@pageproof/sdk-pr 257.0.1596077711713 → 257.0.1598929505185
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 -5
- package/lib/api/Comments.d.ts +42 -8
- package/lib/api/Comments.js +1 -1
- package/lib/api/GroupsWorkflows.js +1 -1
- package/lib/api/Proofs.d.ts +7 -24
- package/lib/api/Proofs.js +1 -1
- package/lib/api/Workflows.d.ts +24 -0
- package/lib/api/Workflows.js +1 -1
- package/lib/api/admin/Team.d.ts +15 -0
- package/lib/api/admin/Team.js +28 -4
- package/lib/api/admin/TeamIntegrations.d.ts +10 -0
- package/lib/api/admin/TeamIntegrations.js +47 -0
- package/lib/api/admin/TeamMondayDotCom.d.ts +15 -0
- package/lib/api/admin/TeamMondayDotCom.js +52 -0
- package/lib/api/admin/TeamNotifications.d.ts +31 -0
- package/lib/api/admin/TeamNotifications.js +79 -0
- package/lib/api/admin/TeamPreferences.d.ts +10 -0
- package/lib/api/admin/TeamPreferences.js +47 -0
- package/lib/enum/CommentState.d.ts +1 -2
- package/lib/enum/CommentState.js +1 -1
- package/lib/models/TeamNotifications.d.ts +19 -0
- package/lib/models/TeamNotifications.js +1 -0
- package/lib/network/endpoints.json +32 -12
- package/lib/pageproof.js +1 -1
- package/lib/util/comments/getCommentState.js +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,41 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.134
|
|
4
|
+
|
|
5
|
+
Released on the 31st of August 2020.
|
|
6
|
+
|
|
7
|
+
- Support for monday.com.
|
|
8
|
+
|
|
9
|
+
## 2.0.0-beta.133
|
|
10
|
+
|
|
11
|
+
Released on the 18th of August 2020.
|
|
12
|
+
|
|
13
|
+
- Added support for team email notification settings. See [TeamNotifications](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/admin/TeamNotifications.js~TeamNotifications.html)
|
|
14
|
+
|
|
15
|
+
## 2.0.0-beta.132
|
|
16
|
+
|
|
17
|
+
Released on the 3th of August 2020.
|
|
18
|
+
|
|
19
|
+
- Improved the validation of the mark & markAll for supporting IE11.
|
|
20
|
+
|
|
21
|
+
## 2.0.0-beta.131
|
|
22
|
+
|
|
23
|
+
Released on the 3th of August 2020.
|
|
24
|
+
|
|
25
|
+
- [[#252](https://github.com/PageProofCom/sdk/issues/252)] Support for updating multiple comment status changes. See [Comments](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Comments.js~Comments.html).
|
|
26
|
+
- "unmarked done" state of the comments is removed. It will be displayed as "marked done". See [CommentState](https://docs.pageproof.tech/@pageproof/sdk/beta/variable/index.html#static-variable-CommentState)
|
|
3
27
|
|
|
4
28
|
## 2.0.0-beta.131
|
|
5
29
|
|
|
6
30
|
Released on the 31st of July 2020.
|
|
7
31
|
|
|
8
|
-
- [[#257](https://github.com/PageProofCom/sdk/pull/257)] Support for replacing approver on a
|
|
32
|
+
- [[#257](https://github.com/PageProofCom/sdk/pull/257)] Support for replacing approver on a workflow or workflows. See [Workflows.replaceApprover](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Workflows.js~Workflows.html#instance-method-replaceApprover). Support for replacing approver on all owned proofs of a group. See [GroupsWorkflows.replaceApprovers](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/GroupsWorkflows.js~GroupsWorkflows.html#instance-method-replaceApprovers).
|
|
9
33
|
|
|
10
34
|
## 2.0.0-beta.130
|
|
11
35
|
|
|
12
36
|
Released on the 29th of July 2020.
|
|
13
37
|
|
|
14
|
-
- [[#250](https://github.com/PageProofCom/sdk/pull/250)] Support for updating decision by reviewer/mandatory reviewer. See [Proofs.updateDecision](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/
|
|
38
|
+
- [[#250](https://github.com/PageProofCom/sdk/pull/250)] Support for updating decision by reviewer/mandatory reviewer. See [Proofs.updateDecision](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Proofs.js~Proofs.html#instance-method-updateDecision).
|
|
15
39
|
|
|
16
40
|
## 2.0.0-beta.129
|
|
17
41
|
|
|
@@ -19,21 +43,18 @@ Released on the 29th of July 2020.
|
|
|
19
43
|
|
|
20
44
|
- [[#255](https://github.com/PageProofCom/sdk/pull/255)] Support for proof's tags. See [Proofs.tags](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/Proof.js~Proof.html#instance-member-tags).
|
|
21
45
|
|
|
22
|
-
|
|
23
46
|
## 2.0.0-beta.128
|
|
24
47
|
|
|
25
48
|
Released on the 28th of July 2020.
|
|
26
49
|
|
|
27
50
|
- Minor bug fixes.
|
|
28
51
|
|
|
29
|
-
|
|
30
52
|
## 2.0.0-beta.127
|
|
31
53
|
|
|
32
54
|
Released on the 20th of July 2020.
|
|
33
55
|
|
|
34
56
|
- [[#245](https://github.com/PageProofCom/sdk/pull/245)] Support for updating bulk due date. See [Proofs.update](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Proofs.js~Proofs.html#instance-method-update).
|
|
35
57
|
|
|
36
|
-
|
|
37
58
|
## 2.0.0-beta.126
|
|
38
59
|
|
|
39
60
|
Released on the 16th of July 2020.
|
package/lib/api/Comments.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ declare class Comments extends API {
|
|
|
3
3
|
constructor(client: any);
|
|
4
4
|
/** @private */
|
|
5
5
|
_mark(commentId: any, state: any, value: any): any;
|
|
6
|
+
/** @private */
|
|
7
|
+
_markAll(proofId: any, commentIds: any, state: any, value: any): any;
|
|
6
8
|
/**
|
|
7
9
|
* Marks a comment as to-do or done.
|
|
8
10
|
*
|
|
@@ -13,15 +15,13 @@ declare class Comments extends API {
|
|
|
13
15
|
* @returns {Promise<CommentState>}
|
|
14
16
|
*/
|
|
15
17
|
mark(commentId: string, state: {
|
|
16
|
-
COMMENT: string;
|
|
17
18
|
TODO: string;
|
|
18
19
|
DONE: string;
|
|
19
|
-
|
|
20
|
+
UNMARKED: string;
|
|
20
21
|
}): Promise<{
|
|
21
|
-
COMMENT: string;
|
|
22
22
|
TODO: string;
|
|
23
23
|
DONE: string;
|
|
24
|
-
|
|
24
|
+
UNMARKED: string;
|
|
25
25
|
}>;
|
|
26
26
|
/**
|
|
27
27
|
* Unmarks a comment as to-do or done.
|
|
@@ -33,16 +33,50 @@ declare class Comments extends API {
|
|
|
33
33
|
* @returns {Promise<CommentState>}
|
|
34
34
|
*/
|
|
35
35
|
unmark(commentId: string, state: {
|
|
36
|
-
COMMENT: string;
|
|
37
36
|
TODO: string;
|
|
38
37
|
DONE: string;
|
|
39
|
-
|
|
38
|
+
UNMARKED: string;
|
|
40
39
|
}): Promise<{
|
|
41
|
-
COMMENT: string;
|
|
42
40
|
TODO: string;
|
|
43
41
|
DONE: string;
|
|
44
|
-
|
|
42
|
+
UNMARKED: string;
|
|
45
43
|
}>;
|
|
44
|
+
/**
|
|
45
|
+
* Mark comments as to-do or done.
|
|
46
|
+
*
|
|
47
|
+
* @since v2.0.0-beta.131
|
|
48
|
+
* @see {@link Comment.state}
|
|
49
|
+
* @param {string} proofId The proof id
|
|
50
|
+
* @param {Array<string>} commentIds The comment ids
|
|
51
|
+
* @param {CommentState} state The comment mark type (otherwise known as the "state")
|
|
52
|
+
* @returns {Promise<Array<{CommentId, CommentState}>>}
|
|
53
|
+
*/
|
|
54
|
+
markAll(proofId: string, commentIds: string[], state: {
|
|
55
|
+
TODO: string;
|
|
56
|
+
DONE: string;
|
|
57
|
+
UNMARKED: string;
|
|
58
|
+
}): Promise<{
|
|
59
|
+
CommentId: any;
|
|
60
|
+
CommentState: any;
|
|
61
|
+
}[]>;
|
|
62
|
+
/**
|
|
63
|
+
* Unmark comments as to-do or done.
|
|
64
|
+
*
|
|
65
|
+
* @since v2.0.0-beta.131
|
|
66
|
+
* @see {@link Comment.state}
|
|
67
|
+
* @param {string} proofId The proof id
|
|
68
|
+
* @param {Array<string>} commentIds The comment ids
|
|
69
|
+
* @param {CommentState} state The comment mark type (otherwise known as the "state")
|
|
70
|
+
* @returns {Promise<Array<{CommentId, CommentState}>>}
|
|
71
|
+
*/
|
|
72
|
+
unmarkAll(proofId: string, commentIds: string[], state: {
|
|
73
|
+
TODO: string;
|
|
74
|
+
DONE: string;
|
|
75
|
+
UNMARKED: string;
|
|
76
|
+
}): Promise<{
|
|
77
|
+
CommentId: any;
|
|
78
|
+
CommentState: any;
|
|
79
|
+
}[]>;
|
|
46
80
|
/**
|
|
47
81
|
* Deletes a comment.
|
|
48
82
|
*
|
package/lib/api/Comments.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Comment=require("../models/Comment");var _Comment2=_interopRequireDefault(_Comment);var _CommentState=require("../enum/CommentState");var _CommentState2=_interopRequireDefault(_CommentState);var _constants=require("../util/constants");var _sort=require("../util/sort");var _v=require("../util/comments/v2");var _extractMentions=require("../util/comments/extractMentions");var _extractMentions2=_interopRequireDefault(_extractMentions);var _parseComment=require("../util/comments/parseComment");var _parseComment2=_interopRequireDefault(_parseComment);var _creationToken=require("../util/creationToken");var _throttle=require("../util/throttle");var _throttle2=_interopRequireDefault(_throttle);var _getCommentState=require("../../lib/util/comments/getCommentState");var _getCommentState2=_interopRequireDefault(_getCommentState);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}function getCommentDataFromPages(pages){var comments=[];Object.keys(pages).forEach(function(pageNumber){pages[pageNumber].Comments.forEach(function(commentData){comments.push(commentData)})});return comments}var _sortPages=(0,_sort.sortObjectsByKey)("pageNumber");var _sortCreatedDateDESC=(0,_sort.sortObjectsByKey)("createdDate",true);var _sortCreatedDateASC=(0,_sort.sortObjectsByKey)("createdDate",false);var sortComments=(0,_sort.combineSort)(_sortPages,_sortCreatedDateDESC);var sortReplies=(0,_sort.combineSort)(_sortPages,_sortCreatedDateASC);function mapComments(commentsData){var comments=[];var replies=[];commentsData.forEach(function(commentData){var entity=(new _Comment2.default).fromComment(commentData);if(entity.parentCommentId){replies.push(entity)}else{comments.push(entity)}});comments.sort(sortComments);var commentIds=comments.map(function(c){return c.id});var sortByParentCommentIndex=(0,_sort.sortObjectsBy)(function(r){return commentIds.indexOf(r.parentCommentId)},true);replies.sort((0,_sort.combineSort)(sortReplies,sortByParentCommentIndex));return comments.concat(replies)}var Comments=function(_API){_inherits(Comments,_API);function Comments(){_classCallCheck(this,Comments);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Comments.prototype._mark=function _mark(commentId,state,value){var
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Comment=require("../models/Comment");var _Comment2=_interopRequireDefault(_Comment);var _CommentState=require("../enum/CommentState");var _CommentState2=_interopRequireDefault(_CommentState);var _constants=require("../util/constants");var _sort=require("../util/sort");var _v=require("../util/comments/v2");var _extractMentions=require("../util/comments/extractMentions");var _extractMentions2=_interopRequireDefault(_extractMentions);var _parseComment=require("../util/comments/parseComment");var _parseComment2=_interopRequireDefault(_parseComment);var _creationToken=require("../util/creationToken");var _throttle=require("../util/throttle");var _throttle2=_interopRequireDefault(_throttle);var _getCommentState=require("../../lib/util/comments/getCommentState");var _getCommentState2=_interopRequireDefault(_getCommentState);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}function getCommentDataFromPages(pages){var comments=[];Object.keys(pages).forEach(function(pageNumber){pages[pageNumber].Comments.forEach(function(commentData){comments.push(commentData)})});return comments}var _sortPages=(0,_sort.sortObjectsByKey)("pageNumber");var _sortCreatedDateDESC=(0,_sort.sortObjectsByKey)("createdDate",true);var _sortCreatedDateASC=(0,_sort.sortObjectsByKey)("createdDate",false);var sortComments=(0,_sort.combineSort)(_sortPages,_sortCreatedDateDESC);var sortReplies=(0,_sort.combineSort)(_sortPages,_sortCreatedDateASC);function mapComments(commentsData){var comments=[];var replies=[];commentsData.forEach(function(commentData){var entity=(new _Comment2.default).fromComment(commentData);if(entity.parentCommentId){replies.push(entity)}else{comments.push(entity)}});comments.sort(sortComments);var commentIds=comments.map(function(c){return c.id});var sortByParentCommentIndex=(0,_sort.sortObjectsBy)(function(r){return commentIds.indexOf(r.parentCommentId)},true);replies.sort((0,_sort.combineSort)(sortReplies,sortByParentCommentIndex));return comments.concat(replies)}var Comments=function(_API){_inherits(Comments,_API);function Comments(){_classCallCheck(this,Comments);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Comments.prototype._mark=function _mark(commentId,state,value){if(Object.keys(_CommentState2.default).map(function(key){return _CommentState2.default[key]}).indexOf(state)===-1){throw new Error('Cannot mark comment state "'+state+'".')}var TODO=_CommentState2.default.TODO,DONE=_CommentState2.default.DONE,UNMARKED=_CommentState2.default.UNMARKED;var data={commentId:commentId};switch(state){case UNMARKED:{data.change=0;data.done=0;break}case TODO:{data.change=value?1:0;data.done=0;break}case DONE:{data.done=value?1:0;break}}return this.client.request("comments.state.update",data).then(function(response){return(0,_getCommentState2.default)(response.data)})};Comments.prototype._markAll=function _markAll(proofId,commentIds,state,value){if(Object.keys(_CommentState2.default).map(function(key){return _CommentState2.default[key]}).indexOf(state)===-1){throw new Error('Cannot mark comment state "'+state+'".')}var TODO=_CommentState2.default.TODO,DONE=_CommentState2.default.DONE,UNMARKED=_CommentState2.default.UNMARKED;var data={proofId:proofId,commentIds:commentIds};switch(state){case UNMARKED:{data.change=0;data.done=0;break}case TODO:{data.change=value?1:0;data.done=0;break}case DONE:{data.done=value?1:0;break}}return this.client.request("comments.state.multiple-update",data).then(function(response){return response.data.map(function(comment){return{commentId:comment.CommentId,commentState:(0,_getCommentState2.default)(comment)}})})};Comments.prototype.mark=function mark(commentId,state){return this._mark(commentId,state,true)};Comments.prototype.unmark=function unmark(commentId,state){return this._mark(commentId,state,false)};Comments.prototype.markAll=function markAll(proofId,commentIds,state){return this._markAll(proofId,commentIds,state,true)};Comments.prototype.unmarkAll=function unmarkAll(proofId,commentIds,state){return this._markAll(proofId,commentIds,state,false)};Comments.prototype.delete=function _delete(commentId){return this.client.request("comments.delete",{commentId:commentId})};Comments.prototype.load=function load(_options){var _this2=this;var options=typeof _options==="string"?{proofId:_options}:_options;var proofId=options.proofId,_options$pageNumber=options.pageNumber,pageNumber=_options$pageNumber===undefined?null:_options$pageNumber,_options$sinceDate=options.sinceDate,sinceDate=_options$sinceDate===undefined?null:_options$sinceDate,_options$async=options.async,async=_options$async===undefined?false:_options$async,_options$decrypt=options.decrypt,decrypt=_options$decrypt===undefined?true:_options$decrypt,onDecryptComment=options.onDecryptComment,onDecryptComments=options.onDecryptComments,_options$onDecryptCom=options.onDecryptCommentsThrottleMs,onDecryptCommentsThrottleMs=_options$onDecryptCom===undefined?1e3:_options$onDecryptCom,onDecryptError=options.onDecryptError;var sinceDateISO=sinceDate?sinceDate.toISOString().match(_constants.ISO_REGEX)[0]:_constants.DEFAULT_ISO_DATE;var payload={proofId:proofId,page:pageNumber,timestamp:sinceDateISO};return this.client.request(pageNumber!==null?"comments.load-page":"comments.load-all",payload).then(function(response){var comments=mapComments(response.data.Pages?getCommentDataFromPages(response.data.Pages):response.data);var wait=Promise.resolve();if(decrypt){var scheduled=[];var pendingBatch=[];var scheduleOnDecryptComments=onDecryptComments?(0,_throttle2.default)(function(){if(pendingBatch.length){onDecryptComments(pendingBatch);pendingBatch=[]}},onDecryptCommentsThrottleMs):function(){};var cached=Promise.all(comments.map(function(comment){return _this2.client.cache.auto(_constants.COMMENT_CACHE_PREFIX+comment.comment$,function(resolve){scheduled.push({comment:comment,resolve:resolve})}).then(function(rawComment){if(rawComment){comment.fromRawComment(rawComment)}return comment})}));wait=wait.then(function(){return cached});wait=wait.then(function(){var decrypted=scheduled.map(function(_ref){var comment=_ref.comment,resolve=_ref.resolve;return _this2.client.crypto().decryptComment(comment.comment$,comment.envelope,_this2.client.session.privateKeyPEM).then(function(rawComment){comment.fromRawComment(rawComment);resolve(rawComment);if(onDecryptComment){onDecryptComment(comment)}pendingBatch.push(comment);scheduleOnDecryptComments()}).catch(function(err){if(onDecryptError){onDecryptError(err,comment)}if(!async){return Promise.reject(err)}return undefined})});if(!async){return Promise.all(decrypted)}return null})}return wait.then(function(){return comments})})};Comments.prototype.create=function create(_ref2){var _this3=this;var raw=_ref2.raw,tokens=_ref2.tokens,proofId=_ref2.proofId,_ref2$pageNumber=_ref2.pageNumber,pageNumber=_ref2$pageNumber===undefined?1:_ref2$pageNumber,pin=_ref2.pin,mediaTime=_ref2.mediaTime,mediaDuration=_ref2.mediaDuration,parentCommentId=_ref2.parentCommentId,metadata=_ref2.metadata,state=_ref2.state,retryCreationToken=_ref2.creationToken;var mentions=[];var serialized=raw||(0,_v.serialize)(tokens);{var parsed=tokens||(0,_parseComment2.default)(raw);mentions.push.apply(mentions,(0,_extractMentions2.default)(parsed))}var creationToken=retryCreationToken||(0,_creationToken.generateCreationToken)();return this.client.crypto().encryptComment(serialized,[this.client.session.serverPublicKeyPEM,this.client.session.publicKeyPEM]).then(function(_ref3){var envelope=_ref3.envelope,comment$=_ref3.comment$;return{proofId:proofId,page:parentCommentId?undefined:pageNumber,envelope:envelope,encryptedComment:comment$,xy:JSON.stringify({x:pin&&typeof pin.x==="number"?pin.x:null,y:pin&&typeof pin.y==="number"?pin.y:null,x2:pin&&typeof pin.x2==="number"?pin.x2:null,y2:pin&&typeof pin.y2==="number"?pin.y2:null,time:typeof mediaTime==="number"?mediaTime:null,duration:typeof mediaDuration==="number"?mediaDuration:null}),boxFillImage:pin.fill?pin.fill.image:undefined,boxFillType:pin.fill?pin.fill.type:undefined,parent:parentCommentId||undefined,mentions:mentions,metadata:metadata?JSON.stringify(metadata):"{}",creationToken:creationToken,change:state===_CommentState2.default.TODO?"1":undefined,done:state===_CommentState2.default.DONE?"1":undefined}}).then(function(requestData){return _this3.client.request("comments.create",requestData).then(function(response){return(new _Comment2.default).fromComment(response.data).fromRawComment(serialized)})}).catch(function(err){if(err){err.creationToken=creationToken}return Promise.reject(err)})};return Comments}(_API3.default);exports.default=Comments;
|
|
@@ -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 GroupsWorkflows=function(_API){_inherits(GroupsWorkflows,_API);function GroupsWorkflows(){_classCallCheck(this,GroupsWorkflows);return _possibleConstructorReturn(this,_API.apply(this,arguments))}GroupsWorkflows.prototype.addReviewers=function addReviewers(groupId,userOrUsers){return this.client.request("proofs.groups.workflows.add-reviewers",{groupId:groupId,reviewers:[].concat(userOrUsers)})};GroupsWorkflows.prototype.replaceApprovers=function replaceApprovers(groupId,user){return this.client.request("groups-approver
|
|
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 GroupsWorkflows=function(_API){_inherits(GroupsWorkflows,_API);function GroupsWorkflows(){_classCallCheck(this,GroupsWorkflows);return _possibleConstructorReturn(this,_API.apply(this,arguments))}GroupsWorkflows.prototype.addReviewers=function addReviewers(groupId,userOrUsers){return this.client.request("proofs.groups.workflows.add-reviewers",{groupId:groupId,reviewers:[].concat(userOrUsers)})};GroupsWorkflows.prototype.replaceApprovers=function replaceApprovers(groupId,user){return this.client.request("proofs.groups.replace-approver",{groupId:groupId,user:user})};return GroupsWorkflows}(_API3.default);exports.default=GroupsWorkflows;
|
package/lib/api/Proofs.d.ts
CHANGED
|
@@ -50,6 +50,12 @@ declare class Proofs extends API {
|
|
|
50
50
|
* @type {ProofsAssets}
|
|
51
51
|
*/
|
|
52
52
|
assets: ProofsAssets;
|
|
53
|
+
/**
|
|
54
|
+
* The Proof workflow.
|
|
55
|
+
*
|
|
56
|
+
* @type {Workflows}
|
|
57
|
+
*/
|
|
58
|
+
workflows: Workflows;
|
|
53
59
|
/**
|
|
54
60
|
* The Proofs Custom Tools API.
|
|
55
61
|
*
|
|
@@ -435,30 +441,6 @@ declare class Proofs extends API {
|
|
|
435
441
|
* @returns {Promise}
|
|
436
442
|
*/
|
|
437
443
|
update(proofOrProofs: ProofForUpdateDefinition | ProofForUpdateDefinition[]): Promise<any>;
|
|
438
|
-
/**
|
|
439
|
-
* Replaces an approver on a proof or proofs.
|
|
440
|
-
*
|
|
441
|
-
* @example <caption>Replacing an approver (by email)</caption>
|
|
442
|
-
* await client.proofs.replaceApprovers(proof.id, { email: 'my-new-approver@example.com' });
|
|
443
|
-
*
|
|
444
|
-
* @example <caption>Replacing an approver (by user id)</caption>
|
|
445
|
-
* await client.proofs.replaceApprovers(proof.id, { id: 'ULVRHSLLP69ACHCT' });
|
|
446
|
-
*
|
|
447
|
-
* @example <caption>Replacing an approver on multiple proofs</caption>
|
|
448
|
-
* await client.proofs.replaceApprovers(
|
|
449
|
-
* [
|
|
450
|
-
* 'PIA76GGP3I4LDJXB',
|
|
451
|
-
* 'PIA76GGP3I4LDJXA',
|
|
452
|
-
* ],
|
|
453
|
-
* { email: 'my-new-approver@example.com' }
|
|
454
|
-
* );
|
|
455
|
-
*
|
|
456
|
-
* @since v2.0.0-beta.131
|
|
457
|
-
* @param {string|Array<string>} proofIdOrIds The proof id or ids
|
|
458
|
-
* @param {ApproverUserDefinition} user User to be replace as approver
|
|
459
|
-
* @returns {Promise}
|
|
460
|
-
*/
|
|
461
|
-
replaceApprovers(proofIdOrIds: string | string[], user: ApproverUserDefinition): Promise<any>;
|
|
462
444
|
}
|
|
463
445
|
import API from "./API";
|
|
464
446
|
import ProofsOwners from "./ProofsOwners";
|
|
@@ -469,5 +451,6 @@ import ProofsVersions from "./ProofsVersions";
|
|
|
469
451
|
import ProofsGroups from "./ProofsGroups";
|
|
470
452
|
import ProofsAudit from "./ProofsAudit";
|
|
471
453
|
import ProofsAssets from "./ProofsAssets";
|
|
454
|
+
import Workflows from "./Workflows";
|
|
472
455
|
import ProofsCustomTools from "./ProofsCustomTools";
|
|
473
456
|
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 _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}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);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,team=_ref.team,reference=_ref.reference,customTools=_ref.customTools,_ref$reminders=_ref.reminders,reminders=_ref$reminders===undefined?[]:_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),teamSlug:team&&team.slug||undefined}).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),customTools&&_this4.customTools.update(proof.id,customTools)])}).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.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,_ref3){var messageToOwners=_ref3.messageToOwners,_ref3$markCommentsAsT=_ref3.markCommentsAsTodo,markCommentsAsTodo=_ref3$markCommentsAsT===undefined?false:_ref3$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){return this.client.request("proofs.bulk-update",{proofs:transformProofsForUpdate(proofOrProofs)})};
|
|
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 _Workflows=require("./Workflows");var _Workflows2=_interopRequireDefault(_Workflows);var _ProofsCustomTools=require("./ProofsCustomTools");var _ProofsCustomTools2=_interopRequireDefault(_ProofsCustomTools);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}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.workflows=new _Workflows2.default(client);_this.customTools=new _ProofsCustomTools2.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,team=_ref.team,reference=_ref.reference,customTools=_ref.customTools,_ref$reminders=_ref.reminders,reminders=_ref$reminders===undefined?[]:_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),teamSlug:team&&team.slug||undefined}).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),customTools&&_this4.customTools.update(proof.id,customTools)])}).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.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,_ref3){var messageToOwners=_ref3.messageToOwners,_ref3$markCommentsAsT=_ref3.markCommentsAsTodo,markCommentsAsTodo=_ref3$markCommentsAsT===undefined?false:_ref3$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){return this.client.request("proofs.bulk-update",{proofs:transformProofsForUpdate(proofOrProofs)})};return Proofs}(_API3.default);exports.default=Proofs;
|
package/lib/api/Workflows.d.ts
CHANGED
|
@@ -259,6 +259,30 @@ declare class Workflows extends API {
|
|
|
259
259
|
* @returns {Promise}
|
|
260
260
|
*/
|
|
261
261
|
setStartingStep(workflowId: string, stepId: string): Promise<any>;
|
|
262
|
+
/**
|
|
263
|
+
* Replaces an approver on a workflow or workflows.
|
|
264
|
+
*
|
|
265
|
+
* @example <caption>Replacing an approver (by email)</caption>
|
|
266
|
+
* await client.proofs.workflows.replaceApprover(workflow.id, { email: 'my-new-approver@example.com' });
|
|
267
|
+
*
|
|
268
|
+
* @example <caption>Replacing an approver (by user id)</caption>
|
|
269
|
+
* await client.proofs.workflows.replaceApprover(workflow.id, { id: 'ULVRHSLLP69ACHCT' });
|
|
270
|
+
*
|
|
271
|
+
* @example <caption>Replacing an approver on multiple proofs</caption>
|
|
272
|
+
* await client.proofs.workflows.replaceApprover(
|
|
273
|
+
* [
|
|
274
|
+
* 'WIA76GGP3I4LDJXB',
|
|
275
|
+
* 'WIA76GGP3I4LDJXA',
|
|
276
|
+
* ],
|
|
277
|
+
* { email: 'my-new-approver@example.com' }
|
|
278
|
+
* );
|
|
279
|
+
*
|
|
280
|
+
* @since v2.0.0-beta.131
|
|
281
|
+
* @param {string|Array<string>} workflowIdOrIds The workflow id or ids
|
|
282
|
+
* @param {ApproverUserDefinition} user User to be replace as approver
|
|
283
|
+
* @returns {Promise}
|
|
284
|
+
*/
|
|
285
|
+
replaceApprover(workflowIdOrIds: string | string[], user: ApproverUserDefinition): Promise<any>;
|
|
262
286
|
/** @private */
|
|
263
287
|
_duplicateWorkflow(workflowId: any): any;
|
|
264
288
|
/** @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;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]})}var largestPosition=0;for(var i=0;i<steps.length;i++){var step=steps[i];if(!step.users||!step.users.length){return Promise.reject(Error("Workflow steps must contain 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):_this2._addWorkflowStepAndUsers(workflow.id,step)}))])}).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){return this.duplicate(workflowId)};Workflows.prototype.duplicate=function duplicate(workflowId){return this._duplicateWorkflow(workflowId)};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._duplicateWorkflow=function _duplicateWorkflow(workflowId){var _this3=this;return this.client.request("workflows.duplicate",{workflowId:workflowId}).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){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)})};Workflows.prototype._setWorkflowStepUsersMutate=function _setWorkflowStepUsersMutate(workflowId,workflowStep,users){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;return workflowStep})};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;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]})}var largestPosition=0;for(var i=0;i<steps.length;i++){var step=steps[i];if(!step.users||!step.users.length){return Promise.reject(Error("Workflow steps must contain 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):_this2._addWorkflowStepAndUsers(workflow.id,step)}))])}).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){return this.duplicate(workflowId)};Workflows.prototype.duplicate=function duplicate(workflowId){return this._duplicateWorkflow(workflowId)};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){var _this3=this;return this.client.request("workflows.duplicate",{workflowId:workflowId}).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){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)})};Workflows.prototype._setWorkflowStepUsersMutate=function _setWorkflowStepUsersMutate(workflowId,workflowStep,users){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;return workflowStep})};return Workflows}(_API3.default);exports.default=Workflows;
|
package/lib/api/admin/Team.d.ts
CHANGED
|
@@ -20,6 +20,12 @@ declare class Team extends API {
|
|
|
20
20
|
* @type {TeamFeatures}
|
|
21
21
|
*/
|
|
22
22
|
features: TeamFeatures;
|
|
23
|
+
/**
|
|
24
|
+
* The Admin Team Preferences API.
|
|
25
|
+
*
|
|
26
|
+
* @type {TeamPreferences}
|
|
27
|
+
*/
|
|
28
|
+
preferences: TeamPreferences;
|
|
23
29
|
/**
|
|
24
30
|
* The Admin Custom Webhooks API.
|
|
25
31
|
*
|
|
@@ -32,10 +38,19 @@ declare class Team extends API {
|
|
|
32
38
|
* @type {TeamSCIM}
|
|
33
39
|
*/
|
|
34
40
|
scim: TeamSCIM;
|
|
41
|
+
/**
|
|
42
|
+
* The Admin Team Integrations API.
|
|
43
|
+
*
|
|
44
|
+
* @type {TeamIntegrations}
|
|
45
|
+
*/
|
|
46
|
+
teamIntegrations: TeamIntegrations;
|
|
47
|
+
integrations: TeamIntegrations;
|
|
35
48
|
}
|
|
36
49
|
import API from "../API";
|
|
37
50
|
import TeamUsers from "./TeamUsers";
|
|
38
51
|
import TeamDashboard from "./TeamDashboard";
|
|
39
52
|
import TeamFeatures from "./TeamFeatures";
|
|
53
|
+
import TeamPreferences from "./TeamPreferences";
|
|
40
54
|
import TeamCustomWebhooks from "./TeamCustomWebhooks";
|
|
41
55
|
import TeamSCIM from "./TeamSCIM";
|
|
56
|
+
import TeamIntegrations from "./TeamIntegrations";
|
package/lib/api/admin/Team.js
CHANGED
|
@@ -18,6 +18,10 @@ var _TeamFeatures = require('./TeamFeatures');
|
|
|
18
18
|
|
|
19
19
|
var _TeamFeatures2 = _interopRequireDefault(_TeamFeatures);
|
|
20
20
|
|
|
21
|
+
var _TeamPreferences = require('./TeamPreferences');
|
|
22
|
+
|
|
23
|
+
var _TeamPreferences2 = _interopRequireDefault(_TeamPreferences);
|
|
24
|
+
|
|
21
25
|
var _TeamCustomWebhooks = require('./TeamCustomWebhooks');
|
|
22
26
|
|
|
23
27
|
var _TeamCustomWebhooks2 = _interopRequireDefault(_TeamCustomWebhooks);
|
|
@@ -26,6 +30,10 @@ var _TeamSCIM = require('./TeamSCIM');
|
|
|
26
30
|
|
|
27
31
|
var _TeamSCIM2 = _interopRequireDefault(_TeamSCIM);
|
|
28
32
|
|
|
33
|
+
var _TeamIntegrations = require('./TeamIntegrations');
|
|
34
|
+
|
|
35
|
+
var _TeamIntegrations2 = _interopRequireDefault(_TeamIntegrations);
|
|
36
|
+
|
|
29
37
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
38
|
|
|
31
39
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -45,9 +53,16 @@ var Team = function (_API) {
|
|
|
45
53
|
|
|
46
54
|
|
|
47
55
|
/**
|
|
48
|
-
* The Admin
|
|
56
|
+
* The Admin Team SCIM API.
|
|
49
57
|
*
|
|
50
|
-
* @type {
|
|
58
|
+
* @type {TeamSCIM}
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The Admin Team Preferences API.
|
|
64
|
+
*
|
|
65
|
+
* @type {TeamPreferences}
|
|
51
66
|
*/
|
|
52
67
|
|
|
53
68
|
|
|
@@ -65,15 +80,24 @@ var Team = function (_API) {
|
|
|
65
80
|
_this.users = new _TeamUsers2.default(client);
|
|
66
81
|
_this.dashboard = new _TeamDashboard2.default(client);
|
|
67
82
|
_this.features = new _TeamFeatures2.default(client);
|
|
83
|
+
_this.preferences = new _TeamPreferences2.default(client);
|
|
68
84
|
_this.customWebhooks = new _TeamCustomWebhooks2.default(client);
|
|
69
85
|
_this.scim = new _TeamSCIM2.default(client);
|
|
86
|
+
_this.integrations = new _TeamIntegrations2.default(client);
|
|
70
87
|
return _this;
|
|
71
88
|
}
|
|
72
89
|
|
|
73
90
|
/**
|
|
74
|
-
* The Admin Team
|
|
91
|
+
* The Admin Team Integrations API.
|
|
75
92
|
*
|
|
76
|
-
* @type {
|
|
93
|
+
* @type {TeamIntegrations}
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The Admin Custom Webhooks API.
|
|
99
|
+
*
|
|
100
|
+
* @type {TeamCustomWebhooks}
|
|
77
101
|
*/
|
|
78
102
|
|
|
79
103
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
|
|
5
|
+
var _API2 = require('../API');
|
|
6
|
+
|
|
7
|
+
var _API3 = _interopRequireDefault(_API2);
|
|
8
|
+
|
|
9
|
+
var _TeamMondayDotCom = require('./TeamMondayDotCom');
|
|
10
|
+
|
|
11
|
+
var _TeamMondayDotCom2 = _interopRequireDefault(_TeamMondayDotCom);
|
|
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
|
+
var TeamIntegrations = function (_API) {
|
|
26
|
+
_inherits(TeamIntegrations, _API);
|
|
27
|
+
|
|
28
|
+
/** @private */
|
|
29
|
+
function TeamIntegrations(client) {
|
|
30
|
+
_classCallCheck(this, TeamIntegrations);
|
|
31
|
+
|
|
32
|
+
// Nested APIs
|
|
33
|
+
var _this = _possibleConstructorReturn(this, _API.call(this, client));
|
|
34
|
+
|
|
35
|
+
_this.mondayDotCom = new _TeamMondayDotCom2.default(client);
|
|
36
|
+
return _this;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The Admin Team monday.com API.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
return TeamIntegrations;
|
|
44
|
+
}(_API3.default);
|
|
45
|
+
|
|
46
|
+
exports.default = TeamIntegrations;
|
|
47
|
+
//# sourceMappingURL=TeamIntegrations.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default TeamMondayDotCom;
|
|
2
|
+
declare class TeamMondayDotCom extends API {
|
|
3
|
+
constructor(client: any);
|
|
4
|
+
/**
|
|
5
|
+
* Gets URL used to authenticate against monday.com.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const admin = await client.admin();
|
|
9
|
+
* const authUrl = await admin.team.integrations.mondayDotCom.getAuthUrl();
|
|
10
|
+
*
|
|
11
|
+
* @returns {Promise<string>}
|
|
12
|
+
*/
|
|
13
|
+
getAuthUrl(): Promise<string>;
|
|
14
|
+
}
|
|
15
|
+
import API from "../API";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
|
|
5
|
+
var _API2 = require('../API');
|
|
6
|
+
|
|
7
|
+
var _API3 = _interopRequireDefault(_API2);
|
|
8
|
+
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
|
|
11
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
+
|
|
13
|
+
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; }
|
|
14
|
+
|
|
15
|
+
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.
|
|
16
|
+
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
|
17
|
+
* Proprietary and confidential.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var TeamMondayDotCom = function (_API) {
|
|
22
|
+
_inherits(TeamMondayDotCom, _API);
|
|
23
|
+
|
|
24
|
+
function TeamMondayDotCom() {
|
|
25
|
+
_classCallCheck(this, TeamMondayDotCom);
|
|
26
|
+
|
|
27
|
+
return _possibleConstructorReturn(this, _API.apply(this, arguments));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Gets URL used to authenticate against monday.com.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* const admin = await client.admin();
|
|
35
|
+
* const authUrl = await admin.team.integrations.mondayDotCom.getAuthUrl();
|
|
36
|
+
*
|
|
37
|
+
* @returns {Promise<string>}
|
|
38
|
+
*/
|
|
39
|
+
TeamMondayDotCom.prototype.getAuthUrl = function getAuthUrl() {
|
|
40
|
+
return this.client.request('admin.team.integrations.monday-dot-com.get-request-url').then(function (response) {
|
|
41
|
+
if (response.data) {
|
|
42
|
+
return response.data.url;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return TeamMondayDotCom;
|
|
49
|
+
}(_API3.default);
|
|
50
|
+
|
|
51
|
+
exports.default = TeamMondayDotCom;
|
|
52
|
+
//# sourceMappingURL=TeamMondayDotCom.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export default TeamNotifications;
|
|
2
|
+
declare class TeamNotifications extends API {
|
|
3
|
+
constructor(client: any);
|
|
4
|
+
/**
|
|
5
|
+
* Loads the administrator's team notifications.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const admin = await client.admin();
|
|
9
|
+
* const preferences = admin.team.preferences.notifications.load();
|
|
10
|
+
*
|
|
11
|
+
* @since v2.0.0-beta.134
|
|
12
|
+
* @returns {Promise<TeamNotifications>}
|
|
13
|
+
*/
|
|
14
|
+
load(): Promise<TeamNotifications>;
|
|
15
|
+
/**
|
|
16
|
+
* Set the notifications preferences for the administrator's team.
|
|
17
|
+
*
|
|
18
|
+
* @example <caption>Disabling the owner add email from admin</caption>
|
|
19
|
+
* const admin = await client.admin();
|
|
20
|
+
* const preferences = admin.team.preferences.notifications.set({ownerAddedByAdmin: false});
|
|
21
|
+
*
|
|
22
|
+
* @since v2.0.0-beta.134
|
|
23
|
+
* @param {object} options
|
|
24
|
+
* @param {boolean} options.ownerAddedByAdmin Whether the email should be sent or not to other owners, when an owner added on a proof by admin.
|
|
25
|
+
* @returns {Promise}
|
|
26
|
+
*/
|
|
27
|
+
set({ ownerAddedByAdmin, }: {
|
|
28
|
+
ownerAddedByAdmin: boolean;
|
|
29
|
+
}): Promise<any>;
|
|
30
|
+
}
|
|
31
|
+
import API from "../API";
|