@pageproof/sdk-pr 153.0.1557353091941 → 155.0.1558307184733

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.0-beta.79
4
+
5
+ Released on the 20th of May 2019.
6
+
7
+ - [[#155](https://github.com/PageProofCom/sdk/pull/155)] Support for collectionName in Proof model. See [Proof.collectionName](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/Proof.js~Proof.html#instance-member-collectionName).
8
+
3
9
  ## 2.0.0-beta.78
4
10
 
5
11
  Released on the 8th of May 2019.
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var _ICryptoAdapter2=require("./ICryptoAdapter");var _ICryptoAdapter3=_interopRequireDefault(_ICryptoAdapter2);var _crypto=require("../crypto");var crypto=_interopRequireWildcard(_crypto);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}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 debug=require("debug")("SyncCryptoAdapter");var SyncCryptoAdapter=function(_ICryptoAdapter){_inherits(SyncCryptoAdapter,_ICryptoAdapter);function SyncCryptoAdapter(){_classCallCheck(this,SyncCryptoAdapter);var _this=_possibleConstructorReturn(this,_ICryptoAdapter.call(this));Object.getOwnPropertyNames(SyncCryptoAdapter.prototype).forEach(function(method){if(typeof _this[method]==="function"){var original=_this[method].bind(_this);_this[method]=function(){try{debug("before"+method);return original.apply(undefined,arguments)}finally{debug("after "+method)}}}});return _this}SyncCryptoAdapter.prototype.decryptComment=function decryptComment(comment$,envelope,privateKeyPEM){return crypto.decryptComment(comment$,envelope,privateKeyPEM)};SyncCryptoAdapter.prototype.decryptData=function decryptData(version,data$,envelope$,privateKeyPEM){return crypto.decryptData(version,data$,envelope$,privateKeyPEM)};SyncCryptoAdapter.prototype.decryptImage=function decryptImage(data$,privateKeyPEM){return crypto.decryptImage(data$,privateKeyPEM)};SyncCryptoAdapter.prototype.decryptPrivateKey=function decryptPrivateKey(privateKey$,password){return crypto.decryptPrivateKey(privateKey$,password)};SyncCryptoAdapter.prototype.encryptFileBlock=function encryptFileBlock(keyIV,fileBlock,decodeBlock){return crypto.encryptFileBlock(keyIV,fileBlock,decodeBlock)};SyncCryptoAdapter.prototype.encryptPrivateKey=function encryptPrivateKey(privateKeyPEM,password){return crypto.encryptPrivateKey(privateKeyPEM,password)};SyncCryptoAdapter.prototype.envelopeSeal=function envelopeSeal(secret,publicKeyPEMs){return crypto.envelopeSeal(secret,publicKeyPEMs)};SyncCryptoAdapter.prototype.envelopeUnseal=function envelopeUnseal(envelope,privateKeyPEM){return crypto.envelopeUnseal(envelope,privateKeyPEM)};SyncCryptoAdapter.prototype.generateAuthorizationHeaders=function generateAuthorizationHeaders(method,path,session){return crypto.generateAuthorizationHeaders(method,path,session)};SyncCryptoAdapter.prototype.generateKeyIV=function generateKeyIV(){return crypto.generateKeyIV()};SyncCryptoAdapter.prototype.generateKeyPair=function generateKeyPair(){return crypto.generateKeyPair()};SyncCryptoAdapter.prototype.generatePasswordHash=function generatePasswordHash(password){return crypto.generatePasswordHash(password)};SyncCryptoAdapter.prototype.generateWrappedSymmetricKey=function generateWrappedSymmetricKey(serverPublicKeyPEM){return crypto.generateWrappedSymmetricKey(serverPublicKeyPEM)};SyncCryptoAdapter.prototype.decryptManagedPrivateKey=function decryptManagedPrivateKey(privateKey$,keyBase64){return crypto.decryptManagedPrivateKey(privateKey$,keyBase64)};SyncCryptoAdapter.prototype.encryptComment=function encryptComment(comment,publicKeyPEMs){return crypto.encryptComment(comment,publicKeyPEMs)};return SyncCryptoAdapter}(_ICryptoAdapter3.default);exports.default=SyncCryptoAdapter;
1
+ "use strict";exports.__esModule=true;var _ICryptoAdapter2=require("./ICryptoAdapter");var _ICryptoAdapter3=_interopRequireDefault(_ICryptoAdapter2);var _crypto=require("../crypto");var crypto=_interopRequireWildcard(_crypto);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}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 SyncCryptoAdapter=function(_ICryptoAdapter){_inherits(SyncCryptoAdapter,_ICryptoAdapter);function SyncCryptoAdapter(){_classCallCheck(this,SyncCryptoAdapter);return _possibleConstructorReturn(this,_ICryptoAdapter.apply(this,arguments))}SyncCryptoAdapter.prototype.decryptComment=function decryptComment(comment$,envelope,privateKeyPEM){return crypto.decryptComment(comment$,envelope,privateKeyPEM)};SyncCryptoAdapter.prototype.decryptData=function decryptData(version,data$,envelope$,privateKeyPEM){return crypto.decryptData(version,data$,envelope$,privateKeyPEM)};SyncCryptoAdapter.prototype.decryptImage=function decryptImage(data$,privateKeyPEM){return crypto.decryptImage(data$,privateKeyPEM)};SyncCryptoAdapter.prototype.decryptPrivateKey=function decryptPrivateKey(privateKey$,password){return crypto.decryptPrivateKey(privateKey$,password)};SyncCryptoAdapter.prototype.encryptFileBlock=function encryptFileBlock(keyIV,fileBlock,decodeBlock){return crypto.encryptFileBlock(keyIV,fileBlock,decodeBlock)};SyncCryptoAdapter.prototype.encryptPrivateKey=function encryptPrivateKey(privateKeyPEM,password){return crypto.encryptPrivateKey(privateKeyPEM,password)};SyncCryptoAdapter.prototype.envelopeSeal=function envelopeSeal(secret,publicKeyPEMs){return crypto.envelopeSeal(secret,publicKeyPEMs)};SyncCryptoAdapter.prototype.envelopeUnseal=function envelopeUnseal(envelope,privateKeyPEM){return crypto.envelopeUnseal(envelope,privateKeyPEM)};SyncCryptoAdapter.prototype.generateAuthorizationHeaders=function generateAuthorizationHeaders(method,path,session){return crypto.generateAuthorizationHeaders(method,path,session)};SyncCryptoAdapter.prototype.generateKeyIV=function generateKeyIV(){return crypto.generateKeyIV()};SyncCryptoAdapter.prototype.generateKeyPair=function generateKeyPair(){return crypto.generateKeyPair()};SyncCryptoAdapter.prototype.generatePasswordHash=function generatePasswordHash(password){return crypto.generatePasswordHash(password)};SyncCryptoAdapter.prototype.generateWrappedSymmetricKey=function generateWrappedSymmetricKey(serverPublicKeyPEM){return crypto.generateWrappedSymmetricKey(serverPublicKeyPEM)};SyncCryptoAdapter.prototype.decryptManagedPrivateKey=function decryptManagedPrivateKey(privateKey$,keyBase64){return crypto.decryptManagedPrivateKey(privateKey$,keyBase64)};SyncCryptoAdapter.prototype.encryptComment=function encryptComment(comment,publicKeyPEMs){return crypto.encryptComment(comment,publicKeyPEMs)};return SyncCryptoAdapter}(_ICryptoAdapter3.default);exports.default=SyncCryptoAdapter;
@@ -1,2 +1,2 @@
1
- !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.PageProofAngularEnhancementAdapter=n():e.PageProofAngularEnhancementAdapter=n()}(this,function(){return function(e){function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}var t={};return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=0)}([function(e,n,t){"use strict";function o(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function r(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?e:n}function a(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)}n.__esModule=!0;var c=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},s=t(1),i=function(e){return e&&e.__esModule?e:{default:e}}(s),u=t(2)("AngularEnhancementAdapter"),f={$scope:null,$exceptionHandler:null,module:null},l=function(e){function n(t){o(this,n);var a=r(this,e.call(this));return a.options=c({},f,t),a.$scope=a.options.$scope,a.$exceptionHandler=a.options.$exceptionHandler,a.options.module&&a.options.module.run(["$rootScope","$exceptionHandler",function(e,n){u("Extracting the $rootScope and $exceptionHandler from Angular module"),a.$scope=a.$scope||e,a.$exceptionHandler=a.$exceptionHandler||n}]),a}return a(n,e),n.prototype.onMethodFinally=function(){this.$scope&&!this.$scope.$$phase&&this.$scope.$apply(),this.$scope||u("Unable to tell $scope to re-digest, either module hasn't booted, or no $scope was provided")},n.prototype.onMethodReject=function(e){var n=e.rejected;this.$exceptionHandler?this.$exceptionHandler(n):u("Unable to invoke $exceptionHandler of rejected Promise, check configuration")},n.prototype.onMethodThrown=function(e){var n=e.error;this.$exceptionHandler?this.$exceptionHandler(n):u("Unable to invoke $exceptionHandler of uncaught error, check configuration")},n}(i.default);n.default=l},function(e,n,t){"use strict";function o(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function r(e,n,t){var o=e[n];e[n]=function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];var a=o.bind.apply(o,[this].concat(n));return t(a,this,n).apply(this,n)}}function a(e){function n(r){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],c=Object.getOwnPropertyNames(r).filter(function(n){return r[n].client===e}),s=Object.getPrototypeOf(r),i=Object.keys(s).filter(function(e){return"function"==typeof s[e]&&0!==e.indexOf("_")});(a.length||t)&&i.forEach(function(e){o.push({namespace:a.join("."),name:e,api:r})}),c.forEach(function(e){n(r[e],a.concat(e))})}var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=[];return n(e),o}n.__esModule=!0;var c,s,i=(s=c=function(){function e(){o(this,e)}return e.prototype.onClientReady=function(e){var n=this;a(e).forEach(function(e){r(e.api,e.name,function(t){var o={api:e.api,namespace:e.namespace,name:e.name,displayName:e.namespace+"."+e.name};return n.onMethodBefore(o),function(){var e=void 0;try{e=t()}catch(e){throw o.error=e,n.onMethodThrown(o),e}finally{o.value=e,n.onMethodAfter(o),e&&"function"==typeof e.then&&e.then(function(e){o.resolved=e,n.onMethodResolve(o)},function(e){o.rejected=e,n.onMethodReject(o)}).then(function(){n.onMethodFinally(o)})}return e}})}),e.on("experimental.request.before",function(e){return n.onRequestBefore(e.data)}),e.on("experimental.request.after",function(e){return n.onRequestAfter(e.data)}),e.on("error.response",function(e){return n.onRequestReject(e.data)}),e.on("error.throttled",function(e){return n.onRequestThrottled(e.data)}),e.on("experimental.request.retry",function(e){return n.onRequestRetry(e.data)}),e.on("error.unauthorized",function(e){return n.onRequestUnauthorized(e.data)}),e.on("error.deprecated",function(e){return n.onRequestDeprecated(e.data)}),e.on("experimental.request.resolve",function(e){return n.onRequestResolve(e.data)}),e.on("experimental.request.finally",function(e){return n.onRequestFinally(e.data)})},e.prototype.onMethodBefore=function(){},e.prototype.onMethodAfter=function(){},e.prototype.onMethodReject=function(){},e.prototype.onMethodResolve=function(){},e.prototype.onMethodFinally=function(){},e.prototype.onMethodThrown=function(){},e.prototype.onRequestBefore=function(){},e.prototype.onRequestAfter=function(){},e.prototype.onRequestReject=function(){},e.prototype.onRequestThrottled=function(){},e.prototype.onRequestRetry=function(){},e.prototype.onRequestUnauthorized=function(){},e.prototype.onRequestDeprecated=function(){},e.prototype.onRequestResolve=function(){},e.prototype.onRequestFinally=function(){},e}(),c.__adapter__="IEnhancementAdapter",s);n.default=i},function(e,n,t){function o(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function r(e){var t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),t){var o="color: "+this.color;e.splice(1,0,o,"color: inherit");var r=0,a=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(r++,"%c"===e&&(a=r))}),e.splice(a,0,o)}}function a(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function c(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(e){}}function s(){var e;try{e=n.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}n=e.exports=t(3),n.log=a,n.formatArgs=r,n.save=c,n.load=s,n.useColors=o,n.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},n.enable(s())},function(e,n,t){function o(e){var t,o=0;for(t in e)o=(o<<5)-o+e.charCodeAt(t),o|=0;return n.colors[Math.abs(o)%n.colors.length]}function r(e){function t(){if(t.enabled){var e=t,o=+new Date,r=o-(u||o);e.diff=r,e.prev=u,e.curr=o,u=o;for(var a=new Array(arguments.length),c=0;c<a.length;c++)a[c]=arguments[c];a[0]=n.coerce(a[0]),"string"!=typeof a[0]&&a.unshift("%O");var s=0;a[0]=a[0].replace(/%([a-zA-Z%])/g,function(t,o){if("%%"===t)return t;s++;var r=n.formatters[o];if("function"==typeof r){var c=a[s];t=r.call(e,c),a.splice(s,1),s--}return t}),n.formatArgs.call(e,a);(t.log||n.log||console.log.bind(console)).apply(e,a)}}return t.namespace=e,t.enabled=n.enabled(e),t.useColors=n.useColors(),t.color=o(e),"function"==typeof n.init&&n.init(t),t}function a(e){n.save(e),n.names=[],n.skips=[];for(var t=("string"==typeof e?e:"").split(/[\s,]+/),o=t.length,r=0;r<o;r++)t[r]&&(e=t[r].replace(/\*/g,".*?"),"-"===e[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))}function c(){n.enable("")}function s(e){var t,o;for(t=0,o=n.skips.length;t<o;t++)if(n.skips[t].test(e))return!1;for(t=0,o=n.names.length;t<o;t++)if(n.names[t].test(e))return!0;return!1}function i(e){return e instanceof Error?e.stack||e.message:e}n=e.exports=r.debug=r.default=r,n.coerce=i,n.disable=c,n.enable=a,n.enabled=s,n.humanize=t(4),n.names=[],n.skips=[],n.formatters={};var u},function(e,n){function t(e){if(e=String(e),!(e.length>100)){var n=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(n){var t=parseFloat(n[1]);switch((n[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return t*f;case"days":case"day":case"d":return t*u;case"hours":case"hour":case"hrs":case"hr":case"h":return t*i;case"minutes":case"minute":case"mins":case"min":case"m":return t*s;case"seconds":case"second":case"secs":case"sec":case"s":return t*c;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function o(e){return e>=u?Math.round(e/u)+"d":e>=i?Math.round(e/i)+"h":e>=s?Math.round(e/s)+"m":e>=c?Math.round(e/c)+"s":e+"ms"}function r(e){return a(e,u,"day")||a(e,i,"hour")||a(e,s,"minute")||a(e,c,"second")||e+" ms"}function a(e,n,t){if(!(e<n))return e<1.5*n?Math.floor(e/n)+" "+t:Math.ceil(e/n)+" "+t+"s"}var c=1e3,s=60*c,i=60*s,u=24*i,f=365.25*u;e.exports=function(e,n){n=n||{};var a=typeof e;if("string"===a&&e.length>0)return t(e);if("number"===a&&!1===isNaN(e))return n.long?r(e):o(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(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){r(e.api,e.name,function(n){var o={api:e.api,namespace:e.namespace,name:e.name,displayName:e.namespace+"."+e.name};return t.onMethodBefore(o),function(){var e=void 0;try{e=n()}catch(e){throw o.error=e,t.onMethodThrown(o),e}finally{o.value=e,t.onMethodAfter(o),e&&"function"==typeof e.then&&e.then(function(e){o.resolved=e,t.onMethodResolve(o)},function(e){o.rejected=e,t.onMethodReject(o)}).then(function(){t.onMethodFinally(o)})}return e}})}),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.onMethodBefore=function(){},e.prototype.onMethodAfter=function(){},e.prototype.onMethodReject=function(){},e.prototype.onMethodResolve=function(){},e.prototype.onMethodFinally=function(){},e.prototype.onMethodThrown=function(){},e.prototype.onRequestBefore=function(){},e.prototype.onRequestAfter=function(){},e.prototype.onRequestReject=function(){},e.prototype.onRequestThrottled=function(){},e.prototype.onRequestRetry=function(){},e.prototype.onRequestUnauthorized=function(){},e.prototype.onRequestDeprecated=function(){},e.prototype.onRequestResolve=function(){},e.prototype.onRequestFinally=function(){},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
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var debug=require("debug")("bluffer");function Bluffer(){if(typeof Bluffer.driver==="function"){var Driver=Bluffer.driver;return new Driver}else if(typeof Bluffer.driver==="string"){var _Driver=void 0;switch(Bluffer.driver){case"Blob":{_Driver=require("./BlobBluffer").default;break}case"ArrayBuffer":{_Driver=require("./ArrayBufferBluffer").default;break}case"Buffer":{_Driver=require("./BufferBluffer").default;break}case"String":{_Driver=require("./StringBluffer").default;break}default:{throw new Error('Unknown Bluffer driver "'+Bluffer.driver+'".')}}if(_Driver){return new _Driver}else{throw new Error('Bluffer driver "'+Bluffer.driver+'" not found.')}}else{throw new Error('Bluffer.driver must be either "Blob", "Bluffer", or "String" or a custom constructor.')}}Bluffer.driver="String";if(typeof Buffer!=="undefined"){Bluffer.driver="Buffer"}else if(typeof Blob!=="undefined"){Bluffer.driver="Blob"}else if(typeof ArrayBuffer!=="undefined"){Bluffer.driver="ArrayBuffer"}else{debug("The current JavaScript environment does not support native Bluffer, falling back to using StringBluffer.");Bluffer.driver="String"}exports.default=Bluffer;
1
+ "use strict";exports.__esModule=true;var debug=require("debug")("bluffer");function Bluffer(){if(typeof Bluffer.driver==="function"){var Driver=Bluffer.driver;return new Driver}else if(typeof Bluffer.driver==="string"){var _Driver=void 0;switch(Bluffer.driver){case"Blob":{_Driver=require("./BlobBluffer").default;break}case"Buffer":{_Driver=require("./BufferBluffer").default;break}case"String":{_Driver=require("./StringBluffer").default;break}default:{throw new Error('Unknown Bluffer driver "'+Bluffer.driver+'".')}}if(_Driver){return new _Driver}else{throw new Error('Bluffer driver "'+Bluffer.driver+'" not found.')}}else{throw new Error('Bluffer.driver must be either "Blob", "Bluffer", or "String" or a custom constructor.')}}Bluffer.driver="String";if(typeof Buffer!=="undefined"){Bluffer.driver="Buffer"}else if(typeof Blob!=="undefined"){Bluffer.driver="Blob"}else{debug("The current JavaScript environment does not support native Bluffer, falling back to using StringBluffer.");Bluffer.driver="String"}exports.default=Bluffer;
package/lib/index.js CHANGED
@@ -3,10 +3,6 @@
3
3
  exports.__esModule = true;
4
4
  exports.version = exports.util = exports.Model = exports.Enum = exports.Bluffer = exports.Client = undefined;
5
5
 
6
- var _debug = require('debug');
7
-
8
- var _debug2 = _interopRequireDefault(_debug);
9
-
10
6
  var _PageProof = require('./core/PageProof');
11
7
 
12
8
  var _PageProof2 = _interopRequireDefault(_PageProof);
@@ -35,10 +31,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
35
31
 
36
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
33
 
38
- _debug2.default.enable('*'); /* Copyright (C) 2018 PageProof Holdings Limited - All Rights Reserved.
39
- * Unauthorized copying of this file, via any medium is strictly prohibited.
40
- * Proprietary and confidential.
41
- */
34
+ /* Copyright (C) 2018 PageProof Holdings Limited - All Rights Reserved.
35
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
36
+ * Proprietary and confidential.
37
+ */
42
38
  exports.default = _PageProof2.default;
43
39
  exports.Client = _PageProof2.default;
44
40
  exports.Bluffer = _bluffer2.default;
@@ -1,2 +1,2 @@
1
- !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.PageProofIndexedDBCacheAdapter=n():e.PageProofIndexedDBCacheAdapter=n()}(this,function(){return function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var t={};return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=0)}([function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function c(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?e:n}function s(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)}function a(e){return e.expiresAt<Date.now()}n.__esModule=!0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},f=t(1),l=r(f),p=t(2),d=r(p),h=t(3)("IndexedDBCacheAdapter"),y={database:"@pageproof/sdk/adapters/IndexedDBCacheAdapter"},m=function(e){function n(t){o(this,n);var r=c(this,e.call(this));return r.options=u({},y,t),r.cache=(0,l.default)(r.options.database),r.purge(),r}return s(n,e),n.prototype.set=function(e,n){return h('Setting "'+e+'" to type '+(void 0===n?"undefined":i(n))),this.cache.set(e,{data:n,expiresAt:Date.now()+864e5})},n.prototype.has=function(e){return this.get(e).then(function(){return!0},function(){return!1})},n.prototype.get=function(e){return h('Retieve from cache by key "'+e+'"'),this.cache.get(e).then(function(n){return n?a(n)?Promise.reject(new Error('"'+e+'" has expired.')):n.data:Promise.reject(new Error('"'+e+'" was not found in the cache.'))})},n.prototype.clear=function(){return h("Clearing all data from cache"),this.cache.clear()},n.prototype.purge=function(){var e=this;h("Purging any expired entries from the cache");var n=0;return this.cache.keys().then(function(t){var r=Promise.resolve();return t.forEach(function(t){r=r.then(function(){return e.cache.get(t)}).then(function(r){if(a(r))return n++,e.cache.remove(t)})}),r}).then(function(){n&&h("Purged "+n+" "+(n>1?"entries":"entry"))})},n}(d.default);n.default=m},function(e,n,t){var r,o;!function(){"use strict";function t(e){function n(){return r||(r=new Promise(function(n,t){var r=indexedDB.open(e,1);r.onerror=function(){t(r.error)},r.onupgradeneeded=function(){r.result.createObjectStore(c)},r.onsuccess=function(){n(r.result)}})),r}function t(e,t){return n().then(function(n){return new Promise(function(r,o){var s=n.transaction(c,e);s.oncomplete=function(){r()},s.onerror=function(){o(s.error)},t(s.objectStore(c))})})}var r;return{get:function(e){var n;return t(s,function(t){n=t.get(e)}).then(function(){return n.result})},set:function(e,n){return t(a,function(t){t.put(n,e)})},remove:function(e){return t(a,function(n){n.delete(e)})},clear:function(){return t(a,function(e){e.clear()})},keys:function(){var e=[];return t(s,function(n){(n.openKeyCursor||n.openCursor).call(n).onsuccess=function(){this.result&&(e.push(this.result.key),this.result.continue())}}).then(function(){return e})}}}var c="kv",s="readonly",a="readwrite",i=t("kv");for(var u in i)i.hasOwnProperty(u)&&(t[u]=i[u]);void 0!==e&&e.exports?e.exports=t:(r=[],void 0!==(o=function(){return t}.apply(n,r))&&(e.exports=o))}()},function(e,n,t){"use strict";function r(){}n.__esModule=!0,r.__adapter__="ICacheAdapter",n.default=r},function(e,n,t){function r(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),t){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var o=0,c=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(o++,"%c"===e&&(c=o))}),e.splice(c,0,r)}}function c(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(e){}}function a(){var e;try{e=n.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}n=e.exports=t(4),n.log=c,n.formatArgs=o,n.save=s,n.load=a,n.useColors=r,n.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},n.enable(a())},function(e,n,t){function r(e){var t,r=0;for(t in e)r=(r<<5)-r+e.charCodeAt(t),r|=0;return n.colors[Math.abs(r)%n.colors.length]}function o(e){function t(){if(t.enabled){var e=t,r=+new Date,o=r-(u||r);e.diff=o,e.prev=u,e.curr=r,u=r;for(var c=new Array(arguments.length),s=0;s<c.length;s++)c[s]=arguments[s];c[0]=n.coerce(c[0]),"string"!=typeof c[0]&&c.unshift("%O");var a=0;c[0]=c[0].replace(/%([a-zA-Z%])/g,function(t,r){if("%%"===t)return t;a++;var o=n.formatters[r];if("function"==typeof o){var s=c[a];t=o.call(e,s),c.splice(a,1),a--}return t}),n.formatArgs.call(e,c);(t.log||n.log||console.log.bind(console)).apply(e,c)}}return t.namespace=e,t.enabled=n.enabled(e),t.useColors=n.useColors(),t.color=r(e),"function"==typeof n.init&&n.init(t),t}function c(e){n.save(e),n.names=[],n.skips=[];for(var t=("string"==typeof e?e:"").split(/[\s,]+/),r=t.length,o=0;o<r;o++)t[o]&&(e=t[o].replace(/\*/g,".*?"),"-"===e[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))}function s(){n.enable("")}function a(e){var t,r;for(t=0,r=n.skips.length;t<r;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;t<r;t++)if(n.names[t].test(e))return!0;return!1}function i(e){return e instanceof Error?e.stack||e.message:e}n=e.exports=o.debug=o.default=o,n.coerce=i,n.disable=s,n.enable=c,n.enabled=a,n.humanize=t(5),n.names=[],n.skips=[],n.formatters={};var u},function(e,n){function t(e){if(e=String(e),!(e.length>100)){var n=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(n){var t=parseFloat(n[1]);switch((n[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return t*f;case"days":case"day":case"d":return t*u;case"hours":case"hour":case"hrs":case"hr":case"h":return t*i;case"minutes":case"minute":case"mins":case"min":case"m":return t*a;case"seconds":case"second":case"secs":case"sec":case"s":return t*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function r(e){return e>=u?Math.round(e/u)+"d":e>=i?Math.round(e/i)+"h":e>=a?Math.round(e/a)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function o(e){return c(e,u,"day")||c(e,i,"hour")||c(e,a,"minute")||c(e,s,"second")||e+" ms"}function c(e,n,t){if(!(e<n))return e<1.5*n?Math.floor(e/n)+" "+t:Math.ceil(e/n)+" "+t+"s"}var s=1e3,a=60*s,i=60*a,u=24*i,f=365.25*u;e.exports=function(e,n){n=n||{};var c=typeof e;if("string"===c&&e.length>0)return t(e);if("number"===c&&!1===isNaN(e))return n.long?o(e):r(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(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.PageProofIndexedDBCacheAdapter=t():e.PageProofIndexedDBCacheAdapter=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},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 r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(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 c(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)}function i(e){return e.expiresAt<Date.now()}t.__esModule=!0;var f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=n(1),p=r(s),l=n(2),d=r(l),h=n(3)("IndexedDBCacheAdapter"),y={database:"@pageproof/sdk/adapters/IndexedDBCacheAdapter"},b=function(e){function t(n){o(this,t);var r=u(this,e.call(this));return r.options=a({},y,n),r.cache=(0,p.default)(r.options.database),r.purge(),r}return c(t,e),t.prototype.set=function(e,t){return h('Setting "'+e+'" to type '+(void 0===t?"undefined":f(t))),this.cache.set(e,{data:t,expiresAt:Date.now()+864e5})},t.prototype.has=function(e){return this.get(e).then(function(){return!0},function(){return!1})},t.prototype.get=function(e){return h('Retieve from cache by key "'+e+'"'),this.cache.get(e).then(function(t){return t?i(t)?Promise.reject(new Error('"'+e+'" has expired.')):t.data:Promise.reject(new Error('"'+e+'" was not found in the cache.'))})},t.prototype.clear=function(){return h("Clearing all data from cache"),this.cache.clear()},t.prototype.purge=function(){var e=this;h("Purging any expired entries from the cache");var t=0;return this.cache.keys().then(function(n){var r=Promise.resolve();return n.forEach(function(n){r=r.then(function(){return e.cache.get(n)}).then(function(r){if(i(r))return t++,e.cache.remove(n)})}),r}).then(function(){t&&h("Purged "+t+" "+(t>1?"entries":"entry"))})},t}(d.default);t.default=b},function(e,t,n){var r,o;!function(){"use strict";function n(e){function t(){return r||(r=new Promise(function(t,n){var r=indexedDB.open(e,1);r.onerror=function(){n(r.error)},r.onupgradeneeded=function(){r.result.createObjectStore(u)},r.onsuccess=function(){t(r.result)}})),r}function n(e,n){return t().then(function(t){return new Promise(function(r,o){var c=t.transaction(u,e);c.oncomplete=function(){r()},c.onerror=function(){o(c.error)},n(c.objectStore(u))})})}var r;return{get:function(e){var t;return n(c,function(n){t=n.get(e)}).then(function(){return t.result})},set:function(e,t){return n(i,function(n){n.put(t,e)})},remove:function(e){return n(i,function(t){t.delete(e)})},clear:function(){return n(i,function(e){e.clear()})},keys:function(){var e=[];return n(c,function(t){(t.openKeyCursor||t.openCursor).call(t).onsuccess=function(){this.result&&(e.push(this.result.key),this.result.continue())}}).then(function(){return e})}}}var u="kv",c="readonly",i="readwrite",f=n("kv");for(var a in f)f.hasOwnProperty(a)&&(n[a]=f[a]);void 0!==e&&e.exports?e.exports=n:(r=[],void 0!==(o=function(){return n}.apply(t,r))&&(e.exports=o))}()},function(e,t,n){"use strict";function r(){}t.__esModule=!0,r.__adapter__="ICacheAdapter",t.default=r},function(e,t,n){"use strict";e.exports=function e(){return e}}])});
2
2
  //# sourceMappingURL=indexeddb-cache-adapter.js.map
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _ProofState=require("../enum/ProofState");var _ProofState2=_interopRequireDefault(_ProofState);var _ProofStatus=require("../enum/ProofStatus");var _ProofStatus2=_interopRequireDefault(_ProofStatus);var _ProofType=require("../enum/ProofType");var _ProofType2=_interopRequireDefault(_ProofType);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _id=require("../util/id");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 isOverdue(){return this.dueDate&&this.dueDate.getTime()<Date.now()}var proofSchema={id:"ProofId",name:"Title",status:"Status",workflowId:"WorkflowId",version:"Version",dueDate:(0,_transform.date)("DueDate"),createdDate:(0,_transform.date)("CreateDate"),approvedDate:(0,_transform.date)("ApprovedDate"),isLocked:"Locked",isArchived:"Closed",isOverdue:isOverdue,uploaderUserId:"UserId",ownerUserIds:"OwnerIds",editorUserId:"EditorId",editorUserIds:"EditorIds",lockerUserId:"ProofLockerId",messageToReviewers:"Description",messageToOwners:"OwnerMessage",messageToEditor:"EditorMessage",fileId:"FileId",fileExtension:"Extension",fileStatus:"FileStatus",fileMessage:"FileStatusMessage",pageCount:(0,_transform.number)("Pages"),commentCount:(0,_transform.number)("ParentComments"),canDownload:(0,_transform.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",todoCommentCount:(0,_transform.number)("CountTodoComments"),doneCommentCount:(0,_transform.number)("CountDoneComments"),fileCategory:"FileCategory",isAdminOnProof:"IsAdminOnProof",groupId:"GroupId",canReupload:"CanReupload",hasEditors:"HasEditors"};var Proof=function(){function Proof(){_classCallCheck(this,Proof)}Proof.prototype.getState=function getState(){var state=_ProofState2.default.ACTIVE;if(this.fileStatus===_FileStatus2.default.UPLOADING){state=_ProofState2.default.UPLOADING}else if(this.hasFileError()){state=_ProofState2.default.FILE_ERROR}else if(this.isProcessing()){state=_ProofState2.default.PROCESSING}else if(this.type===_ProofType2.default.BRIEF){switch(this.status){case _ProofStatus2.default.NEW:state=_ProofState2.default.SETUP_NEEDED;break;case _ProofStatus2.default.PROOFING:state=_ProofState2.default.BRIEFING;break;case _ProofStatus2.default.AWAITING_NEW_VERSION:state=_ProofState2.default.AWAITING_PROOF;break;case _ProofStatus2.default.HAS_NEW_VERSION:state=_ProofState2.default.HAS_NEW_VERSION;break;case _ProofStatus2.default.ARCHIVED:state=_ProofState2.default.ARCHIVED;break}}else if(this.status===_ProofStatus2.default.ARCHIVED){state=_ProofState2.default.ARCHIVED}else if(!this.hasWorkflow()){state=_ProofState2.default.PROOFERS_NEEDED}else if(this.status===_ProofStatus2.default.TODOS_REQUESTED){state=_ProofState2.default.TODOS_REQUESTED}else if(this.status===_ProofStatus2.default.AWAITING_NEW_VERSION){state=_ProofState2.default.AWAITING_NEW_VERSION}else if(this.status===_ProofStatus2.default.HAS_NEW_VERSION){state=_ProofState2.default.HAS_NEW_VERSION}else if(this.status===_ProofStatus2.default.APPROVED){state=_ProofState2.default.APPROVED}else if(!this.hasWorkflowStarted()){state=_ProofState2.default.NOT_STARTED}else if(this.isOverdue){state=_ProofState2.default.OVERDUE}return state};Proof.prototype.hasWorkflowStarted=function hasWorkflowStarted(){return this.hasWorkflow()&&this.status!==_ProofStatus2.default.NEW};Proof.prototype.isProcessing=function isProcessing(){return this.fileStatus===_FileStatus2.default.UPLOADING||this.fileStatus===_FileStatus2.default.QUEUED||this.fileStatus===_FileStatus2.default.RIPPING};Proof.prototype.getProcessingProgress=function getProcessingProgress(){switch(this.fileStatus){case _FileStatus2.default.UPLOADING:return.1;case _FileStatus2.default.QUEUED:return.2;case _FileStatus2.default.RIPPING:return.6;default:return-1}};Proof.prototype.hasWorkflow=function hasWorkflow(){return(0,_id.isWorkflowId)(this.workflowId)};Proof.prototype.hasFile=function hasFile(){return(0,_id.isFileId)(this.fileId)};Proof.prototype.hasFileError=function hasFileError(){return this.fileStatus===_FileStatus2.default.ERROR||!this.fileStatus||!this.hasFile()};Proof.prototype.hasEditor=function hasEditor(){return(0,_id.isUserId)(this.editorUserId)};Proof.prototype.hasThumbnail=function hasThumbnail(){return this.fileStatus===_FileStatus2.default.OK};Proof.prototype.canUserUploadNewVersion=function canUserUploadNewVersion(userId){return this.getState()===_ProofState2.default.AWAITING_NEW_VERSION&&(this.isEditor(userId)||this.isOwner(userId))||this.getState()===_ProofState2.default.AWAITING_PROOF&&(this.isEditor(userId)||this.isRecipient(userId))};Proof.prototype.isOwner=function isOwner(userId){return this.ownerUserIds.indexOf(userId)!==-1};Proof.prototype.isEditor=function isEditor(userId){return this.editorUserIds.indexOf(userId)!==-1};Proof.prototype.isRecipient=function isRecipient(userId){return this.recipient===userId};Proof.prototype.calculateState=function calculateState(){this.state=this.getState()};Proof.prototype.fromProof=function fromProof(proofData){(0,_transform2.default)(this,proofSchema,proofData);this.calculateState();return this};return Proof}();exports.default=Proof;
1
+ "use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _ProofState=require("../enum/ProofState");var _ProofState2=_interopRequireDefault(_ProofState);var _ProofStatus=require("../enum/ProofStatus");var _ProofStatus2=_interopRequireDefault(_ProofStatus);var _ProofType=require("../enum/ProofType");var _ProofType2=_interopRequireDefault(_ProofType);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _id=require("../util/id");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 isOverdue(){return this.dueDate&&this.dueDate.getTime()<Date.now()}var proofSchema={id:"ProofId",name:"Title",status:"Status",workflowId:"WorkflowId",version:"VersionNumber",dueDate:(0,_transform.date)("DueDate"),createdDate:(0,_transform.date)("CreateDate"),approvedDate:(0,_transform.date)("ApprovedDate"),isLocked:"Locked",isArchived:"Closed",isOverdue:isOverdue,uploaderUserId:"UserId",ownerUserIds:"OwnerIds",editorUserId:"EditorId",editorUserIds:"EditorIds",lockerUserId:"ProofLockerId",messageToReviewers:"Description",messageToOwners:"OwnerMessage",messageToEditor:"EditorMessage",fileId:"FileId",fileExtension:"Extension",fileStatus:"FileStatus",fileMessage:"FileStatusMessage",pageCount:(0,_transform.number)("Pages"),commentCount:(0,_transform.number)("ParentComments"),canDownload:(0,_transform.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",todoCommentCount:(0,_transform.number)("CountTodoComments"),doneCommentCount:(0,_transform.number)("CountDoneComments"),fileCategory:"FileCategory",isAdminOnProof:"IsAdminOnProof",groupId:"GroupId",canReupload:"CanReupload",hasEditors:"HasEditors",collectionName:"GroupName"};var Proof=function(){function Proof(){_classCallCheck(this,Proof)}Proof.prototype.getState=function getState(){var state=_ProofState2.default.ACTIVE;if(this.fileStatus===_FileStatus2.default.UPLOADING){state=_ProofState2.default.UPLOADING}else if(this.hasFileError()){state=_ProofState2.default.FILE_ERROR}else if(this.isProcessing()){state=_ProofState2.default.PROCESSING}else if(this.type===_ProofType2.default.BRIEF){switch(this.status){case _ProofStatus2.default.NEW:state=_ProofState2.default.SETUP_NEEDED;break;case _ProofStatus2.default.PROOFING:state=_ProofState2.default.BRIEFING;break;case _ProofStatus2.default.AWAITING_NEW_VERSION:state=_ProofState2.default.AWAITING_PROOF;break;case _ProofStatus2.default.HAS_NEW_VERSION:state=_ProofState2.default.HAS_NEW_VERSION;break;case _ProofStatus2.default.ARCHIVED:state=_ProofState2.default.ARCHIVED;break}}else if(this.status===_ProofStatus2.default.ARCHIVED){state=_ProofState2.default.ARCHIVED}else if(!this.hasWorkflow()){state=_ProofState2.default.PROOFERS_NEEDED}else if(this.status===_ProofStatus2.default.TODOS_REQUESTED){state=_ProofState2.default.TODOS_REQUESTED}else if(this.status===_ProofStatus2.default.AWAITING_NEW_VERSION){state=_ProofState2.default.AWAITING_NEW_VERSION}else if(this.status===_ProofStatus2.default.HAS_NEW_VERSION){state=_ProofState2.default.HAS_NEW_VERSION}else if(this.status===_ProofStatus2.default.APPROVED){state=_ProofState2.default.APPROVED}else if(!this.hasWorkflowStarted()){state=_ProofState2.default.NOT_STARTED}else if(this.isOverdue){state=_ProofState2.default.OVERDUE}return state};Proof.prototype.hasWorkflowStarted=function hasWorkflowStarted(){return this.hasWorkflow()&&this.status!==_ProofStatus2.default.NEW};Proof.prototype.isProcessing=function isProcessing(){return this.fileStatus===_FileStatus2.default.UPLOADING||this.fileStatus===_FileStatus2.default.QUEUED||this.fileStatus===_FileStatus2.default.RIPPING};Proof.prototype.getProcessingProgress=function getProcessingProgress(){switch(this.fileStatus){case _FileStatus2.default.UPLOADING:return.1;case _FileStatus2.default.QUEUED:return.2;case _FileStatus2.default.RIPPING:return.6;default:return-1}};Proof.prototype.hasWorkflow=function hasWorkflow(){return(0,_id.isWorkflowId)(this.workflowId)};Proof.prototype.hasFile=function hasFile(){return(0,_id.isFileId)(this.fileId)};Proof.prototype.hasFileError=function hasFileError(){return this.fileStatus===_FileStatus2.default.ERROR||!this.fileStatus||!this.hasFile()};Proof.prototype.hasEditor=function hasEditor(){return(0,_id.isUserId)(this.editorUserId)};Proof.prototype.hasThumbnail=function hasThumbnail(){return this.fileStatus===_FileStatus2.default.OK};Proof.prototype.canUserUploadNewVersion=function canUserUploadNewVersion(userId){return this.getState()===_ProofState2.default.AWAITING_NEW_VERSION&&(this.isEditor(userId)||this.isOwner(userId))||this.getState()===_ProofState2.default.AWAITING_PROOF&&(this.isEditor(userId)||this.isRecipient(userId))};Proof.prototype.isOwner=function isOwner(userId){return this.ownerUserIds.indexOf(userId)!==-1};Proof.prototype.isEditor=function isEditor(userId){return this.editorUserIds.indexOf(userId)!==-1};Proof.prototype.isRecipient=function isRecipient(userId){return this.recipient===userId};Proof.prototype.calculateState=function calculateState(){this.state=this.getState()};Proof.prototype.fromProof=function fromProof(proofData){(0,_transform2.default)(this,proofSchema,proofData);this.calculateState();return this};return Proof}();exports.default=Proof;