UNPKG

webgme-engine

Version:

WebGME server and Client API without a GUI

2,223 lines (614 loc) 32.9 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: Artifact</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: Artifact</h1> <section> <header> <h2><span class="attribs"><span class="type-signature"></span></span>Artifact<span class="signature">(name, blobClient, descriptor)</span><span class="type-signature"></span></h2> </header> <article> <div class="container-overview"> <h4 class="name" id="Artifact"><span class="type-signature"></span>new Artifact<span class="signature">(name, blobClient, descriptor)</span><span class="type-signature"></span></h4> <div class="description"> <p>Creates a new instance of artifact, i.e. complex object, in memory. This object can be saved in the blob-storage on the server and later retrieved with its metadata hash.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type"><a href="global.html#string">string</a></span> </td> <td class="description last"><p>Artifact's name without extension</p></td> </tr> <tr> <td class="name"><code>blobClient</code></td> <td class="type"> <span class="param-type"><a href="BlobClient.html">BlobClient</a></span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>descriptor</code></td> <td class="type"> <span class="param-type"><a href="BlobMetadata.html">BlobMetadata</a></span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="common_blob_Artifact.js.html">common/blob/Artifact.js</a>, <a href="common_blob_Artifact.js.html#line25">line 25</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="addFile"><span class="type-signature"></span>addFile<span class="signature">(name, content, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="external-Promise.html">external:Promise</a>}</span></h4> <div class="description"> <p>Adds content to the artifact as a file.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type"><a href="global.html#string">string</a></span> </td> <td class="attributes"> </td> <td class="description last"><p>filename</p></td> </tr> <tr> <td class="name"><code>content</code></td> <td class="type"> <span class="param-type">Blob</span> </td> <td class="attributes"> </td> <td class="description last"><p>File object or Blob.</p></td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="global.html#function">function</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>if provided no promise will be returned.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="common_blob_Artifact.js.html">common/blob/Artifact.js</a>, <a href="common_blob_Artifact.js.html#line49">line 49</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>On success the promise will be resolved with {string} <b>metadataHash</b>.<br> On error the promise will be rejected with <a href="global.html#Error">Error</a> <b>error</b>.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="external-Promise.html">external:Promise</a></span> </dd> </dl> <h4 class="name" id="addFileAsSoftLink"><span class="type-signature"></span>addFileAsSoftLink<span class="signature">(name, content, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="external-Promise.html">external:Promise</a>}</span></h4> <div class="description"> <p>Adds files as soft-link.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type"><a href="global.html#string">string</a></span> </td> <td class="attributes"> </td> <td class="description last"><p>filename.</p></td> </tr> <tr> <td class="name"><code>content</code></td> <td class="type"> <span class="param-type">Blob</span> </td> <td class="attributes"> </td> <td class="description last"><p>File object or Blob.</p></td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="global.html#function">function</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>if provided no promise will be returned.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="common_blob_Artifact.js.html">common/blob/Artifact.js</a>, <a href="common_blob_Artifact.js.html#line82">line 82</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>On success the promise will be resolved with {string} <b>metadataHash</b>.<br> On error the promise will be rejected with <a href="global.html#Error">Error</a> <b>error</b>.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="external-Promise.html">external:Promise</a></span> </dd> </dl> <h4 class="name" id="addFiles"><span class="type-signature"></span>addFiles<span class="signature">(files, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="external-Promise.html">external:Promise</a>}</span></h4> <div class="description"> <p>Adds multiple files.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>files</code></td> <td class="type"> <span class="param-type">Object.&lt;<a href="global.html#string">string</a>, Blob></span> </td> <td class="attributes"> </td> <td class="description last"><p>files to add</p></td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="global.html#function">function</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>if provided no promise will be returned.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="common_blob_Artifact.js.html">common/blob/Artifact.js</a>, <a href="common_blob_Artifact.js.html#line209">line 209</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>On success the promise will be resolved with {string[]} <b>metadataHashes</b>.<br> On error the promise will be rejected with <a href="global.html#Error">string</a> <b>error</b>.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="external-Promise.html">external:Promise</a></span> </dd> </dl> <h4 class="name" id="addFilesAsSoftLinks"><span class="type-signature"></span>addFilesAsSoftLinks<span class="signature">(files, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="external-Promise.html">external:Promise</a>}</span></h4> <div class="description"> <p>Adds multiple files as soft-links.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>files</code></td> <td class="type"> <span class="param-type">Object.&lt;<a href="global.html#string">string</a>, Blob></span> </td> <td class="attributes"> </td> <td class="description last"><p>files to add</p></td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="global.html#function">function</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>if provided no promise will be returned.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="common_blob_Artifact.js.html">common/blob/Artifact.js</a>, <a href="common_blob_Artifact.js.html#line226">line 226</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>On success the promise will be resolved with {string[]} <b>metadataHashes</b>.<br> On error the promise will be rejected with <a href="global.html#Error">Error</a> <b>error</b>.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="external-Promise.html">external:Promise</a></span> </dd> </dl> <h4 class="name" id="addMetadataHash"><span class="type-signature"></span>addMetadataHash<span class="signature">(name, metadataHash, size<span class="signature-attributes">opt</span>, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="external-Promise.html">external:Promise</a>}</span></h4> <div class="description"> <p>Adds a hash to the artifact using the given file path.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type"><a href="global.html#string">string</a></span> </td> <td class="attributes"> </td> <td class="description last"><p>Path to the file in the artifact. Note: 'a/b/c.txt'</p></td> </tr> <tr> <td class="name"><code>metadataHash</code></td> <td class="type"> <span class="param-type"><a href="global.html#string">string</a></span> </td> <td class="attributes"> </td> <td class="description last"><p>Metadata hash that has to be added.</p></td> </tr> <tr> <td class="name"><code>size</code></td> <td class="type"> <span class="param-type"><a href="global.html#number">number</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Size of the referenced blob.</p></td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="global.html#function">function</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>if provided no promise will be returned.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="common_blob_Artifact.js.html">common/blob/Artifact.js</a>, <a href="common_blob_Artifact.js.html#line160">line 160</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>On success the promise will be resolved with {string} <b>hash</b>.<br> On error the promise will be rejected with <a href="global.html#Error">Error</a> <b>error</b>.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="external-Promise.html">external:Promise</a></span> </dd> </dl> <h4 class="name" id="addMetadataHashes"><span class="type-signature"></span>addMetadataHashes<span class="signature">(metadataHashes, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="external-Promise.html">external:Promise</a>}</span></h4> <div class="description"> <p>Adds hashes to the artifact using the given file paths.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>metadataHashes</code></td> <td class="type"> <span class="param-type"><a href="global.html#object">object</a>.&lt;<a href="global.html#string">string</a>, <a href="global.html#string">string</a>></span> </td> <td class="attributes"> </td> <td class="description last"><p>Keys are file paths and values metadata hashes.</p></td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="global.html#function">function</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>if provided no promise will be returned.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="common_blob_Artifact.js.html">common/blob/Artifact.js</a>, <a href="common_blob_Artifact.js.html#line260">line 260</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>On success the promise will be resolved with {string[]} <b>hashes</b>.<br> On error the promise will be rejected with <a href="global.html#Error">Error</a> <b>error</b>.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="external-Promise.html">external:Promise</a></span> </dd> </dl> <h4 class="name" id="addObjectHash"><span class="type-signature"></span>addObjectHash<span class="signature">(name, metadataHash, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="external-Promise.html">external:Promise</a>}</span></h4> <div class="description"> <p>Adds a hash to the artifact using the given file path.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type"><a href="global.html#string">string</a></span> </td> <td class="attributes"> </td> <td class="description last"><p>Path to the file in the artifact. Note: 'a/b/c.txt'</p></td> </tr> <tr> <td class="name"><code>metadataHash</code></td> <td class="type"> <span class="param-type"><a href="global.html#string">string</a></span> </td> <td class="attributes"> </td> <td class="description last"><p>Metadata hash that has to be added.</p></td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="global.html#function">function</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>if provided no promise will be returned.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="common_blob_Artifact.js.html">common/blob/Artifact.js</a>, <a href="common_blob_Artifact.js.html#line118">line 118</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>On success the promise will be resolved with {string} <b>hash</b>.<br> On error the promise will be rejected with <a href="global.html#Error">Error</a> <b>error</b>.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="external-Promise.html">external:Promise</a></span> </dd> </dl> <h4 class="name" id="addObjectHashes"><span class="type-signature"></span>addObjectHashes<span class="signature">(metadataHashes, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="external-Promise.html">external:Promise</a>}</span></h4> <div class="description"> <p>Adds hashes to the artifact using the given file paths.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>metadataHashes</code></td> <td class="type"> <span class="param-type"><a href="global.html#object">object</a>.&lt;<a href="global.html#string">string</a>, <a href="global.html#string">string</a>></span> </td> <td class="attributes"> </td> <td class="description last"><p>Keys are file paths and values metadata hashes.</p></td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="global.html#function">function</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>if provided no promise will be returned.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="common_blob_Artifact.js.html">common/blob/Artifact.js</a>, <a href="common_blob_Artifact.js.html#line243">line 243</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>On success the promise will be resolved with {string[]} <b>hashes</b>.<br> On error the promise will be rejected with <a href="global.html#Error">Error</a> <b>error</b>.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="external-Promise.html">external:Promise</a></span> </dd> </dl> <h4 class="name" id="save"><span class="type-signature"></span>save<span class="signature">(callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="external-Promise.html">external:Promise</a>}</span></h4> <div class="description"> <p>Saves this artifact and uploads the metadata to the server's storage.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="global.html#function">function</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>if provided no promise will be returned.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="common_blob_Artifact.js.html">common/blob/Artifact.js</a>, <a href="common_blob_Artifact.js.html#line276">line 276</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>On success the promise will be resolved with {string} <b>metadataHash</b>.<br> On error the promise will be rejected with <a href="global.html#Error">Error</a> <b>error</b>.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="external-Promise.html">external:Promise</a></span> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="Server_GMEAuth.html">Server:GMEAuth</a></li><li><a href="Server_SafeStorage.html">Server:SafeStorage</a></li><li><a href="Server_UserProject.html">Server:UserProject</a></li><li><a href="module-Core.html">Core</a></li><li><a href="module-Storage.html">Storage</a></li><li><a href="module-crosscuts.html">crosscuts</a></li><li><a href="module-serialization.html">serialization</a></li></ul><h3>Externals</h3><ul><li><a href="external-Promise.html">Promise</a></li></ul><h3>Classes</h3><ul><li><a href="AddOnBase.html">AddOnBase</a></li><li><a href="AddOnUpdateResult.html">AddOnUpdateResult</a></li><li><a href="Artifact.html">Artifact</a></li><li><a href="BlobClient.html">BlobClient</a></li><li><a href="BlobMetadata.html">BlobMetadata</a></li><li><a href="BlobRunPluginClient.html">BlobRunPluginClient</a></li><li><a href="Client.html">Client</a></li><li><a href="Core.html">Core</a></li><li><a href="ExecutorClient.html">ExecutorClient</a></li><li><a href="GMENode.html">GMENode</a></li><li><a href="GmeLogger.html">GmeLogger</a></li><li><a href="InterPluginResult.html">InterPluginResult</a></li><li><a href="JobInfo.html">JobInfo</a></li><li><a href="OutputInfo.html">OutputInfo</a></li><li><a href="PluginBase.html">PluginBase</a></li><li><a href="PluginConfig.html">PluginConfig</a></li><li><a href="PluginMessage.html">PluginMessage</a></li><li><a href="PluginNodeDescription.html">PluginNodeDescription</a></li><li><a href="PluginResult.html">PluginResult</a></li><li><a href="Project.html">Project</a></li><li><a href="ProjectInterface.html">ProjectInterface</a></li><li><a href="Server_GMEAuth-GMEAuth.html">GMEAuth</a></li><li><a href="Server_SafeStorage-SafeStorage.html">SafeStorage</a></li><li><a href="Server_UserProject-UserProject.html">UserProject</a></li><li><a href="WebsocketRouter.html">WebsocketRouter</a></li><li><a href="WebsocketRouterUser.html">WebsocketRouterUser</a></li></ul><h3>Events</h3><ul><li><a href="Client.html#event:BRANCH_CHANGED">BRANCH_CHANGED</a></li><li><a href="Client.html#event:BRANCH_CLOSED">BRANCH_CLOSED</a></li><li><a href="Client.html#event:BRANCH_OPENED">BRANCH_OPENED</a></li><li><a href="Client.html#event:BRANCH_STATUS_CHANGED">BRANCH_STATUS_CHANGED</a></li><li><a href="Client.html#event:CONNECTED_USERS_CHANGED">CONNECTED_USERS_CHANGED</a></li><li><a href="Client.html#event:NETWORK_STATUS_CHANGED">NETWORK_STATUS_CHANGED</a></li><li><a href="Client.html#event:NOTIFICATION">NOTIFICATION</a></li><li><a href="Client.html#event:PLUGIN_FINISHED">PLUGIN_FINISHED</a></li><li><a href="Client.html#event:PLUGIN_INITIATED">PLUGIN_INITIATED</a></li><li><a href="Client.html#event:PLUGIN_NOTIFICATION">PLUGIN_NOTIFICATION</a></li><li><a href="Client.html#event:PROJECT_CLOSED">PROJECT_CLOSED</a></li><li><a href="Client.html#event:PROJECT_OPENED">PROJECT_OPENED</a></li></ul><h3><a href="global.html">Global</a></h3> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Fri Jun 21 2024 09:43:40 GMT-0400 (Eastern Daylight Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>