@pageproof/sdk-pr 331.0.1620603409176 → 332.0.1620611958554
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/lib/core/KeyPairs.js +1 -1
- package/lib/models/Proof.js +1 -1
- package/lib/pageproof.js +1 -1
- package/package.json +1 -1
package/lib/core/KeyPairs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var KeyPairs=function(){function KeyPairs(client){_classCallCheck(this,KeyPairs);this.keyPairs=[];this.client=client}KeyPairs.prototype.addKeyPair=function addKeyPair(keyPair){var _this=this;this.keyPairs.push(keyPair);return function(){return _this.removeKeyPair(keyPair)}};KeyPairs.prototype.removeKeyPair=function removeKeyPair(keyPair){this.keyPairs.splice(this.keyPairs.indexOf(keyPair),1)};KeyPairs.prototype.getPrivateKeyPEMs=function getPrivateKeyPEMs(){return[this.client.session.privateKeyPEM].concat(this.keyPairs.map(function(keyPair){return keyPair.privateKeyPEM})).filter(Boolean)};KeyPairs.prototype.getPublicKeyPEMs=function getPublicKeyPEMs(){return[this.client.session.serverPublicKeyPEM,this.client.session.publicKeyPEM].concat(this.keyPairs.map(function(keyPair){return keyPair.publicKeyPEM})).filter(Boolean)};return KeyPairs}();exports.default=KeyPairs;
|
|
1
|
+
"use strict";exports.__esModule=true;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var KeyPairs=function(){function KeyPairs(client){_classCallCheck(this,KeyPairs);this.keyPairs=[];this.client=client}KeyPairs.prototype.addKeyPair=function addKeyPair(keyPair){var _this=this;this.keyPairs.push(keyPair);return function(){return _this.removeKeyPair(keyPair)}};KeyPairs.prototype.removeKeyPair=function removeKeyPair(keyPair){this.keyPairs.splice(this.keyPairs.indexOf(keyPair),1)};KeyPairs.prototype.getPrivateKeyPEMs=function getPrivateKeyPEMs(){return[this.client.session&&this.client.session.privateKeyPEM].concat(this.keyPairs.map(function(keyPair){return keyPair.privateKeyPEM})).filter(Boolean)};KeyPairs.prototype.getPublicKeyPEMs=function getPublicKeyPEMs(){return[this.client.session&&this.client.session.serverPublicKeyPEM,this.client.session&&this.client.session.publicKeyPEM].concat(this.keyPairs.map(function(keyPair){return keyPair.publicKeyPEM})).filter(Boolean)};return KeyPairs}();exports.default=KeyPairs;
|
package/lib/models/Proof.js
CHANGED
|
@@ -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");var _getPercentage=require("../util/getPercentage");var _getPercentage2=_interopRequireDefault(_getPercentage);var _User=require("./User");var _User2=_interopRequireDefault(_User);var _DecisionSummary=require("./DecisionSummary");var _DecisionSummary2=_interopRequireDefault(_DecisionSummary);var _ProofIntegrationReference=require("./ProofIntegrationReference");var _ProofIntegrationReference2=_interopRequireDefault(_ProofIntegrationReference);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",fileSize:"FileSize",pageCount:(0,_transform.number)("Pages"),commentCount:(0,_transform.number)("ParentComments"),canDownload:(0,_transform.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",recipientEmail:"RecipientEmail",todoCommentCount:(0,_transform.number)("CountTodoComments"),doneCommentCount:(0,_transform.number)("CountDoneComments"),fileCategory:"FileCategory",isAdminOnProof:"IsAdminOnProof",groupId:"GroupId",canReupload:"CanReupload",hasEditors:"HasEditors",groupName:"GroupName",role:"Role",canOthersEditComments:"FeatureEditComments",canAddCommentReplies:"FeatureCanAddCommentReplies",hasDecisionsEnabled:"FeatureDecisions",reference:"Reference",integrationReferences:(0,_transform.each)("IntegrationReferences",function(data){return(new _ProofIntegrationReference2.default).fromProofIntegrationReference(data)}),isReferenceEnabled:"FeatureProofReference",source:"Source",owners:(0,_transform.each)("Owners",function(ownerData){return(new _User2.default).fromUser(ownerData)}),decisionSummary:(0,_transform.each)("Decisions",function(decisionsData){return(new _DecisionSummary2.default).fromDecisionSummary(decisionsData)}),tags:(0,_transform.each)("Tags",function(tag){return tag.Value}),teamId:"TeamId",isPublic:"IsPublic",canBePublic:"FeaturePublicProofs",canSendShareLink:"FeatureSendShareLink"};var Proof=function(){function Proof(){_classCallCheck(this,Proof)}Proof.prototype.isUserAdminOfProofTeam=function isUserAdminOfProofTeam(user){return user.isAdmin&&this.teamId===user.teamId};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.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.hasWorkflow()){state=_ProofState2.default.PROOFERS_NEEDED}else if(!this.hasWorkflowStarted()){state=_ProofState2.default.NOT_STARTED}else if(this.isOverdue){state=_ProofState2.default.OVERDUE}return state};Proof.prototype.getVideoProcessingProgress=function getVideoProcessingProgress(){var percent=0;var message=String(this.fileMessage);if(message){var thumbMatch=/^Thumb-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(message);var videoMatch=/^Video-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(message);if(message.startsWith("Video-Scheduled-")){percent=0}else if(videoMatch){percent=(0,_getPercentage2.default)(parseFloat(videoMatch[1])/100,0,.2)}else if(thumbMatch){percent=(0,_getPercentage2.default)(parseFloat(thumbMatch[1])/100,.8,0)}}return percent};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.isAwaitingFile=function isAwaitingFile(){return this.source&&this.fileStatus===_FileStatus2.default.CREATED};Proof.prototype.getProcessingProgress=function getProcessingProgress(){switch(this.fileStatus){case _FileStatus2.default.UPLOADING:return.1;case _FileStatus2.default.QUEUED:return.2;case _FileStatus2.default.RIPPING:if(this.fileCategory==="video"){return(0,_getPercentage2.default)(this.getVideoProcessingProgress(),.2,.1).toFixed(2)}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");var _getPercentage=require("../util/getPercentage");var _getPercentage2=_interopRequireDefault(_getPercentage);var _User=require("./User");var _User2=_interopRequireDefault(_User);var _DecisionSummary=require("./DecisionSummary");var _DecisionSummary2=_interopRequireDefault(_DecisionSummary);var _ProofIntegrationReference=require("./ProofIntegrationReference");var _ProofIntegrationReference2=_interopRequireDefault(_ProofIntegrationReference);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",fileSize:"FileSize",pageCount:(0,_transform.number)("Pages"),commentCount:(0,_transform.number)("ParentComments"),canDownload:(0,_transform.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",recipientEmail:"RecipientEmail",todoCommentCount:(0,_transform.number)("CountTodoComments"),doneCommentCount:(0,_transform.number)("CountDoneComments"),fileCategory:"FileCategory",isAdminOnProof:"IsAdminOnProof",groupId:"GroupId",canReupload:"CanReupload",hasEditors:"HasEditors",groupName:"GroupName",role:"Role",canOthersEditComments:"FeatureEditComments",canAddCommentReplies:"FeatureCanAddCommentReplies",hasDecisionsEnabled:"FeatureDecisions",reference:"Reference",integrationReferences:(0,_transform.each)("IntegrationReferences",function(data){return(new _ProofIntegrationReference2.default).fromProofIntegrationReference(data)}),isReferenceEnabled:"FeatureProofReference",source:"Source",owners:(0,_transform.each)("Owners",function(ownerData){return(new _User2.default).fromUser(ownerData)}),decisionSummary:(0,_transform.each)("Decisions",function(decisionsData){return(new _DecisionSummary2.default).fromDecisionSummary(decisionsData)}),tags:(0,_transform.each)("Tags",function(tag){return tag.Value}),teamId:"TeamId",isPublic:"IsPublic",canBePublic:"FeaturePublicProofs",canSendShareLink:"FeatureSendShareLink",publicProofKeyPair:function publicProofKeyPair(data){return data.PublicProofKeyPair&&{publicKeyPEM:data.PublicProofKeyPair.PublicKey,privateKeyPEM:data.PublicProofKeyPair.PrivateKey}}};var Proof=function(){function Proof(){_classCallCheck(this,Proof)}Proof.prototype.isUserAdminOfProofTeam=function isUserAdminOfProofTeam(user){return user.isAdmin&&this.teamId===user.teamId};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.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.hasWorkflow()){state=_ProofState2.default.PROOFERS_NEEDED}else if(!this.hasWorkflowStarted()){state=_ProofState2.default.NOT_STARTED}else if(this.isOverdue){state=_ProofState2.default.OVERDUE}return state};Proof.prototype.getVideoProcessingProgress=function getVideoProcessingProgress(){var percent=0;var message=String(this.fileMessage);if(message){var thumbMatch=/^Thumb-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(message);var videoMatch=/^Video-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(message);if(message.startsWith("Video-Scheduled-")){percent=0}else if(videoMatch){percent=(0,_getPercentage2.default)(parseFloat(videoMatch[1])/100,0,.2)}else if(thumbMatch){percent=(0,_getPercentage2.default)(parseFloat(thumbMatch[1])/100,.8,0)}}return percent};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.isAwaitingFile=function isAwaitingFile(){return this.source&&this.fileStatus===_FileStatus2.default.CREATED};Proof.prototype.getProcessingProgress=function getProcessingProgress(){switch(this.fileStatus){case _FileStatus2.default.UPLOADING:return.1;case _FileStatus2.default.QUEUED:return.2;case _FileStatus2.default.RIPPING:if(this.fileCategory==="video"){return(0,_getPercentage2.default)(this.getVideoProcessingProgress(),.2,.1).toFixed(2)}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;
|