Compare commits

...

92 Commits

Author SHA1 Message Date
zadam
ed5eb5c6db fix dockerfile APK python dependency 2021-11-14 11:35:10 +01:00
zadam
acb50f44a1 release 0.48.6 2021-11-13 22:49:58 +01:00
zadam
c946030106 slowndown note map for small note counts to mitigate drift 2021-11-13 22:48:30 +01:00
zadam
df0411197b fixed syncing of erased notes, closes #2316 2021-11-12 21:19:23 +01:00
zadam
600c16551a fixed jsdoc script API generation, closes #2313 2021-11-10 21:30:54 +01:00
zadam
5710c9e997 extra init check to provide better error response 2021-11-10 21:12:53 +01:00
Myzel394
550a9fa711 fixed button background (#2310)
* fixed button background

* fixed width
2021-11-09 21:26:38 +01:00
zadam
51348cfbad don't show hidden subtree in autocomplete, fixes #2301 2021-11-04 22:27:39 +01:00
zadam
7400a6723e fix ribbon tab not appearing 2021-11-04 22:21:49 +01:00
zadam
e57dee2f14 pasted images should have trimmed names if too long (too often it's just garbage), closes #2307 2021-11-04 21:48:46 +01:00
zadam
b02a5b872a default font family after checking font overriding should be "theme" 2021-11-04 21:23:16 +01:00
zadam
4733de23ba fix {isoDate} template variable in journal date naming, closes #2306 2021-11-04 19:56:45 +01:00
zadam
57b7f6199e utcDateStr => utcDateTimeStr 2021-11-04 19:52:00 +01:00
zadam
a9df0c485f link map contains also backward references and tree map contains parents as well, closes #2270 2021-11-01 21:11:16 +01:00
zadam
21dedff9bf release 0.48.5 2021-11-01 10:25:43 +01:00
zadam
6f60cf1a86 release 0.48.5 2021-11-01 09:19:28 +01:00
zadam
930d29d64a add hack to produce debian compatible XZ compressed deb packages, fixes #2272 2021-11-01 09:11:04 +01:00
zadam
c345e7031b fix hoisting note from empty detail screen 2021-11-01 08:50:01 +01:00
zadam
fc46398a3c close last tab should behave similarly to 0.47, fixes #2298 2021-11-01 08:37:59 +01:00
zadam
7e41226549 fix "XSS" in the new empty tab, closes #2145 2021-10-31 23:12:24 +01:00
zadam
b0c0ed8512 add configurable max content width with default value of 1200px. 2021-10-31 21:55:11 +01:00
zadam
5978447185 add back .isDeleted property to becca's note, branch and attribute entities for BC, fixes #2268 2021-10-31 21:03:26 +01:00
zadam
ec4d445f97 make sure we're not using electron before enabling mobile version 2021-10-31 20:25:54 +01:00
zadam
e378435fbe added "switch to mobile version" button to web edition, closes #1889 2021-10-31 16:56:23 +01:00
zadam
e4dca4750f fix overriding monospace font size, closes #2296 2021-10-31 16:48:21 +01:00
zadam
311b98ffcb fix immediately closed attribute detail after clicking e.g. "add label" 2021-10-30 15:36:50 +02:00
zadam
126f41ae5e fix broken autocomplete in attribute editor, closes #2295 2021-10-30 15:22:20 +02:00
zadam
4b1678c416 fix sizing of the attribute detail in inherited attribute list 2021-10-29 21:47:04 +02:00
zadam
da74272f13 jsdoc @param => @type 2021-10-29 21:37:12 +02:00
zadam
9ce224d4c5 fix correct number of related attributes 2021-10-29 21:36:57 +02:00
zadam
ce57a13002 fix infinite recursion, closes #2292 2021-10-29 21:36:23 +02:00
zadam
e42357f1f8 release 0.48.4 2021-10-28 22:28:52 +02:00
zadam
ab7d121290 disallow removing last tab because of frequent race conditions when done too quickly 2021-10-28 22:27:21 +02:00
zadam
5209583a73 new note is in decrypted state even if protected, fixes #2291 2021-10-28 22:02:18 +02:00
zadam
35fc4ba9a4 fix wrapping of code blocks in note revisions, #2216 2021-10-28 20:38:35 +02:00
zadam
7f9019322b after creation of inverse relation we need to clear the cache, otherwise inverse relations will be created infinitely, fixes #2269 2021-10-27 22:36:33 +02:00
zadam
8a455e83f0 fix creating inverse relations 2021-10-27 22:28:33 +02:00
zadam
79b8d91025 validate/clean inverse relation name in promoted attr definition 2021-10-27 22:13:54 +02:00
zadam
bcabe5786f fix ordering of note contexts, fixes #2283 2021-10-27 21:32:03 +02:00
Abitofevrything
a7d3dafcf1 Remove logging line (#2284) 2021-10-27 19:45:59 +02:00
zadam
e6af84df39 fix updating "lastAcceptedEntityId" - can't take last entityChange since they might be reordered based on update order, closes #2277 2021-10-26 22:07:35 +02:00
zadam
674172f0b8 fix not updating attribute if not needed 2021-10-26 20:57:45 +02:00
zadam
7ec20f9384 fix refreshing ribbon titles upon entity change, closes #2274 2021-10-26 20:14:56 +02:00
zadam
6135de8507 Merge remote-tracking branch 'origin/master' 2021-10-25 21:59:34 +02:00
zadam
63b0d30e74 fix note status update, closes #2276 2021-10-25 21:59:21 +02:00
MeIchthys
9e29fba8da Update "Sync from Desktop" setup instructions. (#2271) 2021-10-25 21:15:17 +02:00
zadam
8910ae92c7 increasing amount of text rendered in note previous to 2000 (previously 1000) bytes, #2266 2021-10-25 20:01:41 +02:00
zadam
3413074235 when saving Saved Search or SQL console, move it to their home (i.e. remove from hidden subtree) 2021-10-24 14:53:45 +02:00
zadam
33aa72eb97 fix finding note paths of hidden notes, fixes #2262 2021-10-24 14:37:41 +02:00
zadam
6e0a65b59c release 0.48.3 2021-10-22 21:31:44 +02:00
zadam
56e49cfc19 set iconClass also on whole page clipping #2250 2021-10-21 23:02:22 +02:00
zadam
af40d73cee fix saving images from web clipper, closes #2249 2021-10-21 22:58:52 +02:00
zadam
50b7063811 display properly relations in note map even if they are not in the subtree, closes #2251 2021-10-21 22:52:52 +02:00
zadam
ee1b377bc2 deactivate some buttons based on note type 2021-10-21 21:28:44 +02:00
zadam
51dfe8bb14 avoid double rendering of note paths 2021-10-21 21:10:55 +02:00
zadam
e426ee3e4f disallow changing note type of note-map 2021-10-21 21:02:37 +02:00
zadam
a434aa113d fix repeated invocation of actions in note actions dropdown, closes #2255 2021-10-21 20:53:35 +02:00
Sathyam M Vellal
3b551e3e4d Add week notes to frontend_script_api (#2253)
Note: getWeekNote can take `startOfTheWeek` as options but is not passed to the api route.
2021-10-21 12:16:51 +02:00
zadam
3d98644bf6 release 0.48.2 2021-10-20 22:12:20 +02:00
zadam
a22e4d60b6 Merge remote-tracking branch 'origin/master' 2021-10-20 21:30:39 +02:00
zadam
069fbee3a6 allow async scripts in runOnBackend(), fixes #2243 2021-10-20 21:27:47 +02:00
Matt
8b21867c5c Set default icon for clipped notes (#2246)
* Set default icon for clipped notes

I like being able to differentiate between clipped notes and regular notes

* Globe
2021-10-20 08:57:05 +02:00
zadam
2cc4367b37 fix restoring note revision, closes #2232 2021-10-15 21:37:16 +02:00
zadam
241d1b1035 node 14.18.1 2021-10-14 22:22:27 +02:00
zadam
449081807e fix backend API's getNote, getBranch, getAttribute, closes #2230 2021-10-14 21:19:03 +02:00
zadam
dc0d6d24bd Merge remote-tracking branch 'origin/master' 2021-10-14 21:09:32 +02:00
zadam
4111a2f0e8 docker image build/push is now handled by github actions 2021-10-14 20:49:48 +02:00
TrAnn3l
8ef4b2bf50 Add tag based multi arch docker build. (#2229) 2021-10-14 20:42:27 +02:00
zadam
53875d26bc don't try to activate the pane being currently removed 2021-10-13 23:27:58 +02:00
zadam
f505f9d65a hide tooltip after clicking on a button, fixes #2228 2021-10-13 23:05:47 +02:00
zadam
6434889cd6 added SVG icon 2021-10-13 19:54:26 +02:00
zadam
21d2ca3c54 release 0.48.1-beta 2021-10-12 22:42:48 +02:00
zadam
64a3a8b561 tweaks 2021-10-12 22:36:22 +02:00
zadam
6738f2cd24 fix preserving original sourceId after running script notes, fixes #2224 2021-10-12 21:41:25 +02:00
zadam
1cdd644b8f fix reloading frontend after erasing notes in firefox, fixes #2221 2021-10-12 19:47:44 +02:00
zadam
f5dc05e79a Merge remote-tracking branch 'origin/master' 2021-10-12 19:30:42 +02:00
zadam
e2c37a6f8c add toggleLeftPane command/shortcut, closes #2225 2021-10-12 19:29:42 +02:00
sigaloid
cfea2440fb fix mobile frontend, closes #2217 (#2223)
does this

rename

Update bug_report.yml

Update bug_report.yml

Update bug_report.yml

Update bug_report.yml

Update and rename feature_request.md to feature_request.yml

Co-authored-by: zadam <zadam.apps@gmail.com>
2021-10-12 18:57:07 +02:00
zadam
23e34e8c02 fix mobile frontend, closes #2217 2021-10-11 23:00:52 +02:00
zadam
8bd7b657f8 added option to disable backup, #2210 2021-10-11 22:30:23 +02:00
zadam
899d9e65fd Merge remote-tracking branch 'origin/master' 2021-10-11 21:08:48 +02:00
zadam
ec732c0a98 filter out duplicated note paths, fixes #2218 2021-10-11 21:08:25 +02:00
Tom Free
66797f34c4 upgrade node v14.17.6 for gitpod since optional chaining is required (#2219) 2021-10-11 20:54:01 +02:00
zadam
1ad25b063d change order of ribbon tabs so that type specific ones are in front 2021-10-10 21:47:56 +02:00
zadam
e09b2902fa fix large image deforming the note revisions dialog, closing #2216 2021-10-10 21:47:22 +02:00
zadam
f6776df645 link overflowing with ellipsis 2021-10-10 14:34:54 +02:00
zadam
f0c672445d show note icons also in bookmark folder 2021-10-10 14:10:51 +02:00
zadam
a033ddfcb7 Merge remote-tracking branch 'origin/master' 2021-10-10 14:09:42 +02:00
zadam
d02d846024 empty notes in note overview will display the list of children 2021-10-10 14:09:22 +02:00
sigaloid
a8b6538c4e Add issue templates (#2213)
* Create feature_request.md

* Create bug_report.md

* Update feature_request.md

* Update bug_report.md

* Update feature_request.md

* Update feature_request.md

* Update bug_report.md

* Update bug_report.md

* Update bug_report.md

* Update feature_request.md

* Update bug_report.md
2021-10-10 11:22:32 +02:00
zadam
4eb4a44331 fix reopening last tab for splits 2021-10-09 22:03:24 +02:00
Abitofevrything
c1e1f3df24 Add shortcut to reopen last closed tab, closes #2211 (#2214) 2021-10-09 21:20:12 +02:00
174 changed files with 7340 additions and 12023 deletions

63
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@@ -0,0 +1,63 @@
name: Bug Report
description: Report a bug
title: "(Bug report) "
labels: "Type: Bug"
body:
- type: checkboxes
attributes:
label: Preflight Checklist
description: Please ensure you've completed all of the following.
options:
- label: I have searched the [issue tracker](https://www.github.com/zadam/trilium/issues) for a bug report that matches the one I want to file, without success.
required: true
- type: input
attributes:
label: Trilium Version
description: What version of Trilium are you using?
placeholder: 0.48.0-beta
validations:
required: true
- type: dropdown
attributes:
label: What operating system are you using?
options:
- Windows
- macOS
- Ubuntu
- Other Linux
- Other (specify below)
validations:
required: true
- type: dropdown
attributes:
label: What is your setup?
description: https://github.com/zadam/trilium/wiki#choose-the-setup
options:
- Local (no sync)
- Local + server sync
- Server access only
validations:
required: true
- type: input
attributes:
label: Operating System Version
description: What operating system version are you using? On Windows, click Start button > Settings > System > About. On macOS, click the Apple Menu > About This Mac. On Linux, use lsb_release or uname -a.
placeholder: "e.g. Windows 10 version 1909, macOS Catalina 10.15.7, or Ubuntu 20.04"
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: A clear and concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: Actual Behavior
description: A clear description of what actually happens.
validations:
required: true
- type: textarea
attributes:
label: Additional Information
description: If your problem needs further explanation, or if the issue you're seeing cannot be reproduced in a gist, please add more information here.

View File

@@ -0,0 +1,22 @@
name: Feature Request
description: Report a bug
title: "(Feature request) "
labels: "Type: Enhancement"
body:
- type: checkboxes
attributes:
label: Preflight Checklist
description: Please ensure you've completed all of the following.
options:
- label: I have searched the [issue tracker](https://www.github.com/zadam/trilium/issues) for a feature request that matches the one I want to file, without success.
required: true
- type: textarea
attributes:
label: Describe feature
description: A clear and concise description of what you want to be added..
validations:
required: true
- type: textarea
attributes:
label: Additional Information
description: If your problem needs further explanation, or if the issue you're seeing cannot be reproduced in a gist, please add more information here.

53
.github/workflows/docker.yaml vendored Normal file
View File

@@ -0,0 +1,53 @@
name: Publish Docker image
on:
push:
tags: [v*]
jobs:
push_to_registries:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
zadam/trilium
ghcr.io/zadam/trilium
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}-latest
type=match,pattern=(\d+.\d+).\d+\-beta,enable=${{ endsWith(github.ref, 'beta') }},group=1,suffix=-latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
install: true
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create server-package.json
run: cat package.json | grep -v electron > server-package.json
- name: Build and Push
uses: docker/build-push-action@v2.7.0
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
push: true
cache-from: type=registry,ref=zadam/trilium:buildcache
cache-to: type=registry,ref=zadam/trilium:buildcache,mode=max
tags: ${{ steps.meta.outputs.tags }}

View File

@@ -2,10 +2,10 @@ image:
file: .gitpod.dockerfile file: .gitpod.dockerfile
tasks: tasks:
- before: nvm install 10 && nvm use 10 - before: nvm install 14.18.1 && nvm use 14.18.1
init: npm install init: npm install
command: npm run start-server command: npm run start-server
ports: ports:
- port: 8080 - port: 8080
onOpen: open-preview onOpen: open-preview

View File

@@ -1,4 +1,4 @@
FROM node:14.17.6-alpine FROM node:14.18.1-alpine
# Create app directory # Create app directory
WORKDIR /usr/src/app WORKDIR /usr/src/app
@@ -16,7 +16,7 @@ RUN set -x \
make \ make \
nasm \ nasm \
libpng-dev \ libpng-dev \
python \ python3 \
&& npm install --production \ && npm install --production \
&& apk del .build-dependencies && apk del .build-dependencies

View File

@@ -4,4 +4,19 @@ echo "Packaging debian x64 distribution..."
VERSION=`jq -r ".version" package.json` VERSION=`jq -r ".version" package.json`
./node_modules/.bin/electron-installer-debian --config bin/deb-options.json --options.version=${VERSION} --arch amd64 ./node_modules/.bin/electron-installer-debian --config bin/deb-options.json --options.version=${VERSION} --arch amd64
# hacky stop-gag measure to produce debian compatible XZ compressed debs until this is fixed: https://github.com/electron-userland/electron-installer-debian/issues/272
cd dist
ar x trilium_${VERSION}_amd64.deb
rm trilium_${VERSION}_amd64.deb
# recompress
< control.tar.zst zstd -d | xz > control.tar.xz
< data.tar.zst zstd -d | xz > data.tar.xz
# create deb archive (I really do not know, what argument "sdsd" is for but something is required for ar to create the archive as desired)
ar -m -c -a sdsd trilium_${VERSION}_amd64.deb debian-binary control.tar.xz data.tar.xz
rm control* data* debian-binary
echo "Converted to XZ deb"

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
PKG_DIR=dist/trilium-linux-x64-server PKG_DIR=dist/trilium-linux-x64-server
NODE_VERSION=14.17.6 NODE_VERSION=14.18.1
if [ "$1" != "DONTCOPY" ] if [ "$1" != "DONTCOPY" ]
then then

View File

@@ -5,7 +5,7 @@ if [[ $# -eq 0 ]] ; then
exit 1 exit 1
fi fi
n exec 14.17.6 npm run webpack n exec 14.18.1 npm run webpack
DIR=$1 DIR=$1
@@ -27,7 +27,7 @@ cp -r electron.js $DIR/
cp webpack-* $DIR/ cp webpack-* $DIR/
# run in subshell (so we return to original dir) # run in subshell (so we return to original dir)
(cd $DIR && n exec 14.17.6 npm install --only=prod) (cd $DIR && n exec 14.18.1 npm install --only=prod)
# cleanup of useless files in dependencies # cleanup of useless files in dependencies
rm -r $DIR/node_modules/image-q/demo rm -r $DIR/node_modules/image-q/demo

View File

@@ -69,13 +69,3 @@ gh release create "$TAG" \
"dist/$WINDOWS_X64_BUILD" \ "dist/$WINDOWS_X64_BUILD" \
"dist/$MAC_X64_BUILD" \ "dist/$MAC_X64_BUILD" \
"dist/$SERVER_BUILD" "dist/$SERVER_BUILD"
echo "Building docker image"
bin/build-docker.sh $VERSION
echo "Pushing docker image to dockerhub"
bin/push-docker-image.sh $VERSION
echo "Release finished!"

View File

@@ -139,6 +139,214 @@
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="apiTokenId"><span class="type-signature"></span>apiTokenId<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_api_token.js.html">becca/entities/api_token.js</a>, <a href="becca_entities_api_token.js.html#line18">line 18</a>
</li></ul></dd>
</dl>
<h4 class="name" id="token"><span class="type-signature"></span>token<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_api_token.js.html">becca/entities/api_token.js</a>, <a href="becca_entities_api_token.js.html#line20">line 20</a>
</li></ul></dd>
</dl>
<h4 class="name" id="utcDateCreated"><span class="type-signature"></span>utcDateCreated<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_api_token.js.html">becca/entities/api_token.js</a>, <a href="becca_entities_api_token.js.html#line22">line 22</a>
</li></ul></dd>
</dl>
@@ -155,7 +363,7 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -30,7 +30,8 @@
<h2><span class="attribs"><span class="type-signature"></span></span>Attribute<span class="signature">()</span><span class="type-signature"></span></h2> <h2><span class="attribs"><span class="type-signature"></span></span>Attribute<span class="signature">()</span><span class="type-signature"></span></h2>
<div class="class-description">Attribute is key value pair owned by a note.</div> <div class="class-description">Attribute is an abstract concept which has two real uses - label (key - value pair)
and relation (representing named relationship between source and target note)</div>
</header> </header>
@@ -64,268 +65,6 @@
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>attributeId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">immutable</td>
</tr>
<tr>
<td class="name"><code>noteId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">immutable</td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">immutable</td>
</tr>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">immutable</td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>position</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>isInheritable</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last">immutable</td>
</tr>
<tr>
<td class="name"><code>isDeleted</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>deleteId</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">null</span>
</td>
<td class="description last">ID identifying delete transaction</td>
</tr>
<tr>
<td class="name"><code>utcDateModified</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details"> <dl class="details">
@@ -355,7 +94,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line25">line 25</a> <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line13">line 13</a>
</li></ul></dd> </li></ul></dd>
@@ -389,16 +128,55 @@
</div> </div>
<h3 class="subsection-title">Extends</h3>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="attributeId"><span class="type-signature"></span>attributeId<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul> <ul>
<li><a href="Entity.html">Entity</a></li> <li>
<span class="param-type">string</span>
</li>
</ul> </ul>
<dl class="details">
@@ -411,6 +189,504 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line44">line 44</a>
</li></ul></dd>
</dl>
<h4 class="name" id="isInheritable"><span class="type-signature"></span>isInheritable<span class="type-signature"> :boolean</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">boolean</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line56">line 56</a>
</li></ul></dd>
</dl>
<h4 class="name" id="name"><span class="type-signature"></span>name<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line50">line 50</a>
</li></ul></dd>
</dl>
<h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line46">line 46</a>
</li></ul></dd>
</dl>
<h4 class="name" id="position"><span class="type-signature"></span>position<span class="type-signature"> :int</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">int</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line52">line 52</a>
</li></ul></dd>
</dl>
<h4 class="name" id="type"><span class="type-signature"></span>type<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line48">line 48</a>
</li></ul></dd>
</dl>
<h4 class="name" id="utcDateModified"><span class="type-signature"></span>utcDateModified<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line58">line 58</a>
</li></ul></dd>
</dl>
<h4 class="name" id="value"><span class="type-signature"></span>value<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line54">line 54</a>
</li></ul></dd>
</dl>
@@ -470,7 +746,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line43">line 43</a> <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line112">line 112</a>
</li></ul></dd> </li></ul></dd>
@@ -575,7 +851,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line50">line 50</a> <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line119">line 119</a>
</li></ul></dd> </li></ul></dd>
@@ -680,7 +956,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line65">line 65</a> <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line134">line 134</a>
</li></ul></dd> </li></ul></dd>
@@ -744,13 +1020,13 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a>
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@@ -5913,7 +5913,7 @@ exists, then we'll use that transaction.
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -30,8 +30,8 @@
<h2><span class="attribs"><span class="type-signature"></span></span>Branch<span class="signature">()</span><span class="type-signature"></span></h2> <h2><span class="attribs"><span class="type-signature"></span></span>Branch<span class="signature">()</span><span class="type-signature"></span></h2>
<div class="class-description">Branch represents note's placement in the tree - it's essentially pair of noteId and parentNoteId. <div class="class-description">Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple
Each note can have multiple (at least one) branches, meaning it can be placed into multiple places in the tree.</div> parents.</div>
</header> </header>
@@ -65,268 +65,6 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>branchId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">primary key, immutable</td>
</tr>
<tr>
<td class="name"><code>noteId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">immutable</td>
</tr>
<tr>
<td class="name"><code>parentNoteId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">immutable</td>
</tr>
<tr>
<td class="name"><code>notePosition</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>prefix</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>isExpanded</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>isDeleted</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>deleteId</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">null</span>
</td>
<td class="description last">ID identifying delete transaction</td>
</tr>
<tr>
<td class="name"><code>utcDateModified</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>utcDateCreated</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details"> <dl class="details">
@@ -356,7 +94,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line24">line 24</a> <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line12">line 12</a>
</li></ul></dd> </li></ul></dd>
@@ -390,16 +128,45 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
</div> </div>
<h3 class="subsection-title">Extends</h3>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="branchId"><span class="type-signature"></span>branchId<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul> <ul>
<li><a href="Entity.html">Entity</a></li> <li>
<span class="param-type">string</span>
</li>
</ul> </ul>
<dl class="details">
@@ -415,23 +182,37 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
<h3 class="subsection-title">Methods</h3>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line43">line 43</a>
</li></ul></dd>
</dl>
<h4 class="name" id="childNote"><span class="type-signature"></span>childNote<span class="type-signature"></span></h4>
<h4 class="name" id="getNote"><span class="type-signature"></span>getNote<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Note.html">Note</a>|null}</span></h4>
@@ -471,7 +252,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line31">line 31</a> <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line85">line 85</a>
</li></ul></dd> </li></ul></dd>
@@ -487,58 +268,215 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
<h5>Returns:</h5>
<h4 class="name" id="isExpanded"><span class="type-signature"></span>isExpanded<span class="type-signature"> :boolean</span></h4>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Note.html">Note</a></span>
|
<span class="param-type">null</span>
</dd>
</dl>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">boolean</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line53">line 53</a>
</li></ul></dd>
</dl>
<h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<h4 class="name" id="getParentNote"><span class="type-signature"></span>getParentNote<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Note.html">Note</a>|null}</span></h4>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line45">line 45</a>
</li></ul></dd>
</dl>
<h4 class="name" id="notePosition"><span class="type-signature"></span>notePosition<span class="type-signature"> :int</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">int</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line51">line 51</a>
</li></ul></dd>
</dl>
<h4 class="name" id="parentNote"><span class="type-signature"></span>parentNote<span class="type-signature"></span></h4>
@@ -576,7 +514,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line36">line 36</a> <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line99">line 99</a>
</li></ul></dd> </li></ul></dd>
@@ -592,42 +530,213 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
<h5>Returns:</h5>
<h4 class="name" id="parentNoteId"><span class="type-signature"></span>parentNoteId<span class="type-signature"> :string</span></h4>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Note.html">Note</a></span>
|
<span class="param-type">null</span>
</dd>
</dl>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line47">line 47</a>
</li></ul></dd>
</dl>
<h4 class="name" id="prefix"><span class="type-signature"></span>prefix<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line49">line 49</a>
</li></ul></dd>
</dl>
<h4 class="name" id="utcDateModified"><span class="type-signature"></span>utcDateModified<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line55">line 55</a>
</li></ul></dd>
</dl>
@@ -643,13 +752,13 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a>
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@@ -1,227 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Entity</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: Entity</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>Entity<span class="signature">(row<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="Entity"><span class="type-signature"></span>new Entity<span class="signature">(row<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<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>row</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">database row representing given entity</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_entity.js.html">entities/entity.js</a>, <a href="entities_entity.js.html#line10">line 10</a>
</li></ul></dd>
</dl>
</div>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</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 3.6.6</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -1,389 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Image</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: Image</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>Image<span class="signature">(imageId, format, checksum, name, data, isDeleted, dateModified, dateCreated)</span><span class="type-signature"></span></h2>
<div class="class-description">This class represents image data.</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="Image"><span class="type-signature"></span>new Image<span class="signature">(imageId, format, checksum, name, data, isDeleted, dateModified, dateCreated)</span><span class="type-signature"></span></h4>
<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>imageId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>format</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>checksum</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">blob</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>isDeleted</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>dateModified</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>dateCreated</code></td>
<td class="type">
<span class="param-type">string</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="entities_image.js.html">entities/image.js</a>, <a href="entities_image.js.html#line20">line 20</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li><a href="Entity.html">Entity</a></li>
</ul>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Image.html">Image</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteImage.html">NoteImage</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Oct 07 2018 16:26:59 GMT+0200 (CEST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -1,367 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Link</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: Link</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>Link<span class="signature">(linkId, noteId, targetNoteId, type, isDeleted, utcDateModified, utcDateCreated)</span><span class="type-signature"></span></h2>
<div class="class-description">This class represents link from one note to another in the form of hyperlink or image reference. Note that
this is different concept than attribute/relation.</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="Link"><span class="type-signature"></span>new Link<span class="signature">(linkId, noteId, targetNoteId, type, isDeleted, utcDateModified, utcDateCreated)</span><span class="type-signature"></span></h4>
<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>linkId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>noteId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>targetNoteId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>isDeleted</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>utcDateModified</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>utcDateCreated</code></td>
<td class="type">
<span class="param-type">string</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="entities_link.js.html">entities/link.js</a>, <a href="entities_link.js.html#line21">line 21</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li><a href="Entity.html">Entity</a></li>
</ul>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Link.html">Link</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -1,343 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: NoteImage</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: NoteImage</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>NoteImage<span class="signature">(noteImageId, noteId, imageId, isDeleted, dateModified, dateCreated)</span><span class="type-signature"></span></h2>
<div class="class-description">This class represents image's placement in the note(s). One image may be placed into several notes.</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="NoteImage"><span class="type-signature"></span>new NoteImage<span class="signature">(noteImageId, noteId, imageId, isDeleted, dateModified, dateCreated)</span><span class="type-signature"></span></h4>
<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>noteImageId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>noteId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>imageId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>isDeleted</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>dateModified</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>dateCreated</code></td>
<td class="type">
<span class="param-type">string</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="entities_note_image.js.html">entities/note_image.js</a>, <a href="entities_note_image.js.html#line19">line 19</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li><a href="Entity.html">Entity</a></li>
</ul>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Image.html">Image</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteImage.html">NoteImage</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Oct 07 2018 16:26:59 GMT+0200 (CEST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -30,7 +30,8 @@
<h2><span class="attribs"><span class="type-signature"></span></span>NoteRevision<span class="signature">()</span><span class="type-signature"></span></h2> <h2><span class="attribs"><span class="type-signature"></span></span>NoteRevision<span class="signature">()</span><span class="type-signature"></span></h2>
<div class="class-description">NoteRevision represents snapshot of note's title and content at some point in the past. It's used for seamless note versioning.</div> <div class="class-description">NoteRevision represents snapshot of note's title and content at some point in the past.
It's used for seamless note versioning.</div>
</header> </header>
@@ -93,7 +94,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line14">line 14</a> <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line15">line 15</a>
</li></ul></dd> </li></ul></dd>
@@ -143,13 +144,23 @@
<h4 class="name" id="contentLength"><span class="type-signature"></span>contentLength<span class="type-signature"></span></h4> <h4 class="name" id="contentLength"><span class="type-signature"></span>contentLength<span class="type-signature"> :number</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">number</span>
</li>
</ul>
@@ -183,7 +194,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line45">line 45</a> <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line46">line 46</a>
</li></ul></dd> </li></ul></dd>
@@ -201,13 +212,23 @@
<h4 class="name" id="dateCreated"><span class="type-signature"></span>dateCreated<span class="type-signature"></span></h4> <h4 class="name" id="dateCreated"><span class="type-signature"></span>dateCreated<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -241,7 +262,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line37">line 37</a> <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line38">line 38</a>
</li></ul></dd> </li></ul></dd>
@@ -259,13 +280,23 @@
<h4 class="name" id="dateLastEdited"><span class="type-signature"></span>dateLastEdited<span class="type-signature"></span></h4> <h4 class="name" id="dateLastEdited"><span class="type-signature"></span>dateLastEdited<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -299,7 +330,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line35">line 35</a> <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line36">line 36</a>
</li></ul></dd> </li></ul></dd>
@@ -317,13 +348,23 @@
<h4 class="name" id="isProtected"><span class="type-signature"></span>isProtected<span class="type-signature"></span></h4> <h4 class="name" id="isProtected"><span class="type-signature"></span>isProtected<span class="type-signature"> :boolean</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">boolean</span>
</li>
</ul>
@@ -357,7 +398,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line31">line 31</a> <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line32">line 32</a>
</li></ul></dd> </li></ul></dd>
@@ -375,13 +416,23 @@
<h4 class="name" id="mime"><span class="type-signature"></span>mime<span class="type-signature"></span></h4> <h4 class="name" id="mime"><span class="type-signature"></span>mime<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -415,7 +466,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line29">line 29</a> <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line30">line 30</a>
</li></ul></dd> </li></ul></dd>
@@ -433,13 +484,23 @@
<h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"></span></h4> <h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -473,7 +534,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line25">line 25</a> <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line26">line 26</a>
</li></ul></dd> </li></ul></dd>
@@ -491,13 +552,23 @@
<h4 class="name" id="noteRevisionId"><span class="type-signature"></span>noteRevisionId<span class="type-signature"></span></h4> <h4 class="name" id="noteRevisionId"><span class="type-signature"></span>noteRevisionId<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -531,7 +602,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line23">line 23</a> <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line24">line 24</a>
</li></ul></dd> </li></ul></dd>
@@ -549,13 +620,23 @@
<h4 class="name" id="title"><span class="type-signature"></span>title<span class="type-signature"></span></h4> <h4 class="name" id="title"><span class="type-signature"></span>title<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -589,7 +670,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line33">line 33</a> <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line34">line 34</a>
</li></ul></dd> </li></ul></dd>
@@ -607,13 +688,23 @@
<h4 class="name" id="type"><span class="type-signature"></span>type<span class="type-signature"></span></h4> <h4 class="name" id="type"><span class="type-signature"></span>type<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -647,7 +738,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line27">line 27</a> <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line28">line 28</a>
</li></ul></dd> </li></ul></dd>
@@ -665,13 +756,23 @@
<h4 class="name" id="utcDateCreated"><span class="type-signature"></span>utcDateCreated<span class="type-signature"></span></h4> <h4 class="name" id="utcDateCreated"><span class="type-signature"></span>utcDateCreated<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -705,7 +806,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line41">line 41</a> <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line42">line 42</a>
</li></ul></dd> </li></ul></dd>
@@ -723,13 +824,23 @@
<h4 class="name" id="utcDateLastEdited"><span class="type-signature"></span>utcDateLastEdited<span class="type-signature"></span></h4> <h4 class="name" id="utcDateLastEdited"><span class="type-signature"></span>utcDateLastEdited<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -763,7 +874,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line39">line 39</a> <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line40">line 40</a>
</li></ul></dd> </li></ul></dd>
@@ -781,13 +892,23 @@
<h4 class="name" id="utcDateModified"><span class="type-signature"></span>utcDateModified<span class="type-signature"></span></h4> <h4 class="name" id="utcDateModified"><span class="type-signature"></span>utcDateModified<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -821,7 +942,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line43">line 43</a> <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line44">line 44</a>
</li></ul></dd> </li></ul></dd>
@@ -897,7 +1018,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line76">line 76</a> <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line77">line 77</a>
</li></ul></dd> </li></ul></dd>
@@ -999,7 +1120,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line140">line 140</a> <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line141">line 141</a>
</li></ul></dd> </li></ul></dd>
@@ -1101,7 +1222,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line62">line 62</a> <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line63">line 63</a>
</li></ul></dd> </li></ul></dd>
@@ -1169,7 +1290,7 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -139,6 +139,282 @@
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="isSynced"><span class="type-signature"></span>isSynced<span class="type-signature"> :boolean</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">boolean</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line22">line 22</a>
</li></ul></dd>
</dl>
<h4 class="name" id="name"><span class="type-signature"></span>name<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line18">line 18</a>
</li></ul></dd>
</dl>
<h4 class="name" id="utcDateModified"><span class="type-signature"></span>utcDateModified<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line24">line 24</a>
</li></ul></dd>
</dl>
<h4 class="name" id="value"><span class="type-signature"></span>value<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line20">line 20</a>
</li></ul></dd>
</dl>
@@ -155,7 +431,7 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -139,6 +139,214 @@
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_recent_note.js.html">becca/entities/recent_note.js</a>, <a href="becca_entities_recent_note.js.html#line17">line 17</a>
</li></ul></dd>
</dl>
<h4 class="name" id="notePath"><span class="type-signature"></span>notePath<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_recent_note.js.html">becca/entities/recent_note.js</a>, <a href="becca_entities_recent_note.js.html#line19">line 19</a>
</li></ul></dd>
</dl>
<h4 class="name" id="utcDateCreated"><span class="type-signature"></span>utcDateCreated<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_recent_note.js.html">becca/entities/recent_note.js</a>, <a href="becca_entities_recent_note.js.html#line21">line 21</a>
</li></ul></dd>
</dl>
@@ -155,7 +363,7 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -1,472 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: backend_script_api.js</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">Source: backend_script_api.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>const log = require('./log');
const noteService = require('./notes');
const sql = require('./sql');
const utils = require('./utils');
const attributeService = require('./attributes');
const dateNoteService = require('./date_notes');
const treeService = require('./tree');
const config = require('./config');
const axios = require('axios');
const dayjs = require('dayjs');
const xml2js = require('xml2js');
const cloningService = require('./cloning');
const appInfo = require('./app_info');
const searchService = require('./search/services/search');
const SearchContext = require("./search/search_context");
const becca = require("../becca/becca");
/**
* This is the main backend API interface for scripts. It's published in the local "api" object.
*
* @constructor
* @hideconstructor
*/
function BackendScriptApi(currentNote, apiParams) {
/** @property {Note} note where script started executing */
this.startNote = apiParams.startNote;
/** @property {Note} note where script is currently executing. Don't mix this up with concept of active note */
this.currentNote = currentNote;
/** @property {Entity} entity whose event triggered this executions */
this.originEntity = apiParams.originEntity;
for (const key in apiParams) {
this[key] = apiParams[key];
}
/** @property {axios} Axios library for HTTP requests. See https://axios-http.com/ for documentation */
this.axios = axios;
/** @property {dayjs} day.js library for date manipulation. See https://day.js.org/ for documentation */
this.dayjs = dayjs;
/** @property {axios} xml2js library for XML parsing. See https://github.com/Leonidas-from-XIV/node-xml2js for documentation */
this.xml2js = xml2js;
// DEPRECATED - use direct api.unescapeHtml
this.utils = {
unescapeHtml: utils.unescapeHtml
};
/**
* Instance name identifies particular Trilium instance. It can be useful for scripts
* if some action needs to happen on only one specific instance.
*
* @returns {string|null}
*/
this.getInstanceName = () => config.General ? config.General.instanceName : null;
/**
* @method
* @param {string} noteId
* @returns {Note|null}
*/
this.getNote = becca.getNote;
/**
* @method
* @param {string} branchId
* @returns {Branch|null}
*/
this.getBranch = becca.getBranch;
/**
* @method
* @param {string} attributeId
* @returns {Attribute|null}
*/
this.getAttribute = becca.getAttribute;
/**
* This is a powerful search method - you can search by attributes and their values, e.g.:
* "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
*
* @method
* @param {string} query
* @param {Object} [searchParams]
* @returns {Note[]}
*/
this.searchForNotes = (query, searchParams = {}) => {
if (searchParams.includeArchivedNotes === undefined) {
searchParams.includeArchivedNotes = true;
}
if (searchParams.ignoreHoistedNote === undefined) {
searchParams.ignoreHoistedNote = true;
}
const noteIds = searchService.findResultsWithQuery(query, new SearchContext(searchParams))
.map(sr => sr.noteId);
return becca.getNotes(noteIds);
};
/**
* This is a powerful search method - you can search by attributes and their values, e.g.:
* "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
*
* @method
* @param {string} query
* @param {Object} [searchParams]
* @returns {Note|null}
*/
this.searchForNote = (query, searchParams = {}) => {
const notes = this.searchForNotes(query, searchParams);
return notes.length > 0 ? notes[0] : null;
};
/**
* Retrieves notes with given label name &amp; value
*
* @method
* @param {string} name - attribute name
* @param {string} [value] - attribute value
* @returns {Note[]}
*/
this.getNotesWithLabel = attributeService.getNotesWithLabel;
/**
* Retrieves first note with given label name &amp; value
*
* @method
* @param {string} name - attribute name
* @param {string} [value] - attribute value
* @returns {Note|null}
*/
this.getNoteWithLabel = attributeService.getNoteWithLabel;
/**
* If there's no branch between note and parent note, create one. Otherwise do nothing.
*
* @method
* @param {string} noteId
* @param {string} parentNoteId
* @param {string} prefix - if branch will be create between note and parent note, set this prefix
* @returns {void}
*/
this.ensureNoteIsPresentInParent = cloningService.ensureNoteIsPresentInParent;
/**
* If there's a branch between note and parent note, remove it. Otherwise do nothing.
*
* @method
* @param {string} noteId
* @param {string} parentNoteId
* @returns {void}
*/
this.ensureNoteIsAbsentFromParent = cloningService.ensureNoteIsAbsentFromParent;
/**
* Based on the value, either create or remove branch between note and parent note.
*
* @method
* @param {boolean} present - true if we want the branch to exist, false if we want it gone
* @param {string} noteId
* @param {string} parentNoteId
* @param {string} prefix - if branch will be create between note and parent note, set this prefix
* @returns {void}
*/
this.toggleNoteInParent = cloningService.toggleNoteInParent;
/**
* @typedef {object} CreateNoteAttribute
* @property {string} type - attribute type - label, relation etc.
* @property {string} name - attribute name
* @property {string} [value] - attribute value
*/
/**
* Create text note. See also createNewNote() for more options.
*
* @param {string} parentNoteId
* @param {string} title
* @param {string} content
* @return {{note: Note, branch: Branch}} - object having "note" and "branch" keys representing respective objects
*/
this.createTextNote = (parentNoteId, title, content = '') => noteService.createNewNote({
parentNoteId,
title,
content,
type: 'text'
});
/**
* Create data note - data in this context means object serializable to JSON. Created note will be of type 'code' and
* JSON MIME type. See also createNewNote() for more options.
*
* @param {string} parentNoteId
* @param {string} title
* @param {object} content
* @return {{note: Note, branch: Branch}} object having "note" and "branch" keys representing respective objects
*/
this.createDataNote = (parentNoteId, title, content = {}) => noteService.createNewNote({
parentNoteId,
title,
content: JSON.stringify(content, null, '\t'),
type: 'code',
mime: 'application/json'
});
/**
* @typedef {object} CreateNewNoteParams
* @property {string} parentNoteId - MANDATORY
* @property {string} title - MANDATORY
* @property {string|buffer} content - MANDATORY
* @property {string} type - text, code, file, image, search, book, relation-map - MANDATORY
* @property {string} mime - value is derived from default mimes for type
* @property {boolean} isProtected - default is false
* @property {boolean} isExpanded - default is false
* @property {string} prefix - default is empty string
* @property {int} notePosition - default is last existing notePosition in a parent + 10
*/
/**
* @method
*
* @param {CreateNewNoteParams} [params]
* @returns {{note: Note, branch: Branch}} object contains newly created entities note and branch
*/
this.createNewNote = noteService.createNewNote;
/**
* @typedef {object} CreateNoteAttribute
* @property {string} type - attribute type - label, relation etc.
* @property {string} name - attribute name
* @property {string} [value] - attribute value
*/
/**
* @typedef {object} CreateNoteExtraOptions
* @property {boolean} [json=false] - should the note be JSON
* @property {boolean} [isProtected=false] - should the note be protected
* @property {string} [type='text'] - note type
* @property {string} [mime='text/html'] - MIME type of the note
* @property {CreateNoteAttribute[]} [attributes=[]] - attributes to be created for this note
*/
/**
* @method
* @deprecated please use createTextNote() with similar API for simpler use cases or createNewNote() for more complex needs
*
* @param {string} parentNoteId - create new note under this parent
* @param {string} title
* @param {string} [content=""]
* @param {CreateNoteExtraOptions} [extraOptions={}]
* @returns {{note: Note, branch: Branch}} object contains newly created entities note and branch
*/
this.createNote = (parentNoteId, title, content = "", extraOptions= {}) => {
extraOptions.parentNoteId = parentNoteId;
extraOptions.title = title;
const parentNote = becca.getNote(parentNoteId);
// code note type can be inherited, otherwise text is default
extraOptions.type = parentNote.type === 'code' ? 'code' : 'text';
extraOptions.mime = parentNote.type === 'code' ? parentNote.mime : 'text/html';
if (extraOptions.json) {
extraOptions.content = JSON.stringify(content || {}, null, '\t');
extraOptions.type = 'code';
extraOptions.mime = 'application/json';
}
else {
extraOptions.content = content;
}
return sql.transactional(() => {
const {note, branch} = noteService.createNewNote(extraOptions);
for (const attr of extraOptions.attributes || []) {
attributeService.createAttribute({
noteId: note.noteId,
type: attr.type,
name: attr.name,
value: attr.value,
isInheritable: !!attr.isInheritable
});
}
return {note, branch};
});
};
/**
* Log given message to trilium logs.
*
* @param message
*/
this.log = message => log.info(`Script "${currentNote.title}" (${currentNote.noteId}): ${message}`);
/**
* Returns root note of the calendar.
*
* @method
* @returns {Note|null}
*/
this.getRootCalendarNote = dateNoteService.getRootCalendarNote;
/**
* Returns day note for given date. If such note doesn't exist, it is created.
*
* @method
* @param {string} date in YYYY-MM-DD format
* @returns {Note|null}
*/
this.getDateNote = dateNoteService.getDateNote;
/**
* Returns today's day note. If such note doesn't exist, it is created.
*
* @method
* @returns {Note|null}
*/
this.getTodayNote = dateNoteService.getTodayNote;
/**
* Returns note for the first date of the week of the given date.
*
* @method
* @param {string} date in YYYY-MM-DD format
* @param {object} options - "startOfTheWeek" - either "monday" (default) or "sunday"
* @returns {Note|null}
*/
this.getWeekNote = dateNoteService.getWeekNote;
/**
* Returns month note for given date. If such note doesn't exist, it is created.
*
* @method
* @param {string} date in YYYY-MM format
* @returns {Note|null}
*/
this.getMonthNote = dateNoteService.getMonthNote;
/**
* Returns year note for given year. If such note doesn't exist, it is created.
*
* @method
* @param {string} year in YYYY format
* @returns {Note|null}
*/
this.getYearNote = dateNoteService.getYearNote;
/**
* @method
* @param {string} parentNoteId - this note's child notes will be sorted
*/
this.sortNotesByTitle = parentNoteId => treeService.sortNotes(parentNoteId);
/**
* This method finds note by its noteId and prefix and either sets it to the given parentNoteId
* or removes the branch (if parentNoteId is not given).
*
* This method looks similar to toggleNoteInParent() but differs because we're looking up branch by prefix.
*
* @method
* @deprecated - this method is pretty confusing and serves specialized purpose only
* @param {string} noteId
* @param {string} prefix
* @param {string|null} parentNoteId
*/
this.setNoteToParent = treeService.setNoteToParent;
/**
* This functions wraps code which is supposed to be running in transaction. If transaction already
* exists, then we'll use that transaction.
*
* @method
* @param {function} func
* @returns {?} result of func callback
*/
this.transactional = sql.transactional;
/**
* Return randomly generated string of given length. This random string generation is NOT cryptographically secure.
*
* @method
* @param {number} length of the string
* @returns {string} random string
*/
this.randomString = utils.randomString;
/**
* @method
* @param {string} string to escape
* @returns {string} escaped string
*/
this.escapeHtml = utils.escapeHtml;
/**
* @method
* @param {string} string to unescape
* @returns {string} unescaped string
*/
this.unescapeHtml = utils.unescapeHtml;
/**
* @property {module:sql} sql
*/
this.sql = sql;
/**
* @method
* @deprecated - this is now no-op since all the changes should be gracefully handled per widget
*/
this.refreshTree = () => {};
/**
* @return {{syncVersion, appVersion, buildRevision, dbVersion, dataDirectory, buildDate}|*} - object representing basic info about running Trilium version
*/
this.getAppInfo = () => appInfo
}
module.exports = BackendScriptApi;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="BackendScriptApi.html">BackendScriptApi</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 3.6.7</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -42,8 +42,11 @@ class ApiToken extends AbstractEntity {
constructor(row) { constructor(row) {
super(); super();
/** @type {string} */
this.apiTokenId = row.apiTokenId; this.apiTokenId = row.apiTokenId;
/** @type {string} */
this.token = row.token; this.token = row.token;
/** @type {string} */
this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime(); this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime();
} }
@@ -67,7 +70,7 @@ module.exports = ApiToken;
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -34,6 +34,10 @@ const sql = require("../../services/sql.js");
const dateUtils = require("../../services/date_utils.js"); const dateUtils = require("../../services/date_utils.js");
const promotedAttributeDefinitionParser = require("../../services/promoted_attribute_definition_parser"); const promotedAttributeDefinitionParser = require("../../services/promoted_attribute_definition_parser");
/**
* Attribute is an abstract concept which has two real uses - label (key - value pair)
* and relation (representing named relationship between source and target note)
*/
class Attribute extends AbstractEntity { class Attribute extends AbstractEntity {
static get entityName() { return "attributes"; } static get entityName() { return "attributes"; }
static get primaryKeyName() { return "attributeId"; } static get primaryKeyName() { return "attributeId"; }
@@ -64,21 +68,21 @@ class Attribute extends AbstractEntity {
} }
update([attributeId, noteId, type, name, value, isInheritable, position, utcDateModified]) { update([attributeId, noteId, type, name, value, isInheritable, position, utcDateModified]) {
/** @param {string} */ /** @type {string} */
this.attributeId = attributeId; this.attributeId = attributeId;
/** @param {string} */ /** @type {string} */
this.noteId = noteId; this.noteId = noteId;
/** @param {string} */ /** @type {string} */
this.type = type; this.type = type;
/** @param {string} */ /** @type {string} */
this.name = name; this.name = name;
/** @param {int} */ /** @type {int} */
this.position = position; this.position = position;
/** @param {string} */ /** @type {string} */
this.value = value; this.value = value;
/** @param {boolean} */ /** @type {boolean} */
this.isInheritable = !!isInheritable; this.isInheritable = !!isInheritable;
/** @param {string} */ /** @type {string} */
this.utcDateModified = utcDateModified; this.utcDateModified = utcDateModified;
return this; return this;
@@ -91,7 +95,7 @@ class Attribute extends AbstractEntity {
if (!(this.noteId in this.becca.notes)) { if (!(this.noteId in this.becca.notes)) {
// entities can come out of order in sync, create skeleton which will be filled later // entities can come out of order in sync, create skeleton which will be filled later
this.becca.notes[this.noteId] = new Note({noteId: this.noteId}); this.becca.addNote(this.noteId, new Note({noteId: this.noteId}));
} }
this.becca.notes[this.noteId].ownedAttributes.push(this); this.becca.notes[this.noteId].ownedAttributes.push(this);
@@ -173,6 +177,10 @@ class Attribute extends AbstractEntity {
} }
} }
get isDeleted() {
return !(this.attributeId in this.becca.attributes);
}
beforeSaving() { beforeSaving() {
if (!this.value) { if (!this.value) {
if (this.type === 'relation') { if (this.type === 'relation') {
@@ -237,7 +245,7 @@ module.exports = Attribute;
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -33,6 +33,10 @@ const AbstractEntity = require("./abstract_entity.js");
const sql = require("../../services/sql.js"); const sql = require("../../services/sql.js");
const dateUtils = require("../../services/date_utils.js"); const dateUtils = require("../../services/date_utils.js");
/**
* Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple
* parents.
*/
class Branch extends AbstractEntity { class Branch extends AbstractEntity {
static get entityName() { return "branches"; } static get entityName() { return "branches"; }
static get primaryKeyName() { return "branchId"; } static get primaryKeyName() { return "branchId"; }
@@ -63,19 +67,19 @@ class Branch extends AbstractEntity {
} }
update([branchId, noteId, parentNoteId, prefix, notePosition, isExpanded, utcDateModified]) { update([branchId, noteId, parentNoteId, prefix, notePosition, isExpanded, utcDateModified]) {
/** @param {string} */ /** @type {string} */
this.branchId = branchId; this.branchId = branchId;
/** @param {string} */ /** @type {string} */
this.noteId = noteId; this.noteId = noteId;
/** @param {string} */ /** @type {string} */
this.parentNoteId = parentNoteId; this.parentNoteId = parentNoteId;
/** @param {string} */ /** @type {string} */
this.prefix = prefix; this.prefix = prefix;
/** @param {int} */ /** @type {int} */
this.notePosition = notePosition; this.notePosition = notePosition;
/** @param {boolean} */ /** @type {boolean} */
this.isExpanded = !!isExpanded; this.isExpanded = !!isExpanded;
/** @param {string} */ /** @type {string} */
this.utcDateModified = utcDateModified; this.utcDateModified = utcDateModified;
return this; return this;
@@ -89,20 +93,27 @@ class Branch extends AbstractEntity {
const childNote = this.childNote; const childNote = this.childNote;
const parentNote = this.parentNote; const parentNote = this.parentNote;
childNote.parents.push(parentNote); if (!childNote.parents.includes(parentNote)) {
childNote.parentBranches.push(this); childNote.parents.push(parentNote);
}
parentNote.children.push(childNote); if (!childNote.parentBranches.includes(this)) {
childNote.parentBranches.push(this);
}
if (!parentNote.children.includes(childNote)) {
parentNote.children.push(childNote);
}
this.becca.branches[this.branchId] = this; this.becca.branches[this.branchId] = this;
this.becca.childParentToBranch[`${this.noteId}-${this.parentNoteId}`] = this; this.becca.childParentToBranch[`${this.noteId}-${this.parentNoteId}`] = this;
} }
/** @return {Note} */ /** @returns {Note} */
get childNote() { get childNote() {
if (!(this.noteId in this.becca.notes)) { if (!(this.noteId in this.becca.notes)) {
// entities can come out of order in sync, create skeleton which will be filled later // entities can come out of order in sync, create skeleton which will be filled later
this.becca.notes[this.noteId] = new Note({noteId: this.noteId}); this.becca.addNote(this.noteId, new Note({noteId: this.noteId}));
} }
return this.becca.notes[this.noteId]; return this.becca.notes[this.noteId];
@@ -112,16 +123,20 @@ class Branch extends AbstractEntity {
return this.childNote; return this.childNote;
} }
/** @return {Note} */ /** @returns {Note} */
get parentNote() { get parentNote() {
if (!(this.parentNoteId in this.becca.notes)) { if (!(this.parentNoteId in this.becca.notes)) {
// entities can come out of order in sync, create skeleton which will be filled later // entities can come out of order in sync, create skeleton which will be filled later
this.becca.notes[this.parentNoteId] = new Note({noteId: this.parentNoteId}); this.becca.addNote(this.parentNoteId, new Note({noteId: this.parentNoteId}));
} }
return this.becca.notes[this.parentNoteId]; return this.becca.notes[this.parentNoteId];
} }
get isDeleted() {
return !(this.branchId in this.becca.branches);
}
beforeSaving() { beforeSaving() {
if (this.notePosition === undefined || this.notePosition === null) { if (this.notePosition === undefined || this.notePosition === null) {
// TODO finding new position can be refactored into becca // TODO finding new position can be refactored into becca
@@ -177,7 +192,7 @@ module.exports = Branch;
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -40,6 +40,9 @@ const NoteRevision = require("./note_revision.js");
const LABEL = 'label'; const LABEL = 'label';
const RELATION = 'relation'; const RELATION = 'relation';
/**
* Trilium's main entity which can represent text note, image, code note, file attachment etc.
*/
class Note extends AbstractEntity { class Note extends AbstractEntity {
static get entityName() { return "notes"; } static get entityName() { return "notes"; }
static get primaryKeyName() { return "noteId"; } static get primaryKeyName() { return "noteId"; }
@@ -73,68 +76,80 @@ class Note extends AbstractEntity {
update([noteId, title, type, mime, isProtected, dateCreated, dateModified, utcDateCreated, utcDateModified]) { update([noteId, title, type, mime, isProtected, dateCreated, dateModified, utcDateCreated, utcDateModified]) {
// ------ Database persisted attributes ------ // ------ Database persisted attributes ------
/** @param {string} */ /** @type {string} */
this.noteId = noteId; this.noteId = noteId;
/** @param {string} */ /** @type {string} */
this.title = title; this.title = title;
/** @param {boolean} */ /** @type {boolean} */
this.isProtected = !!isProtected; this.isProtected = !!isProtected;
/** @param {string} */ /** @type {string} */
this.type = type; this.type = type;
/** @param {string} */ /** @type {string} */
this.mime = mime; this.mime = mime;
/** @param {string} */ /** @type {string} */
this.dateCreated = dateCreated || dateUtils.localNowDateTime(); this.dateCreated = dateCreated || dateUtils.localNowDateTime();
/** @param {string} */ /** @type {string} */
this.dateModified = dateModified; this.dateModified = dateModified;
/** @param {string} */ /** @type {string} */
this.utcDateCreated = utcDateCreated || dateUtils.utcNowDateTime(); this.utcDateCreated = utcDateCreated || dateUtils.utcNowDateTime();
/** @param {string} */ /** @type {string} */
this.utcDateModified = utcDateModified; this.utcDateModified = utcDateModified;
// ------ Derived attributes ------ // ------ Derived attributes ------
/** @param {boolean} */ /** @type {boolean} */
this.isDecrypted = !this.isProtected; this.isDecrypted = !this.noteId || !this.isProtected;
this.decrypt(); this.decrypt();
/** @param {string|null} */ /** @type {string|null} */
this.flatTextCache = null; this.flatTextCache = null;
return this; return this;
} }
init() { init() {
/** @param {Branch[]} */ /** @type {Branch[]} */
this.parentBranches = []; this.parentBranches = [];
/** @param {Note[]} */ /** @type {Note[]} */
this.parents = []; this.parents = [];
/** @param {Note[]} */ /** @type {Note[]} */
this.children = []; this.children = [];
/** @param {Attribute[]} */ /** @type {Attribute[]} */
this.ownedAttributes = []; this.ownedAttributes = [];
/** @param {Attribute[]|null} */ /** @type {Attribute[]|null}
* @private */
this.__attributeCache = null; this.__attributeCache = null;
/** @param {Attribute[]|null} */ /** @type {Attribute[]|null}
* @private*/
this.inheritableAttributeCache = null; this.inheritableAttributeCache = null;
/** @param {Attribute[]} */ /** @type {Attribute[]} */
this.targetRelations = []; this.targetRelations = [];
this.becca.notes[this.noteId] = this; this.becca.addNote(this.noteId, this);
/** @param {Note[]|null} */ /** @type {Note[]|null}
* @private */
this.ancestorCache = null; this.ancestorCache = null;
// following attributes are filled during searching from database // following attributes are filled during searching from database
/** @param {int} size of the content in bytes */ /**
* size of the content in bytes
* @type {int|null}
*/
this.contentSize = null; this.contentSize = null;
/** @param {int} size of the content and note revision contents in bytes */ /**
* size of the content and note revision contents in bytes
* @type {int|null}
*/
this.noteSize = null; this.noteSize = null;
/** @param {int} number of note revisions for this note */ /**
* number of note revisions for this note
* @type {int|null}
*/
this.revisionCount = null; this.revisionCount = null;
} }
@@ -144,26 +159,32 @@ class Note extends AbstractEntity {
|| protectedSessionService.isProtectedSessionAvailable() || protectedSessionService.isProtectedSessionAvailable()
} }
/** @returns {Branch[]} */
getParentBranches() { getParentBranches() {
return this.parentBranches; return this.parentBranches;
} }
/** @returns {Branch[]} */
getBranches() { getBranches() {
return this.parentBranches; return this.parentBranches;
} }
/** @returns {Note[]} */
getParentNotes() { getParentNotes() {
return this.parents; return this.parents;
} }
/** @returns {Note[]} */
getChildNotes() { getChildNotes() {
return this.children; return this.children;
} }
/** @returns {boolean} */
hasChildren() { hasChildren() {
return this.children &amp;&amp; this.children.length > 0; return this.children &amp;&amp; this.children.length > 0;
} }
/** @returns {Branch[]} */
getChildBranches() { getChildBranches() {
return this.children.map(childNote => this.becca.getBranchFromChildAndParent(childNote.noteId, this.noteId)); return this.children.map(childNote => this.becca.getBranchFromChildAndParent(childNote.noteId, this.noteId));
} }
@@ -398,7 +419,7 @@ class Note extends AbstractEntity {
return this.__attributeCache; return this.__attributeCache;
} }
/** @return {Attribute[]} */ /** @returns {Attribute[]} */
__getInheritableAttributes(path) { __getInheritableAttributes(path) {
if (path.includes(this.noteId)) { if (path.includes(this.noteId)) {
return []; return [];
@@ -639,7 +660,7 @@ class Note extends AbstractEntity {
// will sort the parents so that non-search &amp; non-archived are first and archived at the end // will sort the parents so that non-search &amp; non-archived are first and archived at the end
// this is done so that non-search &amp; non-archived paths are always explored as first when looking for note path // this is done so that non-search &amp; non-archived paths are always explored as first when looking for note path
resortParents() { sortParents() {
this.parentBranches.sort((a, b) => this.parentBranches.sort((a, b) =>
a.branchId.startsWith('virt-') a.branchId.startsWith('virt-')
|| a.parentNote.hasInheritableOwnedArchivedLabel() ? 1 : -1); || a.parentNote.hasInheritableOwnedArchivedLabel() ? 1 : -1);
@@ -749,28 +770,38 @@ class Note extends AbstractEntity {
return !!this.targetRelations.find(rel => rel.name === 'template'); return !!this.targetRelations.find(rel => rel.name === 'template');
} }
/** @return {Note[]} */ /** @returns {Note[]} */
getSubtreeNotesIncludingTemplated() { getSubtreeNotesIncludingTemplated() {
const arr = [[this]]; const set = new Set();
for (const childNote of this.children) { function inner(note) {
arr.push(childNote.getSubtreeNotesIncludingTemplated()); if (set.has(note)) {
} return;
}
for (const targetRelation of this.targetRelations) { set.add(note);
if (targetRelation.name === 'template') {
const note = targetRelation.note;
if (note) { for (const childNote of note.children) {
arr.push(note.getSubtreeNotesIncludingTemplated()); inner(childNote);
}
for (const targetRelation of note.targetRelations) {
if (targetRelation.name === 'template') {
const targetNote = targetRelation.note;
if (targetNote) {
inner(targetNote);
}
} }
} }
} }
return arr.flat(); inner(this);
return Array.from(set);
} }
/** @return {Note[]} */ /** @returns {Note[]} */
getSubtreeNotes(includeArchived = true) { getSubtreeNotes(includeArchived = true) {
const noteSet = new Set(); const noteSet = new Set();
@@ -791,9 +822,9 @@ class Note extends AbstractEntity {
return Array.from(noteSet); return Array.from(noteSet);
} }
/** @return {String[]} */ /** @returns {String[]} */
getSubtreeNoteIds() { getSubtreeNoteIds(includeArchived = true) {
return this.getSubtreeNotes().map(note => note.noteId); return this.getSubtreeNotes(includeArchived).map(note => note.noteId);
} }
getDescendantNoteIds() { getDescendantNoteIds() {
@@ -848,6 +879,7 @@ class Note extends AbstractEntity {
return this.getAttributes().length; return this.getAttributes().length;
} }
/** @returns {Note[]} */
getAncestors() { getAncestors() {
if (!this.ancestorCache) { if (!this.ancestorCache) {
const noteIds = new Set(); const noteIds = new Set();
@@ -871,11 +903,22 @@ class Note extends AbstractEntity {
return this.ancestorCache; return this.ancestorCache;
} }
/** @returns {boolean} */
hasAncestor(ancestorNoteId) {
for (const ancestorNote of this.getAncestors()) {
if (ancestorNote.noteId === ancestorNoteId) {
return true;
}
}
return false;
}
getTargetRelations() { getTargetRelations() {
return this.targetRelations; return this.targetRelations;
} }
/** @return {Note[]} - returns only notes which are templated, does not include their subtrees /** @returns {Note[]} - returns only notes which are templated, does not include their subtrees
* in effect returns notes which are influenced by note's non-inheritable attributes */ * in effect returns notes which are influenced by note's non-inheritable attributes */
getTemplatedNotes() { getTemplatedNotes() {
const arr = [this]; const arr = [this];
@@ -1112,10 +1155,14 @@ class Note extends AbstractEntity {
} }
} }
get isDeleted() {
return !(this.noteId in this.becca.notes);
}
beforeSaving() { beforeSaving() {
super.beforeSaving(); super.beforeSaving();
this.becca.notes[this.noteId] = this; this.becca.addNote(this.noteId, this);
this.dateModified = dateUtils.localNowDateTime(); this.dateModified = dateUtils.localNowDateTime();
this.utcDateModified = dateUtils.utcNowDateTime(); this.utcDateModified = dateUtils.utcNowDateTime();
@@ -1164,7 +1211,7 @@ module.exports = Note;
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -37,7 +37,8 @@ const entityChangesService = require('../../services/entity_changes');
const AbstractEntity = require("./abstract_entity.js"); const AbstractEntity = require("./abstract_entity.js");
/** /**
* NoteRevision represents snapshot of note's title and content at some point in the past. It's used for seamless note versioning. * NoteRevision represents snapshot of note's title and content at some point in the past.
* It's used for seamless note versioning.
*/ */
class NoteRevision extends AbstractEntity { class NoteRevision extends AbstractEntity {
static get entityName() { return "note_revisions"; } static get entityName() { return "note_revisions"; }
@@ -47,29 +48,29 @@ class NoteRevision extends AbstractEntity {
constructor(row) { constructor(row) {
super(); super();
/** @param {string} */ /** @type {string} */
this.noteRevisionId = row.noteRevisionId; this.noteRevisionId = row.noteRevisionId;
/** @param {string} */ /** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
/** @param {string} */ /** @type {string} */
this.type = row.type; this.type = row.type;
/** @param {string} */ /** @type {string} */
this.mime = row.mime; this.mime = row.mime;
/** @param {boolean} */ /** @type {boolean} */
this.isProtected = !!row.isProtected; this.isProtected = !!row.isProtected;
/** @param {string} */ /** @type {string} */
this.title = row.title; this.title = row.title;
/** @param {string} */ /** @type {string} */
this.dateLastEdited = row.dateLastEdited; this.dateLastEdited = row.dateLastEdited;
/** @param {string} */ /** @type {string} */
this.dateCreated = row.dateCreated; this.dateCreated = row.dateCreated;
/** @param {string} */ /** @type {string} */
this.utcDateLastEdited = row.utcDateLastEdited; this.utcDateLastEdited = row.utcDateLastEdited;
/** @param {string} */ /** @type {string} */
this.utcDateCreated = row.utcDateCreated; this.utcDateCreated = row.utcDateCreated;
/** @param {string} */ /** @type {string} */
this.utcDateModified = row.utcDateModified; this.utcDateModified = row.utcDateModified;
/** @param {number} */ /** @type {number} */
this.contentLength = row.contentLength; this.contentLength = row.contentLength;
if (this.isProtected) { if (this.isProtected) {
@@ -77,7 +78,7 @@ class NoteRevision extends AbstractEntity {
this.title = protectedSessionService.decryptString(this.title); this.title = protectedSessionService.decryptString(this.title);
} }
else { else {
this.title = "[Protected]"; this.title = "[protected]";
} }
} }
} }
@@ -194,12 +195,14 @@ class NoteRevision extends AbstractEntity {
utcDateLastEdited: this.utcDateLastEdited, utcDateLastEdited: this.utcDateLastEdited,
utcDateCreated: this.utcDateCreated, utcDateCreated: this.utcDateCreated,
utcDateModified: this.utcDateModified, utcDateModified: this.utcDateModified,
content: this.content,
contentLength: this.contentLength contentLength: this.contentLength
}; };
} }
getPojoToSave() { getPojoToSave() {
const pojo = this.getPojo(); const pojo = this.getPojo();
delete pojo.content; // not getting persisted
delete pojo.contentLength; // not getting persisted delete pojo.contentLength; // not getting persisted
if (pojo.isProtected) { if (pojo.isProtected) {
@@ -227,7 +230,7 @@ module.exports = NoteRevision;
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -42,9 +42,13 @@ class Option extends AbstractEntity {
constructor(row) { constructor(row) {
super(); super();
/** @type {string} */
this.name = row.name; this.name = row.name;
/** @type {string} */
this.value = row.value; this.value = row.value;
/** @type {boolean} */
this.isSynced = !!row.isSynced; this.isSynced = !!row.isSynced;
/** @type {string} */
this.utcDateModified = row.utcDateModified; this.utcDateModified = row.utcDateModified;
this.becca.options[this.name] = this; this.becca.options[this.name] = this;
@@ -79,7 +83,7 @@ module.exports = Option;
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -41,8 +41,11 @@ class RecentNote extends AbstractEntity {
constructor(row) { constructor(row) {
super(); super();
/** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
/** @type {string} */
this.notePath = row.notePath; this.notePath = row.notePath;
/** @type {string} */
this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime(); this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime();
} }
@@ -66,7 +69,7 @@ module.exports = RecentNote;
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -1,84 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: entities/api_token.js</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">Source: entities/api_token.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";
const Entity = require('./entity');
const dateUtils = require('../services/date_utils');
/**
* ApiToken is an entity representing token used to authenticate against Trilium API from client applications. Currently used only by Trilium Sender.
*
* @property {string} apiTokenId - primary key
* @property {string} token
* @property {boolean} isDeleted - true if API token is deleted
* @property {string} utcDateCreated
*
* @extends Entity
*/
class ApiToken extends Entity {
static get entityName() { return "api_tokens"; }
static get primaryKeyName() { return "apiTokenId"; }
static get hashedProperties() { return ["apiTokenId", "token", "utcDateCreated", "isDeleted"]; }
beforeSaving() {
if (!this.isDeleted) {
this.isDeleted = false;
}
if (!this.utcDateCreated) {
this.utcDateCreated = dateUtils.utcNowDateTime();
}
super.beforeSaving();
}
}
module.exports = ApiToken;</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</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 3.6.6</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -1,175 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: entities/attribute.js</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">Source: entities/attribute.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";
const Entity = require('./entity');
const dateUtils = require('../services/date_utils');
const sql = require('../services/sql');
const promotedAttributeDefinitionParser = require("../services/promoted_attribute_definition_parser");
/**
* Attribute is key value pair owned by a note.
*
* @property {string} attributeId - immutable
* @property {string} noteId - immutable
* @property {string} type - immutable
* @property {string} name - immutable
* @property {string} value
* @property {int} position
* @property {boolean} isInheritable - immutable
* @property {boolean} isDeleted
* @property {string|null} deleteId - ID identifying delete transaction
* @property {string} utcDateModified
*
* @extends Entity
*/
class Attribute extends Entity {
static get entityName() { return "attributes"; }
static get primaryKeyName() { return "attributeId"; }
static get hashedProperties() { return ["attributeId", "noteId", "type", "name", "value", "isInheritable", "isDeleted"]; }
constructor(row) {
super(row);
this.isInheritable = !!this.isInheritable;
}
isAutoLink() {
return this.type === 'relation' &amp;&amp; ['internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink'].includes(this.name);
}
/**
* @returns {Note|null}
*/
getNote() {
return this.repository.getNote(this.noteId);
}
/**
* @returns {Note|null}
*/
getTargetNote() {
if (this.type !== 'relation') {
throw new Error(`Attribute ${this.attributeId} is not relation`);
}
if (!this.value) {
return null;
}
return this.repository.getNote(this.value);
}
/**
* @return {boolean}
*/
isDefinition() {
return this.type === 'label' &amp;&amp; (this.name.startsWith('label:') || this.name.startsWith('relation:'));
}
getDefinition() {
return promotedAttributeDefinitionParser.parse(this.value);
}
getDefinedName() {
if (this.type === 'label' &amp;&amp; this.name.startsWith('label:')) {
return this.name.substr(6);
} else if (this.type === 'label' &amp;&amp; this.name.startsWith('relation:')) {
return this.name.substr(9);
} else {
return this.name;
}
}
beforeSaving() {
if (!this.value) {
if (this.type === 'relation') {
throw new Error(`Cannot save relation ${this.name} since it does not target any note.`);
}
// null value isn't allowed
this.value = "";
}
if (this.position === undefined) {
this.position = 1 + sql.getValue(`SELECT COALESCE(MAX(position), 0) FROM attributes WHERE noteId = ?`, [this.noteId]);
}
if (!this.isInheritable) {
this.isInheritable = false;
}
if (!this.isDeleted) {
this.isDeleted = false;
}
super.beforeSaving();
this.utcDateModified = dateUtils.utcNowDateTime();
}
createClone(type, name, value, isInheritable) {
return new Attribute({
noteId: this.noteId,
type: type,
name: name,
value: value,
position: this.position,
isInheritable: isInheritable,
isDeleted: false,
utcDateModified: this.utcDateModified
});
}
}
module.exports = Attribute;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</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 3.6.6</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -1,128 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: entities/branch.js</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">Source: entities/branch.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";
const Entity = require('./entity');
const dateUtils = require('../services/date_utils');
const sql = require('../services/sql');
/**
* Branch represents note's placement in the tree - it's essentially pair of noteId and parentNoteId.
* Each note can have multiple (at least one) branches, meaning it can be placed into multiple places in the tree.
*
* @property {string} branchId - primary key, immutable
* @property {string} noteId - immutable
* @property {string} parentNoteId - immutable
* @property {int} notePosition
* @property {string} prefix
* @property {boolean} isExpanded
* @property {boolean} isDeleted
* @property {string|null} deleteId - ID identifying delete transaction
* @property {string} utcDateModified
* @property {string} utcDateCreated
*
* @extends Entity
*/
class Branch extends Entity {
static get entityName() { return "branches"; }
static get primaryKeyName() { return "branchId"; }
// notePosition is not part of hash because it would produce a lot of updates in case of reordering
static get hashedProperties() { return ["branchId", "noteId", "parentNoteId", "isDeleted", "deleteId", "prefix"]; }
/** @returns {Note|null} */
getNote() {
return this.repository.getNote(this.noteId);
}
/** @returns {Note|null} */
getParentNote() {
return this.repository.getNote(this.parentNoteId);
}
beforeSaving() {
if (this.notePosition === undefined || this.notePosition === null) {
const maxNotePos = sql.getValue('SELECT MAX(notePosition) FROM branches WHERE parentNoteId = ? AND isDeleted = 0', [this.parentNoteId]);
this.notePosition = maxNotePos === null ? 0 : maxNotePos + 10;
}
if (!this.isExpanded) {
this.isExpanded = false;
}
if (!this.isDeleted) {
this.isDeleted = false;
}
if (!this.utcDateCreated) {
this.utcDateCreated = dateUtils.utcNowDateTime();
}
super.beforeSaving();
this.utcDateModified = dateUtils.utcNowDateTime();
}
createClone(parentNoteId, notePosition) {
return new Branch({
noteId: this.noteId,
parentNoteId: parentNoteId,
notePosition: notePosition,
prefix: this.prefix,
isExpanded: this.isExpanded,
isDeleted: false,
utcDateCreated: this.utcDateCreated,
utcDateModified: this.utcDateModified
});
}
}
module.exports = Branch;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</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 3.6.6</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -1,113 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: entities/entity.js</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">Source: entities/entity.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";
const utils = require('../services/utils');
let repo = null;
class Entity {
/**
* @param {object} [row] - database row representing given entity
*/
constructor(row = {}) {
for (const key in row) {
// ! is used when joint-fetching notes and note_contents objects for performance
if (!key.startsWith('!')) {
this[key] = row[key];
}
}
if ('isDeleted' in this &amp;&amp; this.constructor.entityName !== 'recent_notes') {
this.isDeleted = !!this.isDeleted;
}
}
beforeSaving() {
this.generateIdIfNecessary();
}
generateIdIfNecessary() {
if (!this[this.constructor.primaryKeyName]) {
this[this.constructor.primaryKeyName] = utils.newEntityId();
}
}
generateHash() {
let contentToHash = "";
for (const propertyName of this.constructor.hashedProperties) {
contentToHash += "|" + this[propertyName];
}
return utils.hash(contentToHash).substr(0, 10);
}
getUtcDateChanged() {
return this.utcDateModified || this.utcDateCreated;
}
get repository() {
if (!repo) {
repo = require('../services/repository');
}
return repo;
}
save() {
this.repository.updateEntity(this);
return this;
}
}
module.exports = Entity;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</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 3.6.6</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -1,92 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: entities/image.js</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">Source: entities/image.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";
const Entity = require('./entity');
const dateUtils = require('../services/date_utils');
/**
* This class represents image data.
*
* @param {string} imageId
* @param {string} format
* @param {string} checksum
* @param {string} name
* @param {blob} data
* @param {boolean} isDeleted
* @param {string} dateModified
* @param {string} dateCreated
*
* @extends Entity
*/
class Image extends Entity {
static get entityName() { return "images"; }
static get primaryKeyName() { return "imageId"; }
static get hashedProperties() { return ["imageId", "format", "checksum", "name", "isDeleted", "dateCreated"]; }
beforeSaving() {
if (!this.isDeleted) {
this.isDeleted = false;
}
if (!this.dateCreated) {
this.dateCreated = dateUtils.nowDate();
}
super.beforeSaving();
if (this.isChanged) {
this.dateModified = dateUtils.nowDate();
}
}
}
module.exports = Image;</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Image.html">Image</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteImage.html">NoteImage</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Oct 07 2018 16:26:59 GMT+0200 (CEST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -1,101 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: entities/link.js</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">Source: entities/link.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";
const Entity = require('./entity');
const repository = require('../services/repository');
const dateUtils = require('../services/date_utils');
/**
* This class represents link from one note to another in the form of hyperlink or image reference. Note that
* this is different concept than attribute/relation.
*
* @param {string} linkId
* @param {string} noteId
* @param {string} targetNoteId
* @param {string} type
* @param {boolean} isDeleted
* @param {string} utcDateModified
* @param {string} utcDateCreated
*
* @extends Entity
*/
class Link extends Entity {
static get entityName() { return "links"; }
static get primaryKeyName() { return "linkId"; }
static get hashedProperties() { return ["linkId", "noteId", "targetNoteId", "type", "isDeleted", "utcDateCreated", "utcDateModified"]; }
async getNote() {
return await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
}
async getTargetNote() {
return await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.targetNoteId]);
}
beforeSaving() {
if (!this.isDeleted) {
this.isDeleted = false;
}
if (!this.utcDateCreated) {
this.utcDateCreated = dateUtils.utcNowDateTime();
}
super.beforeSaving();
if (this.isChanged) {
this.utcDateModified = dateUtils.utcNowDateTime();
}
}
}
module.exports = Link;</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Link.html">Link</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -1,993 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: entities/note.js</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">Source: entities/note.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";
const Entity = require('./entity');
const Attribute = require('./attribute');
const protectedSessionService = require('../services/protected_session');
const sql = require('../services/sql');
const utils = require('../services/utils');
const dateUtils = require('../services/date_utils');
const entityChangesService = require('../services/entity_changes.js');
const LABEL = 'label';
const RELATION = 'relation';
/**
* This represents a Note which is a central object in the Trilium Notes project.
*
* @property {string} noteId - primary key
* @property {string} type - one of "text", "code", "file" or "render"
* @property {string} mime - MIME type, e.g. "text/html"
* @property {string} title - note title
* @property {boolean} isProtected - true if note is protected
* @property {boolean} isDeleted - true if note is deleted
* @property {string|null} deleteId - ID identifying delete transaction
* @property {string} dateCreated - local date time (with offset)
* @property {string} dateModified - local date time (with offset)
* @property {string} utcDateCreated
* @property {string} utcDateModified
*
* @extends Entity
*/
class Note extends Entity {
static get entityName() { return "notes"; }
static get primaryKeyName() { return "noteId"; }
static get hashedProperties() { return ["noteId", "title", "type", "mime", "isProtected", "isDeleted", "deleteId"]; }
/**
* @param row - object containing database row from "notes" table
*/
constructor(row) {
super(row);
this.isProtected = !!this.isProtected;
/* true if content is either not encrypted
* or encrypted, but with available protected session (so effectively decrypted) */
this.isContentAvailable = true;
// check if there's noteId, otherwise this is a new entity which wasn't encrypted yet
if (this.isProtected &amp;&amp; this.noteId) {
this.isContentAvailable = protectedSessionService.isProtectedSessionAvailable();
if (this.isContentAvailable) {
try {
this.title = protectedSessionService.decryptString(this.title);
}
catch (e) {
throw new Error(`Could not decrypt title of note ${this.noteId}: ${e.message} ${e.stack}`)
}
}
else {
this.title = "[protected]";
}
}
}
/*
* Note content has quite special handling - it's not a separate entity, but a lazily loaded
* part of Note entity with it's own sync. Reasons behind this hybrid design has been:
*
* - content can be quite large and it's not necessary to load it / fill memory for any note access even if we don't need a content, especially for bulk operations like search
* - changes in the note metadata or title should not trigger note content sync (so we keep separate utcDateModified and entity changes records)
* - but to the user note content and title changes are one and the same - single dateModified (so all changes must go through Note and content is not a separate entity)
*/
/** @returns {*} */
getContent(silentNotFoundError = false) {
if (this.content === undefined) {
const row = sql.getRow(`SELECT content FROM note_contents WHERE noteId = ?`, [this.noteId]);
if (!row) {
if (silentNotFoundError) {
return undefined;
}
else {
throw new Error("Cannot find note content for noteId=" + this.noteId);
}
}
this.content = row.content;
if (this.isProtected) {
if (this.isContentAvailable) {
this.content = this.content === null ? null : protectedSessionService.decrypt(this.content);
}
else {
this.content = "";
}
}
}
if (this.isStringNote()) {
return this.content === null
? ""
: this.content.toString("UTF-8");
}
else {
return this.content;
}
}
/** @returns {{contentLength, dateModified, utcDateModified}} */
getContentMetadata() {
return sql.getRow(`
SELECT
LENGTH(content) AS contentLength,
dateModified,
utcDateModified
FROM note_contents
WHERE noteId = ?`, [this.noteId]);
}
/** @returns {*} */
getJsonContent() {
const content = this.getContent();
if (!content || !content.trim()) {
return null;
}
return JSON.parse(content);
}
setContent(content) {
if (content === null || content === undefined) {
throw new Error(`Cannot set null content to note ${this.noteId}`);
}
if (this.isStringNote()) {
content = content.toString();
}
else {
content = Buffer.isBuffer(content) ? content : Buffer.from(content);
}
this.content = content;
const pojo = {
noteId: this.noteId,
content: content,
dateModified: dateUtils.localNowDateTime(),
utcDateModified: dateUtils.utcNowDateTime()
};
if (this.isProtected) {
if (this.isContentAvailable) {
pojo.content = protectedSessionService.encrypt(pojo.content);
}
else {
throw new Error(`Cannot update content of noteId=${this.noteId} since we're out of protected session.`);
}
}
sql.upsert("note_contents", "noteId", pojo);
const hash = utils.hash(this.noteId + "|" + pojo.content.toString());
entityChangesService.addEntityChange({
entityName: 'note_contents',
entityId: this.noteId,
hash: hash,
isErased: false,
utcDateChanged: pojo.utcDateModified
}, null);
}
setJsonContent(content) {
this.setContent(JSON.stringify(content, null, '\t'));
}
/** @returns {boolean} true if this note is the root of the note tree. Root note has "root" noteId */
isRoot() {
return this.noteId === 'root';
}
/** @returns {boolean} true if this note is of application/json content type */
isJson() {
return this.mime === "application/json";
}
/** @returns {boolean} true if this note is JavaScript (code or attachment) */
isJavaScript() {
return (this.type === "code" || this.type === "file")
&amp;&amp; (this.mime.startsWith("application/javascript")
|| this.mime === "application/x-javascript"
|| this.mime === "text/javascript");
}
/** @returns {boolean} true if this note is HTML */
isHtml() {
return (this.type === "code" || this.type === "file" || this.type === "render") &amp;&amp; this.mime === "text/html";
}
/** @returns {boolean} true if the note has string content (not binary) */
isStringNote() {
return utils.isStringNote(this.type, this.mime);
}
/** @returns {string} JS script environment - either "frontend" or "backend" */
getScriptEnv() {
if (this.isHtml() || (this.isJavaScript() &amp;&amp; this.mime.endsWith('env=frontend'))) {
return "frontend";
}
if (this.type === 'render') {
return "frontend";
}
if (this.isJavaScript() &amp;&amp; this.mime.endsWith('env=backend')) {
return "backend";
}
return null;
}
loadOwnedAttributesToCache() {
this.__ownedAttributeCache = this.repository.getEntities(`SELECT * FROM attributes WHERE isDeleted = 0 AND noteId = ?`, [this.noteId]);
return this.__ownedAttributeCache;
}
/**
* This method is a faster variant of getAttributes() which looks for only owned attributes.
* Use when inheritance is not needed and/or in batch/performance sensitive operations.
*
* @param {string} [type] - (optional) attribute type to filter
* @param {string} [name] - (optional) attribute name to filter
* @returns {Attribute[]} note's "owned" attributes - excluding inherited ones
*/
getOwnedAttributes(type, name) {
if (!this.__ownedAttributeCache) {
this.loadOwnedAttributesToCache();
}
if (type &amp;&amp; name) {
return this.__ownedAttributeCache.filter(attr => attr.type === type &amp;&amp; attr.name === name);
}
else if (type) {
return this.__ownedAttributeCache.filter(attr => attr.type === type);
}
else if (name) {
return this.__ownedAttributeCache.filter(attr => attr.name === name);
}
else {
return this.__ownedAttributeCache.slice();
}
}
/**
* @returns {Attribute} attribute belonging to this specific note (excludes inherited attributes)
*
* This method can be significantly faster than the getAttribute()
*/
getOwnedAttribute(type, name) {
const attrs = this.getOwnedAttributes(type, name);
return attrs.length > 0 ? attrs[0] : null;
}
/**
* @returns {Attribute[]} relations targetting this specific note
*/
getTargetRelations() {
return this.repository.getEntities("SELECT * FROM attributes WHERE type = 'relation' AND isDeleted = 0 AND value = ?", [this.noteId]);
}
/**
* @param {string} [type] - (optional) attribute type to filter
* @param {string} [name] - (optional) attribute name to filter
* @returns {Attribute[]} all note's attributes, including inherited ones
*/
getAttributes(type, name) {
if (!this.__attributeCache) {
this.loadAttributesToCache();
}
if (type &amp;&amp; name) {
return this.__attributeCache.filter(attr => attr.type === type &amp;&amp; attr.name === name);
}
else if (type) {
return this.__attributeCache.filter(attr => attr.type === type);
}
else if (name) {
return this.__attributeCache.filter(attr => attr.name === name);
}
else {
return this.__attributeCache.slice();
}
}
/**
* @param {string} [name] - label name to filter
* @returns {Attribute[]} all note's labels (attributes with type label), including inherited ones
*/
getLabels(name) {
return this.getAttributes(LABEL, name);
}
/**
* @param {string} [name] - label name to filter
* @returns {Attribute[]} all note's labels (attributes with type label), excluding inherited ones
*/
getOwnedLabels(name) {
return this.getOwnedAttributes(LABEL, name);
}
/**
* @param {string} [name] - relation name to filter
* @returns {Attribute[]} all note's relations (attributes with type relation), including inherited ones
*/
getRelations(name) {
return this.getAttributes(RELATION, name);
}
/**
* @param {string} [name] - relation name to filter
* @returns {Attribute[]} all note's relations (attributes with type relation), excluding inherited ones
*/
getOwnedRelations(name) {
return this.getOwnedAttributes(RELATION, name);
}
/**
* @param {string} [name] - relation name to filter
* @returns {Note[]}
*/
getRelationTargets(name) {
const relations = this.getRelations(name);
const targets = [];
for (const relation of relations) {
targets.push(relation.getTargetNote());
}
return targets;
}
/**
* Clear note's attributes cache to force fresh reload for next attribute request.
* Cache is note instance scoped.
*/
invalidateAttributeCache() {
this.__attributeCache = null;
this.__ownedAttributeCache = null;
}
loadAttributesToCache() {
const attributes = this.repository.getEntities(`
WITH RECURSIVE
tree(noteId, level) AS (
SELECT ?, 0
UNION
SELECT branches.parentNoteId, tree.level + 1
FROM branches
JOIN tree ON branches.noteId = tree.noteId
WHERE branches.isDeleted = 0
),
treeWithAttrs(noteId, level) AS (
SELECT * FROM tree
UNION
SELECT attributes.value, treeWithAttrs.level FROM attributes
JOIN treeWithAttrs ON treeWithAttrs.noteId = attributes.noteId
WHERE attributes.isDeleted = 0
AND attributes.type = 'relation'
AND attributes.name = 'template'
)
SELECT attributes.* FROM attributes JOIN treeWithAttrs ON attributes.noteId = treeWithAttrs.noteId
WHERE attributes.isDeleted = 0 AND (attributes.isInheritable = 1 OR treeWithAttrs.level = 0)
ORDER BY level, noteId, position`, [this.noteId]);
// attributes are ordered so that "closest" attributes are first
// we order by noteId so that attributes from same note stay together. Actual noteId ordering doesn't matter.
const filteredAttributes = attributes.filter((attr, index) => {
// if this exact attribute already appears then don't include it (can happen via cloning)
if (attributes.findIndex(it => it.attributeId === attr.attributeId) !== index) {
return false;
}
// FIXME: this code is quite questionable, one problem is that other caches (Froca, Becca) have nothing like that
if (attr.isDefinition()) {
const firstDefinitionIndex = attributes.findIndex(el => el.type === attr.type &amp;&amp; el.name === attr.name);
// keep only if this element is the first definition for this type &amp; name
return firstDefinitionIndex === index;
}
else {
const definitionAttr = attributes.find(el => el.type === 'label' &amp;&amp; el.name === attr.type + ':' + attr.name);
if (!definitionAttr) {
return true;
}
const definition = definitionAttr.getDefinition();
if (definition.multiplicity === 'multi') {
return true;
}
else {
const firstAttrIndex = attributes.findIndex(el => el.type === attr.type &amp;&amp; el.name === attr.name);
// in case of single-valued attribute we'll keep it only if it's first (closest)
return firstAttrIndex === index;
}
}
});
this.__attributeCache = filteredAttributes;
}
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @returns {boolean} true if note has an attribute with given type and name (including inherited)
*/
hasAttribute(type, name) {
return !!this.getAttribute(type, name);
}
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @returns {boolean} true if note has an attribute with given type and name (excluding inherited)
*/
hasOwnedAttribute(type, name) {
return !!this.getOwnedAttribute(type, name);
}
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @returns {Attribute} attribute of given type and name. If there's more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
*/
getAttribute(type, name) {
const attributes = this.getAttributes();
return attributes.find(attr => attr.type === type &amp;&amp; attr.name === name);
}
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @returns {string|null} attribute value of given type and name or null if no such attribute exists.
*/
getAttributeValue(type, name) {
const attr = this.getAttribute(type, name);
return attr ? attr.value : null;
}
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @returns {string|null} attribute value of given type and name or null if no such attribute exists.
*/
getOwnedAttributeValue(type, name) {
const attr = this.getOwnedAttribute(type, name);
return attr ? attr.value : null;
}
/**
* Based on enabled, attribute is either set or removed.
*
* @param {string} type - attribute type ('relation', 'label' etc.)
* @param {boolean} enabled - toggle On or Off
* @param {string} name - attribute name
* @param {string} [value] - attribute value (optional)
*/
toggleAttribute(type, enabled, name, value) {
if (enabled) {
this.setAttribute(type, name, value);
}
else {
this.removeAttribute(type, name, value);
}
}
/**
* Update's given attribute's value or creates it if it doesn't exist
*
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @param {string} [value] - attribute value (optional)
*/
setAttribute(type, name, value) {
const attributes = this.loadOwnedAttributesToCache();
let attr = attributes.find(attr => attr.type === type &amp;&amp; attr.name === name);
if (attr) {
if (attr.value !== value) {
attr.value = value;
attr.save();
this.invalidateAttributeCache();
}
}
else {
attr = new Attribute({
noteId: this.noteId,
type: type,
name: name,
value: value !== undefined ? value : ""
});
attr.save();
this.invalidateAttributeCache();
}
}
/**
* Removes given attribute name-value pair if it exists.
*
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @param {string} [value] - attribute value (optional)
*/
removeAttribute(type, name, value) {
const attributes = this.loadOwnedAttributesToCache();
for (const attribute of attributes) {
if (attribute.type === type &amp;&amp; attribute.name === name &amp;&amp; (value === undefined || value === attribute.value)) {
attribute.isDeleted = true;
attribute.save();
this.invalidateAttributeCache();
}
}
}
/**
* @return {Attribute}
*/
addAttribute(type, name, value = "", isInheritable = false, position = 1000) {
const attr = new Attribute({
noteId: this.noteId,
type: type,
name: name,
value: value,
isInheritable: isInheritable,
position: position
});
attr.save();
this.invalidateAttributeCache();
return attr;
}
addLabel(name, value = "", isInheritable = false) {
return this.addAttribute(LABEL, name, value, isInheritable);
}
addRelation(name, targetNoteId, isInheritable = false) {
return this.addAttribute(RELATION, name, targetNoteId, isInheritable);
}
/**
* @param {string} name - label name
* @returns {boolean} true if label exists (including inherited)
*/
hasLabel(name) { return this.hasAttribute(LABEL, name); }
/**
* @param {string} name - label name
* @returns {boolean} true if label exists (excluding inherited)
*/
hasOwnedLabel(name) { return this.hasOwnedAttribute(LABEL, name); }
/**
* @param {string} name - relation name
* @returns {boolean} true if relation exists (including inherited)
*/
hasRelation(name) { return this.hasAttribute(RELATION, name); }
/**
* @param {string} name - relation name
* @returns {boolean} true if relation exists (excluding inherited)
*/
hasOwnedRelation(name) { return this.hasOwnedAttribute(RELATION, name); }
/**
* @param {string} name - label name
* @returns {Attribute|null} label if it exists, null otherwise
*/
getLabel(name) { return this.getAttribute(LABEL, name); }
/**
* @param {string} name - label name
* @returns {Attribute|null} label if it exists, null otherwise
*/
getOwnedLabel(name) { return this.getOwnedAttribute(LABEL, name); }
/**
* @param {string} name - relation name
* @returns {Attribute|null} relation if it exists, null otherwise
*/
getRelation(name) { return this.getAttribute(RELATION, name); }
/**
* @param {string} name - relation name
* @returns {Attribute|null} relation if it exists, null otherwise
*/
getOwnedRelation(name) { return this.getOwnedAttribute(RELATION, name); }
/**
* @param {string} name - label name
* @returns {string|null} label value if label exists, null otherwise
*/
getLabelValue(name) { return this.getAttributeValue(LABEL, name); }
/**
* @param {string} name - label name
* @returns {string|null} label value if label exists, null otherwise
*/
getOwnedLabelValue(name) { return this.getOwnedAttributeValue(LABEL, name); }
/**
* @param {string} name - relation name
* @returns {string|null} relation value if relation exists, null otherwise
*/
getRelationValue(name) { return this.getAttributeValue(RELATION, name); }
/**
* @param {string} name - relation name
* @returns {string|null} relation value if relation exists, null otherwise
*/
getOwnedRelationValue(name) { return this.getOwnedAttributeValue(RELATION, name); }
/**
* @param {string} name
* @returns {Note|null} target note of the relation or null (if target is empty or note was not found)
*/
getRelationTarget(name) {
const relation = this.getRelation(name);
return relation ? this.repository.getNote(relation.value) : null;
}
/**
* @param {string} name
* @returns {Note|null} target note of the relation or null (if target is empty or note was not found)
*/
getOwnedRelationTarget(name) {
const relation = this.getOwnedRelation(name);
return relation ? this.repository.getNote(relation.value) : null;
}
/**
* Based on enabled, label is either set or removed.
*
* @param {boolean} enabled - toggle On or Off
* @param {string} name - label name
* @param {string} [value] - label value (optional)
*/
toggleLabel(enabled, name, value) { return this.toggleAttribute(LABEL, enabled, name, value); }
/**
* Based on enabled, relation is either set or removed.
*
* @param {boolean} enabled - toggle On or Off
* @param {string} name - relation name
* @param {string} [value] - relation value (noteId)
*/
toggleRelation(enabled, name, value) { return this.toggleAttribute(RELATION, enabled, name, value); }
/**
* Update's given label's value or creates it if it doesn't exist
*
* @param {string} name - label name
* @param {string} [value] - label value
*/
setLabel(name, value) { return this.setAttribute(LABEL, name, value); }
/**
* Update's given relation's value or creates it if it doesn't exist
*
* @param {string} name - relation name
* @param {string} value - relation value (noteId)
*/
setRelation(name, value) { return this.setAttribute(RELATION, name, value); }
/**
* Remove label name-value pair, if it exists.
*
* @param {string} name - label name
* @param {string} [value] - label value
*/
removeLabel(name, value) { return this.removeAttribute(LABEL, name, value); }
/**
* Remove relation name-value pair, if it exists.
*
* @param {string} name - relation name
* @param {string} [value] - relation value (noteId)
*/
removeRelation(name, value) { return this.removeAttribute(RELATION, name, value); }
/**
* @return {string[]} return list of all descendant noteIds of this note. Returning just noteIds because number of notes can be huge. Includes also this note's noteId
*/
getDescendantNoteIds() {
return sql.getColumn(`
WITH RECURSIVE
tree(noteId) AS (
SELECT ?
UNION
SELECT branches.noteId FROM branches
JOIN tree ON branches.parentNoteId = tree.noteId
JOIN notes ON notes.noteId = branches.noteId
WHERE notes.isDeleted = 0
AND branches.isDeleted = 0
)
SELECT noteId FROM tree`, [this.noteId]);
}
/**
* Finds descendant notes with given attribute name and value. Only own attributes are considered, not inherited ones
*
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @param {string} [value] - attribute value
* @returns {Note[]}
*/
getDescendantNotesWithAttribute(type, name, value) {
const params = [this.noteId, name];
let valueCondition = "";
if (value !== undefined) {
params.push(value);
valueCondition = " AND attributes.value = ?";
}
const notes = this.repository.getEntities(`
WITH RECURSIVE
tree(noteId) AS (
SELECT ?
UNION
SELECT branches.noteId FROM branches
JOIN tree ON branches.parentNoteId = tree.noteId
JOIN notes ON notes.noteId = branches.noteId
WHERE notes.isDeleted = 0
AND branches.isDeleted = 0
)
SELECT notes.* FROM notes
JOIN tree ON tree.noteId = notes.noteId
JOIN attributes ON attributes.noteId = notes.noteId
WHERE attributes.isDeleted = 0
AND attributes.name = ?
${valueCondition}
ORDER BY noteId, position`, params);
return notes;
}
/**
* Finds descendant notes with given label name and value. Only own labels are considered, not inherited ones
*
* @param {string} name - label name
* @param {string} [value] - label value
* @returns {Note[]}
*/
getDescendantNotesWithLabel(name, value) { return this.getDescendantNotesWithAttribute(LABEL, name, value); }
/**
* Finds descendant notes with given relation name and value. Only own relations are considered, not inherited ones
*
* @param {string} name - relation name
* @param {string} [value] - relation value
* @returns {Note[]}
*/
getDescendantNotesWithRelation(name, value) { return this.getDescendantNotesWithAttribute(RELATION, name, value); }
/**
* Returns note revisions of this note.
*
* @returns {NoteRevision[]}
*/
getRevisions() {
return this.repository.getEntities("SELECT * FROM note_revisions WHERE noteId = ?", [this.noteId]);
}
/**
* Get list of links coming out of this note.
*
* @deprecated - not intended for general use
* @returns {Attribute[]}
*/
getLinks() {
return this.repository.getEntities(`
SELECT *
FROM attributes
WHERE noteId = ? AND
isDeleted = 0 AND
type = 'relation' AND
name IN ('internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink')`, [this.noteId]);
}
/**
* @returns {Branch[]}
*/
getBranches() {
return this.repository.getEntities("SELECT * FROM branches WHERE isDeleted = 0 AND noteId = ?", [this.noteId]);
}
/**
* @returns {boolean} - true if note has children
*/
hasChildren() {
return this.getChildNotes().length > 0;
}
/**
* @returns {Note[]} child notes of this note
*/
getChildNotes() {
return this.repository.getEntities(`
SELECT notes.*
FROM branches
JOIN notes USING(noteId)
WHERE notes.isDeleted = 0
AND branches.isDeleted = 0
AND branches.parentNoteId = ?
ORDER BY branches.notePosition`, [this.noteId]);
}
/**
* @returns {Branch[]} child branches of this note
*/
getChildBranches() {
return this.repository.getEntities(`
SELECT branches.*
FROM branches
WHERE branches.isDeleted = 0
AND branches.parentNoteId = ?
ORDER BY branches.notePosition`, [this.noteId]);
}
/**
* @returns {Note[]} parent notes of this note (note can have multiple parents because of cloning)
*/
getParentNotes() {
return this.repository.getEntities(`
SELECT parent_notes.*
FROM
branches AS child_tree
JOIN notes AS parent_notes ON parent_notes.noteId = child_tree.parentNoteId
WHERE child_tree.noteId = ?
AND child_tree.isDeleted = 0
AND parent_notes.isDeleted = 0`, [this.noteId]);
}
/**
* @return {string[][]} - array of notePaths (each represented by array of noteIds constituting the particular note path)
*/
getAllNotePaths() {
if (this.noteId === 'root') {
return [['root']];
}
const notePaths = [];
for (const parentNote of this.getParentNotes()) {
for (const parentPath of parentNote.getAllNotePaths()) {
parentPath.push(this.noteId);
notePaths.push(parentPath);
}
}
return notePaths;
}
getRelationDefinitions() {
return this.getLabels()
.filter(l => l.name.startsWith("relation:"));
}
getLabelDefinitions() {
return this.getLabels()
.filter(l => l.name.startsWith("relation:"));
}
/**
* @param ancestorNoteId
* @return {boolean} - true if ancestorNoteId occurs in at least one of the note's paths
*/
isDescendantOfNote(ancestorNoteId) {
const notePaths = this.getAllNotePaths();
return notePaths.some(path => path.includes(ancestorNoteId));
}
beforeSaving() {
if (!this.isDeleted) {
this.isDeleted = false;
}
if (!this.dateCreated) {
this.dateCreated = dateUtils.localNowDateTime();
}
if (!this.utcDateCreated) {
this.utcDateCreated = dateUtils.utcNowDateTime();
}
super.beforeSaving();
this.dateModified = dateUtils.localNowDateTime();
this.utcDateModified = dateUtils.utcNowDateTime();
}
// cannot be static!
updatePojo(pojo) {
if (pojo.isProtected) {
if (this.isContentAvailable) {
pojo.title = protectedSessionService.encrypt(pojo.title);
}
else {
// updating protected note outside of protected session means we will keep original ciphertexts
delete pojo.title;
}
}
delete pojo.isContentAvailable;
delete pojo.__attributeCache;
delete pojo.__ownedAttributeCache;
delete pojo.content;
/** zero references to contentHash, probably can be removed */
delete pojo.contentHash;
}
}
module.exports = Note;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</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 3.6.6</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -1,99 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: entities/note_image.js</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">Source: entities/note_image.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";
const Entity = require('./entity');
const repository = require('../services/repository');
const dateUtils = require('../services/date_utils');
/**
* This class represents image's placement in the note(s). One image may be placed into several notes.
*
* @param {string} noteImageId
* @param {string} noteId
* @param {string} imageId
* @param {boolean} isDeleted
* @param {string} dateModified
* @param {string} dateCreated
*
* @extends Entity
*/
class NoteImage extends Entity {
static get entityName() { return "note_images"; }
static get primaryKeyName() { return "noteImageId"; }
static get hashedProperties() { return ["noteImageId", "noteId", "imageId", "isDeleted", "dateCreated"]; }
async getNote() {
return await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
}
async getImage() {
return await repository.getEntity("SELECT * FROM images WHERE imageId = ?", [this.imageId]);
}
beforeSaving() {
if (!this.isDeleted) {
this.isDeleted = false;
}
if (!this.dateCreated) {
this.dateCreated = dateUtils.nowDate();
}
super.beforeSaving();
if (this.isChanged) {
this.dateModified = dateUtils.nowDate();
}
}
}
module.exports = NoteImage;</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Image.html">Image</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteImage.html">NoteImage</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Oct 07 2018 16:26:59 GMT+0200 (CEST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -1,204 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: entities/note_revision.js</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">Source: entities/note_revision.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";
const Entity = require('./entity');
const protectedSessionService = require('../services/protected_session');
const utils = require('../services/utils');
const sql = require('../services/sql');
const dateUtils = require('../services/date_utils');
const entityChangesService = require('../services/entity_changes.js');
/**
* NoteRevision represents snapshot of note's title and content at some point in the past. It's used for seamless note versioning.
*
* @property {string} noteRevisionId
* @property {string} noteId
* @property {string} type
* @property {string} mime
* @property {string} title
* @property {boolean} isProtected
* @property {string} dateLastEdited
* @property {string} dateCreated
* @property {string} utcDateLastEdited
* @property {string} utcDateCreated
* @property {string} utcDateModified
*
* @extends Entity
*/
class NoteRevision extends Entity {
static get entityName() { return "note_revisions"; }
static get primaryKeyName() { return "noteRevisionId"; }
static get hashedProperties() { return ["noteRevisionId", "noteId", "title", "isProtected", "dateLastEdited", "dateCreated", "utcDateLastEdited", "utcDateCreated", "utcDateModified"]; }
constructor(row) {
super(row);
this.isProtected = !!this.isProtected;
if (this.isProtected) {
if (protectedSessionService.isProtectedSessionAvailable()) {
this.title = protectedSessionService.decryptString(this.title);
}
else {
this.title = "[Protected]";
}
}
}
getNote() {
return this.repository.getNote(this.noteId);
}
/** @returns {boolean} true if the note has string content (not binary) */
isStringNote() {
return utils.isStringNote(this.type, this.mime);
}
/*
* Note revision content has quite special handling - it's not a separate entity, but a lazily loaded
* part of NoteRevision entity with it's own sync. Reason behind this hybrid design is that
* content can be quite large and it's not necessary to load it / fill memory for any note access even
* if we don't need a content, especially for bulk operations like search.
*
* This is the same approach as is used for Note's content.
*/
/** @returns {*} */
getContent(silentNotFoundError = false) {
if (this.content === undefined) {
const res = sql.getRow(`SELECT content FROM note_revision_contents WHERE noteRevisionId = ?`, [this.noteRevisionId]);
if (!res) {
if (silentNotFoundError) {
return undefined;
}
else {
throw new Error("Cannot find note revision content for noteRevisionId=" + this.noteRevisionId);
}
}
this.content = res.content;
if (this.isProtected) {
if (protectedSessionService.isProtectedSessionAvailable()) {
this.content = protectedSessionService.decrypt(this.content);
}
else {
this.content = "";
}
}
}
if (this.isStringNote()) {
return this.content === null
? ""
: this.content.toString("UTF-8");
}
else {
return this.content;
}
}
setContent(content) {
this.content = content;
const pojo = {
noteRevisionId: this.noteRevisionId,
content: content,
utcDateModified: dateUtils.utcNowDateTime()
};
if (this.isProtected) {
if (protectedSessionService.isProtectedSessionAvailable()) {
pojo.content = protectedSessionService.encrypt(pojo.content);
}
else {
throw new Error(`Cannot update content of noteRevisionId=${this.noteRevisionId} since we're out of protected session.`);
}
}
sql.upsert("note_revision_contents", "noteRevisionId", pojo);
const hash = utils.hash(this.noteRevisionId + "|" + content);
entityChangesService.addEntityChange({
entityName: 'note_revision_contents',
entityId: this.noteRevisionId,
hash: hash,
isErased: false,
utcDateChanged: this.getUtcDateChanged()
}, null);
}
beforeSaving() {
super.beforeSaving();
this.utcDateModified = dateUtils.utcNowDateTime();
}
// cannot be static!
updatePojo(pojo) {
if (pojo.isProtected) {
if (protectedSessionService.isProtectedSessionAvailable()) {
pojo.title = protectedSessionService.encrypt(pojo.title);
}
else {
// updating protected note outside of protected session means we will keep original ciphertexts
delete pojo.title;
}
}
delete pojo.content;
}
}
module.exports = NoteRevision;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</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 3.6.6</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -1,90 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: entities/option.js</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">Source: entities/option.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";
const Entity = require('./entity');
const dateUtils = require('../services/date_utils');
/**
* Option represents name-value pair, either directly configurable by the user or some system property.
*
* @property {string} name
* @property {string} value
* @property {boolean} isSynced
* @property {string} utcDateModified
* @property {string} utcDateCreated
*
* @extends Entity
*/
class Option extends Entity {
static get entityName() { return "options"; }
static get primaryKeyName() { return "name"; }
static get hashedProperties() { return ["name", "value"]; }
constructor(row) {
super(row);
this.isSynced = !!this.isSynced;
}
beforeSaving() {
if (!this.utcDateCreated) {
this.utcDateCreated = dateUtils.utcNowDateTime();
}
super.beforeSaving();
this.utcDateModified = dateUtils.utcNowDateTime();
}
}
module.exports = Option;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</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 3.6.6</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -1,79 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: entities/recent_note.js</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">Source: entities/recent_note.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";
const Entity = require('./entity');
const dateUtils = require('../services/date_utils');
/**
* RecentNote represents recently visited note.
*
* @property {string} noteId
* @property {string} notePath
* @property {string} utcDateCreated
*
* @extends Entity
*/
class RecentNote extends Entity {
static get entityName() { return "recent_notes"; }
static get primaryKeyName() { return "noteId"; }
beforeSaving() {
if (!this.utcDateCreated) {
this.utcDateCreated = dateUtils.utcNowDateTime();
}
super.beforeSaving();
}
}
module.exports = RecentNote;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</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 3.6.6</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -1083,7 +1083,7 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -50,7 +50,7 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -1252,7 +1252,7 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -86,21 +86,21 @@ function BackendScriptApi(currentNote, apiParams) {
* @param {string} noteId * @param {string} noteId
* @returns {Note|null} * @returns {Note|null}
*/ */
this.getNote = becca.getNote; this.getNote = noteId => becca.getNote(noteId);
/** /**
* @method * @method
* @param {string} branchId * @param {string} branchId
* @returns {Branch|null} * @returns {Branch|null}
*/ */
this.getBranch = becca.getBranch; this.getBranch = branchId => becca.getBranch(branchId);
/** /**
* @method * @method
* @param {string} attributeId * @param {string} attributeId
* @returns {Attribute|null} * @returns {Attribute|null}
*/ */
this.getAttribute = becca.getAttribute; this.getAttribute = attributeId => becca.getAttribute(attributeId);
/** /**
* This is a powerful search method - you can search by attributes and their values, e.g.: * This is a powerful search method - you can search by attributes and their values, e.g.:
@@ -457,7 +457,7 @@ module.exports = BackendScriptApi;
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -395,7 +395,7 @@ module.exports = {
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -1,410 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: sql.js</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">Source: sql.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";
/**
* @module sql
*/
const log = require('./log');
const Database = require('better-sqlite3');
const dataDir = require('./data_dir');
const cls = require('./cls');
const dbConnection = new Database(dataDir.DOCUMENT_PATH);
dbConnection.pragma('journal_mode = WAL');
[`exit`, `SIGINT`, `SIGUSR1`, `SIGUSR2`, `SIGTERM`].forEach(eventType => {
process.on(eventType, () => {
if (dbConnection) {
// closing connection is especially important to fold -wal file into the main DB file
// (see https://sqlite.org/tempfiles.html for details)
dbConnection.close();
}
});
});
function insert(tableName, rec, replace = false) {
const keys = Object.keys(rec);
if (keys.length === 0) {
log.error("Can't insert empty object into table " + tableName);
return;
}
const columns = keys.join(", ");
const questionMarks = keys.map(p => "?").join(", ");
const query = "INSERT " + (replace ? "OR REPLACE" : "") + " INTO " + tableName + "(" + columns + ") VALUES (" + questionMarks + ")";
const res = execute(query, Object.values(rec));
return res ? res.lastInsertRowid : null;
}
function replace(tableName, rec) {
return insert(tableName, rec, true);
}
function upsert(tableName, primaryKey, rec) {
const keys = Object.keys(rec);
if (keys.length === 0) {
log.error("Can't upsert empty object into table " + tableName);
return;
}
const columns = keys.join(", ");
const questionMarks = keys.map(colName => "@" + colName).join(", ");
const updateMarks = keys.map(colName => `${colName} = @${colName}`).join(", ");
const query = `INSERT INTO ${tableName} (${columns}) VALUES (${questionMarks})
ON CONFLICT (${primaryKey}) DO UPDATE SET ${updateMarks}`;
for (const idx in rec) {
if (rec[idx] === true || rec[idx] === false) {
rec[idx] = rec[idx] ? 1 : 0;
}
}
execute(query, rec);
}
const statementCache = {};
function stmt(sql) {
if (!(sql in statementCache)) {
statementCache[sql] = dbConnection.prepare(sql);
}
return statementCache[sql];
}
function getRow(query, params = []) {
return wrap(query, s => s.get(params));
}
function getRowOrNull(query, params = []) {
const all = getRows(query, params);
return all.length > 0 ? all[0] : null;
}
function getValue(query, params = []) {
const row = getRowOrNull(query, params);
if (!row) {
return null;
}
return row[Object.keys(row)[0]];
}
// smaller values can result in better performance due to better usage of statement cache
const PARAM_LIMIT = 100;
function getManyRows(query, params) {
let results = [];
while (params.length > 0) {
const curParams = params.slice(0, Math.min(params.length, PARAM_LIMIT));
params = params.slice(curParams.length);
const curParamsObj = {};
let j = 1;
for (const param of curParams) {
curParamsObj['param' + j++] = param;
}
let i = 1;
const questionMarks = curParams.map(() => ":param" + i++).join(",");
const curQuery = query.replace(/\?\?\?/g, questionMarks);
const statement = curParams.length === PARAM_LIMIT
? stmt(curQuery)
: dbConnection.prepare(curQuery);
const subResults = statement.all(curParamsObj);
results = results.concat(subResults);
}
return results;
}
function getRows(query, params = []) {
return wrap(query, s => s.all(params));
}
function getRawRows(query, params = []) {
return wrap(query, s => s.raw().all(params));
}
function iterateRows(query, params = []) {
return stmt(query).iterate(params);
}
function getMap(query, params = []) {
const map = {};
const results = getRows(query, params);
for (const row of results) {
const keys = Object.keys(row);
map[row[keys[0]]] = row[keys[1]];
}
return map;
}
function getColumn(query, params = []) {
const list = [];
const result = getRows(query, params);
if (result.length === 0) {
return list;
}
const key = Object.keys(result[0])[0];
for (const row of result) {
list.push(row[key]);
}
return list;
}
function execute(query, params = []) {
return wrap(query, s => s.run(params));
}
function executeWithoutTransaction(query, params = []) {
dbConnection.run(query, params);
}
function executeMany(query, params) {
while (params.length > 0) {
const curParams = params.slice(0, Math.min(params.length, PARAM_LIMIT));
params = params.slice(curParams.length);
const curParamsObj = {};
let j = 1;
for (const param of curParams) {
curParamsObj['param' + j++] = param;
}
let i = 1;
const questionMarks = curParams.map(() => ":param" + i++).join(",");
const curQuery = query.replace(/\?\?\?/g, questionMarks);
dbConnection.prepare(curQuery).run(curParamsObj);
}
}
function executeScript(query) {
return dbConnection.exec(query);
}
function wrap(query, func) {
const startTimestamp = Date.now();
let result;
try {
result = func(stmt(query));
}
catch (e) {
if (e.message.includes("The database connection is not open")) {
// this often happens on killing the app which puts these alerts in front of user
// in these cases error should be simply ignored.
console.log(e.message);
return null
}
throw e;
}
const milliseconds = Date.now() - startTimestamp;
if (milliseconds >= 20) {
if (query.includes("WITH RECURSIVE")) {
log.info(`Slow recursive query took ${milliseconds}ms.`);
}
else {
log.info(`Slow query took ${milliseconds}ms: ${query.trim().replace(/\s+/g, " ")}`);
}
}
return result;
}
function transactional(func) {
try {
const ret = dbConnection.transaction(func).deferred();
if (!dbConnection.inTransaction) { // i.e. transaction was really committed (and not just savepoint released)
require('./ws').sendTransactionEntityChangesToAllClients();
}
return ret;
}
catch (e) {
const entityChanges = cls.getAndClearEntityChangeIds();
if (entityChanges.length > 0) {
log.info("Transaction rollback dirtied the becca, forcing reload.");
require('../becca/becca_loader').load();
}
throw e;
}
}
function fillParamList(paramIds, truncate = true) {
if (paramIds.length === 0) {
return;
}
if (truncate) {
execute("DELETE FROM param_list");
}
paramIds = Array.from(new Set(paramIds));
if (paramIds.length > 30000) {
fillParamList(paramIds.slice(30000), false);
paramIds = paramIds.slice(0, 30000);
}
// doing it manually to avoid this showing up on the sloq query list
const s = stmt(`INSERT INTO param_list VALUES ` + paramIds.map(paramId => `(?)`).join(','), paramIds);
s.run(paramIds);
}
module.exports = {
dbConnection,
insert,
replace,
/**
* Get single value from the given query - first column from first returned row.
*
* @method
* @param {string} query - SQL query with ? used as parameter placeholder
* @param {object[]} [params] - array of params if needed
* @return [object] - single value
*/
getValue,
/**
* Get first returned row.
*
* @method
* @param {string} query - SQL query with ? used as parameter placeholder
* @param {object[]} [params] - array of params if needed
* @return {object} - map of column name to column value
*/
getRow,
getRowOrNull,
/**
* Get all returned rows.
*
* @method
* @param {string} query - SQL query with ? used as parameter placeholder
* @param {object[]} [params] - array of params if needed
* @return {object[]} - array of all rows, each row is a map of column name to column value
*/
getRows,
getRawRows,
iterateRows,
getManyRows,
/**
* Get a map of first column mapping to second column.
*
* @method
* @param {string} query - SQL query with ? used as parameter placeholder
* @param {object[]} [params] - array of params if needed
* @return {object} - map of first column to second column
*/
getMap,
/**
* Get a first column in an array.
*
* @method
* @param {string} query - SQL query with ? used as parameter placeholder
* @param {object[]} [params] - array of params if needed
* @return {object[]} - array of first column of all returned rows
*/
getColumn,
/**
* Execute SQL
*
* @method
* @param {string} query - SQL query with ? used as parameter placeholder
* @param {object[]} [params] - array of params if needed
*/
execute,
executeWithoutTransaction,
executeMany,
executeScript,
transactional,
upsert,
fillParamList
};
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="BackendScriptApi.html">BackendScriptApi</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 3.6.7</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -0,0 +1,757 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Attribute</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: Attribute</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>Attribute<span class="signature">()</span><span class="type-signature"></span></h2>
<div class="class-description">Attribute is an abstract concept which has two real uses - label (key - value pair)
and relation (representing named relationship between source and target note)</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="Attribute"><span class="type-signature"></span>new Attribute<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line7">line 7</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="attributeId"><span class="type-signature"></span>attributeId<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line16">line 16</a>
</li></ul></dd>
</dl>
<h4 class="name" id="isInheritable"><span class="type-signature"></span>isInheritable<span class="type-signature"> :boolean</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">boolean</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line28">line 28</a>
</li></ul></dd>
</dl>
<h4 class="name" id="name"><span class="type-signature"></span>name<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line22">line 22</a>
</li></ul></dd>
</dl>
<h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line18">line 18</a>
</li></ul></dd>
</dl>
<h4 class="name" id="position"><span class="type-signature"></span>position<span class="type-signature"> :int</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">int</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line26">line 26</a>
</li></ul></dd>
</dl>
<h4 class="name" id="type"><span class="type-signature"></span>type<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line20">line 20</a>
</li></ul></dd>
</dl>
<h4 class="name" id="value"><span class="type-signature"></span>value<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line24">line 24</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="getNote"><span class="type-signature"></span>getNote<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="NoteShort.html">NoteShort</a>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line32">line 32</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="NoteShort.html">NoteShort</a></span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -30,7 +30,8 @@
<h2><span class="attribs"><span class="type-signature"></span></span>Branch<span class="signature">()</span><span class="type-signature"></span></h2> <h2><span class="attribs"><span class="type-signature"></span></span>Branch<span class="signature">()</span><span class="type-signature"></span></h2>
<div class="class-description">Represents mapping between note and parent note</div> <div class="class-description">Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple
parents.</div>
</header> </header>
@@ -93,7 +94,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line2">line 2</a> <a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line5">line 5</a>
</li></ul></dd> </li></ul></dd>
@@ -143,244 +144,26 @@
<h4 class="name" id="branchId"><span class="type-signature"></span>branchId<span class="type-signature"></span></h4> <h4 class="name" id="branchId"><span class="type-signature"></span>branchId<span class="type-signature"> :string</span></h4>
<div class="description">
primary key
</div>
<h5>Type:</h5>
<ul>
<li>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line11">line 11</a>
</li></ul></dd>
</dl>
<h4 class="name" id="fromSearchNote"><span class="type-signature"></span>fromSearchNote<span class="type-signature"></span></h4> <span class="param-type">string</span>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line23">line 23</a>
</li></ul></dd>
</dl>
<h4 class="name" id="isExpanded"><span class="type-signature"></span>isExpanded<span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line21">line 21</a>
</li></ul></dd>
</dl>
<h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line13">line 13</a>
</li></ul></dd>
</dl>
<h4 class="name" id="notePosition"><span class="type-signature"></span>notePosition<span class="type-signature"></span></h4>
</li>
</ul>
@@ -433,13 +216,23 @@
<h4 class="name" id="parentNoteId"><span class="type-signature"></span>parentNoteId<span class="type-signature"></span></h4> <h4 class="name" id="fromSearchNote"><span class="type-signature"></span>fromSearchNote<span class="type-signature"> :boolean</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">boolean</span>
</li>
</ul>
@@ -473,7 +266,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line15">line 15</a> <a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line29">line 29</a>
</li></ul></dd> </li></ul></dd>
@@ -491,13 +284,91 @@
<h4 class="name" id="prefix"><span class="type-signature"></span>prefix<span class="type-signature"></span></h4> <h4 class="name" id="isExpanded"><span class="type-signature"></span>isExpanded<span class="type-signature"> :boolean</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">boolean</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line27">line 27</a>
</li></ul></dd>
</dl>
<h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -548,6 +419,210 @@
<h4 class="name" id="notePosition"><span class="type-signature"></span>notePosition<span class="type-signature"> :int</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">int</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line23">line 23</a>
</li></ul></dd>
</dl>
<h4 class="name" id="parentNoteId"><span class="type-signature"></span>parentNoteId<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line21">line 21</a>
</li></ul></dd>
</dl>
<h4 class="name" id="prefix"><span class="type-signature"></span>prefix<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line25">line 25</a>
</li></ul></dd>
</dl>
@@ -607,7 +682,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line27">line 27</a> <a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line33">line 33</a>
</li></ul></dd> </li></ul></dd>
@@ -709,7 +784,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line32">line 32</a> <a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line38">line 38</a>
</li></ul></dd> </li></ul></dd>
@@ -811,7 +886,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line37">line 37</a> <a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line43">line 43</a>
</li></ul></dd> </li></ul></dd>
@@ -913,7 +988,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line42">line 42</a> <a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line48">line 48</a>
</li></ul></dd> </li></ul></dd>
@@ -981,7 +1056,7 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -1928,7 +1928,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line437">line 437</a> <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line446">line 446</a>
</li></ul></dd> </li></ul></dd>
@@ -3147,7 +3147,7 @@ if some action needs to happen on only one specific instance.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line406">line 406</a> <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line415">line 415</a>
</li></ul></dd> </li></ul></dd>
@@ -3635,6 +3635,161 @@ otherwise (by e.g. createNoteLink())
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;<a href="NoteShort.html">NoteShort</a>></span>
</dd>
</dl>
<h4 class="name" id="getWeekNote"><span class="type-signature"></span>getWeekNote<span class="signature">(date)</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="NoteShort.html">NoteShort</a>>}</span></h4>
<div class="description">
Returns date-note for the first date of the week of the given date. If it doesn't exist, it is automatically created.
</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>date</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">e.g. "2019-04-29"</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line406">line 406</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5> <h5>Returns:</h5>
@@ -3765,7 +3920,7 @@ otherwise (by e.g. createNoteLink())
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line415">line 415</a> <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line424">line 424</a>
</li></ul></dd> </li></ul></dd>
@@ -4651,7 +4806,7 @@ otherwise (by e.g. createNoteLink())
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line464">line 464</a> <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line473">line 473</a>
</li></ul></dd> </li></ul></dd>
@@ -4805,7 +4960,7 @@ otherwise (by e.g. createNoteLink())
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line455">line 455</a> <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line464">line 464</a>
</li></ul></dd> </li></ul></dd>
@@ -5746,7 +5901,7 @@ Internally this serializes the anonymous function into string and sends it to ba
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line424">line 424</a> <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line433">line 433</a>
</li></ul></dd> </li></ul></dd>
@@ -6263,7 +6418,7 @@ Typical use case is when new note has been created, we should wait until it is s
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line448">line 448</a> <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line457">line 457</a>
</li></ul></dd> </li></ul></dd>
@@ -6309,7 +6464,7 @@ Typical use case is when new note has been created, we should wait until it is s
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">

File diff suppressed because it is too large Load Diff

View File

@@ -1,280 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: KeyboardActions</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: KeyboardActions</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>KeyboardActions<span class="signature">()</span><span class="type-signature"></span></h2>
<div class="class-description">blaa vlaa</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="KeyboardActions"><span class="type-signature"></span>new KeyboardActions<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_keyboard_actions.js.html">services/keyboard_action.js</a>, <a href="services_keyboard_actions.js.html#line5">line 5</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="JUMP_TO"><span class="type-signature"></span>JUMP_TO<span class="type-signature"></span></h4>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
<span class="param-type">string</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="services_keyboard_actions.js.html">services/keyboard_action.js</a>, <a href="services_keyboard_actions.js.html#line7">line 7</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="KeyboardActions.html">KeyboardActions</a></li><li><a href="NoteFull.html">NoteFull</a></li><li><a href="NoteShort.html">NoteShort</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 3.6.3</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -143,13 +143,23 @@
<h4 class="name" id="combinedDateModified"><span class="type-signature"></span>combinedDateModified<span class="type-signature"></span></h4> <h4 class="name" id="combinedDateModified"><span class="type-signature"></span>combinedDateModified<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -183,7 +193,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line32">line 32</a> <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line33">line 33</a>
</li></ul></dd> </li></ul></dd>
@@ -201,13 +211,23 @@
<h4 class="name" id="combinedUtcDateModified"><span class="type-signature"></span>combinedUtcDateModified<span class="type-signature"></span></h4> <h4 class="name" id="combinedUtcDateModified"><span class="type-signature"></span>combinedUtcDateModified<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -241,7 +261,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line35">line 35</a> <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line36">line 36</a>
</li></ul></dd> </li></ul></dd>
@@ -259,14 +279,28 @@
<h4 class="name" id="content"><span class="type-signature"></span>content<span class="type-signature"></span></h4> <h4 class="name" id="content"><span class="type-signature"></span>content<span class="type-signature"> :string</span></h4>
<div class="description">
can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images)
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -299,7 +333,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line12">line 12</a> <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line13">line 13</a>
</li></ul></dd> </li></ul></dd>
@@ -317,13 +351,23 @@
<h4 class="name" id="contentLength"><span class="type-signature"></span>contentLength<span class="type-signature"></span></h4> <h4 class="name" id="contentLength"><span class="type-signature"></span>contentLength<span class="type-signature"> :int</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">int</span>
</li>
</ul>
@@ -357,7 +401,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line15">line 15</a> <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line16">line 16</a>
</li></ul></dd> </li></ul></dd>
@@ -375,13 +419,23 @@
<h4 class="name" id="dateCreated"><span class="type-signature"></span>dateCreated<span class="type-signature"></span></h4> <h4 class="name" id="dateCreated"><span class="type-signature"></span>dateCreated<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -415,7 +469,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line18">line 18</a> <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line19">line 19</a>
</li></ul></dd> </li></ul></dd>
@@ -433,13 +487,23 @@
<h4 class="name" id="dateModified"><span class="type-signature"></span>dateModified<span class="type-signature"></span></h4> <h4 class="name" id="dateModified"><span class="type-signature"></span>dateModified<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -473,7 +537,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line21">line 21</a> <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line22">line 22</a>
</li></ul></dd> </li></ul></dd>
@@ -491,13 +555,23 @@
<h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"></span></h4> <h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -549,13 +623,23 @@
<h4 class="name" id="utcDateCreated"><span class="type-signature"></span>utcDateCreated<span class="type-signature"></span></h4> <h4 class="name" id="utcDateCreated"><span class="type-signature"></span>utcDateCreated<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -589,7 +673,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line24">line 24</a> <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line25">line 25</a>
</li></ul></dd> </li></ul></dd>
@@ -607,13 +691,23 @@
<h4 class="name" id="utcDateModified"><span class="type-signature"></span>utcDateModified<span class="type-signature"></span></h4> <h4 class="name" id="utcDateModified"><span class="type-signature"></span>utcDateModified<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -647,7 +741,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line27">line 27</a> <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line28">line 28</a>
</li></ul></dd> </li></ul></dd>
@@ -681,7 +775,7 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -1,464 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: NoteFull</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: NoteFull</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>NoteFull<span class="signature">()</span><span class="type-signature"></span></h2>
<div class="class-description">Represents full note, specifically including note's content.</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="NoteFull"><span class="type-signature"></span>new NoteFull<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_full.js.html">entities/note_full.js</a>, <a href="entities_note_full.js.html#line7">line 7</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="content"><span class="type-signature"></span>content<span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_full.js.html">entities/note_full.js</a>, <a href="entities_note_full.js.html#line11">line 11</a>
</li></ul></dd>
</dl>
<h4 class="name" id="dateCreated"><span class="type-signature"></span>dateCreated<span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_full.js.html">entities/note_full.js</a>, <a href="entities_note_full.js.html#line14">line 14</a>
</li></ul></dd>
</dl>
<h4 class="name" id="dateModified"><span class="type-signature"></span>dateModified<span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_full.js.html">entities/note_full.js</a>, <a href="entities_note_full.js.html#line17">line 17</a>
</li></ul></dd>
</dl>
<h4 class="name" id="utcDateCreated"><span class="type-signature"></span>utcDateCreated<span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_full.js.html">entities/note_full.js</a>, <a href="entities_note_full.js.html#line20">line 20</a>
</li></ul></dd>
</dl>
<h4 class="name" id="utcDateModified"><span class="type-signature"></span>utcDateModified<span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_full.js.html">entities/note_full.js</a>, <a href="entities_note_full.js.html#line23">line 23</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteFull.html">NoteFull</a></li><li><a href="NoteShort.html">NoteShort</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 3.6.3</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -421,13 +421,23 @@ This note's representation is used in note tree and is kept in Froca.</div>
<h4 class="name" id="isProtected"><span class="type-signature"></span>isProtected<span class="type-signature"></span></h4> <h4 class="name" id="isProtected"><span class="type-signature"></span>isProtected<span class="type-signature"> :boolean</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">boolean</span>
</li>
</ul>
@@ -479,14 +489,28 @@ This note's representation is used in note tree and is kept in Froca.</div>
<h4 class="name" id="mime"><span class="type-signature"></span>mime<span class="type-signature"></span></h4> <h4 class="name" id="mime"><span class="type-signature"></span>mime<span class="type-signature"> :string</span></h4>
<div class="description">
content-type, e.g. "application/json"
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -519,7 +543,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line65">line 65</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line71">line 71</a>
</li></ul></dd> </li></ul></dd>
@@ -537,13 +561,23 @@ This note's representation is used in note tree and is kept in Froca.</div>
<h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"></span></h4> <h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -799,13 +833,23 @@ This note's representation is used in note tree and is kept in Froca.</div>
<h4 class="name" id="title"><span class="type-signature"></span>title<span class="type-signature"></span></h4> <h4 class="name" id="title"><span class="type-signature"></span>title<span class="type-signature"> :string</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -857,14 +901,28 @@ This note's representation is used in note tree and is kept in Froca.</div>
<h4 class="name" id="type"><span class="type-signature"></span>type<span class="type-signature"></span></h4> <h4 class="name" id="type"><span class="type-signature"></span>type<span class="type-signature"> :string</span></h4>
<div class="description">
one of 'text', 'code', 'file' or 'render'
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
@@ -897,7 +955,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line63">line 63</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line66">line 66</a>
</li></ul></dd> </li></ul></dd>
@@ -1045,7 +1103,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line469">line 469</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line475">line 475</a>
</li></ul></dd> </li></ul></dd>
@@ -1245,7 +1303,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line210">line 210</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line216">line 216</a>
</li></ul></dd> </li></ul></dd>
@@ -1423,7 +1481,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line491">line 491</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line497">line 497</a>
</li></ul></dd> </li></ul></dd>
@@ -1529,7 +1587,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line133">line 133</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line139">line 139</a>
</li></ul></dd> </li></ul></dd>
@@ -1631,7 +1689,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line128">line 128</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line134">line 134</a>
</li></ul></dd> </li></ul></dd>
@@ -1733,7 +1791,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line145">line 145</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line151">line 151</a>
</li></ul></dd> </li></ul></dd>
@@ -1835,7 +1893,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line183">line 183</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line189">line 189</a>
</li></ul></dd> </li></ul></dd>
@@ -1937,7 +1995,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line188">line 188</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line194">line 194</a>
</li></ul></dd> </li></ul></dd>
@@ -2088,7 +2146,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line531">line 531</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line537">line 537</a>
</li></ul></dd> </li></ul></dd>
@@ -2255,7 +2313,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line358">line 358</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line364">line 364</a>
</li></ul></dd> </li></ul></dd>
@@ -2410,7 +2468,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line555">line 555</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line561">line 561</a>
</li></ul></dd> </li></ul></dd>
@@ -2520,7 +2578,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line680">line 680</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line683">line 683</a>
</li></ul></dd> </li></ul></dd>
@@ -2694,7 +2752,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line458">line 458</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line464">line 464</a>
</li></ul></dd> </li></ul></dd>
@@ -2894,7 +2952,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line197">line 197</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line203">line 203</a>
</li></ul></dd> </li></ul></dd>
@@ -3072,7 +3130,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line480">line 480</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line486">line 486</a>
</li></ul></dd> </li></ul></dd>
@@ -3227,7 +3285,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line525">line 525</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line531">line 531</a>
</li></ul></dd> </li></ul></dd>
@@ -3394,7 +3452,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line350">line 350</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line356">line 356</a>
</li></ul></dd> </li></ul></dd>
@@ -3549,7 +3607,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line549">line 549</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line555">line 555</a>
</li></ul></dd> </li></ul></dd>
@@ -3704,7 +3762,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line537">line 537</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line543">line 543</a>
</li></ul></dd> </li></ul></dd>
@@ -3871,7 +3929,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line423">line 423</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line429">line 429</a>
</li></ul></dd> </li></ul></dd>
@@ -4026,7 +4084,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line561">line 561</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line567">line 567</a>
</li></ul></dd> </li></ul></dd>
@@ -4132,7 +4190,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line153">line 153</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line159">line 159</a>
</li></ul></dd> </li></ul></dd>
@@ -4234,7 +4292,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line158">line 158</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line164">line 164</a>
</li></ul></dd> </li></ul></dd>
@@ -4385,7 +4443,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line543">line 543</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line549">line 549</a>
</li></ul></dd> </li></ul></dd>
@@ -4552,7 +4610,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line431">line 431</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line437">line 437</a>
</li></ul></dd> </li></ul></dd>
@@ -4707,7 +4765,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line573">line 573</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line579">line 579</a>
</li></ul></dd> </li></ul></dd>
@@ -4877,7 +4935,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line583">line 583</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line589">line 589</a>
</li></ul></dd> </li></ul></dd>
@@ -5028,7 +5086,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line567">line 567</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line573">line 573</a>
</li></ul></dd> </li></ul></dd>
@@ -5134,7 +5192,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line724">line 724</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line727">line 727</a>
</li></ul></dd> </li></ul></dd>
@@ -5247,7 +5305,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line659">line 659</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line662">line 662</a>
</li></ul></dd> </li></ul></dd>
@@ -5353,7 +5411,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line669">line 669</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line672">line 672</a>
</li></ul></dd> </li></ul></dd>
@@ -5455,7 +5513,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line597">line 597</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line603">line 603</a>
</li></ul></dd> </li></ul></dd>
@@ -5629,7 +5687,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line440">line 440</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line446">line 446</a>
</li></ul></dd> </li></ul></dd>
@@ -5735,7 +5793,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line140">line 140</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line146">line 146</a>
</li></ul></dd> </li></ul></dd>
@@ -5886,7 +5944,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line507">line 507</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line513">line 513</a>
</li></ul></dd> </li></ul></dd>
@@ -6064,7 +6122,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line449">line 449</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line455">line 455</a>
</li></ul></dd> </li></ul></dd>
@@ -6219,7 +6277,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line501">line 501</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line507">line 507</a>
</li></ul></dd> </li></ul></dd>
@@ -6374,7 +6432,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line513">line 513</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line519">line 519</a>
</li></ul></dd> </li></ul></dd>
@@ -6529,7 +6587,7 @@ This note's representation is used in note tree and is kept in Froca.</div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line519">line 519</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line525">line 525</a>
</li></ul></dd> </li></ul></dd>
@@ -6594,11 +6652,6 @@ This note's representation is used in note tree and is kept in Froca.</div>
<div class="description">
Clear note's attributes cache to force fresh reload for next attribute request.
Cache is note instance scoped.
</div>
@@ -6628,6 +6681,8 @@ Cache is note instance scoped.
<dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li>NOOP</li></ul></dd>
@@ -6640,7 +6695,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line650">line 650</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line655">line 655</a>
</li></ul></dd> </li></ul></dd>
@@ -6724,7 +6779,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line719">line 719</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line722">line 722</a>
</li></ul></dd> </li></ul></dd>
@@ -6830,7 +6885,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line711">line 711</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line714">line 714</a>
</li></ul></dd> </li></ul></dd>
@@ -6936,7 +6991,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line103">line 103</a> <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line109">line 109</a>
</li></ul></dd> </li></ul></dd>
@@ -7000,7 +7055,7 @@ Cache is note instance scoped.
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -1,85 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: branch.js</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">Source: branch.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/** Represents mapping between note and parent note */
class Branch {
constructor(froca, row) {
this.froca = froca;
/** @param {string} primary key */
this.branchId = row.branchId;
/** @param {string} */
this.noteId = row.noteId;
this.note = null;
/** @param {string} */
this.parentNoteId = row.parentNoteId;
/** @param {int} */
this.notePosition = row.notePosition;
/** @param {string} */
this.prefix = row.prefix;
/** @param {boolean} */
this.isExpanded = row.isExpanded;
}
/** @returns {NoteShort} */
async getNote() {
return await this.froca.getNote(this.noteId);
}
/** @returns {boolean} true if it's top level, meaning its parent is root note */
isTopLevel() {
return this.parentNoteId === 'root';
}
get toString() {
return `Branch(branchId=${this.branchId})`;
}
}
export default Branch;</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="NoteFull.html">NoteFull</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Aug 23 2018 12:50:56 GMT+0200 (CEST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -28,6 +28,10 @@
<article> <article>
<pre class="prettyprint source linenums"><code>import promotedAttributeDefinitionParser from '../services/promoted_attribute_definition_parser.js'; <pre class="prettyprint source linenums"><code>import promotedAttributeDefinitionParser from '../services/promoted_attribute_definition_parser.js';
/**
* Attribute is an abstract concept which has two real uses - label (key - value pair)
* and relation (representing named relationship between source and target note)
*/
class Attribute { class Attribute {
constructor(froca, row) { constructor(froca, row) {
this.froca = froca; this.froca = froca;
@@ -36,19 +40,19 @@ class Attribute {
} }
update(row) { update(row) {
/** @param {string} attributeId */ /** @type {string} */
this.attributeId = row.attributeId; this.attributeId = row.attributeId;
/** @param {string} noteId */ /** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
/** @param {string} type */ /** @type {string} */
this.type = row.type; this.type = row.type;
/** @param {string} name */ /** @type {string} */
this.name = row.name; this.name = row.name;
/** @param {string} value */ /** @type {string} */
this.value = row.value; this.value = row.value;
/** @param {int} position */ /** @type {int} */
this.position = row.position; this.position = row.position;
/** @param {boolean} isInheritable */ /** @type {boolean} */
this.isInheritable = !!row.isInheritable; this.isInheritable = !!row.isInheritable;
} }
@@ -100,7 +104,7 @@ export default Attribute;
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -26,7 +26,10 @@
<section> <section>
<article> <article>
<pre class="prettyprint source linenums"><code>/** Represents mapping between note and parent note */ <pre class="prettyprint source linenums"><code>/**
* Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple
* parents.
*/
class Branch { class Branch {
constructor(froca, row) { constructor(froca, row) {
this.froca = froca; this.froca = froca;
@@ -35,19 +38,22 @@ class Branch {
} }
update(row) { update(row) {
/** @param {string} primary key */ /**
* primary key
* @type {string}
*/
this.branchId = row.branchId; this.branchId = row.branchId;
/** @param {string} */ /** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
/** @param {string} */ /** @type {string} */
this.parentNoteId = row.parentNoteId; this.parentNoteId = row.parentNoteId;
/** @param {int} */ /** @type {int} */
this.notePosition = row.notePosition; this.notePosition = row.notePosition;
/** @param {string} */ /** @type {string} */
this.prefix = row.prefix; this.prefix = row.prefix;
/** @param {boolean} */ /** @type {boolean} */
this.isExpanded = !!row.isExpanded; this.isExpanded = !!row.isExpanded;
/** @param {boolean} */ /** @type {boolean} */
this.fromSearchNote = !!row.fromSearchNote; this.fromSearchNote = !!row.fromSearchNote;
} }
@@ -87,7 +93,7 @@ export default Branch;
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -31,35 +31,36 @@
*/ */
class NoteComplement { class NoteComplement {
constructor(row) { constructor(row) {
/** @param {string} */ /** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
/** /**
* @param {string} - can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images) * can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images)
* @type {string}
*/ */
this.content = row.content; this.content = row.content;
/** @param {int} */ /** @type {int} */
this.contentLength = row.contentLength; this.contentLength = row.contentLength;
/** @param {string} */ /** @type {string} */
this.dateCreated = row.dateCreated; this.dateCreated = row.dateCreated;
/** @param {string} */ /** @type {string} */
this.dateModified = row.dateModified; this.dateModified = row.dateModified;
/** @param {string} */ /** @type {string} */
this.utcDateCreated = row.utcDateCreated; this.utcDateCreated = row.utcDateCreated;
/** @param {string} */ /** @type {string} */
this.utcDateModified = row.utcDateModified; this.utcDateModified = row.utcDateModified;
// "combined" date modified give larger out of note's and note_content's dateModified // "combined" date modified give larger out of note's and note_content's dateModified
/** @param {string} */ /** @type {string} */
this.combinedDateModified = row.combinedDateModified; this.combinedDateModified = row.combinedDateModified;
/** @param {string} */ /** @type {string} */
this.combinedUtcDateModified = row.combinedUtcDateModified; this.combinedUtcDateModified = row.combinedUtcDateModified;
} }
} }
@@ -75,7 +76,7 @@ export default NoteComplement;
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -1,83 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: entities/note_full.js</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">Source: entities/note_full.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>import NoteShort from './note_short.js';
/**
* Represents full note, specifically including note's content.
*/
class NoteFull extends NoteShort {
constructor(froca, row, noteShort) {
super(froca, row, []);
/** @param {string} */
this.content = row.content;
/** @param {string} */
this.dateCreated = row.dateCreated;
/** @param {string} */
this.dateModified = row.dateModified;
/** @param {string} */
this.utcDateCreated = row.utcDateCreated;
/** @param {string} */
this.utcDateModified = row.utcDateModified;
/* ugly */
this.parents = noteShort.parents;
this.parentToBranch = noteShort.parentToBranch;
this.children = noteShort.children;
this.childToBranch = noteShort.childToBranch;
}
}
export default NoteFull;</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteFull.html">NoteFull</a></li><li><a href="NoteShort.html">NoteShort</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 3.6.3</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -81,15 +81,21 @@ class NoteShort {
} }
update(row) { update(row) {
/** @param {string} */ /** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
/** @param {string} */ /** @type {string} */
this.title = row.title; this.title = row.title;
/** @param {boolean} */ /** @type {boolean} */
this.isProtected = !!row.isProtected; this.isProtected = !!row.isProtected;
/** @param {string} one of 'text', 'code', 'file' or 'render' */ /**
* one of 'text', 'code', 'file' or 'render'
* @type {string}
*/
this.type = row.type; this.type = row.type;
/** @param {string} content-type, e.g. "application/json" */ /**
* content-type, e.g. "application/json"
* @type {string}
*/
this.mime = row.mime; this.mime = row.mime;
} }
@@ -672,12 +678,9 @@ class NoteShort {
} }
/** /**
* Clear note's attributes cache to force fresh reload for next attribute request. * @deprecated NOOP
* Cache is note instance scoped.
*/ */
invalidateAttributeCache() { invalidateAttributeCache() {}
this.__attributeCache = null;
}
/** /**
* Get relations which target this note * Get relations which target this note
@@ -709,7 +712,7 @@ class NoteShort {
return await this.froca.getNoteComplement(this.noteId); return await this.froca.getNoteComplement(this.noteId);
} }
get toString() { toString() {
return `Note(noteId=${this.noteId}, title=${this.title})`; return `Note(noteId=${this.noteId}, title=${this.title})`;
} }
@@ -796,7 +799,7 @@ export default NoteShort;
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -425,7 +425,7 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -50,7 +50,7 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -1,280 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: exports</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: exports</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>exports<span class="signature">()</span><span class="type-signature"></span></h2>
<div class="class-description">blaa vlaa</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="exports"><span class="type-signature"></span>new exports<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_keyboard_actions.js.html">services/keyboard_action.js</a>, <a href="services_keyboard_actions.js.html#line5">line 5</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="JUMP_TO"><span class="type-signature"></span>JUMP_TO<span class="type-signature"></span></h4>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
<span class="param-type">string</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="services_keyboard_actions.js.html">services/keyboard_action.js</a>, <a href="services_keyboard_actions.js.html#line7">line 7</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="module.exports.html">exports</a></li><li><a href="NoteFull.html">NoteFull</a></li><li><a href="NoteShort.html">NoteShort</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 3.6.3</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -1,73 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: note_full.js</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">Source: note_full.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>import NoteShort from './note_short.js';
/**
* Represents full note, specifically including note's content.
*/
class NoteFull extends NoteShort {
constructor(froca, row) {
super(froca, row);
/** @param {string} */
this.content = row.content;
if (this.content !== "" &amp;&amp; this.isJson()) {
try {
/** @param {object} */
this.jsonContent = JSON.parse(this.content);
}
catch(e) {}
}
}
}
export default NoteFull;</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="NoteFull.html">NoteFull</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Aug 23 2018 12:50:56 GMT+0200 (CEST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -1,137 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: note_short.js</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">Source: note_short.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* This note's representation is used in note tree and is kept in Froca.
* Its notable omission is the note content.
*/
class NoteShort {
constructor(froca, row) {
this.froca = froca;
/** @param {string} */
this.noteId = row.noteId;
/** @param {string} */
this.title = row.title;
/** @param {boolean} */
this.isProtected = row.isProtected;
/** @param {string} one of 'text', 'code', 'file' or 'render' */
this.type = row.type;
/** @param {string} content-type, e.g. "application/json" */
this.mime = row.mime;
/** @param {boolean} */
this.archived = row.archived;
this.cssClass = row.cssClass;
}
/** @returns {boolean} */
isJson() {
return this.mime === "application/json";
}
/** @returns {Promise&lt;Array.&lt;Branch>>} */
async getBranches() {
const branchIds = this.froca.parents[this.noteId].map(
parentNoteId => this.froca.getBranchIdByChildParent(this.noteId, parentNoteId));
return this.froca.getBranches(branchIds);
}
/** @returns {boolean} */
hasChildren() {
return this.froca.children[this.noteId]
&amp;&amp; this.froca.children[this.noteId].length > 0;
}
/** @returns {Promise&lt;Array.&lt;Branch>>} */
async getChildBranches() {
if (!this.froca.children[this.noteId]) {
return [];
}
const branchIds = this.froca.children[this.noteId].map(
childNoteId => this.froca.getBranchIdByChildParent(childNoteId, this.noteId));
return await this.froca.getBranches(branchIds);
}
/** @returns {Array.&lt;string>} */
getParentNoteIds() {
return this.froca.parents[this.noteId] || [];
}
/** @returns {Promise&lt;Array.&lt;NoteShort>>} */
async getParentNotes() {
return await this.froca.getNotes(this.getParentNoteIds());
}
/** @returns {Array.&lt;string>} */
getChildNoteIds() {
return this.froca.children[this.noteId] || [];
}
/** @returns {Promise&lt;Array.&lt;NoteShort>>} */
async getChildNotes() {
return await this.froca.getNotes(this.getChildNoteIds());
}
get toString() {
return `Note(noteId=${this.noteId}, title=${this.title})`;
}
get dto() {
const dto = Object.assign({}, this);
delete dto.froca;
delete dto.archived;
return dto;
}
}
export default NoteShort;</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="NoteFull.html">NoteFull</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Aug 23 2018 12:50:56 GMT+0200 (CEST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -424,6 +424,15 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
*/ */
this.getDateNote = dateNotesService.getDateNote; this.getDateNote = dateNotesService.getDateNote;
/**
* Returns date-note for the first date of the week of the given date. If it doesn't exist, it is automatically created.
*
* @method
* @param {string} date - e.g. "2019-04-29"
* @return {Promise&lt;NoteShort>}
*/
this.getWeekNote = dateNotesService.getWeekNote;
/** /**
* Returns month-note. If it doesn't exist, it is automatically created. * Returns month-note. If it doesn't exist, it is automatically created.
* *
@@ -503,7 +512,7 @@ export default FrontendScriptApi;
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">

View File

@@ -1,280 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: services/keyboard_action.js</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">Source: services/keyboard_action.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* blaa vlaa
*/
class KeyboardAction {
constructor(params) {
this.optionName = params.optionName;
}
}
/**
* Open "Jump to note" dialog
* @static
*/
KeyboardAction.JumpToNote = new KeyboardAction({
optionName: "JumpToNote",
defaultShortcuts: "mod+j",
description: 'Open "Jump to note" dialog'
});
/** @static */
KeyboardAction.MarkdownToHTML = new KeyboardAction({
optionName: "MarkdownToHTML",
defaultShortcuts: "mod+return"
});
/** @static */
KeyboardAction.NewTab = new KeyboardAction({
optionName: "NewTab",
defaultShortcuts: "mod+t"
});
/** @static */
KeyboardAction.CloseTab = new KeyboardAction({
optionName: "CloseTab",
defaultShortcuts: "mod+w"
});
/** @static */
KeyboardAction.NextTab = new KeyboardAction({
optionName: "NextTab",
defaultShortcuts: "mod+tab"
});
/** @static */
KeyboardAction.PreviousTab = new KeyboardAction({
optionName: "PreviousTab",
defaultShortcuts: "mod+shift+tab"
});
/** @static */
KeyboardAction.CreateNoteAfter = new KeyboardAction({
optionName: "CreateNoteAfter",
defaultShortcuts: "mod+o"
});
/** @static */
KeyboardAction.CreateNoteInto = new KeyboardAction({
optionName: "CreateNoteInto",
defaultShortcuts: "mod+p"
});
/** @static */
KeyboardAction.ScrollToActiveNote = new KeyboardAction({
optionName: "ScrollToActiveNote",
defaultShortcuts: "mod+."
});
/** @static */
KeyboardAction.CollapseTree = new KeyboardAction({
optionName: "CollapseTree",
defaultShortcuts: "alt+c"
});
/** @static */
KeyboardAction.RunSQL = new KeyboardAction({
optionName: "RunSQL",
defaultShortcuts: "mod+return"
});
/** @static */
KeyboardAction.FocusNote = new KeyboardAction({
optionName: "FocusNote",
defaultShortcuts: "return"
});
/** @static */
KeyboardAction.RunCurrentNote = new KeyboardAction({
optionName: "RunCurrentNote",
defaultShortcuts: "mod+return"
});
/** @static */
KeyboardAction.ClipboardCopy = new KeyboardAction({
optionName: "ClipboardCopy",
defaultShortcuts: "mod+c"
});
/** @static */
KeyboardAction.ClipboardPaste = new KeyboardAction({
optionName: "ClipboardPaste",
defaultShortcuts: "mod+v"
});
/** @static */
KeyboardAction.ClipboardCut = new KeyboardAction({
optionName: "ClipboardCut",
defaultShortcuts: "mod+x"
});
/** @static */
KeyboardAction.SelectAllNotesInParent = new KeyboardAction({
optionName: "SelectAllNotesInParent",
defaultShortcuts: "mod+a"
});
/** @static */
KeyboardAction.Undo = new KeyboardAction({
optionName: "Undo",
defaultShortcuts: "mod+z"
});
/** @static */
KeyboardAction.Redo = new KeyboardAction({
optionName: "Redo",
defaultShortcuts: "mod+y"
});
/** @static */
KeyboardAction.AddLinkToText = new KeyboardAction({
optionName: "AddLinkToText",
defaultShortcuts: "mod+l"
});
/** @static */
KeyboardAction.CloneNotesTo = new KeyboardAction({
optionName: "CloneNotesTo",
defaultShortcuts: "mod+shift+c"
});
/** @static */
KeyboardAction.MoveNotesTo = new KeyboardAction({
optionName: "MoveNotesTo",
defaultShortcuts: "mod+shift+c"
});
/** @static */
KeyboardAction.SearchNotes = new KeyboardAction({
optionName: "SearchNotes",
defaultShortcuts: "mod+s"
});
/** @static */
KeyboardAction.ShowAttributes = new KeyboardAction({
optionName: "ShowAttributes",
defaultShortcuts: "alt+a"
});
/** @static */
KeyboardAction.ShowHelp = new KeyboardAction({
optionName: "ShowHelp",
defaultShortcuts: "f1"
});
/** @static */
KeyboardAction.OpenSQLConsole = new KeyboardAction({
optionName: "OpenSQLConsole",
defaultShortcuts: "alt+o"
});
/** @static */
KeyboardAction.BackInNoteHistory = new KeyboardAction({
optionName: "BackInNoteHistory",
defaultShortcuts: "alt+left"
});
/** @static */
KeyboardAction.ForwardInNoteHistory = new KeyboardAction({
optionName: "ForwardInNoteHistory",
defaultShortcuts: "alt+right"
});
/** @static */
KeyboardAction.ToggleZenMode = new KeyboardAction({
optionName: "ToggleZenMode",
defaultShortcuts: "alt+m"
});
/** @static */
KeyboardAction.InsertDateTime = new KeyboardAction({
optionName: "InsertDateTime",
defaultShortcuts: "alt+t"
});
/** @static */
KeyboardAction.ReloadApp = new KeyboardAction({
optionName: "ReloadApp",
defaultShortcuts: ["f5", "mod+r"]
});
/** @static */
KeyboardAction.OpenDevTools = new KeyboardAction({
optionName: "OpenDevTools",
defaultShortcuts: "mod+shift+i"
});
/** @static */
KeyboardAction.FindInText = new KeyboardAction({
optionName: "FindInText",
defaultShortcuts: "mod+f"
});
/** @static */
KeyboardAction.ToggleFullscreen = new KeyboardAction({
optionName: "ToggleFullscreen",
defaultShortcuts: "f11"
});
/** @static */
KeyboardAction.ZoomOut = new KeyboardAction({
optionName: "ZoomOut",
defaultShortcuts: "mod+-"
});
/** @static */
KeyboardAction.ZoomIn = new KeyboardAction({
optionName: "ZoomIn",
defaultShortcuts: "mod+="
});
export default KeyboardAction;</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="KeyboardAction.html">KeyboardAction</a></li><li><a href="NoteFull.html">NoteFull</a></li><li><a href="NoteShort.html">NoteShort</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 3.6.3</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -1,61 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: services/keyboard_action.js</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">Source: services/keyboard_action.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* blaa vlaa
*/
class KeyboardActions {
constructor() {
/** @property {string} */
this.JUMP_TO = "";
}
}
export default KeyboardActions;</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="KeyboardActions.html">KeyboardActions</a></li><li><a href="NoteFull.html">NoteFull</a></li><li><a href="NoteShort.html">NoteShort</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 3.6.3</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@@ -75,7 +75,7 @@ export default class CollapsibleWidget extends NoteContextAwareWidget {
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">

67
images/icon.svg Normal file
View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg2163"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"
sodipodi:docname="cropped.svg">
<defs
id="defs2157" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.5099157"
inkscape:cx="386.95033"
inkscape:cy="314.49555"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1245"
inkscape:window-height="846"
inkscape:window-x="60"
inkscape:window-y="0"
inkscape:window-maximized="0" />
<metadata
id="metadata2160">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1">
<path
d="m 139.19968,46.483949 c -5.40456,-0.16722 -8.20491,2.3622 -8.88118,2.5968 0.61524,-1.16523 1.02694,-1.89936 2.60032,-3.53766 -5.35164,-0.0561 -10.31381,1.10208 -14.09982,4.64397 -5.07788,4.75015 -4.68312,8.68574 -4.69335,8.66634 0.001,0.002 -0.80116,-2.56646 -1.04176,-5.31354 -5.52591,7.64928 -7.70784,17.78459 -3.51825,25.34532 2.60068,-6.2738 6.73029,-11.68083 12.0523,-15.9445 0.17533,-4.47393 1.9752,-8.25394 4.82,-11.04477 -2.56716,3.0727 -3.69993,6.57331 -3.58563,10.10144 6.19019,-4.61821 13.77738,-7.6962 22.11141,-8.7062 -6.03391,1.10878 -11.50091,3.51367 -16.27929,6.7938 2.99085,1.36595 6.40645,1.58009 9.99631,0.32984 -3.4417,1.6129 -7.26228,1.87678 -11.12731,0.47202 -3.43041,2.51213 -6.48124,5.4804 -9.10343,8.74254 4.65525,1.52188 9.74725,1.2072 14.81455,-1.37548 -4.65173,3.00461 -10.11661,4.13138 -15.95614,2.85185 -2.32798,3.1242 -4.2792,6.47983 -5.80426,9.93811 1.87855,1.385 10.03089,5.73052 24.01465,-4.58153 -1.9745,-0.58349 -3.5747,-1.40864 -3.57541,-1.41005 0.0445,0.0198 1.4411,0.14817 5.52556,-2.2987 3.61104,-2.11173 6.71724,-5.9369 9.0103,-8.91434 -1.95051,-0.71861 -3.46957,-1.47285 -3.47028,-1.47461 -0.001,-10e-4 2.5206,0.16968 6.4322,-2.8247 3.48897,-2.67088 7.38399,-6.54261 7.39599,-6.43325 0.0247,0.0233 -8.59226,-6.3433 -17.63748,-6.6227"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.0352778"
id="path1983" />
<path
d="m 76.908921,60.394149 c 4.10149,-1.19228 6.7131,0.18422 7.27437,0.22948 -0.68748,-0.76706 -1.13907,-1.24548 -2.64709,-2.18406 4.08133,-1.09739 8.09089,-1.19268 11.64521,0.76111 4.7672,2.6204 5.19783,5.69818 5.20227,5.68151 -8.1e-4,0.002 0.13467,-2.11419 -0.19274,-4.25578 5.649429,4.74214 9.204969,12.03797 7.409049,18.6271 -3.15635,-4.27007 -7.320749,-7.57773 -12.183899,-9.77927 -0.96691,-3.37555 -3.04709,-5.90265 -5.74177,-7.46934 2.535,1.83627 4.0527,4.28158 4.62244,6.9933 -5.59297,-2.30039 -11.96698,-3.15163 -18.52727,-2.27895 4.82002,-0.34383 15.0298,0.35455 23.31423,7.22913 -3.27571,2.07767 -7.22761,2.84155 -11.58272,1.87121 4.116,1.37333 8.50418,1.15576 12.73066,-0.97074 2.361629,1.92282 4.478499,4.09616 6.288529,6.4319 -1.1786,1.42613 -6.602629,6.34494 -19.214749,1.23993 1.40117,-0.83377 2.47089,-1.77831 2.47129,-1.7795 -0.0302,0.0238 -1.07415,0.39703 -4.65308,-0.66304 -3.15394,-0.89808 -6.24094,-3.20205 -8.54894,-5.02006 1.35762,-0.93183 2.37896,-1.80609 2.37896,-1.80768 3.9e-4,-8.1e-4 -1.89551,0.62612 -5.44379,-0.88538 -3.16522,-1.34871 -6.86431,-3.53238 -6.85302,-3.44662 -0.0145,0.0226 5.38855,-6.52877 12.25206,-8.52425"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.040011"
id="path1985" />
<path
d="m 106.35028,116.78676 c -2.99089,-2.78316 -3.11891,-5.61706 -3.35465,-6.10128 -0.30328,0.94728 -0.48119,1.55657 -0.5271,3.26459 -2.902599,-2.81363 -4.935969,-6.06629 -5.042799,-9.9638 -0.14303,-5.226251 2.20774,-7.111581 2.19185,-7.106711 0.002,0 -1.82455,0.94068 -3.44692,2.27518 1.19194,-7.00825 5.529279,-13.56279 11.887189,-15.36164 -2.01438,4.72154 -2.73705,9.79389 -2.19847,14.89152 -2.33709,2.474751 -3.42573,5.443121 -3.41602,8.440321 0.29225,-2.99941 1.58705,-5.46485 3.56567,-7.282331 0.81185,5.747411 3.21074,11.417161 7.13399,16.382681 -2.63507,-3.79648 -7.03025,-12.54682 -5.34828,-22.784661 3.32507,1.66359 5.88686,4.53616 7.20241,8.603531 -0.86349,-4.070921 -3.18336,-7.574601 -7.01259,-9.996131 0.44853,-2.89963 1.2255,-5.72253 2.28632,-8.37424 1.76099,0.26123 8.49766,2.27917 10.39682,15.19844 -1.37647,-0.73844 -2.68363,-1.14912 -2.68496,-1.14868 0.0349,0.0129 0.85422,0.68654 1.7164,4.159181 0.78977,3.04292 0.37789,6.72937 -0.0102,9.53311 -1.43739,-0.65417 -2.66244,-1.05988 -2.66332,-1.059 -0.001,0 1.44445,1.24891 1.91637,4.92099 0.42071,3.27585 0.40659,7.40616 0.47236,7.35418 0.026,8.4e-4 -8.0584,-1.18846 -13.06411,-5.84525"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.0442482"
id="path1987" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.4 KiB

602
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
"name": "trilium", "name": "trilium",
"productName": "Trilium Notes", "productName": "Trilium Notes",
"description": "Trilium Notes", "description": "Trilium Notes",
"version": "0.48.0-beta", "version": "0.48.6",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"main": "electron.js", "main": "electron.js",
"bin": { "bin": {
@@ -15,8 +15,8 @@
"scripts": { "scripts": {
"start-server": "cross-env TRILIUM_ENV=dev node ./src/www", "start-server": "cross-env TRILIUM_ENV=dev node ./src/www",
"start-electron": "cross-env TRILIUM_ENV=dev electron --inspect=5858 .", "start-electron": "cross-env TRILIUM_ENV=dev electron --inspect=5858 .",
"build-backend-docs": "./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/backend_api src/becca/entities/*.js src/services/backend_script_api.js src/services/sql.js", "build-backend-docs": "rm -r ./docs/backend_api && ./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/backend_api src/becca/entities/*.js src/services/backend_script_api.js src/services/sql.js",
"build-frontend-docs": "./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/frontend_api src/public/app/entities/*.js src/public/app/services/frontend_script_api.js src/public/app/widgets/collapsible_widget.js", "build-frontend-docs": "rm -r ./docs/frontend_api && ./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/frontend_api src/public/app/entities/*.js src/public/app/services/frontend_script_api.js src/public/app/widgets/collapsible_widget.js",
"build-docs": "npm run build-backend-docs && npm run build-frontend-docs", "build-docs": "npm run build-backend-docs && npm run build-frontend-docs",
"webpack": "npx webpack -c webpack-desktop.config.js && npx webpack -c webpack-mobile.config.js && npx webpack -c webpack-setup.config.js", "webpack": "npx webpack -c webpack-desktop.config.js && npx webpack -c webpack-mobile.config.js && npx webpack -c webpack-setup.config.js",
"test": "jasmine", "test": "jasmine",
@@ -26,7 +26,7 @@
"dependencies": { "dependencies": {
"archiver": "5.3.0", "archiver": "5.3.0",
"async-mutex": "0.3.2", "async-mutex": "0.3.2",
"axios": "0.22.0", "axios": "0.23.0",
"better-sqlite3": "7.4.3", "better-sqlite3": "7.4.3",
"body-parser": "1.19.0", "body-parser": "1.19.0",
"chokidar": "3.5.2", "chokidar": "3.5.2",
@@ -42,7 +42,7 @@
"electron-window-state": "5.0.3", "electron-window-state": "5.0.3",
"express": "4.17.1", "express": "4.17.1",
"express-partial-content": "^1.0.2", "express-partial-content": "^1.0.2",
"express-rate-limit": "5.4.1", "express-rate-limit": "5.5.0",
"express-session": "1.17.2", "express-session": "1.17.2",
"fs-extra": "10.0.0", "fs-extra": "10.0.0",
"helmet": "4.6.0", "helmet": "4.6.0",
@@ -56,7 +56,7 @@
"is-svg": "4.3.1", "is-svg": "4.3.1",
"jimp": "0.16.1", "jimp": "0.16.1",
"joplin-turndown-plugin-gfm": "1.0.12", "joplin-turndown-plugin-gfm": "1.0.12",
"jsdom": "17.0.0", "jsdom": "18.0.0",
"mime-types": "2.1.33", "mime-types": "2.1.33",
"multer": "1.4.3", "multer": "1.4.3",
"node-abi": "3.2.0", "node-abi": "3.2.0",
@@ -66,7 +66,7 @@
"request": "^2.88.2", "request": "^2.88.2",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"sanitize-filename": "1.6.3", "sanitize-filename": "1.6.3",
"sanitize-html": "2.5.1", "sanitize-html": "2.5.2",
"sax": "1.2.4", "sax": "1.2.4",
"semver": "7.3.5", "semver": "7.3.5",
"serve-favicon": "2.5.0", "serve-favicon": "2.5.0",
@@ -81,16 +81,16 @@
}, },
"devDependencies": { "devDependencies": {
"cross-env": "7.0.3", "cross-env": "7.0.3",
"electron": "13.5.1", "electron": "13.6.1",
"electron-builder": "22.11.7", "electron-builder": "22.13.1",
"electron-packager": "15.4.0", "electron-packager": "15.4.0",
"electron-rebuild": "3.2.3", "electron-rebuild": "3.2.3",
"esm": "3.2.25", "esm": "3.2.25",
"jasmine": "3.9.0", "jasmine": "3.10.0",
"jsdoc": "3.6.7", "jsdoc": "3.6.7",
"lorem-ipsum": "2.0.4", "lorem-ipsum": "2.0.4",
"rcedit": "3.0.1", "rcedit": "3.0.1",
"webpack": "5.58.0", "webpack": "5.58.2",
"webpack-cli": "4.9.0" "webpack-cli": "4.9.0"
}, },
"optionalDependencies": { "optionalDependencies": {

View File

@@ -4,7 +4,7 @@ const Attribute = require('../../src/becca/entities/attribute.js');
const becca = require('../../src/becca/becca.js'); const becca = require('../../src/becca/becca.js');
const randtoken = require('rand-token').generator({source: 'crypto'}); const randtoken = require('rand-token').generator({source: 'crypto'});
/** @return {Note} */ /** @returns {Note} */
function findNoteByTitle(searchResults, title) { function findNoteByTitle(searchResults, title) {
return searchResults return searchResults
.map(sr => becca.notes[sr.noteId]) .map(sr => becca.notes[sr.noteId])

View File

@@ -1,8 +1,6 @@
"use strict"; "use strict";
const sql = require("../services/sql.js"); const sql = require("../services/sql.js");
const NoteRevision = require("./entities/note_revision.js");
const RecentNote = require("./entities/recent_note.js");
const NoteSet = require("../services/search/note_set"); const NoteSet = require("../services/search/note_set");
class Becca { class Becca {
@@ -27,7 +25,7 @@ class Becca {
this.loaded = false; this.loaded = false;
} }
/** @return {Attribute[]} */ /** @returns {Attribute[]} */
findAttributes(type, name) { findAttributes(type, name) {
name = name.trim().toLowerCase(); name = name.trim().toLowerCase();
@@ -38,7 +36,7 @@ class Becca {
return this.attributeIndex[`${type}-${name}`] || []; return this.attributeIndex[`${type}-${name}`] || [];
} }
/** @return {Attribute[]} */ /** @returns {Attribute[]} */
findAttributesWithPrefix(type, name) { findAttributesWithPrefix(type, name) {
const resArr = []; const resArr = [];
const key = `${type}-${name}`; const key = `${type}-${name}`;
@@ -102,6 +100,7 @@ class Becca {
getNoteRevision(noteRevisionId) { getNoteRevision(noteRevisionId) {
const row = sql.getRow("SELECT * FROM note_revisions WHERE noteRevisionId = ?", [noteRevisionId]); const row = sql.getRow("SELECT * FROM note_revisions WHERE noteRevisionId = ?", [noteRevisionId]);
const NoteRevision = require("./entities/note_revision.js"); // avoiding circular dependency problems
return row ? new NoteRevision(row) : null; return row ? new NoteRevision(row) : null;
} }
@@ -131,12 +130,14 @@ class Becca {
getRecentNotesFromQuery(query, params = []) { getRecentNotesFromQuery(query, params = []) {
const rows = sql.getRows(query, params); const rows = sql.getRows(query, params);
const RecentNote = require("./entities/recent_note.js"); // avoiding circular dependency problems
return rows.map(row => new RecentNote(row)); return rows.map(row => new RecentNote(row));
} }
getNoteRevisionsFromQuery(query, params = []) { getNoteRevisionsFromQuery(query, params = []) {
const rows = sql.getRows(query, params); const rows = sql.getRows(query, params);
const NoteRevision = require("./entities/note_revision.js"); // avoiding circular dependency problems
return rows.map(row => new NoteRevision(row)); return rows.map(row => new NoteRevision(row));
} }

View File

@@ -45,6 +45,10 @@ function load() {
new Option(row); new Option(row);
} }
for (const noteId in becca.notes) {
becca.notes[noteId].sortParents();
}
becca.loaded = true; becca.loaded = true;
log.info(`Becca (note cache) load took ${Date.now() - start}ms`); log.info(`Becca (note cache) load took ${Date.now() - start}ms`);
@@ -66,7 +70,7 @@ function postProcessEntityUpdate(entityName, entity) {
} }
} }
eventService.subscribe([eventService.ENTITY_CHANGE_SYNCED], ({entityName, entityRow}) => { eventService.subscribeBeccaLoader([eventService.ENTITY_CHANGE_SYNCED], ({entityName, entityRow}) => {
if (!becca.loaded) { if (!becca.loaded) {
return; return;
} }
@@ -89,7 +93,7 @@ eventService.subscribe([eventService.ENTITY_CHANGE_SYNCED], ({entityName, entit
postProcessEntityUpdate(entityName, entityRow); postProcessEntityUpdate(entityName, entityRow);
}); });
eventService.subscribe(eventService.ENTITY_CHANGED, ({entityName, entity}) => { eventService.subscribeBeccaLoader(eventService.ENTITY_CHANGED, ({entityName, entity}) => {
if (!becca.loaded) { if (!becca.loaded) {
return; return;
} }
@@ -97,7 +101,7 @@ eventService.subscribe(eventService.ENTITY_CHANGED, ({entityName, entity}) => {
postProcessEntityUpdate(entityName, entity); postProcessEntityUpdate(entityName, entity);
}); });
eventService.subscribe([eventService.ENTITY_DELETED, eventService.ENTITY_DELETE_SYNCED], ({entityName, entityId}) => { eventService.subscribeBeccaLoader([eventService.ENTITY_DELETED, eventService.ENTITY_DELETE_SYNCED], ({entityName, entityId}) => {
if (!becca.loaded) { if (!becca.loaded) {
return; return;
} }
@@ -151,7 +155,7 @@ function branchUpdated(branch) {
if (childNote) { if (childNote) {
childNote.flatTextCache = null; childNote.flatTextCache = null;
childNote.resortParents(); childNote.sortParents();
} }
} }
@@ -216,7 +220,7 @@ function noteReorderingUpdated(branchIdList) {
} }
} }
eventService.subscribe(eventService.ENTER_PROTECTED_SESSION, () => { eventService.subscribeBeccaLoader(eventService.ENTER_PROTECTED_SESSION, () => {
try { try {
becca.decryptProtectedNotes(); becca.decryptProtectedNotes();
} }
@@ -225,7 +229,7 @@ eventService.subscribe(eventService.ENTER_PROTECTED_SESSION, () => {
} }
}); });
eventService.subscribe(eventService.LEAVE_PROTECTED_SESSION, load); eventService.subscribeBeccaLoader(eventService.LEAVE_PROTECTED_SESSION, load);
module.exports = { module.exports = {
load, load,

View File

@@ -125,7 +125,7 @@ function getNoteTitleForPath(notePathArray) {
/** /**
* Returns notePath for noteId from cache. Note hoisting is respected. * Returns notePath for noteId from cache. Note hoisting is respected.
* Archived notes are also returned, but non-archived paths are preferred if available * Archived (and hidden) notes are also returned, but non-archived paths are preferred if available
* - this means that archived paths is returned only if there's no non-archived path * - this means that archived paths is returned only if there's no non-archived path
* - you can check whether returned path is archived using isArchived * - you can check whether returned path is archived using isArchived
*/ */
@@ -140,10 +140,6 @@ function getSomePathInner(note, path, respectHoisting) {
path.push(note.noteId); path.push(note.noteId);
path.reverse(); path.reverse();
if (path.includes("hidden")) {
return false;
}
if (respectHoisting && !path.includes(cls.getHoistedNoteId())) { if (respectHoisting && !path.includes(cls.getHoistedNoteId())) {
return false; return false;
} }

View File

@@ -14,8 +14,11 @@ class ApiToken extends AbstractEntity {
constructor(row) { constructor(row) {
super(); super();
/** @type {string} */
this.apiTokenId = row.apiTokenId; this.apiTokenId = row.apiTokenId;
/** @type {string} */
this.token = row.token; this.token = row.token;
/** @type {string} */
this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime(); this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime();
} }

View File

@@ -6,6 +6,10 @@ const sql = require("../../services/sql.js");
const dateUtils = require("../../services/date_utils.js"); const dateUtils = require("../../services/date_utils.js");
const promotedAttributeDefinitionParser = require("../../services/promoted_attribute_definition_parser"); const promotedAttributeDefinitionParser = require("../../services/promoted_attribute_definition_parser");
/**
* Attribute is an abstract concept which has two real uses - label (key - value pair)
* and relation (representing named relationship between source and target note)
*/
class Attribute extends AbstractEntity { class Attribute extends AbstractEntity {
static get entityName() { return "attributes"; } static get entityName() { return "attributes"; }
static get primaryKeyName() { return "attributeId"; } static get primaryKeyName() { return "attributeId"; }
@@ -36,21 +40,21 @@ class Attribute extends AbstractEntity {
} }
update([attributeId, noteId, type, name, value, isInheritable, position, utcDateModified]) { update([attributeId, noteId, type, name, value, isInheritable, position, utcDateModified]) {
/** @param {string} */ /** @type {string} */
this.attributeId = attributeId; this.attributeId = attributeId;
/** @param {string} */ /** @type {string} */
this.noteId = noteId; this.noteId = noteId;
/** @param {string} */ /** @type {string} */
this.type = type; this.type = type;
/** @param {string} */ /** @type {string} */
this.name = name; this.name = name;
/** @param {int} */ /** @type {int} */
this.position = position; this.position = position;
/** @param {string} */ /** @type {string} */
this.value = value; this.value = value;
/** @param {boolean} */ /** @type {boolean} */
this.isInheritable = !!isInheritable; this.isInheritable = !!isInheritable;
/** @param {string} */ /** @type {string} */
this.utcDateModified = utcDateModified; this.utcDateModified = utcDateModified;
return this; return this;
@@ -145,6 +149,10 @@ class Attribute extends AbstractEntity {
} }
} }
get isDeleted() {
return !(this.attributeId in this.becca.attributes);
}
beforeSaving() { beforeSaving() {
if (!this.value) { if (!this.value) {
if (this.type === 'relation') { if (this.type === 'relation') {

View File

@@ -5,6 +5,10 @@ const AbstractEntity = require("./abstract_entity.js");
const sql = require("../../services/sql.js"); const sql = require("../../services/sql.js");
const dateUtils = require("../../services/date_utils.js"); const dateUtils = require("../../services/date_utils.js");
/**
* Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple
* parents.
*/
class Branch extends AbstractEntity { class Branch extends AbstractEntity {
static get entityName() { return "branches"; } static get entityName() { return "branches"; }
static get primaryKeyName() { return "branchId"; } static get primaryKeyName() { return "branchId"; }
@@ -35,19 +39,19 @@ class Branch extends AbstractEntity {
} }
update([branchId, noteId, parentNoteId, prefix, notePosition, isExpanded, utcDateModified]) { update([branchId, noteId, parentNoteId, prefix, notePosition, isExpanded, utcDateModified]) {
/** @param {string} */ /** @type {string} */
this.branchId = branchId; this.branchId = branchId;
/** @param {string} */ /** @type {string} */
this.noteId = noteId; this.noteId = noteId;
/** @param {string} */ /** @type {string} */
this.parentNoteId = parentNoteId; this.parentNoteId = parentNoteId;
/** @param {string} */ /** @type {string} */
this.prefix = prefix; this.prefix = prefix;
/** @param {int} */ /** @type {int} */
this.notePosition = notePosition; this.notePosition = notePosition;
/** @param {boolean} */ /** @type {boolean} */
this.isExpanded = !!isExpanded; this.isExpanded = !!isExpanded;
/** @param {string} */ /** @type {string} */
this.utcDateModified = utcDateModified; this.utcDateModified = utcDateModified;
return this; return this;
@@ -77,7 +81,7 @@ class Branch extends AbstractEntity {
this.becca.childParentToBranch[`${this.noteId}-${this.parentNoteId}`] = this; this.becca.childParentToBranch[`${this.noteId}-${this.parentNoteId}`] = this;
} }
/** @return {Note} */ /** @returns {Note} */
get childNote() { get childNote() {
if (!(this.noteId in this.becca.notes)) { if (!(this.noteId in this.becca.notes)) {
// entities can come out of order in sync, create skeleton which will be filled later // entities can come out of order in sync, create skeleton which will be filled later
@@ -91,7 +95,7 @@ class Branch extends AbstractEntity {
return this.childNote; return this.childNote;
} }
/** @return {Note} */ /** @returns {Note} */
get parentNote() { get parentNote() {
if (!(this.parentNoteId in this.becca.notes)) { if (!(this.parentNoteId in this.becca.notes)) {
// entities can come out of order in sync, create skeleton which will be filled later // entities can come out of order in sync, create skeleton which will be filled later
@@ -101,6 +105,10 @@ class Branch extends AbstractEntity {
return this.becca.notes[this.parentNoteId]; return this.becca.notes[this.parentNoteId];
} }
get isDeleted() {
return !(this.branchId in this.becca.branches);
}
beforeSaving() { beforeSaving() {
if (this.notePosition === undefined || this.notePosition === null) { if (this.notePosition === undefined || this.notePosition === null) {
// TODO finding new position can be refactored into becca // TODO finding new position can be refactored into becca

View File

@@ -12,6 +12,9 @@ const NoteRevision = require("./note_revision.js");
const LABEL = 'label'; const LABEL = 'label';
const RELATION = 'relation'; const RELATION = 'relation';
/**
* Trilium's main entity which can represent text note, image, code note, file attachment etc.
*/
class Note extends AbstractEntity { class Note extends AbstractEntity {
static get entityName() { return "notes"; } static get entityName() { return "notes"; }
static get primaryKeyName() { return "noteId"; } static get primaryKeyName() { return "noteId"; }
@@ -45,68 +48,80 @@ class Note extends AbstractEntity {
update([noteId, title, type, mime, isProtected, dateCreated, dateModified, utcDateCreated, utcDateModified]) { update([noteId, title, type, mime, isProtected, dateCreated, dateModified, utcDateCreated, utcDateModified]) {
// ------ Database persisted attributes ------ // ------ Database persisted attributes ------
/** @param {string} */ /** @type {string} */
this.noteId = noteId; this.noteId = noteId;
/** @param {string} */ /** @type {string} */
this.title = title; this.title = title;
/** @param {boolean} */ /** @type {boolean} */
this.isProtected = !!isProtected; this.isProtected = !!isProtected;
/** @param {string} */ /** @type {string} */
this.type = type; this.type = type;
/** @param {string} */ /** @type {string} */
this.mime = mime; this.mime = mime;
/** @param {string} */ /** @type {string} */
this.dateCreated = dateCreated || dateUtils.localNowDateTime(); this.dateCreated = dateCreated || dateUtils.localNowDateTime();
/** @param {string} */ /** @type {string} */
this.dateModified = dateModified; this.dateModified = dateModified;
/** @param {string} */ /** @type {string} */
this.utcDateCreated = utcDateCreated || dateUtils.utcNowDateTime(); this.utcDateCreated = utcDateCreated || dateUtils.utcNowDateTime();
/** @param {string} */ /** @type {string} */
this.utcDateModified = utcDateModified; this.utcDateModified = utcDateModified;
// ------ Derived attributes ------ // ------ Derived attributes ------
/** @param {boolean} */ /** @type {boolean} */
this.isDecrypted = !this.isProtected; this.isDecrypted = !this.noteId || !this.isProtected;
this.decrypt(); this.decrypt();
/** @param {string|null} */ /** @type {string|null} */
this.flatTextCache = null; this.flatTextCache = null;
return this; return this;
} }
init() { init() {
/** @param {Branch[]} */ /** @type {Branch[]} */
this.parentBranches = []; this.parentBranches = [];
/** @param {Note[]} */ /** @type {Note[]} */
this.parents = []; this.parents = [];
/** @param {Note[]} */ /** @type {Note[]} */
this.children = []; this.children = [];
/** @param {Attribute[]} */ /** @type {Attribute[]} */
this.ownedAttributes = []; this.ownedAttributes = [];
/** @param {Attribute[]|null} */ /** @type {Attribute[]|null}
* @private */
this.__attributeCache = null; this.__attributeCache = null;
/** @param {Attribute[]|null} */ /** @type {Attribute[]|null}
* @private*/
this.inheritableAttributeCache = null; this.inheritableAttributeCache = null;
/** @param {Attribute[]} */ /** @type {Attribute[]} */
this.targetRelations = []; this.targetRelations = [];
this.becca.addNote(this.noteId, this); this.becca.addNote(this.noteId, this);
/** @param {Note[]|null} */ /** @type {Note[]|null}
* @private */
this.ancestorCache = null; this.ancestorCache = null;
// following attributes are filled during searching from database // following attributes are filled during searching from database
/** @param {int} size of the content in bytes */ /**
* size of the content in bytes
* @type {int|null}
*/
this.contentSize = null; this.contentSize = null;
/** @param {int} size of the content and note revision contents in bytes */ /**
* size of the content and note revision contents in bytes
* @type {int|null}
*/
this.noteSize = null; this.noteSize = null;
/** @param {int} number of note revisions for this note */ /**
* number of note revisions for this note
* @type {int|null}
*/
this.revisionCount = null; this.revisionCount = null;
} }
@@ -116,26 +131,32 @@ class Note extends AbstractEntity {
|| protectedSessionService.isProtectedSessionAvailable() || protectedSessionService.isProtectedSessionAvailable()
} }
/** @returns {Branch[]} */
getParentBranches() { getParentBranches() {
return this.parentBranches; return this.parentBranches;
} }
/** @returns {Branch[]} */
getBranches() { getBranches() {
return this.parentBranches; return this.parentBranches;
} }
/** @returns {Note[]} */
getParentNotes() { getParentNotes() {
return this.parents; return this.parents;
} }
/** @returns {Note[]} */
getChildNotes() { getChildNotes() {
return this.children; return this.children;
} }
/** @returns {boolean} */
hasChildren() { hasChildren() {
return this.children && this.children.length > 0; return this.children && this.children.length > 0;
} }
/** @returns {Branch[]} */
getChildBranches() { getChildBranches() {
return this.children.map(childNote => this.becca.getBranchFromChildAndParent(childNote.noteId, this.noteId)); return this.children.map(childNote => this.becca.getBranchFromChildAndParent(childNote.noteId, this.noteId));
} }
@@ -370,7 +391,7 @@ class Note extends AbstractEntity {
return this.__attributeCache; return this.__attributeCache;
} }
/** @return {Attribute[]} */ /** @returns {Attribute[]} */
__getInheritableAttributes(path) { __getInheritableAttributes(path) {
if (path.includes(this.noteId)) { if (path.includes(this.noteId)) {
return []; return [];
@@ -611,7 +632,7 @@ class Note extends AbstractEntity {
// will sort the parents so that non-search & non-archived are first and archived at the end // will sort the parents so that non-search & non-archived are first and archived at the end
// this is done so that non-search & non-archived paths are always explored as first when looking for note path // this is done so that non-search & non-archived paths are always explored as first when looking for note path
resortParents() { sortParents() {
this.parentBranches.sort((a, b) => this.parentBranches.sort((a, b) =>
a.branchId.startsWith('virt-') a.branchId.startsWith('virt-')
|| a.parentNote.hasInheritableOwnedArchivedLabel() ? 1 : -1); || a.parentNote.hasInheritableOwnedArchivedLabel() ? 1 : -1);
@@ -721,28 +742,38 @@ class Note extends AbstractEntity {
return !!this.targetRelations.find(rel => rel.name === 'template'); return !!this.targetRelations.find(rel => rel.name === 'template');
} }
/** @return {Note[]} */ /** @returns {Note[]} */
getSubtreeNotesIncludingTemplated() { getSubtreeNotesIncludingTemplated() {
const arr = [[this]]; const set = new Set();
for (const childNote of this.children) { function inner(note) {
arr.push(childNote.getSubtreeNotesIncludingTemplated()); if (set.has(note)) {
} return;
}
for (const targetRelation of this.targetRelations) { set.add(note);
if (targetRelation.name === 'template') {
const note = targetRelation.note;
if (note) { for (const childNote of note.children) {
arr.push(note.getSubtreeNotesIncludingTemplated()); inner(childNote);
}
for (const targetRelation of note.targetRelations) {
if (targetRelation.name === 'template') {
const targetNote = targetRelation.note;
if (targetNote) {
inner(targetNote);
}
} }
} }
} }
return arr.flat(); inner(this);
return Array.from(set);
} }
/** @return {Note[]} */ /** @returns {Note[]} */
getSubtreeNotes(includeArchived = true) { getSubtreeNotes(includeArchived = true) {
const noteSet = new Set(); const noteSet = new Set();
@@ -763,9 +794,9 @@ class Note extends AbstractEntity {
return Array.from(noteSet); return Array.from(noteSet);
} }
/** @return {String[]} */ /** @returns {String[]} */
getSubtreeNoteIds() { getSubtreeNoteIds(includeArchived = true) {
return this.getSubtreeNotes().map(note => note.noteId); return this.getSubtreeNotes(includeArchived).map(note => note.noteId);
} }
getDescendantNoteIds() { getDescendantNoteIds() {
@@ -820,6 +851,7 @@ class Note extends AbstractEntity {
return this.getAttributes().length; return this.getAttributes().length;
} }
/** @returns {Note[]} */
getAncestors() { getAncestors() {
if (!this.ancestorCache) { if (!this.ancestorCache) {
const noteIds = new Set(); const noteIds = new Set();
@@ -843,11 +875,22 @@ class Note extends AbstractEntity {
return this.ancestorCache; return this.ancestorCache;
} }
/** @returns {boolean} */
hasAncestor(ancestorNoteId) {
for (const ancestorNote of this.getAncestors()) {
if (ancestorNote.noteId === ancestorNoteId) {
return true;
}
}
return false;
}
getTargetRelations() { getTargetRelations() {
return this.targetRelations; return this.targetRelations;
} }
/** @return {Note[]} - returns only notes which are templated, does not include their subtrees /** @returns {Note[]} - returns only notes which are templated, does not include their subtrees
* in effect returns notes which are influenced by note's non-inheritable attributes */ * in effect returns notes which are influenced by note's non-inheritable attributes */
getTemplatedNotes() { getTemplatedNotes() {
const arr = [this]; const arr = [this];
@@ -1084,6 +1127,10 @@ class Note extends AbstractEntity {
} }
} }
get isDeleted() {
return !(this.noteId in this.becca.notes);
}
beforeSaving() { beforeSaving() {
super.beforeSaving(); super.beforeSaving();

View File

@@ -9,7 +9,8 @@ const entityChangesService = require('../../services/entity_changes');
const AbstractEntity = require("./abstract_entity.js"); const AbstractEntity = require("./abstract_entity.js");
/** /**
* NoteRevision represents snapshot of note's title and content at some point in the past. It's used for seamless note versioning. * NoteRevision represents snapshot of note's title and content at some point in the past.
* It's used for seamless note versioning.
*/ */
class NoteRevision extends AbstractEntity { class NoteRevision extends AbstractEntity {
static get entityName() { return "note_revisions"; } static get entityName() { return "note_revisions"; }
@@ -19,29 +20,29 @@ class NoteRevision extends AbstractEntity {
constructor(row) { constructor(row) {
super(); super();
/** @param {string} */ /** @type {string} */
this.noteRevisionId = row.noteRevisionId; this.noteRevisionId = row.noteRevisionId;
/** @param {string} */ /** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
/** @param {string} */ /** @type {string} */
this.type = row.type; this.type = row.type;
/** @param {string} */ /** @type {string} */
this.mime = row.mime; this.mime = row.mime;
/** @param {boolean} */ /** @type {boolean} */
this.isProtected = !!row.isProtected; this.isProtected = !!row.isProtected;
/** @param {string} */ /** @type {string} */
this.title = row.title; this.title = row.title;
/** @param {string} */ /** @type {string} */
this.dateLastEdited = row.dateLastEdited; this.dateLastEdited = row.dateLastEdited;
/** @param {string} */ /** @type {string} */
this.dateCreated = row.dateCreated; this.dateCreated = row.dateCreated;
/** @param {string} */ /** @type {string} */
this.utcDateLastEdited = row.utcDateLastEdited; this.utcDateLastEdited = row.utcDateLastEdited;
/** @param {string} */ /** @type {string} */
this.utcDateCreated = row.utcDateCreated; this.utcDateCreated = row.utcDateCreated;
/** @param {string} */ /** @type {string} */
this.utcDateModified = row.utcDateModified; this.utcDateModified = row.utcDateModified;
/** @param {number} */ /** @type {number} */
this.contentLength = row.contentLength; this.contentLength = row.contentLength;
if (this.isProtected) { if (this.isProtected) {
@@ -49,7 +50,7 @@ class NoteRevision extends AbstractEntity {
this.title = protectedSessionService.decryptString(this.title); this.title = protectedSessionService.decryptString(this.title);
} }
else { else {
this.title = "[Protected]"; this.title = "[protected]";
} }
} }
} }

View File

@@ -14,9 +14,13 @@ class Option extends AbstractEntity {
constructor(row) { constructor(row) {
super(); super();
/** @type {string} */
this.name = row.name; this.name = row.name;
/** @type {string} */
this.value = row.value; this.value = row.value;
/** @type {boolean} */
this.isSynced = !!row.isSynced; this.isSynced = !!row.isSynced;
/** @type {string} */
this.utcDateModified = row.utcDateModified; this.utcDateModified = row.utcDateModified;
this.becca.options[this.name] = this; this.becca.options[this.name] = this;

View File

@@ -13,8 +13,11 @@ class RecentNote extends AbstractEntity {
constructor(row) { constructor(row) {
super(); super();
/** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
/** @type {string} */
this.notePath = row.notePath; this.notePath = row.notePath;
/** @type {string} */
this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime(); this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime();
} }

View File

@@ -178,10 +178,10 @@ function buildDateLimits(baseNote) {
const dateCreatedTs = dateUtils.parseDateTime(baseNote.utcDateCreated).getTime(); const dateCreatedTs = dateUtils.parseDateTime(baseNote.utcDateCreated).getTime();
return { return {
minDate: dateUtils.utcDateStr(new Date(dateCreatedTs - 3600 * 1000)), minDate: dateUtils.utcDateTimeStr(new Date(dateCreatedTs - 3600 * 1000)),
minExcludedDate: dateUtils.utcDateStr(new Date(dateCreatedTs - 5 * 1000)), minExcludedDate: dateUtils.utcDateTimeStr(new Date(dateCreatedTs - 5 * 1000)),
maxExcludedDate: dateUtils.utcDateStr(new Date(dateCreatedTs + 5 * 1000)), maxExcludedDate: dateUtils.utcDateTimeStr(new Date(dateCreatedTs + 5 * 1000)),
maxDate: dateUtils.utcDateStr(new Date(dateCreatedTs + 3600 * 1000)), maxDate: dateUtils.utcDateTimeStr(new Date(dateCreatedTs + 3600 * 1000)),
}; };
} }

View File

@@ -11,13 +11,14 @@ export async function showDialog() {
utils.openDialog($dialog); utils.openDialog($dialog);
(await Promise.all([ (await Promise.all([
import('./options/advanced.js'),
import('./options/appearance.js'), import('./options/appearance.js'),
import('./options/shortcuts.js'),
import('./options/code_notes.js'), import('./options/code_notes.js'),
import('./options/credentials.js'), import('./options/credentials.js'),
import('./options/other.js'), import('./options/backup.js'),
import('./options/sync.js'), import('./options/sync.js'),
import('./options/keyboard_shortcuts.js'), import('./options/other.js'),
import('./options/advanced.js')
])) ]))
.map(m => new m.default) .map(m => new m.default)
.forEach(tab => { .forEach(tab => {
@@ -25,4 +26,4 @@ export async function showDialog() {
tab.optionsLoaded(options) tab.optionsLoaded(options)
} }
}); });
} }

View File

@@ -24,12 +24,6 @@ const TPL = `
<button id="anonymize-button" class="btn">Save anonymized database</button><br/><br/> <button id="anonymize-button" class="btn">Save anonymized database</button><br/><br/>
<h4>Backup database</h4>
<p>Trilium has automatic backup (daily, weekly, monthly), but you can also trigger a manual backup here.</p>
<button id="backup-database-button" class="btn">Backup database now</button><br/><br/>
<h4>Vacuum database</h4> <h4>Vacuum database</h4>
<p>This will rebuild the database which will typically result in a smaller database file. No data will be actually changed.</p> <p>This will rebuild the database which will typically result in a smaller database file. No data will be actually changed.</p>
@@ -70,12 +64,6 @@ export default class AdvancedOptions {
} }
}); });
this.$backupDatabaseButton.on('click', async () => {
const {backupFile} = await server.post('database/backup-database');
toastService.showMessage("Database has been backed up to " + backupFile, 10000);
});
this.$vacuumDatabaseButton.on('click', async () => { this.$vacuumDatabaseButton.on('click', async () => {
await server.post('database/vacuum-database'); await server.post('database/vacuum-database');

View File

@@ -163,7 +163,23 @@ const TPL = `
<p> <p>
To apply font changes, click on To apply font changes, click on
<button class="btn btn-micro" id="reload-frontend-button">reload frontend</button> <button class="btn btn-micro reload-frontend-button">reload frontend</button>
</p>
<h4>Content width</h4>
<p>Trilium by default limits max content width to improve readability for maximized screens on wide screens.</p>
<div class="form-group row">
<div class="col-4">
<label for="max-content-width">Max content width in pixels</label>
<input type="number" min="200" step="10" class="form-control" id="max-content-width">
</div>
</div>
<p>
To content width changes, click on
<button class="btn btn-micro reload-frontend-button">reload frontend</button>
</p> </p>
</form>`; </form>`;
@@ -192,7 +208,7 @@ export default class ApperanceOptions {
this.$monospaceFontSize = $("#monospace-font-size"); this.$monospaceFontSize = $("#monospace-font-size");
this.$monospaceFontFamily = $("#monospace-font-family"); this.$monospaceFontFamily = $("#monospace-font-family");
$("#reload-frontend-button").on("click", () => utils.reloadFrontendApp("font changes")); $(".reload-frontend-button").on("click", () => utils.reloadFrontendApp("changes from appearance options"));
this.$body = $("body"); this.$body = $("body");
@@ -238,6 +254,14 @@ export default class ApperanceOptions {
for (const optionName of optionsToSave) { for (const optionName of optionsToSave) {
this['$' + optionName].on('change', () => server.put(`options/${optionName}/${this['$' + optionName].val()}`)); this['$' + optionName].on('change', () => server.put(`options/${optionName}/${this['$' + optionName].val()}`));
} }
this.$maxContentWidth = $("#max-content-width");
this.$maxContentWidth.on('change', async () => {
const maxContentWidth = this.$maxContentWidth.val();
await server.put('options/maxContentWidth/' + maxContentWidth);
})
} }
toggleBodyClass(prefix, value) { toggleBodyClass(prefix, value) {
@@ -292,6 +316,8 @@ export default class ApperanceOptions {
this.$monospaceFontSize.val(options.monospaceFontSize); this.$monospaceFontSize.val(options.monospaceFontSize);
this.fillFontFamilyOptions(this.$monospaceFontFamily, options.monospaceFontFamily); this.fillFontFamilyOptions(this.$monospaceFontFamily, options.monospaceFontFamily);
this.$maxContentWidth.val(options.maxContentWidth);
} }
fillFontFamilyOptions($select, currentValue) { fillFontFamilyOptions($select, currentValue) {

View File

@@ -0,0 +1,78 @@
import server from "../../services/server.js";
import toastService from "../../services/toast.js";
const TPL = `
<h4>Automatic backup</h4>
<p>Trilium can back up the database automatically:</p>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="daily-backup-enabled">
<label class="custom-control-label" for="daily-backup-enabled">Enable daily backup</label>
</div>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="weekly-backup-enabled">
<label class="custom-control-label" for="weekly-backup-enabled">Enable weekly backup</label>
</div>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="monthly-backup-enabled">
<label class="custom-control-label" for="monthly-backup-enabled">Enable monthly backup</label>
</div>
<br/>
<p>It's recommended to keep the backup turned on, but this can make application startup slow with large databases and/or slow storage devices.</p>
<br/>
<h4>Backup now</h4>
<button id="backup-database-button" class="btn">Backup database now</button><br/><br/>
`;
export default class BackupOptions {
constructor() {
$("#options-backup").html(TPL);
this.$backupDatabaseButton = $("#backup-database-button");
this.$backupDatabaseButton.on('click', async () => {
const {backupFile} = await server.post('database/backup-database');
toastService.showMessage("Database has been backed up to " + backupFile, 10000);
});
this.$dailyBackupEnabled = $("#daily-backup-enabled");
this.$weeklyBackupEnabled = $("#weekly-backup-enabled");
this.$monthlyBackupEnabled = $("#monthly-backup-enabled");
this.$dailyBackupEnabled.on('change', () => {
const opts = { 'dailyBackupEnabled': this.$dailyBackupEnabled.is(":checked") ? "true" : "false" };
server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
return false;
});
this.$weeklyBackupEnabled.on('change', () => {
const opts = { 'weeklyBackupEnabled': this.$weeklyBackupEnabled.is(":checked") ? "true" : "false" };
server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
return false;
});
this.$monthlyBackupEnabled.on('change', () => {
const opts = { 'monthlyBackupEnabled': this.$monthlyBackupEnabled.is(":checked") ? "true" : "false" };
server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
return false;
});
}
optionsLoaded(options) {
this.$dailyBackupEnabled.prop("checked", options['dailyBackupEnabled'] === 'true');
this.$weeklyBackupEnabled.prop("checked", options['weeklyBackupEnabled'] === 'true');
this.$monthlyBackupEnabled.prop("checked", options['monthlyBackupEnabled'] === 'true');
}
}

View File

@@ -35,7 +35,7 @@ let globActions;
export default class KeyboardShortcutsOptions { export default class KeyboardShortcutsOptions {
constructor() { constructor() {
$("#options-keyboard-shortcuts").html(TPL); $("#options-shortcuts").html(TPL);
$("#options-keyboard-shortcuts-reload-app").on("click", () => utils.reloadFrontendApp()); $("#options-keyboard-shortcuts-reload-app").on("click", () => utils.reloadFrontendApp());

View File

@@ -1,5 +1,9 @@
import promotedAttributeDefinitionParser from '../services/promoted_attribute_definition_parser.js'; import promotedAttributeDefinitionParser from '../services/promoted_attribute_definition_parser.js';
/**
* Attribute is an abstract concept which has two real uses - label (key - value pair)
* and relation (representing named relationship between source and target note)
*/
class Attribute { class Attribute {
constructor(froca, row) { constructor(froca, row) {
this.froca = froca; this.froca = froca;
@@ -8,19 +12,19 @@ class Attribute {
} }
update(row) { update(row) {
/** @param {string} attributeId */ /** @type {string} */
this.attributeId = row.attributeId; this.attributeId = row.attributeId;
/** @param {string} noteId */ /** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
/** @param {string} type */ /** @type {string} */
this.type = row.type; this.type = row.type;
/** @param {string} name */ /** @type {string} */
this.name = row.name; this.name = row.name;
/** @param {string} value */ /** @type {string} */
this.value = row.value; this.value = row.value;
/** @param {int} position */ /** @type {int} */
this.position = row.position; this.position = row.position;
/** @param {boolean} isInheritable */ /** @type {boolean} */
this.isInheritable = !!row.isInheritable; this.isInheritable = !!row.isInheritable;
} }

View File

@@ -1,4 +1,7 @@
/** Represents mapping between note and parent note */ /**
* Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple
* parents.
*/
class Branch { class Branch {
constructor(froca, row) { constructor(froca, row) {
this.froca = froca; this.froca = froca;
@@ -7,19 +10,22 @@ class Branch {
} }
update(row) { update(row) {
/** @param {string} primary key */ /**
* primary key
* @type {string}
*/
this.branchId = row.branchId; this.branchId = row.branchId;
/** @param {string} */ /** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
/** @param {string} */ /** @type {string} */
this.parentNoteId = row.parentNoteId; this.parentNoteId = row.parentNoteId;
/** @param {int} */ /** @type {int} */
this.notePosition = row.notePosition; this.notePosition = row.notePosition;
/** @param {string} */ /** @type {string} */
this.prefix = row.prefix; this.prefix = row.prefix;
/** @param {boolean} */ /** @type {boolean} */
this.isExpanded = !!row.isExpanded; this.isExpanded = !!row.isExpanded;
/** @param {boolean} */ /** @type {boolean} */
this.fromSearchNote = !!row.fromSearchNote; this.fromSearchNote = !!row.fromSearchNote;
} }

View File

@@ -3,35 +3,36 @@
*/ */
class NoteComplement { class NoteComplement {
constructor(row) { constructor(row) {
/** @param {string} */ /** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
/** /**
* @param {string} - can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images) * can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images)
* @type {string}
*/ */
this.content = row.content; this.content = row.content;
/** @param {int} */ /** @type {int} */
this.contentLength = row.contentLength; this.contentLength = row.contentLength;
/** @param {string} */ /** @type {string} */
this.dateCreated = row.dateCreated; this.dateCreated = row.dateCreated;
/** @param {string} */ /** @type {string} */
this.dateModified = row.dateModified; this.dateModified = row.dateModified;
/** @param {string} */ /** @type {string} */
this.utcDateCreated = row.utcDateCreated; this.utcDateCreated = row.utcDateCreated;
/** @param {string} */ /** @type {string} */
this.utcDateModified = row.utcDateModified; this.utcDateModified = row.utcDateModified;
// "combined" date modified give larger out of note's and note_content's dateModified // "combined" date modified give larger out of note's and note_content's dateModified
/** @param {string} */ /** @type {string} */
this.combinedDateModified = row.combinedDateModified; this.combinedDateModified = row.combinedDateModified;
/** @param {string} */ /** @type {string} */
this.combinedUtcDateModified = row.combinedUtcDateModified; this.combinedUtcDateModified = row.combinedUtcDateModified;
} }
} }

View File

@@ -53,15 +53,21 @@ class NoteShort {
} }
update(row) { update(row) {
/** @param {string} */ /** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
/** @param {string} */ /** @type {string} */
this.title = row.title; this.title = row.title;
/** @param {boolean} */ /** @type {boolean} */
this.isProtected = !!row.isProtected; this.isProtected = !!row.isProtected;
/** @param {string} one of 'text', 'code', 'file' or 'render' */ /**
* one of 'text', 'code', 'file' or 'render'
* @type {string}
*/
this.type = row.type; this.type = row.type;
/** @param {string} content-type, e.g. "application/json" */ /**
* content-type, e.g. "application/json"
* @type {string}
*/
this.mime = row.mime; this.mime = row.mime;
} }
@@ -644,12 +650,9 @@ class NoteShort {
} }
/** /**
* Clear note's attributes cache to force fresh reload for next attribute request. * @deprecated NOOP
* Cache is note instance scoped.
*/ */
invalidateAttributeCache() { invalidateAttributeCache() {}
this.__attributeCache = null;
}
/** /**
* Get relations which target this note * Get relations which target this note
@@ -681,7 +684,7 @@ class NoteShort {
return await this.froca.getNoteComplement(this.noteId); return await this.froca.getNoteComplement(this.noteId);
} }
get toString() { toString() {
return `Note(noteId=${this.noteId}, title=${this.title})`; return `Note(noteId=${this.noteId}, title=${this.title})`;
} }

View File

@@ -126,13 +126,13 @@ export default class DesktopLayout {
.child( .child(
new RibbonContainer() new RibbonContainer()
.ribbon(new SearchDefinitionWidget()) .ribbon(new SearchDefinitionWidget())
.ribbon(new BasicPropertiesWidget())
.ribbon(new EditedNotesWidget()) .ribbon(new EditedNotesWidget())
.ribbon(new BookPropertiesWidget()) .ribbon(new BookPropertiesWidget())
.ribbon(new NotePropertiesWidget()) .ribbon(new NotePropertiesWidget())
.ribbon(new FilePropertiesWidget()) .ribbon(new FilePropertiesWidget())
.ribbon(new ImagePropertiesWidget()) .ribbon(new ImagePropertiesWidget())
.ribbon(new PromotedAttributesWidget()) .ribbon(new PromotedAttributesWidget())
.ribbon(new BasicPropertiesWidget())
.ribbon(new OwnedAttributeListWidget()) .ribbon(new OwnedAttributeListWidget())
.ribbon(new InheritedAttributesWidget()) .ribbon(new InheritedAttributesWidget())
.ribbon(new NotePathsWidget()) .ribbon(new NotePathsWidget())

View File

@@ -36,6 +36,7 @@ const FANCYTREE_CSS = `
margin-top: 55px; margin-top: 55px;
overflow-y: auto; overflow-y: auto;
contain: content; contain: content;
padding-left: 10px;
} }
.fancytree-custom-icon { .fancytree-custom-icon {
@@ -57,6 +58,7 @@ const FANCYTREE_CSS = `
span.fancytree-expander { span.fancytree-expander {
width: 24px !important; width: 24px !important;
margin-right: 5px;
} }
.fancytree-loading span.fancytree-expander { .fancytree-loading span.fancytree-expander {
@@ -98,18 +100,24 @@ export default class MobileLayout {
.child(new ScreenContainer("detail", "column") .child(new ScreenContainer("detail", "column")
.class("d-sm-flex d-md-flex d-lg-flex d-xl-flex col-12 col-sm-7 col-md-8 col-lg-8") .class("d-sm-flex d-md-flex d-lg-flex d-xl-flex col-12 col-sm-7 col-md-8 col-lg-8")
.css('max-height', '100%') .css('max-height', '100%')
.child(new FlexContainer('row').overflowing().filling() .child(new FlexContainer('row').overflowing().contentSized()
.css('font-size', 'larger') .css('font-size', 'larger')
.css('align-items', 'center') .css('align-items', 'center')
.child(new MobileDetailMenuWidget()) .child(new MobileDetailMenuWidget().contentSized())
.child(new NoteTitleWidget()) .child(new NoteTitleWidget()
.child(new CloseDetailButtonWidget())) .contentSized()
.css("position: relative;")
.css("top: 5px;")
)
.child(new CloseDetailButtonWidget().contentSized()))
.child( .child(
new ScrollingContainer() new ScrollingContainer()
.filling()
.overflowing()
.contentSized()
.child( .child(
new NoteDetailWidget() new NoteDetailWidget()
.css('padding', '5px 20px 10px 0') .css('padding', '5px 20px 10px 0')
.css('contain', 'content')
) )
) )
); );

View File

@@ -79,12 +79,12 @@ class AppContext extends Component {
this.triggerEvent('initialRenderComplete'); this.triggerEvent('initialRenderComplete');
} }
/** @return {Promise} */ /** @returns {Promise} */
triggerEvent(name, data) { triggerEvent(name, data) {
return this.handleEvent(name, data); return this.handleEvent(name, data);
} }
/** @return {Promise} */ /** @returns {Promise} */
triggerCommand(name, data = {}) { triggerCommand(name, data = {}) {
for (const executor of this.executors) { for (const executor of this.executors) {
const fun = executor[name + "Command"]; const fun = executor[name + "Command"];

View File

@@ -109,6 +109,10 @@ async function deleteNotes(branchIdsToDelete) {
} }
} }
if (eraseNotes) {
utils.reloadFrontendApp("erasing notes requires reload");
}
return true; return true;
} }

View File

@@ -97,7 +97,7 @@ class ContextMenu {
.append($link) .append($link)
// important to use mousedown instead of click since the former does not change focus // important to use mousedown instead of click since the former does not change focus
// (especially important for focused text for spell check) // (especially important for focused text for spell check)
.on('mousedown', (e) => { .on('mousedown', e => {
e.stopPropagation(); e.stopPropagation();
this.hide(); this.hide();

View File

@@ -2,19 +2,19 @@ import froca from "./froca.js";
import server from "./server.js"; import server from "./server.js";
import ws from "./ws.js"; import ws from "./ws.js";
/** @return {NoteShort} */ /** @returns {NoteShort} */
async function getInboxNote() { async function getInboxNote() {
const note = await server.get('special-notes/inbox/' + dayjs().format("YYYY-MM-DD"), "date-note"); const note = await server.get('special-notes/inbox/' + dayjs().format("YYYY-MM-DD"), "date-note");
return await froca.getNote(note.noteId); return await froca.getNote(note.noteId);
} }
/** @return {NoteShort} */ /** @returns {NoteShort} */
async function getTodayNote() { async function getTodayNote() {
return await getDateNote(dayjs().format("YYYY-MM-DD")); return await getDateNote(dayjs().format("YYYY-MM-DD"));
} }
/** @return {NoteShort} */ /** @returns {NoteShort} */
async function getDateNote(date) { async function getDateNote(date) {
const note = await server.get('special-notes/date/' + date, "date-note"); const note = await server.get('special-notes/date/' + date, "date-note");
@@ -23,7 +23,16 @@ async function getDateNote(date) {
return await froca.getNote(note.noteId); return await froca.getNote(note.noteId);
} }
/** @return {NoteShort} */ /** @returns {NoteShort} */
async function getWeekNote(date) {
const note = await server.get('special-notes/week/' + date, "date-note");
await ws.waitForMaxKnownEntityChangeId();
return await froca.getNote(note.noteId);
}
/** @returns {NoteShort} */
async function getMonthNote(month) { async function getMonthNote(month) {
const note = await server.get('special-notes/month/' + month, "date-note"); const note = await server.get('special-notes/month/' + month, "date-note");
@@ -32,7 +41,7 @@ async function getMonthNote(month) {
return await froca.getNote(note.noteId); return await froca.getNote(note.noteId);
} }
/** @return {NoteShort} */ /** @returns {NoteShort} */
async function getYearNote(year) { async function getYearNote(year) {
const note = await server.get('special-notes/year/' + year, "date-note"); const note = await server.get('special-notes/year/' + year, "date-note");
@@ -41,7 +50,7 @@ async function getYearNote(year) {
return await froca.getNote(note.noteId); return await froca.getNote(note.noteId);
} }
/** @return {NoteShort} */ /** @returns {NoteShort} */
async function createSqlConsole() { async function createSqlConsole() {
const note = await server.post('special-notes/sql-console'); const note = await server.post('special-notes/sql-console');
@@ -50,7 +59,7 @@ async function createSqlConsole() {
return await froca.getNote(note.noteId); return await froca.getNote(note.noteId);
} }
/** @return {NoteShort} */ /** @returns {NoteShort} */
async function createSearchNote(opts = {}) { async function createSearchNote(opts = {}) {
const note = await server.post('special-notes/search-note', opts); const note = await server.post('special-notes/search-note', opts);
@@ -63,6 +72,7 @@ export default {
getInboxNote, getInboxNote,
getTodayNote, getTodayNote,
getDateNote, getDateNote,
getWeekNote,
getMonthNote, getMonthNote,
getYearNote, getYearNote,
createSqlConsole, createSqlConsole,

View File

@@ -172,6 +172,12 @@ export default class Entrypoints extends Component {
utils.reloadFrontendApp("Switching to desktop version"); utils.reloadFrontendApp("Switching to desktop version");
} }
async switchToMobileVersionCommand() {
utils.setCookie('trilium-device', 'mobile');
utils.reloadFrontendApp("Switching to mobile version");
}
async openInWindowCommand({notePath, hoistedNoteId}) { async openInWindowCommand({notePath, hoistedNoteId}) {
if (!hoistedNoteId) { if (!hoistedNoteId) {
hoistedNoteId = 'root'; hoistedNoteId = 'root';

Some files were not shown because too many files have changed in this diff Show More