UNPKG

triplecheck-core

Version:

Core contracts and utilities for TripleCheck.

138 lines 7.86 kB
<!doctype html> <html class="default no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>triplecheck-core</title> <meta name="description" content="Documentation for triplecheck-core"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="assets/css/main.css"> <script async src="assets/js/search.js" id="search-script"></script> </head> <body> <header> <div class="tsd-page-toolbar"> <div class="container"> <div class="table-wrap"> <div class="table-cell" id="tsd-search" data-index="assets/js/search.json" data-base="."> <div class="field"> <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label> <input id="tsd-search-field" type="text" /> </div> <ul class="results"> <li class="state loading">Preparing search index...</li> <li class="state failure">The search index is not available</li> </ul> <a href="index.html" class="title">triplecheck-core</a> </div> <div class="table-cell" id="tsd-widgets"> <div id="tsd-filter"> <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a> <div class="tsd-filter-group"> <div class="tsd-select" id="tsd-filter-visibility"> <span class="tsd-select-label">All</span> <ul class="tsd-select-list"> <li data-value="public">Public</li> <li data-value="protected">Public/Protected</li> <li data-value="private" class="selected">All</li> </ul> </div> <input type="checkbox" id="tsd-filter-inherited" checked /> <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label> <input type="checkbox" id="tsd-filter-externals" checked /> <label class="tsd-widget" for="tsd-filter-externals">Externals</label> </div> </div> <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a> </div> </div> </div> </div> <div class="tsd-page-title"> <div class="container"> <h1>triplecheck-core</h1> </div> </div> </header> <div class="container container-main"> <div class="row"> <div class="col-8 col-content"> <div class="tsd-panel tsd-typography"> <a href="#triplecheck-core" id="triplecheck-core" style="color: inherit; text-decoration: none;"> <h1>triplecheck-core</h1> </a> <p><img src="readme/triplecheck-core.png" alt="TripleCheck Core"></p> <a href="#triplecheck-core-contracts-and-utilities" id="triplecheck-core-contracts-and-utilities" style="color: inherit; text-decoration: none;"> <h2>TripleCheck: Core contracts and utilities</h2> </a> <p><em>If you are just a regular user of TripleCheck (CLI and/or broker) you won&#39;t need to think about this package at all.</em></p> <p>This repo contains core functionality that is shared across <code>triplecheck</code> projects, such as the base <a href="https://hannesdorfmann.com/android/evolution-of-the-repository-pattern/">repository contract</a> to be used by any concrete implementations that handle database actions for TripleCheck. To use a vendor-specific solution there needs to be a compatible Repository built for it. <a href="https://github.com/mikaelvesavuori?tab=repositories&amp;q=triplecheck-repository&amp;type=&amp;language=&amp;sort=">Check this list for currently available repositories written by myself</a>.</p> <p>TripleCheck and its repositories are written in Typescript.</p> <a href="#installation" id="installation" style="color: inherit; text-decoration: none;"> <h2>Installation</h2> </a> <p>Install as a dependency with <code>npm install triplecheck-core</code> or <code>yarn install triplecheck-core</code>.</p> <a href="#documentation" id="documentation" style="color: inherit; text-decoration: none;"> <h2>Documentation</h2> </a> <p>See the generated documentation under <code>/docs</code>.</p> <a href="#the-repository-class" id="the-repository-class" style="color: inherit; text-decoration: none;"> <h2>The Repository class</h2> </a> <p>You should <code>implement</code> the Repository class for your concrete implementation.</p> <pre><code class="language-TypeScript"><span style="color: #AF00DB">export</span><span style="color: #000000"> </span><span style="color: #0000FF">abstract</span><span style="color: #000000"> </span><span style="color: #0000FF">class</span><span style="color: #000000"> </span><span style="color: #267F99">Repository</span><span style="color: #000000"> {</span> <span style="color: #000000"> </span><span style="color: #0000FF">abstract</span><span style="color: #000000"> </span><span style="color: #795E26">getData</span><span style="color: #000000">(</span><span style="color: #001080">key</span><span style="color: #000000">: </span><span style="color: #267F99">string</span><span style="color: #000000">): </span><span style="color: #267F99">Promise</span><span style="color: #000000">&lt;</span><span style="color: #267F99">any</span><span style="color: #000000">&gt;;</span> <span style="color: #000000"> </span><span style="color: #0000FF">abstract</span><span style="color: #000000"> </span><span style="color: #795E26">updateData</span><span style="color: #000000">(</span><span style="color: #001080">key</span><span style="color: #000000">: </span><span style="color: #267F99">string</span><span style="color: #000000">, </span><span style="color: #001080">data</span><span style="color: #000000">: </span><span style="color: #267F99">any</span><span style="color: #000000">): </span><span style="color: #267F99">Promise</span><span style="color: #000000">&lt;</span><span style="color: #267F99">void</span><span style="color: #000000">&gt;;</span> <span style="color: #000000"> </span><span style="color: #0000FF">abstract</span><span style="color: #000000"> </span><span style="color: #795E26">deleteData</span><span style="color: #000000">(</span><span style="color: #001080">key</span><span style="color: #000000">: </span><span style="color: #267F99">string</span><span style="color: #000000">): </span><span style="color: #267F99">Promise</span><span style="color: #000000">&lt;</span><span style="color: #267F99">void</span><span style="color: #000000">&gt;;</span> <span style="color: #000000">}</span> </code></pre> </div> </div> <div class="col-4 col-menu menu-sticky-wrap menu-highlight"> <nav class="tsd-navigation primary"> <ul> <li class=" "> <a href="modules.html">Exports</a> </li> <li class=" tsd-kind-module"> <a href="modules/contracts_list.html">contracts/<wbr>List</a> </li> <li class=" tsd-kind-module"> <a href="modules/contracts_repository.html">contracts/<wbr>Repository</a> </li> <li class=" tsd-kind-module"> <a href="modules/frameworks_filterdata.html">frameworks/filter<wbr>Data</a> </li> <li class=" tsd-kind-module"> <a href="modules/index.html">index</a> </li> </ul> </nav> <nav class="tsd-navigation secondary menu-sticky"> <ul class="before-current"> </ul> </nav> </div> </div> </div> <footer class="with-border-bottom"> <div class="container"> <h2>Legend</h2> <div class="tsd-legend-group"> <ul class="tsd-legend"> <li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li> <li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li> </ul> </div> </div> </footer> <div class="container tsd-generator"> <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p> </div> <div class="overlay"></div> <script src="assets/js/main.js"></script> </body> </html>