@pageproof/sdk-pr 280.0.1602213888586 → 280.0.1604526415503

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/lib/adapters/SyncCryptoAdapter.d.ts +1 -1
  3. package/lib/api/Encryption.d.ts +1 -1
  4. package/lib/api/Encryption.js +1 -1
  5. package/lib/api/Integrations.d.ts +56 -0
  6. package/lib/api/Integrations.js +1 -0
  7. package/lib/api/Profile.d.ts +8 -0
  8. package/lib/api/Profile.js +1 -1
  9. package/lib/api/Proofs.d.ts +8 -1
  10. package/lib/api/Proofs.js +1 -1
  11. package/lib/api/ProofsCustomTools.d.ts +6 -5
  12. package/lib/api/ProofsIntegrationReferences.d.ts +41 -0
  13. package/lib/api/ProofsIntegrationReferences.js +1 -0
  14. package/lib/api/Workflows.d.ts +24 -2
  15. package/lib/api/Workflows.js +1 -1
  16. package/lib/api/admin/Team.d.ts +18 -4
  17. package/lib/api/admin/Team.js +29 -4
  18. package/lib/api/admin/TeamCustomTools.d.ts +22 -0
  19. package/lib/api/admin/{TeamMondayDotCom.js → TeamCustomTools.js} +29 -18
  20. package/lib/api/admin/TeamFeatures.d.ts +7 -0
  21. package/lib/api/admin/TeamFeatures.js +5 -0
  22. package/lib/api/admin/TeamWorkflows.d.ts +19 -0
  23. package/lib/api/admin/{TeamIntegrations.js → TeamWorkflows.js} +32 -16
  24. package/lib/crypto/transformFile.d.ts +1 -1
  25. package/lib/crypto/transformFile.js +1 -1
  26. package/lib/models/Proof.d.ts +7 -0
  27. package/lib/models/Proof.js +1 -1
  28. package/lib/models/ProofIntegrationReference.d.ts +33 -0
  29. package/lib/models/ProofIntegrationReference.js +1 -0
  30. package/lib/models/TeamAccountFeatures.d.ts +26 -0
  31. package/lib/models/TeamAccountFeatures.js +1 -0
  32. package/lib/models/TeamEmailFeatures.d.ts +8 -1
  33. package/lib/models/TeamEmailFeatures.js +1 -1
  34. package/lib/models/TeamFeatures.d.ts +8 -0
  35. package/lib/models/TeamFeatures.js +1 -1
  36. package/lib/models/Workflow.d.ts +21 -0
  37. package/lib/models/Workflow.js +1 -1
  38. package/lib/network/Request.js +1 -1
  39. package/lib/network/endpoints.json +55 -4
  40. package/lib/pageproof.js +1 -1
  41. package/lib/sync-crypto-adapter.js +1 -1
  42. package/lib/worker-crypto-adapter.js +1 -1
  43. package/lib/{worker.5ce37299.js → worker.a2f0a156.js} +2 -2
  44. package/package.json +1 -1
  45. package/lib/api/admin/TeamIntegrations.d.ts +0 -10
  46. package/lib/api/admin/TeamMondayDotCom.d.ts +0 -15
package/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # Changelog
2
2
 
3
+
4
+ ## 2.0.0-beta.145
5
+
6
+ Released on the 2nd of November 2020.
7
+
8
+ - [[#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).
9
+ - 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).
10
+
11
+ ## 2.0.0-beta.144
12
+
13
+ Released on the 30th of October 2020.
14
+
15
+ - Support for integration references.
16
+
17
+ ## 2.0.0-beta.143
18
+
19
+ Released on the 27th of October 2020.
20
+
21
+ - [[#283](https://github.com/PageProofCom/sdk/pull/283)]
22
+ - 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).
23
+ - 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).
24
+
25
+ ## 2.0.0-beta.142
26
+
27
+ Released on the 22nd of October 2020.
28
+
29
+ - Support for team-level custom tools.
30
+
31
+ ## 2.0.0-beta.141
32
+
33
+ Released on the 19th of October 2020.
34
+
35
+ - [[#270](https://github.com/PageProofCom/sdk/pull/270)] Support for retrieving configurations for services integrated with PageProof.
36
+
37
+
3
38
  ## 2.0.0-beta.140
4
39
 
5
40
  Released on the 9th of October 2020.
@@ -1,6 +1,6 @@
1
1
  export default SyncCryptoAdapter;
2
2
  declare class SyncCryptoAdapter extends ICryptoAdapter {
3
- transformFile(direction: any, variant: any, raw: any, ioEncoding: any, envelope: any, privateKeyPEM: any, encryptionVersions: any, encryptionVersion: any): Promise<any>;
3
+ transformFile(direction: any, variant: any, raw: any, ioEncoding: any, envelope: any, privateKeyPEM: any, encryptionVersions: any, encryptionVersion: any): any;
4
4
  /**
5
5
  * @param {string} data$ The encrypted (and encoded) data
6
6
  * @param {string} envelope$ The envelope containing the key
@@ -51,7 +51,7 @@ declare class Encryption extends API {
51
51
  };
52
52
  }>;
53
53
  /** @private */
54
- _transformFile(direction: any, variant: any, data: any, envelopeOrKeyIV: any, encryptionVersion: any): any;
54
+ _transformFile(variant: any, data: any, envelopeOrKeyIV: any, encryptionVersion: any, reverse?: boolean): any;
55
55
  /**
56
56
  * Encrypts a thumbnail (for a file).
57
57
  *
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _bluffer=require("../bluffer");var _bluffer2=_interopRequireDefault(_bluffer);var _encryptionVersions=require("../util/encryptionVersions.json");var _encryptionVersions2=_interopRequireDefault(_encryptionVersions);var _constants=require("../util/constants");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Encryption=function(_API){_inherits(Encryption,_API);function Encryption(){_classCallCheck(this,Encryption);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Encryption.prototype.decrypt=function decrypt(_ref){var _this2=this;var version=_ref.version,data=_ref.data,envelope=_ref.envelope;var bluffer=new _bluffer2.default;var content=typeof data==="string"?bluffer.create(data):Promise.resolve(data);return content.then(function(content$){return bluffer.read(content$).then(function(data$){return _this2.client.crypto().decryptData(version,data$,envelope,_this2.client.session.privateKeyPEM).then(function(decrypted){return bluffer.create(decrypted)})})})};Encryption.prototype.generateFileEnvelope=function generateFileEnvelope(){var _this3=this;var encryptionVersion=arguments.length>0&&arguments[0]!==undefined?arguments[0]:_constants.DEFAULT_FILE_ENCRYPTION_VERSION;if(encryptionVersion==="0000"){return Promise.resolve({encryptionVersion:"0000",envelope:null,keyIV:null})}return this.client.crypto().generateKeyIV().then(function(keyIV){return Promise.all([{key:keyIV.key,iv:keyIV.iv},_this3.client.crypto().envelopeSeal(keyIV.keyIV,[_this3.client.session.serverPublicKeyPEM,_this3.client.session.publicKeyPEM],false)])}).then(function(_ref2){var keyIV=_ref2[0],envelope=_ref2[1];return{encryptionVersion:encryptionVersion,envelope:envelope,keyIV:keyIV}})};Encryption.prototype._transformFile=function _transformFile(direction,variant,data,envelopeOrKeyIV,encryptionVersion){var _this4=this;var bluffer=new _bluffer2.default;return bluffer.readBase64(data).then(function(base64Data){return _this4.client.crypto().transformFile(direction,variant,base64Data,"base64",envelopeOrKeyIV,_this4.client.session.privateKeyPEM,_encryptionVersions2.default,encryptionVersion)}).then(function(base64Output){return bluffer.createBase64(base64Output)})};Encryption.prototype.encryptFileThumbnail=function encryptFileThumbnail(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("in","thumbnail",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.decryptFileThumbnail=function decryptFileThumbnail(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("out","thumbnail",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.encryptFileSpriteSheet=function encryptFileSpriteSheet(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("in","sprite_sheet",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.decryptFileSpriteSheet=function decryptFileSpriteSheet(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("out","sprite_sheet",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.encryptFilePreviewLow=function encryptFilePreviewLow(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("in","preview_low",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.decryptFilePreviewLow=function decryptFilePreviewLow(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("out","preview_low",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.encryptFilePreviewHigh=function encryptFilePreviewHigh(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("in","preview_high",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.decryptFilePreviewHigh=function decryptFilePreviewHigh(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("out","preview_high",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.encryptFileContentsPerChunk=function encryptFileContentsPerChunk(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("in","contents_per_chunk",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.decryptFileContentsPerChunk=function decryptFileContentsPerChunk(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("out","contents_per_chunk",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.encryptFileExtractedTextPerChunk=function encryptFileExtractedTextPerChunk(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("in","extracted_text_per_chunk",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.decryptFileExtractedTextPerChunk=function decryptFileExtractedTextPerChunk(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("out","extracted_text_per_chunk",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.encryptFileUploadPerChunk=function encryptFileUploadPerChunk(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("in","upload_per_chunk",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.decryptFileUploadPerChunk=function decryptFileUploadPerChunk(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("out","upload_per_chunk",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.encryptFileRendition=function encryptFileRendition(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("in","rendition",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.decryptFileRendition=function decryptFileRendition(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("out","rendition",data,envelopeOrKeyIV,encryptionVersion)};return Encryption}(_API3.default);exports.default=Encryption;
1
+ "use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _bluffer=require("../bluffer");var _bluffer2=_interopRequireDefault(_bluffer);var _encryptionVersions=require("../util/encryptionVersions.json");var _encryptionVersions2=_interopRequireDefault(_encryptionVersions);var _constants=require("../util/constants");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Encryption=function(_API){_inherits(Encryption,_API);function Encryption(){_classCallCheck(this,Encryption);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Encryption.prototype.decrypt=function decrypt(_ref){var _this2=this;var version=_ref.version,data=_ref.data,envelope=_ref.envelope;var bluffer=new _bluffer2.default;var content=typeof data==="string"?bluffer.create(data):Promise.resolve(data);return content.then(function(content$){return bluffer.read(content$).then(function(data$){return _this2.client.crypto().decryptData(version,data$,envelope,_this2.client.session.privateKeyPEM).then(function(decrypted){return bluffer.create(decrypted)})})})};Encryption.prototype.generateFileEnvelope=function generateFileEnvelope(){var _this3=this;var encryptionVersion=arguments.length>0&&arguments[0]!==undefined?arguments[0]:_constants.DEFAULT_FILE_ENCRYPTION_VERSION;if(encryptionVersion==="0000"){return Promise.resolve({encryptionVersion:"0000",envelope:null,keyIV:null})}return this.client.crypto().generateKeyIV().then(function(keyIV){return Promise.all([{key:keyIV.key,iv:keyIV.iv},_this3.client.crypto().envelopeSeal(keyIV.keyIV,[_this3.client.session.serverPublicKeyPEM,_this3.client.session.publicKeyPEM],false)])}).then(function(_ref2){var keyIV=_ref2[0],envelope=_ref2[1];return{encryptionVersion:encryptionVersion,envelope:envelope,keyIV:keyIV}})};Encryption.prototype._transformFile=function _transformFile(variant,data,envelopeOrKeyIV,encryptionVersion){var _this4=this;var reverse=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;var transformOperations=void 0;try{if(!(encryptionVersion in _encryptionVersions2.default)){throw new Error("Unsupported encryption version "+encryptionVersion+".")}if(!(variant in _encryptionVersions2.default[encryptionVersion])){throw new Error('File variant "'+variant+'" not supported by this version of the SDK.')}transformOperations=[].concat(_encryptionVersions2.default[encryptionVersion][variant]);if(reverse)transformOperations.reverse()}catch(err){return Promise.reject(err)}if(!transformOperations.length){return Promise.resolve(data)}var inputEncoding=transformOperations[0]==="base64.encode"&&reverse?"binary":"base64";var outputEncoding=reverse||transformOperations[transformOperations.length-1]!=="base64.encode"?"base64":"binary";var bluffer=new _bluffer2.default;return(inputEncoding==="base64"?bluffer.readBase64(data):bluffer.read(data)).then(function(input){return _this4.client.crypto().transformFile(input,inputEncoding,outputEncoding,envelopeOrKeyIV,_this4.client.session.privateKeyPEM,transformOperations,reverse)}).then(function(output){return outputEncoding==="base64"?bluffer.createBase64(output):bluffer.create(output)})};Encryption.prototype.encryptFileThumbnail=function encryptFileThumbnail(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("thumbnail",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.decryptFileThumbnail=function decryptFileThumbnail(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("thumbnail",data,envelopeOrKeyIV,encryptionVersion,true)};Encryption.prototype.encryptFileSpriteSheet=function encryptFileSpriteSheet(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("sprite_sheet",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.decryptFileSpriteSheet=function decryptFileSpriteSheet(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("sprite_sheet",data,envelopeOrKeyIV,encryptionVersion,true)};Encryption.prototype.encryptFilePreviewLow=function encryptFilePreviewLow(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("preview_low",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.decryptFilePreviewLow=function decryptFilePreviewLow(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("preview_low",data,envelopeOrKeyIV,encryptionVersion,true)};Encryption.prototype.encryptFilePreviewHigh=function encryptFilePreviewHigh(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("preview_high",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.decryptFilePreviewHigh=function decryptFilePreviewHigh(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("preview_high",data,envelopeOrKeyIV,encryptionVersion,true)};Encryption.prototype.encryptFileContentsPerChunk=function encryptFileContentsPerChunk(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("contents_per_chunk",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.decryptFileContentsPerChunk=function decryptFileContentsPerChunk(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("contents_per_chunk",data,envelopeOrKeyIV,encryptionVersion,true)};Encryption.prototype.encryptFileExtractedTextPerChunk=function encryptFileExtractedTextPerChunk(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("extracted_text_per_chunk",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.decryptFileExtractedTextPerChunk=function decryptFileExtractedTextPerChunk(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("extracted_text_per_chunk",data,envelopeOrKeyIV,encryptionVersion,true)};Encryption.prototype.encryptFileUploadPerChunk=function encryptFileUploadPerChunk(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("upload_per_chunk",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.decryptFileUploadPerChunk=function decryptFileUploadPerChunk(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("upload_per_chunk",data,envelopeOrKeyIV,encryptionVersion,true)};Encryption.prototype.encryptFileRendition=function encryptFileRendition(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("rendition",data,envelopeOrKeyIV,encryptionVersion)};Encryption.prototype.decryptFileRendition=function decryptFileRendition(encryptionVersion,envelopeOrKeyIV,data){return this._transformFile("rendition",data,envelopeOrKeyIV,encryptionVersion,true)};return Encryption}(_API3.default);exports.default=Encryption;
@@ -0,0 +1,56 @@
1
+ export default Integrations;
2
+ declare class Integrations extends API {
3
+ /** @private */
4
+ constructor(client: any, level: any);
5
+ /** @private */
6
+ level: any;
7
+ /**
8
+ * Gets the configurations for the available integrations
9
+ *
10
+ * @example <caption>Retrieving configurations for a team</caption>
11
+ * const admin = await client.admin();
12
+ * const availableConfigurations = await admin.team.integrations.configurations();
13
+ *
14
+ * @example <caption>Retrieving configurations for a user</caption>
15
+ * const availableConfigurations = await client.profile.integrations.configurations();
16
+ *
17
+ * @since 2.0.0-beta.141
18
+ * @returns {Promise<object|null>}
19
+ */
20
+ configurations(): Promise<any>;
21
+ /**
22
+ * Gets the URL for setting up an integration
23
+ *
24
+ * @example <caption>Retrieving the integration setup url for a team</caption>
25
+ * const admin = await client.admin();
26
+ * const { url, windowFeatures } = await admin.team.integrations.getSetupUrl('monday.com');
27
+ *
28
+ * @example <caption>Retrieving the integration setup url for a user</caption>
29
+ * const { url, windowFeatures } = await client.profile.integrations.getSetupUrl('monday.com');
30
+ *
31
+ * @since 2.0.0-beta.141
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 }>}
35
+ */
36
+ getSetupUrl(integrationKey: string, params?: any): Promise<{
37
+ url: string;
38
+ windowFeatures: string;
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>;
55
+ }
56
+ import API from "./API";
@@ -0,0 +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);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;
@@ -1,6 +1,13 @@
1
1
  export default Profile;
2
2
  declare class Profile extends API {
3
+ /** @private */
3
4
  constructor(client: any);
5
+ /**
6
+ * The Integrations API.
7
+ *
8
+ * @type {Integrations}
9
+ */
10
+ integrations: Integrations;
4
11
  /**
5
12
  * Uploads the avatar for the current user.
6
13
  *
@@ -76,3 +83,4 @@ declare class Profile extends API {
76
83
  clearStatus(): Promise<any>;
77
84
  }
78
85
  import API from "./API";
86
+ import Integrations from "./Integrations";
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _bluffer=require("../bluffer");var _bluffer2=_interopRequireDefault(_bluffer);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 Profile=function(_API){_inherits(Profile,_API);function Profile(){_classCallCheck(this,Profile);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Profile.prototype.uploadAvatar=function uploadAvatar(file){var _this2=this;var bluffer=new _bluffer2.default;return bluffer.readBase64(file).then(function(base64){return _this2.client.request("profile.upload-avatar",{uploadedImage:"data:image/png;base64,"+base64})})};Profile.prototype.changePassword=function changePassword(currentPassword,password){var _this3=this;var crypto=this.client.crypto();return Promise.all([crypto.generatePasswordHash(currentPassword),crypto.generatePasswordHash(password),crypto.encryptPrivateKey(this.client.session.privateKeyPEM,password)]).then(function(_ref){var oldPassword=_ref[0],newPassword=_ref[1],newPrivateKey=_ref[2];return _this3.client.request("profile.change-password",{oldPassword:oldPassword,newPassword:newPassword,newPrivateKey:newPrivateKey})})};Profile.prototype.getStatus=function getStatus(){return this.client.request("profile.status").then(function(response){return response.data.status})};Profile.prototype.setStatus=function setStatus(status){return this.client.request("profile.set-status",status)};Profile.prototype.clearStatus=function clearStatus(){return this.client.request("profile.clear-status")};return Profile}(_API3.default);exports.default=Profile;
1
+ "use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _bluffer=require("../bluffer");var _bluffer2=_interopRequireDefault(_bluffer);var _Integrations=require("./Integrations");var _Integrations2=_interopRequireDefault(_Integrations);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 Profile=function(_API){_inherits(Profile,_API);function Profile(client){_classCallCheck(this,Profile);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.integrations=new _Integrations2.default(client,"user");return _this}Profile.prototype.uploadAvatar=function uploadAvatar(file){var _this2=this;var bluffer=new _bluffer2.default;return bluffer.readBase64(file).then(function(base64){return _this2.client.request("profile.upload-avatar",{uploadedImage:"data:image/png;base64,"+base64})})};Profile.prototype.changePassword=function changePassword(currentPassword,password){var _this3=this;var crypto=this.client.crypto();return Promise.all([crypto.generatePasswordHash(currentPassword),crypto.generatePasswordHash(password),crypto.encryptPrivateKey(this.client.session.privateKeyPEM,password)]).then(function(_ref){var oldPassword=_ref[0],newPassword=_ref[1],newPrivateKey=_ref[2];return _this3.client.request("profile.change-password",{oldPassword:oldPassword,newPassword:newPassword,newPrivateKey:newPrivateKey})})};Profile.prototype.getStatus=function getStatus(){return this.client.request("profile.status").then(function(response){return response.data.status})};Profile.prototype.setStatus=function setStatus(status){return this.client.request("profile.set-status",status)};Profile.prototype.clearStatus=function clearStatus(){return this.client.request("profile.clear-status")};return Profile}(_API3.default);exports.default=Profile;
@@ -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;
@@ -42,16 +42,17 @@ declare class ProofsCustomTools extends API {
42
42
  /**
43
43
  * Loads the custom tools definition for a proof.
44
44
  *
45
- * @param {string} proofId
46
- * @returns {any}
45
+ * @param {string} proofId The proof ID
46
+ * @returns {Promise<any>}
47
47
  */
48
- load(proofId: string): any;
48
+ load(proofId: string): Promise<any>;
49
49
  /**
50
50
  * Updates a custom tools definition for a proof.
51
51
  *
52
- * @param {string} proofId
52
+ * @param {string} proofId The proof ID
53
53
  * @param {any} updates
54
+ * @returns {Promise<any>}
54
55
  */
55
- update(proofId: string, updates: any): any;
56
+ update(proofId: string, updates: any): Promise<any>;
56
57
  }
57
58
  import API from "./API";
@@ -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;
@@ -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 */
@@ -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;
@@ -41,10 +41,22 @@ declare class Team extends API {
41
41
  /**
42
42
  * The Admin Team Integrations API.
43
43
  *
44
- * @type {TeamIntegrations}
44
+ * @type {Integrations}
45
45
  */
46
- teamIntegrations: TeamIntegrations;
47
- integrations: TeamIntegrations;
46
+ integrations: Integrations;
47
+ /**
48
+ * The Admin Team Custom Tools API.
49
+ *
50
+ * @type {TeamCustomTools}
51
+ */
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;
48
60
  }
49
61
  import API from "../API";
50
62
  import TeamUsers from "./TeamUsers";
@@ -53,4 +65,6 @@ import TeamFeatures from "./TeamFeatures";
53
65
  import TeamPreferences from "./TeamPreferences";
54
66
  import TeamCustomWebhooks from "./TeamCustomWebhooks";
55
67
  import TeamSCIM from "./TeamSCIM";
56
- import TeamIntegrations from "./TeamIntegrations";
68
+ import Integrations from "../Integrations";
69
+ import TeamCustomTools from "./TeamCustomTools";
70
+ import TeamWorkflows from "./TeamWorkflows";
@@ -30,9 +30,17 @@ var _TeamSCIM = require('./TeamSCIM');
30
30
 
31
31
  var _TeamSCIM2 = _interopRequireDefault(_TeamSCIM);
32
32
 
33
- var _TeamIntegrations = require('./TeamIntegrations');
33
+ var _TeamWorkflows = require('./TeamWorkflows');
34
34
 
35
- var _TeamIntegrations2 = _interopRequireDefault(_TeamIntegrations);
35
+ var _TeamWorkflows2 = _interopRequireDefault(_TeamWorkflows);
36
+
37
+ var _Integrations = require('../Integrations');
38
+
39
+ var _Integrations2 = _interopRequireDefault(_Integrations);
40
+
41
+ var _TeamCustomTools = require('./TeamCustomTools');
42
+
43
+ var _TeamCustomTools2 = _interopRequireDefault(_TeamCustomTools);
36
44
 
37
45
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
38
46
 
@@ -52,6 +60,13 @@ var Team = function (_API) {
52
60
  /** @private */
53
61
 
54
62
 
63
+ /**
64
+ * The Admin Team Custom Tools API.
65
+ *
66
+ * @type {TeamCustomTools}
67
+ */
68
+
69
+
55
70
  /**
56
71
  * The Admin Team SCIM API.
57
72
  *
@@ -83,14 +98,24 @@ var Team = function (_API) {
83
98
  _this.preferences = new _TeamPreferences2.default(client);
84
99
  _this.customWebhooks = new _TeamCustomWebhooks2.default(client);
85
100
  _this.scim = new _TeamSCIM2.default(client);
86
- _this.integrations = new _TeamIntegrations2.default(client);
101
+ _this.workflows = new _TeamWorkflows2.default(client);
102
+ _this.integrations = new _Integrations2.default(client, 'team');
103
+ _this.customTools = new _TeamCustomTools2.default(client);
87
104
  return _this;
88
105
  }
89
106
 
107
+ /**
108
+ * The Admin Team Workflows API.
109
+ *
110
+ * @since v2.0.0-beta.145
111
+ * @type {TeamWorkflows}
112
+ */
113
+
114
+
90
115
  /**
91
116
  * The Admin Team Integrations API.
92
117
  *
93
- * @type {TeamIntegrations}
118
+ * @type {Integrations}
94
119
  */
95
120
 
96
121
 
@@ -0,0 +1,22 @@
1
+ export default TeamCustomTools;
2
+ declare class TeamCustomTools extends API {
3
+ constructor(client: any);
4
+ /**
5
+ * Loads the custom tools for your team.
6
+ *
7
+ * Note: This feature is only available to enterprise teams.
8
+ *
9
+ * @returns {Promise<any>}
10
+ */
11
+ load(): Promise<any>;
12
+ /**
13
+ * Updates a custom tools definition for your team.
14
+ *
15
+ * Note: This feature is only available to enterprise teams.
16
+ *
17
+ * @param {any} updates
18
+ * @returns {Promise<any>}
19
+ */
20
+ update(updates: any): Promise<any>;
21
+ }
22
+ import API from "../API";
@@ -18,35 +18,46 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
18
18
  */
19
19
 
20
20
 
21
- var TeamMondayDotCom = function (_API) {
22
- _inherits(TeamMondayDotCom, _API);
21
+ var TeamCustomTools = function (_API) {
22
+ _inherits(TeamCustomTools, _API);
23
23
 
24
- function TeamMondayDotCom() {
25
- _classCallCheck(this, TeamMondayDotCom);
24
+ function TeamCustomTools() {
25
+ _classCallCheck(this, TeamCustomTools);
26
26
 
27
27
  return _possibleConstructorReturn(this, _API.apply(this, arguments));
28
28
  }
29
29
 
30
30
  /**
31
- * Gets URL used to authenticate against monday.com.
31
+ * Loads the custom tools for your team.
32
32
  *
33
- * @example
34
- * const admin = await client.admin();
35
- * const authUrl = await admin.team.integrations.mondayDotCom.getAuthUrl();
33
+ * Note: This feature is only available to enterprise teams.
36
34
  *
37
- * @returns {Promise<string>}
35
+ * @returns {Promise<any>}
38
36
  */
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;
37
+ TeamCustomTools.prototype.load = function load() {
38
+ return this.client.request('admin.team.custom-tools.load').then(function (response) {
39
+ return response.data.tools;
45
40
  });
46
41
  };
47
42
 
48
- return TeamMondayDotCom;
43
+ /**
44
+ * Updates a custom tools definition for your team.
45
+ *
46
+ * Note: This feature is only available to enterprise teams.
47
+ *
48
+ * @param {any} updates
49
+ * @returns {Promise<any>}
50
+ */
51
+
52
+
53
+ TeamCustomTools.prototype.update = function update(updates) {
54
+ return this.client.request('admin.team.custom-tools.update', { updates: updates }).then(function (response) {
55
+ return response.data.tools;
56
+ });
57
+ };
58
+
59
+ return TeamCustomTools;
49
60
  }(_API3.default);
50
61
 
51
- exports.default = TeamMondayDotCom;
52
- //# sourceMappingURL=TeamMondayDotCom.js.map
62
+ exports.default = TeamCustomTools;
63
+ //# sourceMappingURL=TeamCustomTools.js.map