@pageproof/sdk-pr 488.0.1688088778494 → 489.0.1688095963465

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.
@@ -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 _whatwgURL=require("../util/whatwgURL");var _whatwgURL2=_interopRequireDefault(_whatwgURL);var _bluffer=require("../bluffer");var _bluffer2=_interopRequireDefault(_bluffer);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}var CommentsImport=function(_API){_inherits(CommentsImport,_API);function CommentsImport(){_classCallCheck(this,CommentsImport);return _possibleConstructorReturn(this,_API.apply(this,arguments))}CommentsImport.prototype._createTask=function _createTask(options){var _this2=this;return this.client.crypto().generateCommentImportKey(this.client.serverPublicKeyPEM).then(function(_ref){var key=_ref.key,key$=_ref.key$;return _this2.client.request("comments.import.create-task",{options:_extends({},options,{key:key$})}).then(function(response){return[response.data,key]})})};CommentsImport.prototype._startTask=function _startTask(id,options){return this.client.request("comments.import.action-task",{id:id,options:options,action:"start"}).then(function(response){return response.data.task})};CommentsImport.prototype.fromFile=function fromFile(file,options,progressCallback){var _this3=this;var proofId=options.proofId,fileName=options.fileName,startTaskOptions=_objectWithoutProperties(options,["proofId","fileName"]);return this._createTask({type:"pdf",proofId:proofId,fileName:fileName}).then(function(_ref2){var _ref2$=_ref2[0],task=_ref2$.task,uploadRequest=_ref2$.uploadRequest,key=_ref2[1];var bluffer=new _bluffer2.default;return bluffer.readBase64(file).then(function(fileBase64){return _this3.client.crypto().encryptCommentImportFile(key,fileBase64)}).then(function(encodedEncryptedFile){return bluffer.createBase64(encodedEncryptedFile)}).then(function(encryptedFile){return _this3.client.rawRequest({url:new _whatwgURL2.default(uploadRequest.url),method:uploadRequest.method,headers:uploadRequest.headers,body:encryptedFile},{onUploadProgress:progressCallback})}).then(function(){return task})}).then(function(task){return _this3._startTask(task.id,startTaskOptions)})};CommentsImport.prototype.info=function info(id){return this.client.request("comments.import.get-task",{id:id}).then(function(response){return response.data.task})};CommentsImport.prototype.cancel=function cancel(id){return this.client.request("comments.import.action-task",{id:id,action:"cancel",options:{}}).then(function(response){return response.data.task})};return CommentsImport}(_API3.default);exports.default=CommentsImport;
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 _whatwgURL=require("../util/whatwgURL");var _whatwgURL2=_interopRequireDefault(_whatwgURL);var _bluffer=require("../bluffer");var _bluffer2=_interopRequireDefault(_bluffer);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}var CommentsImport=function(_API){_inherits(CommentsImport,_API);function CommentsImport(){_classCallCheck(this,CommentsImport);return _possibleConstructorReturn(this,_API.apply(this,arguments))}CommentsImport.prototype._createTask=function _createTask(options){var _this2=this;return this.client.crypto().generateCommentImportKey(this.client.session.serverPublicKeyPEM).then(function(_ref){var key=_ref.key,key$=_ref.key$;return _this2.client.request("comments.import.create-task",{options:_extends({},options,{key:key$})}).then(function(response){return[response.data,key]})})};CommentsImport.prototype._startTask=function _startTask(id,options){return this.client.request("comments.import.action-task",{id:id,options:options,action:"start"}).then(function(response){return response.data.task})};CommentsImport.prototype.fromFile=function fromFile(file,options,progressCallback){var _this3=this;var proofId=options.proofId,fileName=options.fileName,startTaskOptions=_objectWithoutProperties(options,["proofId","fileName"]);return this._createTask({type:"pdf",proofId:proofId,fileName:fileName}).then(function(_ref2){var _ref2$=_ref2[0],task=_ref2$.task,uploadRequest=_ref2$.uploadRequest,key=_ref2[1];var bluffer=new _bluffer2.default;return bluffer.readBase64(file).then(function(fileBase64){return _this3.client.crypto().encryptCommentImportFile(key,fileBase64)}).then(function(encodedEncryptedFile){return bluffer.createBase64(encodedEncryptedFile)}).then(function(encryptedFile){return _this3.client.rawRequest({url:new _whatwgURL2.default(uploadRequest.url),method:uploadRequest.method,headers:uploadRequest.headers,body:encryptedFile},{onUploadProgress:progressCallback})}).then(function(){return task})}).then(function(task){return _this3._startTask(task.id,startTaskOptions)})};CommentsImport.prototype.info=function info(id){return this.client.request("comments.import.get-task",{id:id}).then(function(response){return response.data.task})};CommentsImport.prototype.cancel=function cancel(id){return this.client.request("comments.import.action-task",{id:id,action:"cancel",options:{}}).then(function(response){return response.data.task})};return CommentsImport}(_API3.default);exports.default=CommentsImport;