@pageproof/sdk-pr 92.0.1530833367136 → 92.0.1532904992987

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.
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";exports.__esModule=true;exports.getCommentTokens=exports.getCommentText=exports.getCommentMentions=exports.getCommentHTML=exports.getCommentEscaped=exports.parseComment=undefined;var _escapeHtml=require("escape-html");var _escapeHtml2=_interopRequireDefault(_escapeHtml);var _constants=require("../util/constants");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function getCommentEscaped(rawComment){return(0,_escapeHtml2.default)(rawComment)}function getCommentText(escapedComment){return escapedComment.replace(_constants.MENTION_REGEX,function(_,id,label){return label})}function getCommentHTML(escapedComment){var mentionIndex=0;return escapedComment.replace(_constants.MENTION_REGEX,function(match,id,label,startIndex){var index=mentionIndex++;return"<span "+"data-mention "+('data-mention-index="'+index+'" ')+('data-mention-user-id="'+id+'" ')+('data-mention-user-label="'+label.replace(/"/,'\\"')+'" ')+('data-mention-start-index="'+startIndex+'" ')+('data-mention-end-index="'+(startIndex+match.length)+'" ')+('data-mention-length="'+match.length+'">')+label+"</span>"})}function getCommentMentions(rawComment){var mentions=[];rawComment.replace(_constants.MENTION_REGEX,function(match,id,label,startIndex){mentions.push({id:id,label:label,index:startIndex,length:match.length})});return mentions}function getCommentTokens(rawComment){var mentions=getCommentMentions(rawComment);var tokens=[];var previousIndex=0;mentions.forEach(function(mention){var before=rawComment.slice(previousIndex,mention.index);previousIndex=mention.index+mention.length;if(before){tokens.push({type:"text",value:before})}tokens.push({type:"mention",value:mention})});var remainder=rawComment.slice(previousIndex);if(remainder){tokens.push({type:"text",value:remainder})}return tokens}function parseComment(rawComment){var escapedComment=getCommentEscaped(rawComment);return{raw:rawComment,text:getCommentText(escapedComment),html:getCommentHTML(escapedComment),mentions:getCommentMentions(rawComment),tokens:getCommentTokens(rawComment)}}exports.parseComment=parseComment;exports.getCommentEscaped=getCommentEscaped;exports.getCommentHTML=getCommentHTML;exports.getCommentMentions=getCommentMentions;exports.getCommentText=getCommentText;exports.getCommentTokens=getCommentTokens;
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var TOKEN_HEADER=exports.TOKEN_HEADER="x-authorization-token";var HMAC_HEADER=exports.HMAC_HEADER="x-authorization-hmac";var TIMESTAMP_HEADER=exports.TIMESTAMP_HEADER="x-timestamp";var DEVICE_ID_HEADER=exports.DEVICE_ID_HEADER="x-device-id";var SUBSCRIPTION_KEY_HEADER=exports.SUBSCRIPTION_KEY_HEADER="ocp-apim-subscription-key";var SDK_VERSION_HEADER=exports.SDK_VERSION_HEADER="x-pageproof-javascript-sdk";var RETRY_AFTER_HEADER=exports.RETRY_AFTER_HEADER="retry-after";var BYTES_PER_BLOCK=exports.BYTES_PER_BLOCK=1024*1024*2;var MENTION_REGEX=exports.MENTION_REGEX=/@{(U[a-zA-Z0-9]{15})}{(.*?)}/g;var ISO_REGEX=exports.ISO_REGEX=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/;var DEFAULT_ISO_DATE=exports.DEFAULT_ISO_DATE="0001-01-01T00:00:00";var DAY_IN_MS=exports.DAY_IN_MS=1e3*60*60*24;var COMMENT_CACHE_PREFIX=exports.COMMENT_CACHE_PREFIX="comment";var THUMBNAIL_CACHE_PREFIX=exports.THUMBNAIL_CACHE_PREFIX="thumbnail";
1
+ "use strict";exports.__esModule=true;var TOKEN_HEADER=exports.TOKEN_HEADER="x-authorization-token";var HMAC_HEADER=exports.HMAC_HEADER="x-authorization-hmac";var TIMESTAMP_HEADER=exports.TIMESTAMP_HEADER="x-timestamp";var DEVICE_ID_HEADER=exports.DEVICE_ID_HEADER="x-device-id";var SUBSCRIPTION_KEY_HEADER=exports.SUBSCRIPTION_KEY_HEADER="ocp-apim-subscription-key";var SDK_VERSION_HEADER=exports.SDK_VERSION_HEADER="x-pageproof-javascript-sdk";var RETRY_AFTER_HEADER=exports.RETRY_AFTER_HEADER="retry-after";var BYTES_PER_BLOCK=exports.BYTES_PER_BLOCK=1024*1024*2;var MENTION_REGEX=exports.MENTION_REGEX=/@{(U[a-zA-Z0-9]{15}|~everyone)}{(.*?)}/g;var ISO_REGEX=exports.ISO_REGEX=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/;var DEFAULT_ISO_DATE=exports.DEFAULT_ISO_DATE="0001-01-01T00:00:00";var DAY_IN_MS=exports.DAY_IN_MS=1e3*60*60*24;var COMMENT_CACHE_PREFIX=exports.COMMENT_CACHE_PREFIX="comment";var THUMBNAIL_CACHE_PREFIX=exports.THUMBNAIL_CACHE_PREFIX="thumbnail";
@@ -0,0 +1 @@
1
+ "use strict";exports.__esModule=true;var CREATION_TOKEN_LENGTH=32;function generateCreationToken(){var time=(new Date).getTime();var mask="abcdefghijklmnopqrstuvwxyz"+"ABCDEFGHIJKLMNOPQRSTUVWXYZ"+"0123456789"+"~`!@#$%^&*()_+-={}[]:\";'<>?,./|\\";var result="";for(var i=CREATION_TOKEN_LENGTH;i>0;--i){result+=mask[Math.round(Math.random()*(mask.length-1))]}return result+"-"+time}exports.generateCreationToken=generateCreationToken;
@@ -0,0 +1 @@
1
+ "use strict";exports.__esModule=true;function throttle(func,ms){var timeout=void 0;return function(){if(!timeout){timeout=setTimeout(function(){func();timeout=null},ms)}}}exports.default=throttle;
@@ -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.PageProofWorkerCryptoAdapter=t():e.PageProofWorkerCryptoAdapter=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,r){"use strict";function n(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 s(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 r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=r(1),c=n(a),p=r(6),f=n(p),l={url:null,limit:navigator.hardwareConcurrency||1,optimistic:!1},d=function(e){function t(n){o(this,t),n=u({},l,n);var i=s(this,e.call(this,{limit:n.limit,create:function(){return r.p=n.url+"/",new f.default}}));return n.optimistic&&i.scheduler.prime(),i.options=n,i}return i(t,e),t}(c.default);t.default=d},function(e,t,r){"use strict";function n(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 s(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=r(2),a=n(u),c=r(5),p=n(c),f=function(e){function t(r){o(this,t);var n=s(this,e.call(this));return n.scheduler=new a.default(r),n}return i(t,e),t.prototype.decryptComment=function(e,t,r){return this.scheduler.send({type:"decryptComment",args:[e,t,r]})},t.prototype.decryptFileBlock=function(e,t){return this.scheduler.send({type:"decryptFileBlock",args:[e,t]})},t.prototype.decryptImage=function(e,t){return this.scheduler.send({type:"decryptImage",args:[e,t]})},t.prototype.decryptPrivateKey=function(e,t){return this.scheduler.send({type:"decryptPrivateKey",args:[e,t]})},t.prototype.encryptFileBlock=function(e,t){return this.scheduler.send({type:"encryptFileBlock",args:[e,t]})},t.prototype.encryptPrivateKey=function(e,t){return this.scheduler.send({type:"encryptPrivateKey",args:[e,t]})},t.prototype.envelopeSeal=function(e,t){return this.scheduler.send({type:"envelopeSeal",args:[e,t]})},t.prototype.envelopeUnseal=function(e,t){return this.scheduler.send({type:"envelopeUnseal",args:[e,t]})},t.prototype.generateAuthorizationHeaders=function(e,t,r){return this.scheduler.send({type:"generateAuthorizationHeaders",args:[e,t,r]})},t.prototype.generateKeyIV=function(){return this.scheduler.send({type:"generateKeyIV"})},t.prototype.generateKeyPair=function(){return this.scheduler.send({type:"generateKeyPair"})},t.prototype.generatePasswordHash=function(e){return this.scheduler.send({type:"generatePasswordHash",args:[e]})},t.prototype.generateWrappedSymmetricKey=function(e){return this.scheduler.send({type:"generateWrappedSymmetricKey",args:[e]})},t.prototype.decryptManagedPrivateKey=function(e,t){return this.scheduler.send({type:"decryptManagedPrivateKey",args:[e,t]})},t}(p.default);t.default=f},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(s),u=r(4)("Scheduler"),a={limit:1},c=function e(){var t=this;n(this,e),this.promise=new Promise(function(e,r){t.resolve=e,t.reject=r})},p=function(){function e(t){n(this,e),this.queue=[],this.workers=new Map,this.options=o({},a,t)}return e.prototype.send=function(e){var t=new c;return this.queue.push({id:(0,i.default)(),deferred:t,message:e}),this.process(),t.promise},e.prototype.prime=function(){for(;this.workers.size<this.options.limit;)this.createWorker()},e.prototype.getIdleWorkers=function(){var e=[];return this.workers.forEach(function(t,r){t&&e.push(r)}),e},e.prototype.getNextIdleWorker=function(){return this.getIdleWorkers()[0]},e.prototype.shouldCreateWorkers=function(){return 0===this.getIdleWorkers().length&&this.workers.size<this.options.limit&&this.queue.length>=1},e.prototype.createWorker=function(){var e=this.options.create();return this.workers.set(e,!0),e},e.prototype.process=function(){if(0===this.queue.length)return void u("Nothing to process, queue empty");var e=null;if(!(e=this.shouldCreateWorkers()?this.createWorker():this.getNextIdleWorker()))return void u("Unable to process queue, as there are no idle worker available");var t=this.queue.shift();this.handle(t,e)},e.prototype.handle=function(e,t){var r=this;this.workers.set(t,!1);var n=function n(o){u("Recieved response from worker ("+e.id+")"),t.removeEventListener("message",n),r.workers.set(t,!0);var s=e.deferred,i=s.resolve,a=s.reject;if(o.data&&o.data.error){var c=o.data.error,p=c.message,f=c.stack,l=new Error(p);Object.defineProperty(l,"stack",{value:f}),a(l)}else i(o.data);r.process()};t.addEventListener("message",n),u("Sending message to worker ("+e.id+")"),t.postMessage(e.message)},e}();t.default=p},function(e,t,r){"use strict";function n(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,n)}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";e.exports=function e(){return e}},function(e,t,r){"use strict";function n(){}t.__esModule=!0,n.__adapter__="ICryptoAdapter",t.default=n},function(e,t,r){e.exports=function(){return new Worker(r.p+"worker.434ad608.js")}}])});
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PageProofWorkerCryptoAdapter=t():e.PageProofWorkerCryptoAdapter=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,r){"use strict";function n(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 s(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 r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=r(1),c=n(a),p=r(6),f=n(p),l={url:null,limit:navigator.hardwareConcurrency||1,optimistic:!1},d=function(e){function t(n){o(this,t),n=u({},l,n);var i=s(this,e.call(this,{limit:n.limit,create:function(){return r.p=n.url+"/",new f.default}}));return n.optimistic&&i.scheduler.prime(),i.options=n,i}return i(t,e),t}(c.default);t.default=d},function(e,t,r){"use strict";function n(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 s(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=r(2),a=n(u),c=r(5),p=n(c),f=function(e){function t(r){o(this,t);var n=s(this,e.call(this));return n.scheduler=new a.default(r),n}return i(t,e),t.prototype.decryptComment=function(e,t,r){return this.scheduler.send({type:"decryptComment",args:[e,t,r]})},t.prototype.decryptFileBlock=function(e,t){return this.scheduler.send({type:"decryptFileBlock",args:[e,t]})},t.prototype.decryptImage=function(e,t){return this.scheduler.send({type:"decryptImage",args:[e,t]})},t.prototype.decryptPrivateKey=function(e,t){return this.scheduler.send({type:"decryptPrivateKey",args:[e,t]})},t.prototype.encryptFileBlock=function(e,t){return this.scheduler.send({type:"encryptFileBlock",args:[e,t]})},t.prototype.encryptPrivateKey=function(e,t){return this.scheduler.send({type:"encryptPrivateKey",args:[e,t]})},t.prototype.envelopeSeal=function(e,t){return this.scheduler.send({type:"envelopeSeal",args:[e,t]})},t.prototype.envelopeUnseal=function(e,t){return this.scheduler.send({type:"envelopeUnseal",args:[e,t]})},t.prototype.generateAuthorizationHeaders=function(e,t,r){return this.scheduler.send({type:"generateAuthorizationHeaders",args:[e,t,r]})},t.prototype.generateKeyIV=function(){return this.scheduler.send({type:"generateKeyIV"})},t.prototype.generateKeyPair=function(){return this.scheduler.send({type:"generateKeyPair"})},t.prototype.generatePasswordHash=function(e){return this.scheduler.send({type:"generatePasswordHash",args:[e]})},t.prototype.generateWrappedSymmetricKey=function(e){return this.scheduler.send({type:"generateWrappedSymmetricKey",args:[e]})},t.prototype.decryptManagedPrivateKey=function(e,t){return this.scheduler.send({type:"decryptManagedPrivateKey",args:[e,t]})},t.prototype.encryptComment=function(e,t){return this.scheduler.send({type:"encryptComment",args:[e,t]})},t}(p.default);t.default=f},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(s),u=r(4)("Scheduler"),a={limit:1},c=function e(){var t=this;n(this,e),this.promise=new Promise(function(e,r){t.resolve=e,t.reject=r})},p=function(){function e(t){n(this,e),this.queue=[],this.workers=new Map,this.options=o({},a,t)}return e.prototype.send=function(e){var t=new c;return this.queue.push({id:(0,i.default)(),deferred:t,message:e}),this.process(),t.promise},e.prototype.prime=function(){for(;this.workers.size<this.options.limit;)this.createWorker()},e.prototype.getIdleWorkers=function(){var e=[];return this.workers.forEach(function(t,r){t&&e.push(r)}),e},e.prototype.getNextIdleWorker=function(){return this.getIdleWorkers()[0]},e.prototype.shouldCreateWorkers=function(){return 0===this.getIdleWorkers().length&&this.workers.size<this.options.limit&&this.queue.length>=1},e.prototype.createWorker=function(){var e=this.options.create();return this.workers.set(e,!0),e},e.prototype.process=function(){if(0===this.queue.length)return void u("Nothing to process, queue empty");var e=null;if(!(e=this.shouldCreateWorkers()?this.createWorker():this.getNextIdleWorker()))return void u("Unable to process queue, as there are no idle worker available");var t=this.queue.shift();this.handle(t,e)},e.prototype.handle=function(e,t){var r=this;this.workers.set(t,!1);var n=function n(o){u("Recieved response from worker ("+e.id+")"),t.removeEventListener("message",n),r.workers.set(t,!0);var s=e.deferred,i=s.resolve,a=s.reject;if(o.data&&o.data.error){var c=o.data.error,p=c.message,f=c.stack,l=new Error(p);Object.defineProperty(l,"stack",{value:f}),a(l)}else i(o.data);r.process()};t.addEventListener("message",n),u("Sending message to worker ("+e.id+")"),t.postMessage(e.message)},e}();t.default=p},function(e,t,r){"use strict";function n(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,n)}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";e.exports=function e(){return e}},function(e,t,r){"use strict";function n(){}t.__esModule=!0,n.__adapter__="ICryptoAdapter",t.default=n},function(e,t,r){e.exports=function(){return new Worker(r.p+"worker.35eb8871.js")}}])});
2
2
  //# sourceMappingURL=worker-crypto-adapter.js.map