@pageproof/sdk-pr 286.0.1603423939361 → 286.0.1606440481509
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 +47 -0
- package/lib/adapters/AngularEnhancementAdapter.d.ts +2 -0
- package/lib/adapters/IEnhancementAdapter.d.ts +129 -30
- package/lib/adapters/IEnhancementAdapter.js +1 -1
- package/lib/angular-enhancement-adapter.js +1 -1
- package/lib/api/Files.d.ts +1 -0
- package/lib/api/Files.js +1 -1
- package/lib/api/Integrations.d.ts +32 -5
- package/lib/api/Integrations.js +1 -1
- package/lib/api/Preferences.d.ts +2 -1
- package/lib/api/Proofs.d.ts +8 -1
- package/lib/api/Proofs.js +1 -1
- package/lib/api/ProofsGroups.d.ts +6 -6
- package/lib/api/ProofsGroups.js +1 -1
- package/lib/api/ProofsIntegrationReferences.d.ts +42 -0
- package/lib/api/ProofsIntegrationReferences.js +1 -0
- package/lib/api/Workflows.d.ts +24 -2
- package/lib/api/Workflows.js +1 -1
- package/lib/api/admin/Team.d.ts +8 -0
- package/lib/api/admin/Team.js +29 -16
- package/lib/api/admin/TeamFeatures.d.ts +7 -0
- package/lib/api/admin/TeamFeatures.js +5 -0
- package/lib/api/admin/TeamWorkflows.d.ts +19 -0
- package/lib/api/admin/TeamWorkflows.js +63 -0
- package/lib/enum/Preference.d.ts +1 -0
- package/lib/enum/Preference.js +1 -1
- package/lib/models/Proof.d.ts +7 -0
- package/lib/models/Proof.js +1 -1
- package/lib/models/ProofIntegrationReference.d.ts +33 -0
- package/lib/models/ProofIntegrationReference.js +1 -0
- package/lib/models/TeamAccountFeatures.d.ts +26 -0
- package/lib/models/TeamAccountFeatures.js +1 -0
- package/lib/models/TeamEmailFeatures.d.ts +8 -1
- package/lib/models/TeamEmailFeatures.js +1 -1
- package/lib/models/TeamFeatures.d.ts +8 -0
- package/lib/models/TeamFeatures.js +1 -1
- package/lib/models/Workflow.d.ts +21 -0
- package/lib/models/Workflow.js +1 -1
- package/lib/network/Request.js +1 -1
- package/lib/network/endpoints.json +46 -4
- package/lib/pageproof.js +1 -1
- package/package.json +1 -1
- package/lib/util/restParamsToArray.d.ts +0 -6
- package/lib/util/restParamsToArray.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.149
|
|
4
|
+
|
|
5
|
+
Released on the 24th of November 2020.
|
|
6
|
+
|
|
7
|
+
- [[#239](https://github.com/PageProofCom/sdk/pull/239)] Adds support for a `onFileDetails` callback option when uploading files. See [Files.upload](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Files.js~Files.html#instance-method-upload).
|
|
8
|
+
|
|
9
|
+
## 2.0.0-beta.148
|
|
10
|
+
|
|
11
|
+
Released on the 24th of November 2020.
|
|
12
|
+
|
|
13
|
+
- [[#289](https://github.com/PageProofCom/sdk/pull/289)] Adds support for default reminder user preferences. See [Preferences](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Preferences.js~Preferences.html).
|
|
14
|
+
- Adds support for updating the configuration of integrations.
|
|
15
|
+
|
|
16
|
+
## 2.0.0-beta.147
|
|
17
|
+
|
|
18
|
+
Released on the 23rd of November 2020.
|
|
19
|
+
|
|
20
|
+
- Allowed including parameters when retrieving options for proof integration references.
|
|
21
|
+
|
|
22
|
+
## 2.0.0-beta.146
|
|
23
|
+
|
|
24
|
+
Released on the 20th of November 2020.
|
|
25
|
+
|
|
26
|
+
- Improved support for the enhancement adapter interface.
|
|
27
|
+
|
|
28
|
+
## 2.0.0-beta.145
|
|
29
|
+
|
|
30
|
+
Released on the 2nd of November 2020.
|
|
31
|
+
|
|
32
|
+
- [[#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).
|
|
33
|
+
- 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).
|
|
34
|
+
|
|
35
|
+
## 2.0.0-beta.144
|
|
36
|
+
|
|
37
|
+
Released on the 30th of October 2020.
|
|
38
|
+
|
|
39
|
+
- Support for integration references.
|
|
40
|
+
|
|
41
|
+
## 2.0.0-beta.143
|
|
42
|
+
|
|
43
|
+
Released on the 27th of October 2020.
|
|
44
|
+
|
|
45
|
+
- [[#283](https://github.com/PageProofCom/sdk/pull/283)]
|
|
46
|
+
- 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).
|
|
47
|
+
- 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).
|
|
48
|
+
|
|
3
49
|
## 2.0.0-beta.142
|
|
4
50
|
|
|
5
51
|
Released on the 22nd of October 2020.
|
|
@@ -12,6 +58,7 @@ Released on the 19th of October 2020.
|
|
|
12
58
|
|
|
13
59
|
- [[#270](https://github.com/PageProofCom/sdk/pull/270)] Support for retrieving configurations for services integrated with PageProof.
|
|
14
60
|
|
|
61
|
+
|
|
15
62
|
## 2.0.0-beta.140
|
|
16
63
|
|
|
17
64
|
Released on the 9th of October 2020.
|
|
@@ -3,34 +3,133 @@ declare class IEnhancementAdapter {
|
|
|
3
3
|
static __adapter__: string;
|
|
4
4
|
/** @private */
|
|
5
5
|
onClientReady(client: any): void;
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Called before the method is enhanced.
|
|
8
|
+
*
|
|
9
|
+
* @abstract
|
|
10
|
+
* @param {{ api: API, namespace: string, name: string, displayName: string }} ctx
|
|
11
|
+
*/
|
|
12
|
+
onMethodEnhance(ctx: {
|
|
13
|
+
api: any;
|
|
14
|
+
namespace: string;
|
|
15
|
+
name: string;
|
|
16
|
+
displayName: string;
|
|
17
|
+
}): void;
|
|
18
|
+
/**
|
|
19
|
+
* Called before the method is invoked.
|
|
20
|
+
*
|
|
21
|
+
* @abstract
|
|
22
|
+
* @param {{ api: API, namespace: string, name: string, displayName: string }} ctx
|
|
23
|
+
*/
|
|
24
|
+
onMethodBefore(ctx: {
|
|
25
|
+
api: any;
|
|
26
|
+
namespace: string;
|
|
27
|
+
name: string;
|
|
28
|
+
displayName: string;
|
|
29
|
+
}): void;
|
|
30
|
+
/**
|
|
31
|
+
* Called after the method has been invoked.
|
|
32
|
+
*
|
|
33
|
+
* @abstract
|
|
34
|
+
* @param {{ api: API, namespace: string, name: string, displayName: string }} ctx
|
|
35
|
+
*/
|
|
36
|
+
onMethodAfter(ctx: {
|
|
37
|
+
api: any;
|
|
38
|
+
namespace: string;
|
|
39
|
+
name: string;
|
|
40
|
+
displayName: string;
|
|
41
|
+
}): void;
|
|
42
|
+
/**
|
|
43
|
+
* Called if the method returns a rejected promise.
|
|
44
|
+
*
|
|
45
|
+
* @abstract
|
|
46
|
+
* @param {{ api: API, namespace: string, name: string, displayName: string }} ctx
|
|
47
|
+
*/
|
|
48
|
+
onMethodReject(ctx: {
|
|
49
|
+
api: any;
|
|
50
|
+
namespace: string;
|
|
51
|
+
name: string;
|
|
52
|
+
displayName: string;
|
|
53
|
+
}): void;
|
|
54
|
+
/**
|
|
55
|
+
* Called if the method returns a resolved promise.
|
|
56
|
+
*
|
|
57
|
+
* @abstract
|
|
58
|
+
* @param {{ api: API, namespace: string, name: string, displayName: string }} ctx
|
|
59
|
+
*/
|
|
60
|
+
onMethodResolve(ctx: {
|
|
61
|
+
api: any;
|
|
62
|
+
namespace: string;
|
|
63
|
+
name: string;
|
|
64
|
+
displayName: string;
|
|
65
|
+
}): void;
|
|
66
|
+
/**
|
|
67
|
+
* Called after the method's promise has either resolved or rejected.
|
|
68
|
+
*
|
|
69
|
+
* @abstract
|
|
70
|
+
* @param {{ api: API, namespace: string, name: string, displayName: string }} ctx
|
|
71
|
+
*/
|
|
72
|
+
onMethodFinally(ctx: {
|
|
73
|
+
api: any;
|
|
74
|
+
namespace: string;
|
|
75
|
+
name: string;
|
|
76
|
+
displayName: string;
|
|
77
|
+
}): void;
|
|
78
|
+
/**
|
|
79
|
+
* Called if the method throws an error synchronously.
|
|
80
|
+
*
|
|
81
|
+
* @abstract
|
|
82
|
+
* @param {{ api: API, namespace: string, name: string, displayName: string }} ctx
|
|
83
|
+
*/
|
|
84
|
+
onMethodThrown(ctx: {
|
|
85
|
+
api: any;
|
|
86
|
+
namespace: string;
|
|
87
|
+
name: string;
|
|
88
|
+
displayName: string;
|
|
89
|
+
}): void;
|
|
90
|
+
/**
|
|
91
|
+
* @abstract
|
|
92
|
+
* @param {any} event
|
|
93
|
+
*/
|
|
94
|
+
onRequestBefore(event: any): void;
|
|
95
|
+
/**
|
|
96
|
+
* @abstract
|
|
97
|
+
* @param {any} event
|
|
98
|
+
*/
|
|
99
|
+
onRequestAfter(event: any): void;
|
|
100
|
+
/**
|
|
101
|
+
* @abstract
|
|
102
|
+
* @param {any} event
|
|
103
|
+
*/
|
|
104
|
+
onRequestReject(event: any): void;
|
|
105
|
+
/**
|
|
106
|
+
* @abstract
|
|
107
|
+
* @param {any} event
|
|
108
|
+
*/
|
|
109
|
+
onRequestThrottled(event: any): void;
|
|
110
|
+
/**
|
|
111
|
+
* @abstract
|
|
112
|
+
* @param {any} event
|
|
113
|
+
*/
|
|
114
|
+
onRequestRetry(event: any): void;
|
|
115
|
+
/**
|
|
116
|
+
* @abstract
|
|
117
|
+
* @param {any} event
|
|
118
|
+
*/
|
|
119
|
+
onRequestUnauthorized(event: any): void;
|
|
120
|
+
/**
|
|
121
|
+
* @abstract
|
|
122
|
+
* @param {any} event
|
|
123
|
+
*/
|
|
124
|
+
onRequestDeprecated(event: any): void;
|
|
125
|
+
/**
|
|
126
|
+
* @abstract
|
|
127
|
+
* @param {any} event
|
|
128
|
+
*/
|
|
129
|
+
onRequestResolve(event: any): void;
|
|
130
|
+
/**
|
|
131
|
+
* @abstract
|
|
132
|
+
* @param {any} event
|
|
133
|
+
*/
|
|
134
|
+
onRequestFinally(event: any): void;
|
|
36
135
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _class,_temp;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var IEnhancementAdapter=(_temp=_class=function(){function IEnhancementAdapter(){_classCallCheck(this,IEnhancementAdapter)}IEnhancementAdapter.prototype.onClientReady=function onClientReady(client){var _this=this;var methods=getNestedMethods(client);methods.forEach(function(definition){
|
|
1
|
+
"use strict";exports.__esModule=true;var _class,_temp;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var IEnhancementAdapter=(_temp=_class=function(){function IEnhancementAdapter(){_classCallCheck(this,IEnhancementAdapter)}IEnhancementAdapter.prototype.onClientReady=function onClientReady(client){var _this=this;var methods=getNestedMethods(client);methods.forEach(function(definition){var ctx={api:definition.api,namespace:definition.namespace,name:definition.name,displayName:definition.namespace+"."+definition.name};_this.onMethodEnhance(ctx);enhance(definition.api,definition.name,function(callback){_this.onMethodBefore(ctx);return function(){var value=void 0;try{value=callback()}catch(err){ctx.error=err;_this.onMethodThrown(ctx);throw err}finally{ctx.value=value;_this.onMethodAfter(ctx);if(value&&typeof value.then==="function"){value.then(function(resolved){ctx.resolved=resolved;_this.onMethodResolve(ctx)},function(rejected){ctx.rejected=rejected;_this.onMethodReject(ctx)}).then(function(){_this.onMethodFinally(ctx)})}}return value}})});client.on("experimental.request.before",function(event){return _this.onRequestBefore(event.data)});client.on("experimental.request.after",function(event){return _this.onRequestAfter(event.data)});client.on("error.response",function(event){return _this.onRequestReject(event.data)});client.on("error.throttled",function(event){return _this.onRequestThrottled(event.data)});client.on("experimental.request.retry",function(event){return _this.onRequestRetry(event.data)});client.on("error.unauthorized",function(event){return _this.onRequestUnauthorized(event.data)});client.on("error.deprecated",function(event){return _this.onRequestDeprecated(event.data)});client.on("experimental.request.resolve",function(event){return _this.onRequestResolve(event.data)});client.on("experimental.request.finally",function(event){return _this.onRequestFinally(event.data)})};IEnhancementAdapter.prototype.onMethodEnhance=function onMethodEnhance(ctx){};IEnhancementAdapter.prototype.onMethodBefore=function onMethodBefore(ctx){};IEnhancementAdapter.prototype.onMethodAfter=function onMethodAfter(ctx){};IEnhancementAdapter.prototype.onMethodReject=function onMethodReject(ctx){};IEnhancementAdapter.prototype.onMethodResolve=function onMethodResolve(ctx){};IEnhancementAdapter.prototype.onMethodFinally=function onMethodFinally(ctx){};IEnhancementAdapter.prototype.onMethodThrown=function onMethodThrown(ctx){};IEnhancementAdapter.prototype.onRequestBefore=function onRequestBefore(event){};IEnhancementAdapter.prototype.onRequestAfter=function onRequestAfter(event){};IEnhancementAdapter.prototype.onRequestReject=function onRequestReject(event){};IEnhancementAdapter.prototype.onRequestThrottled=function onRequestThrottled(event){};IEnhancementAdapter.prototype.onRequestRetry=function onRequestRetry(event){};IEnhancementAdapter.prototype.onRequestUnauthorized=function onRequestUnauthorized(event){};IEnhancementAdapter.prototype.onRequestDeprecated=function onRequestDeprecated(event){};IEnhancementAdapter.prototype.onRequestResolve=function onRequestResolve(event){};IEnhancementAdapter.prototype.onRequestFinally=function onRequestFinally(event){};return IEnhancementAdapter}(),_class.__adapter__="IEnhancementAdapter",_temp);function enhance(obj,name,factory){var original=obj[name];obj[name]=function enhanced(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}var bound=original.bind.apply(original,[this].concat(args));var replacement=factory(bound,this,args);var value=replacement.apply(this,args);return value}}function getNestedMethods(client){var includeTop=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var definitions=[];function scan(api){var prefix=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var children=Object.getOwnPropertyNames(api).filter(function(name){return api[name].client===client});var proto=Object.getPrototypeOf(api);var methods=Object.keys(proto).filter(function(name){return typeof proto[name]==="function"&&name.indexOf("_")!==0});if(prefix.length||includeTop){methods.forEach(function(name){definitions.push({namespace:prefix.join("."),name:name,api:api})})}children.forEach(function(name){scan(api[name],prefix.concat(name))})}scan(client);return definitions}exports.default=IEnhancementAdapter;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PageProofAngularEnhancementAdapter=t():e.PageProofAngularEnhancementAdapter=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},c=n(1),a=function(e){return e&&e.__esModule?e:{default:e}}(c),p=n(2)("AngularEnhancementAdapter"),f={$scope:null,$exceptionHandler:null,module:null},s=function(e){function t(n){o(this,t);var i=r(this,e.call(this));return i.options=u({},f,n),i.$scope=i.options.$scope,i.$exceptionHandler=i.options.$exceptionHandler,i.options.module&&i.options.module.run(["$rootScope","$exceptionHandler",function(e,t){p("Extracting the $rootScope and $exceptionHandler from Angular module"),i.$scope=i.$scope||e,i.$exceptionHandler=i.$exceptionHandler||t}]),i}return i(t,e),t.prototype.onMethodFinally=function(){this.$scope&&!this.$scope.$$phase&&this.$scope.$apply(),this.$scope||p("Unable to tell $scope to re-digest, either module hasn't booted, or no $scope was provided")},t.prototype.onMethodReject=function(e){var t=e.rejected;this.$exceptionHandler?this.$exceptionHandler(t):p("Unable to invoke $exceptionHandler of rejected Promise, check configuration")},t.prototype.onMethodThrown=function(e){var t=e.error;this.$exceptionHandler?this.$exceptionHandler(t):p("Unable to invoke $exceptionHandler of uncaught error, check configuration")},t}(a.default);t.default=s},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n){var o=e[t];e[t]=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=o.bind.apply(o,[this].concat(t));return n(i,this,t).apply(this,t)}}function i(e){function t(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],u=Object.getOwnPropertyNames(r).filter(function(t){return r[t].client===e}),c=Object.getPrototypeOf(r),a=Object.keys(c).filter(function(e){return"function"==typeof c[e]&&0!==e.indexOf("_")});(i.length||n)&&a.forEach(function(e){o.push({namespace:i.join("."),name:e,api:r})}),u.forEach(function(e){t(r[e],i.concat(e))})}var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=[];return t(e),o}t.__esModule=!0;var u,c,a=(c=u=function(){function e(){o(this,e)}return e.prototype.onClientReady=function(e){var t=this;i(e).forEach(function(e){
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PageProofAngularEnhancementAdapter=t():e.PageProofAngularEnhancementAdapter=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},c=n(1),a=function(e){return e&&e.__esModule?e:{default:e}}(c),p=n(2)("AngularEnhancementAdapter"),f={$scope:null,$exceptionHandler:null,module:null},s=function(e){function t(n){o(this,t);var i=r(this,e.call(this));return i.options=u({},f,n),i.$scope=i.options.$scope,i.$exceptionHandler=i.options.$exceptionHandler,i.options.module&&i.options.module.run(["$rootScope","$exceptionHandler",function(e,t){p("Extracting the $rootScope and $exceptionHandler from Angular module"),i.$scope=i.$scope||e,i.$exceptionHandler=i.$exceptionHandler||t}]),i}return i(t,e),t.prototype.onMethodFinally=function(){this.$scope&&!this.$scope.$$phase&&this.$scope.$apply(),this.$scope||p("Unable to tell $scope to re-digest, either module hasn't booted, or no $scope was provided")},t.prototype.onMethodReject=function(e){var t=e.rejected;this.$exceptionHandler?this.$exceptionHandler(t):p("Unable to invoke $exceptionHandler of rejected Promise, check configuration")},t.prototype.onMethodThrown=function(e){var t=e.error;this.$exceptionHandler?this.$exceptionHandler(t):p("Unable to invoke $exceptionHandler of uncaught error, check configuration")},t}(a.default);t.default=s},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n){var o=e[t];e[t]=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=o.bind.apply(o,[this].concat(t));return n(i,this,t).apply(this,t)}}function i(e){function t(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],u=Object.getOwnPropertyNames(r).filter(function(t){return r[t].client===e}),c=Object.getPrototypeOf(r),a=Object.keys(c).filter(function(e){return"function"==typeof c[e]&&0!==e.indexOf("_")});(i.length||n)&&a.forEach(function(e){o.push({namespace:i.join("."),name:e,api:r})}),u.forEach(function(e){t(r[e],i.concat(e))})}var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=[];return t(e),o}t.__esModule=!0;var u,c,a=(c=u=function(){function e(){o(this,e)}return e.prototype.onClientReady=function(e){var t=this;i(e).forEach(function(e){var n={api:e.api,namespace:e.namespace,name:e.name,displayName:e.namespace+"."+e.name};t.onMethodEnhance(n),r(e.api,e.name,function(e){return t.onMethodBefore(n),function(){var o=void 0;try{o=e()}catch(e){throw n.error=e,t.onMethodThrown(n),e}finally{n.value=o,t.onMethodAfter(n),o&&"function"==typeof o.then&&o.then(function(e){n.resolved=e,t.onMethodResolve(n)},function(e){n.rejected=e,t.onMethodReject(n)}).then(function(){t.onMethodFinally(n)})}return o}})}),e.on("experimental.request.before",function(e){return t.onRequestBefore(e.data)}),e.on("experimental.request.after",function(e){return t.onRequestAfter(e.data)}),e.on("error.response",function(e){return t.onRequestReject(e.data)}),e.on("error.throttled",function(e){return t.onRequestThrottled(e.data)}),e.on("experimental.request.retry",function(e){return t.onRequestRetry(e.data)}),e.on("error.unauthorized",function(e){return t.onRequestUnauthorized(e.data)}),e.on("error.deprecated",function(e){return t.onRequestDeprecated(e.data)}),e.on("experimental.request.resolve",function(e){return t.onRequestResolve(e.data)}),e.on("experimental.request.finally",function(e){return t.onRequestFinally(e.data)})},e.prototype.onMethodEnhance=function(e){},e.prototype.onMethodBefore=function(e){},e.prototype.onMethodAfter=function(e){},e.prototype.onMethodReject=function(e){},e.prototype.onMethodResolve=function(e){},e.prototype.onMethodFinally=function(e){},e.prototype.onMethodThrown=function(e){},e.prototype.onRequestBefore=function(e){},e.prototype.onRequestAfter=function(e){},e.prototype.onRequestReject=function(e){},e.prototype.onRequestThrottled=function(e){},e.prototype.onRequestRetry=function(e){},e.prototype.onRequestUnauthorized=function(e){},e.prototype.onRequestDeprecated=function(e){},e.prototype.onRequestResolve=function(e){},e.prototype.onRequestFinally=function(e){},e}(),u.__adapter__="IEnhancementAdapter",c);t.default=a},function(e,t,n){"use strict";e.exports=function e(){return e}}])});
|
|
2
2
|
//# sourceMappingURL=angular-enhancement-adapter.js.map
|
package/lib/api/Files.d.ts
CHANGED
|
@@ -195,6 +195,7 @@ declare class Files extends API {
|
|
|
195
195
|
* @param {boolean} [file.download=false] Whether the file should be available for download
|
|
196
196
|
* @param {boolean} [file.async=true] Whether to upload the file independently of the Promise
|
|
197
197
|
* @param {function} [file.onProgress] A callback for tracking the upload percentage
|
|
198
|
+
* @param {function} [file.onFileDetails] A callback option which provides you with the {@link File} object - before it starts uploading. The File object currently only includes the `id` field.
|
|
198
199
|
* @param {object} [options]
|
|
199
200
|
* @param {number} [options.progressDecimalPlaces] Sets the number of decimal places in the progress events. This can dramatically reduce the frequency the `file.onProgress` callback is invoked.
|
|
200
201
|
* @param {number} [options.concurrent=6] The number of concurrent chunks to encrypt & upload at once.
|
package/lib/api/Files.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _File=require("../models/File");var _File2=_interopRequireDefault(_File);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _ImportProvider=require("../enum/ImportProvider");var _ImportProvider2=_interopRequireDefault(_ImportProvider);var _streamBlocks=require("../util/streamBlocks");var _streamBlocks2=_interopRequireDefault(_streamBlocks);var _bluffer=require("../bluffer");var _bluffer2=_interopRequireDefault(_bluffer);var _getContentLength=require("../util/getContentLength");var _getContentLength2=_interopRequireDefault(_getContentLength);var _constants=require("../util/constants");var _throttle=require("../util/throttle");var _throttle2=_interopRequireDefault(_throttle);var _concurrent=require("../util/concurrent");var _concurrent2=_interopRequireDefault(_concurrent);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i]}return target}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 parseFilename(filename){var extensionIndex=filename.lastIndexOf(".");var name=filename.substring(0,extensionIndex);var extension=filename.substring(extensionIndex+1);return{name:name,extension:extension}}function containPercentage(percent,left,right){var total=1-(left+right);return total*percent+left}var Files=function(_API){_inherits(Files,_API);function Files(){_classCallCheck(this,Files);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Files.prototype.generateToken=function generateToken(assignedTo,assignedType){if(assignedTo&&!assignedType){return Promise.reject(Error('The "assignedType" option is required when specifying the "assignedTo" option.'))}if(!assignedTo&&assignedType){return Promise.reject(Error('The "assignedTo" option is required when specifying the "assignedType" option.'))}return this.client.request("files.legacy.generate-token",{relatedId:assignedTo,fileType:assignedType}).then(function(response){return response.data.Token})};Files.prototype.setCanDownload=function setCanDownload(fileId,canDownload){return this.client.request("files.can-download.update",{fileId:fileId,downloadOriginal:canDownload?1:0})};Files.prototype._waitFileProcessed=function _waitFileProcessed(id){var _this2=this;return new Promise(function(resolve,reject){var checkTimeout=null;var timeoutTimeout=null;var check=function check(){_this2.details(id).then(function(file){checkTimeout=null;switch(file.status){case _FileStatus2.default.OK:{resolve(file);break}case _FileStatus2.default.ERROR:{reject(new Error("File "+id+" encountered a processing error: "+file.message));break}default:{checkTimeout=setTimeout(check,5e3);break}}if(!checkTimeout||file.status===_FileStatus2.default.RIPPING){clearTimeout(timeoutTimeout)}}).catch(reject)};check();timeoutTimeout=setTimeout(function(){clearTimeout(checkTimeout);reject(new Error("File did not finish processing within specified duration."))},3e4)})};Files.prototype._createWebsiteFile=function _createWebsiteFile(url){var _this3=this;return this._generateKeyIVEnvelope().then(function(_ref){var envelope=_ref.envelope;return _this3.client.request("files.import.web",{url:url,envelope:envelope})}).then(function(response){return response.data})};Files.prototype._importFileFromUrl=function _importFileFromUrl(_ref2){var _this4=this;var name=_ref2.name,url=_ref2.url,provider=_ref2.provider,auth=_ref2.auth,download=_ref2.download;var endpoint=provider;if(provider===_ImportProvider2.default.NONE){endpoint="generic"}var _parseFilename=parseFilename(name),filename=_parseFilename.name,extension=_parseFilename.extension;return this._generateKeyIVEnvelope().then(function(_ref3){var envelope=_ref3.envelope;return _this4.client.request("files.import."+endpoint,{extn:extension,filename:filename,url:url,envelope:envelope,accessToken:auth,storeOriginal:download})}).then(function(response){return response.data})};Files.prototype.import=function _import(_ref4){var _this5=this;var name=_ref4.name,url=_ref4.url,_ref4$provider=_ref4.provider,provider=_ref4$provider===undefined?_ImportProvider2.default.NONE:_ref4$provider,auth=_ref4.auth,_ref4$download=_ref4.download,download=_ref4$download===undefined?false:_ref4$download,_ref4$process=_ref4.process,process=_ref4$process===undefined?false:_ref4$process;var providerSupported=Object.keys(_ImportProvider2.default).some(function(key){return _ImportProvider2.default[key]===provider});if(!providerSupported){return Promise.reject(new Error('Unsupported provider "'+provider+'"'))}return(provider===_ImportProvider2.default.WEBSITE?this._createWebsiteFile(url):this._importFileFromUrl({name:name,url:url,provider:provider,auth:auth,download:download})).then(function(token){if(process){return _this5._waitFileProcessed(token)}else{var file=new _File2.default;file.id=token;return file}})};Files.prototype.email=function email(){return this.client.request("files.create-email").then(function(response){return response.data})};Files.prototype._generateKeyIVEnvelope=function _generateKeyIVEnvelope(){var _this6=this;return this.client.crypto().generateKeyIV().then(function(keyIV){return Promise.all([keyIV,_this6.client.crypto().envelopeSeal(keyIV.keyIV,[_this6.client.session.serverPublicKeyPEM,_this6.client.session.publicKeyPEM])])}).then(function(_ref5){var keyIV=_ref5[0],envelope=_ref5[1];return{keyIV:keyIV,envelope:envelope}})};Files.prototype.upload=function upload(){return this.upload__v2.apply(this,arguments)};Files.prototype.upload__v2=function upload__v2(files){var _this7=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var _options$concurrent=options.concurrent,concurrency=_options$concurrent===undefined?6:_options$concurrent,opts=_objectWithoutProperties(options,["concurrent"]);var scheduleChunk=(0,_concurrent2.default)(concurrency);var scheduleDone=(0,_concurrent2.default)(1);var doneFiles=[];var multipleFiles=Array.isArray(files);var filesList=multipleFiles?files:[files];var done=function done(result){doneFiles.push(result);return scheduleDone(function(){if(doneFiles.length){var _doneFiles=doneFiles.slice();doneFiles.length=0;return _this7.client.request("files.v2.upload-complete",{files:_doneFiles})}return null})};return this.client.request("files.v2.generate-credentials",{supports:{providers:["abs","custom"]},files:filesList.map(function(file){var name=void 0;var extension=void 0;if(file.extension){var _ref6=[file.name,file.extension];name=_ref6[0];extension=_ref6[1]}else{var parsed=parseFilename(file.name);var _ref7=[parsed.name,parsed.extension];name=_ref7[0];extension=_ref7[1]}var size=(0,_getContentLength2.default)(file.contents);var chunks=Math.ceil(size/_constants.BYTES_PER_BLOCK);if(file.onProgress){file.onProgress(0)}return{name:name,extension:extension,chunks:chunks,size:size,hash:null,adobeExportData:file.adobeExportData?JSON.stringify(file.adobeExportData):null,assignedTo:file.assignedTo,assignedType:file.assignedType,canDownload:typeof file.download!=="undefined"?!!file.download:true}})}).then(function(response){return Promise.all(filesList.map(function(file,index){var definition=response.data[index];if(file.onProgress){file.onProgress(1)}return _this7._upload__v2(file,definition,opts,scheduleChunk,done).then(function(){var entity=new _File2.default;entity.id=definition.FileId;return entity})}))}).then(function(results){return multipleFiles?results:results[0]})};Files.prototype._upload__v2=function _upload__v2(file,definition,options,schedule,done){var _this8=this;return this._generateKeyIVEnvelope().then(function(_ref8){var keyIV=_ref8.keyIV,envelope=_ref8.envelope;return new Promise(function(resolve){var fileId=definition.FileId,uploadCredentials=definition.UploadCredentials;var bluffer=new _bluffer2.default;var complete=false;var index=0;var blocks=(0,_streamBlocks2.default)(file.contents,function(b){return bluffer.readBase64(b)});var tasks=[];var count=Math.ceil((0,_getContentLength2.default)(file.contents)/_constants.BYTES_PER_BLOCK);var percent=new Array(count);var lastPercent=1;var onUploadProgress=function onUploadProgress(){};var onProgress=file.onProgress;if(onProgress){onUploadProgress=function onUploadProgress(blockIndex,progress){percent[blockIndex]=Math.max(progress,percent[blockIndex]||0);var totalPercent=containPercentage(percent.reduce(function(a,b){return a+(b||0)},0)/count/100,.01,.01)*100;if(typeof options.progressDecimalPlaces!=="undefined"){totalPercent=+totalPercent.toFixed(options.progressDecimalPlaces)}if(lastPercent!==totalPercent){onProgress(totalPercent);lastPercent=totalPercent}}}function handle(block,blockIndex){var task=encryptAndUpload(block,blockIndex);tasks.push(task);return task}var abs=function abs(block,blockIndex){return _this8.client.rawRequest({method:"PUT",host:uploadCredentials.url,path:"/"+fileId+"/"+blockIndex,query:uploadCredentials.sas,body:block,headers:{"x-ms-blob-type":"BlockBlob"}},{onUploadProgress:onUploadProgress.bind(null,blockIndex)})};var custom=function custom(block,blockIndex){var values={"file.id":fileId,"chunk.index":blockIndex};var interpolate=function interpolate(str){var map=arguments.length>1&&arguments[1]!==undefined?arguments[1]:function(a){return a};return str.replace(/\{([\w\.]+)\}/g,function(_,key){return map(values[key])})};var interpolatedHeaders={};Object.keys(uploadCredentials.headers).forEach(function(name){var value=interpolate(uploadCredentials.headers[name]);interpolatedHeaders[interpolate(name)]=value});return _this8.client.rawRequest({method:uploadCredentials.method,host:interpolate(uploadCredentials.host),path:interpolate(uploadCredentials.path,encodeURIComponent),query:interpolate(uploadCredentials.query,encodeURIComponent),body:block,headers:interpolatedHeaders},{onUploadProgress:onUploadProgress.bind(null,blockIndex)})};var uploadData={abs:abs,custom:custom}[uploadCredentials.type];var encryptAndUpload=function encryptAndUpload(block,blockIndex){return _this8.client.crypto().encryptFileBlock(keyIV,block,true).then(function(block$_){return bluffer.createBase64(block$_)}).then(function(block$){return uploadData(block$,blockIndex)})};var finish=function finish(){return done({fileId:fileId,envelope:envelope}).then(function(){if(onProgress)onProgress(100)})};function next(){if(complete){return}schedule(function(){return blocks().then(function(data){if(data){next();return handle(data,index++)}else if(!complete){complete=true;var final=Promise.all(tasks).then(finish);resolve(final)}})})}next();if(file.async!==false){resolve()}})})};Files.prototype.upload__legacy=function upload__legacy(_ref9){var _this9=this;var name=_ref9.name,contents=_ref9.contents,adobeExportData=_ref9.adobeExportData,assignedTo=_ref9.assignedTo,assignedType=_ref9.assignedType,_ref9$download=_ref9.download,download=_ref9$download===undefined?false:_ref9$download,_ref9$async=_ref9.async,async=_ref9$async===undefined?true:_ref9$async,onProgress=_ref9.onProgress,onError=_ref9.onError;return this.generateToken(assignedTo,assignedType).then(function(token){return Promise.all([token,_this9._generateKeyIVEnvelope()])}).then(function(_ref10){var token=_ref10[0],_ref10$=_ref10[1],keyIV=_ref10$.keyIV,envelope=_ref10$.envelope;var process=_this9._upload__legacy({name:name,contents:contents,adobeExportData:adobeExportData,download:download,token:token,keyIV:keyIV,envelope:envelope,onProgress:onProgress,onError:onError});if(async){process=Promise.resolve()}return process.then(function(){return token})}).then(function(token){var file=new _File2.default;file.id=token;return file})};Files.prototype._upload__legacy=function _upload__legacy(_ref11){var _this10=this;var name=_ref11.name,contents=_ref11.contents,adobeExportData=_ref11.adobeExportData,download=_ref11.download,token=_ref11.token,keyIV=_ref11.keyIV,envelope=_ref11.envelope,onProgress=_ref11.onProgress;return new Promise(function(resolve){var concurrent=4;var _parseFilename2=parseFilename(name),filename=_parseFilename2.name,extension=_parseFilename2.extension;var blocks=(0,_streamBlocks2.default)(contents);var chain=Promise.resolve();var index=0;var end=false;var count=Math.ceil((0,_getContentLength2.default)(contents)/_constants.BYTES_PER_BLOCK);var percent=new Array(count);var onUploadProgress=function onUploadProgress(){};if(onProgress){onUploadProgress=function onUploadProgress(blockIndex,progress){percent[blockIndex]=Math.max(progress,percent[blockIndex]||0);onProgress(percent.reduce(function(a,b){return a+(b||0)},0)/count*.99)}}var process=function process(block,blockIndex){return _this10.client.crypto().encryptFileBlock(keyIV,block).then(function(block$){return _this10.client.request("files.legacy.upload-block",{block:blockIndex,part:1,token:token,data:block$},{onUploadProgress:onUploadProgress.bind(null,blockIndex)})})};function next(){blocks().then(function(block){if(end)return;if(block===null){end=true;resolve(chain.then(complete))}else{var handle=process(block,index++);chain=chain.then(function(){return handle});handle.then(next)}})}var complete=function complete(){return _this10.client.request("files.legacy.upload-complete",{block:0,blockCount:index,part:0,token:token,extn:extension,pages:1,filename:filename,storeoriginal:download?1:0,adobeExportData:adobeExportData?JSON.stringify(adobeExportData):null,envelope:envelope}).then(function(){return onProgress&&onProgress(100)})};while(concurrent--){next()}})};Files.prototype.download=function download(_options){var _this11=this;var options=typeof _options==="string"?{fileId:_options}:_options;var fileId=options.fileId,onFileDetails=options.onFileDetails;return this.details(fileId).then(function(file){if(!file.downloadable){throw new Error("File "+fileId+" is not downloadable.")}if(file.status!==_FileStatus2.default.OK){throw new Error("File "+fileId+" cannot be download. The file may still be uploading, processing or has errored.")}if(!file.blocks){throw new Error("File "+fileId+" is empty.")}if(onFileDetails){onFileDetails(file)}return _this11._downloadFile(file,options)})};Files.prototype._downloadFile=function _downloadFile(file,options){var _this12=this;return new Promise(function(resolve){var concurrent=4;var bluffer=new _bluffer2.default;var count=file.blocks;var blocks=new Array(count);var chain=Promise.resolve();var onData=options.onData||function onData(block,index){blocks[index]=block};var onDownloadProgress=function onDownloadProgress(){};if(options.onProgress){var percent=new Array(count);onDownloadProgress=function onDownloadProgress(blockIndex,progress){percent[blockIndex]=Math.max(progress,percent[blockIndex]||0);options.onProgress(percent.reduce(function(a,b){return a+(b||0)},0)/count*.99)}}var process=function process(blockIndex){return _this12.client.request("files.download-block",{proofId:file.assignedTo,fileId:file.id,block:blockIndex+1},{onDownloadProgress:onDownloadProgress.bind(null,blockIndex)}).then(function(response){return _this12.client.crypto().decryptFileBlock(response.data,_this12.client.session.privateKeyPEM).then(function(blockBase64){return bluffer.createBase64(blockBase64)})})};var index=0;var end=false;function next(){if(end)return;if(index<blocks.length){var blockIndex=index++;var block=process(blockIndex);chain=chain.then(function(){return block.then(function(data){return onData(data,blockIndex,count)})});block.then(next)}else{end=true;resolve(chain.then(complete))}}var complete=function complete(){if(options.onProgress){options.onProgress(100)}if(!options.onData){return bluffer.combine.apply(bluffer,blocks)}return null};while(concurrent--){next()}})};Files.prototype.details=function details(fileId){return this.client.request("files.details",{fileId:fileId}).then(function(response){return(new _File2.default).fromFile(response.data)})};Files.prototype.thumbnail=function thumbnail(fileId){var _this13=this;return this.client.cache.auto(_constants.THUMBNAIL_CACHE_PREFIX+fileId,function(){return _this13._thumbnail(fileId)})};Files.prototype._thumbnail=function _thumbnail(fileId){var _this14=this;return this.client.request("files.thumbnail",{fileId:fileId}).then(function(response){return _this14.client.crypto().decryptImage(response.data,_this14.client.session.privateKeyPEM)}).then(function(imageBase64){var bluffer=new _bluffer2.default;return bluffer.createBase64(imageBase64)})};Files.prototype.thumbnails=function thumbnails(fileIds,_ref12){var _this15=this;var _ref12$async=_ref12.async,async=_ref12$async===undefined?false:_ref12$async,onLoadThumbnail=_ref12.onLoadThumbnail,onLoadThumbnails=_ref12.onLoadThumbnails,_ref12$onLoadThumbnai=_ref12.onLoadThumbnailsThrottleMs,onLoadThumbnailsThrottleMs=_ref12$onLoadThumbnai===undefined?1e3:_ref12$onLoadThumbnai,onLoadError=_ref12.onLoadError;var scheduled=[];var pendingBatch={};var scheduleOnLoadThumbnails=onLoadThumbnails?(0,_throttle2.default)(function(){if(Object.keys(pendingBatch).length){onLoadThumbnails(pendingBatch);pendingBatch={}}},onLoadThumbnailsThrottleMs):function(){};return Promise.all(fileIds.map(function(fileId){return _this15.client.cache.auto(_constants.THUMBNAIL_CACHE_PREFIX+fileId,function(resolve){scheduled.push({fileId:fileId,resolve:resolve})}).then(function(thumbnail){var _ref13;return thumbnail&&(_ref13={},_ref13[fileId]=thumbnail,_ref13)})})).then(function(entries){var more=Promise.all(scheduled.map(function(_ref14){var fileId=_ref14.fileId,resolve=_ref14.resolve;return _this15._thumbnail(fileId).then(function(thumbnail){var _ref15;resolve(thumbnail);if(onLoadThumbnail){var _onLoadThumbnail;onLoadThumbnail((_onLoadThumbnail={},_onLoadThumbnail[fileId]=thumbnail,_onLoadThumbnail))}pendingBatch[fileId]=thumbnail;scheduleOnLoadThumbnails();return _ref15={},_ref15[fileId]=thumbnail,_ref15}).catch(function(err){if(onLoadError){onLoadError(err,fileId)}if(!async){return Promise.reject(err)}return{}})}));if(async){return entries}else{return more.then(function(moreEntries){return[].concat(entries,moreEntries)})}}).then(function(entries){return Object.assign.apply(Object,[{}].concat(entries))})};return Files}(_API3.default);exports.default=Files;
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _File=require("../models/File");var _File2=_interopRequireDefault(_File);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _ImportProvider=require("../enum/ImportProvider");var _ImportProvider2=_interopRequireDefault(_ImportProvider);var _streamBlocks=require("../util/streamBlocks");var _streamBlocks2=_interopRequireDefault(_streamBlocks);var _bluffer=require("../bluffer");var _bluffer2=_interopRequireDefault(_bluffer);var _getContentLength=require("../util/getContentLength");var _getContentLength2=_interopRequireDefault(_getContentLength);var _constants=require("../util/constants");var _throttle=require("../util/throttle");var _throttle2=_interopRequireDefault(_throttle);var _concurrent=require("../util/concurrent");var _concurrent2=_interopRequireDefault(_concurrent);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i]}return target}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 parseFilename(filename){var extensionIndex=filename.lastIndexOf(".");var name=filename.substring(0,extensionIndex);var extension=filename.substring(extensionIndex+1);return{name:name,extension:extension}}function containPercentage(percent,left,right){var total=1-(left+right);return total*percent+left}var Files=function(_API){_inherits(Files,_API);function Files(){_classCallCheck(this,Files);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Files.prototype.generateToken=function generateToken(assignedTo,assignedType){if(assignedTo&&!assignedType){return Promise.reject(Error('The "assignedType" option is required when specifying the "assignedTo" option.'))}if(!assignedTo&&assignedType){return Promise.reject(Error('The "assignedTo" option is required when specifying the "assignedType" option.'))}return this.client.request("files.legacy.generate-token",{relatedId:assignedTo,fileType:assignedType}).then(function(response){return response.data.Token})};Files.prototype.setCanDownload=function setCanDownload(fileId,canDownload){return this.client.request("files.can-download.update",{fileId:fileId,downloadOriginal:canDownload?1:0})};Files.prototype._waitFileProcessed=function _waitFileProcessed(id){var _this2=this;return new Promise(function(resolve,reject){var checkTimeout=null;var timeoutTimeout=null;var check=function check(){_this2.details(id).then(function(file){checkTimeout=null;switch(file.status){case _FileStatus2.default.OK:{resolve(file);break}case _FileStatus2.default.ERROR:{reject(new Error("File "+id+" encountered a processing error: "+file.message));break}default:{checkTimeout=setTimeout(check,5e3);break}}if(!checkTimeout||file.status===_FileStatus2.default.RIPPING){clearTimeout(timeoutTimeout)}}).catch(reject)};check();timeoutTimeout=setTimeout(function(){clearTimeout(checkTimeout);reject(new Error("File did not finish processing within specified duration."))},3e4)})};Files.prototype._createWebsiteFile=function _createWebsiteFile(url){var _this3=this;return this._generateKeyIVEnvelope().then(function(_ref){var envelope=_ref.envelope;return _this3.client.request("files.import.web",{url:url,envelope:envelope})}).then(function(response){return response.data})};Files.prototype._importFileFromUrl=function _importFileFromUrl(_ref2){var _this4=this;var name=_ref2.name,url=_ref2.url,provider=_ref2.provider,auth=_ref2.auth,download=_ref2.download;var endpoint=provider;if(provider===_ImportProvider2.default.NONE){endpoint="generic"}var _parseFilename=parseFilename(name),filename=_parseFilename.name,extension=_parseFilename.extension;return this._generateKeyIVEnvelope().then(function(_ref3){var envelope=_ref3.envelope;return _this4.client.request("files.import."+endpoint,{extn:extension,filename:filename,url:url,envelope:envelope,accessToken:auth,storeOriginal:download})}).then(function(response){return response.data})};Files.prototype.import=function _import(_ref4){var _this5=this;var name=_ref4.name,url=_ref4.url,_ref4$provider=_ref4.provider,provider=_ref4$provider===undefined?_ImportProvider2.default.NONE:_ref4$provider,auth=_ref4.auth,_ref4$download=_ref4.download,download=_ref4$download===undefined?false:_ref4$download,_ref4$process=_ref4.process,process=_ref4$process===undefined?false:_ref4$process;var providerSupported=Object.keys(_ImportProvider2.default).some(function(key){return _ImportProvider2.default[key]===provider});if(!providerSupported){return Promise.reject(new Error('Unsupported provider "'+provider+'"'))}return(provider===_ImportProvider2.default.WEBSITE?this._createWebsiteFile(url):this._importFileFromUrl({name:name,url:url,provider:provider,auth:auth,download:download})).then(function(token){if(process){return _this5._waitFileProcessed(token)}else{var file=new _File2.default;file.id=token;return file}})};Files.prototype.email=function email(){return this.client.request("files.create-email").then(function(response){return response.data})};Files.prototype._generateKeyIVEnvelope=function _generateKeyIVEnvelope(){var _this6=this;return this.client.crypto().generateKeyIV().then(function(keyIV){return Promise.all([keyIV,_this6.client.crypto().envelopeSeal(keyIV.keyIV,[_this6.client.session.serverPublicKeyPEM,_this6.client.session.publicKeyPEM])])}).then(function(_ref5){var keyIV=_ref5[0],envelope=_ref5[1];return{keyIV:keyIV,envelope:envelope}})};Files.prototype.upload=function upload(){return this.upload__v2.apply(this,arguments)};Files.prototype.upload__v2=function upload__v2(files){var _this7=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var _options$concurrent=options.concurrent,concurrency=_options$concurrent===undefined?6:_options$concurrent,opts=_objectWithoutProperties(options,["concurrent"]);var scheduleChunk=(0,_concurrent2.default)(concurrency);var scheduleDone=(0,_concurrent2.default)(1);var doneFiles=[];var multipleFiles=Array.isArray(files);var filesList=multipleFiles?files:[files];var done=function done(result){doneFiles.push(result);return scheduleDone(function(){if(doneFiles.length){var _doneFiles=doneFiles.slice();doneFiles.length=0;return _this7.client.request("files.v2.upload-complete",{files:_doneFiles})}return null})};return this.client.request("files.v2.generate-credentials",{supports:{providers:["abs","custom"]},files:filesList.map(function(file){var name=void 0;var extension=void 0;if(file.extension){var _ref6=[file.name,file.extension];name=_ref6[0];extension=_ref6[1]}else{var parsed=parseFilename(file.name);var _ref7=[parsed.name,parsed.extension];name=_ref7[0];extension=_ref7[1]}var size=(0,_getContentLength2.default)(file.contents);var chunks=Math.ceil(size/_constants.BYTES_PER_BLOCK);if(file.onProgress){file.onProgress(0)}return{name:name,extension:extension,chunks:chunks,size:size,hash:null,adobeExportData:file.adobeExportData?JSON.stringify(file.adobeExportData):null,assignedTo:file.assignedTo,assignedType:file.assignedType,canDownload:typeof file.download!=="undefined"?!!file.download:true}})}).then(function(response){return Promise.all(filesList.map(function(file,index){var definition=response.data[index];if(file.onProgress){file.onProgress(1)}var entity=new _File2.default;entity.id=definition.FileId;if(file.onFileDetails){file.onFileDetails(entity)}return _this7._upload__v2(file,definition,opts,scheduleChunk,done).then(function(){return entity})}))}).then(function(results){return multipleFiles?results:results[0]})};Files.prototype._upload__v2=function _upload__v2(file,definition,options,schedule,done){var _this8=this;return this._generateKeyIVEnvelope().then(function(_ref8){var keyIV=_ref8.keyIV,envelope=_ref8.envelope;return new Promise(function(resolve){var fileId=definition.FileId,uploadCredentials=definition.UploadCredentials;var bluffer=new _bluffer2.default;var complete=false;var index=0;var blocks=(0,_streamBlocks2.default)(file.contents,function(b){return bluffer.readBase64(b)});var tasks=[];var count=Math.ceil((0,_getContentLength2.default)(file.contents)/_constants.BYTES_PER_BLOCK);var percent=new Array(count);var lastPercent=1;var onUploadProgress=function onUploadProgress(){};var onProgress=file.onProgress;if(onProgress){onUploadProgress=function onUploadProgress(blockIndex,progress){percent[blockIndex]=Math.max(progress,percent[blockIndex]||0);var totalPercent=containPercentage(percent.reduce(function(a,b){return a+(b||0)},0)/count/100,.01,.01)*100;if(typeof options.progressDecimalPlaces!=="undefined"){totalPercent=+totalPercent.toFixed(options.progressDecimalPlaces)}if(lastPercent!==totalPercent){onProgress(totalPercent);lastPercent=totalPercent}}}function handle(block,blockIndex){var task=encryptAndUpload(block,blockIndex);tasks.push(task);return task}var abs=function abs(block,blockIndex){return _this8.client.rawRequest({method:"PUT",host:uploadCredentials.url,path:"/"+fileId+"/"+blockIndex,query:uploadCredentials.sas,body:block,headers:{"x-ms-blob-type":"BlockBlob"}},{onUploadProgress:onUploadProgress.bind(null,blockIndex)})};var custom=function custom(block,blockIndex){var values={"file.id":fileId,"chunk.index":blockIndex};var interpolate=function interpolate(str){var map=arguments.length>1&&arguments[1]!==undefined?arguments[1]:function(a){return a};return str.replace(/\{([\w\.]+)\}/g,function(_,key){return map(values[key])})};var interpolatedHeaders={};Object.keys(uploadCredentials.headers).forEach(function(name){var value=interpolate(uploadCredentials.headers[name]);interpolatedHeaders[interpolate(name)]=value});return _this8.client.rawRequest({method:uploadCredentials.method,host:interpolate(uploadCredentials.host),path:interpolate(uploadCredentials.path,encodeURIComponent),query:interpolate(uploadCredentials.query,encodeURIComponent),body:block,headers:interpolatedHeaders},{onUploadProgress:onUploadProgress.bind(null,blockIndex)})};var uploadData={abs:abs,custom:custom}[uploadCredentials.type];var encryptAndUpload=function encryptAndUpload(block,blockIndex){return _this8.client.crypto().encryptFileBlock(keyIV,block,true).then(function(block$_){return bluffer.createBase64(block$_)}).then(function(block$){return uploadData(block$,blockIndex)})};var finish=function finish(){return done({fileId:fileId,envelope:envelope}).then(function(){if(onProgress)onProgress(100)})};function next(){if(complete){return}schedule(function(){return blocks().then(function(data){if(data){next();return handle(data,index++)}else if(!complete){complete=true;var final=Promise.all(tasks).then(finish);resolve(final)}})})}next();if(file.async!==false){resolve()}})})};Files.prototype.upload__legacy=function upload__legacy(_ref9){var _this9=this;var name=_ref9.name,contents=_ref9.contents,adobeExportData=_ref9.adobeExportData,assignedTo=_ref9.assignedTo,assignedType=_ref9.assignedType,_ref9$download=_ref9.download,download=_ref9$download===undefined?false:_ref9$download,_ref9$async=_ref9.async,async=_ref9$async===undefined?true:_ref9$async,onProgress=_ref9.onProgress,onError=_ref9.onError;return this.generateToken(assignedTo,assignedType).then(function(token){return Promise.all([token,_this9._generateKeyIVEnvelope()])}).then(function(_ref10){var token=_ref10[0],_ref10$=_ref10[1],keyIV=_ref10$.keyIV,envelope=_ref10$.envelope;var process=_this9._upload__legacy({name:name,contents:contents,adobeExportData:adobeExportData,download:download,token:token,keyIV:keyIV,envelope:envelope,onProgress:onProgress,onError:onError});if(async){process=Promise.resolve()}return process.then(function(){return token})}).then(function(token){var file=new _File2.default;file.id=token;return file})};Files.prototype._upload__legacy=function _upload__legacy(_ref11){var _this10=this;var name=_ref11.name,contents=_ref11.contents,adobeExportData=_ref11.adobeExportData,download=_ref11.download,token=_ref11.token,keyIV=_ref11.keyIV,envelope=_ref11.envelope,onProgress=_ref11.onProgress;return new Promise(function(resolve){var concurrent=4;var _parseFilename2=parseFilename(name),filename=_parseFilename2.name,extension=_parseFilename2.extension;var blocks=(0,_streamBlocks2.default)(contents);var chain=Promise.resolve();var index=0;var end=false;var count=Math.ceil((0,_getContentLength2.default)(contents)/_constants.BYTES_PER_BLOCK);var percent=new Array(count);var onUploadProgress=function onUploadProgress(){};if(onProgress){onUploadProgress=function onUploadProgress(blockIndex,progress){percent[blockIndex]=Math.max(progress,percent[blockIndex]||0);onProgress(percent.reduce(function(a,b){return a+(b||0)},0)/count*.99)}}var process=function process(block,blockIndex){return _this10.client.crypto().encryptFileBlock(keyIV,block).then(function(block$){return _this10.client.request("files.legacy.upload-block",{block:blockIndex,part:1,token:token,data:block$},{onUploadProgress:onUploadProgress.bind(null,blockIndex)})})};function next(){blocks().then(function(block){if(end)return;if(block===null){end=true;resolve(chain.then(complete))}else{var handle=process(block,index++);chain=chain.then(function(){return handle});handle.then(next)}})}var complete=function complete(){return _this10.client.request("files.legacy.upload-complete",{block:0,blockCount:index,part:0,token:token,extn:extension,pages:1,filename:filename,storeoriginal:download?1:0,adobeExportData:adobeExportData?JSON.stringify(adobeExportData):null,envelope:envelope}).then(function(){return onProgress&&onProgress(100)})};while(concurrent--){next()}})};Files.prototype.download=function download(_options){var _this11=this;var options=typeof _options==="string"?{fileId:_options}:_options;var fileId=options.fileId,onFileDetails=options.onFileDetails;return this.details(fileId).then(function(file){if(!file.downloadable){throw new Error("File "+fileId+" is not downloadable.")}if(file.status!==_FileStatus2.default.OK){throw new Error("File "+fileId+" cannot be download. The file may still be uploading, processing or has errored.")}if(!file.blocks){throw new Error("File "+fileId+" is empty.")}if(onFileDetails){onFileDetails(file)}return _this11._downloadFile(file,options)})};Files.prototype._downloadFile=function _downloadFile(file,options){var _this12=this;return new Promise(function(resolve){var concurrent=4;var bluffer=new _bluffer2.default;var count=file.blocks;var blocks=new Array(count);var chain=Promise.resolve();var onData=options.onData||function onData(block,index){blocks[index]=block};var onDownloadProgress=function onDownloadProgress(){};if(options.onProgress){var percent=new Array(count);onDownloadProgress=function onDownloadProgress(blockIndex,progress){percent[blockIndex]=Math.max(progress,percent[blockIndex]||0);options.onProgress(percent.reduce(function(a,b){return a+(b||0)},0)/count*.99)}}var process=function process(blockIndex){return _this12.client.request("files.download-block",{proofId:file.assignedTo,fileId:file.id,block:blockIndex+1},{onDownloadProgress:onDownloadProgress.bind(null,blockIndex)}).then(function(response){return _this12.client.crypto().decryptFileBlock(response.data,_this12.client.session.privateKeyPEM).then(function(blockBase64){return bluffer.createBase64(blockBase64)})})};var index=0;var end=false;function next(){if(end)return;if(index<blocks.length){var blockIndex=index++;var block=process(blockIndex);chain=chain.then(function(){return block.then(function(data){return onData(data,blockIndex,count)})});block.then(next)}else{end=true;resolve(chain.then(complete))}}var complete=function complete(){if(options.onProgress){options.onProgress(100)}if(!options.onData){return bluffer.combine.apply(bluffer,blocks)}return null};while(concurrent--){next()}})};Files.prototype.details=function details(fileId){return this.client.request("files.details",{fileId:fileId}).then(function(response){return(new _File2.default).fromFile(response.data)})};Files.prototype.thumbnail=function thumbnail(fileId){var _this13=this;return this.client.cache.auto(_constants.THUMBNAIL_CACHE_PREFIX+fileId,function(){return _this13._thumbnail(fileId)})};Files.prototype._thumbnail=function _thumbnail(fileId){var _this14=this;return this.client.request("files.thumbnail",{fileId:fileId}).then(function(response){return _this14.client.crypto().decryptImage(response.data,_this14.client.session.privateKeyPEM)}).then(function(imageBase64){var bluffer=new _bluffer2.default;return bluffer.createBase64(imageBase64)})};Files.prototype.thumbnails=function thumbnails(fileIds,_ref12){var _this15=this;var _ref12$async=_ref12.async,async=_ref12$async===undefined?false:_ref12$async,onLoadThumbnail=_ref12.onLoadThumbnail,onLoadThumbnails=_ref12.onLoadThumbnails,_ref12$onLoadThumbnai=_ref12.onLoadThumbnailsThrottleMs,onLoadThumbnailsThrottleMs=_ref12$onLoadThumbnai===undefined?1e3:_ref12$onLoadThumbnai,onLoadError=_ref12.onLoadError;var scheduled=[];var pendingBatch={};var scheduleOnLoadThumbnails=onLoadThumbnails?(0,_throttle2.default)(function(){if(Object.keys(pendingBatch).length){onLoadThumbnails(pendingBatch);pendingBatch={}}},onLoadThumbnailsThrottleMs):function(){};return Promise.all(fileIds.map(function(fileId){return _this15.client.cache.auto(_constants.THUMBNAIL_CACHE_PREFIX+fileId,function(resolve){scheduled.push({fileId:fileId,resolve:resolve})}).then(function(thumbnail){var _ref13;return thumbnail&&(_ref13={},_ref13[fileId]=thumbnail,_ref13)})})).then(function(entries){var more=Promise.all(scheduled.map(function(_ref14){var fileId=_ref14.fileId,resolve=_ref14.resolve;return _this15._thumbnail(fileId).then(function(thumbnail){var _ref15;resolve(thumbnail);if(onLoadThumbnail){var _onLoadThumbnail;onLoadThumbnail((_onLoadThumbnail={},_onLoadThumbnail[fileId]=thumbnail,_onLoadThumbnail))}pendingBatch[fileId]=thumbnail;scheduleOnLoadThumbnails();return _ref15={},_ref15[fileId]=thumbnail,_ref15}).catch(function(err){if(onLoadError){onLoadError(err,fileId)}if(!async){return Promise.reject(err)}return{}})}));if(async){return entries}else{return more.then(function(moreEntries){return[].concat(entries,moreEntries)})}}).then(function(entries){return Object.assign.apply(Object,[{}].concat(entries))})};return Files}(_API3.default);exports.default=Files;
|
|
@@ -15,9 +15,10 @@ declare class Integrations extends API {
|
|
|
15
15
|
* const availableConfigurations = await client.profile.integrations.configurations();
|
|
16
16
|
*
|
|
17
17
|
* @since 2.0.0-beta.141
|
|
18
|
-
* @
|
|
18
|
+
* @param {Array} [integrationKeys] The unique identifiers of the integrations to retrieve configurations for
|
|
19
|
+
* @returns {Promise<Array|null>}
|
|
19
20
|
*/
|
|
20
|
-
configurations(): Promise<any>;
|
|
21
|
+
configurations(integrationKeys?: any[]): Promise<any[]>;
|
|
21
22
|
/**
|
|
22
23
|
* Gets the URL for setting up an integration
|
|
23
24
|
*
|
|
@@ -29,12 +30,38 @@ declare class Integrations extends API {
|
|
|
29
30
|
* const { url, windowFeatures } = await client.profile.integrations.getSetupUrl('monday.com');
|
|
30
31
|
*
|
|
31
32
|
* @since 2.0.0-beta.141
|
|
32
|
-
* @param {string
|
|
33
|
-
* @
|
|
33
|
+
* @param {string} integrationKey The unique identifier for the integration
|
|
34
|
+
* @param {object} [params] Any additional parameters required for building the setup url
|
|
35
|
+
* @returns {Promise<{ url: string, windowFeatures: string }>}
|
|
34
36
|
*/
|
|
35
|
-
getSetupUrl(integrationKey: string
|
|
37
|
+
getSetupUrl(integrationKey: string, params?: any): Promise<{
|
|
36
38
|
url: string;
|
|
37
39
|
windowFeatures: string;
|
|
38
40
|
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Disables an integration
|
|
43
|
+
*
|
|
44
|
+
* @example <caption>Disabling an integration for a team</caption>
|
|
45
|
+
* const admin = await client.admin();
|
|
46
|
+
* await admin.team.integrations.disable('monday.com');
|
|
47
|
+
*
|
|
48
|
+
* @example <caption>Disabling an integration for a user</caption>
|
|
49
|
+
* await client.profile.integrations.disable('monday.com');
|
|
50
|
+
*
|
|
51
|
+
* @since 2.0.0-beta.144
|
|
52
|
+
* @param {string} integrationKey The unique identifier for the integration
|
|
53
|
+
* @returns {Promise}
|
|
54
|
+
*/
|
|
55
|
+
disable(integrationKey: string): Promise<any>;
|
|
56
|
+
/**
|
|
57
|
+
* Updates the configuration of an integration
|
|
58
|
+
*
|
|
59
|
+
* @since 2.0.0-beta.148
|
|
60
|
+
* @param {string} integrationKey The unique identifier for the integration
|
|
61
|
+
* @param {string} key The key of the configuration to be updated
|
|
62
|
+
* @param {string} value The value for the configuration to be updated to
|
|
63
|
+
* @returns {Promise}
|
|
64
|
+
*/
|
|
65
|
+
updateConfiguration(integrationKey: string, key: string, value: string): Promise<any>;
|
|
39
66
|
}
|
|
40
67
|
import API from "./API";
|
package/lib/api/Integrations.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Integrations=function(_API){_inherits(Integrations,_API);function Integrations(client,level){_classCallCheck(this,Integrations);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.level=level;return _this}Integrations.prototype.configurations=function configurations(){return this.client.request("integrations.get-configurations",{level:this.level}).then(function(response){if(response.data){return response.data.integrations}return null})};Integrations.prototype.getSetupUrl=function getSetupUrl(integrationKey){return this.client.request("integrations.get-setup-url",{integration_key:integrationKey}).then(function(response){return{url:response.data.url,windowFeatures:response.data.windowFeatures}})};return Integrations}(_API3.default);exports.default=Integrations;
|
|
1
|
+
"use strict";exports.__esModule=true;var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};var _API2=require("./API");var _API3=_interopRequireDefault(_API2);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Integrations=function(_API){_inherits(Integrations,_API);function Integrations(client,level){_classCallCheck(this,Integrations);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.level=level;return _this}Integrations.prototype.configurations=function configurations(){var integrationKeys=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];return this.client.request("integrations.get-configurations",{level:this.level,integration_keys:integrationKeys.join(",")}).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,level:this.level})}).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})};Integrations.prototype.updateConfiguration=function updateConfiguration(integrationKey,key,value){return this.client.request("integrations.update-configuration",{level:this.level,integrationKey:integrationKey,key:key,value:value})};return Integrations}(_API3.default);exports.default=Integrations;
|
package/lib/api/Preferences.d.ts
CHANGED
|
@@ -25,8 +25,9 @@ declare class Preferences extends API {
|
|
|
25
25
|
* PageProof.Enum.Preference.DEFAULT_DUE_DATE,
|
|
26
26
|
* PageProof.Enum.Preference.DEFAULT_DUE_TIME,
|
|
27
27
|
* PageProof.Enum.Preference.DEFAULT_MESSAGE_TO_REVIEWERS,
|
|
28
|
+
* PageProof.Enum.Preference.DEFAULT_REMINDER,
|
|
28
29
|
* ]);
|
|
29
|
-
* const [dueDate, dueTime, messageToReviewers] = preferences;
|
|
30
|
+
* const [dueDate, dueTime, messageToReviewers, proofReminders] = preferences;
|
|
30
31
|
* console.log(messageToReviewers.getValueOrDefault());
|
|
31
32
|
*
|
|
32
33
|
* @example <caption>Retrieving a single preference</caption>
|
package/lib/api/Proofs.d.ts
CHANGED
|
@@ -56,6 +56,12 @@ declare class Proofs extends API {
|
|
|
56
56
|
* @type {ProofsCustomTools}
|
|
57
57
|
*/
|
|
58
58
|
customTools: ProofsCustomTools;
|
|
59
|
+
/**
|
|
60
|
+
* The Proofs Integration References API.
|
|
61
|
+
*
|
|
62
|
+
* @type {ProofsIntegrationReferences}
|
|
63
|
+
*/
|
|
64
|
+
integrationReferences: ProofsIntegrationReferences;
|
|
59
65
|
linkCheck: ProofLinkCheck;
|
|
60
66
|
/**
|
|
61
67
|
* Assigns a workflow to a proof.
|
|
@@ -184,7 +190,7 @@ declare class Proofs extends API {
|
|
|
184
190
|
* @param {boolean} [options.start=true] Whether to immediately start the proof (sends invitation emails to reviewers in the workflow)
|
|
185
191
|
* @returns {Promise<Proof>}
|
|
186
192
|
*/
|
|
187
|
-
create({ name, tags, dueDate, messageToReviewers, workflow, workflowTemplate, file, group, previousProof, team, reference, customTools, reminders, owners, canDownload, start, }: {
|
|
193
|
+
create({ name, tags, dueDate, messageToReviewers, workflow, workflowTemplate, file, group, previousProof, team, reference, customTools, integrationReferences, reminders, owners, canDownload, start, }: {
|
|
188
194
|
name: string;
|
|
189
195
|
tags?: string[];
|
|
190
196
|
dueDate?: Date;
|
|
@@ -458,5 +464,6 @@ import ProofsGroups from "./ProofsGroups";
|
|
|
458
464
|
import ProofsAudit from "./ProofsAudit";
|
|
459
465
|
import ProofsAssets from "./ProofsAssets";
|
|
460
466
|
import ProofsCustomTools from "./ProofsCustomTools";
|
|
467
|
+
import ProofsIntegrationReferences from "./ProofsIntegrationReferences";
|
|
461
468
|
import ProofLinkCheck from "./ProofsLinkCheck";
|
|
462
469
|
import Proof from "../models/Proof";
|
package/lib/api/Proofs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofsOwners=require("./ProofsOwners");var _ProofsOwners2=_interopRequireDefault(_ProofsOwners);var _ProofsEditors=require("./ProofsEditors");var _ProofsEditors2=_interopRequireDefault(_ProofsEditors);var _ProofsReviewers=require("./ProofsReviewers");var _ProofsReviewers2=_interopRequireDefault(_ProofsReviewers);var _ProofsVersions=require("./ProofsVersions");var _ProofsVersions2=_interopRequireDefault(_ProofsVersions);var _ProofsGroups=require("./ProofsGroups");var _ProofsGroups2=_interopRequireDefault(_ProofsGroups);var _ProofsAudit=require("./ProofsAudit");var _ProofsAudit2=_interopRequireDefault(_ProofsAudit);var _ProofsAssets=require("./ProofsAssets");var _ProofsAssets2=_interopRequireDefault(_ProofsAssets);var _ProofsCustomTools=require("./ProofsCustomTools");var _ProofsCustomTools2=_interopRequireDefault(_ProofsCustomTools);var _ProofsLinkCheck=require("./ProofsLinkCheck");var _ProofsLinkCheck2=_interopRequireDefault(_ProofsLinkCheck);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _Reminders=require("./Reminders");var _Reminders2=_interopRequireDefault(_Reminders);var _constants=require("../util/constants");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}function transformProofsForUpdate(proofs){var proofsArrForUpdate=[].concat(proofs);proofsArrForUpdate.forEach(function(proof){proof.proofId=proof.id;delete proof.id});return proofsArrForUpdate}var Proofs=function(_API){_inherits(Proofs,_API);function Proofs(client){_classCallCheck(this,Proofs);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _ProofsOwners2.default(client);_this.editors=new _ProofsEditors2.default(client);_this.reviewers=new _ProofsReviewers2.default(client);_this.versions=new _ProofsVersions2.default(client);_this.groups=new _ProofsGroups2.default(client);_this.reminders=new _Reminders2.default(client);_this.audit=new _ProofsAudit2.default(client);_this.assets=new _ProofsAssets2.default(client);_this.customTools=new _ProofsCustomTools2.default(client);_this.linkCheck=new _ProofsLinkCheck2.default(client);return _this}Proofs.prototype.setWorkflow=function setWorkflow(proofId,workflowId){var _this2=this;return this.client.request("proofs.normalize-workflow",{proofId:proofId,workflowId:workflowId}).then(function(){return _this2.client.request("proofs.set-workflow",{proofId:proofId,workflowId:workflowId})})};Proofs.prototype.setTags=function setTags(proofId,tags){return this.client.request("proofs.set-tags",{relatedId:proofId,tag:tags.join(",")})};Proofs.prototype.deleteTag=function deleteTag(proofId,tag){return this.client.request("proofs.tag-delete",{relatedId:proofId,tag:tag})};Proofs.prototype.setFile=function setFile(proofId,fileId){var _this3=this;return this.client.request("proofs.set-file",{proofId:proofId,fileId:fileId}).then(function(){return _this3.client.request("proofs.distribute-file",{proofId:proofId})})};Proofs.prototype.create=function create(_ref){var _this4=this;var name=_ref.name,_ref$tags=_ref.tags,tags=_ref$tags===undefined?[]:_ref$tags,_ref$dueDate=_ref.dueDate,dueDate=_ref$dueDate===undefined?new Date(Date.now()+3*_constants.DAY_IN_MS):_ref$dueDate,messageToReviewers=_ref.messageToReviewers,workflow=_ref.workflow,workflowTemplate=_ref.workflowTemplate,file=_ref.file,group=_ref.group,previousProof=_ref.previousProof,team=_ref.team,reference=_ref.reference,customTools=_ref.customTools,_ref$reminders=_ref.reminders,reminders=_ref$reminders===undefined?[]:_ref$reminders,owners=_ref.owners,canDownload=_ref.canDownload,_ref$start=_ref.start,start=_ref$start===undefined?true:_ref$start;return this.client.request("proofs.create",{proof:{name:name,tags:tags,dueDate:dueDate.toISOString(),messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,workflowTemplateId:workflowTemplate&&workflowTemplate.id||undefined,fileId:file&&file.id||undefined,groupId:group&&group.id||undefined,previousProofId:previousProof&&previousProof.id||undefined,teamSlug:team&&team.slug||undefined,reference:reference,reminders:[].concat(reminders),owners:owners,canDownload:canDownload,start:start}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();if(customTools&&!previousProof){return _this4.customTools.update(proof.id,customTools).then(function(){return proof})}return proof})};Proofs.prototype.archive=function archive(proofIdOrIds){return this.client.request("proofs.archive",{proofIds:proofIdOrIds})};Proofs.prototype.unarchive=function unarchive(proofId){return this.client.request("proofs.unarchive",{proofId:proofId})};Proofs.prototype.delete=function _delete(proofId){return this.client.request("proofs.delete",{proofId:proofId})};Proofs.prototype.finish=function finish(proofId,decision){return this.client.request("proofs.finish",{proofId:proofId,decision:decision})};Proofs.prototype.approve=function approve(proofId,message){return this.client.request("proofs.manual-approval",{proofId:proofId,message:message})};Proofs.prototype.withdrawApproval=function withdrawApproval(proofId,messageToSender){return this.client.request("proofs.withdraw-approval",{proofId:proofId,messageToSender:messageToSender})};Proofs.prototype.generateEmail=function generateEmail(proofId){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return this.client.request("email.proofs.generate",_extends({proofId:proofId},options)).then(function(response){return response.data})};Proofs.prototype.return=function _return(proofId){return this.client.request("proofs.return",{proofId:proofId})};Proofs.prototype.start=function start(proofId){return this.client.request("proofs.start",{proofId:proofId})};Proofs.prototype.removeEditor=function removeEditor(id){return this.client.request("proofs.remove-editor",{proofId:id})};Proofs.prototype.load=function load(proofId){return this.client.request("proofs.load",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.lock=function lock(proofId){return this.client.request("proofs.lock",{proofId:proofId})};Proofs.prototype.unlock=function unlock(proofId){return this.client.request("proofs.unlock",{proofId:proofId})};Proofs.prototype.requestUnlock=function requestUnlock(proofId){return this.client.request("proofs.request-unlock",{proofId:proofId})};Proofs.prototype.requestAccess=function requestAccess(proofId){return this.client.request("proofs.request-access",{proofId:proofId})};Proofs.prototype.images=function images(proofId){return this.client.request("proofs.images",{proofId:proofId}).then(function(response){return response.data.proof.file})};Proofs.prototype.setMessageToReviewers=function setMessageToReviewers(proofId,messageToReviewers){return this.client.request("proofs.set-reviewers-message",{proofId:proofId,messageToReviewers:messageToReviewers})};Proofs.prototype.returnTodos=function returnTodos(proofIdOrIds,_ref2){var messageToOwners=_ref2.messageToOwners,_ref2$markCommentsAsT=_ref2.markCommentsAsTodo,markCommentsAsTodo=_ref2$markCommentsAsT===undefined?false:_ref2$markCommentsAsT;return this.client.request("proofs.return-todos",{proofIds:[].concat(proofIdOrIds),messageToOwners:messageToOwners,markCommentAsTodo:markCommentsAsTodo})};Proofs.prototype.updateDecision=function updateDecision(proofId,decision){return this.client.request("proofs.update-decision",{proofId:proofId,decision:decision})};Proofs.prototype.update=function update(proofOrProofs){if(proofOrProofs.length===1||typeof proofOrProofs.length==="undefined"){var _concat$=[].concat(proofOrProofs)[0],id=_concat$.id,name=_concat$.name,tags=_concat$.tags,dueDate=_concat$.dueDate,messageToReviewers=_concat$.messageToReviewers,workflow=_concat$.workflow,file=_concat$.file,reference=_concat$.reference,reminders=_concat$.reminders,owners=_concat$.owners,canDownload=_concat$.canDownload,start=_concat$.start;return this.client.request("proofs.update",{proof:{id:id,name:name,tags:tags,dueDate:dueDate?dueDate.toISOString():undefined,messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,fileId:file&&file.id||undefined,reference:reference,reminders:reminders?[].concat(reminders):undefined,owners:owners,canDownload:canDownload,start:start}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();return proof})}return this.client.request("proofs.bulk-update",{proofs:transformProofsForUpdate(proofOrProofs)})};Proofs.prototype.next=function next(proofId){return this.client.request("proofs.next",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};return Proofs}(_API3.default);exports.default=Proofs;
|
|
1
|
+
"use strict";exports.__esModule=true;var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofsOwners=require("./ProofsOwners");var _ProofsOwners2=_interopRequireDefault(_ProofsOwners);var _ProofsEditors=require("./ProofsEditors");var _ProofsEditors2=_interopRequireDefault(_ProofsEditors);var _ProofsReviewers=require("./ProofsReviewers");var _ProofsReviewers2=_interopRequireDefault(_ProofsReviewers);var _ProofsVersions=require("./ProofsVersions");var _ProofsVersions2=_interopRequireDefault(_ProofsVersions);var _ProofsGroups=require("./ProofsGroups");var _ProofsGroups2=_interopRequireDefault(_ProofsGroups);var _ProofsAudit=require("./ProofsAudit");var _ProofsAudit2=_interopRequireDefault(_ProofsAudit);var _ProofsAssets=require("./ProofsAssets");var _ProofsAssets2=_interopRequireDefault(_ProofsAssets);var _ProofsCustomTools=require("./ProofsCustomTools");var _ProofsCustomTools2=_interopRequireDefault(_ProofsCustomTools);var _ProofsIntegrationReferences=require("./ProofsIntegrationReferences");var _ProofsIntegrationReferences2=_interopRequireDefault(_ProofsIntegrationReferences);var _ProofsLinkCheck=require("./ProofsLinkCheck");var _ProofsLinkCheck2=_interopRequireDefault(_ProofsLinkCheck);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _Reminders=require("./Reminders");var _Reminders2=_interopRequireDefault(_Reminders);var _constants=require("../util/constants");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}function transformProofsForUpdate(proofs){var proofsArrForUpdate=[].concat(proofs);proofsArrForUpdate.forEach(function(proof){proof.proofId=proof.id;delete proof.id});return proofsArrForUpdate}var Proofs=function(_API){_inherits(Proofs,_API);function Proofs(client){_classCallCheck(this,Proofs);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _ProofsOwners2.default(client);_this.editors=new _ProofsEditors2.default(client);_this.reviewers=new _ProofsReviewers2.default(client);_this.versions=new _ProofsVersions2.default(client);_this.groups=new _ProofsGroups2.default(client);_this.reminders=new _Reminders2.default(client);_this.audit=new _ProofsAudit2.default(client);_this.assets=new _ProofsAssets2.default(client);_this.customTools=new _ProofsCustomTools2.default(client);_this.integrationReferences=new _ProofsIntegrationReferences2.default(client);_this.linkCheck=new _ProofsLinkCheck2.default(client);return _this}Proofs.prototype.setWorkflow=function setWorkflow(proofId,workflowId){var _this2=this;return this.client.request("proofs.normalize-workflow",{proofId:proofId,workflowId:workflowId}).then(function(){return _this2.client.request("proofs.set-workflow",{proofId:proofId,workflowId:workflowId})})};Proofs.prototype.setTags=function setTags(proofId,tags){return this.client.request("proofs.set-tags",{relatedId:proofId,tag:tags.join(",")})};Proofs.prototype.deleteTag=function deleteTag(proofId,tag){return this.client.request("proofs.tag-delete",{relatedId:proofId,tag:tag})};Proofs.prototype.setFile=function setFile(proofId,fileId){var _this3=this;return this.client.request("proofs.set-file",{proofId:proofId,fileId:fileId}).then(function(){return _this3.client.request("proofs.distribute-file",{proofId:proofId})})};Proofs.prototype.create=function create(_ref){var _this4=this;var name=_ref.name,_ref$tags=_ref.tags,tags=_ref$tags===undefined?[]:_ref$tags,_ref$dueDate=_ref.dueDate,dueDate=_ref$dueDate===undefined?new Date(Date.now()+3*_constants.DAY_IN_MS):_ref$dueDate,messageToReviewers=_ref.messageToReviewers,workflow=_ref.workflow,workflowTemplate=_ref.workflowTemplate,file=_ref.file,group=_ref.group,previousProof=_ref.previousProof,team=_ref.team,reference=_ref.reference,customTools=_ref.customTools,integrationReferences=_ref.integrationReferences,_ref$reminders=_ref.reminders,reminders=_ref$reminders===undefined?[]:_ref$reminders,owners=_ref.owners,canDownload=_ref.canDownload,_ref$start=_ref.start,start=_ref$start===undefined?true:_ref$start;return this.client.request("proofs.create",{proof:{name:name,tags:tags,dueDate:dueDate.toISOString(),messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,workflowTemplateId:workflowTemplate&&workflowTemplate.id||undefined,fileId:file&&file.id||undefined,groupId:group&&group.id||undefined,previousProofId:previousProof&&previousProof.id||undefined,teamSlug:team&&team.slug||undefined,reference:reference,integrationReferences:integrationReferences,reminders:[].concat(reminders),owners:owners,canDownload:canDownload,start:start}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();if(customTools&&!previousProof){return _this4.customTools.update(proof.id,customTools).then(function(){return proof})}return proof})};Proofs.prototype.archive=function archive(proofIdOrIds){return this.client.request("proofs.archive",{proofIds:proofIdOrIds})};Proofs.prototype.unarchive=function unarchive(proofId){return this.client.request("proofs.unarchive",{proofId:proofId})};Proofs.prototype.delete=function _delete(proofId){return this.client.request("proofs.delete",{proofId:proofId})};Proofs.prototype.finish=function finish(proofId,decision){return this.client.request("proofs.finish",{proofId:proofId,decision:decision})};Proofs.prototype.approve=function approve(proofId,message){return this.client.request("proofs.manual-approval",{proofId:proofId,message:message})};Proofs.prototype.withdrawApproval=function withdrawApproval(proofId,messageToSender){return this.client.request("proofs.withdraw-approval",{proofId:proofId,messageToSender:messageToSender})};Proofs.prototype.generateEmail=function generateEmail(proofId){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return this.client.request("email.proofs.generate",_extends({proofId:proofId},options)).then(function(response){return response.data})};Proofs.prototype.return=function _return(proofId){return this.client.request("proofs.return",{proofId:proofId})};Proofs.prototype.start=function start(proofId){return this.client.request("proofs.start",{proofId:proofId})};Proofs.prototype.removeEditor=function removeEditor(id){return this.client.request("proofs.remove-editor",{proofId:id})};Proofs.prototype.load=function load(proofId){return this.client.request("proofs.load",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.lock=function lock(proofId){return this.client.request("proofs.lock",{proofId:proofId})};Proofs.prototype.unlock=function unlock(proofId){return this.client.request("proofs.unlock",{proofId:proofId})};Proofs.prototype.requestUnlock=function requestUnlock(proofId){return this.client.request("proofs.request-unlock",{proofId:proofId})};Proofs.prototype.requestAccess=function requestAccess(proofId){return this.client.request("proofs.request-access",{proofId:proofId})};Proofs.prototype.images=function images(proofId){return this.client.request("proofs.images",{proofId:proofId}).then(function(response){return response.data.proof.file})};Proofs.prototype.setMessageToReviewers=function setMessageToReviewers(proofId,messageToReviewers){return this.client.request("proofs.set-reviewers-message",{proofId:proofId,messageToReviewers:messageToReviewers})};Proofs.prototype.returnTodos=function returnTodos(proofIdOrIds,_ref2){var messageToOwners=_ref2.messageToOwners,_ref2$markCommentsAsT=_ref2.markCommentsAsTodo,markCommentsAsTodo=_ref2$markCommentsAsT===undefined?false:_ref2$markCommentsAsT;return this.client.request("proofs.return-todos",{proofIds:[].concat(proofIdOrIds),messageToOwners:messageToOwners,markCommentAsTodo:markCommentsAsTodo})};Proofs.prototype.updateDecision=function updateDecision(proofId,decision){return this.client.request("proofs.update-decision",{proofId:proofId,decision:decision})};Proofs.prototype.update=function update(proofOrProofs){if(proofOrProofs.length===1||typeof proofOrProofs.length==="undefined"){var _concat$=[].concat(proofOrProofs)[0],id=_concat$.id,name=_concat$.name,tags=_concat$.tags,dueDate=_concat$.dueDate,messageToReviewers=_concat$.messageToReviewers,workflow=_concat$.workflow,file=_concat$.file,reference=_concat$.reference,integrationReferences=_concat$.integrationReferences,reminders=_concat$.reminders,owners=_concat$.owners,canDownload=_concat$.canDownload,start=_concat$.start;return this.client.request("proofs.update",{proof:{id:id,name:name,tags:tags,dueDate:dueDate?dueDate.toISOString():undefined,messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,fileId:file&&file.id||undefined,reference:reference,integrationReferences:integrationReferences,reminders:reminders?[].concat(reminders):undefined,owners:owners,canDownload:canDownload,start:start}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();return proof})}return this.client.request("proofs.bulk-update",{proofs:transformProofsForUpdate(proofOrProofs)})};Proofs.prototype.next=function next(proofId){return this.client.request("proofs.next",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};return Proofs}(_API3.default);exports.default=Proofs;
|
|
@@ -94,21 +94,21 @@ declare class ProofsGroups extends API {
|
|
|
94
94
|
* await client.proofs.groups.archive('GVNM8NTI1VSTCRN5', 'GVNM8NTI1VSTCRN6');
|
|
95
95
|
*
|
|
96
96
|
* @example <caption>Archiving a group and it's proofs user owns</caption>
|
|
97
|
-
* await client.proofs.groups.archive('GVNM8NTI1VSTCRN5', {archiveProofs: true});
|
|
97
|
+
* await client.proofs.groups.archive('GVNM8NTI1VSTCRN5', { archiveProofs: true });
|
|
98
98
|
*
|
|
99
99
|
* @example <caption>Archiving number of groups and their all proofs user owns</caption>
|
|
100
100
|
* await client.proofs.groups.archive(
|
|
101
|
-
*
|
|
102
|
-
*
|
|
101
|
+
* ['GVNM8NTI1VSTCRN5', 'GVNM8NTI1VSTCRN6'],
|
|
102
|
+
* { archiveProofs: true }
|
|
103
103
|
* );
|
|
104
104
|
*
|
|
105
105
|
* @since v2.0.0-beta.110
|
|
106
106
|
* @param {string|Array<string>} groupIdOrIds The id or array of ids of the groups
|
|
107
|
-
* @param {object} options
|
|
108
|
-
* @param {boolean} options.archiveProofs Whether to archive all owned proofs as well or just the group
|
|
107
|
+
* @param {object} [options]
|
|
108
|
+
* @param {boolean} [options.archiveProofs] Whether to archive all owned proofs as well or just the group
|
|
109
109
|
* @returns {Promise}
|
|
110
110
|
*/
|
|
111
|
-
archive(...
|
|
111
|
+
archive(...args: any[]): Promise<any>;
|
|
112
112
|
/**
|
|
113
113
|
* Reopen a group or array of groups.
|
|
114
114
|
*
|
package/lib/api/ProofsGroups.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofGroup=require("../models/ProofGroup");var _ProofGroup2=_interopRequireDefault(_ProofGroup);var _GroupsOwners=require("./GroupsOwners");var _GroupsOwners2=_interopRequireDefault(_GroupsOwners);var _GroupsWorkflows=require("./GroupsWorkflows");var _GroupsWorkflows2=_interopRequireDefault(_GroupsWorkflows);
|
|
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 _ProofGroup=require("../models/ProofGroup");var _ProofGroup2=_interopRequireDefault(_ProofGroup);var _GroupsOwners=require("./GroupsOwners");var _GroupsOwners2=_interopRequireDefault(_GroupsOwners);var _GroupsWorkflows=require("./GroupsWorkflows");var _GroupsWorkflows2=_interopRequireDefault(_GroupsWorkflows);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 mapResponseToGroup(response){return(new _ProofGroup2.default).fromProofGroup(response.data)}var ProofsGroups=function(_API){_inherits(ProofsGroups,_API);function ProofsGroups(client){_classCallCheck(this,ProofsGroups);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _GroupsOwners2.default(client);_this.workflows=new _GroupsWorkflows2.default(client);return _this}ProofsGroups.prototype.create=function create(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},name=_ref.name,isOwnedByTeam=_ref.isOwnedByTeam;return this.client.request("proofs.groups.create",{name:name,ownedByTeam:isOwnedByTeam}).then(mapResponseToGroup)};ProofsGroups.prototype.load=function load(groupId){return this.client.request("proofs.groups.load",{groupId:groupId}).then(mapResponseToGroup)};ProofsGroups.prototype.ready=function ready(groupId){return this.client.request("proofs.groups.ready",{groupId:groupId})};ProofsGroups.prototype.update=function update(groupId,_ref2){var name=_ref2.name,isOwnedByTeam=_ref2.isOwnedByTeam;return this.client.request("proofs.groups.update",{groupId:groupId,name:name,ownedByTeam:isOwnedByTeam}).then(mapResponseToGroup)};ProofsGroups.prototype.removeProof=function removeProof(proofId){return this.client.request("proofs.groups.remove-proof",{proofId:proofId})};ProofsGroups.prototype.addProof=function addProof(groupId,proofId){return this.client.request("proofs.groups.add-proof",{groupId:groupId,proofId:proofId})};ProofsGroups.prototype.delete=function _delete(groupId){return this.client.request("proofs.groups.delete",{groupId:groupId})};ProofsGroups.prototype.archive=function archive(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}if(args.every(function(arg){return typeof arg==="string"})){return this.client.request("proofs.groups.archive",{groupIds:args})}else{var defaultOptions={archiveProofs:false};var groupIdOrGroupIds=args[0],_args$=args[1],options=_args$===undefined?defaultOptions:_args$;var groupIds=[].concat(groupIdOrGroupIds);return this.client.request("proofs.groups.archive",_extends({groupIds:groupIds},options))}};ProofsGroups.prototype.reopen=function reopen(){for(var _len2=arguments.length,groupIds=Array(_len2),_key2=0;_key2<_len2;_key2++){groupIds[_key2]=arguments[_key2]}return this.client.request("proofs.groups.reopen",{groupIds:groupIds})};return ProofsGroups}(_API3.default);exports.default=ProofsGroups;
|