-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
15 lines (15 loc) · 9.32 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>@medic/cht-datasource</title><meta name="description" content="Documentation for @medic/cht-datasource"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script defer src="assets/main.js"></script><script async src="assets/icons.js" id="tsd-icons-script"></script><script async src="assets/search.js" id="tsd-search-script"></script><script async src="assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></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">@medic/cht-datasource</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><h2>@medic/cht-datasource</h2></div><div class="tsd-panel tsd-typography"><a id="md:cht-datasource" class="tsd-anchor"></a><h1 class="tsd-anchor-link">CHT Datasource<a href="#md:cht-datasource" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1><p>The CHT Datasource library is intended to be agnostic and simple. It provides a versioned API from feature modules.</p>
<p>See the TSDoc in <a href="modules.html">the code</a> for more information about using the API.</p>
<a id="md:development" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Development<a href="#md:development" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Functionality in cht-datasource is provided via two implementations. The <a href="./src/local"><code>local</code> adapter</a> leverages the provided PouchDB instances for data interaction. This is intended for usage in cases where offline functionality is required (like webapp for offline users) or direct access to the Couch database is guaranteed (like api and sentinel). The <a href="./src/remote"><code>remote</code> adapter</a> functions by proxying requests directly to the api server via HTTP. This is intended for usage in cases where connectivity to the api server is guaranteed (like in admin or webapp for online users).</p>
<a id="md:building-cht-datasource" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Building cht-datasource<a href="#md:building-cht-datasource" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><p>The transpiled JavaScript code is generated in the <a href="./dist"><code>dist</code> directory</a>. The library is automatically built when running <code>npm ci</code> (either within the <code>cht-datasource</code> directory or from the root level). To manually build the library, run <code>npm run build</code>. To automatically re-build the library when any of the source files change, run <code>npm run build-watch</code>.</p>
<p>The root level <code>build-dev-watch</code>, <code>dev-api</code>, and <code>dev-sentinel</code> scripts will automatically watch for changes in the cht-datasource code and rebuild the library.</p>
<a id="md:adding-a-new-api" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Adding a new API<a href="#md:adding-a-new-api" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><p>When adding a new API to cht-datasource (whether it is a new concept or just a new interaction with an existing concept), the implementation must be completed at four levels:</p>
<ol>
<li>Implement the interaction in the <a href="./src/local"><code>local</code></a> and <a href="./src/remote"><code>remote</code></a> adapters.</li>
<li>Expose a unified interface for the interaction from the relevant top-level <a href="./src">concept module</a>.</li>
<li>Expose the new concept interaction by adding it to the datasource returned from the <a href="modules.html">index.ts</a>.</li>
<li>Implement the necessary endpoint(s) in <a href="../../api">api</a> to support the new interaction (these are the endpoints called by the remote adapter code).</li>
</ol>
<a id="md:updating-functionality" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Updating functionality<a href="#md:updating-functionality" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Only passive changes should be made to the versioned public API's exposed by cht-datasource. Besides their usage in cht-core, these API's are available to custom configuration code for things like purging, tasks, targets, etc. If a non-passive change is needed, it should be made on a new version of the API.</p>
<p>The previous version of the functionality should be marked as <code>@deprecated</code> and, where possible, all usages in the cht-core code should be updated to use the new API.</p>
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#md:cht-datasource"><span>CHT <wbr/>Datasource</span></a><ul><li><a href="#md:development"><span>Development</span></a></li><li><ul><li><a href="#md:building-cht-datasource"><span>Building cht-<wbr/>datasource</span></a></li><li><a href="#md:adding-a-new-api"><span>Adding a new API</span></a></li><li><a href="#md:updating-functionality"><span>Updating functionality</span></a></li></ul></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-1"></use></svg><span>@medic/cht-datasource</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base="."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>