UNPKG

jive-sdk

Version:

Node.js SDK for Jive Software to assist with the development of add-ons

2,068 lines (712 loc) 27.8 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Jive SDK Module: service</title> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css"> <link type="text/css" rel="stylesheet" href="styles/site.spacelab.css"> </head> <body> <div class="container-fluid"> <div class="navbar navbar-fixed-top navbar-inverse"> <div class="navbar-inner"> <a class="brand" href="index.html">Jive SDK</a> <ul class="nav"> <li class="dropdown"> <a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b class="caret"></b></a> <ul class="dropdown-menu "> <li> <a href="module-abstractDefinitions.html">abstractDefinitions</a> </li> <li> <a href="module-abstractInstances.html">abstractInstances</a> </li> <li> <a href="module-addOnRoutes.html">addOnRoutes</a> </li> <li> <a href="module-api.html">api</a> </li> <li> <a href="module-community.html">community</a> </li> <li> <a href="module-constants.html">constants</a> </li> <li> <a href="module-devRoutes.html">devRoutes</a> </li> <li> <a href="module-events.html">events</a> </li> <li> <a href="module-extensions.html">extensions</a> </li> <li> <a href="module-extstreamsInstances.html">extstreamsInstances</a> </li> <li> <a href="module-jiveutil.html">jiveutil</a> </li> <li> <a href="module-oauthRoutes.html">oauthRoutes</a> </li> <li> <a href="module-request.html">request</a> </li> <li> <a href="module-security.html">security</a> </li> <li> <a href="module-service.html">service</a> </li> <li> <a href="module-tasks.html">tasks</a> </li> <li> <a href="module-tileInstances.html">tileInstances</a> </li> <li> <a href="module-tileRoutes.html">tileRoutes</a> </li> <li> <a href="module-tilesDefinitions.html">tilesDefinitions</a> </li> <li> <a href="module-webhooks.html">webhooks</a> </li> </ul> </li> <li class="dropdown"> <a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a> <ul class="dropdown-menu "> <li> <a href="extstreamsDefinitions.html">extstreamsDefinitions</a> </li> <li> <a href="filePersistence.html">filePersistence</a> </li> <li> <a href="memoryPersistence.html">memoryPersistence</a> </li> <li> <a href="memoryScheduler.html">memoryScheduler</a> </li> <li> <a href="oauthHandler.html">oauthHandler</a> </li> </ul> </li> </ul> </div> </div> <div class="row-fluid"> <div class="span8"> <div id="main"> <h1 class="page-title">Module: service</h1> <section> <header> <h2> service </h2> </header> <article> <div class="container-overview"> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="service.js.html">jive-sdk-service/lib/service.js</a>, <a href="service.js.html#sunlight-1-line-17">line 17</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Members</h3> <dl> <dt> <h4 class="name" id="community"><span class="type-signature">&lt;static> </span>community<span class="type-signature"> :<a href="module-community.html">module:community</a></span></h4> </dt> <dd> <h5>Type:</h5> <ul> <li> <span class="param-type"><a href="module-community.html">module:community</a></span> </li> </ul> <dl class="details"> <dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li>This is just a symlink to jive.community (use that instead). To be removed in next major version.</li><ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="service.js.html">jive-sdk-service/lib/service.js</a>, <a href="service.js.html#sunlight-1-line-69">line 69</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="options"><span class="type-signature">&lt;static> </span>options<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Service configuration options.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="service.js.html">jive-sdk-service/lib/service.js</a>, <a href="service.js.html#sunlight-1-line-62">line 62</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="role"><span class="type-signature">&lt;static> </span>role<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Interrogate the role of this node</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="service.js.html">jive-sdk-service/lib/service.js</a>, <a href="service.js.html#sunlight-1-line-563">line 563</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="routes"><span class="type-signature">&lt;static> </span>routes<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Public service routes</p> </div> <dl class="details"> <h5 class="subsection-title">Properties:</h5> <dl> <table class="props table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>tiles</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>jive</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>dev</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>oauth</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"></td> </tr> </tbody> </table> </dl> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="service.js.html">jive-sdk-service/lib/service.js</a>, <a href="service.js.html#sunlight-1-line-553">line 553</a> </li></ul></dd> </dl> </dd> </dl> <h3 class="subsection-title">Methods</h3> <dl> <dt> <h4 class="name" id="autowire"><span class="type-signature">&lt;static> </span>autowire<span class="signature">(options)</span><span class="type-signature"> &rarr; {Promise}</span></h4> </dt> <dd> <div class="description"> <p>Autowires the entire service. Service autowiring will setup:</p> <ul> <li>Public web assets such as html, javascript, and images available from the /public directory</li> <li>Public endpoints ('routes') shared by all components</li> <li>Public endpoints ('routes') for each service subcomponent</li> <li>Event listeners</li> <li>Recurrent tasks</li> <li>Execute serivce component bootstrap code</li> </ul> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Autowiring options. If not present, all service components (tiles, apps, services, storage frameworks, etc.) will be autowired.</p> <h6>Properties</h6> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>componentsToWire</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>Polymorphic, optional field. If present and value is 'all', then all service components will be autowired. Otherwise, if present and value is list of one or more of <b>tiles</b>, <b>apps</b>, <b>services</b>, and <b>storages</b>, the specified components are autowired.</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="service.js.html">jive-sdk-service/lib/service.js</a>, <a href="service.js.html#sunlight-1-line-460">line 460</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Promise</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> </dd> <dt> <h4 class="name" id="extensions"><span class="type-signature">&lt;static> </span>extensions<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="module-extensions.html">module:extensions</a>}</span></h4> </dt> <dd> <div class="description"> <p>API for managing add-on extensions.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="service.js.html">jive-sdk-service/lib/service.js</a>, <a href="service.js.html#sunlight-1-line-579">line 579</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="module-extensions.html">module:extensions</a></span> </dd> </dl> </dd> <dt> <h4 class="name" id="init"><span class="type-signature">&lt;static> </span>init<span class="signature">(expressApp, options)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Initializes the service based on the passed-in express app, and any configuration options. If an express app isn't provided, one is created.</p> <ul> <li>Applies globally applicable middleware to the express app</li> <li>Configures service role based on options</li> <li>Sets up service logging based on options</li> <li>Sets up service persistence based on options</li> <li>Sets up service scheduler based on options</li> </ul> <p>Environment variable overrides:</p> <ul> <li>jive_sdk_service_role: optional, one of http, worker, pusher.</li> <li>jive_sdk_config_file: optional, if set, JSON options will be loaded from this path.</li> </ul> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>expressApp</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>JSON, or path to the options file.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="service.js.html">jive-sdk-service/lib/service.js</a>, <a href="service.js.html#sunlight-1-line-217">line 217</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="isDevelopment"><span class="type-signature">&lt;static> </span>isDevelopment<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4> </dt> <dd> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="service.js.html">jive-sdk-service/lib/service.js</a>, <a href="service.js.html#sunlight-1-line-676">line 676</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns true if service configuration options has 'development' : true set.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">boolean</span> </dd> </dl> </dd> <dt> <h4 class="name" id="persistence"><span class="type-signature">&lt;static> </span>persistence<span class="signature">(persistenceStrategy)</span><span class="type-signature"> &rarr; {Object}</span></h4> </dt> <dd> <div class="description"> <p>Retrieves or sets current persistence strategy, defaults to file.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>persistenceStrategy</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>If set, the service will be configured to use the provided strategy.</p> <h6>Properties</h6> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>find</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>findByID</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>remove</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>save</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="service.js.html">jive-sdk-service/lib/service.js</a>, <a href="service.js.html#sunlight-1-line-81">line 81</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> </dd> <dt> <h4 class="name" id="scheduler"><span class="type-signature">&lt;static> </span>scheduler<span class="signature">(schedulerStrategy)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Retrieves or sets the scheduling strategy. Defaults to memory (single node). todo</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>schedulerStrategy</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>If set, the service will be configured to use the provided strategy.</p> <h6>Properties</h6> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>schedule</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>unschedule</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>getTasks</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="service.js.html">jive-sdk-service/lib/service.js</a>, <a href="service.js.html#sunlight-1-line-182">line 182</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="security"><span class="type-signature">&lt;static> </span>security<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="module-security.html">module:security</a>}</span></h4> </dt> <dd> <div class="description"> <p>API for managing service security</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="service.js.html">jive-sdk-service/lib/service.js</a>, <a href="service.js.html#sunlight-1-line-669">line 669</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="module-security.html">module:security</a></span> </dd> </dl> </dd> <dt> <h4 class="name" id="serviceStatus"><span class="type-signature">&lt;static> </span>serviceStatus<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4> </dt> <dd> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="service.js.html">jive-sdk-service/lib/service.js</a>, <a href="service.js.html#sunlight-1-line-683">line 683</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> </dd> <dt> <h4 class="name" id="serviceURL"><span class="type-signature">&lt;static> </span>serviceURL<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Computes the full service URL for this service, taking into account jiveclientconfiguration.json (clientUrl &amp; port)</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="service.js.html">jive-sdk-service/lib/service.js</a>, <a href="service.js.html#sunlight-1-line-528">line 528</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="start"><span class="type-signature">&lt;static> </span>start<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4> </dt> <dd> <div class="description"> <p>Return promise - fail or succeed</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="service.js.html">jive-sdk-service/lib/service.js</a>, <a href="service.js.html#sunlight-1-line-502">line 502</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>promise</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> </dd> <dt> <h4 class="name" id="stop"><span class="type-signature">&lt;static> </span>stop<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4> </dt> <dd> <div class="description"> <p>Halt the service.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="service.js.html">jive-sdk-service/lib/service.js</a>, <a href="service.js.html#sunlight-1-line-517">line 517</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>promise</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> </dd> </dl> </article> </section> </div> <div class="clearfix"></div> <footer> <span class="copyright"> Jive Software, Inc </span> <br /> <span class="jsdoc-message"> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a> on Wed Jan 22 2014 12:29:39 GMT-0800 (PST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>. </span> </footer> </div> <div class="span3"> <div id="toc"></div> </div> <br clear="both"> </div> </div> <script src="scripts/sunlight.js"></script> <script src="scripts/sunlight.javascript.js"></script> <script src="scripts/sunlight-plugin.doclinks.js"></script> <script src="scripts/sunlight-plugin.linenumbers.js"></script> <script src="scripts/sunlight-plugin.menu.js"></script> <script src="scripts/jquery.min.js"></script> <script src="scripts/jquery.scrollTo.js"></script> <script src="scripts/jquery.localScroll.js"></script> <script src="scripts/bootstrap-dropdown.js"></script> <script src="scripts/toc.js"></script> <script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script> <script> $( function () { $( "#toc" ).toc( { selectors : "h1,h2,h3,h4", showAndHide : false, scrollTo : 60 } ); $( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" ); $( "#main span[id^='toc']" ).addClass( "toc-shim" ); } ); </script> </body> </html>