@pageproof/sdk-pr 272.0.1603756510939 → 272.0.1604638896835
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 +26 -2
- package/lib/api/Integrations.d.ts +19 -3
- package/lib/api/Integrations.js +1 -1
- package/lib/api/Proofs.d.ts +8 -1
- package/lib/api/Proofs.js +1 -1
- package/lib/api/ProofsIntegrationReferences.d.ts +41 -0
- package/lib/api/ProofsIntegrationReferences.js +1 -0
- package/lib/api/Workflows.d.ts +24 -2
- package/lib/api/Workflows.js +1 -1
- package/lib/api/admin/Team.d.ts +8 -0
- package/lib/api/admin/Team.js +29 -16
- package/lib/api/admin/TeamDashboardGroups.d.ts +4 -4
- package/lib/api/admin/TeamDashboardGroups.js +4 -4
- package/lib/api/admin/TeamFeatures.d.ts +7 -0
- package/lib/api/admin/TeamFeatures.js +5 -0
- package/lib/api/admin/TeamWorkflows.d.ts +19 -0
- package/lib/api/admin/TeamWorkflows.js +63 -0
- package/lib/models/Proof.d.ts +10 -3
- package/lib/models/Proof.js +1 -1
- package/lib/models/ProofGroup.d.ts +2 -2
- package/lib/models/ProofGroup.js +1 -1
- package/lib/models/ProofIntegrationReference.d.ts +33 -0
- package/lib/models/ProofIntegrationReference.js +1 -0
- package/lib/models/TeamAccountFeatures.d.ts +26 -0
- package/lib/models/TeamAccountFeatures.js +1 -0
- package/lib/models/TeamEmailFeatures.d.ts +8 -1
- package/lib/models/TeamEmailFeatures.js +1 -1
- package/lib/models/TeamFeatures.d.ts +8 -0
- package/lib/models/TeamFeatures.js +1 -1
- package/lib/models/Workflow.d.ts +21 -0
- package/lib/models/Workflow.js +1 -1
- package/lib/network/Request.js +1 -1
- package/lib/network/endpoints.json +38 -3
- package/lib/pageproof.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
## 2.0.0-beta.
|
|
4
|
+
## 2.0.0-beta.146
|
|
5
5
|
|
|
6
6
|
Released on the 16th of October 2020.
|
|
7
7
|
|
|
8
|
-
- [[#272](https://github.com/PageProofCom/sdk/pull/272)] Team administrators can now load their team's groups - see [TeamDashboardGroups](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/admin/TeamDashboardGroups.js~TeamDashboardGroups.html).
|
|
8
|
+
- [[#272](https://github.com/PageProofCom/sdk/pull/272)] Team administrators can now load their team's groups - see [TeamDashboardGroups](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/admin/TeamDashboardGroups.js~TeamDashboardGroups.html).
|
|
9
|
+
- The Proof model now contains the team ID, it belongs to ([Proof.teamId](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/Proof.js~Proof.html#instance-member-teamId)).
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## 2.0.0-beta.145
|
|
13
|
+
|
|
14
|
+
Released on the 2nd of November 2020.
|
|
15
|
+
|
|
16
|
+
- [[#279](https://github.com/PageProofCom/sdk/pull/279)] Added Support for sharing a workflow template with team. See [Workflows.create](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Workflows.js~Workflows.html#instance-method-create) and [Workflows.update](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Workflows.js~Workflows.html#instance-method-update).
|
|
17
|
+
- Added support for team admin to get team owned workflow templates [TeamWorkflows.owned](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/admin/TeamWorkflows.js~TeamWorkflows.html#instance-method-owned).
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## 2.0.0-beta.144
|
|
21
|
+
|
|
22
|
+
Released on the 30th of October 2020.
|
|
23
|
+
|
|
24
|
+
- Support for integration references.
|
|
25
|
+
|
|
26
|
+
## 2.0.0-beta.143
|
|
27
|
+
|
|
28
|
+
Released on the 27th of October 2020.
|
|
29
|
+
|
|
30
|
+
- [[#283](https://github.com/PageProofCom/sdk/pull/283)]
|
|
31
|
+
- Support for updating whether using the team name should be used, instead of "PageProof Team" as the from name in emails. See [TeamEmailFeatures](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/TeamEmailFeatures.js~TeamEmailFeatures.html).
|
|
32
|
+
- Support for team account information in team admin API. see [TeamAccountFeatures](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/TeamAccountFeatures.js~TeamAccountFeatures.html).
|
|
9
33
|
|
|
10
34
|
|
|
11
35
|
## 2.0.0-beta.142
|
|
@@ -29,12 +29,28 @@ declare class Integrations extends API {
|
|
|
29
29
|
* const { url, windowFeatures } = await client.profile.integrations.getSetupUrl('monday.com');
|
|
30
30
|
*
|
|
31
31
|
* @since 2.0.0-beta.141
|
|
32
|
-
* @param {string
|
|
33
|
-
* @
|
|
32
|
+
* @param {string} integrationKey The unique identifier for the integration
|
|
33
|
+
* @param {object} [params] Any additional parameters required for building the setup url
|
|
34
|
+
* @returns {Promise<{ url: string, windowFeatures: string }>}
|
|
34
35
|
*/
|
|
35
|
-
getSetupUrl(integrationKey: string
|
|
36
|
+
getSetupUrl(integrationKey: string, params?: any): Promise<{
|
|
36
37
|
url: string;
|
|
37
38
|
windowFeatures: string;
|
|
38
39
|
}>;
|
|
40
|
+
/**
|
|
41
|
+
* Disables an integration
|
|
42
|
+
*
|
|
43
|
+
* @example <caption>Disabling an integration for a team</caption>
|
|
44
|
+
* const admin = await client.admin();
|
|
45
|
+
* await admin.team.integrations.disable('monday.com');
|
|
46
|
+
*
|
|
47
|
+
* @example <caption>Disabling an integration for a user</caption>
|
|
48
|
+
* await client.profile.integrations.disable('monday.com');
|
|
49
|
+
*
|
|
50
|
+
* @since 2.0.0-beta.144
|
|
51
|
+
* @param {string} integrationKey The unique identifier/identifiers for the integration/integrations
|
|
52
|
+
* @returns {Promise}
|
|
53
|
+
*/
|
|
54
|
+
disable(integrationKey: string): Promise<any>;
|
|
39
55
|
}
|
|
40
56
|
import API from "./API";
|
package/lib/api/Integrations.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);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 Integrations=function(_API){_inherits(Integrations,_API);function Integrations(client,level){_classCallCheck(this,Integrations);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.level=level;return _this}Integrations.prototype.configurations=function configurations(){return this.client.request("integrations.get-configurations",{level:this.level}).then(function(response){if(response.data){return response.data.integrations}return null})};Integrations.prototype.getSetupUrl=function getSetupUrl(integrationKey){return this.client.request("integrations.get-setup-url",{integration_key:integrationKey}).then(function(response){return{url:response.data.url,windowFeatures:response.data.windowFeatures}})};return Integrations}(_API3.default);exports.default=Integrations;
|
|
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 _API2=require("./API");var _API3=_interopRequireDefault(_API2);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 Integrations=function(_API){_inherits(Integrations,_API);function Integrations(client,level){_classCallCheck(this,Integrations);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.level=level;return _this}Integrations.prototype.configurations=function configurations(){return this.client.request("integrations.get-configurations",{level:this.level}).then(function(response){if(response.data){return response.data.integrations}return null})};Integrations.prototype.getSetupUrl=function getSetupUrl(integrationKey,params){return this.client.request("integrations.get-setup-url",{params:_extends({},params,{integration_key:integrationKey})}).then(function(response){return{url:response.data.url,windowFeatures:response.data.windowFeatures}})};Integrations.prototype.disable=function disable(integrationKey){return this.client.request("integrations.disable",{level:this.level,integration_key:integrationKey})};return Integrations}(_API3.default);exports.default=Integrations;
|
package/lib/api/Proofs.d.ts
CHANGED
|
@@ -56,6 +56,12 @@ declare class Proofs extends API {
|
|
|
56
56
|
* @type {ProofsCustomTools}
|
|
57
57
|
*/
|
|
58
58
|
customTools: ProofsCustomTools;
|
|
59
|
+
/**
|
|
60
|
+
* The Proofs Integration References API.
|
|
61
|
+
*
|
|
62
|
+
* @type {ProofsIntegrationReferences}
|
|
63
|
+
*/
|
|
64
|
+
integrationReferences: ProofsIntegrationReferences;
|
|
59
65
|
linkCheck: ProofLinkCheck;
|
|
60
66
|
/**
|
|
61
67
|
* Assigns a workflow to a proof.
|
|
@@ -184,7 +190,7 @@ declare class Proofs extends API {
|
|
|
184
190
|
* @param {boolean} [options.start=true] Whether to immediately start the proof (sends invitation emails to reviewers in the workflow)
|
|
185
191
|
* @returns {Promise<Proof>}
|
|
186
192
|
*/
|
|
187
|
-
create({ name, tags, dueDate, messageToReviewers, workflow, workflowTemplate, file, group, previousProof, team, reference, customTools, reminders, owners, canDownload, start, }: {
|
|
193
|
+
create({ name, tags, dueDate, messageToReviewers, workflow, workflowTemplate, file, group, previousProof, team, reference, customTools, integrationReferences, reminders, owners, canDownload, start, }: {
|
|
188
194
|
name: string;
|
|
189
195
|
tags?: string[];
|
|
190
196
|
dueDate?: Date;
|
|
@@ -458,5 +464,6 @@ import ProofsGroups from "./ProofsGroups";
|
|
|
458
464
|
import ProofsAudit from "./ProofsAudit";
|
|
459
465
|
import ProofsAssets from "./ProofsAssets";
|
|
460
466
|
import ProofsCustomTools from "./ProofsCustomTools";
|
|
467
|
+
import ProofsIntegrationReferences from "./ProofsIntegrationReferences";
|
|
461
468
|
import ProofLinkCheck from "./ProofsLinkCheck";
|
|
462
469
|
import Proof from "../models/Proof";
|
package/lib/api/Proofs.js
CHANGED
|
@@ -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 _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 _ProofsAssets=require("./ProofsAssets");var _ProofsAssets2=_interopRequireDefault(_ProofsAssets);var _ProofsCustomTools=require("./ProofsCustomTools");var _ProofsCustomTools2=_interopRequireDefault(_ProofsCustomTools);var _ProofsLinkCheck=require("./ProofsLinkCheck");var _ProofsLinkCheck2=_interopRequireDefault(_ProofsLinkCheck);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _Reminders=require("./Reminders");var _Reminders2=_interopRequireDefault(_Reminders);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}function transformProofsForUpdate(proofs){var proofsArrForUpdate=[].concat(proofs);proofsArrForUpdate.forEach(function(proof){proof.proofId=proof.id;delete proof.id});return proofsArrForUpdate}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);_this.assets=new _ProofsAssets2.default(client);_this.customTools=new _ProofsCustomTools2.default(client);_this.linkCheck=new _ProofsLinkCheck2.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,workflowTemplate=_ref.workflowTemplate,file=_ref.file,group=_ref.group,previousProof=_ref.previousProof,team=_ref.team,reference=_ref.reference,customTools=_ref.customTools,_ref$reminders=_ref.reminders,reminders=_ref$reminders===undefined?[]:_ref$reminders,owners=_ref.owners,canDownload=_ref.canDownload,_ref$start=_ref.start,start=_ref$start===undefined?true:_ref$start;return this.client.request("proofs.create",{proof:{name:name,tags:tags,dueDate:dueDate.toISOString(),messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,workflowTemplateId:workflowTemplate&&workflowTemplate.id||undefined,fileId:file&&file.id||undefined,groupId:group&&group.id||undefined,previousProofId:previousProof&&previousProof.id||undefined,teamSlug:team&&team.slug||undefined,reference:reference,reminders:[].concat(reminders),owners:owners,canDownload:canDownload,start:start}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();if(customTools&&!previousProof){return _this4.customTools.update(proof.id,customTools).then(function(){return proof})}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.generateEmail=function generateEmail(proofId){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return this.client.request("email.proofs.generate",_extends({proofId:proofId},options)).then(function(response){return response.data})};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})};Proofs.prototype.returnTodos=function returnTodos(proofIdOrIds,_ref2){var messageToOwners=_ref2.messageToOwners,_ref2$markCommentsAsT=_ref2.markCommentsAsTodo,markCommentsAsTodo=_ref2$markCommentsAsT===undefined?false:_ref2$markCommentsAsT;return this.client.request("proofs.return-todos",{proofIds:[].concat(proofIdOrIds),messageToOwners:messageToOwners,markCommentAsTodo:markCommentsAsTodo})};Proofs.prototype.updateDecision=function updateDecision(proofId,decision){return this.client.request("proofs.update-decision",{proofId:proofId,decision:decision})};Proofs.prototype.update=function update(proofOrProofs){if(proofOrProofs.length===1||typeof proofOrProofs.length==="undefined"){var _concat$=[].concat(proofOrProofs)[0],id=_concat$.id,name=_concat$.name,tags=_concat$.tags,dueDate=_concat$.dueDate,messageToReviewers=_concat$.messageToReviewers,workflow=_concat$.workflow,file=_concat$.file,reference=_concat$.reference,reminders=_concat$.reminders,owners=_concat$.owners,canDownload=_concat$.canDownload,start=_concat$.start;return this.client.request("proofs.update",{proof:{id:id,name:name,tags:tags,dueDate:dueDate?dueDate.toISOString():undefined,messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,fileId:file&&file.id||undefined,reference:reference,reminders:reminders?[].concat(reminders):undefined,owners:owners,canDownload:canDownload,start:start}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();return proof})}return this.client.request("proofs.bulk-update",{proofs:transformProofsForUpdate(proofOrProofs)})};Proofs.prototype.next=function next(proofId){return this.client.request("proofs.next",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};return Proofs}(_API3.default);exports.default=Proofs;
|
|
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 _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 _ProofsAssets=require("./ProofsAssets");var _ProofsAssets2=_interopRequireDefault(_ProofsAssets);var _ProofsCustomTools=require("./ProofsCustomTools");var _ProofsCustomTools2=_interopRequireDefault(_ProofsCustomTools);var _ProofsIntegrationReferences=require("./ProofsIntegrationReferences");var _ProofsIntegrationReferences2=_interopRequireDefault(_ProofsIntegrationReferences);var _ProofsLinkCheck=require("./ProofsLinkCheck");var _ProofsLinkCheck2=_interopRequireDefault(_ProofsLinkCheck);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _Reminders=require("./Reminders");var _Reminders2=_interopRequireDefault(_Reminders);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}function transformProofsForUpdate(proofs){var proofsArrForUpdate=[].concat(proofs);proofsArrForUpdate.forEach(function(proof){proof.proofId=proof.id;delete proof.id});return proofsArrForUpdate}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);_this.assets=new _ProofsAssets2.default(client);_this.customTools=new _ProofsCustomTools2.default(client);_this.integrationReferences=new _ProofsIntegrationReferences2.default(client);_this.linkCheck=new _ProofsLinkCheck2.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,workflowTemplate=_ref.workflowTemplate,file=_ref.file,group=_ref.group,previousProof=_ref.previousProof,team=_ref.team,reference=_ref.reference,customTools=_ref.customTools,integrationReferences=_ref.integrationReferences,_ref$reminders=_ref.reminders,reminders=_ref$reminders===undefined?[]:_ref$reminders,owners=_ref.owners,canDownload=_ref.canDownload,_ref$start=_ref.start,start=_ref$start===undefined?true:_ref$start;return this.client.request("proofs.create",{proof:{name:name,tags:tags,dueDate:dueDate.toISOString(),messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,workflowTemplateId:workflowTemplate&&workflowTemplate.id||undefined,fileId:file&&file.id||undefined,groupId:group&&group.id||undefined,previousProofId:previousProof&&previousProof.id||undefined,teamSlug:team&&team.slug||undefined,reference:reference,integrationReferences:integrationReferences,reminders:[].concat(reminders),owners:owners,canDownload:canDownload,start:start}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();if(customTools&&!previousProof){return _this4.customTools.update(proof.id,customTools).then(function(){return proof})}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.generateEmail=function generateEmail(proofId){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return this.client.request("email.proofs.generate",_extends({proofId:proofId},options)).then(function(response){return response.data})};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})};Proofs.prototype.returnTodos=function returnTodos(proofIdOrIds,_ref2){var messageToOwners=_ref2.messageToOwners,_ref2$markCommentsAsT=_ref2.markCommentsAsTodo,markCommentsAsTodo=_ref2$markCommentsAsT===undefined?false:_ref2$markCommentsAsT;return this.client.request("proofs.return-todos",{proofIds:[].concat(proofIdOrIds),messageToOwners:messageToOwners,markCommentAsTodo:markCommentsAsTodo})};Proofs.prototype.updateDecision=function updateDecision(proofId,decision){return this.client.request("proofs.update-decision",{proofId:proofId,decision:decision})};Proofs.prototype.update=function update(proofOrProofs){if(proofOrProofs.length===1||typeof proofOrProofs.length==="undefined"){var _concat$=[].concat(proofOrProofs)[0],id=_concat$.id,name=_concat$.name,tags=_concat$.tags,dueDate=_concat$.dueDate,messageToReviewers=_concat$.messageToReviewers,workflow=_concat$.workflow,file=_concat$.file,reference=_concat$.reference,integrationReferences=_concat$.integrationReferences,reminders=_concat$.reminders,owners=_concat$.owners,canDownload=_concat$.canDownload,start=_concat$.start;return this.client.request("proofs.update",{proof:{id:id,name:name,tags:tags,dueDate:dueDate?dueDate.toISOString():undefined,messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,fileId:file&&file.id||undefined,reference:reference,integrationReferences:integrationReferences,reminders:reminders?[].concat(reminders):undefined,owners:owners,canDownload:canDownload,start:start}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();return proof})}return this.client.request("proofs.bulk-update",{proofs:transformProofsForUpdate(proofOrProofs)})};Proofs.prototype.next=function next(proofId){return this.client.request("proofs.next",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};return Proofs}(_API3.default);exports.default=Proofs;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export default ProofsIntegrationReferences;
|
|
2
|
+
declare class ProofsIntegrationReferences extends API {
|
|
3
|
+
constructor(client: any);
|
|
4
|
+
/**
|
|
5
|
+
* Gets the integrations that a user is able to reference
|
|
6
|
+
*
|
|
7
|
+
* @example <caption>Retrieving integrations that can be referenced by a user</caption>
|
|
8
|
+
* const availableIntegrations = await client.proofs.integrationReferences.availableIntegrations()
|
|
9
|
+
*
|
|
10
|
+
* @since 2.0.0-beta.144
|
|
11
|
+
* @returns {Promise<Array<object>>}
|
|
12
|
+
*/
|
|
13
|
+
availableIntegrations(): Promise<any[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Gets the options for what a user can reference in an integration
|
|
16
|
+
*
|
|
17
|
+
* @since 2.0.0-beta.144
|
|
18
|
+
* @param {string} integrationKey The unique identifier for the integration
|
|
19
|
+
* @returns {Promise<Array<object>>}
|
|
20
|
+
*/
|
|
21
|
+
options(key: any): Promise<any[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Add an integration reference to a proof
|
|
24
|
+
*
|
|
25
|
+
* @since 2.0.0-beta.144
|
|
26
|
+
* @param {string} proofId The proof id
|
|
27
|
+
* @param {object} integrationReference The integration reference option to add to a proof
|
|
28
|
+
* @returns {Promise}
|
|
29
|
+
*/
|
|
30
|
+
add(proofId: string, integrationReference: any): Promise<any>;
|
|
31
|
+
/**
|
|
32
|
+
* Remove an integration reference from a proof
|
|
33
|
+
*
|
|
34
|
+
* @since 2.0.0-beta.144
|
|
35
|
+
* @param {string} proofId The proof id
|
|
36
|
+
* @param {string} referenceId The integration reference option referenceId
|
|
37
|
+
* @returns {Promise}
|
|
38
|
+
*/
|
|
39
|
+
remove(proofId: string, referenceId: string): Promise<any>;
|
|
40
|
+
}
|
|
41
|
+
import API from "./API";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);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 ProofsIntegrationReferences=function(_API){_inherits(ProofsIntegrationReferences,_API);function ProofsIntegrationReferences(){_classCallCheck(this,ProofsIntegrationReferences);return _possibleConstructorReturn(this,_API.apply(this,arguments))}ProofsIntegrationReferences.prototype.availableIntegrations=function availableIntegrations(){return this.client.request("integrations.get-available-reference-integrations").then(function(response){return response.data.integrations})};ProofsIntegrationReferences.prototype.options=function options(key){return this.client.request("integrations.get-available-reference-options",{integration_key:key}).then(function(response){return response.data.optionTypes})};ProofsIntegrationReferences.prototype.add=function add(proofId,integrationReference){return this.client.request("integrations.proof-integration-references.add",{proofId:proofId,integrationReference:integrationReference})};ProofsIntegrationReferences.prototype.remove=function remove(proofId,referenceId){return this.client.request("integrations.proof-integration-references.remove",{proofId:proofId,referenceId:referenceId})};return ProofsIntegrationReferences}(_API3.default);exports.default=ProofsIntegrationReferences;
|
package/lib/api/Workflows.d.ts
CHANGED
|
@@ -165,15 +165,17 @@ declare class Workflows extends API {
|
|
|
165
165
|
* @param {Array<WorkflowUserDefinition>} options.reviewers A list of reviewers placed into a single step together (instead of steps)
|
|
166
166
|
* @param {Array<OwnerUserDefinition>} options.owners A list of users that will be made owners of proofs this workflow template is attached to
|
|
167
167
|
* @param {WorkflowUserDefinition} options.approver The approver user
|
|
168
|
+
* @param {boolean} [options.isOwnedByTeam] For workflow templates, or when `save` is `true`, if workflow template can be used by all team members.
|
|
168
169
|
* @returns {Promise<Workflow>}
|
|
169
170
|
*/
|
|
170
|
-
create({ save, name, steps: _steps, reviewers, approver, owners, }: {
|
|
171
|
+
create({ save, name, steps: _steps, reviewers, approver, owners, isOwnedByTeam, }: {
|
|
171
172
|
save?: boolean;
|
|
172
173
|
name?: string;
|
|
173
174
|
steps: WorkflowStepDefinition[];
|
|
174
175
|
reviewers: WorkflowUserDefinition[];
|
|
175
176
|
owners: OwnerUserDefinition[];
|
|
176
177
|
approver: WorkflowUserDefinition;
|
|
178
|
+
isOwnedByTeam?: boolean;
|
|
177
179
|
}): Promise<Workflow>;
|
|
178
180
|
/**
|
|
179
181
|
* Loads a workflow/workflow template (by it's id).
|
|
@@ -310,12 +312,32 @@ declare class Workflows extends API {
|
|
|
310
312
|
* @returns {Promise}
|
|
311
313
|
*/
|
|
312
314
|
replaceApprover(workflowIdOrIds: string | string[], user: ApproverUserDefinition): Promise<any>;
|
|
315
|
+
/**
|
|
316
|
+
* Updates workflow template.
|
|
317
|
+
*
|
|
318
|
+
* @example <caption>Updating workflow template name</caption>
|
|
319
|
+
* await client.workflows.update(workflowId, { name: 'Updated workflow name' });
|
|
320
|
+
*
|
|
321
|
+
* @example <caption>Updating workflow template isOwnedByTeam flag</caption>
|
|
322
|
+
* await client.workflows.update(workflowId, { isOwnedByTeam: true });
|
|
323
|
+
*
|
|
324
|
+
* @since v2.0.0-beta.145
|
|
325
|
+
* @param {string} workflowId The workflow id to update workflow template
|
|
326
|
+
* @param {object} options The options
|
|
327
|
+
* @param {string} [options.name] The name to update
|
|
328
|
+
* @param {boolean} [options.isOwnedByTeam] If template can be used by team members
|
|
329
|
+
* @returns {Promise<Workflow>}
|
|
330
|
+
*/
|
|
331
|
+
update(workflowId: string, { name, isOwnedByTeam, }: {
|
|
332
|
+
name?: string;
|
|
333
|
+
isOwnedByTeam?: boolean;
|
|
334
|
+
}): Promise<Workflow>;
|
|
313
335
|
/** @private */
|
|
314
336
|
_duplicateWorkflow(workflowId: any, options: any): any;
|
|
315
337
|
/** @private */
|
|
316
338
|
_deleteWorkflow(workflowId: any): any;
|
|
317
339
|
/** @private */
|
|
318
|
-
_createWorkflow(name: any): any;
|
|
340
|
+
_createWorkflow(name: any, isOwnedByTeam: any): any;
|
|
319
341
|
/** @private */
|
|
320
342
|
_addWorkflowStepAndUsers(workflowId: any, step: any, start: any): any;
|
|
321
343
|
/** @private */
|
package/lib/api/Workflows.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Workflow=require("../models/Workflow");var _Workflow2=_interopRequireDefault(_Workflow);var _WorkflowStep=require("../models/WorkflowStep");var _WorkflowStep2=_interopRequireDefault(_WorkflowStep);var _WorkflowUser=require("../models/WorkflowUser");var _WorkflowUser2=_interopRequireDefault(_WorkflowUser);var _id=require("../util/id");var _WorkflowsSteps=require("./WorkflowsSteps");var _WorkflowsSteps2=_interopRequireDefault(_WorkflowsSteps);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 hasEnoughUserDetails(workflowUser){return workflowUser&&((0,_id.isUserId)(workflowUser.id)||workflowUser.email)}function transformWorkflows(workflows){return(workflows||[]).map(function(workflowData){return(new _Workflow2.default).fromWorkflow(workflowData)})}var Workflows=function(_API){_inherits(Workflows,_API);function Workflows(client){_classCallCheck(this,Workflows);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.steps=new _WorkflowsSteps2.default(client);return _this}Workflows.prototype.create=function create(_ref){var _this2=this;var _ref$save=_ref.save,save=_ref$save===undefined?false:_ref$save,name=_ref.name,_ref$steps=_ref.steps,_steps=_ref$steps===undefined?[]:_ref$steps,reviewers=_ref.reviewers,approver=_ref.approver,owners=_ref.owners;if(!hasEnoughUserDetails(approver)){return Promise.reject(Error("An approver is required to create a workflow."))}if(save&&!name){return Promise.reject(Error("A workflow must have a name when saving it as a workflow template."))}var steps=_steps;if(reviewers&&reviewers.length){steps.splice(0,0,{users:reviewers})}if(approver){steps.push({position:1e3,users:[approver],start:approver.start})}var largestPosition=0;for(var i=0;i<steps.length;i++){var step=steps[i];step.users=step.users||[];if(!step.position||step.position<largestPosition){step.position=largestPosition+1}largestPosition=Math.max(largestPosition,step.position);for(var ii=0;ii<step.users.length;ii++){var user=step.users[ii];if(!hasEnoughUserDetails(user)){return Promise.reject(Error("A user id or email address must be provided for a workflow user."))}}}var workflowId=void 0;return this._createWorkflow(name).then(function(workflow){workflowId=workflow.id;return Promise.all([workflow,Promise.all(steps.map(function(step){var workflowStep=workflow.getStepByPosition(step.position);return workflowStep?_this2._setWorkflowStepUsersMutate(workflow.id,workflowStep,step.users,step.start):_this2._addWorkflowStepAndUsers(workflow.id,step,step.start)})),owners&&Promise.all(owners.map(function(owner){return _this2._addProofOwnerToWorkflowTemplate(workflowId,owner)}))])}).then(function(_ref2){var workflow=_ref2[0],workflowSteps=_ref2[1];workflow.steps=workflowSteps;return workflow}).then(function(workflow){if(save){return _this2._duplicateWorkflow(workflowId)}return workflow}).catch(function(err){return Promise.resolve(workflowId&&_this2._deleteWorkflow(workflowId)).then(function(){return Promise.reject(err)})})};Workflows.prototype.load=function load(workflowId){return this.client.request("workflows.load",{workflowId:workflowId}).then(function(response){return(new _Workflow2.default).fromWorkflow(response.data)})};Workflows.prototype.use=function use(workflowId,options){return this.duplicate(workflowId,options)};Workflows.prototype.duplicate=function duplicate(workflowId,options){return this._duplicateWorkflow(workflowId,options)};Workflows.prototype.delete=function _delete(workflowId){return this._deleteWorkflow(workflowId)};Workflows.prototype.all=function all(){return Promise.all([this.owned(),this.shared()]).then(function(_ref3){var owned=_ref3[0],shared=_ref3[1];return[].concat(owned,shared)})};Workflows.prototype.owned=function owned(){return this.client.request("workflows.owned").then(function(response){return transformWorkflows(response.data)})};Workflows.prototype.shared=function shared(){return this.client.request("workflows.shared").then(function(response){return transformWorkflows(response.data)})};Workflows.prototype.setApprover=function setApprover(workflowId,user){return this.client.request("workflows.users.set",{workflowId:workflowId,position:1e3,users:[user]})};Workflows.prototype.skipAll=function skipAll(workflowId){return this.client.request("workflows.users.skip-all",{workflowId:workflowId})};Workflows.prototype.setStartingStep=function setStartingStep(workflowId,stepId){return this.client.request("workflows.set-starting-step",{workflowId:workflowId,stepId:stepId})};Workflows.prototype.replaceApprover=function replaceApprover(workflowIdOrIds,user){return this.client.request("workflows.replace-approver",{workflowIds:[].concat(workflowIdOrIds),user:user})};Workflows.prototype._duplicateWorkflow=function _duplicateWorkflow(workflowId,options){var _this3=this;return this.client.request("workflows.duplicate",{workflowId:workflowId,noOwners:options&&options.includeOwners===false?true:undefined}).then(function(response){var duplicatedWorkflowId=response.data.WorkflowId;return _this3.load(duplicatedWorkflowId)})};Workflows.prototype._deleteWorkflow=function _deleteWorkflow(workflowId){return this.client.request("workflows.delete",{workflowId:workflowId})};Workflows.prototype._createWorkflow=function _createWorkflow(name){return this.client.request("workflows.create",{title:name}).then(function(response){return(new _Workflow2.default).fromWorkflow(response.data)})};Workflows.prototype._addWorkflowStepAndUsers=function _addWorkflowStepAndUsers(workflowId,step,start){var _this4=this;return this.client.request("workflows.steps.add",{workflowId:workflowId,title:step.name,position:step.position}).then(function(response){var workflowStep=(new _WorkflowStep2.default).fromWorkflowStep(response.data);return _this4._setWorkflowStepUsersMutate(workflowId,workflowStep,step.users,start)})};Workflows.prototype._setWorkflowStepUsersMutate=function _setWorkflowStepUsersMutate(workflowId,workflowStep,users,start){var _this5=this;return this.client.request("workflows.users.set",{workflowId:workflowId,stepId:workflowStep.id,users:users.map(function(user){return{email:user.email,userId:user.id,role:user.role,permissions:user.permissions&&{inviter:!!user.permissions.inviter}}})}).then(function(response){var workflowUsers=response.data.map(function(user){return(new _WorkflowUser2.default).fromWorkflowUser(user)});workflowStep.users=workflowUsers}).then(function(){if(start===true){return _this5.setStartingStep(workflowId,workflowStep.id).then(function(){return workflowStep})}return workflowStep})};Workflows.prototype._addProofOwnerToWorkflowTemplate=function _addProofOwnerToWorkflowTemplate(workflowId,user){return this.client.request("workflows.proof-owners.add",{relatedId:workflowId,workflowCopyToProof:1,userId:user.id,email:user.email})};return Workflows}(_API3.default);exports.default=Workflows;
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Workflow=require("../models/Workflow");var _Workflow2=_interopRequireDefault(_Workflow);var _WorkflowStep=require("../models/WorkflowStep");var _WorkflowStep2=_interopRequireDefault(_WorkflowStep);var _WorkflowUser=require("../models/WorkflowUser");var _WorkflowUser2=_interopRequireDefault(_WorkflowUser);var _id=require("../util/id");var _WorkflowsSteps=require("./WorkflowsSteps");var _WorkflowsSteps2=_interopRequireDefault(_WorkflowsSteps);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 hasEnoughUserDetails(workflowUser){return workflowUser&&((0,_id.isUserId)(workflowUser.id)||workflowUser.email)}function transformWorkflows(workflows){return(workflows||[]).map(function(workflowData){return(new _Workflow2.default).fromWorkflow(workflowData)})}var Workflows=function(_API){_inherits(Workflows,_API);function Workflows(client){_classCallCheck(this,Workflows);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.steps=new _WorkflowsSteps2.default(client);return _this}Workflows.prototype.create=function create(_ref){var _this2=this;var _ref$save=_ref.save,save=_ref$save===undefined?false:_ref$save,name=_ref.name,_ref$steps=_ref.steps,_steps=_ref$steps===undefined?[]:_ref$steps,reviewers=_ref.reviewers,approver=_ref.approver,owners=_ref.owners,_ref$isOwnedByTeam=_ref.isOwnedByTeam,isOwnedByTeam=_ref$isOwnedByTeam===undefined?false:_ref$isOwnedByTeam;if(!hasEnoughUserDetails(approver)){return Promise.reject(Error("An approver is required to create a workflow."))}if(save&&!name){return Promise.reject(Error("A workflow must have a name when saving it as a workflow template."))}var steps=_steps;if(reviewers&&reviewers.length){steps.splice(0,0,{users:reviewers})}if(approver){steps.push({position:1e3,users:[approver],start:approver.start})}var largestPosition=0;for(var i=0;i<steps.length;i++){var step=steps[i];step.users=step.users||[];if(!step.position||step.position<largestPosition){step.position=largestPosition+1}largestPosition=Math.max(largestPosition,step.position);for(var ii=0;ii<step.users.length;ii++){var user=step.users[ii];if(!hasEnoughUserDetails(user)){return Promise.reject(Error("A user id or email address must be provided for a workflow user."))}}}var workflowId=void 0;return this._createWorkflow(name,isOwnedByTeam).then(function(workflow){workflowId=workflow.id;return Promise.all([workflow,Promise.all(steps.map(function(step){var workflowStep=workflow.getStepByPosition(step.position);return workflowStep?_this2._setWorkflowStepUsersMutate(workflow.id,workflowStep,step.users,step.start):_this2._addWorkflowStepAndUsers(workflow.id,step,step.start)})),owners&&Promise.all(owners.map(function(owner){return _this2._addProofOwnerToWorkflowTemplate(workflowId,owner)}))])}).then(function(_ref2){var workflow=_ref2[0],workflowSteps=_ref2[1];workflow.steps=workflowSteps;return workflow}).then(function(workflow){if(save){return _this2._duplicateWorkflow(workflowId)}return workflow}).catch(function(err){return Promise.resolve(workflowId&&_this2._deleteWorkflow(workflowId)).then(function(){return Promise.reject(err)})})};Workflows.prototype.load=function load(workflowId){return this.client.request("workflows.load",{workflowId:workflowId}).then(function(response){return(new _Workflow2.default).fromWorkflow(response.data)})};Workflows.prototype.use=function use(workflowId,options){return this.duplicate(workflowId,options)};Workflows.prototype.duplicate=function duplicate(workflowId,options){return this._duplicateWorkflow(workflowId,options)};Workflows.prototype.delete=function _delete(workflowId){return this._deleteWorkflow(workflowId)};Workflows.prototype.all=function all(){return Promise.all([this.owned(),this.shared()]).then(function(_ref3){var owned=_ref3[0],shared=_ref3[1];return[].concat(owned,shared)})};Workflows.prototype.owned=function owned(){return this.client.request("workflows.owned").then(function(response){return transformWorkflows(response.data)})};Workflows.prototype.shared=function shared(){return this.client.request("workflows.shared").then(function(response){return transformWorkflows(response.data)})};Workflows.prototype.setApprover=function setApprover(workflowId,user){return this.client.request("workflows.users.set",{workflowId:workflowId,position:1e3,users:[user]})};Workflows.prototype.skipAll=function skipAll(workflowId){return this.client.request("workflows.users.skip-all",{workflowId:workflowId})};Workflows.prototype.setStartingStep=function setStartingStep(workflowId,stepId){return this.client.request("workflows.set-starting-step",{workflowId:workflowId,stepId:stepId})};Workflows.prototype.replaceApprover=function replaceApprover(workflowIdOrIds,user){return this.client.request("workflows.replace-approver",{workflowIds:[].concat(workflowIdOrIds),user:user})};Workflows.prototype.update=function update(workflowId,_ref4){var name=_ref4.name,isOwnedByTeam=_ref4.isOwnedByTeam;return this.client.request("workflows.update",{workflowId:workflowId,title:name,ownedByTeam:isOwnedByTeam}).then(function(response){return(new _Workflow2.default).fromWorkflow(response.data)})};Workflows.prototype._duplicateWorkflow=function _duplicateWorkflow(workflowId,options){var _this3=this;return this.client.request("workflows.duplicate",{workflowId:workflowId,noOwners:options&&options.includeOwners===false?true:undefined}).then(function(response){var duplicatedWorkflowId=response.data.WorkflowId;return _this3.load(duplicatedWorkflowId)})};Workflows.prototype._deleteWorkflow=function _deleteWorkflow(workflowId){return this.client.request("workflows.delete",{workflowId:workflowId})};Workflows.prototype._createWorkflow=function _createWorkflow(name,isOwnedByTeam){return this.client.request("workflows.create",{title:name,ownedByTeam:isOwnedByTeam}).then(function(response){return(new _Workflow2.default).fromWorkflow(response.data)})};Workflows.prototype._addWorkflowStepAndUsers=function _addWorkflowStepAndUsers(workflowId,step,start){var _this4=this;return this.client.request("workflows.steps.add",{workflowId:workflowId,title:step.name,position:step.position}).then(function(response){var workflowStep=(new _WorkflowStep2.default).fromWorkflowStep(response.data);return _this4._setWorkflowStepUsersMutate(workflowId,workflowStep,step.users,start)})};Workflows.prototype._setWorkflowStepUsersMutate=function _setWorkflowStepUsersMutate(workflowId,workflowStep,users,start){var _this5=this;return this.client.request("workflows.users.set",{workflowId:workflowId,stepId:workflowStep.id,users:users.map(function(user){return{email:user.email,userId:user.id,role:user.role,permissions:user.permissions&&{inviter:!!user.permissions.inviter}}})}).then(function(response){var workflowUsers=response.data.map(function(user){return(new _WorkflowUser2.default).fromWorkflowUser(user)});workflowStep.users=workflowUsers}).then(function(){if(start===true){return _this5.setStartingStep(workflowId,workflowStep.id).then(function(){return workflowStep})}return workflowStep})};Workflows.prototype._addProofOwnerToWorkflowTemplate=function _addProofOwnerToWorkflowTemplate(workflowId,user){return this.client.request("workflows.proof-owners.add",{relatedId:workflowId,workflowCopyToProof:1,userId:user.id,email:user.email})};return Workflows}(_API3.default);exports.default=Workflows;
|
package/lib/api/admin/Team.d.ts
CHANGED
|
@@ -50,6 +50,13 @@ declare class Team extends API {
|
|
|
50
50
|
* @type {TeamCustomTools}
|
|
51
51
|
*/
|
|
52
52
|
customTools: TeamCustomTools;
|
|
53
|
+
/**
|
|
54
|
+
* The Admin Team Workflows API.
|
|
55
|
+
*
|
|
56
|
+
* @since v2.0.0-beta.145
|
|
57
|
+
* @type {TeamWorkflows}
|
|
58
|
+
*/
|
|
59
|
+
workflows: TeamWorkflows;
|
|
53
60
|
}
|
|
54
61
|
import API from "../API";
|
|
55
62
|
import TeamUsers from "./TeamUsers";
|
|
@@ -60,3 +67,4 @@ import TeamCustomWebhooks from "./TeamCustomWebhooks";
|
|
|
60
67
|
import TeamSCIM from "./TeamSCIM";
|
|
61
68
|
import Integrations from "../Integrations";
|
|
62
69
|
import TeamCustomTools from "./TeamCustomTools";
|
|
70
|
+
import TeamWorkflows from "./TeamWorkflows";
|
package/lib/api/admin/Team.js
CHANGED
|
@@ -30,6 +30,10 @@ var _TeamSCIM = require('./TeamSCIM');
|
|
|
30
30
|
|
|
31
31
|
var _TeamSCIM2 = _interopRequireDefault(_TeamSCIM);
|
|
32
32
|
|
|
33
|
+
var _TeamWorkflows = require('./TeamWorkflows');
|
|
34
|
+
|
|
35
|
+
var _TeamWorkflows2 = _interopRequireDefault(_TeamWorkflows);
|
|
36
|
+
|
|
33
37
|
var _Integrations = require('../Integrations');
|
|
34
38
|
|
|
35
39
|
var _Integrations2 = _interopRequireDefault(_Integrations);
|
|
@@ -57,29 +61,30 @@ var Team = function (_API) {
|
|
|
57
61
|
|
|
58
62
|
|
|
59
63
|
/**
|
|
60
|
-
* The Admin Team
|
|
64
|
+
* The Admin Team Custom Tools API.
|
|
61
65
|
*
|
|
62
|
-
* @type {
|
|
66
|
+
* @type {TeamCustomTools}
|
|
63
67
|
*/
|
|
64
68
|
|
|
65
69
|
|
|
66
70
|
/**
|
|
67
|
-
* The Admin
|
|
71
|
+
* The Admin Team SCIM API.
|
|
68
72
|
*
|
|
69
|
-
* @type {
|
|
73
|
+
* @type {TeamSCIM}
|
|
70
74
|
*/
|
|
71
75
|
|
|
72
76
|
|
|
73
77
|
/**
|
|
74
|
-
* The Admin Team
|
|
78
|
+
* The Admin Team Preferences API.
|
|
75
79
|
*
|
|
76
|
-
* @type {
|
|
80
|
+
* @type {TeamPreferences}
|
|
77
81
|
*/
|
|
78
82
|
|
|
83
|
+
|
|
79
84
|
/**
|
|
80
|
-
* The Admin Team
|
|
85
|
+
* The Admin Team Dashboard API.
|
|
81
86
|
*
|
|
82
|
-
* @type {
|
|
87
|
+
* @type {TeamDashboard}
|
|
83
88
|
*/
|
|
84
89
|
function Team(client) {
|
|
85
90
|
_classCallCheck(this, Team);
|
|
@@ -93,36 +98,44 @@ var Team = function (_API) {
|
|
|
93
98
|
_this.preferences = new _TeamPreferences2.default(client);
|
|
94
99
|
_this.customWebhooks = new _TeamCustomWebhooks2.default(client);
|
|
95
100
|
_this.scim = new _TeamSCIM2.default(client);
|
|
101
|
+
_this.workflows = new _TeamWorkflows2.default(client);
|
|
96
102
|
_this.integrations = new _Integrations2.default(client, 'team');
|
|
97
103
|
_this.customTools = new _TeamCustomTools2.default(client);
|
|
98
104
|
return _this;
|
|
99
105
|
}
|
|
100
106
|
|
|
101
107
|
/**
|
|
102
|
-
* The Admin Team
|
|
108
|
+
* The Admin Team Workflows API.
|
|
103
109
|
*
|
|
104
|
-
* @
|
|
110
|
+
* @since v2.0.0-beta.145
|
|
111
|
+
* @type {TeamWorkflows}
|
|
105
112
|
*/
|
|
106
113
|
|
|
107
114
|
|
|
108
115
|
/**
|
|
109
|
-
* The Admin Team
|
|
116
|
+
* The Admin Team Integrations API.
|
|
110
117
|
*
|
|
111
|
-
* @type {
|
|
118
|
+
* @type {Integrations}
|
|
112
119
|
*/
|
|
113
120
|
|
|
114
121
|
|
|
115
122
|
/**
|
|
116
|
-
* The Admin
|
|
123
|
+
* The Admin Custom Webhooks API.
|
|
117
124
|
*
|
|
118
|
-
* @type {
|
|
125
|
+
* @type {TeamCustomWebhooks}
|
|
119
126
|
*/
|
|
120
127
|
|
|
121
128
|
|
|
122
129
|
/**
|
|
123
|
-
* The Admin Team
|
|
130
|
+
* The Admin Team Features API.
|
|
124
131
|
*
|
|
125
|
-
* @type {
|
|
132
|
+
* @type {TeamFeatures}
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The Admin Team Users API.
|
|
137
|
+
*
|
|
138
|
+
* @type {TeamUsers}
|
|
126
139
|
*/
|
|
127
140
|
|
|
128
141
|
|
|
@@ -5,7 +5,7 @@ declare class TeamDashboardGroups extends API {
|
|
|
5
5
|
* Loads all groups info for current authenticated team dashboard, based on filter
|
|
6
6
|
*
|
|
7
7
|
* @private
|
|
8
|
-
* @since v2.0.0-beta.
|
|
8
|
+
* @since v2.0.0-beta.146
|
|
9
9
|
* @param {string} filterBy filter name for getting all groups of a user
|
|
10
10
|
* @returns {Promise}
|
|
11
11
|
*/
|
|
@@ -18,7 +18,7 @@ declare class TeamDashboardGroups extends API {
|
|
|
18
18
|
* const teamGroup = await admin.team.dashboard.groups.load('GVNM8NTI1VSTCRN5');
|
|
19
19
|
* console.log('Team's group data: ', teamGroup); // {ProofGroup}
|
|
20
20
|
*
|
|
21
|
-
* @since v2.0.0-beta.
|
|
21
|
+
* @since v2.0.0-beta.146
|
|
22
22
|
* @param {string} groupId The group id
|
|
23
23
|
* @returns {Promise<ProofGroup>}
|
|
24
24
|
*/
|
|
@@ -31,7 +31,7 @@ declare class TeamDashboardGroups extends API {
|
|
|
31
31
|
* const currentGroupsForTeam = await admin.team.dashboard.groups.current();
|
|
32
32
|
* console.log(currentGroupsForTeam); // [ProofGroup, ProofGroup, ...]
|
|
33
33
|
*
|
|
34
|
-
* @since v2.0.0-beta.
|
|
34
|
+
* @since v2.0.0-beta.146
|
|
35
35
|
* @returns {Promise<Array<ProofGroup>>}
|
|
36
36
|
*/
|
|
37
37
|
current(): Promise<any[]>;
|
|
@@ -43,7 +43,7 @@ declare class TeamDashboardGroups extends API {
|
|
|
43
43
|
* const archivedGroupsForTeam = await admin.team.dashboard.groups.archived();
|
|
44
44
|
* console.log(archivedGroupsForTeam); // [ProofGroup, ProofGroup, ...]
|
|
45
45
|
*
|
|
46
|
-
* @since v2.0.0-beta.
|
|
46
|
+
* @since v2.0.0-beta.146
|
|
47
47
|
* @returns {Promise<Array<ProofGroup>>}
|
|
48
48
|
*/
|
|
49
49
|
archived(): Promise<any[]>;
|
|
@@ -41,7 +41,7 @@ var TeamDashboardGroups = function (_API) {
|
|
|
41
41
|
* Loads all groups info for current authenticated team dashboard, based on filter
|
|
42
42
|
*
|
|
43
43
|
* @private
|
|
44
|
-
* @since v2.0.0-beta.
|
|
44
|
+
* @since v2.0.0-beta.146
|
|
45
45
|
* @param {string} filterBy filter name for getting all groups of a user
|
|
46
46
|
* @returns {Promise}
|
|
47
47
|
*/
|
|
@@ -61,7 +61,7 @@ var TeamDashboardGroups = function (_API) {
|
|
|
61
61
|
* const teamGroup = await admin.team.dashboard.groups.load('GVNM8NTI1VSTCRN5');
|
|
62
62
|
* console.log('Team's group data: ', teamGroup); // {ProofGroup}
|
|
63
63
|
*
|
|
64
|
-
* @since v2.0.0-beta.
|
|
64
|
+
* @since v2.0.0-beta.146
|
|
65
65
|
* @param {string} groupId The group id
|
|
66
66
|
* @returns {Promise<ProofGroup>}
|
|
67
67
|
*/
|
|
@@ -81,7 +81,7 @@ var TeamDashboardGroups = function (_API) {
|
|
|
81
81
|
* const currentGroupsForTeam = await admin.team.dashboard.groups.current();
|
|
82
82
|
* console.log(currentGroupsForTeam); // [ProofGroup, ProofGroup, ...]
|
|
83
83
|
*
|
|
84
|
-
* @since v2.0.0-beta.
|
|
84
|
+
* @since v2.0.0-beta.146
|
|
85
85
|
* @returns {Promise<Array<ProofGroup>>}
|
|
86
86
|
*/
|
|
87
87
|
|
|
@@ -98,7 +98,7 @@ var TeamDashboardGroups = function (_API) {
|
|
|
98
98
|
* const archivedGroupsForTeam = await admin.team.dashboard.groups.archived();
|
|
99
99
|
* console.log(archivedGroupsForTeam); // [ProofGroup, ProofGroup, ...]
|
|
100
100
|
*
|
|
101
|
-
* @since v2.0.0-beta.
|
|
101
|
+
* @since v2.0.0-beta.146
|
|
102
102
|
* @returns {Promise<Array<ProofGroup>>}
|
|
103
103
|
*/
|
|
104
104
|
|
|
@@ -23,17 +23,24 @@ declare class TeamFeatures extends API {
|
|
|
23
23
|
* @param {object} options
|
|
24
24
|
* @param {object} options.emails The emails features
|
|
25
25
|
* @param {boolean} options.emails.displayComments Whether the comment should display in emails or not
|
|
26
|
+
* @param {boolean} options.emails.displayTeamName Whether using the team name or ’PageProof Team’ as the ‘from’ name in Email.
|
|
26
27
|
* @param {object} options.comments The comments features
|
|
27
28
|
* @param {boolean} options.comments.editComments Whether the comments/replies can be edited by other users or not
|
|
29
|
+
* @param {object} options.proofs The proofs features
|
|
30
|
+
* @param {boolean} options.proofs.reference Whether showing the reference field on a proof
|
|
28
31
|
* @returns {Promise}
|
|
29
32
|
*/
|
|
30
33
|
update({ emails, comments, proofs, }: {
|
|
31
34
|
emails: {
|
|
32
35
|
displayComments: boolean;
|
|
36
|
+
displayTeamName: boolean;
|
|
33
37
|
};
|
|
34
38
|
comments: {
|
|
35
39
|
editComments: boolean;
|
|
36
40
|
};
|
|
41
|
+
proofs: {
|
|
42
|
+
reference: boolean;
|
|
43
|
+
};
|
|
37
44
|
}): Promise<any>;
|
|
38
45
|
}
|
|
39
46
|
import API from "../API";
|
|
@@ -61,8 +61,11 @@ var TeamFeatures = function (_API) {
|
|
|
61
61
|
* @param {object} options
|
|
62
62
|
* @param {object} options.emails The emails features
|
|
63
63
|
* @param {boolean} options.emails.displayComments Whether the comment should display in emails or not
|
|
64
|
+
* @param {boolean} options.emails.displayTeamName Whether using the team name or ’PageProof Team’ as the ‘from’ name in Email.
|
|
64
65
|
* @param {object} options.comments The comments features
|
|
65
66
|
* @param {boolean} options.comments.editComments Whether the comments/replies can be edited by other users or not
|
|
67
|
+
* @param {object} options.proofs The proofs features
|
|
68
|
+
* @param {boolean} options.proofs.reference Whether showing the reference field on a proof
|
|
66
69
|
* @returns {Promise}
|
|
67
70
|
*/
|
|
68
71
|
|
|
@@ -73,10 +76,12 @@ var TeamFeatures = function (_API) {
|
|
|
73
76
|
proofs = _ref.proofs;
|
|
74
77
|
|
|
75
78
|
var displayComments = emails && emails.displayComments;
|
|
79
|
+
var displayTeamName = emails && emails.displayTeamName;
|
|
76
80
|
var editComments = comments && comments.editComments;
|
|
77
81
|
var proofReference = proofs && proofs.reference;
|
|
78
82
|
return this.client.request('admin.team.features.update', {
|
|
79
83
|
displayComments: displayComments,
|
|
84
|
+
displayTeamName: displayTeamName,
|
|
80
85
|
editComments: editComments,
|
|
81
86
|
proofReference: proofReference
|
|
82
87
|
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default TeamWorkflows;
|
|
2
|
+
declare class TeamWorkflows extends API {
|
|
3
|
+
constructor(client: any);
|
|
4
|
+
/**
|
|
5
|
+
* Loads all the team workflow templates.
|
|
6
|
+
*
|
|
7
|
+
* @example <caption>Loading team's all workflow templates</caption>
|
|
8
|
+
* const admin = await client.admin();
|
|
9
|
+
* const teamOwnedTemplates = await admin.team.workflows.owned();
|
|
10
|
+
* console.log(teamOwnedTemplates); // [Workflow, Workflow, ...]
|
|
11
|
+
*
|
|
12
|
+
* @since v2.0.0-beta.145
|
|
13
|
+
* @returns {Promise<Array<Workflow>>}
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
owned(): Promise<Workflow[]>;
|
|
17
|
+
}
|
|
18
|
+
import API from "../API";
|
|
19
|
+
import Workflow from "../../models/Workflow";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
|
|
5
|
+
var _API2 = require('../API');
|
|
6
|
+
|
|
7
|
+
var _API3 = _interopRequireDefault(_API2);
|
|
8
|
+
|
|
9
|
+
var _Workflow = require('../../models/Workflow');
|
|
10
|
+
|
|
11
|
+
var _Workflow2 = _interopRequireDefault(_Workflow);
|
|
12
|
+
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
|
|
15
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
|
+
|
|
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
|
+
|
|
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; } /* Copyright (C) 2018 PageProof Holdings Limited - All Rights Reserved.
|
|
20
|
+
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
|
21
|
+
* Proprietary and confidential.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/** @private */
|
|
26
|
+
function transformWorkflows(workflows) {
|
|
27
|
+
return (workflows || []).map(function (workflowData) {
|
|
28
|
+
return new _Workflow2.default().fromWorkflow(workflowData);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var TeamWorkflows = function (_API) {
|
|
33
|
+
_inherits(TeamWorkflows, _API);
|
|
34
|
+
|
|
35
|
+
function TeamWorkflows() {
|
|
36
|
+
_classCallCheck(this, TeamWorkflows);
|
|
37
|
+
|
|
38
|
+
return _possibleConstructorReturn(this, _API.apply(this, arguments));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Loads all the team workflow templates.
|
|
43
|
+
*
|
|
44
|
+
* @example <caption>Loading team's all workflow templates</caption>
|
|
45
|
+
* const admin = await client.admin();
|
|
46
|
+
* const teamOwnedTemplates = await admin.team.workflows.owned();
|
|
47
|
+
* console.log(teamOwnedTemplates); // [Workflow, Workflow, ...]
|
|
48
|
+
*
|
|
49
|
+
* @since v2.0.0-beta.145
|
|
50
|
+
* @returns {Promise<Array<Workflow>>}
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
TeamWorkflows.prototype.owned = function owned() {
|
|
54
|
+
return this.client.request('admin.team.workflows.owned').then(function (response) {
|
|
55
|
+
return transformWorkflows(response.data);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return TeamWorkflows;
|
|
60
|
+
}(_API3.default);
|
|
61
|
+
|
|
62
|
+
exports.default = TeamWorkflows;
|
|
63
|
+
//# sourceMappingURL=TeamWorkflows.js.map
|