mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	Compare commits
	
		
			405 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | d3a477b8f2 | ||
|  | 01093d05d7 | ||
|  | a9b63111ae | ||
|  | ed1a731950 | ||
|  | ef974ab1f5 | ||
|  | 1cd391a132 | ||
|  | 1c15527d95 | ||
|  | 7af79ec33b | ||
|  | 4294c043d8 | ||
|  | e5b925abf8 | ||
|  | 90c0a4a437 | ||
|  | 692f7868bc | ||
|  | 5282af55f6 | ||
|  | aefc4c6bd2 | ||
|  | b39ba76505 | ||
|  | 9d918e7a54 | ||
|  | 38db7f9db7 | ||
|  | 5163e50e7d | ||
|  | 5115b33446 | ||
|  | b01fe5ead9 | ||
|  | b1d4a258a1 | ||
|  | ca041bb658 | ||
|  | 87a60e325f | ||
|  | 0a172d8bc1 | ||
|  | 67a12d3c4d | ||
|  | 5b2ba3646d | ||
|  | 148bff9f77 | ||
|  | 2132cf3bdc | ||
|  | d5271c17e3 | ||
|  | b764761e58 | ||
|  | c666fc3b98 | ||
|  | ba34df2e15 | ||
|  | 840ac2d63e | ||
|  | 5dd4586ebe | ||
|  | d09d3f5a96 | ||
|  | 3d15aeae58 | ||
|  | 9765892d18 | ||
|  | 78f8a37587 | ||
|  | 86d62866f2 | ||
|  | 1dc3fafcbf | ||
|  | 7f06952d9e | ||
|  | 78b6614eea | ||
|  | 9665e872c2 | ||
|  | 9db0a062ed | ||
|  | 055bb39e4d | ||
|  | 1261a06a30 | ||
|  | 91eb3c45d5 | ||
|  | 3944235592 | ||
|  | 5be61e6142 | ||
|  | 62ccf798ee | ||
|  | 70d6bd0157 | ||
|  | e5555beea9 | ||
|  | 9767b6269a | ||
|  | 7e486fda06 | ||
|  | 9f726304aa | ||
|  | be918628c3 | ||
|  | 602b9ae64a | ||
|  | 602a166e36 | ||
|  | aaad858395 | ||
|  | 48248224f8 | ||
|  | 79e5e3b65f | ||
|  | d0383f3044 | ||
|  | 62ecd1ad76 | ||
|  | 75b7706c2c | ||
|  | 584b176643 | ||
|  | a16555bbff | ||
|  | a749e24147 | ||
|  | bb81f110dd | ||
|  | 5dd6f49104 | ||
|  | bc6be44b19 | ||
|  | 8075265753 | ||
|  | 4a67f63abd | ||
|  | d9666210f1 | ||
|  | 5f6d562bf8 | ||
|  | f37dc66074 | ||
|  | 0b84524807 | ||
|  | 8062bb7e2a | ||
|  | 806062c8d1 | ||
|  | 83f19c0537 | ||
|  | 3a83d58b25 | ||
|  | 6fa9d996e8 | ||
|  | 1ea3d238e0 | ||
|  | eb273b7dbb | ||
|  | d2263c68f8 | ||
|  | 97d8b19868 | ||
|  | 2bc7da91a6 | ||
|  | 2b4cbb5f6b | ||
|  | 7b662b04ff | ||
|  | f8e4a665bd | ||
|  | f9a27dd90c | ||
|  | 641985737f | ||
|  | 121e4ba2ea | ||
|  | 01474ecd2d | ||
|  | 82e4e28e7b | ||
|  | 886ee0dbcb | ||
|  | 6f7fbacca1 | ||
|  | 8da5b90aea | ||
|  | e7d57bc08f | ||
|  | 041758766a | ||
|  | f2a510e4c5 | ||
|  | 4717242dc7 | ||
|  | c1865f8564 | ||
|  | 515c5411a6 | ||
|  | 3f7a5504c7 | ||
|  | 8c7c37cf98 | ||
|  | c0f48c0e99 | ||
|  | abedf2bba4 | ||
|  | bb0137b2fd | ||
|  | 6c54c7d17d | ||
|  | 90255ac55b | ||
|  | e741c2826c | ||
|  | 026992db78 | ||
|  | 33780c1e17 | ||
|  | ede9c43f67 | ||
|  | 5c12ac4eee | ||
|  | 522518cf0d | ||
|  | 1d869d25c2 | ||
|  | a9cdd93cb4 | ||
|  | 4240da349d | ||
|  | c257bc07a8 | ||
|  | 00eaa16985 | ||
|  | fefb059564 | ||
|  | 9166765ced | ||
|  | 6ae7661603 | ||
|  | 30e75056bd | ||
|  | 530e56dcb5 | ||
|  | 63675bfbae | ||
|  | 696ce38083 | ||
|  | 12014b9f4d | ||
|  | e8b52f9e6c | ||
|  | 04b125afc0 | ||
|  | 2a7fe85020 | ||
|  | 119050e355 | ||
|  | 72122d0f95 | ||
|  | bd22863bb7 | ||
|  | ce3834eb9e | ||
|  | 8edb5428e5 | ||
|  | 527718eff7 | ||
|  | 5b0f487f3f | ||
|  | a3fa8341ba | ||
|  | 04813743e2 | ||
|  | ddf75cd5e5 | ||
|  | d0e5ad5b7e | ||
|  | b4631e927c | ||
|  | b7bc843a37 | ||
|  | 98d65f8767 | ||
|  | 0599891ec0 | ||
|  | cc06701565 | ||
|  | 40683985cd | ||
|  | 074e13a889 | ||
|  | 98b0baefe2 | ||
|  | 3aad0ebc95 | ||
|  | 479d720a6e | ||
|  | e4892c9888 | ||
|  | f8c9178c5d | ||
|  | 83049c95c3 | ||
|  | bc8f531b33 | ||
|  | 23278f54cb | ||
|  | 18801fb3e1 | ||
|  | dc0a0dcf09 | ||
|  | 04c306b360 | ||
|  | d6a4f1db13 | ||
|  | 84c4b368c8 | ||
|  | 4307f25205 | ||
|  | 48f03f7a1b | ||
|  | 9d24499fef | ||
|  | df97b269a7 | ||
|  | ee6fb98a0d | ||
|  | 13e30e5855 | ||
|  | 5ab2ec0f13 | ||
|  | 8465d7fa68 | ||
|  | d153fc7ba5 | ||
|  | 1a7c2d4c32 | ||
|  | b3381a3b53 | ||
|  | ac0d61e9b4 | ||
|  | b13a6ced19 | ||
|  | b61aab06b5 | ||
|  | 64b86b2666 | ||
|  | 27e6fa9526 | ||
|  | 3d31742285 | ||
|  | 2b2f4fbc07 | ||
|  | 513bf252cd | ||
|  | f591e954f3 | ||
|  | 59de1925a9 | ||
|  | 6c1011341c | ||
|  | 906082a6b2 | ||
|  | 30bcd1764a | ||
|  | cea54aecad | ||
|  | ff6f2a4d44 | ||
|  | 5f6fded833 | ||
|  | fed5f1a7d2 | ||
|  | a06ee1ced1 | ||
|  | 332b92791e | ||
|  | d4a9461460 | ||
|  | 2dac6ab281 | ||
|  | 4d00404f55 | ||
|  | 3adab07ddb | ||
|  | 3d0c3652ce | ||
|  | c3f5bb5518 | ||
|  | b2d460d5c1 | ||
|  | d475346a09 | ||
|  | ca41806bc2 | ||
|  | a748710b01 | ||
|  | ac9a4b3afc | ||
|  | b7f0fd2db3 | ||
|  | 7d6c847d47 | ||
|  | 6ec6d66f17 | ||
|  | 977089cc28 | ||
|  | c3f8975166 | ||
|  | 639f80b603 | ||
|  | 927da84d3b | ||
|  | b8c9943deb | ||
|  | bb6ab0fe45 | ||
|  | 0c86dece5f | ||
|  | b7b0bd80ed | ||
|  | f06207207b | ||
|  | 068684101f | ||
|  | f78d96a3d4 | ||
|  | a0d958bf12 | ||
|  | 0802b81807 | ||
|  | 192e399cb5 | ||
|  | fc564f6aed | ||
|  | eb34f9c64f | ||
|  | 48029cea7c | ||
|  | f4ec4e58c7 | ||
|  | faa402fcda | ||
|  | 788841d256 | ||
|  | b7c37fdf58 | ||
|  | a46c5a2243 | ||
|  | 430f2975f8 | ||
|  | dd8226ff4c | ||
|  | 807b442c7a | ||
|  | a452e4add5 | ||
|  | 48b30b985e | ||
|  | 05d2f4fe96 | ||
|  | 85a75fc186 | ||
|  | ddda4d9867 | ||
|  | 42c8059ae1 | ||
|  | 0f4eb8ff4c | ||
|  | 8ee537e2eb | ||
|  | 8eb091445b | ||
|  | 1fc23c948e | ||
|  | cb2b97635a | ||
|  | 8fb42e4517 | ||
|  | edae1a5d1c | ||
|  | 08398a1417 | ||
|  | 712304bbc6 | ||
|  | afb893c157 | ||
|  | ebccd48013 | ||
|  | 54065672aa | ||
|  | 8394ce8002 | ||
|  | 176784834f | ||
|  | a47004bb4e | ||
|  | 995f1c9fc4 | ||
|  | 1f3b6feaff | ||
|  | 8095c77b91 | ||
|  | 6cfd18b29b | ||
|  | defd997424 | ||
|  | 5905950c17 | ||
|  | 691fccb769 | ||
|  | bbe3f436d3 | ||
|  | af053b61fc | ||
|  | a2cd6f92d7 | ||
|  | 3ff5fe61b2 | ||
|  | 75c6afd1c3 | ||
|  | 8d2958738f | ||
|  | 0496412f4a | ||
|  | f80a20d18c | ||
|  | 34c642a49a | ||
|  | 2ebbc33081 | ||
|  | ac56056f65 | ||
|  | 6f16b4caec | ||
|  | fbc805a221 | ||
|  | 41844cf817 | ||
|  | b97ebe9f03 | ||
|  | 08ec866dd2 | ||
|  | 38839532d5 | ||
|  | 0234ff5fca | ||
|  | 44bcfd47c0 | ||
|  | 69c7eb14aa | ||
|  | 00453fc151 | ||
|  | 5c393f959d | ||
|  | e6bf6424e8 | ||
|  | 57702a07a2 | ||
|  | 3b3f6082a7 | ||
|  | 49241ab318 | ||
|  | 93addac8bb | ||
|  | fe908759d1 | ||
|  | 779751a234 | ||
|  | cb9feab7b2 | ||
|  | b79631a35d | ||
|  | c177aaa901 | ||
|  | eff3e1df85 | ||
|  | b46d5f4a71 | ||
|  | 5b421d51b5 | ||
|  | 8852e8e531 | ||
|  | cde13dc580 | ||
|  | 3e3d7aa4d7 | ||
|  | 446c41d020 | ||
|  | 33fdad5159 | ||
|  | 463d145cb7 | ||
|  | 1413756d00 | ||
|  | 50ec17433d | ||
|  | 2c8eb82d42 | ||
|  | 045ee18237 | ||
|  | 0a66809bf0 | ||
|  | ecfdde2f2a | ||
|  | 92d5aeae41 | ||
|  | d2d286a4ff | ||
|  | 86861f6ec3 | ||
|  | f4b5d43899 | ||
|  | 235b779dec | ||
|  | df17840dbc | ||
|  | 9d52f80c2f | ||
|  | 0aa119af2c | ||
|  | c2f70031d0 | ||
|  | 8e913cb453 | ||
|  | 579ed7e194 | ||
|  | e20fac19ba | ||
|  | 9e9fb2979f | ||
|  | 1f8798d7ac | ||
|  | af95d387b9 | ||
|  | 76196ed42c | ||
|  | 8a6002c6be | ||
|  | 38781d33ac | ||
|  | ff5d3a5f0c | ||
|  | 626af84f42 | ||
|  | b05ce12e7b | ||
|  | 274505188b | ||
|  | f85209a72f | ||
|  | 291f0e79d9 | ||
|  | 64db5e2542 | ||
|  | 9f5f0aeddd | ||
|  | 4d5612e845 | ||
|  | 371f174756 | ||
|  | 8284c673f9 | ||
|  | cc02546ed3 | ||
|  | 2aa987c072 | ||
|  | a06ddc439d | ||
|  | f6944b8219 | ||
|  | fa3cbb4645 | ||
|  | 6dfc72c065 | ||
|  | 0af6f91d21 | ||
|  | 5e1f81e53e | ||
|  | 9cdcbb3125 | ||
|  | 35338e9ec6 | ||
|  | 78d83b8826 | ||
|  | 8edf06d28d | ||
|  | ecd2a5cbac | ||
|  | c0cf319521 | ||
|  | 9b32d86f78 | ||
|  | fbffc6b2b5 | ||
|  | cd01886eb2 | ||
|  | d8bc9c2982 | ||
|  | d232694dec | ||
|  | 735ac55bb8 | ||
|  | 330e7ac08e | ||
|  | 49fb913eab | ||
|  | 4b074365e7 | ||
|  | 5e2efca933 | ||
|  | e71b0d82a1 | ||
|  | c6c162cdda | ||
|  | 8b46d6c718 | ||
|  | e28fbf4617 | ||
|  | 0e4a040ed8 | ||
|  | b84670d503 | ||
|  | f01657e1dd | ||
|  | 34ecd77bd4 | ||
|  | 6cf0fe0b73 | ||
|  | 3f8bf7cacc | ||
|  | 17128c5874 | ||
|  | 9e71c44c76 | ||
|  | 54c0268593 | ||
|  | a5f0b2a81e | ||
|  | a154bea016 | ||
|  | 15a11daf38 | ||
|  | 5d6d9ab6d6 | ||
|  | 2bc78ccafb | ||
|  | 53aebf1448 | ||
|  | fa406d3ded | ||
|  | 9be524ef89 | ||
|  | fd8a2d4d92 | ||
|  | 0b270ee87a | ||
|  | 5cc5859211 | ||
|  | bd489d5780 | ||
|  | a24c56a9d5 | ||
|  | 95e38a037b | ||
|  | 256b800d0e | ||
|  | b3c4c850db | ||
|  | e698aa5822 | ||
|  | 1fdb23746a | ||
|  | 9cd5bdeb53 | ||
|  | e6183b9a1d | ||
|  | d83005fe4d | ||
|  | 2b84f1be00 | ||
|  | bb45c67e60 | ||
|  | 515fb4e5db | ||
|  | b6efc954bd | ||
|  | eee05a4d01 | ||
|  | dc97400dbf | ||
|  | e16bedfab4 | ||
|  | 5a8e216dec | ||
|  | 1faf8225c7 | ||
|  | 5225a99995 | ||
|  | 929f8ef720 | 
| @@ -75,8 +75,6 @@ module.exports = { | |||||||
|         glob: true, |         glob: true, | ||||||
|         log: true, |         log: true, | ||||||
|         EditorWatchdog: true, |         EditorWatchdog: true, | ||||||
|         baseApiUrl: true, |  | ||||||
|         // \src\share\canvas_share.js |  | ||||||
|         React: true, |         React: true, | ||||||
|         appState: true, |         appState: true, | ||||||
|         ExcalidrawLib: true, |         ExcalidrawLib: true, | ||||||
| @@ -93,17 +91,16 @@ module.exports = { | |||||||
|         renderMathInElement: true, |         renderMathInElement: true, | ||||||
|         // \src\public\app\widgets\type_widgets\editable_text.js |         // \src\public\app\widgets\type_widgets\editable_text.js | ||||||
|         BalloonEditor: true, |         BalloonEditor: true, | ||||||
|  |         FancytreeNode: true, | ||||||
|         CKEditorInspector: true, |         CKEditorInspector: true, | ||||||
|         // \src\public\app\widgets\type_widgets\editable_code.js |         // \src\public\app\widgets\type_widgets\editable_code.js | ||||||
|         CodeMirror: true, |         CodeMirror: true, | ||||||
|         // \src\public\app\services\resizer.js |         // \src\public\app\services\resizer.js | ||||||
|         Split: true, |         Split: true, | ||||||
|         // \src\public\app\services\note_content_renderer.js |         // \src\public\app\services\content_renderer.js | ||||||
|         mermaid: true, |         mermaid: true, | ||||||
|         // src\public\app\services\frontend_script_api.js |         // src\public\app\services\frontend_script_api.js | ||||||
|         dayjs: true, |         dayjs: true, | ||||||
|         // \src\public\app\widgets\dialogs\markdown_import.js |  | ||||||
|         commonmark: true, |  | ||||||
|         // \src\public\app\widgets\note_map.js |         // \src\public\app\widgets\note_map.js | ||||||
|         ForceGraph: true, |         ForceGraph: true, | ||||||
|         // \src\public\app\setup.js |         // \src\public\app\setup.js | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ image: | |||||||
|   file: .gitpod.dockerfile |   file: .gitpod.dockerfile | ||||||
|  |  | ||||||
| tasks: | tasks: | ||||||
|     - before: nvm install 16.19.1 && nvm use 16.19.1 |     - before: nvm install 18.18.2 && nvm use 18.18.2 | ||||||
|       init: npm install |       init: npm install | ||||||
|       command: npm run start-server |       command: npm run start-server | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								.idea/dataSources.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								.idea/dataSources.xml
									
									
									
										generated
									
									
									
								
							| @@ -1,11 +1,11 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||||
| <project version="4"> | <project version="4"> | ||||||
|   <component name="DataSourceManagerImpl" format="xml" multifile-model="true"> |   <component name="DataSourceManagerImpl" format="xml" multifile-model="true"> | ||||||
|     <data-source source="LOCAL" name="SQLite - document.db" uuid="30cef30d-e704-484d-a4ca-5d3bfc2ece63"> |     <data-source source="LOCAL" name="document.db" uuid="2a4ac1e6-b828-4a2a-8e4a-3f59f10aff26"> | ||||||
|       <driver-ref>sqlite.xerial</driver-ref> |       <driver-ref>sqlite.xerial</driver-ref> | ||||||
|       <synchronize>true</synchronize> |       <synchronize>true</synchronize> | ||||||
|       <jdbc-driver>org.sqlite.JDBC</jdbc-driver> |       <jdbc-driver>org.sqlite.JDBC</jdbc-driver> | ||||||
|       <jdbc-url>jdbc:sqlite:$PROJECT_DIR$/../trilium-data/document.db</jdbc-url> |       <jdbc-url>jdbc:sqlite:$PROJECT_DIR$/data/document.db</jdbc-url> | ||||||
|       <working-dir>$ProjectFileDir$</working-dir> |       <working-dir>$ProjectFileDir$</working-dir> | ||||||
|     </data-source> |     </data-source> | ||||||
|   </component> |   </component> | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							| @@ -1,4 +1,3 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> | <project version="4"> | ||||||
|   <component name="JavaScriptSettings"> |   <component name="JavaScriptSettings"> | ||||||
|     <option name="languageLevel" value="ES6" /> |     <option name="languageLevel" value="ES6" /> | ||||||
|   | |||||||
| @@ -1,11 +1,13 @@ | |||||||
| //https://prettier.io/docs/en/options.html | //https://prettier.io/docs/en/options.html | ||||||
| module.exports = { | module.exports = { | ||||||
| 	semi: true, | 	semi: true, | ||||||
| 	trailingComma: 'es5', | 	trailingComma: 'none', | ||||||
| 	singleQuote: true, | 	singleQuote: true, | ||||||
| 	printWidth: 120, | 	printWidth: 100, | ||||||
| 	tabWidth: 4, | 	tabWidth: 4, | ||||||
| 	// useTabs: false, | 	useTabs: false, | ||||||
| 	// bracketSpacing: true, | 	quoteProps: "as-needed", | ||||||
|  | 	bracketSpacing: true, | ||||||
|  | 	arrowParens: "avoid" | ||||||
| 	// htmlWhitespaceSensitivity: 'ignore', | 	// htmlWhitespaceSensitivity: 'ignore', | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| # !!! Don't try to build this Dockerfile directly, run it through bin/build-docker.sh script !!! | # !!! Don't try to build this Dockerfile directly, run it through bin/build-docker.sh script !!! | ||||||
| FROM node:16.19.1-alpine | FROM node:18.18.2-alpine | ||||||
|  |  | ||||||
| # Create app directory | # Create app directory | ||||||
| WORKDIR /usr/src/app | WORKDIR /usr/src/app | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -5,18 +5,3 @@ 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" |  | ||||||
|   | |||||||
| @@ -24,9 +24,6 @@ mv "./dist/Trilium Notes-linux-x64" $BUILD_DIR | |||||||
|  |  | ||||||
| cp images/app-icons/png/128x128.png $BUILD_DIR/icon.png | cp images/app-icons/png/128x128.png $BUILD_DIR/icon.png | ||||||
|  |  | ||||||
| # removing software WebGL binaries because they are pretty huge and not necessary |  | ||||||
| rm -r $BUILD_DIR/swiftshader |  | ||||||
|  |  | ||||||
| cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | ||||||
|  |  | ||||||
| cp -r dump-db $BUILD_DIR/ | cp -r dump-db $BUILD_DIR/ | ||||||
|   | |||||||
| @@ -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=16.19.1 | NODE_VERSION=18.18.2 | ||||||
|  |  | ||||||
| if [ "$1" != "DONTCOPY" ] | if [ "$1" != "DONTCOPY" ] | ||||||
| then | then | ||||||
|   | |||||||
| @@ -22,9 +22,6 @@ rm -rf $BUILD_DIR | |||||||
|  |  | ||||||
| mv "./dist/Trilium Notes-win32-x64" $BUILD_DIR | mv "./dist/Trilium Notes-win32-x64" $BUILD_DIR | ||||||
|  |  | ||||||
| # removing software WebGL binaries because they are pretty huge and not necessary |  | ||||||
| rm -r $BUILD_DIR/swiftshader |  | ||||||
|  |  | ||||||
| cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | ||||||
|  |  | ||||||
| cp -r dump-db $BUILD_DIR/ | cp -r dump-db $BUILD_DIR/ | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ if [[ $# -eq 0 ]] ; then | |||||||
|     exit 1 |     exit 1 | ||||||
| fi | fi | ||||||
|  |  | ||||||
| n exec 16.19.1 npm run webpack | n exec 18.18.2 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 16.19.1 npm install --only=prod) | (cd $DIR && n exec 18.18.2 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 | ||||||
|   | |||||||
							
								
								
									
										0
									
								
								bin/create-anonymization-script.js
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								bin/create-anonymization-script.js
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @@ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "src": "dist/trilium-linux-x64", |   "src": "dist/trilium-linux-x64", | ||||||
|   "dest": "dist/", |   "dest": "dist/", | ||||||
|  |   "compression": "xz", | ||||||
|   "name": "trilium", |   "name": "trilium", | ||||||
|   "productName": "Trilium Notes", |   "productName": "Trilium Notes", | ||||||
|   "genericName": "Note taker", |   "genericName": "Note taker", | ||||||
|   | |||||||
| @@ -1,166 +1,47 @@ | |||||||
|  |  | ||||||
| UPDATE etapi_tokens SET tokenHash = 'API token hash value'; | UPDATE etapi_tokens SET tokenHash = 'API token hash value'; | ||||||
| UPDATE notes SET title = 'title' WHERE noteId != 'root' AND noteId NOT LIKE '\_%' ESCAPE '\'; | UPDATE notes SET title = 'title' WHERE title NOT IN ('root', '_hidden', '_share'); | ||||||
| UPDATE note_contents SET content = 'text' WHERE content IS NOT NULL; | UPDATE blobs SET content = 'text' WHERE content IS NOT NULL; | ||||||
| UPDATE note_revisions SET title = 'title'; | UPDATE revisions SET title = 'title'; | ||||||
| UPDATE note_revision_contents SET content = 'text' WHERE content IS NOT NULL; |  | ||||||
|  |  | ||||||
| UPDATE attributes SET name = 'name', value = 'value' |  | ||||||
|                   WHERE type = 'label' |  | ||||||
|                     AND name NOT IN ('inbox', |  | ||||||
|                                      'disableVersioning', |  | ||||||
|                                      'calendarRoot', |  | ||||||
|                                      'archived', |  | ||||||
|                                      'excludeFromExport', |  | ||||||
|                                      'disableInclusion', |  | ||||||
|                                      'appCss', |  | ||||||
|                                      'appTheme', |  | ||||||
|                                      'hidePromotedAttributes', |  | ||||||
|                                      'readOnly', |  | ||||||
|                                      'autoReadOnlyDisabled', |  | ||||||
|                                      'cssClass', |  | ||||||
|                                      'iconClass', |  | ||||||
|                                      'keyboardShortcut', |  | ||||||
|                                      'run', |  | ||||||
|                                      'runOnInstance', |  | ||||||
|                                      'runAtHour', |  | ||||||
|                                      'customRequestHandler', |  | ||||||
|                                      'customResourceProvider', |  | ||||||
|                                      'widget', |  | ||||||
|                                      'noteInfoWidgetDisabled', |  | ||||||
|                                      'linkMapWidgetDisabled', |  | ||||||
|                                      'noteRevisionsWidgetDisabled', |  | ||||||
|                                      'whatLinksHereWidgetDisabled', |  | ||||||
|                                      'similarNotesWidgetDisabled', |  | ||||||
|                                      'workspace', |  | ||||||
|                                      'workspaceIconClass', |  | ||||||
|                                      'workspaceTabBackgroundColor', |  | ||||||
|                                      'searchHome', |  | ||||||
|                                      'workspaceInbox', |  | ||||||
|                                      'workspaceSearchHome', |  | ||||||
|                                      'sqlConsoleHome', |  | ||||||
|                                      'datePattern', |  | ||||||
|                                      'pageSize', |  | ||||||
|                                      'viewType', |  | ||||||
|                                      'mapRootNoteId', |  | ||||||
|                                      'bookmarkFolder', |  | ||||||
|                                      'sorted', |  | ||||||
|                                      'top', |  | ||||||
|                                      'fullContentWidth', |  | ||||||
|                                      'shareHiddenFromTree', |  | ||||||
|                                      'shareAlias', |  | ||||||
|                                      'shareOmitDefaultCss', |  | ||||||
|                                      'shareRoot', |  | ||||||
|                                      'internalLink', |  | ||||||
|                                      'imageLink', |  | ||||||
|                                      'relationMapLink', |  | ||||||
|                                      'includeMapLink', |  | ||||||
|                                      'runOnNoteCreation', |  | ||||||
|                                      'runOnNoteTitleChange', |  | ||||||
|                                      'runOnNoteContentChange', |  | ||||||
|                                      'runOnNoteChange', |  | ||||||
|                                      'runOnChildNoteCreation', |  | ||||||
|                                      'runOnAttributeCreation', |  | ||||||
|                                      'runOnAttributeChange', |  | ||||||
|                                      'template', |  | ||||||
|                                      'inherit', |  | ||||||
|                                      'widget', |  | ||||||
|                                      'renderNote', |  | ||||||
|                                      'shareCss', |  | ||||||
|                                      'shareJs', |  | ||||||
|                                      'shareFavicon', |  | ||||||
|                                      'executeButton', |  | ||||||
|                                      'keepCurrentHoisting', |  | ||||||
|                                      'color', |  | ||||||
|                                      'toc', |  | ||||||
|                                      'excludeFromNoteMap', |  | ||||||
|                                      'docName', |  | ||||||
|                                      'launcherType', |  | ||||||
|                                      'builtinWidget', |  | ||||||
|                                      'baseSize', |  | ||||||
|                                      'growthFactor' |  | ||||||
|                       ); |  | ||||||
|  |  | ||||||
| UPDATE attributes SET name = 'name' |  | ||||||
|                     AND name NOT IN ('inbox', |  | ||||||
|                                      'disableVersioning', |  | ||||||
|                                      'calendarRoot', |  | ||||||
|                                      'archived', |  | ||||||
|                                      'excludeFromExport', |  | ||||||
|                                      'disableInclusion', |  | ||||||
|                                      'appCss', |  | ||||||
|                                      'appTheme', |  | ||||||
|                                      'hidePromotedAttributes', |  | ||||||
|                                      'readOnly', |  | ||||||
|                                      'autoReadOnlyDisabled', |  | ||||||
|                                      'cssClass', |  | ||||||
|                                      'iconClass', |  | ||||||
|                                      'keyboardShortcut', |  | ||||||
|                                      'run', |  | ||||||
|                                      'runOnInstance', |  | ||||||
|                                      'runAtHour', |  | ||||||
|                                      'customRequestHandler', |  | ||||||
|                                      'customResourceProvider', |  | ||||||
|                                      'widget', |  | ||||||
|                                      'noteInfoWidgetDisabled', |  | ||||||
|                                      'linkMapWidgetDisabled', |  | ||||||
|                                      'noteRevisionsWidgetDisabled', |  | ||||||
|                                      'whatLinksHereWidgetDisabled', |  | ||||||
|                                      'similarNotesWidgetDisabled', |  | ||||||
|                                      'workspace', |  | ||||||
|                                      'workspaceIconClass', |  | ||||||
|                                      'workspaceTabBackgroundColor', |  | ||||||
|                                      'searchHome', |  | ||||||
|                                      'workspaceInbox', |  | ||||||
|                                      'workspaceSearchHome', |  | ||||||
|                                      'sqlConsoleHome', |  | ||||||
|                                      'datePattern', |  | ||||||
|                                      'pageSize', |  | ||||||
|                                      'viewType', |  | ||||||
|                                      'mapRootNoteId', |  | ||||||
|                                      'bookmarkFolder', |  | ||||||
|                                      'sorted', |  | ||||||
|                                      'top', |  | ||||||
|                                      'fullContentWidth', |  | ||||||
|                                      'shareHiddenFromTree', |  | ||||||
|                                      'shareAlias', |  | ||||||
|                                      'shareOmitDefaultCss', |  | ||||||
|                                      'shareRoot', |  | ||||||
|                                      'internalLink', |  | ||||||
|                                      'imageLink', |  | ||||||
|                                      'relationMapLink', |  | ||||||
|                                      'includeMapLink', |  | ||||||
|                                      'runOnNoteCreation', |  | ||||||
|                                      'runOnNoteTitleChange', |  | ||||||
|                                      'runOnNoteContentChange', |  | ||||||
|                                      'runOnNoteChange', |  | ||||||
|                                      'runOnChildNoteCreation', |  | ||||||
|                                      'runOnAttributeCreation', |  | ||||||
|                                      'runOnAttributeChange', |  | ||||||
|                                      'template', |  | ||||||
|                                      'inherit', |  | ||||||
|                                      'widget', |  | ||||||
|                                      'renderNote', |  | ||||||
|                                      'shareCss', |  | ||||||
|                                      'shareJs', |  | ||||||
|                                      'shareFavicon', |  | ||||||
|                                      'executeButton', |  | ||||||
|                                      'keepCurrentHoisting', |  | ||||||
|                                      'color', |  | ||||||
|                                      'toc', |  | ||||||
|                                      'excludeFromNoteMap', |  | ||||||
|                                      'docName', |  | ||||||
|                                      'launcherType', |  | ||||||
|                                      'builtinWidget', |  | ||||||
|                                      'baseSize', |  | ||||||
|                                      'growthFactor' |  | ||||||
|                                     ); |  | ||||||
|  |  | ||||||
|  | UPDATE attributes SET name  = 'name', value = 'value' WHERE type = 'label' | ||||||
|  |   AND name NOT IN | ||||||
|  |       ('inbox', 'disableVersioning', 'calendarRoot', 'archived', 'excludeFromExport', 'disableInclusion', 'appCss', | ||||||
|  |        'appTheme', 'hidePromotedAttributes', 'readOnly', 'autoReadOnlyDisabled', 'cssClass', 'iconClass', | ||||||
|  |        'keyboardShortcut', 'run', 'runOnInstance', 'runAtHour', 'customRequestHandler', 'customResourceProvider', | ||||||
|  |        'widget', 'noteInfoWidgetDisabled', 'linkMapWidgetDisabled', 'revisionsWidgetDisabled', | ||||||
|  |        'whatLinksHereWidgetDisabled', 'similarNotesWidgetDisabled', 'workspace', 'workspaceIconClass', | ||||||
|  |        'workspaceTabBackgroundColor', 'workspaceCalendarRoot', 'workspaceTemplate', 'searchHome', 'workspaceInbox', | ||||||
|  |        'workspaceSearchHome', 'sqlConsoleHome', 'datePattern', 'pageSize', 'viewType', 'mapRootNoteId', | ||||||
|  |        'bookmarkFolder', 'sorted', 'sortDirection', 'sortFoldersFirst', 'sortNatural', 'sortLocale', 'top', | ||||||
|  |        'fullContentWidth', 'shareHiddenFromTree', 'shareOmitDefaultCss', 'shareRoot', 'shareDescription', | ||||||
|  |        'shareRaw', 'shareDisallowRobotIndexing', 'shareIndex', 'displayRelations', 'hideRelations', 'titleTemplate', | ||||||
|  |        'template', 'toc', 'color', 'keepCurrentHoisting', 'executeButton', 'executeDescription', 'newNotesOnTop', | ||||||
|  |        'clipperInbox', 'internalLink', 'imageLink', 'relationMapLink', 'includeMapLink', 'runOnNoteCreation', | ||||||
|  |        'runOnNoteTitleChange', 'runOnNoteChange', 'runOnNoteContentChange', 'runOnNoteDeletion', 'runOnBranchCreation', | ||||||
|  |        'runOnBranchDeletion', 'runOnChildNoteCreation', 'runOnAttributeCreation', 'runOnAttributeChange', 'template', | ||||||
|  |        'inherit', 'widget', 'renderNote', 'shareCss', 'shareJs', 'shareFavicon'); | ||||||
|  | UPDATE attributes SET name = 'name' WHERE type = 'relation' | ||||||
|  |   AND name NOT IN | ||||||
|  |       ('inbox', 'disableVersioning', 'calendarRoot', 'archived', 'excludeFromExport', 'disableInclusion', 'appCss', | ||||||
|  |        'appTheme', 'hidePromotedAttributes', 'readOnly', 'autoReadOnlyDisabled', 'cssClass', 'iconClass', | ||||||
|  |        'keyboardShortcut', 'run', 'runOnInstance', 'runAtHour', 'customRequestHandler', 'customResourceProvider', | ||||||
|  |        'widget', 'noteInfoWidgetDisabled', 'linkMapWidgetDisabled', 'revisionsWidgetDisabled', | ||||||
|  |        'whatLinksHereWidgetDisabled', 'similarNotesWidgetDisabled', 'workspace', 'workspaceIconClass', | ||||||
|  |        'workspaceTabBackgroundColor', 'workspaceCalendarRoot', 'workspaceTemplate', 'searchHome', 'workspaceInbox', | ||||||
|  |        'workspaceSearchHome', 'sqlConsoleHome', 'datePattern', 'pageSize', 'viewType', 'mapRootNoteId', | ||||||
|  |        'bookmarkFolder', 'sorted', 'sortDirection', 'sortFoldersFirst', 'sortNatural', 'sortLocale', 'top', | ||||||
|  |        'fullContentWidth', 'shareHiddenFromTree', 'shareOmitDefaultCss', 'shareRoot', 'shareDescription', | ||||||
|  |        'shareRaw', 'shareDisallowRobotIndexing', 'shareIndex', 'displayRelations', 'hideRelations', 'titleTemplate', | ||||||
|  |        'template', 'toc', 'color', 'keepCurrentHoisting', 'executeButton', 'executeDescription', 'newNotesOnTop', | ||||||
|  |        'clipperInbox', 'internalLink', 'imageLink', 'relationMapLink', 'includeMapLink', 'runOnNoteCreation', | ||||||
|  |        'runOnNoteTitleChange', 'runOnNoteChange', 'runOnNoteContentChange', 'runOnNoteDeletion', 'runOnBranchCreation', | ||||||
|  |        'runOnBranchDeletion', 'runOnChildNoteCreation', 'runOnAttributeCreation', 'runOnAttributeChange', 'template', | ||||||
|  |        'inherit', 'widget', 'renderNote', 'shareCss', 'shareJs', 'shareFavicon'); | ||||||
| UPDATE branches SET prefix = 'prefix' WHERE prefix IS NOT NULL AND prefix != 'recovered'; | UPDATE branches SET prefix = 'prefix' WHERE prefix IS NOT NULL AND prefix != 'recovered'; | ||||||
| UPDATE options SET value = 'anonymized' WHERE name IN | UPDATE options SET value = 'anonymized' WHERE name IN | ||||||
|                     ('documentId', 'documentSecret', 'encryptedDataKey', |       ('documentId', 'documentSecret', 'encryptedDataKey', | ||||||
|                      'passwordVerificationHash', 'passwordVerificationSalt', |        'passwordVerificationHash', 'passwordVerificationSalt', | ||||||
|                      'passwordDerivedKeySalt', 'username', 'syncServerHost', 'syncProxy') |        'passwordDerivedKeySalt', 'username', 'syncServerHost', 'syncProxy') | ||||||
|                       AND value != ''; |   AND value != ''; | ||||||
|  |  | ||||||
| VACUUM; | VACUUM; | ||||||
|   | |||||||
| @@ -16,7 +16,7 @@ noBackup=false | |||||||
| # host=0.0.0.0 | # host=0.0.0.0 | ||||||
| # port setting is relevant only for web deployments, desktop builds run on a fixed port (changeable with TRILIUM_PORT environment variable) | # port setting is relevant only for web deployments, desktop builds run on a fixed port (changeable with TRILIUM_PORT environment variable) | ||||||
| port=8080 | port=8080 | ||||||
| # true for TLS/SSL/HTTPS (secure), false for HTTP (unsecure). | # true for TLS/SSL/HTTPS (secure), false for HTTP (insecure). | ||||||
| https=false | https=false | ||||||
| # path to certificate (run "bash bin/generate-cert.sh" to generate self-signed certificate). Relevant only if https=true | # path to certificate (run "bash bin/generate-cert.sh" to generate self-signed certificate). Relevant only if https=true | ||||||
| certPath= | certPath= | ||||||
|   | |||||||
| @@ -1,5 +1,4 @@ | |||||||
| - isDeleted = 0 by default | - isDeleted = 0 by default | ||||||
| - rename openTabs to openNoteContexts |  | ||||||
| - unify readOnly handling to a single attribute: | - unify readOnly handling to a single attribute: | ||||||
|   * readOnly - like now |   * readOnly - like now | ||||||
|   * readOnly=auto - like without readOnly (used to override inherited readOnly) |   * readOnly=auto - like without readOnly (used to override inherited readOnly) | ||||||
|   | |||||||
							
								
								
									
										
											BIN
										
									
								
								db/demo.zip
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								db/demo.zip
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -1 +0,0 @@ | |||||||
| module.exports = () => console.log("NOOP, moved to migration 0189"); |  | ||||||
| @@ -1,4 +0,0 @@ | |||||||
| -- black theme has been removed, dark is closest replacement |  | ||||||
| UPDATE options SET value = 'dark' WHERE name = 'theme' AND value = 'black'; |  | ||||||
|  |  | ||||||
| UPDATE options SET value = 'light' WHERE name = 'theme' AND value = 'white'; |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| ALTER TABLE branches DROP COLUMN utcDateCreated; |  | ||||||
| ALTER TABLE options DROP COLUMN utcDateCreated; |  | ||||||
| @@ -1,33 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "mig_entity_changes" ( |  | ||||||
|                                                 `id`	INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |  | ||||||
|                                                 `entityName`	TEXT NOT NULL, |  | ||||||
|                                                 `entityId`	TEXT NOT NULL, |  | ||||||
|                                                 `hash`	TEXT NOT NULL, |  | ||||||
|                                                 `isErased` INT NOT NULL, |  | ||||||
|                                                 `changeId` TEXT NOT NULL, |  | ||||||
|                                                 `sourceId` TEXT NOT NULL, |  | ||||||
|                                                 `isSynced` INTEGER NOT NULL, |  | ||||||
|                                                 `utcDateChanged` TEXT NOT NULL |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO mig_entity_changes (id, entityName, entityId, hash, isErased, changeId, sourceId, isSynced, utcDateChanged) |  | ||||||
|     SELECT id, entityName, entityId, hash, isErased, '', sourceId, isSynced, utcDateChanged FROM entity_changes; |  | ||||||
|  |  | ||||||
| -- delete duplicates https://github.com/zadam/trilium/issues/2534 |  | ||||||
| DELETE FROM mig_entity_changes WHERE isErased = 0 AND id IN ( |  | ||||||
|     SELECT id FROM mig_entity_changes ec |  | ||||||
|     WHERE ( |  | ||||||
|               SELECT COUNT(*) FROM mig_entity_changes |  | ||||||
|               WHERE ec.entityName = mig_entity_changes.entityName |  | ||||||
|                 AND ec.entityId = mig_entity_changes.entityId |  | ||||||
|           ) > 1 |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| DROP TABLE entity_changes; |  | ||||||
|  |  | ||||||
| ALTER TABLE mig_entity_changes RENAME TO entity_changes; |  | ||||||
|  |  | ||||||
| CREATE UNIQUE INDEX `IDX_entityChanges_entityName_entityId` ON "entity_changes" ( |  | ||||||
|                                                                                  `entityName`, |  | ||||||
|                                                                                  `entityId` |  | ||||||
|     ); |  | ||||||
| @@ -1,8 +0,0 @@ | |||||||
| UPDATE branches SET branchId = 'hidden' where branchId = ( |  | ||||||
|     SELECT branchId FROM branches |  | ||||||
|     WHERE parentNoteId = 'root' |  | ||||||
|       AND noteId = 'hidden' |  | ||||||
|       AND isDeleted = 0 |  | ||||||
|     ORDER BY utcDateModified |  | ||||||
|     LIMIT 1 |  | ||||||
| ); |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| DELETE FROM options WHERE name = 'username'; |  | ||||||
| @@ -1,15 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "etapi_tokens" |  | ||||||
| ( |  | ||||||
|     etapiTokenId TEXT PRIMARY KEY NOT NULL, |  | ||||||
|     name TEXT NOT NULL, |  | ||||||
|     tokenHash TEXT NOT NULL, |  | ||||||
|     utcDateCreated TEXT NOT NULL, |  | ||||||
|     utcDateModified TEXT NOT NULL, |  | ||||||
|     isDeleted INT NOT NULL DEFAULT 0); |  | ||||||
|  |  | ||||||
| INSERT INTO etapi_tokens (etapiTokenId, name, tokenHash, utcDateCreated, utcDateModified, isDeleted) |  | ||||||
| SELECT apiTokenId, 'Trilium Sender', token, utcDateCreated, utcDateCreated, isDeleted FROM api_tokens; |  | ||||||
|  |  | ||||||
| DROP TABLE api_tokens; |  | ||||||
|  |  | ||||||
| UPDATE entity_changes SET entityName = 'etapi_tokens' WHERE entityName = 'api_tokens'; |  | ||||||
| @@ -1,10 +0,0 @@ | |||||||
| module.exports = () => { |  | ||||||
|     const sql = require('../../src/services/sql'); |  | ||||||
|     const crypto = require('crypto'); |  | ||||||
|  |  | ||||||
|     for (const {etapiTokenId, token} of sql.getRows("SELECT etapiTokenId, tokenHash AS token FROM etapi_tokens")) { |  | ||||||
|         const tokenHash = crypto.createHash('sha256').update(token).digest('base64'); |  | ||||||
|          |  | ||||||
|         sql.execute(`UPDATE etapi_tokens SET tokenHash = ? WHERE etapiTokenId = ?`, [tokenHash, etapiTokenId]); |  | ||||||
|     } |  | ||||||
| }; |  | ||||||
| @@ -1,20 +0,0 @@ | |||||||
| DROP TABLE entity_changes; |  | ||||||
| -- not preserving the data because of https://github.com/zadam/trilium/issues/3447 |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "entity_changes" ( |  | ||||||
|                                                     `id`	INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |  | ||||||
|                                                     `entityName`	TEXT NOT NULL, |  | ||||||
|                                                     `entityId`	TEXT NOT NULL, |  | ||||||
|                                                     `hash`	TEXT NOT NULL, |  | ||||||
|                                                     `isErased` INT NOT NULL, |  | ||||||
|                                                     `changeId` TEXT NOT NULL, |  | ||||||
|                                                     `componentId` TEXT NOT NULL, |  | ||||||
|                                                     `instanceId` TEXT NOT NULL, |  | ||||||
|                                                     `isSynced` INTEGER NOT NULL, |  | ||||||
|                                                     `utcDateChanged` TEXT NOT NULL |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| CREATE UNIQUE INDEX `IDX_entityChanges_entityName_entityId` ON "entity_changes" ( |  | ||||||
|                                                                                  `entityName`, |  | ||||||
|                                                                                  `entityId` |  | ||||||
|     ); |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| CREATE INDEX `IDX_entity_changes_changeId` ON `entity_changes` (`changeId`); |  | ||||||
| @@ -1,15 +0,0 @@ | |||||||
| const becca = require('../../src/becca/becca'); |  | ||||||
| const beccaLoader = require('../../src/becca/becca_loader'); |  | ||||||
| const cls = require('../../src/services/cls'); |  | ||||||
|  |  | ||||||
| module.exports = () => { |  | ||||||
|     cls.init(() => { |  | ||||||
|         beccaLoader.load(); |  | ||||||
|  |  | ||||||
|         for (const note of Object.values(becca.notes)) { |  | ||||||
|             if (note.hasLabel('calendarRoot')) { |  | ||||||
|                 note.addLabel('excludeFromNoteMap', "", true); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     }); |  | ||||||
| }; |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| -- removing potential remnants of recent notes in entity changes, see https://github.com/zadam/trilium/issues/2842 |  | ||||||
| DELETE FROM entity_changes WHERE entityName = 'recent_notes'; |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| UPDATE attributes SET value = replace(value, 'setLabelValue', 'updateLabelValue') WHERE name = 'action' AND type = 'label'; |  | ||||||
| UPDATE attributes SET value = replace(value, 'setRelationTarget', 'updateRelationTarget') WHERE name = 'action' AND type = 'label'; |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| module.exports = () => console.log("NOOP, increased because of protected notes IV change"); |  | ||||||
| @@ -1,6 +0,0 @@ | |||||||
| UPDATE branches SET branchId = '_hidden__search' WHERE parentNoteId = 'hidden' AND noteId = 'search' AND isDeleted = 0; |  | ||||||
| UPDATE branches SET branchId = 'root__globalNoteMap' WHERE parentNoteId = 'singles' AND noteId = 'globalnotemap' AND isDeleted = 0; |  | ||||||
| UPDATE branches SET branchId = '_hidden__sqlConsole' WHERE parentNoteId = 'hidden' AND noteId = 'sqlconsole' AND isDeleted = 0; |  | ||||||
| UPDATE branches SET branchId = 'root__hidden' WHERE parentNoteId = 'root' AND noteId = 'hidden' AND isDeleted = 0; |  | ||||||
| UPDATE branches SET branchId = '_hidden__bulkAction' WHERE parentNoteId = 'hidden' AND noteId = 'bulkaction' AND isDeleted = 0; |  | ||||||
| UPDATE branches SET branchId = '_hidden__share' WHERE parentNoteId = 'root' AND noteId = 'share' AND isDeleted = 0; |  | ||||||
| @@ -1,53 +0,0 @@ | |||||||
| UPDATE notes SET noteId = '_globalNoteMap', title = 'Note Map' WHERE noteId = 'globalnotemap'; |  | ||||||
| UPDATE note_contents SET noteId = '_globalNoteMap' WHERE noteId = 'globalnotemap'; |  | ||||||
| UPDATE note_revisions SET noteId = '_globalNoteMap' WHERE noteId = 'globalnotemap'; |  | ||||||
| UPDATE branches SET noteId = '_globalNoteMap' WHERE noteId = 'globalnotemap'; |  | ||||||
| UPDATE branches SET parentNoteId = '_globalNoteMap' WHERE parentNoteId = 'globalnotemap'; |  | ||||||
| UPDATE attributes SET noteId = '_globalNoteMap' WHERE noteId = 'globalnotemap'; |  | ||||||
| UPDATE attributes SET value = '_globalNoteMap' WHERE type = 'relation' AND value = 'globalnotemap'; |  | ||||||
| UPDATE entity_changes SET entityId = '_globalNoteMap' WHERE entityId = 'globalnotemap'; |  | ||||||
|  |  | ||||||
| UPDATE notes SET noteId = '_bulkAction', title = 'Bulk Action' WHERE noteId = 'bulkaction'; |  | ||||||
| UPDATE note_contents SET noteId = '_bulkAction' WHERE noteId = 'bulkaction'; |  | ||||||
| UPDATE note_revisions SET noteId = '_bulkAction' WHERE noteId = 'bulkaction'; |  | ||||||
| UPDATE branches SET parentNoteId = '_bulkAction' WHERE parentNoteId = 'bulkaction'; |  | ||||||
| UPDATE branches SET noteId = '_bulkAction' WHERE noteId = 'bulkaction'; |  | ||||||
| UPDATE attributes SET noteId = '_bulkAction' WHERE noteId = 'bulkaction'; |  | ||||||
| UPDATE attributes SET value = '_bulkAction' WHERE type = 'relation' AND value = 'bulkaction'; |  | ||||||
| UPDATE entity_changes SET entityId = '_bulkAction' WHERE entityId = 'bulkaction'; |  | ||||||
|  |  | ||||||
| UPDATE notes SET noteId = '_sqlConsole', title = 'SQL Console History' WHERE noteId = 'sqlconsole'; |  | ||||||
| UPDATE note_contents SET noteId = '_sqlConsole' WHERE noteId = 'sqlconsole'; |  | ||||||
| UPDATE note_revisions SET noteId = '_sqlConsole' WHERE noteId = 'sqlconsole'; |  | ||||||
| UPDATE branches SET noteId = '_sqlConsole' WHERE noteId = 'sqlconsole'; |  | ||||||
| UPDATE branches SET parentNoteId = '_sqlConsole' WHERE parentNoteId = 'sqlconsole'; |  | ||||||
| UPDATE attributes SET noteId = '_sqlConsole' WHERE noteId = 'sqlconsole'; |  | ||||||
| UPDATE attributes SET value = '_sqlConsole' WHERE type = 'relation' AND value = 'sqlconsole'; |  | ||||||
| UPDATE entity_changes SET entityId = '_sqlConsole' WHERE entityId = 'sqlconsole'; |  | ||||||
|  |  | ||||||
| UPDATE notes SET noteId = '_hidden', title = 'Hidden Notes' WHERE noteId = 'hidden'; |  | ||||||
| UPDATE note_contents SET noteId = '_hidden' WHERE noteId = 'hidden'; |  | ||||||
| UPDATE note_revisions SET noteId = '_hidden' WHERE noteId = 'hidden'; |  | ||||||
| UPDATE branches SET noteId = '_hidden', prefix = NULL WHERE noteId = 'hidden'; |  | ||||||
| UPDATE branches SET parentNoteId = '_hidden' WHERE parentNoteId = 'hidden'; |  | ||||||
| UPDATE attributes SET noteId = '_hidden' WHERE noteId = 'hidden'; |  | ||||||
| UPDATE attributes SET value = '_hidden' WHERE type = 'relation' AND value = 'hidden'; |  | ||||||
| UPDATE entity_changes SET entityId = '_hidden' WHERE entityId = 'hidden'; |  | ||||||
|  |  | ||||||
| UPDATE notes SET noteId = '_search', title = 'Search History' WHERE noteId = 'search'; |  | ||||||
| UPDATE note_contents SET noteId = '_search' WHERE noteId = 'search'; |  | ||||||
| UPDATE note_revisions SET noteId = '_search' WHERE noteId = 'search'; |  | ||||||
| UPDATE branches SET noteId = '_search' WHERE noteId = 'search'; |  | ||||||
| UPDATE branches SET parentNoteId = '_search' WHERE parentNoteId = 'search'; |  | ||||||
| UPDATE attributes SET noteId = '_search' WHERE noteId = 'search'; |  | ||||||
| UPDATE attributes SET value = '_search' WHERE type = 'relation' AND value = 'search'; |  | ||||||
| UPDATE entity_changes SET entityId = '_search' WHERE entityId = 'search'; |  | ||||||
|  |  | ||||||
| UPDATE notes SET noteId = '_share', title = 'Shared Notes' WHERE noteId = 'share'; |  | ||||||
| UPDATE note_contents SET noteId = '_share' WHERE noteId = 'share'; |  | ||||||
| UPDATE note_revisions SET noteId = '_share' WHERE noteId = 'share'; |  | ||||||
| UPDATE branches SET noteId = '_share' WHERE noteId = 'share'; |  | ||||||
| UPDATE branches SET parentNoteId = '_share' WHERE parentNoteId = 'share'; |  | ||||||
| UPDATE attributes SET noteId = '_share' WHERE noteId = 'share'; |  | ||||||
| UPDATE attributes SET value = '_share' WHERE type = 'relation' AND value = 'share'; |  | ||||||
| UPDATE entity_changes SET entityId = '_share' WHERE entityId = 'share'; |  | ||||||
| @@ -1,12 +0,0 @@ | |||||||
| module.exports = () => { |  | ||||||
|     const hiddenSubtreeService = require('../../src/services/hidden_subtree'); |  | ||||||
|     const cls = require("../../src/services/cls"); |  | ||||||
|     const beccaLoader = require("../../src/becca/becca_loader"); |  | ||||||
|  |  | ||||||
|     cls.init(() => { |  | ||||||
|         beccaLoader.load(); |  | ||||||
|         // make sure the hidden subtree exists since the subsequent migrations we will move some existing notes into it (share...) |  | ||||||
|         // in previous releases hidden subtree was created lazily |  | ||||||
|         hiddenSubtreeService.checkHiddenSubtree(true); |  | ||||||
|     }); |  | ||||||
| }; |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| DELETE FROM branches WHERE noteId = '_share' AND parentNoteId != 'root' AND parentNoteId != '_hidden'; -- delete all other branches of _share if any |  | ||||||
| UPDATE branches SET parentNoteId = '_hidden' WHERE noteId = '_share'; |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| DELETE FROM branches WHERE noteId = '_globalNoteMap' AND parentNoteId != 'singles' AND parentNoteId != '_hidden'; -- make sure there are no clones which would fail at the next line |  | ||||||
| UPDATE branches SET parentNoteId = '_hidden' WHERE noteId = '_globalNoteMap'; |  | ||||||
| @@ -1,6 +0,0 @@ | |||||||
| DELETE FROM branches WHERE noteId = 'singles'; |  | ||||||
| DELETE FROM notes WHERE noteId = 'singles'; |  | ||||||
| DELETE FROM note_contents WHERE noteId = 'singles'; |  | ||||||
| DELETE FROM note_revisions WHERE noteId = 'singles'; |  | ||||||
| DELETE FROM attributes WHERE noteId = 'singles'; |  | ||||||
| DELETE FROM entity_changes WHERE entityId = 'singles'; |  | ||||||
| @@ -1,21 +0,0 @@ | |||||||
| module.exports = () => { |  | ||||||
|     const cls = require("../../src/services/cls"); |  | ||||||
|     const cloningService = require("../../src/services/cloning"); |  | ||||||
|     const beccaLoader = require("../../src/becca/becca_loader"); |  | ||||||
|     const becca = require("../../src/becca/becca"); |  | ||||||
|  |  | ||||||
|     cls.init(() => { |  | ||||||
|         beccaLoader.load(); |  | ||||||
|  |  | ||||||
|         for (const attr of becca.findAttributes('label','bookmarked')) { |  | ||||||
|             cloningService.toggleNoteInParent(true, attr.noteId, '_lbBookmarks'); |  | ||||||
|  |  | ||||||
|             attr.markAsDeleted("0204__migrate_bookmarks_to_clones"); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         // bookmarkFolder used to work in 0.57 without the bookmarked label |  | ||||||
|         for (const attr of becca.findAttributes('label','bookmarkFolder')) { |  | ||||||
|             cloningService.toggleNoteInParent(true, attr.noteId, '_lbBookmarks'); |  | ||||||
|         } |  | ||||||
|     }); |  | ||||||
| }; |  | ||||||
| @@ -1,3 +0,0 @@ | |||||||
| UPDATE notes SET type = 'relationMap' WHERE type = 'relation-map'; |  | ||||||
| UPDATE notes SET type = 'noteMap' WHERE type = 'note-map'; |  | ||||||
| UPDATE notes SET type = 'webView' WHERE type = 'web-view'; |  | ||||||
| @@ -1,33 +0,0 @@ | |||||||
| // the history was previously not exposed and the fact they were not cleaned up is rather a side-effect than an intention |  | ||||||
|  |  | ||||||
| module.exports = () => { |  | ||||||
|     const cls = require("../../src/services/cls"); |  | ||||||
|     const beccaLoader = require("../../src/becca/becca_loader"); |  | ||||||
|     const becca = require("../../src/becca/becca"); |  | ||||||
|  |  | ||||||
|     cls.init(() => { |  | ||||||
|         beccaLoader.load(); |  | ||||||
|  |  | ||||||
|         // deleting just branches because they might be cloned (and therefore saved) also outside of the hidden subtree |  | ||||||
|  |  | ||||||
|         const searchRoot = becca.getNote('_search'); |  | ||||||
|  |  | ||||||
|         for (const searchBranch of searchRoot.getChildBranches()) { |  | ||||||
|             const searchNote = searchBranch.getNote(); |  | ||||||
|  |  | ||||||
|             if (searchNote.type === 'search') { |  | ||||||
|                 searchBranch.deleteBranch('0206__delete_search_and_sql_console_history'); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         const sqlConsoleRoot = becca.getNote('_sqlConsole'); |  | ||||||
|  |  | ||||||
|         for (const sqlConsoleBranch of sqlConsoleRoot.getChildBranches()) { |  | ||||||
|             const sqlConsoleNote = sqlConsoleBranch.getNote(); |  | ||||||
|  |  | ||||||
|             if (sqlConsoleNote.type === 'code' && sqlConsoleNote.mime === 'text/x-sqlite;schema=trilium') { |  | ||||||
|                 sqlConsoleBranch.deleteBranch('0206__delete_search_and_sql_console_history'); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     }); |  | ||||||
| }; |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| UPDATE notes SET title = 'SQL Console History' WHERE noteId = '_sqlConsole'; |  | ||||||
| UPDATE notes SET title = 'Search History' WHERE noteId = '_search'; |  | ||||||
| @@ -1,13 +0,0 @@ | |||||||
| module.exports = () => { |  | ||||||
|     const cls = require("../../src/services/cls"); |  | ||||||
|     const beccaLoader = require("../../src/becca/becca_loader"); |  | ||||||
|     const becca = require("../../src/becca/becca"); |  | ||||||
|  |  | ||||||
|     cls.init(() => { |  | ||||||
|         beccaLoader.load(); |  | ||||||
|  |  | ||||||
|         for (const label of becca.getNote('_hidden').getLabels('archived')) { |  | ||||||
|             label.markAsDeleted('0208__remove_archived_from_hidden'); |  | ||||||
|         } |  | ||||||
|     }); |  | ||||||
| }; |  | ||||||
| @@ -1,5 +0,0 @@ | |||||||
| UPDATE attributes SET name = 'workspaceInbox' WHERE type = 'label' AND name = 'hoistedInbox'; |  | ||||||
| UPDATE entity_changes SET entityId = 'workspaceInbox' WHERE entityName = 'attributes' AND entityId = 'hoistedInbox'; |  | ||||||
|  |  | ||||||
| UPDATE attributes SET name = 'workspaceSearchHome' WHERE type = 'label' AND name = 'hoistedSearchHome'; |  | ||||||
| UPDATE entity_changes SET entityId = 'workspaceSearchHome' WHERE entityName = 'attributes' AND entityId = 'hoistedSearchHome'; |  | ||||||
| @@ -1,24 +0,0 @@ | |||||||
| module.exports = async () => { |  | ||||||
|     const cls = require("../../src/services/cls"); |  | ||||||
|     const beccaLoader = require("../../src/becca/becca_loader"); |  | ||||||
|     const log = require("../../src/services/log"); |  | ||||||
|     const consistencyChecks = require("../../src/services/consistency_checks"); |  | ||||||
|     const noteService = require("../../src/services/notes"); |  | ||||||
|  |  | ||||||
|     await cls.init(async () => { |  | ||||||
|         // precaution for the 0211 migration |  | ||||||
|         noteService.eraseDeletedNotesNow(); |  | ||||||
|  |  | ||||||
|         beccaLoader.load(); |  | ||||||
|  |  | ||||||
|         try { |  | ||||||
|             // precaution before running 211 which might produce unique constraint problems if the DB was not consistent |  | ||||||
|             consistencyChecks.runOnDemandChecksWithoutExclusiveLock(true); |  | ||||||
|         } |  | ||||||
|         catch (e) { |  | ||||||
|             // consistency checks might start failing in the future if there's some incompatible migration down the road |  | ||||||
|             // we can optimistically assume the DB is consistent and still continue |  | ||||||
|             log.error(`Consistency checks failed in migration 0210: ${e.message} ${e.stack}`); |  | ||||||
|         } |  | ||||||
|     }); |  | ||||||
| }; |  | ||||||
| @@ -1,12 +0,0 @@ | |||||||
| -- case based on isDeleted is needed, otherwise 2 branches (1 deleted, 1 not) might get the same ID |  | ||||||
| UPDATE entity_changes SET entityId = COALESCE(( |  | ||||||
|     SELECT |  | ||||||
|         CASE isDeleted |  | ||||||
|             WHEN 0 THEN parentNoteId || '_' || noteId |  | ||||||
|             WHEN 1 THEN branchId |  | ||||||
|         END |  | ||||||
|     FROM branches WHERE branchId = entityId |  | ||||||
| ), entityId) |  | ||||||
| WHERE entityName = 'branches' AND isErased = 0; |  | ||||||
|  |  | ||||||
| UPDATE branches SET branchId = parentNoteId || '_' || noteId WHERE isDeleted = 0; |  | ||||||
| @@ -1,27 +0,0 @@ | |||||||
| module.exports = () => { |  | ||||||
|     const cls = require("../../src/services/cls"); |  | ||||||
|     const beccaLoader = require("../../src/becca/becca_loader"); |  | ||||||
|     const becca = require("../../src/becca/becca"); |  | ||||||
|     const log = require("../../src/services/log"); |  | ||||||
|  |  | ||||||
|     cls.init(() => { |  | ||||||
|         beccaLoader.load(); |  | ||||||
|  |  | ||||||
|         const hidden = becca.getNote("_hidden"); |  | ||||||
|  |  | ||||||
|         if (!hidden) { |  | ||||||
|             log.info("MIGRATION 212: no _hidden note, skipping."); |  | ||||||
|             return; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         for (const noteId of hidden.getSubtreeNoteIds({includeHidden: true})) { |  | ||||||
|             if (noteId.startsWith("_")) { // is "named" note |  | ||||||
|                 const note = becca.getNote(noteId); |  | ||||||
|  |  | ||||||
|                 for (const attr of note.getOwnedAttributes()) { |  | ||||||
|                     attr.markAsDeleted("0212__delete_all_attributes_of_named_notes"); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     }); |  | ||||||
| }; |  | ||||||
| @@ -1,48 +0,0 @@ | |||||||
| module.exports = () => { |  | ||||||
|     const beccaLoader = require("../../src/becca/becca_loader"); |  | ||||||
|     const becca = require("../../src/becca/becca"); |  | ||||||
|     const cls = require("../../src/services/cls"); |  | ||||||
|     const log = require("../../src/services/log"); |  | ||||||
|  |  | ||||||
|     cls.init(() => { |  | ||||||
|         beccaLoader.load(); |  | ||||||
|  |  | ||||||
|         for (const note of Object.values(becca.notes)) { |  | ||||||
|             try { |  | ||||||
|                 if (!note.isJavaScript()) { |  | ||||||
|                     continue; |  | ||||||
|                 } |  | ||||||
|  |  | ||||||
|                 if (!note.mime?.endsWith('env=frontend') && !note.mime?.endsWith('env=backend')) { |  | ||||||
|                     continue; |  | ||||||
|                 } |  | ||||||
|  |  | ||||||
|                 const origContent = note.getContent().toString(); |  | ||||||
|                 const fixedContent = origContent |  | ||||||
|                     .replaceAll("runOnServer", "runOnBackend") |  | ||||||
|                     .replaceAll("api.refreshTree()", "") |  | ||||||
|                     .replaceAll("addTextToActiveTabEditor", "addTextToActiveContextEditor") |  | ||||||
|                     .replaceAll("getActiveTabNote", "getActiveContextNote") |  | ||||||
|                     .replaceAll("getActiveTabTextEditor", "getActiveContextTextEditor") |  | ||||||
|                     .replaceAll("getActiveTabNotePath", "getActiveContextNotePath") |  | ||||||
|                     .replaceAll("getDateNote", "getDayNote") |  | ||||||
|                     .replaceAll("utils.unescapeHtml", "unescapeHtml") |  | ||||||
|                     .replaceAll("sortNotesByTitle", "sortNotes") |  | ||||||
|                     .replaceAll("CollapsibleWidget", "RightPanelWidget") |  | ||||||
|                     .replaceAll("TabAwareWidget", "NoteContextAwareWidget") |  | ||||||
|                     .replaceAll("TabCachingWidget", "NoteContextAwareWidget") |  | ||||||
|                     .replaceAll("NoteContextCachingWidget", "NoteContextAwareWidget"); |  | ||||||
|  |  | ||||||
|                 if (origContent !== fixedContent) { |  | ||||||
|                     log.info(`Replacing legacy API calls for note '${note.noteId}'`); |  | ||||||
|  |  | ||||||
|                     note.saveNoteRevision(); |  | ||||||
|                     note.setContent(fixedContent); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             catch (e) { |  | ||||||
|                 log.error(`Error during migration to 213 for note '${note.noteId}': ${e.message} ${e.stack}`); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     }); |  | ||||||
| }; |  | ||||||
							
								
								
									
										10
									
								
								db/migrations/0215__content_structure.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								db/migrations/0215__content_structure.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | |||||||
|  | CREATE TABLE IF NOT EXISTS "blobs" ( | ||||||
|  |                                                `blobId`	TEXT NOT NULL, | ||||||
|  |                                                `content`	TEXT NULL DEFAULT NULL, | ||||||
|  |                                                `dateModified` TEXT NOT NULL, | ||||||
|  |                                                `utcDateModified` TEXT NOT NULL, | ||||||
|  |                                                PRIMARY KEY(`blobId`) | ||||||
|  | ); | ||||||
|  |  | ||||||
|  | ALTER TABLE notes ADD blobId TEXT DEFAULT NULL; | ||||||
|  | ALTER TABLE note_revisions ADD blobId TEXT DEFAULT NULL; | ||||||
							
								
								
									
										62
									
								
								db/migrations/0216__move_content_into_blobs.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								db/migrations/0216__move_content_into_blobs.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,62 @@ | |||||||
|  | module.exports = () => { | ||||||
|  |     const sql = require("../../src/services/sql"); | ||||||
|  |     const utils = require("../../src/services/utils"); | ||||||
|  |  | ||||||
|  |     const existingBlobIds = new Set(); | ||||||
|  |  | ||||||
|  |     for (const noteId of sql.getColumn(`SELECT noteId FROM note_contents`)) { | ||||||
|  |         const row = sql.getRow(`SELECT noteId, content, dateModified, utcDateModified FROM note_contents WHERE noteId = ?`, [noteId]); | ||||||
|  |         const blobId = utils.hashedBlobId(row.content); | ||||||
|  |  | ||||||
|  |         if (!existingBlobIds.has(blobId)) { | ||||||
|  |             existingBlobIds.add(blobId); | ||||||
|  |  | ||||||
|  |             sql.insert('blobs', { | ||||||
|  |                 blobId, | ||||||
|  |                 content: row.content, | ||||||
|  |                 dateModified: row.dateModified, | ||||||
|  |                 utcDateModified: row.utcDateModified | ||||||
|  |             }); | ||||||
|  |  | ||||||
|  |             sql.execute("UPDATE entity_changes SET entityName = 'blobs', entityId = ? WHERE entityName = 'note_contents' AND entityId = ?", [blobId, row.noteId]); | ||||||
|  |         } else { | ||||||
|  |             // duplicates | ||||||
|  |             sql.execute("DELETE FROM entity_changes WHERE entityName = 'note_contents' AND entityId = ?", [row.noteId]); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         sql.execute('UPDATE notes SET blobId = ? WHERE noteId = ?', [blobId, row.noteId]); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     for (const noteRevisionId of sql.getColumn(`SELECT noteRevisionId FROM note_revision_contents`)) { | ||||||
|  |         const row = sql.getRow(`SELECT noteRevisionId, content, utcDateModified FROM note_revision_contents WHERE noteRevisionId = ?`, [noteRevisionId]); | ||||||
|  |         const blobId = utils.hashedBlobId(row.content); | ||||||
|  |  | ||||||
|  |         if (!existingBlobIds.has(blobId)) { | ||||||
|  |             existingBlobIds.add(blobId); | ||||||
|  |  | ||||||
|  |             sql.insert('blobs', { | ||||||
|  |                 blobId, | ||||||
|  |                 content: row.content, | ||||||
|  |                 dateModified: row.utcDateModified, | ||||||
|  |                 utcDateModified: row.utcDateModified | ||||||
|  |             }); | ||||||
|  |  | ||||||
|  |             sql.execute("UPDATE entity_changes SET entityName = 'blobs', entityId = ? WHERE entityName = 'note_revision_contents' AND entityId = ?", [blobId, row.noteRevisionId]); | ||||||
|  |         } else { | ||||||
|  |             // duplicates | ||||||
|  |             sql.execute("DELETE FROM entity_changes WHERE entityName = 'note_revision_contents' AND entityId = ?", [row.noteId]); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         sql.execute('UPDATE note_revisions SET blobId = ? WHERE noteRevisionId = ?', [blobId, row.noteRevisionId]); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     const notesWithoutBlobIds = sql.getColumn("SELECT noteId FROM notes WHERE blobId IS NULL"); | ||||||
|  |     if (notesWithoutBlobIds.length > 0) { | ||||||
|  |         throw new Error("BlobIds were not filled correctly in notes: " + JSON.stringify(notesWithoutBlobIds)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     const noteRevisionsWithoutBlobIds = sql.getColumn("SELECT noteRevisionId FROM note_revisions WHERE blobId IS NULL"); | ||||||
|  |     if (noteRevisionsWithoutBlobIds.length > 0) { | ||||||
|  |         throw new Error("BlobIds were not filled correctly in note revisions: " + JSON.stringify(noteRevisionsWithoutBlobIds)); | ||||||
|  |     } | ||||||
|  | }; | ||||||
							
								
								
									
										4
									
								
								db/migrations/0217__drop_content_tables.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								db/migrations/0217__drop_content_tables.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | DROP TABLE note_contents; | ||||||
|  | DROP TABLE note_revision_contents; | ||||||
|  |  | ||||||
|  | DELETE FROM entity_changes WHERE entityName IN ('note_contents', 'note_revision_contents'); | ||||||
							
								
								
									
										25
									
								
								db/migrations/0218__rename_note_revision_to_revision.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								db/migrations/0218__rename_note_revision_to_revision.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | |||||||
|  | CREATE TABLE IF NOT EXISTS "revisions" (`revisionId`	TEXT NOT NULL PRIMARY KEY, | ||||||
|  |                                         `noteId`	TEXT NOT NULL, | ||||||
|  |                                         type TEXT DEFAULT '' NOT NULL, | ||||||
|  |                                         mime TEXT DEFAULT '' NOT NULL, | ||||||
|  |                                         `title`	TEXT NOT NULL, | ||||||
|  |                                         `isProtected`	INT NOT NULL DEFAULT 0, | ||||||
|  |                                         blobId TEXT DEFAULT NULL, | ||||||
|  |                                         `utcDateLastEdited` TEXT NOT NULL, | ||||||
|  |                                         `utcDateCreated` TEXT NOT NULL, | ||||||
|  |                                         `utcDateModified` TEXT NOT NULL, | ||||||
|  |                                         `dateLastEdited` TEXT NOT NULL, | ||||||
|  |                                         `dateCreated` TEXT NOT NULL); | ||||||
|  |  | ||||||
|  | INSERT INTO revisions (revisionId, noteId, type, mime, title, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated, blobId) | ||||||
|  | SELECT noteRevisionId, noteId, type, mime, title, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated, blobId FROM note_revisions; | ||||||
|  |  | ||||||
|  | DROP TABLE note_revisions; | ||||||
|  |  | ||||||
|  | CREATE INDEX `IDX_revisions_noteId` ON `revisions` (`noteId`); | ||||||
|  | CREATE INDEX `IDX_revisions_utcDateCreated` ON `revisions` (`utcDateCreated`); | ||||||
|  | CREATE INDEX `IDX_revisions_utcDateLastEdited` ON `revisions` (`utcDateLastEdited`); | ||||||
|  | CREATE INDEX `IDX_revisions_dateCreated` ON `revisions` (`dateCreated`); | ||||||
|  | CREATE INDEX `IDX_revisions_dateLastEdited` ON `revisions` (`dateLastEdited`); | ||||||
|  |  | ||||||
|  | UPDATE entity_changes SET entityName = 'revisions' WHERE entityName = 'note_revisions'; | ||||||
							
								
								
									
										21
									
								
								db/migrations/0219__attachments.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								db/migrations/0219__attachments.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | CREATE TABLE IF NOT EXISTS "attachments" | ||||||
|  | ( | ||||||
|  |     attachmentId      TEXT not null primary key, | ||||||
|  |     ownerId       TEXT not null, | ||||||
|  |     role         TEXT not null, | ||||||
|  |     mime         TEXT not null, | ||||||
|  |     title         TEXT not null, | ||||||
|  |     isProtected    INT  not null DEFAULT 0, | ||||||
|  |     position     INT  default 0 not null, | ||||||
|  |     blobId    TEXT DEFAULT null, | ||||||
|  |     dateModified TEXT NOT NULL, | ||||||
|  |     utcDateModified TEXT not null, | ||||||
|  |     utcDateScheduledForErasureSince TEXT DEFAULT NULL, | ||||||
|  |     isDeleted    INT  not null, | ||||||
|  |     deleteId    TEXT DEFAULT NULL); | ||||||
|  |  | ||||||
|  | CREATE INDEX IDX_attachments_ownerId_role | ||||||
|  |     on attachments (ownerId, role); | ||||||
|  |  | ||||||
|  | CREATE INDEX IDX_attachments_utcDateScheduledForErasureSince | ||||||
|  |     on attachments (utcDateScheduledForErasureSince); | ||||||
							
								
								
									
										23
									
								
								db/migrations/0220__migrate_images_to_attachments.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								db/migrations/0220__migrate_images_to_attachments.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | |||||||
|  | module.exports = () => { | ||||||
|  |     const beccaLoader = require("../../src/becca/becca_loader"); | ||||||
|  |     const becca = require("../../src/becca/becca"); | ||||||
|  |     const cls = require("../../src/services/cls"); | ||||||
|  |     const log = require("../../src/services/log"); | ||||||
|  |  | ||||||
|  |     cls.init(() => { | ||||||
|  |         beccaLoader.load(); | ||||||
|  |  | ||||||
|  |         for (const note of Object.values(becca.notes)) { | ||||||
|  |             try { | ||||||
|  |                 const attachment = note.convertToParentAttachment({autoConversion: true}); | ||||||
|  |  | ||||||
|  |                 if (attachment) { | ||||||
|  |                     log.info(`Auto-converted note '${note.noteId}' into attachment '${attachment.attachmentId}'.`); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |             catch (e) { | ||||||
|  |                 log.error(`Cannot convert note '${note.noteId}' to attachment: ${e.message} ${e.stack}`); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     }); | ||||||
|  | }; | ||||||
| @@ -0,0 +1,2 @@ | |||||||
|  | DELETE FROM options WHERE name = 'hideIncludedImages_main'; | ||||||
|  | DELETE FROM entity_changes WHERE entityName = 'options' AND entityId = 'hideIncludedImages_main'; | ||||||
| @@ -0,0 +1,2 @@ | |||||||
|  | UPDATE options SET name = 'openNoteContexts' WHERE name = 'openTabs'; | ||||||
|  | UPDATE entity_changes SET entityId = 'openNoteContexts' WHERE entityName = 'options' AND entityId = 'openTabs'; | ||||||
							
								
								
									
										1
									
								
								db/migrations/0223__NOOP.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								db/migrations/0223__NOOP.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | SELECT 1; | ||||||
							
								
								
									
										14
									
								
								db/migrations/0224__fix_blobIds.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								db/migrations/0224__fix_blobIds.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | |||||||
|  | UPDATE blobs SET blobId = REPLACE(blobId, '+', 'X'); | ||||||
|  | UPDATE blobs SET blobId = REPLACE(blobId, '/', 'Y'); | ||||||
|  |  | ||||||
|  | UPDATE notes SET blobId = REPLACE(blobId, '+', 'X'); | ||||||
|  | UPDATE notes SET blobId = REPLACE(blobId, '/', 'Y'); | ||||||
|  |  | ||||||
|  | UPDATE attachments SET blobId = REPLACE(blobId, '+', 'X'); | ||||||
|  | UPDATE attachments SET blobId = REPLACE(blobId, '/', 'Y'); | ||||||
|  |  | ||||||
|  | UPDATE revisions SET blobId = REPLACE(blobId, '+', 'X'); | ||||||
|  | UPDATE revisions SET blobId = REPLACE(blobId, '/', 'Y'); | ||||||
|  |  | ||||||
|  | UPDATE entity_changes SET entityId = REPLACE(entityId, '+', 'X') WHERE entityName = 'blobs'; | ||||||
|  | UPDATE entity_changes SET entityId = REPLACE(entityId, '/', 'Y') WHERE entityName = 'blobs'; | ||||||
							
								
								
									
										3
									
								
								db/migrations/0225__create_blobId_indices.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								db/migrations/0225__create_blobId_indices.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | CREATE INDEX IF NOT EXISTS IDX_notes_blobId on notes (blobId); | ||||||
|  | CREATE INDEX IF NOT EXISTS IDX_revisions_blobId on revisions (blobId); | ||||||
|  | CREATE INDEX IF NOT EXISTS IDX_attachments_blobId on attachments (blobId); | ||||||
							
								
								
									
										1
									
								
								db/migrations/0226__rename_noteSize_label.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								db/migrations/0226__rename_noteSize_label.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | UPDATE attributes SET value = 'contentAndAttachmentsAndRevisionsSize' WHERE name = 'orderBy' AND value = 'noteSize'; | ||||||
| @@ -35,6 +35,7 @@ CREATE TABLE IF NOT EXISTS "notes" ( | |||||||
|                                        `isProtected`	INT NOT NULL DEFAULT 0, |                                        `isProtected`	INT NOT NULL DEFAULT 0, | ||||||
|                                        `type` TEXT NOT NULL DEFAULT 'text', |                                        `type` TEXT NOT NULL DEFAULT 'text', | ||||||
|                                        `mime` TEXT NOT NULL DEFAULT 'text/html', |                                        `mime` TEXT NOT NULL DEFAULT 'text/html', | ||||||
|  |                                        blobId TEXT DEFAULT NULL, | ||||||
|                                        `isDeleted`	INT NOT NULL DEFAULT 0, |                                        `isDeleted`	INT NOT NULL DEFAULT 0, | ||||||
|                                        `deleteId`   TEXT DEFAULT NULL, |                                        `deleteId`   TEXT DEFAULT NULL, | ||||||
|                                        `dateCreated`	TEXT NOT NULL, |                                        `dateCreated`	TEXT NOT NULL, | ||||||
| @@ -42,27 +43,18 @@ CREATE TABLE IF NOT EXISTS "notes" ( | |||||||
|                                        `utcDateCreated`	TEXT NOT NULL, |                                        `utcDateCreated`	TEXT NOT NULL, | ||||||
|                                        `utcDateModified`	TEXT NOT NULL, |                                        `utcDateModified`	TEXT NOT NULL, | ||||||
|                                        PRIMARY KEY(`noteId`)); |                                        PRIMARY KEY(`noteId`)); | ||||||
| CREATE TABLE IF NOT EXISTS "note_contents" ( | CREATE TABLE IF NOT EXISTS "revisions" (`revisionId`	TEXT NOT NULL PRIMARY KEY, | ||||||
|                                                `noteId`	TEXT NOT NULL, |  | ||||||
|                                                `content`	TEXT NULL DEFAULT NULL, |  | ||||||
|                                                `dateModified` TEXT NOT NULL, |  | ||||||
|                                                `utcDateModified` TEXT NOT NULL, |  | ||||||
|                                                PRIMARY KEY(`noteId`) |  | ||||||
| ); |  | ||||||
| CREATE TABLE IF NOT EXISTS "note_revisions" (`noteRevisionId`	TEXT NOT NULL PRIMARY KEY, |  | ||||||
|                                              `noteId`	TEXT NOT NULL, |                                              `noteId`	TEXT NOT NULL, | ||||||
|                                              type TEXT DEFAULT '' NOT NULL, |                                              type TEXT DEFAULT '' NOT NULL, | ||||||
|                                              mime TEXT DEFAULT '' NOT NULL, |                                              mime TEXT DEFAULT '' NOT NULL, | ||||||
|                                              `title`	TEXT NOT NULL, |                                              `title`	TEXT NOT NULL, | ||||||
|                                              `isProtected`	INT NOT NULL DEFAULT 0, |                                              `isProtected`	INT NOT NULL DEFAULT 0, | ||||||
|  |                                             blobId TEXT DEFAULT NULL, | ||||||
|                                              `utcDateLastEdited` TEXT NOT NULL, |                                              `utcDateLastEdited` TEXT NOT NULL, | ||||||
|                                              `utcDateCreated` TEXT NOT NULL, |                                              `utcDateCreated` TEXT NOT NULL, | ||||||
|                                              `utcDateModified` TEXT NOT NULL, |                                              `utcDateModified` TEXT NOT NULL, | ||||||
|                                              `dateLastEdited` TEXT NOT NULL, |                                              `dateLastEdited` TEXT NOT NULL, | ||||||
|                                              `dateCreated` TEXT NOT NULL); |                                              `dateCreated` TEXT NOT NULL); | ||||||
| CREATE TABLE IF NOT EXISTS "note_revision_contents" (`noteRevisionId`	TEXT NOT NULL PRIMARY KEY, |  | ||||||
|                                                      `content`	TEXT, |  | ||||||
|                                                      `utcDateModified` TEXT NOT NULL); |  | ||||||
| CREATE TABLE IF NOT EXISTS "options" | CREATE TABLE IF NOT EXISTS "options" | ||||||
| ( | ( | ||||||
|     name TEXT not null PRIMARY KEY, |     name TEXT not null PRIMARY KEY, | ||||||
| @@ -94,11 +86,11 @@ CREATE INDEX `IDX_notes_dateCreated` ON `notes` (`dateCreated`); | |||||||
| CREATE INDEX `IDX_notes_dateModified` ON `notes` (`dateModified`); | CREATE INDEX `IDX_notes_dateModified` ON `notes` (`dateModified`); | ||||||
| CREATE INDEX `IDX_notes_utcDateModified` ON `notes` (`utcDateModified`); | CREATE INDEX `IDX_notes_utcDateModified` ON `notes` (`utcDateModified`); | ||||||
| CREATE INDEX `IDX_notes_utcDateCreated` ON `notes` (`utcDateCreated`); | CREATE INDEX `IDX_notes_utcDateCreated` ON `notes` (`utcDateCreated`); | ||||||
| CREATE INDEX `IDX_note_revisions_noteId` ON `note_revisions` (`noteId`); | CREATE INDEX `IDX_revisions_noteId` ON `revisions` (`noteId`); | ||||||
| CREATE INDEX `IDX_note_revisions_utcDateCreated` ON `note_revisions` (`utcDateCreated`); | CREATE INDEX `IDX_revisions_utcDateCreated` ON `revisions` (`utcDateCreated`); | ||||||
| CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`); | CREATE INDEX `IDX_revisions_utcDateLastEdited` ON `revisions` (`utcDateLastEdited`); | ||||||
| CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`); | CREATE INDEX `IDX_revisions_dateCreated` ON `revisions` (`dateCreated`); | ||||||
| CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`); | CREATE INDEX `IDX_revisions_dateLastEdited` ON `revisions` (`dateLastEdited`); | ||||||
| CREATE INDEX `IDX_entity_changes_changeId` ON `entity_changes` (`changeId`); | CREATE INDEX `IDX_entity_changes_changeId` ON `entity_changes` (`changeId`); | ||||||
| CREATE INDEX IDX_attributes_name_value | CREATE INDEX IDX_attributes_name_value | ||||||
|     on attributes (name, value); |     on attributes (name, value); | ||||||
| @@ -112,3 +104,31 @@ CREATE TABLE IF NOT EXISTS "recent_notes" | |||||||
|     notePath TEXT not null, |     notePath TEXT not null, | ||||||
|     utcDateCreated TEXT not null |     utcDateCreated TEXT not null | ||||||
| ); | ); | ||||||
|  | CREATE TABLE IF NOT EXISTS "blobs" ( | ||||||
|  |                                                `blobId`	TEXT NOT NULL, | ||||||
|  |                                                `content`	TEXT NULL DEFAULT NULL, | ||||||
|  |                                                `dateModified` TEXT NOT NULL, | ||||||
|  |                                                `utcDateModified` TEXT NOT NULL, | ||||||
|  |                                                PRIMARY KEY(`blobId`) | ||||||
|  | ); | ||||||
|  | CREATE TABLE IF NOT EXISTS "attachments" | ||||||
|  | ( | ||||||
|  |     attachmentId      TEXT not null primary key, | ||||||
|  |     ownerId       TEXT not null, | ||||||
|  |     role         TEXT not null, | ||||||
|  |     mime         TEXT not null, | ||||||
|  |     title         TEXT not null, | ||||||
|  |     isProtected    INT  not null DEFAULT 0, | ||||||
|  |     position     INT  default 0 not null, | ||||||
|  |     blobId    TEXT DEFAULT null, | ||||||
|  |     dateModified TEXT NOT NULL, | ||||||
|  |     utcDateModified TEXT not null, | ||||||
|  |     utcDateScheduledForErasureSince TEXT DEFAULT NULL, | ||||||
|  |     isDeleted    INT  not null, | ||||||
|  |     deleteId    TEXT DEFAULT NULL); | ||||||
|  | CREATE INDEX IDX_attachments_ownerId_role | ||||||
|  |     on attachments (ownerId, role); | ||||||
|  |  | ||||||
|  | CREATE INDEX IDX_notes_blobId on notes (blobId); | ||||||
|  | CREATE INDEX IDX_revisions_blobId on revisions (blobId); | ||||||
|  | CREATE INDEX IDX_attachments_blobId on attachments (blobId); | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | # Running `docker-compose up` will create/use the "trilium-data" directory in the user home | ||||||
|  | # Run `TRILIUM_DATA_DIR=/path/of/your/choice docker-compose up` to set a different directory | ||||||
| version: '2.1' | version: '2.1' | ||||||
| services: | services: | ||||||
|   trilium: |   trilium: | ||||||
| @@ -8,7 +10,7 @@ services: | |||||||
|     ports: |     ports: | ||||||
|       - "8080:8080" |       - "8080:8080" | ||||||
|     volumes: |     volumes: | ||||||
|       - trilium:/home/node/trilium-data |       - ${TRILIUM_DATA_DIR:-~/trilium-data}:/home/node/trilium-data | ||||||
|  |  | ||||||
| volumes: | volumes: | ||||||
|   trilium: |   trilium: | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ const fs = require("fs"); | |||||||
| const dataDir = require("./src/services/data_dir"); | const dataDir = require("./src/services/data_dir"); | ||||||
| const config = ini.parse(fs.readFileSync(dataDir.CONFIG_INI_PATH, 'utf-8')); | const config = ini.parse(fs.readFileSync(dataDir.CONFIG_INI_PATH, 'utf-8')); | ||||||
|  |  | ||||||
| if (config.https) { | if (config.Network.https) { | ||||||
|     // built-in TLS (terminated by trilium) is not supported yet, PRs are welcome |     // built-in TLS (terminated by trilium) is not supported yet, PRs are welcome | ||||||
|     // for reverse proxy terminated TLS this will works since config.https will be false |     // for reverse proxy terminated TLS this will works since config.https will be false | ||||||
|     process.exit(0); |     process.exit(0); | ||||||
|   | |||||||
| @@ -93,7 +93,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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line16">line 16</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line18">line 18</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -183,7 +183,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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line53">line 53</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line35">line 35</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -211,7 +211,7 @@ | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="addEntityChange"><span class="type-signature">(protected) </span>addEntityChange<span class="signature">()</span><span class="type-signature"></span></h4> |     <h4 class="name" id="_getContent"><span class="type-signature">(protected) </span>_getContent<span class="signature">()</span><span class="type-signature"> → {string|Buffer}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -259,7 +259,112 @@ | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line62">line 62</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line250">line 250</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">string</span> | ||||||
|  | | | ||||||
|  |  | ||||||
|  | <span class="param-type">Buffer</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="_setContent"><span class="type-signature">(protected) </span>_setContent<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="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line128">line 128</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -343,7 +448,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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line18">line 18</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line20">line 20</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -379,7 +484,7 @@ | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="generateHash"><span class="type-signature">(protected) </span>generateHash<span class="signature">()</span><span class="type-signature"></span></h4> |     <h4 class="name" id="generateHash"><span class="type-signature">(protected) </span>generateHash<span class="signature">()</span><span class="type-signature"> → {string}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -427,7 +532,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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line30">line 30</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line59">line 59</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -452,6 +557,22 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">string</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -463,7 +584,9 @@ | |||||||
|              |              | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="generateIdIfNecessary"><span class="type-signature">(protected) </span>generateIdIfNecessary<span class="signature">()</span><span class="type-signature"></span></h4> |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="getPojo"><span class="type-signature">(abstract, protected) </span>getPojo<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -511,7 +634,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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line23">line 23</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line82">line 82</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -679,7 +802,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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line45">line 45</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line27">line 27</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -725,7 +848,7 @@ | |||||||
| <div class="description"> | <div class="description"> | ||||||
|     Mark the entity as (soft) deleted. It will be completely erased later. |     Mark the entity as (soft) deleted. It will be completely erased later. | ||||||
|  |  | ||||||
| This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | This is a low-level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -833,7 +956,91 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line128">line 128</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line267">line 267</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="putEntityChange"><span class="type-signature">(protected) </span>putEntityChange<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="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line44">line 44</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -921,7 +1128,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line83">line 83</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line91">line 91</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -985,7 +1192,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
| </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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -268,7 +268,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line53">line 53</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line35">line 35</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -772,7 +772,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="addEntityChange"><span class="type-signature">(protected) </span>addEntityChange<span class="signature">()</span><span class="type-signature"></span></h4> |     <h4 class="name" id="_getContent"><span class="type-signature">(protected) </span>_getContent<span class="signature">()</span><span class="type-signature"> → {string|Buffer}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -802,7 +802,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|     <dt class="tag-overrides">Overrides:</dt> |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|     <dd class="tag-overrides"><ul class="dummy"><li> |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|         <a href="AbstractBeccaEntity.html#addEntityChange">AbstractBeccaEntity#addEntityChange</a> |         <a href="AbstractBeccaEntity.html#_getContent">AbstractBeccaEntity#_getContent</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -825,7 +825,117 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line62">line 62</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line250">line 250</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">string</span> | ||||||
|  | | | ||||||
|  |  | ||||||
|  | <span class="param-type">Buffer</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="_setContent"><span class="type-signature">(protected) </span>_setContent<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|  |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|  |         <a href="AbstractBeccaEntity.html#_setContent">AbstractBeccaEntity#_setContent</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line128">line 128</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -914,7 +1024,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line18">line 18</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line20">line 20</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -950,7 +1060,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="generateHash"><span class="type-signature">(protected) </span>generateHash<span class="signature">()</span><span class="type-signature"></span></h4> |     <h4 class="name" id="generateHash"><span class="type-signature">(protected) </span>generateHash<span class="signature">()</span><span class="type-signature"> → {string}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -1003,7 +1113,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line30">line 30</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line59">line 59</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1028,98 +1138,27 @@ and relation (representing named relationship between source and target note)</d | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|          |          | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">string</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|              |     </dd> | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <h4 class="name" id="generateIdIfNecessary"><span class="type-signature">(protected) </span>generateIdIfNecessary<span class="signature">()</span><span class="type-signature"></span></h4> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-overrides">Overrides:</dt> |  | ||||||
|     <dd class="tag-overrides"><ul class="dummy"><li> |  | ||||||
|         <a href="AbstractBeccaEntity.html#generateIdIfNecessary">AbstractBeccaEntity#generateIdIfNecessary</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line23">line 23</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> | </dl> | ||||||
|  |  | ||||||
|      |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |          | ||||||
| @@ -1227,6 +1266,95 @@ and relation (representing named relationship between source and target note)</d | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="getPojo"><span class="type-signature">(abstract, protected) </span>getPojo<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|  |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|  |         <a href="AbstractBeccaEntity.html#getPojo">AbstractBeccaEntity#getPojo</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line82">line 82</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |          | ||||||
|              |              | ||||||
|  |  | ||||||
| @@ -1480,7 +1608,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line45">line 45</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line27">line 27</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1628,7 +1756,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
| <div class="description"> | <div class="description"> | ||||||
|     Mark the entity as (soft) deleted. It will be completely erased later. |     Mark the entity as (soft) deleted. It will be completely erased later. | ||||||
|  |  | ||||||
| This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | This is a low-level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -1741,7 +1869,96 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line128">line 128</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line267">line 267</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="putEntityChange"><span class="type-signature">(protected) </span>putEntityChange<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|  |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|  |         <a href="AbstractBeccaEntity.html#putEntityChange">AbstractBeccaEntity#putEntityChange</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line44">line 44</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1834,7 +2051,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line83">line 83</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line91">line 91</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1898,7 +2115,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
| </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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
| @@ -203,7 +203,7 @@ Always check noteId instead.</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="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line53">line 53</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line35">line 35</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -463,7 +463,7 @@ of deletion should not act as a clone. | |||||||
|      |      | ||||||
|     <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_bbranch.js.html">becca/entities/bbranch.js</a>, <a href="becca_entities_bbranch.js.html#line133">line 133</a> |         <a href="becca_entities_bbranch.js.html">becca/entities/bbranch.js</a>, <a href="becca_entities_bbranch.js.html#line134">line 134</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -657,7 +657,7 @@ of deletion should not act as a clone. | |||||||
|      |      | ||||||
|     <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_bbranch.js.html">becca/entities/bbranch.js</a>, <a href="becca_entities_bbranch.js.html#line111">line 111</a> |         <a href="becca_entities_bbranch.js.html">becca/entities/bbranch.js</a>, <a href="becca_entities_bbranch.js.html#line112">line 112</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -892,7 +892,7 @@ of deletion should not act as a clone. | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="addEntityChange"><span class="type-signature">(protected) </span>addEntityChange<span class="signature">()</span><span class="type-signature"></span></h4> |     <h4 class="name" id="_getContent"><span class="type-signature">(protected) </span>_getContent<span class="signature">()</span><span class="type-signature"> → {string|Buffer}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -922,7 +922,7 @@ of deletion should not act as a clone. | |||||||
|      |      | ||||||
|     <dt class="tag-overrides">Overrides:</dt> |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|     <dd class="tag-overrides"><ul class="dummy"><li> |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|         <a href="AbstractBeccaEntity.html#addEntityChange">AbstractBeccaEntity#addEntityChange</a> |         <a href="AbstractBeccaEntity.html#_getContent">AbstractBeccaEntity#_getContent</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -945,7 +945,117 @@ of deletion should not act as a clone. | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line62">line 62</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line250">line 250</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">string</span> | ||||||
|  | | | ||||||
|  |  | ||||||
|  | <span class="param-type">Buffer</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="_setContent"><span class="type-signature">(protected) </span>_setContent<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|  |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|  |         <a href="AbstractBeccaEntity.html#_setContent">AbstractBeccaEntity#_setContent</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line128">line 128</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1034,7 +1144,7 @@ of deletion should not act as a clone. | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line18">line 18</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line20">line 20</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1216,7 +1326,7 @@ of deletion should not act as a clone. | |||||||
|      |      | ||||||
|     <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_bbranch.js.html">becca/entities/bbranch.js</a>, <a href="becca_entities_bbranch.js.html#line145">line 145</a> |         <a href="becca_entities_bbranch.js.html">becca/entities/bbranch.js</a>, <a href="becca_entities_bbranch.js.html#line146">line 146</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1274,7 +1384,7 @@ of deletion should not act as a clone. | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="generateHash"><span class="type-signature">(protected) </span>generateHash<span class="signature">()</span><span class="type-signature"></span></h4> |     <h4 class="name" id="generateHash"><span class="type-signature">(protected) </span>generateHash<span class="signature">()</span><span class="type-signature"> → {string}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -1327,7 +1437,7 @@ of deletion should not act as a clone. | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line30">line 30</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line59">line 59</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1352,6 +1462,22 @@ of deletion should not act as a clone. | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">string</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1363,7 +1489,111 @@ of deletion should not act as a clone. | |||||||
|              |              | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="generateIdIfNecessary"><span class="type-signature">(protected) </span>generateIdIfNecessary<span class="signature">()</span><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"> → {<a href="BNote.html">BNote</a>}</span></h4> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="becca_entities_bbranch.js.html">becca/entities/bbranch.js</a>, <a href="becca_entities_bbranch.js.html#line107">line 107</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type"><a href="BNote.html">BNote</a></span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="getPojo"><span class="type-signature">(abstract, protected) </span>getPojo<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -1393,7 +1623,7 @@ of deletion should not act as a clone. | |||||||
|      |      | ||||||
|     <dt class="tag-overrides">Overrides:</dt> |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|     <dd class="tag-overrides"><ul class="dummy"><li> |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|         <a href="AbstractBeccaEntity.html#generateIdIfNecessary">AbstractBeccaEntity#generateIdIfNecessary</a> |         <a href="AbstractBeccaEntity.html#getPojo">AbstractBeccaEntity#getPojo</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1416,7 +1646,7 @@ of deletion should not act as a clone. | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line23">line 23</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line82">line 82</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1594,7 +1824,7 @@ of deletion should not act as a clone. | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line45">line 45</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line27">line 27</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1640,7 +1870,7 @@ of deletion should not act as a clone. | |||||||
| <div class="description"> | <div class="description"> | ||||||
|     Mark the entity as (soft) deleted. It will be completely erased later. |     Mark the entity as (soft) deleted. It will be completely erased later. | ||||||
|  |  | ||||||
| This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | This is a low-level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -1753,7 +1983,96 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line128">line 128</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line267">line 267</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="putEntityChange"><span class="type-signature">(protected) </span>putEntityChange<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|  |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|  |         <a href="AbstractBeccaEntity.html#putEntityChange">AbstractBeccaEntity#putEntityChange</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line44">line 44</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1846,7 +2165,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line83">line 83</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line91">line 91</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1910,7 +2229,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
| </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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
| @@ -205,7 +205,7 @@ from tokenHash and token.</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="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line53">line 53</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line35">line 35</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -641,7 +641,7 @@ from tokenHash and token.</div> | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="addEntityChange"><span class="type-signature">(protected) </span>addEntityChange<span class="signature">()</span><span class="type-signature"></span></h4> |     <h4 class="name" id="_getContent"><span class="type-signature">(protected) </span>_getContent<span class="signature">()</span><span class="type-signature"> → {string|Buffer}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -671,7 +671,7 @@ from tokenHash and token.</div> | |||||||
|      |      | ||||||
|     <dt class="tag-overrides">Overrides:</dt> |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|     <dd class="tag-overrides"><ul class="dummy"><li> |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|         <a href="AbstractBeccaEntity.html#addEntityChange">AbstractBeccaEntity#addEntityChange</a> |         <a href="AbstractBeccaEntity.html#_getContent">AbstractBeccaEntity#_getContent</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -694,7 +694,117 @@ from tokenHash and token.</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="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line62">line 62</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line250">line 250</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">string</span> | ||||||
|  | | | ||||||
|  |  | ||||||
|  | <span class="param-type">Buffer</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="_setContent"><span class="type-signature">(protected) </span>_setContent<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|  |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|  |         <a href="AbstractBeccaEntity.html#_setContent">AbstractBeccaEntity#_setContent</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line128">line 128</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -783,7 +893,7 @@ from tokenHash and token.</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="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line18">line 18</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line20">line 20</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -819,7 +929,7 @@ from tokenHash and token.</div> | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="generateHash"><span class="type-signature">(protected) </span>generateHash<span class="signature">()</span><span class="type-signature"></span></h4> |     <h4 class="name" id="generateHash"><span class="type-signature">(protected) </span>generateHash<span class="signature">()</span><span class="type-signature"> → {string}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -872,7 +982,7 @@ from tokenHash and token.</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="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line30">line 30</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line59">line 59</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -897,6 +1007,22 @@ from tokenHash and token.</div> | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">string</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -908,7 +1034,9 @@ from tokenHash and token.</div> | |||||||
|              |              | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="generateIdIfNecessary"><span class="type-signature">(protected) </span>generateIdIfNecessary<span class="signature">()</span><span class="type-signature"></span></h4> |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="getPojo"><span class="type-signature">(abstract, protected) </span>getPojo<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -938,7 +1066,7 @@ from tokenHash and token.</div> | |||||||
|      |      | ||||||
|     <dt class="tag-overrides">Overrides:</dt> |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|     <dd class="tag-overrides"><ul class="dummy"><li> |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|         <a href="AbstractBeccaEntity.html#generateIdIfNecessary">AbstractBeccaEntity#generateIdIfNecessary</a> |         <a href="AbstractBeccaEntity.html#getPojo">AbstractBeccaEntity#getPojo</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -961,7 +1089,7 @@ from tokenHash and token.</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="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line23">line 23</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line82">line 82</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1139,7 +1267,7 @@ from tokenHash and token.</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="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line45">line 45</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line27">line 27</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1185,7 +1313,7 @@ from tokenHash and token.</div> | |||||||
| <div class="description"> | <div class="description"> | ||||||
|     Mark the entity as (soft) deleted. It will be completely erased later. |     Mark the entity as (soft) deleted. It will be completely erased later. | ||||||
|  |  | ||||||
| This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | This is a low-level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -1298,7 +1426,96 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line128">line 128</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line267">line 267</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="putEntityChange"><span class="type-signature">(protected) </span>putEntityChange<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|  |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|  |         <a href="AbstractBeccaEntity.html#putEntityChange">AbstractBeccaEntity#putEntityChange</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line44">line 44</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1391,7 +1608,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line83">line 83</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line91">line 91</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1455,7 +1672,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
| </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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -30,7 +30,7 @@ | |||||||
|      |      | ||||||
|         <h2><span class="attribs"><span class="type-signature"></span></span>BOption<span class="signature">()</span><span class="type-signature"></span></h2> |         <h2><span class="attribs"><span class="type-signature"></span></span>BOption<span class="signature">()</span><span class="type-signature"></span></h2> | ||||||
|          |          | ||||||
|             <div class="class-description">Option represents name-value pair, either directly configurable by the user or some system property.</div> |             <div class="class-description">Option represents a name-value pair, either directly configurable by the user or some system property.</div> | ||||||
|          |          | ||||||
|      |      | ||||||
| </header> | </header> | ||||||
| @@ -199,7 +199,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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line53">line 53</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line35">line 35</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -499,7 +499,7 @@ | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="addEntityChange"><span class="type-signature">(protected) </span>addEntityChange<span class="signature">()</span><span class="type-signature"></span></h4> |     <h4 class="name" id="_getContent"><span class="type-signature">(protected) </span>_getContent<span class="signature">()</span><span class="type-signature"> → {string|Buffer}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -529,7 +529,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-overrides">Overrides:</dt> |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|     <dd class="tag-overrides"><ul class="dummy"><li> |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|         <a href="AbstractBeccaEntity.html#addEntityChange">AbstractBeccaEntity#addEntityChange</a> |         <a href="AbstractBeccaEntity.html#_getContent">AbstractBeccaEntity#_getContent</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -552,7 +552,117 @@ | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line62">line 62</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line250">line 250</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">string</span> | ||||||
|  | | | ||||||
|  |  | ||||||
|  | <span class="param-type">Buffer</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="_setContent"><span class="type-signature">(protected) </span>_setContent<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|  |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|  |         <a href="AbstractBeccaEntity.html#_setContent">AbstractBeccaEntity#_setContent</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line128">line 128</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -641,7 +751,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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line18">line 18</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line20">line 20</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -677,7 +787,7 @@ | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="generateHash"><span class="type-signature">(protected) </span>generateHash<span class="signature">()</span><span class="type-signature"></span></h4> |     <h4 class="name" id="generateHash"><span class="type-signature">(protected) </span>generateHash<span class="signature">()</span><span class="type-signature"> → {string}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -730,7 +840,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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line30">line 30</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line59">line 59</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -755,6 +865,22 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">string</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -766,7 +892,9 @@ | |||||||
|              |              | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="generateIdIfNecessary"><span class="type-signature">(protected) </span>generateIdIfNecessary<span class="signature">()</span><span class="type-signature"></span></h4> |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="getPojo"><span class="type-signature">(abstract, protected) </span>getPojo<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -796,7 +924,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-overrides">Overrides:</dt> |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|     <dd class="tag-overrides"><ul class="dummy"><li> |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|         <a href="AbstractBeccaEntity.html#generateIdIfNecessary">AbstractBeccaEntity#generateIdIfNecessary</a> |         <a href="AbstractBeccaEntity.html#getPojo">AbstractBeccaEntity#getPojo</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -819,7 +947,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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line23">line 23</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line82">line 82</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -997,7 +1125,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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line45">line 45</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line27">line 27</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1043,7 +1171,7 @@ | |||||||
| <div class="description"> | <div class="description"> | ||||||
|     Mark the entity as (soft) deleted. It will be completely erased later. |     Mark the entity as (soft) deleted. It will be completely erased later. | ||||||
|  |  | ||||||
| This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | This is a low-level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -1156,7 +1284,96 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line128">line 128</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line267">line 267</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="putEntityChange"><span class="type-signature">(protected) </span>putEntityChange<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|  |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|  |         <a href="AbstractBeccaEntity.html#putEntityChange">AbstractBeccaEntity#putEntityChange</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line44">line 44</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1249,7 +1466,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line83">line 83</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line91">line 91</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1313,7 +1530,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
| </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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
| @@ -199,7 +199,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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line53">line 53</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line35">line 35</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -431,7 +431,7 @@ | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="addEntityChange"><span class="type-signature">(protected) </span>addEntityChange<span class="signature">()</span><span class="type-signature"></span></h4> |     <h4 class="name" id="_getContent"><span class="type-signature">(protected) </span>_getContent<span class="signature">()</span><span class="type-signature"> → {string|Buffer}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -461,7 +461,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-overrides">Overrides:</dt> |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|     <dd class="tag-overrides"><ul class="dummy"><li> |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|         <a href="AbstractBeccaEntity.html#addEntityChange">AbstractBeccaEntity#addEntityChange</a> |         <a href="AbstractBeccaEntity.html#_getContent">AbstractBeccaEntity#_getContent</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -484,7 +484,117 @@ | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line62">line 62</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line250">line 250</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">string</span> | ||||||
|  | | | ||||||
|  |  | ||||||
|  | <span class="param-type">Buffer</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="_setContent"><span class="type-signature">(protected) </span>_setContent<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|  |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|  |         <a href="AbstractBeccaEntity.html#_setContent">AbstractBeccaEntity#_setContent</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line128">line 128</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -573,7 +683,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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line18">line 18</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line20">line 20</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -609,7 +719,7 @@ | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="generateHash"><span class="type-signature">(protected) </span>generateHash<span class="signature">()</span><span class="type-signature"></span></h4> |     <h4 class="name" id="generateHash"><span class="type-signature">(protected) </span>generateHash<span class="signature">()</span><span class="type-signature"> → {string}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -662,7 +772,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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line30">line 30</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line59">line 59</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -687,6 +797,22 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">string</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -698,7 +824,9 @@ | |||||||
|              |              | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="generateIdIfNecessary"><span class="type-signature">(protected) </span>generateIdIfNecessary<span class="signature">()</span><span class="type-signature"></span></h4> |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="getPojo"><span class="type-signature">(abstract, protected) </span>getPojo<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -728,7 +856,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-overrides">Overrides:</dt> |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|     <dd class="tag-overrides"><ul class="dummy"><li> |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|         <a href="AbstractBeccaEntity.html#generateIdIfNecessary">AbstractBeccaEntity#generateIdIfNecessary</a> |         <a href="AbstractBeccaEntity.html#getPojo">AbstractBeccaEntity#getPojo</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -751,7 +879,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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line23">line 23</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line82">line 82</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -929,7 +1057,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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line45">line 45</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line27">line 27</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -975,7 +1103,7 @@ | |||||||
| <div class="description"> | <div class="description"> | ||||||
|     Mark the entity as (soft) deleted. It will be completely erased later. |     Mark the entity as (soft) deleted. It will be completely erased later. | ||||||
|  |  | ||||||
| This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | This is a low-level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -1088,7 +1216,96 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line128">line 128</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line267">line 267</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="putEntityChange"><span class="type-signature">(protected) </span>putEntityChange<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-overrides">Overrides:</dt> | ||||||
|  |     <dd class="tag-overrides"><ul class="dummy"><li> | ||||||
|  |         <a href="AbstractBeccaEntity.html#putEntityChange">AbstractBeccaEntity#putEntityChange</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line44">line 44</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1181,7 +1398,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
|      |      | ||||||
|     <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_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line83">line 83</a> |         <a href="becca_entities_abstract_becca_entity.js.html">becca/entities/abstract_becca_entity.js</a>, <a href="becca_entities_abstract_becca_entity.js.html#line91">line 91</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1245,7 +1462,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' | |||||||
| </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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
							
								
								
									
										3243
									
								
								docs/backend_api/BRevision.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3243
									
								
								docs/backend_api/BRevision.html
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -94,7 +94,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line29">line 29</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line30">line 30</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -240,7 +240,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line537">line 537</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line594">line 594</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -352,7 +352,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line45">line 45</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line46">line 46</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -423,7 +423,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote. | |||||||
|  |  | ||||||
|              |              | ||||||
|  |  | ||||||
|             <td class="description last">where script is currently executing. Don't mix this up with concept of active note</td> |             <td class="description last">where the script is currently executing. Don't mix this up with the concept of active note</td> | ||||||
|         </tr> |         </tr> | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -462,7 +462,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line33">line 33</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line34">line 34</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -572,7 +572,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line47">line 47</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line48">line 48</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -643,7 +643,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote. | |||||||
|  |  | ||||||
|              |              | ||||||
|  |  | ||||||
|             <td class="description last">whose event triggered this executions</td> |             <td class="description last">whose event triggered this execution</td> | ||||||
|         </tr> |         </tr> | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -682,7 +682,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line35">line 35</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line36">line 36</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -792,7 +792,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line437">line 437</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line438">line 438</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -863,7 +863,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote. | |||||||
|  |  | ||||||
|              |              | ||||||
|  |  | ||||||
|             <td class="description last">where script started executing</td> |             <td class="description last">where the script started executing</td> | ||||||
|         </tr> |         </tr> | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -902,7 +902,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line31">line 31</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line32">line 32</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1012,7 +1012,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line49">line 49</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line50">line 50</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1188,7 +1188,7 @@ JSON MIME type. See also createNewNote() for more options. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line198">line 198</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line199">line 199</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1691,7 +1691,7 @@ JSON MIME type. See also createNewNote() for more options. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line221">line 221</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line222">line 222</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -2311,7 +2311,7 @@ JSON MIME type. See also createNewNote() for more options. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line241">line 241</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line242">line 242</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -2817,7 +2817,7 @@ JSON MIME type. See also createNewNote() for more options. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line464">line 464</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line465">line 465</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -3018,7 +3018,7 @@ JSON MIME type. See also createNewNote() for more options. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line181">line 181</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line182">line 182</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -3200,7 +3200,7 @@ JSON MIME type. See also createNewNote() for more options. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line158">line 158</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line159">line 159</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -3360,7 +3360,7 @@ JSON MIME type. See also createNewNote() for more options. | |||||||
|  |  | ||||||
|              |              | ||||||
|  |  | ||||||
|             <td class="description last">if branch will be created between note and parent note, set this prefix</td> |             <td class="description last">if branch is created between note and parent note, set this prefix</td> | ||||||
|         </tr> |         </tr> | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -3401,7 +3401,7 @@ JSON MIME type. See also createNewNote() for more options. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line148">line 148</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line149">line 149</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -3552,7 +3552,7 @@ JSON MIME type. See also createNewNote() for more options. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line425">line 425</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line426">line 426</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -3753,7 +3753,7 @@ JSON MIME type. See also createNewNote() for more options. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line530">line 530</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line531">line 531</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -3855,7 +3855,7 @@ JSON MIME type. See also createNewNote() for more options. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line443">line 443</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line444">line 444</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -4013,7 +4013,7 @@ JSON MIME type. See also createNewNote() for more options. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line78">line 78</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line79">line 79</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -4167,7 +4167,7 @@ JSON MIME type. See also createNewNote() for more options. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line71">line 71</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line72">line 72</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -4368,7 +4368,7 @@ JSON MIME type. See also createNewNote() for more options. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line324">line 324</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line325">line 325</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -4478,7 +4478,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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line57">line 57</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line58">line 58</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -4679,7 +4679,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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line355">line 355</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line356">line 356</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -4833,7 +4833,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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line64">line 64</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line65">line 65</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -5034,7 +5034,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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line137">line 137</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line138">line 138</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -5235,7 +5235,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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line127">line 127</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line128">line 128</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -5341,7 +5341,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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line314">line 314</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line315">line 315</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -5511,7 +5511,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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line333">line 333</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line334">line 334</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -5814,7 +5814,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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line345">line 345</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line346">line 346</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -6015,7 +6015,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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line365">line 365</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line366">line 366</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -6168,7 +6168,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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line287">line 287</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line288">line 288</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -6272,7 +6272,7 @@ if some action needs to happen on only one specific instance. | |||||||
|             <td class="type"> |             <td class="type"> | ||||||
|              |              | ||||||
|                  |                  | ||||||
| <span class="param-type">number</span> | <span class="param-type">int</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|              |              | ||||||
| @@ -6323,7 +6323,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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line418">line 418</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line419">line 419</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -6381,6 +6381,355 @@ if some action needs to happen on only one specific instance. | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|  |     <h4 class="name" id="runOnFrontend"><span class="type-signature"></span>runOnFrontend<span class="signature">(script, params)</span><span class="type-signature"> → {undefined}</span></h4> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <div class="description"> | ||||||
|  |     Executes given anonymous function on the frontend(s). | ||||||
|  | Internally this serializes the anonymous function into string and sends it to frontend(s) via WebSocket. | ||||||
|  | Note that there can be multiple connected frontend instances (e.g. in different tabs). In such case, all | ||||||
|  | instances execute the given function. | ||||||
|  | </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>script</code></td> | ||||||
|  |              | ||||||
|  |  | ||||||
|  |             <td class="type"> | ||||||
|  |              | ||||||
|  |                  | ||||||
|  | <span class="param-type">string</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |              | ||||||
|  |             </td> | ||||||
|  |  | ||||||
|  |              | ||||||
|  |  | ||||||
|  |              | ||||||
|  |  | ||||||
|  |             <td class="description last">script to be executed on the frontend</td> | ||||||
|  |         </tr> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |         <tr> | ||||||
|  |              | ||||||
|  |                 <td class="name"><code>params</code></td> | ||||||
|  |              | ||||||
|  |  | ||||||
|  |             <td class="type"> | ||||||
|  |              | ||||||
|  |                  | ||||||
|  | <span class="param-type">Array.<?></span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |              | ||||||
|  |             </td> | ||||||
|  |  | ||||||
|  |              | ||||||
|  |  | ||||||
|  |              | ||||||
|  |  | ||||||
|  |             <td class="description last">list of parameters to the anonymous function to be sent to frontend</td> | ||||||
|  |         </tr> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     </tbody> | ||||||
|  | </table> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line544">line 544</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  | <div class="param-desc"> | ||||||
|  |     - no return value is provided. | ||||||
|  | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">undefined</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="runOutsideOfSync"><span class="type-signature"></span>runOutsideOfSync<span class="signature">(callback)</span><span class="type-signature"> → {Promise}</span></h4> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <div class="description"> | ||||||
|  |     Sync process can make data intermittently inconsistent. Scripts which require strong data consistency | ||||||
|  | can use this function to wait for a possible sync process to finish and prevent new sync process from starting | ||||||
|  | while it is running. | ||||||
|  |  | ||||||
|  | Because this is an async process, the inner callback doesn't have automatic transaction handling, so in case | ||||||
|  | you need to make some DB changes, you need to surround your call with api.transactional(...) | ||||||
|  | </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>callback</code></td> | ||||||
|  |              | ||||||
|  |  | ||||||
|  |             <td class="type"> | ||||||
|  |              | ||||||
|  |                  | ||||||
|  | <span class="param-type">function</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |              | ||||||
|  |             </td> | ||||||
|  |  | ||||||
|  |              | ||||||
|  |  | ||||||
|  |              | ||||||
|  |  | ||||||
|  |             <td class="description last">function to be executed while sync process is not running</td> | ||||||
|  |         </tr> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     </tbody> | ||||||
|  | </table> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line587">line 587</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  | <div class="param-desc"> | ||||||
|  |     - resolves once the callback is finished (callback is awaited) | ||||||
|  | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">Promise</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|     <h4 class="name" id="searchForNote"><span class="type-signature"></span>searchForNote<span class="signature">(query, searchParams<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="BNote.html">BNote</a>|null}</span></h4> |     <h4 class="name" id="searchForNote"><span class="type-signature"></span>searchForNote<span class="signature">(query, searchParams<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="BNote.html">BNote</a>|null}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -6526,7 +6875,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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line113">line 113</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line114">line 114</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -6728,7 +7077,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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line89">line 89</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line90">line 90</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -6937,7 +7286,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line399">line 399</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line400">line 400</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -7280,7 +7629,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line379">line 379</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line380">line 380</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -7463,7 +7812,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look | |||||||
|  |  | ||||||
|              |              | ||||||
|  |  | ||||||
|             <td class="description last">if branch will be created between note and parent note, set this prefix</td> |             <td class="description last">if branch is created between note and parent note, set this prefix</td> | ||||||
|         </tr> |         </tr> | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -7504,7 +7853,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line170">line 170</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line171">line 171</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -7660,7 +8009,7 @@ exists, then we'll use that transaction. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line409">line 409</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line410">line 410</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -7815,7 +8164,7 @@ exists, then we'll use that transaction. | |||||||
|      |      | ||||||
|     <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_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line432">line 432</a> |         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line433">line 433</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -7883,7 +8232,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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
| @@ -35,6 +35,8 @@ const eventService = require("../../services/events"); | |||||||
| const dateUtils = require("../../services/date_utils"); | const dateUtils = require("../../services/date_utils"); | ||||||
| const cls = require("../../services/cls"); | const cls = require("../../services/cls"); | ||||||
| const log = require("../../services/log"); | const log = require("../../services/log"); | ||||||
|  | const protectedSessionService = require("../../services/protected_session"); | ||||||
|  | const blobService = require("../../services/blob"); | ||||||
|  |  | ||||||
| let becca = null; | let becca = null; | ||||||
|  |  | ||||||
| @@ -44,31 +46,11 @@ let becca = null; | |||||||
| class AbstractBeccaEntity { | class AbstractBeccaEntity { | ||||||
|     /** @protected */ |     /** @protected */ | ||||||
|     beforeSaving() { |     beforeSaving() { | ||||||
|         this.generateIdIfNecessary(); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** @protected */ |  | ||||||
|     generateIdIfNecessary() { |  | ||||||
|         if (!this[this.constructor.primaryKeyName]) { |         if (!this[this.constructor.primaryKeyName]) { | ||||||
|             this[this.constructor.primaryKeyName] = utils.newEntityId(); |             this[this.constructor.primaryKeyName] = utils.newEntityId(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @protected */ |  | ||||||
|     generateHash(isDeleted = false) { |  | ||||||
|         let contentToHash = ""; |  | ||||||
|  |  | ||||||
|         for (const propertyName of this.constructor.hashedProperties) { |  | ||||||
|             contentToHash += `|${this[propertyName]}`; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (isDeleted) { |  | ||||||
|             contentToHash += "|deleted"; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         return utils.hash(contentToHash).substr(0, 10); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** @protected */ |     /** @protected */ | ||||||
|     getUtcDateChanged() { |     getUtcDateChanged() { | ||||||
|         return this.utcDateModified || this.utcDateCreated; |         return this.utcDateModified || this.utcDateCreated; | ||||||
| @@ -87,8 +69,8 @@ class AbstractBeccaEntity { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @protected */ |     /** @protected */ | ||||||
|     addEntityChange(isDeleted = false) { |     putEntityChange(isDeleted) { | ||||||
|         entityChangesService.addEntityChange({ |         entityChangesService.putEntityChange({ | ||||||
|             entityName: this.constructor.entityName, |             entityName: this.constructor.entityName, | ||||||
|             entityId: this[this.constructor.primaryKeyName], |             entityId: this[this.constructor.primaryKeyName], | ||||||
|             hash: this.generateHash(isDeleted), |             hash: this.generateHash(isDeleted), | ||||||
| @@ -98,11 +80,37 @@ class AbstractBeccaEntity { | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * @protected | ||||||
|  |      * @returns {string} | ||||||
|  |      */ | ||||||
|  |     generateHash(isDeleted) { | ||||||
|  |         let contentToHash = ""; | ||||||
|  |  | ||||||
|  |         for (const propertyName of this.constructor.hashedProperties) { | ||||||
|  |             contentToHash += `|${this[propertyName]}`; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (isDeleted) { | ||||||
|  |             contentToHash += "|deleted"; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return utils.hash(contentToHash).substr(0, 10); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** @protected */ |     /** @protected */ | ||||||
|     getPojoToSave() { |     getPojoToSave() { | ||||||
|         return this.getPojo(); |         return this.getPojo(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * @protected | ||||||
|  |      * @abstract | ||||||
|  |      */ | ||||||
|  |     getPojo() { | ||||||
|  |         throw new Error(`Unimplemented getPojo() for entity '${this.constructor.name}'`) | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Saves entity - executes SQL, but doesn't commit the transaction on its own |      * Saves entity - executes SQL, but doesn't commit the transaction on its own | ||||||
|      * |      * | ||||||
| @@ -114,9 +122,7 @@ class AbstractBeccaEntity { | |||||||
|  |  | ||||||
|         const isNewEntity = !this[primaryKeyName]; |         const isNewEntity = !this[primaryKeyName]; | ||||||
|  |  | ||||||
|         if (this.beforeSaving) { |         this.beforeSaving(opts); | ||||||
|             this.beforeSaving(opts); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         const pojo = this.getPojoToSave(); |         const pojo = this.getPojoToSave(); | ||||||
|  |  | ||||||
| @@ -127,7 +133,7 @@ class AbstractBeccaEntity { | |||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             this.addEntityChange(false); |             this.putEntityChange(!!this.isDeleted); | ||||||
|  |  | ||||||
|             if (!cls.isEntityEventsDisabled()) { |             if (!cls.isEntityEventsDisabled()) { | ||||||
|                 const eventPayload = { |                 const eventPayload = { | ||||||
| @@ -146,10 +152,143 @@ class AbstractBeccaEntity { | |||||||
|         return this; |         return this; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** @protected */ | ||||||
|  |     _setContent(content, opts = {}) { | ||||||
|  |         // client code asks to save entity even if blobId didn't change (something else was changed) | ||||||
|  |         opts.forceSave = !!opts.forceSave; | ||||||
|  |         opts.forceFrontendReload = !!opts.forceFrontendReload; | ||||||
|  |  | ||||||
|  |         if (content === null || content === undefined) { | ||||||
|  |             throw new Error(`Cannot set null content to ${this.constructor.primaryKeyName} '${this[this.constructor.primaryKeyName]}'`); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (this.hasStringContent()) { | ||||||
|  |             content = content.toString(); | ||||||
|  |         } else { | ||||||
|  |             content = Buffer.isBuffer(content) ? content : Buffer.from(content); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         const unencryptedContentForHashCalculation = this.#getUnencryptedContentForHashCalculation(content); | ||||||
|  |  | ||||||
|  |         if (this.isProtected) { | ||||||
|  |             if (protectedSessionService.isProtectedSessionAvailable()) { | ||||||
|  |                 content = protectedSessionService.encrypt(content); | ||||||
|  |             } else { | ||||||
|  |                 throw new Error(`Cannot update content of blob since protected session is not available.`); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         sql.transactional(() => { | ||||||
|  |             const newBlobId = this.#saveBlob(content, unencryptedContentForHashCalculation, opts); | ||||||
|  |             const oldBlobId = this.blobId; | ||||||
|  |  | ||||||
|  |             if (newBlobId !== oldBlobId || opts.forceSave) { | ||||||
|  |                 this.blobId = newBlobId; | ||||||
|  |                 this.save(); | ||||||
|  |  | ||||||
|  |                 if (newBlobId !== oldBlobId) { | ||||||
|  |                     this.#deleteBlobIfNotUsed(oldBlobId); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     #deleteBlobIfNotUsed(oldBlobId) { | ||||||
|  |         if (sql.getValue("SELECT 1 FROM notes WHERE blobId = ? LIMIT 1", [oldBlobId])) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (sql.getValue("SELECT 1 FROM attachments WHERE blobId = ? LIMIT 1", [oldBlobId])) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (sql.getValue("SELECT 1 FROM revisions WHERE blobId = ? LIMIT 1", [oldBlobId])) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         sql.execute("DELETE FROM blobs WHERE blobId = ?", [oldBlobId]); | ||||||
|  |         // blobs are not marked as erased in entity_changes, they are just purged completely | ||||||
|  |         // this is because technically every keystroke can create a new blob and there would be just too many | ||||||
|  |         sql.execute("DELETE FROM entity_changes WHERE entityName = 'blobs' AND entityId = ?", [oldBlobId]); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     #getUnencryptedContentForHashCalculation(unencryptedContent) { | ||||||
|  |         if (this.isProtected) { | ||||||
|  |             // a "random" prefix makes sure that the calculated hash/blobId is different for a decrypted/encrypted content | ||||||
|  |             const encryptedPrefixSuffix = "t$[nvQg7q)&_ENCRYPTED_?M:Bf&j3jr_"; | ||||||
|  |             return Buffer.isBuffer(unencryptedContent) | ||||||
|  |                 ? Buffer.concat([Buffer.from(encryptedPrefixSuffix), unencryptedContent]) | ||||||
|  |                 : `${encryptedPrefixSuffix}${unencryptedContent}`; | ||||||
|  |         } else { | ||||||
|  |             return unencryptedContent; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     #saveBlob(content, unencryptedContentForHashCalculation, opts = {}) { | ||||||
|  |         /* | ||||||
|  |          * We're using the unencrypted blob for the hash calculation, because otherwise the random IV would | ||||||
|  |          * cause every content blob to be unique which would balloon the database size (esp. with revisioning). | ||||||
|  |          * This has minor security implications (it's easy to infer that given content is shared between different | ||||||
|  |          * notes/attachments), but the trade-off comes out clearly positive. | ||||||
|  |          */ | ||||||
|  |         const newBlobId = utils.hashedBlobId(unencryptedContentForHashCalculation); | ||||||
|  |         const blobNeedsInsert = !sql.getValue('SELECT 1 FROM blobs WHERE blobId = ?', [newBlobId]); | ||||||
|  |  | ||||||
|  |         if (!blobNeedsInsert) { | ||||||
|  |             return newBlobId; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         const pojo = { | ||||||
|  |             blobId: newBlobId, | ||||||
|  |             content: content, | ||||||
|  |             dateModified: dateUtils.localNowDateTime(), | ||||||
|  |             utcDateModified: dateUtils.utcNowDateTime() | ||||||
|  |         }; | ||||||
|  |  | ||||||
|  |         sql.upsert("blobs", "blobId", pojo); | ||||||
|  |  | ||||||
|  |         // we can't reuse blobId as an entity_changes hash, because this one has to be calculatable without having | ||||||
|  |         // access to the decrypted content | ||||||
|  |         const hash = blobService.calculateContentHash(pojo); | ||||||
|  |  | ||||||
|  |         entityChangesService.putEntityChange({ | ||||||
|  |             entityName: 'blobs', | ||||||
|  |             entityId: newBlobId, | ||||||
|  |             hash: hash, | ||||||
|  |             isErased: false, | ||||||
|  |             utcDateChanged: pojo.utcDateModified, | ||||||
|  |             isSynced: true, | ||||||
|  |             // overriding componentId will cause frontend to think the change is coming from a different component | ||||||
|  |             // and thus reload | ||||||
|  |             componentId: opts.forceFrontendReload ? utils.randomString(10) : null | ||||||
|  |         }); | ||||||
|  |  | ||||||
|  |         eventService.emit(eventService.ENTITY_CHANGED, { | ||||||
|  |             entityName: 'blobs', | ||||||
|  |             entity: this | ||||||
|  |         }); | ||||||
|  |  | ||||||
|  |         return newBlobId; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * @protected | ||||||
|  |      * @returns {string|Buffer} | ||||||
|  |      */ | ||||||
|  |     _getContent() { | ||||||
|  |         const row = sql.getRow(`SELECT content FROM blobs WHERE blobId = ?`, [this.blobId]); | ||||||
|  |  | ||||||
|  |         if (!row) { | ||||||
|  |             throw new Error(`Cannot find content for ${this.constructor.primaryKeyName} '${this[this.constructor.primaryKeyName]}', blobId '${this.blobId}'`); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return blobService.processContent(row.content, this.isProtected, this.hasStringContent()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Mark the entity as (soft) deleted. It will be completely erased later. |      * Mark the entity as (soft) deleted. It will be completely erased later. | ||||||
|      * |      * | ||||||
|      * This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. |      * This is a low-level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | ||||||
|      * |      * | ||||||
|      * @param [deleteId=null] |      * @param [deleteId=null] | ||||||
|      */ |      */ | ||||||
| @@ -172,7 +311,7 @@ class AbstractBeccaEntity { | |||||||
|  |  | ||||||
|         log.info(`Marking ${entityName} ${entityId} as deleted`); |         log.info(`Marking ${entityName} ${entityId} as deleted`); | ||||||
|  |  | ||||||
|         this.addEntityChange(true); |         this.putEntityChange(true); | ||||||
|  |  | ||||||
|         eventService.emit(eventService.ENTITY_DELETED, { entityName, entityId, entity: this }); |         eventService.emit(eventService.ENTITY_DELETED, { entityName, entityId, entity: this }); | ||||||
|     } |     } | ||||||
| @@ -189,7 +328,7 @@ class AbstractBeccaEntity { | |||||||
|  |  | ||||||
|         log.info(`Marking ${entityName} ${entityId} as deleted`); |         log.info(`Marking ${entityName} ${entityId} as deleted`); | ||||||
|  |  | ||||||
|         this.addEntityChange(true); |         this.putEntityChange(true); | ||||||
|  |  | ||||||
|         eventService.emit(eventService.ENTITY_DELETED, { entityName, entityId, entity: this }); |         eventService.emit(eventService.ENTITY_DELETED, { entityName, entityId, entity: this }); | ||||||
|     } |     } | ||||||
| @@ -206,7 +345,7 @@ module.exports = AbstractBeccaEntity; | |||||||
| </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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
							
								
								
									
										288
									
								
								docs/backend_api/becca_entities_battachment.js.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										288
									
								
								docs/backend_api/becca_entities_battachment.js.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,288 @@ | |||||||
|  | <!DOCTYPE html> | ||||||
|  | <html lang="en"> | ||||||
|  | <head> | ||||||
|  |     <meta charset="utf-8"> | ||||||
|  |     <title>JSDoc: Source: becca/entities/battachment.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: becca/entities/battachment.js</h1> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <section> | ||||||
|  |         <article> | ||||||
|  |             <pre class="prettyprint source linenums"><code>"use strict"; | ||||||
|  |  | ||||||
|  | const utils = require('../../services/utils'); | ||||||
|  | const dateUtils = require('../../services/date_utils'); | ||||||
|  | const AbstractBeccaEntity = require("./abstract_becca_entity"); | ||||||
|  | const sql = require("../../services/sql"); | ||||||
|  | const protectedSessionService = require("../../services/protected_session"); | ||||||
|  | const log = require("../../services/log"); | ||||||
|  |  | ||||||
|  | const attachmentRoleToNoteTypeMapping = { | ||||||
|  |     'image': 'image' | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Attachment represent data related/attached to the note. Conceptually similar to attributes, but intended for | ||||||
|  |  * larger amounts of data and generally not accessible to the user. | ||||||
|  |  * | ||||||
|  |  * @extends AbstractBeccaEntity | ||||||
|  |  */ | ||||||
|  | class BAttachment extends AbstractBeccaEntity { | ||||||
|  |     static get entityName() { return "attachments"; } | ||||||
|  |     static get primaryKeyName() { return "attachmentId"; } | ||||||
|  |     static get hashedProperties() { return ["attachmentId", "ownerId", "role", "mime", "title", "blobId", "utcDateScheduledForErasureSince"]; } | ||||||
|  |  | ||||||
|  |     constructor(row) { | ||||||
|  |         super(); | ||||||
|  |  | ||||||
|  |         if (!row.ownerId?.trim()) { | ||||||
|  |             throw new Error("'ownerId' must be given to initialize a Attachment entity"); | ||||||
|  |         } else if (!row.role?.trim()) { | ||||||
|  |             throw new Error("'role' must be given to initialize a Attachment entity"); | ||||||
|  |         } else if (!row.mime?.trim()) { | ||||||
|  |             throw new Error("'mime' must be given to initialize a Attachment entity"); | ||||||
|  |         } else if (!row.title?.trim()) { | ||||||
|  |             throw new Error("'title' must be given to initialize a Attachment entity"); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.attachmentId = row.attachmentId; | ||||||
|  |         /** @type {string} either noteId or revisionId to which this attachment belongs */ | ||||||
|  |         this.ownerId = row.ownerId; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.role = row.role; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.mime = row.mime; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.title = row.title; | ||||||
|  |         /** @type {int} */ | ||||||
|  |         this.position = row.position; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.blobId = row.blobId; | ||||||
|  |         /** @type {boolean} */ | ||||||
|  |         this.isProtected = !!row.isProtected; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.dateModified = row.dateModified; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.utcDateModified = row.utcDateModified; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.utcDateScheduledForErasureSince = row.utcDateScheduledForErasureSince; | ||||||
|  |  | ||||||
|  |         /** @type {int} optionally added to the entity */ | ||||||
|  |         this.contentLength = row.contentLength; | ||||||
|  |  | ||||||
|  |         this.decrypt(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @returns {BAttachment} */ | ||||||
|  |     copy() { | ||||||
|  |         return new BAttachment({ | ||||||
|  |             ownerId: this.ownerId, | ||||||
|  |             role: this.role, | ||||||
|  |             mime: this.mime, | ||||||
|  |             title: this.title, | ||||||
|  |             blobId: this.blobId, | ||||||
|  |             isProtected: this.isProtected | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @returns {BNote} */ | ||||||
|  |     getNote() { | ||||||
|  |         return this.becca.notes[this.ownerId]; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @returns {boolean} true if the note has string content (not binary) */ | ||||||
|  |     hasStringContent() { | ||||||
|  |         return utils.isStringNote(this.type, this.mime); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     isContentAvailable() { | ||||||
|  |         return !this.attachmentId // new attachment which was not encrypted yet | ||||||
|  |             || !this.isProtected | ||||||
|  |             || protectedSessionService.isProtectedSessionAvailable() | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     getTitleOrProtected() { | ||||||
|  |         return this.isContentAvailable() ? this.title : '[protected]'; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     decrypt() { | ||||||
|  |         if (!this.isProtected || !this.attachmentId) { | ||||||
|  |             this.isDecrypted = true; | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (!this.isDecrypted && protectedSessionService.isProtectedSessionAvailable()) { | ||||||
|  |             try { | ||||||
|  |                 this.title = protectedSessionService.decryptString(this.title); | ||||||
|  |                 this.isDecrypted = true; | ||||||
|  |             } | ||||||
|  |             catch (e) { | ||||||
|  |                 log.error(`Could not decrypt attachment ${this.attachmentId}: ${e.message} ${e.stack}`); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @returns {string|Buffer}  */ | ||||||
|  |     getContent() { | ||||||
|  |         return this._getContent(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * @param content | ||||||
|  |      * @param {object} [opts] | ||||||
|  |      * @param {object} [opts.forceSave=false] - will also save this BAttachment entity | ||||||
|  |      * @param {object} [opts.forceFrontendReload=false] - override frontend heuristics on when to reload, instruct to reload | ||||||
|  |      */ | ||||||
|  |     setContent(content, opts) { | ||||||
|  |         this._setContent(content, opts); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @returns {{note: BNote, branch: BBranch}} */ | ||||||
|  |     convertToNote() { | ||||||
|  |         if (this.type === 'search') { | ||||||
|  |             throw new Error(`Note of type search cannot have child notes`); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (!this.getNote()) { | ||||||
|  |             throw new Error("Cannot find note of this attachment. It is possible that this is note revision's attachment. " + | ||||||
|  |                 "Converting note revision's attachments to note is not (yet) supported."); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (!(this.role in attachmentRoleToNoteTypeMapping)) { | ||||||
|  |             throw new Error(`Mapping from attachment role '${this.role}' to note's type is not defined`); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (!this.isContentAvailable()) { // isProtected is the same for attachment | ||||||
|  |             throw new Error(`Cannot convert protected attachment outside of protected session`); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         const noteService = require('../../services/notes'); | ||||||
|  |  | ||||||
|  |         const { note, branch } = noteService.createNewNote({ | ||||||
|  |             parentNoteId: this.ownerId, | ||||||
|  |             title: this.title, | ||||||
|  |             type: attachmentRoleToNoteTypeMapping[this.role], | ||||||
|  |             mime: this.mime, | ||||||
|  |             content: this.getContent(), | ||||||
|  |             isProtected: this.isProtected | ||||||
|  |         }); | ||||||
|  |  | ||||||
|  |         this.markAsDeleted(); | ||||||
|  |  | ||||||
|  |         const parentNote = this.getNote(); | ||||||
|  |  | ||||||
|  |         if (this.role === 'image' && parentNote.type === 'text') { | ||||||
|  |             const origContent = parentNote.getContent(); | ||||||
|  |             const oldAttachmentUrl = `api/attachments/${this.attachmentId}/image/`; | ||||||
|  |             const newNoteUrl = `api/images/${note.noteId}/`; | ||||||
|  |  | ||||||
|  |             const fixedContent = utils.replaceAll(origContent, oldAttachmentUrl, newNoteUrl); | ||||||
|  |  | ||||||
|  |             if (fixedContent !== origContent) { | ||||||
|  |                 parentNote.setContent(fixedContent); | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             noteService.asyncPostProcessContent(note, fixedContent); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return { note, branch }; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     getFileName() { | ||||||
|  |         const type = this.role === 'image' ? 'image' : 'file'; | ||||||
|  |  | ||||||
|  |         return utils.formatDownloadTitle(this.title, type, this.mime); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     beforeSaving() { | ||||||
|  |         super.beforeSaving(); | ||||||
|  |  | ||||||
|  |         if (this.position === undefined || this.position === null) { | ||||||
|  |             this.position = 10 + sql.getValue(`SELECT COALESCE(MAX(position), 0) | ||||||
|  |                                               FROM attachments | ||||||
|  |                                               WHERE ownerId = ?`, [this.noteId]); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         this.dateModified = dateUtils.localNowDateTime(); | ||||||
|  |         this.utcDateModified = dateUtils.utcNowDateTime(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     getPojo() { | ||||||
|  |         return { | ||||||
|  |             attachmentId: this.attachmentId, | ||||||
|  |             ownerId: this.ownerId, | ||||||
|  |             role: this.role, | ||||||
|  |             mime: this.mime, | ||||||
|  |             title: this.title, | ||||||
|  |             position: this.position, | ||||||
|  |             blobId: this.blobId, | ||||||
|  |             isProtected: !!this.isProtected, | ||||||
|  |             isDeleted: false, | ||||||
|  |             dateModified: this.dateModified, | ||||||
|  |             utcDateModified: this.utcDateModified, | ||||||
|  |             utcDateScheduledForErasureSince: this.utcDateScheduledForErasureSince, | ||||||
|  |             contentLength: this.contentLength | ||||||
|  |         }; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     getPojoToSave() { | ||||||
|  |         const pojo = this.getPojo(); | ||||||
|  |         delete pojo.contentLength; | ||||||
|  |  | ||||||
|  |         if (pojo.isProtected) { | ||||||
|  |             if (this.isDecrypted) { | ||||||
|  |                 pojo.title = protectedSessionService.encrypt(pojo.title); | ||||||
|  |             } | ||||||
|  |             else { | ||||||
|  |                 // updating protected note outside of protected session means we will keep original ciphertexts | ||||||
|  |                 delete pojo.title; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return pojo; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | module.exports = BAttachment; | ||||||
|  | </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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
|  | </nav> | ||||||
|  |  | ||||||
|  | <br class="clear"> | ||||||
|  |  | ||||||
|  | <footer> | ||||||
|  |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> | ||||||
|  | </footer> | ||||||
|  |  | ||||||
|  | <script> prettyPrint(); </script> | ||||||
|  | <script src="scripts/linenumber.js"> </script> | ||||||
|  | </body> | ||||||
|  | </html> | ||||||
| @@ -169,7 +169,7 @@ class BAttribute extends AbstractBeccaEntity { | |||||||
|      */ |      */ | ||||||
|     getTargetNote() { |     getTargetNote() { | ||||||
|         if (this.type !== 'relation') { |         if (this.type !== 'relation') { | ||||||
|             throw new Error(`Attribute ${this.attributeId} is not relation`); |             throw new Error(`Attribute '${this.attributeId}' is not a relation.`); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (!this.value) { |         if (!this.value) { | ||||||
| @@ -216,9 +216,11 @@ class BAttribute extends AbstractBeccaEntity { | |||||||
|             this.value = ""; |             this.value = ""; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (this.position === undefined) { |         if (this.position === undefined || this.position === null) { | ||||||
|             // TODO: can be calculated from becca |             const maxExistingPosition = this.getNote().getAttributes() | ||||||
|             this.position = 1 + sql.getValue(`SELECT COALESCE(MAX(position), 0) FROM attributes WHERE noteId = ?`, [this.noteId]); |                 .reduce((maxPosition, attr) => Math.max(maxPosition, attr.position || 0), 0); | ||||||
|  |  | ||||||
|  |             this.position = maxExistingPosition + 10; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (!this.isInheritable) { |         if (!this.isInheritable) { | ||||||
| @@ -270,7 +272,7 @@ module.exports = BAttribute; | |||||||
| </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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
							
								
								
									
										81
									
								
								docs/backend_api/becca_entities_bblob.js.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								docs/backend_api/becca_entities_bblob.js.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,81 @@ | |||||||
|  | <!DOCTYPE html> | ||||||
|  | <html lang="en"> | ||||||
|  | <head> | ||||||
|  |     <meta charset="utf-8"> | ||||||
|  |     <title>JSDoc: Source: becca/entities/bblob.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: becca/entities/bblob.js</h1> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <section> | ||||||
|  |         <article> | ||||||
|  |             <pre class="prettyprint source linenums"><code>class BBlob { | ||||||
|  |     static get entityName() { return "blobs"; } | ||||||
|  |     static get primaryKeyName() { return "blobId"; } | ||||||
|  |     static get hashedProperties() { return ["blobId", "content"]; } | ||||||
|  |  | ||||||
|  |     constructor(row) { | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.blobId = row.blobId; | ||||||
|  |         /** @type {string|Buffer} */ | ||||||
|  |         this.content = row.content; | ||||||
|  |         /** @type {int} */ | ||||||
|  |         this.contentLength = row.contentLength; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.dateModified = row.dateModified; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.utcDateModified = row.utcDateModified; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     getPojo() { | ||||||
|  |         return { | ||||||
|  |             blobId: this.blobId, | ||||||
|  |             content: this.content, | ||||||
|  |             contentLength: this.contentLength, | ||||||
|  |             dateModified: this.dateModified, | ||||||
|  |             utcDateModified: this.utcDateModified | ||||||
|  |         }; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | module.exports = BBlob; | ||||||
|  | </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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
|  | </nav> | ||||||
|  |  | ||||||
|  | <br class="clear"> | ||||||
|  |  | ||||||
|  | <footer> | ||||||
|  |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> | ||||||
|  | </footer> | ||||||
|  |  | ||||||
|  | <script> prettyPrint(); </script> | ||||||
|  | <script src="scripts/linenumber.js"> </script> | ||||||
|  | </body> | ||||||
|  | </html> | ||||||
| @@ -131,6 +131,7 @@ class BBranch extends AbstractBeccaEntity { | |||||||
|         return this.becca.notes[this.noteId]; |         return this.becca.notes[this.noteId]; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** @returns {BNote} */ | ||||||
|     getNote() { |     getNote() { | ||||||
|         return this.childNote; |         return this.childNote; | ||||||
|     } |     } | ||||||
| @@ -214,11 +215,11 @@ class BBranch extends AbstractBeccaEntity { | |||||||
|  |  | ||||||
|             // first delete children and then parent - this will show up better in recent changes |             // first delete children and then parent - this will show up better in recent changes | ||||||
|  |  | ||||||
|             log.info(`Deleting note ${note.noteId}`); |             log.info(`Deleting note '${note.noteId}'`); | ||||||
|  |  | ||||||
|             this.becca.notes[note.noteId].isBeingDeleted = true; |             this.becca.notes[note.noteId].isBeingDeleted = true; | ||||||
|  |  | ||||||
|             for (const attribute of note.getOwnedAttributes()) { |             for (const attribute of note.getOwnedAttributes().slice()) { | ||||||
|                 attribute.markAsDeleted(deleteId); |                 attribute.markAsDeleted(deleteId); | ||||||
|             } |             } | ||||||
|  |  | ||||||
| @@ -226,6 +227,10 @@ class BBranch extends AbstractBeccaEntity { | |||||||
|                 relation.markAsDeleted(deleteId); |                 relation.markAsDeleted(deleteId); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  |             for (const attachment of note.getAttachments()) { | ||||||
|  |                 attachment.markAsDeleted(deleteId); | ||||||
|  |             } | ||||||
|  |  | ||||||
|             note.markAsDeleted(deleteId); |             note.markAsDeleted(deleteId); | ||||||
|  |  | ||||||
|             return true; |             return true; | ||||||
| @@ -247,7 +252,7 @@ class BBranch extends AbstractBeccaEntity { | |||||||
|  |  | ||||||
|             for (const childBranch of this.parentNote.getChildBranches()) { |             for (const childBranch of this.parentNote.getChildBranches()) { | ||||||
|                 if (maxNotePos < childBranch.notePosition |                 if (maxNotePos < childBranch.notePosition | ||||||
|                     && childBranch.noteId !== '_hidden' // hidden has very large notePosition to always stay last |                     && childBranch.noteId !== '_hidden' // hidden has a very large notePosition to always stay last | ||||||
|                 ) { |                 ) { | ||||||
|                     maxNotePos = childBranch.notePosition; |                     maxNotePos = childBranch.notePosition; | ||||||
|                 } |                 } | ||||||
| @@ -313,7 +318,7 @@ module.exports = BBranch; | |||||||
| </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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
| @@ -114,7 +114,7 @@ module.exports = BEtapiToken; | |||||||
| </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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
| @@ -33,9 +33,9 @@ const log = require('../../services/log'); | |||||||
| const sql = require('../../services/sql'); | const sql = require('../../services/sql'); | ||||||
| const utils = require('../../services/utils'); | const utils = require('../../services/utils'); | ||||||
| const dateUtils = require('../../services/date_utils'); | const dateUtils = require('../../services/date_utils'); | ||||||
| const entityChangesService = require('../../services/entity_changes'); |  | ||||||
| const AbstractBeccaEntity = require("./abstract_becca_entity"); | const AbstractBeccaEntity = require("./abstract_becca_entity"); | ||||||
| const BNoteRevision = require("./bnote_revision"); | const BRevision = require("./brevision"); | ||||||
|  | const BAttachment = require("./battachment"); | ||||||
| const TaskContext = require("../../services/task_context"); | const TaskContext = require("../../services/task_context"); | ||||||
| const dayjs = require("dayjs"); | const dayjs = require("dayjs"); | ||||||
| const utc = require('dayjs/plugin/utc'); | const utc = require('dayjs/plugin/utc'); | ||||||
| @@ -46,14 +46,14 @@ const LABEL = 'label'; | |||||||
| const RELATION = 'relation'; | const RELATION = 'relation'; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Trilium's main entity which can represent text note, image, code note, file attachment etc. |  * Trilium's main entity, which can represent text note, image, code note, file attachment etc. | ||||||
|  * |  * | ||||||
|  * @extends AbstractBeccaEntity |  * @extends AbstractBeccaEntity | ||||||
|  */ |  */ | ||||||
| class BNote extends AbstractBeccaEntity { | class BNote extends AbstractBeccaEntity { | ||||||
|     static get entityName() { return "notes"; } |     static get entityName() { return "notes"; } | ||||||
|     static get primaryKeyName() { return "noteId"; } |     static get primaryKeyName() { return "noteId"; } | ||||||
|     static get hashedProperties() { return ["noteId", "title", "isProtected", "type", "mime"]; } |     static get hashedProperties() { return ["noteId", "title", "isProtected", "type", "mime", "blobId"]; } | ||||||
|  |  | ||||||
|     constructor(row) { |     constructor(row) { | ||||||
|         super(); |         super(); | ||||||
| @@ -73,6 +73,7 @@ class BNote extends AbstractBeccaEntity { | |||||||
|             row.type, |             row.type, | ||||||
|             row.mime, |             row.mime, | ||||||
|             row.isProtected, |             row.isProtected, | ||||||
|  |             row.blobId, | ||||||
|             row.dateCreated, |             row.dateCreated, | ||||||
|             row.dateModified, |             row.dateModified, | ||||||
|             row.utcDateCreated, |             row.utcDateCreated, | ||||||
| @@ -80,19 +81,21 @@ class BNote extends AbstractBeccaEntity { | |||||||
|         ]); |         ]); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     update([noteId, title, type, mime, isProtected, dateCreated, dateModified, utcDateCreated, utcDateModified]) { |     update([noteId, title, type, mime, isProtected, blobId, dateCreated, dateModified, utcDateCreated, utcDateModified]) { | ||||||
|         // ------ Database persisted attributes ------ |         // ------ Database persisted attributes ------ | ||||||
|  |  | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
|         this.noteId = noteId; |         this.noteId = noteId; | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
|         this.title = title; |         this.title = title; | ||||||
|         /** @type {boolean} */ |  | ||||||
|         this.isProtected = !!isProtected; |  | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
|         this.type = type; |         this.type = type; | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
|         this.mime = mime; |         this.mime = mime; | ||||||
|  |         /** @type {boolean} */ | ||||||
|  |         this.isProtected = !!isProtected; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.blobId = blobId; | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
|         this.dateCreated = dateCreated || dateUtils.localNowDateTime(); |         this.dateCreated = dateCreated || dateUtils.localNowDateTime(); | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
| @@ -112,7 +115,7 @@ class BNote extends AbstractBeccaEntity { | |||||||
|         this.decrypt(); |         this.decrypt(); | ||||||
|  |  | ||||||
|         /** @type {string|null} */ |         /** @type {string|null} */ | ||||||
|         this.flatTextCache = null; |         this.__flatTextCache = null; | ||||||
|  |  | ||||||
|         return this; |         return this; | ||||||
|     } |     } | ||||||
| @@ -136,7 +139,7 @@ class BNote extends AbstractBeccaEntity { | |||||||
|         this.__attributeCache = null; |         this.__attributeCache = null; | ||||||
|         /** @type {BAttribute[]|null} |         /** @type {BAttribute[]|null} | ||||||
|          * @private */ |          * @private */ | ||||||
|         this.inheritableAttributeCache = null; |         this.__inheritableAttributeCache = null; | ||||||
|  |  | ||||||
|         /** @type {BAttribute[]} |         /** @type {BAttribute[]} | ||||||
|          * @private */ |          * @private */ | ||||||
| @@ -146,9 +149,9 @@ class BNote extends AbstractBeccaEntity { | |||||||
|  |  | ||||||
|         /** @type {BNote[]|null} |         /** @type {BNote[]|null} | ||||||
|          * @private */ |          * @private */ | ||||||
|         this.ancestorCache = null; |         this.__ancestorCache = null; | ||||||
|  |  | ||||||
|         // following attributes are filled during searching from database |         // following attributes are filled during searching in the database | ||||||
|  |  | ||||||
|         /** |         /** | ||||||
|          * size of the content in bytes |          * size of the content in bytes | ||||||
| @@ -157,11 +160,17 @@ class BNote extends AbstractBeccaEntity { | |||||||
|          */ |          */ | ||||||
|         this.contentSize = null; |         this.contentSize = null; | ||||||
|         /** |         /** | ||||||
|          * size of the content and note revision contents in bytes |          * size of the note content, attachment contents in bytes | ||||||
|          * @type {int|null} |          * @type {int|null} | ||||||
|          * @private |          * @private | ||||||
|          */ |          */ | ||||||
|         this.noteSize = null; |         this.contentAndAttachmentsSize = null; | ||||||
|  |         /** | ||||||
|  |          * size of the note content, attachment contents and revision contents in bytes | ||||||
|  |          * @type {int|null} | ||||||
|  |          * @private | ||||||
|  |          */ | ||||||
|  |         this.contentAndAttachmentsAndRevisionsSize = null; | ||||||
|         /** |         /** | ||||||
|          * number of note revisions for this note |          * number of note revisions for this note | ||||||
|          * @type {int|null} |          * @type {int|null} | ||||||
| @@ -231,49 +240,48 @@ class BNote extends AbstractBeccaEntity { | |||||||
|      * - 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) |      * - 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 {*} */ |     /** @returns {string|Buffer}  */ | ||||||
|     getContent(silentNotFoundError = false) { |     getContent() { | ||||||
|         const row = sql.getRow(`SELECT content FROM note_contents WHERE noteId = ?`, [this.noteId]); |         return this._getContent(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|         if (!row) { |     /** | ||||||
|             if (silentNotFoundError) { |      * @returns {*} | ||||||
|                 return undefined; |      * @throws Error in case of invalid JSON */ | ||||||
|             } |     getJsonContent() { | ||||||
|             else { |         const content = this.getContent(); | ||||||
|                 throw new Error(`Cannot find note content for noteId=${this.noteId}`); |  | ||||||
|             } |         if (!content || !content.trim()) { | ||||||
|  |             return null; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         let content = row.content; |         return JSON.parse(content); | ||||||
|  |     } | ||||||
|  |  | ||||||
|         if (this.isProtected) { |     /** @returns {*|null} valid object or null if the content cannot be parsed as JSON */ | ||||||
|             if (protectedSessionService.isProtectedSessionAvailable()) { |     getJsonContentSafely() { | ||||||
|                 content = content === null ? null : protectedSessionService.decrypt(content); |         try { | ||||||
|             } |             return this.getJsonContent(); | ||||||
|             else { |  | ||||||
|                 content = ""; |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|  |         catch (e) { | ||||||
|         if (this.isStringNote()) { |             return null; | ||||||
|             return content === null |  | ||||||
|                 ? "" |  | ||||||
|                 : content.toString("UTF-8"); |  | ||||||
|         } |  | ||||||
|         else { |  | ||||||
|             return content; |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @returns {{contentLength, dateModified, utcDateModified}} */ |     /** | ||||||
|     getContentMetadata() { |      * @param content | ||||||
|         return sql.getRow(` |      * @param {object} [opts] | ||||||
|             SELECT  |      * @param {object} [opts.forceSave=false] - will also save this BNote entity | ||||||
|                 LENGTH(content) AS contentLength,  |      * @param {object} [opts.forceFrontendReload=false] - override frontend heuristics on when to reload, instruct to reload | ||||||
|                 dateModified, |      */ | ||||||
|                 utcDateModified  |     setContent(content, opts) { | ||||||
|             FROM note_contents  |         this._setContent(content, opts); | ||||||
|             WHERE noteId = ?`, [this.noteId]); |  | ||||||
|  |         eventService.emit(eventService.NOTE_CONTENT_CHANGE, { entity: this }); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     setJsonContent(content) { | ||||||
|  |         this.setContent(JSON.stringify(content, null, '\t')); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     get dateCreatedObj() { |     get dateCreatedObj() { | ||||||
| @@ -292,68 +300,6 @@ class BNote extends AbstractBeccaEntity { | |||||||
|         return this.utcDateModified === null ? null : dayjs.utc(this.utcDateModified); |         return this.utcDateModified === null ? null : dayjs.utc(this.utcDateModified); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @returns {*} */ |  | ||||||
|     getJsonContent() { |  | ||||||
|         const content = this.getContent(); |  | ||||||
|  |  | ||||||
|         if (!content || !content.trim()) { |  | ||||||
|             return null; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         return JSON.parse(content); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     setContent(content, ignoreMissingProtectedSession = false) { |  | ||||||
|         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); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         const pojo = { |  | ||||||
|             noteId: this.noteId, |  | ||||||
|             content: content, |  | ||||||
|             dateModified: dateUtils.localNowDateTime(), |  | ||||||
|             utcDateModified: dateUtils.utcNowDateTime() |  | ||||||
|         }; |  | ||||||
|  |  | ||||||
|         if (this.isProtected) { |  | ||||||
|             if (protectedSessionService.isProtectedSessionAvailable()) { |  | ||||||
|                 pojo.content = protectedSessionService.encrypt(pojo.content); |  | ||||||
|             } |  | ||||||
|             else if (!ignoreMissingProtectedSession) { |  | ||||||
|                 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, |  | ||||||
|             isSynced: true |  | ||||||
|         }); |  | ||||||
|  |  | ||||||
|         eventService.emit(eventService.ENTITY_CHANGED, { |  | ||||||
|             entityName: 'note_contents', |  | ||||||
|             entity: this |  | ||||||
|         }); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     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 */ |     /** @returns {boolean} true if this note is the root of the note tree. Root note has "root" noteId */ | ||||||
|     isRoot() { |     isRoot() { | ||||||
|         return this.noteId === 'root'; |         return this.noteId === 'root'; | ||||||
| @@ -384,8 +330,13 @@ class BNote extends AbstractBeccaEntity { | |||||||
|             || (this.type === 'file' && this.mime?.startsWith('image/')); |             || (this.type === 'file' && this.mime?.startsWith('image/')); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @returns {boolean} true if the note has string content (not binary) */ |     /** @deprecated use hasStringContent() instead */ | ||||||
|     isStringNote() { |     isStringNote() { | ||||||
|  |         return this.hasStringContent(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @returns {boolean} true if the note has string content (not binary) */ | ||||||
|  |     hasStringContent() { | ||||||
|         return utils.isStringNote(this.type, this.mime); |         return utils.isStringNote(this.type, this.mime); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -407,6 +358,9 @@ class BNote extends AbstractBeccaEntity { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|  |      * Beware that the method must not create a copy of the array, but actually returns its internal array | ||||||
|  |      * (for performance reasons) | ||||||
|  |      * | ||||||
|      * @param {string} [type] - (optional) attribute type to filter |      * @param {string} [type] - (optional) attribute type to filter | ||||||
|      * @param {string} [name] - (optional) attribute name to filter |      * @param {string} [name] - (optional) attribute name to filter | ||||||
|      * @returns {BAttribute[]} all note's attributes, including inherited ones |      * @returns {BAttribute[]} all note's attributes, including inherited ones | ||||||
| @@ -425,7 +379,6 @@ class BNote extends AbstractBeccaEntity { | |||||||
|             return this.__attributeCache.filter(attr => attr.name === name); |             return this.__attributeCache.filter(attr => attr.name === name); | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|             // a bit unsafe to return the original array, but defensive copy would be costly |  | ||||||
|             return this.__attributeCache; |             return this.__attributeCache; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -482,11 +435,11 @@ class BNote extends AbstractBeccaEntity { | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             this.inheritableAttributeCache = []; |             this.__inheritableAttributeCache = []; | ||||||
|  |  | ||||||
|             for (const attr of this.__attributeCache) { |             for (const attr of this.__attributeCache) { | ||||||
|                 if (attr.isInheritable) { |                 if (attr.isInheritable) { | ||||||
|                     this.inheritableAttributeCache.push(attr); |                     this.__inheritableAttributeCache.push(attr); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| @@ -503,11 +456,11 @@ class BNote extends AbstractBeccaEntity { | |||||||
|             return []; |             return []; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (!this.inheritableAttributeCache) { |         if (!this.__inheritableAttributeCache) { | ||||||
|             this.__getAttributes(path); // will refresh also this.inheritableAttributeCache |             this.__getAttributes(path); // will refresh also this.__inheritableAttributeCache | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return this.inheritableAttributeCache; |         return this.__inheritableAttributeCache; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     __validateTypeName(type, name) { |     __validateTypeName(type, name) { | ||||||
| @@ -656,7 +609,8 @@ class BNote extends AbstractBeccaEntity { | |||||||
|     /** |     /** | ||||||
|      * @param {string} type - attribute type (label, relation, etc.) |      * @param {string} type - attribute type (label, relation, etc.) | ||||||
|      * @param {string} name - attribute name |      * @param {string} name - attribute name | ||||||
|      * @returns {BAttribute} 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. |      * @returns {BAttribute} attribute of the given type and name. If there are more such attributes, first is returned. | ||||||
|  |      *                       Returns null if there's no such attribute belonging to this note. | ||||||
|      */ |      */ | ||||||
|     getAttribute(type, name) { |     getAttribute(type, name) { | ||||||
|         const attributes = this.getAttributes(); |         const attributes = this.getAttributes(); | ||||||
| @@ -735,6 +689,9 @@ class BNote extends AbstractBeccaEntity { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|  |      * Beware that the method must not create a copy of the array, but actually returns its internal array | ||||||
|  |      * (for performance reasons) | ||||||
|  |      * | ||||||
|      * @param {string|null} [type] - (optional) attribute type to filter |      * @param {string|null} [type] - (optional) attribute type to filter | ||||||
|      * @param {string|null} [name] - (optional) attribute name to filter |      * @param {string|null} [name] - (optional) attribute name to filter | ||||||
|      * @param {string|null} [value] - (optional) attribute value to filter |      * @param {string|null} [value] - (optional) attribute value to filter | ||||||
| @@ -756,7 +713,7 @@ class BNote extends AbstractBeccaEntity { | |||||||
|             return this.ownedAttributes.filter(attr => attr.name === name); |             return this.ownedAttributes.filter(attr => attr.name === name); | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|             return this.ownedAttributes.slice(); |             return this.ownedAttributes; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -778,7 +735,7 @@ class BNote extends AbstractBeccaEntity { | |||||||
|     areAllNotePathsArchived() { |     areAllNotePathsArchived() { | ||||||
|         // there's a slight difference between note being itself archived and all its note paths being archived |         // there's a slight difference between note being itself archived and all its note paths being archived | ||||||
|         // - note is archived when it itself has an archived label or inherits it |         // - note is archived when it itself has an archived label or inherits it | ||||||
|         // - note does not have or inherit archived label, but each note paths contains a note with (non-inheritable) |         // - note does not have or inherit archived label, but each note path contains a note with (non-inheritable) | ||||||
|         //   archived label |         //   archived label | ||||||
|  |  | ||||||
|         const bestNotePathRecord = this.getSortedNotePathRecords()[0]; |         const bestNotePathRecord = this.getSortedNotePathRecords()[0]; | ||||||
| @@ -841,40 +798,40 @@ class BNote extends AbstractBeccaEntity { | |||||||
|      * @returns {string} - returns flattened textual representation of note, prefixes and attributes |      * @returns {string} - returns flattened textual representation of note, prefixes and attributes | ||||||
|      */ |      */ | ||||||
|     getFlatText() { |     getFlatText() { | ||||||
|         if (!this.flatTextCache) { |         if (!this.__flatTextCache) { | ||||||
|             this.flatTextCache = `${this.noteId} ${this.type} ${this.mime} `; |             this.__flatTextCache = `${this.noteId} ${this.type} ${this.mime} `; | ||||||
|  |  | ||||||
|             for (const branch of this.parentBranches) { |             for (const branch of this.parentBranches) { | ||||||
|                 if (branch.prefix) { |                 if (branch.prefix) { | ||||||
|                     this.flatTextCache += `${branch.prefix} `; |                     this.__flatTextCache += `${branch.prefix} `; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             this.flatTextCache += `${this.title} `; |             this.__flatTextCache += `${this.title} `; | ||||||
|  |  | ||||||
|             for (const attr of this.getAttributes()) { |             for (const attr of this.getAttributes()) { | ||||||
|                 // it's best to use space as separator since spaces are filtered from the search string by the tokenization into words |                 // it's best to use space as separator since spaces are filtered from the search string by the tokenization into words | ||||||
|                 this.flatTextCache += `${attr.type === 'label' ? '#' : '~'}${attr.name}`; |                 this.__flatTextCache += `${attr.type === 'label' ? '#' : '~'}${attr.name}`; | ||||||
|  |  | ||||||
|                 if (attr.value) { |                 if (attr.value) { | ||||||
|                     this.flatTextCache += `=${attr.value}`; |                     this.__flatTextCache += `=${attr.value}`; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 this.flatTextCache += ' '; |                 this.__flatTextCache += ' '; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             this.flatTextCache = utils.normalize(this.flatTextCache); |             this.__flatTextCache = utils.normalize(this.__flatTextCache); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return this.flatTextCache; |         return this.__flatTextCache; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     invalidateThisCache() { |     invalidateThisCache() { | ||||||
|         this.flatTextCache = null; |         this.__flatTextCache = null; | ||||||
|  |  | ||||||
|         this.__attributeCache = null; |         this.__attributeCache = null; | ||||||
|         this.inheritableAttributeCache = null; |         this.__inheritableAttributeCache = null; | ||||||
|         this.ancestorCache = null; |         this.__ancestorCache = null; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     invalidateSubTree(path = []) { |     invalidateSubTree(path = []) { | ||||||
| @@ -903,24 +860,6 @@ class BNote extends AbstractBeccaEntity { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     invalidateSubtreeFlatText() { |  | ||||||
|         this.flatTextCache = null; |  | ||||||
|  |  | ||||||
|         for (const childNote of this.children) { |  | ||||||
|             childNote.invalidateSubtreeFlatText(); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         for (const targetRelation of this.targetRelations) { |  | ||||||
|             if (targetRelation.name === 'template' || targetRelation.name === 'inherit') { |  | ||||||
|                 const note = targetRelation.note; |  | ||||||
|  |  | ||||||
|                 if (note) { |  | ||||||
|                     note.invalidateSubtreeFlatText(); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     getRelationDefinitions() { |     getRelationDefinitions() { | ||||||
|         return this.getLabels() |         return this.getLabels() | ||||||
|             .filter(l => l.name.startsWith("relation:")); |             .filter(l => l.name.startsWith("relation:")); | ||||||
| @@ -1049,7 +988,7 @@ class BNote extends AbstractBeccaEntity { | |||||||
|         }; |         }; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @returns {String[]} - includes the subtree node as well */ |     /** @returns {string[]} - includes the subtree root note as well */ | ||||||
|     getSubtreeNoteIds({includeArchived = true, includeHidden = false, resolveSearch = false} = {}) { |     getSubtreeNoteIds({includeArchived = true, includeHidden = false, resolveSearch = false} = {}) { | ||||||
|         return this.getSubtree({includeArchived, includeHidden, resolveSearch}) |         return this.getSubtree({includeArchived, includeHidden, resolveSearch}) | ||||||
|             .notes |             .notes | ||||||
| @@ -1111,28 +1050,33 @@ class BNote extends AbstractBeccaEntity { | |||||||
|  |  | ||||||
|     /** @returns {BNote[]} */ |     /** @returns {BNote[]} */ | ||||||
|     getAncestors() { |     getAncestors() { | ||||||
|         if (!this.ancestorCache) { |         if (!this.__ancestorCache) { | ||||||
|             const noteIds = new Set(); |             const noteIds = new Set(); | ||||||
|             this.ancestorCache = []; |             this.__ancestorCache = []; | ||||||
|  |  | ||||||
|             for (const parent of this.parents) { |             for (const parent of this.parents) { | ||||||
|                 if (noteIds.has(parent.noteId)) { |                 if (noteIds.has(parent.noteId)) { | ||||||
|                     continue; |                     continue; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 this.ancestorCache.push(parent); |                 this.__ancestorCache.push(parent); | ||||||
|                 noteIds.add(parent.noteId); |                 noteIds.add(parent.noteId); | ||||||
|  |  | ||||||
|                 for (const ancestorNote of parent.getAncestors()) { |                 for (const ancestorNote of parent.getAncestors()) { | ||||||
|                     if (!noteIds.has(ancestorNote.noteId)) { |                     if (!noteIds.has(ancestorNote.noteId)) { | ||||||
|                         this.ancestorCache.push(ancestorNote); |                         this.__ancestorCache.push(ancestorNote); | ||||||
|                         noteIds.add(ancestorNote.noteId); |                         noteIds.add(ancestorNote.noteId); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return this.ancestorCache; |         return this.__ancestorCache; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @returns {string[]} */ | ||||||
|  |     getAncestorNoteIds() { | ||||||
|  |         return this.getAncestors().map(note => note.noteId); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @returns {boolean} */ |     /** @returns {boolean} */ | ||||||
| @@ -1150,6 +1094,7 @@ class BNote extends AbstractBeccaEntity { | |||||||
|         return this.noteId === '_hidden' || this.hasAncestor('_hidden'); |         return this.noteId === '_hidden' || this.hasAncestor('_hidden'); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** @returns {BAttribute[]} */ | ||||||
|     getTargetRelations() { |     getTargetRelations() { | ||||||
|         return this.targetRelations; |         return this.targetRelations; | ||||||
|     } |     } | ||||||
| @@ -1186,10 +1131,67 @@ class BNote extends AbstractBeccaEntity { | |||||||
|         return minDistance; |         return minDistance; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @returns {BNoteRevision[]} */ |     /** @returns {BRevision[]} */ | ||||||
|     getNoteRevisions() { |     getRevisions() { | ||||||
|         return sql.getRows("SELECT * FROM note_revisions WHERE noteId = ?", [this.noteId]) |         return sql.getRows("SELECT * FROM revisions WHERE noteId = ?", [this.noteId]) | ||||||
|             .map(row => new BNoteRevision(row)); |             .map(row => new BRevision(row)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @returns {BAttachment[]} */ | ||||||
|  |     getAttachments(opts = {}) { | ||||||
|  |         opts.includeContentLength = !!opts.includeContentLength; | ||||||
|  |         // from testing, it looks like calculating length does not make a difference in performance even on large-ish DB | ||||||
|  |         // given that we're always fetching attachments only for a specific note, we might just do it always | ||||||
|  |  | ||||||
|  |         const query = opts.includeContentLength | ||||||
|  |             ? `SELECT attachments.*, LENGTH(blobs.content) AS contentLength | ||||||
|  |                FROM attachments  | ||||||
|  |                JOIN blobs USING (blobId)  | ||||||
|  |                WHERE ownerId = ? AND isDeleted = 0  | ||||||
|  |                ORDER BY position` | ||||||
|  |             : `SELECT * FROM attachments WHERE ownerId = ? AND isDeleted = 0 ORDER BY position`; | ||||||
|  |  | ||||||
|  |         return sql.getRows(query, [this.noteId]) | ||||||
|  |             .map(row => new BAttachment(row)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @returns {BAttachment|null} */ | ||||||
|  |     getAttachmentById(attachmentId, opts = {}) { | ||||||
|  |         opts.includeContentLength = !!opts.includeContentLength; | ||||||
|  |  | ||||||
|  |         const query = opts.includeContentLength | ||||||
|  |             ? `SELECT attachments.*, LENGTH(blobs.content) AS contentLength | ||||||
|  |                FROM attachments  | ||||||
|  |                JOIN blobs USING (blobId)  | ||||||
|  |                WHERE ownerId = ? AND attachmentId = ? AND isDeleted = 0` | ||||||
|  |             : `SELECT * FROM attachments WHERE ownerId = ? AND attachmentId = ? AND isDeleted = 0`; | ||||||
|  |  | ||||||
|  |         return sql.getRows(query, [this.noteId, attachmentId]) | ||||||
|  |             .map(row => new BAttachment(row))[0]; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @returns {BAttachment[]} */ | ||||||
|  |     getAttachmentsByRole(role) { | ||||||
|  |         return sql.getRows(` | ||||||
|  |                 SELECT attachments.* | ||||||
|  |                 FROM attachments  | ||||||
|  |                 WHERE ownerId = ?  | ||||||
|  |                   AND role = ? | ||||||
|  |                   AND isDeleted = 0 | ||||||
|  |                 ORDER BY position`, [this.noteId, role]) | ||||||
|  |             .map(row => new BAttachment(row)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @returns {BAttachment} */ | ||||||
|  |     getAttachmentByTitle(title) { | ||||||
|  |         return sql.getRows(` | ||||||
|  |                 SELECT attachments.* | ||||||
|  |                 FROM attachments  | ||||||
|  |                 WHERE ownerId = ?  | ||||||
|  |                   AND title = ? | ||||||
|  |                   AND isDeleted = 0 | ||||||
|  |                 ORDER BY position`, [this.noteId, title]) | ||||||
|  |             .map(row => new BAttachment(row))[0]; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -1203,13 +1205,10 @@ class BNote extends AbstractBeccaEntity { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         const parentNotes = this.getParentNotes(); |         const parentNotes = this.getParentNotes(); | ||||||
|         let notePaths = []; |  | ||||||
|  |  | ||||||
|         if (parentNotes.length === 1) { // optimization for most common case |         const notePaths = parentNotes.length === 1 | ||||||
|             notePaths = parentNotes[0].getAllNotePaths(); |             ? parentNotes[0].getAllNotePaths() // optimization for the most common case | ||||||
|         } else { |             : parentNotes.flatMap(parentNote => parentNote.getAllNotePaths()); | ||||||
|             notePaths = parentNotes.flatMap(parentNote => parentNote.getAllNotePaths()); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         for (const notePath of notePaths) { |         for (const notePath of notePaths) { | ||||||
|             notePath.push(this.noteId); |             notePath.push(this.noteId); | ||||||
| @@ -1248,7 +1247,7 @@ class BNote extends AbstractBeccaEntity { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Returns note path considered to be the "best" |      * Returns a note path considered to be the "best" | ||||||
|      * |      * | ||||||
|      * @param {string} [hoistedNoteId='root'] |      * @param {string} [hoistedNoteId='root'] | ||||||
|      * @return {string[]} array of noteIds constituting the particular note path |      * @return {string[]} array of noteIds constituting the particular note path | ||||||
| @@ -1258,7 +1257,7 @@ class BNote extends AbstractBeccaEntity { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Returns note path considered to be the "best" |      * Returns a note path considered to be the "best" | ||||||
|      * |      * | ||||||
|      * @param {string} [hoistedNoteId='root'] |      * @param {string} [hoistedNoteId='root'] | ||||||
|      * @return {string} serialized note path (e.g. 'root/a1h315/js725h') |      * @return {string} serialized note path (e.g. 'root/a1h315/js725h') | ||||||
| @@ -1356,10 +1355,10 @@ class BNote extends AbstractBeccaEntity { | |||||||
|      * @param {string} name - name of the attribute, not including the leading ~/# |      * @param {string} name - name of the attribute, not including the leading ~/# | ||||||
|      * @param {string} [value] - value of the attribute - text for labels, target note ID for relations; optional. |      * @param {string} [value] - value of the attribute - text for labels, target note ID for relations; optional. | ||||||
|      * @param {boolean} [isInheritable=false] |      * @param {boolean} [isInheritable=false] | ||||||
|      * @param {int} [position] |      * @param {int|null} [position] | ||||||
|      * @returns {BAttribute} |      * @returns {BAttribute} | ||||||
|      */ |      */ | ||||||
|     addAttribute(type, name, value = "", isInheritable = false, position = 1000) { |     addAttribute(type, name, value = "", isInheritable = false, position = null) { | ||||||
|         const BAttribute = require("./battribute"); |         const BAttribute = require("./battribute"); | ||||||
|  |  | ||||||
|         return new BAttribute({ |         return new BAttribute({ | ||||||
| @@ -1398,7 +1397,7 @@ class BNote extends AbstractBeccaEntity { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Based on enabled, attribute is either set or removed. |      * Based on enabled, the attribute is either set or removed. | ||||||
|      * |      * | ||||||
|      * @param {string} type - attribute type ('relation', 'label' etc.) |      * @param {string} type - attribute type ('relation', 'label' etc.) | ||||||
|      * @param {boolean} enabled - toggle On or Off |      * @param {boolean} enabled - toggle On or Off | ||||||
| @@ -1457,7 +1456,7 @@ class BNote extends AbstractBeccaEntity { | |||||||
|     removeLabel(name, value) { return this.removeAttribute(LABEL, name, value); } |     removeLabel(name, value) { return this.removeAttribute(LABEL, name, value); } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Remove relation name-value pair, if it exists. |      * Remove the relation name-value pair, if it exists. | ||||||
|      * |      * | ||||||
|      * @param {string} name - relation name |      * @param {string} name - relation name | ||||||
|      * @param {string} [value] - relation value (noteId) |      * @param {string} [value] - relation value (noteId) | ||||||
| @@ -1486,13 +1485,89 @@ class BNote extends AbstractBeccaEntity { | |||||||
|         return cloningService.cloneNoteToBranch(this.noteId, branch.branchId); |         return cloningService.cloneNoteToBranch(this.noteId, branch.branchId); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     isEligibleForConversionToAttachment(opts = {autoConversion: false}) { | ||||||
|  |         if (this.type !== 'image' || !this.isContentAvailable() || this.hasChildren() || this.getParentBranches().length !== 1) { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         const targetRelations = this.getTargetRelations().filter(relation => relation.name === 'imageLink'); | ||||||
|  |  | ||||||
|  |         if (opts.autoConversion && targetRelations.length === 0) { | ||||||
|  |             return false; | ||||||
|  |         } else if (targetRelations.length > 1) { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         const parentNote = this.getParentNotes()[0]; // at this point note can have only one parent | ||||||
|  |         const referencingNote = targetRelations[0]?.getNote(); | ||||||
|  |  | ||||||
|  |         if (referencingNote && parentNote !== referencingNote) { | ||||||
|  |             return false; | ||||||
|  |         } else if (parentNote.type !== 'text' || !parentNote.isContentAvailable()) { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return true; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Some notes are eligible for conversion into an attachment of its parent, note must have these properties: | ||||||
|  |      * - it has exactly one target relation | ||||||
|  |      * - it has a relation from its parent note | ||||||
|  |      * - it has no children | ||||||
|  |      * - it has no clones | ||||||
|  |      * - the parent is of type text | ||||||
|  |      * - both notes are either unprotected or user is in protected session | ||||||
|  |      * | ||||||
|  |      * Currently, works only for image notes. | ||||||
|  |      * | ||||||
|  |      * In the future, this functionality might get more generic and some of the requirements relaxed. | ||||||
|  |      * | ||||||
|  |      * @params {Object} [opts] | ||||||
|  |      * @params {bolean} [opts.autoConversion=false} if true, the action is not triggered by user, but e.g. by migration, | ||||||
|  |      *                                              and only perfect candidates will be migrated | ||||||
|  |      * | ||||||
|  |      * @returns {BAttachment|null} - null if note is not eligible for conversion | ||||||
|  |      */ | ||||||
|  |     convertToParentAttachment(opts = {autoConversion: false}) { | ||||||
|  |         if (!this.isEligibleForConversionToAttachment(opts)) { | ||||||
|  |             return null; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         const content = this.getContent(); | ||||||
|  |  | ||||||
|  |         const parentNote = this.getParentNotes()[0]; | ||||||
|  |         const attachment = parentNote.saveAttachment({ | ||||||
|  |             role: 'image', | ||||||
|  |             mime: this.mime, | ||||||
|  |             title: this.title, | ||||||
|  |             content: content | ||||||
|  |         }); | ||||||
|  |  | ||||||
|  |         let parentContent = parentNote.getContent(); | ||||||
|  |  | ||||||
|  |         const oldNoteUrl = `api/images/${this.noteId}/`; | ||||||
|  |         const newAttachmentUrl = `api/attachments/${attachment.attachmentId}/image/`; | ||||||
|  |  | ||||||
|  |         const fixedContent = utils.replaceAll(parentContent, oldNoteUrl, newAttachmentUrl); | ||||||
|  |  | ||||||
|  |         parentNote.setContent(fixedContent); | ||||||
|  |  | ||||||
|  |         const noteService = require("../../services/notes"); | ||||||
|  |         noteService.asyncPostProcessContent(parentNote, fixedContent); // to mark an unused attachment for deletion | ||||||
|  |  | ||||||
|  |         this.deleteNote(); | ||||||
|  |  | ||||||
|  |         return attachment; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * (Soft) delete a note and all its descendants. |      * (Soft) delete a note and all its descendants. | ||||||
|      * |      * | ||||||
|      * @param {string} [deleteId] - optional delete identified |      * @param {string} [deleteId=null] - optional delete identified | ||||||
|      * @param {TaskContext} [taskContext] |      * @param {TaskContext} [taskContext] | ||||||
|      */ |      */ | ||||||
|     deleteNote(deleteId, taskContext) { |     deleteNote(deleteId = null, taskContext = null) { | ||||||
|         if (this.isDeleted) { |         if (this.isDeleted) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| @@ -1519,7 +1594,7 @@ class BNote extends AbstractBeccaEntity { | |||||||
|         if (this.isProtected && !this.isDecrypted && protectedSessionService.isProtectedSessionAvailable()) { |         if (this.isProtected && !this.isDecrypted && protectedSessionService.isProtectedSessionAvailable()) { | ||||||
|             try { |             try { | ||||||
|                 this.title = protectedSessionService.decryptString(this.title); |                 this.title = protectedSessionService.decryptString(this.title); | ||||||
|                 this.flatTextCache = null; |                 this.__flatTextCache = null; | ||||||
|  |  | ||||||
|                 this.isDecrypted = true; |                 this.isDecrypted = true; | ||||||
|             } |             } | ||||||
| @@ -1538,42 +1613,82 @@ class BNote extends AbstractBeccaEntity { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     get isDeleted() { |     get isDeleted() { | ||||||
|  |         // isBeingDeleted is relevant only in the transition period when the deletion process has begun, but not yet | ||||||
|  |         // finished (note is still in becca) | ||||||
|         return !(this.noteId in this.becca.notes) || this.isBeingDeleted; |         return !(this.noteId in this.becca.notes) || this.isBeingDeleted; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @returns {BNoteRevision|null} |      * @returns {BRevision|null} | ||||||
|      */ |      */ | ||||||
|     saveNoteRevision() { |     saveRevision() { | ||||||
|         const content = this.getContent(); |         return sql.transactional(() => { | ||||||
|  |             let noteContent = this.getContent(); | ||||||
|  |  | ||||||
|         if (!content || (Buffer.isBuffer(content) && content.byteLength === 0)) { |             const revision = new BRevision({ | ||||||
|             return null; |                 noteId: this.noteId, | ||||||
|  |                 // title and text should be decrypted now | ||||||
|  |                 title: this.title, | ||||||
|  |                 type: this.type, | ||||||
|  |                 mime: this.mime, | ||||||
|  |                 isProtected: this.isProtected, | ||||||
|  |                 utcDateLastEdited: this.utcDateModified, | ||||||
|  |                 utcDateCreated: dateUtils.utcNowDateTime(), | ||||||
|  |                 utcDateModified: dateUtils.utcNowDateTime(), | ||||||
|  |                 dateLastEdited: this.dateModified, | ||||||
|  |                 dateCreated: dateUtils.localNowDateTime() | ||||||
|  |             }, true); | ||||||
|  |  | ||||||
|  |             revision.save(); // to generate revisionId, which is then used to save attachments | ||||||
|  |  | ||||||
|  |             for (const noteAttachment of this.getAttachments()) { | ||||||
|  |                 const revisionAttachment = noteAttachment.copy(); | ||||||
|  |                 revisionAttachment.ownerId = revision.revisionId; | ||||||
|  |                 revisionAttachment.setContent(noteAttachment.getContent(), {forceSave: true}); | ||||||
|  |  | ||||||
|  |                 if (this.type === 'text') { | ||||||
|  |                     // content is rewritten to point to the revision attachments | ||||||
|  |                     noteContent = noteContent.replaceAll(`attachments/${noteAttachment.attachmentId}`, | ||||||
|  |                         `attachments/${revisionAttachment.attachmentId}`); | ||||||
|  |  | ||||||
|  |                     noteContent = noteContent.replaceAll(new RegExp(`href="[^"]*attachmentId=${noteAttachment.attachmentId}[^"]*"`, 'gi'), | ||||||
|  |                         `href="api/attachments/${revisionAttachment.attachmentId}/download"`); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             revision.setContent(noteContent); | ||||||
|  |  | ||||||
|  |             return revision; | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * @returns {BAttachment} | ||||||
|  |      */ | ||||||
|  |     saveAttachment({attachmentId, role, mime, title, content, position}) { | ||||||
|  |         let attachment; | ||||||
|  |  | ||||||
|  |         if (attachmentId) { | ||||||
|  |             attachment = this.becca.getAttachmentOrThrow(attachmentId); | ||||||
|  |         } else { | ||||||
|  |             attachment = new BAttachment({ | ||||||
|  |                 ownerId: this.noteId, | ||||||
|  |                 title, | ||||||
|  |                 role, | ||||||
|  |                 mime, | ||||||
|  |                 isProtected: this.isProtected, | ||||||
|  |                 position | ||||||
|  |             }); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         const contentMetadata = this.getContentMetadata(); |         content = content || ""; | ||||||
|  |         attachment.setContent(content, {forceSave: true}); | ||||||
|  |  | ||||||
|         const noteRevision = new BNoteRevision({ |         return attachment; | ||||||
|             noteId: this.noteId, |     } | ||||||
|             // title and text should be decrypted now |  | ||||||
|             title: this.title, |  | ||||||
|             type: this.type, |  | ||||||
|             mime: this.mime, |  | ||||||
|             isProtected: this.isProtected, |  | ||||||
|             utcDateLastEdited: this.utcDateModified > contentMetadata.utcDateModified |  | ||||||
|                 ? this.utcDateModified |  | ||||||
|                 : contentMetadata.utcDateModified, |  | ||||||
|             utcDateCreated: dateUtils.utcNowDateTime(), |  | ||||||
|             utcDateModified: dateUtils.utcNowDateTime(), |  | ||||||
|             dateLastEdited: this.dateModified > contentMetadata.dateModified |  | ||||||
|                 ? this.dateModified |  | ||||||
|                 : contentMetadata.dateModified, |  | ||||||
|             dateCreated: dateUtils.localNowDateTime() |  | ||||||
|         }, true).save(); |  | ||||||
|  |  | ||||||
|         noteRevision.setContent(content); |     getFileName() { | ||||||
|  |         return utils.formatDownloadTitle(this.title, this.type, this.mime); | ||||||
|         return noteRevision; |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     beforeSaving() { |     beforeSaving() { | ||||||
| @@ -1592,6 +1707,7 @@ class BNote extends AbstractBeccaEntity { | |||||||
|             isProtected: this.isProtected, |             isProtected: this.isProtected, | ||||||
|             type: this.type, |             type: this.type, | ||||||
|             mime: this.mime, |             mime: this.mime, | ||||||
|  |             blobId: this.blobId, | ||||||
|             isDeleted: false, |             isDeleted: false, | ||||||
|             dateCreated: this.dateCreated, |             dateCreated: this.dateCreated, | ||||||
|             dateModified: this.dateModified, |             dateModified: this.dateModified, | ||||||
| @@ -1628,7 +1744,7 @@ module.exports = BNote; | |||||||
| </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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
| @@ -32,7 +32,7 @@ const dateUtils = require('../../services/date_utils'); | |||||||
| const AbstractBeccaEntity = require("./abstract_becca_entity"); | const AbstractBeccaEntity = require("./abstract_becca_entity"); | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Option represents name-value pair, either directly configurable by the user or some system property. |  * Option represents a name-value pair, either directly configurable by the user or some system property. | ||||||
|  * |  * | ||||||
|  * @extends AbstractBeccaEntity |  * @extends AbstractBeccaEntity | ||||||
|  */ |  */ | ||||||
| @@ -86,7 +86,7 @@ module.exports = BOption; | |||||||
| </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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
| @@ -71,7 +71,7 @@ module.exports = BRecentNote; | |||||||
| </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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
| <html lang="en"> | <html lang="en"> | ||||||
| <head> | <head> | ||||||
|     <meta charset="utf-8"> |     <meta charset="utf-8"> | ||||||
|     <title>JSDoc: Source: becca/entities/bnote_revision.js</title> |     <title>JSDoc: Source: becca/entities/brevision.js</title> | ||||||
| 
 | 
 | ||||||
|     <script src="scripts/prettify/prettify.js"> </script> |     <script src="scripts/prettify/prettify.js"> </script> | ||||||
|     <script src="scripts/prettify/lang-css.js"> </script> |     <script src="scripts/prettify/lang-css.js"> </script> | ||||||
| @@ -17,7 +17,7 @@ | |||||||
| 
 | 
 | ||||||
| <div id="main"> | <div id="main"> | ||||||
| 
 | 
 | ||||||
|     <h1 class="page-title">Source: becca/entities/bnote_revision.js</h1> |     <h1 class="page-title">Source: becca/entities/brevision.js</h1> | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -30,28 +30,29 @@ | |||||||
| 
 | 
 | ||||||
| const protectedSessionService = require('../../services/protected_session'); | const protectedSessionService = require('../../services/protected_session'); | ||||||
| const utils = require('../../services/utils'); | const utils = require('../../services/utils'); | ||||||
| const sql = require('../../services/sql'); |  | ||||||
| const dateUtils = require('../../services/date_utils'); | const dateUtils = require('../../services/date_utils'); | ||||||
| const becca = require('../becca'); | const becca = require('../becca'); | ||||||
| const entityChangesService = require('../../services/entity_changes'); |  | ||||||
| const AbstractBeccaEntity = require("./abstract_becca_entity"); | const AbstractBeccaEntity = require("./abstract_becca_entity"); | ||||||
|  | const sql = require("../../services/sql"); | ||||||
|  | const BAttachment = require("./battachment"); | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * NoteRevision represents snapshot of note's title and content at some point in the past. |  * Revision represents a snapshot of note's title and content at some point in the past. | ||||||
|  * It's used for seamless note versioning. |  * It's used for seamless note versioning. | ||||||
|  * |  * | ||||||
|  * @extends AbstractBeccaEntity |  * @extends AbstractBeccaEntity | ||||||
|  */ |  */ | ||||||
| class BNoteRevision extends AbstractBeccaEntity { | class BRevision extends AbstractBeccaEntity { | ||||||
|     static get entityName() { return "note_revisions"; } |     static get entityName() { return "revisions"; } | ||||||
|     static get primaryKeyName() { return "noteRevisionId"; } |     static get primaryKeyName() { return "revisionId"; } | ||||||
|     static get hashedProperties() { return ["noteRevisionId", "noteId", "title", "isProtected", "dateLastEdited", "dateCreated", "utcDateLastEdited", "utcDateCreated", "utcDateModified"]; } |     static get hashedProperties() { return ["revisionId", "noteId", "title", "isProtected", "dateLastEdited", "dateCreated", | ||||||
|  |                                             "utcDateLastEdited", "utcDateCreated", "utcDateModified", "blobId"]; } | ||||||
| 
 | 
 | ||||||
|     constructor(row, titleDecrypted = false) { |     constructor(row, titleDecrypted = false) { | ||||||
|         super(); |         super(); | ||||||
| 
 | 
 | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
|         this.noteRevisionId = row.noteRevisionId; |         this.revisionId = row.revisionId; | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
|         this.noteId = row.noteId; |         this.noteId = row.noteId; | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
| @@ -63,6 +64,8 @@ class BNoteRevision extends AbstractBeccaEntity { | |||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
|         this.title = row.title; |         this.title = row.title; | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
|  |         this.blobId = row.blobId; | ||||||
|  |         /** @type {string} */ | ||||||
|         this.dateLastEdited = row.dateLastEdited; |         this.dateLastEdited = row.dateLastEdited; | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
|         this.dateCreated = row.dateCreated; |         this.dateCreated = row.dateCreated; | ||||||
| @@ -72,7 +75,7 @@ class BNoteRevision extends AbstractBeccaEntity { | |||||||
|         this.utcDateCreated = row.utcDateCreated; |         this.utcDateCreated = row.utcDateCreated; | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
|         this.utcDateModified = row.utcDateModified; |         this.utcDateModified = row.utcDateModified; | ||||||
|         /** @type {number} */ |         /** @type {int} */ | ||||||
|         this.contentLength = row.contentLength; |         this.contentLength = row.contentLength; | ||||||
| 
 | 
 | ||||||
|         if (this.isProtected && !titleDecrypted) { |         if (this.isProtected && !titleDecrypted) { | ||||||
| @@ -87,92 +90,109 @@ class BNoteRevision extends AbstractBeccaEntity { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** @returns {boolean} true if the note has string content (not binary) */ |     /** @returns {boolean} true if the note has string content (not binary) */ | ||||||
|     isStringNote() { |     hasStringContent() { | ||||||
|         return utils.isStringNote(this.type, this.mime); |         return utils.isStringNote(this.type, this.mime); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     isContentAvailable() { | ||||||
|  |         return !this.revisionId // new note which was not encrypted yet | ||||||
|  |             || !this.isProtected | ||||||
|  |             || protectedSessionService.isProtectedSessionAvailable() | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /* |     /* | ||||||
|      * Note revision content has quite special handling - it's not a separate entity, but a lazily loaded |      * Note revision content has quite special handling - it's not a separate entity, but a lazily loaded | ||||||
|      * part of NoteRevision entity with its own sync. Reason behind this hybrid design is that |      * part of Revision entity with its own sync. The 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 |      * 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. |      * 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. |      * This is the same approach as is used for Note's content. | ||||||
|      */ |      */ | ||||||
| 
 | 
 | ||||||
|     /** @returns {*} */ |     /** @returns {string|Buffer} */ | ||||||
|     getContent(silentNotFoundError = false) { |     getContent() { | ||||||
|         const res = sql.getRow(`SELECT content FROM note_revision_contents WHERE noteRevisionId = ?`, [this.noteRevisionId]); |         return this._getContent(); | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         if (!res) { |     /** | ||||||
|             if (silentNotFoundError) { |      * @returns {*} | ||||||
|                 return undefined; |      * @throws Error in case of invalid JSON */ | ||||||
|             } |     getJsonContent() { | ||||||
|             else { |         const content = this.getContent(); | ||||||
|                 throw new Error(`Cannot find note revision content for noteRevisionId=${this.noteRevisionId}`); | 
 | ||||||
|             } |         if (!content || !content.trim()) { | ||||||
|  |             return null; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         let content = res.content; |         return JSON.parse(content); | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         if (this.isProtected) { |     /** @returns {*|null} valid object or null if the content cannot be parsed as JSON */ | ||||||
|             if (protectedSessionService.isProtectedSessionAvailable()) { |     getJsonContentSafely() { | ||||||
|                 content = protectedSessionService.decrypt(content); |         try { | ||||||
|             } |             return this.getJsonContent(); | ||||||
|             else { |  | ||||||
|                 content = ""; |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
| 
 |         catch (e) { | ||||||
|         if (this.isStringNote()) { |             return null; | ||||||
|             return content === null |  | ||||||
|                 ? "" |  | ||||||
|                 : content.toString("UTF-8"); |  | ||||||
|         } |  | ||||||
|         else { |  | ||||||
|             return content; |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     setContent(content) { |     /** | ||||||
|         const pojo = { |      * @param content | ||||||
|             noteRevisionId: this.noteRevisionId, |      * @param {object} [opts] | ||||||
|             content: content, |      * @param {object} [opts.forceSave=false] - will also save this BRevision entity | ||||||
|             utcDateModified: dateUtils.utcNowDateTime() |      */ | ||||||
|         }; |     setContent(content, opts) { | ||||||
| 
 |         this._setContent(content, opts); | ||||||
|         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}|${pojo.content.toString()}`); |  | ||||||
| 
 |  | ||||||
|         entityChangesService.addEntityChange({ |  | ||||||
|             entityName: 'note_revision_contents', |  | ||||||
|             entityId: this.noteRevisionId, |  | ||||||
|             hash: hash, |  | ||||||
|             isErased: false, |  | ||||||
|             utcDateChanged: this.getUtcDateChanged(), |  | ||||||
|             isSynced: true |  | ||||||
|         }); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** @returns {{contentLength, dateModified, utcDateModified}} */ |     /** @returns {BAttachment[]} */ | ||||||
|     getContentMetadata() { |     getAttachments() { | ||||||
|         return sql.getRow(` |         return sql.getRows(` | ||||||
|             SELECT  |                 SELECT attachments.* | ||||||
|                 LENGTH(content) AS contentLength,  |                 FROM attachments  | ||||||
|                 dateModified, |                 WHERE ownerId = ?  | ||||||
|                 utcDateModified  |                   AND isDeleted = 0`, [this.revisionId]) | ||||||
|             FROM note_revision_contents  |             .map(row => new BAttachment(row)); | ||||||
|             WHERE noteRevisionId = ?`, [this.noteRevisionId]); |     } | ||||||
|  | 
 | ||||||
|  |     /** @returns {BAttachment|null} */ | ||||||
|  |     getAttachmentById(attachmentId, opts = {}) { | ||||||
|  |         opts.includeContentLength = !!opts.includeContentLength; | ||||||
|  | 
 | ||||||
|  |         const query = opts.includeContentLength | ||||||
|  |             ? `SELECT attachments.*, LENGTH(blobs.content) AS contentLength | ||||||
|  |                FROM attachments  | ||||||
|  |                JOIN blobs USING (blobId)  | ||||||
|  |                WHERE ownerId = ? AND attachmentId = ? AND isDeleted = 0` | ||||||
|  |             : `SELECT * FROM attachments WHERE ownerId = ? AND attachmentId = ? AND isDeleted = 0`; | ||||||
|  | 
 | ||||||
|  |         return sql.getRows(query, [this.revisionId, attachmentId]) | ||||||
|  |             .map(row => new BAttachment(row))[0]; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** @returns {BAttachment[]} */ | ||||||
|  |     getAttachmentsByRole(role) { | ||||||
|  |         return sql.getRows(` | ||||||
|  |                 SELECT attachments.* | ||||||
|  |                 FROM attachments  | ||||||
|  |                 WHERE ownerId = ?  | ||||||
|  |                   AND role = ? | ||||||
|  |                   AND isDeleted = 0 | ||||||
|  |                 ORDER BY position`, [this.revisionId, role]) | ||||||
|  |             .map(row => new BAttachment(row)); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** @returns {BAttachment} */ | ||||||
|  |     getAttachmentByTitle(title) { | ||||||
|  |         return sql.getRows(` | ||||||
|  |                 SELECT attachments.* | ||||||
|  |                 FROM attachments  | ||||||
|  |                 WHERE ownerId = ?  | ||||||
|  |                   AND title = ? | ||||||
|  |                   AND isDeleted = 0 | ||||||
|  |                 ORDER BY position`, [this.revisionId, title]) | ||||||
|  |             .map(row => new BAttachment(row))[0]; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     beforeSaving() { |     beforeSaving() { | ||||||
| @@ -183,12 +203,13 @@ class BNoteRevision extends AbstractBeccaEntity { | |||||||
| 
 | 
 | ||||||
|     getPojo() { |     getPojo() { | ||||||
|         return { |         return { | ||||||
|             noteRevisionId: this.noteRevisionId, |             revisionId: this.revisionId, | ||||||
|             noteId: this.noteId, |             noteId: this.noteId, | ||||||
|             type: this.type, |             type: this.type, | ||||||
|             mime: this.mime, |             mime: this.mime, | ||||||
|             isProtected: this.isProtected, |             isProtected: this.isProtected, | ||||||
|             title: this.title, |             title: this.title, | ||||||
|  |             blobId: this.blobId, | ||||||
|             dateLastEdited: this.dateLastEdited, |             dateLastEdited: this.dateLastEdited, | ||||||
|             dateCreated: this.dateCreated, |             dateCreated: this.dateCreated, | ||||||
|             utcDateLastEdited: this.utcDateLastEdited, |             utcDateLastEdited: this.utcDateLastEdited, | ||||||
| @@ -218,7 +239,7 @@ class BNoteRevision extends AbstractBeccaEntity { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| module.exports = BNoteRevision; | module.exports = BRevision; | ||||||
| </code></pre> | </code></pre> | ||||||
|         </article> |         </article> | ||||||
|     </section> |     </section> | ||||||
| @@ -229,7 +250,7 @@ module.exports = BNoteRevision; | |||||||
| </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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
| 
 | 
 | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
| @@ -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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
| @@ -1294,7 +1294,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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
| @@ -47,6 +47,7 @@ const SpacedUpdate = require("./spaced_update"); | |||||||
| const specialNotesService = require("./special_notes"); | const specialNotesService = require("./special_notes"); | ||||||
| const branchService = require("./branches"); | const branchService = require("./branches"); | ||||||
| const exportService = require("./export/zip"); | const exportService = require("./export/zip"); | ||||||
|  | const syncMutex = require("./sync_mutex.js"); | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * <p>This is the main backend API interface for scripts. All the properties and methods are published in the "api" object |  * <p>This is the main backend API interface for scripts. All the properties and methods are published in the "api" object | ||||||
| @@ -55,11 +56,11 @@ const exportService = require("./export/zip"); | |||||||
|  * @constructor |  * @constructor | ||||||
|  */ |  */ | ||||||
| function BackendScriptApi(currentNote, apiParams) { | function BackendScriptApi(currentNote, apiParams) { | ||||||
|     /** @property {BNote} note where script started executing */ |     /** @property {BNote} note where the script started executing */ | ||||||
|     this.startNote = apiParams.startNote; |     this.startNote = apiParams.startNote; | ||||||
|     /** @property {BNote} note where script is currently executing. Don't mix this up with concept of active note */ |     /** @property {BNote} note where the script is currently executing. Don't mix this up with the concept of active note */ | ||||||
|     this.currentNote = currentNote; |     this.currentNote = currentNote; | ||||||
|     /** @property {AbstractBeccaEntity} entity whose event triggered this executions */ |     /** @property {AbstractBeccaEntity} entity whose event triggered this execution */ | ||||||
|     this.originEntity = apiParams.originEntity; |     this.originEntity = apiParams.originEntity; | ||||||
|  |  | ||||||
|     for (const key in apiParams) { |     for (const key in apiParams) { | ||||||
| @@ -170,7 +171,7 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|      * @method |      * @method | ||||||
|      * @param {string} noteId |      * @param {string} noteId | ||||||
|      * @param {string} parentNoteId |      * @param {string} parentNoteId | ||||||
|      * @param {string} prefix - if branch will be created between note and parent note, set this prefix |      * @param {string} prefix - if branch is created between note and parent note, set this prefix | ||||||
|      * @returns {{branch: BBranch|null}} |      * @returns {{branch: BBranch|null}} | ||||||
|      */ |      */ | ||||||
|     this.ensureNoteIsPresentInParent = cloningService.ensureNoteIsPresentInParent; |     this.ensureNoteIsPresentInParent = cloningService.ensureNoteIsPresentInParent; | ||||||
| @@ -192,7 +193,7 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|      * @param {boolean} present - true if we want the branch to exist, false if we want it gone |      * @param {boolean} present - true if we want the branch to exist, false if we want it gone | ||||||
|      * @param {string} noteId |      * @param {string} noteId | ||||||
|      * @param {string} parentNoteId |      * @param {string} parentNoteId | ||||||
|      * @param {string} prefix - if branch will be created between note and parent note, set this prefix |      * @param {string} prefix - if branch is created between note and parent note, set this prefix | ||||||
|      * @returns {void} |      * @returns {void} | ||||||
|      */ |      */ | ||||||
|     this.toggleNoteInParent = cloningService.toggleNoteInParent; |     this.toggleNoteInParent = cloningService.toggleNoteInParent; | ||||||
| @@ -272,7 +273,7 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|  |  | ||||||
|         const parentNote = becca.getNote(parentNoteId); |         const parentNote = becca.getNote(parentNoteId); | ||||||
|  |  | ||||||
|         // code note type can be inherited, otherwise text is default |         // code note type can be inherited, otherwise "text" is the default | ||||||
|         extraOptions.type = parentNote.type === 'code' ? 'code' : 'text'; |         extraOptions.type = parentNote.type === 'code' ? 'code' : 'text'; | ||||||
|         extraOptions.mime = parentNote.type === 'code' ? parentNote.mime : 'text/html'; |         extraOptions.mime = parentNote.type === 'code' ? parentNote.mime : 'text/html'; | ||||||
|  |  | ||||||
| @@ -440,7 +441,7 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|      * Return randomly generated string of given length. This random string generation is NOT cryptographically secure. |      * Return randomly generated string of given length. This random string generation is NOT cryptographically secure. | ||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {number} length of the string |      * @param {int} length of the string | ||||||
|      * @returns {string} random string |      * @returns {string} random string | ||||||
|      */ |      */ | ||||||
|     this.randomString = utils.randomString; |     this.randomString = utils.randomString; | ||||||
| @@ -557,6 +558,62 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|      */ |      */ | ||||||
|     this.exportSubtreeToZipFile = async (noteId, format, zipFilePath) => await exportService.exportToZipFile(noteId, format, zipFilePath); |     this.exportSubtreeToZipFile = async (noteId, format, zipFilePath) => await exportService.exportToZipFile(noteId, format, zipFilePath); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Executes given anonymous function on the frontend(s). | ||||||
|  |      * Internally this serializes the anonymous function into string and sends it to frontend(s) via WebSocket. | ||||||
|  |      * Note that there can be multiple connected frontend instances (e.g. in different tabs). In such case, all | ||||||
|  |      * instances execute the given function. | ||||||
|  |      * | ||||||
|  |      * @method | ||||||
|  |      * @param {string} script - script to be executed on the frontend | ||||||
|  |      * @param {Array.<?>} params - list of parameters to the anonymous function to be sent to frontend | ||||||
|  |      * @returns {undefined} - no return value is provided. | ||||||
|  |      */ | ||||||
|  |     this.runOnFrontend = async (script, params = []) => { | ||||||
|  |         if (typeof script === "function") { | ||||||
|  |             script = script.toString(); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         ws.sendMessageToAllClients({ | ||||||
|  |             type: 'execute-script', | ||||||
|  |             script: script, | ||||||
|  |             params: prepareParams(params), | ||||||
|  |             startNoteId: this.startNote.noteId, | ||||||
|  |             currentNoteId: this.currentNote.noteId, | ||||||
|  |             originEntityName: "notes", // currently there's no other entity on the frontend which can trigger event | ||||||
|  |             originEntityId: this.originEntity?.noteId || null | ||||||
|  |         }); | ||||||
|  |  | ||||||
|  |         function prepareParams(params) { | ||||||
|  |             if (!params) { | ||||||
|  |                 return params; | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             return params.map(p => { | ||||||
|  |                 if (typeof p === "function") { | ||||||
|  |                     return `!@#Function: ${p.toString()}`; | ||||||
|  |                 } | ||||||
|  |                 else { | ||||||
|  |                     return p; | ||||||
|  |                 } | ||||||
|  |             }); | ||||||
|  |         } | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Sync process can make data intermittently inconsistent. Scripts which require strong data consistency | ||||||
|  |      * can use this function to wait for a possible sync process to finish and prevent new sync process from starting | ||||||
|  |      * while it is running. | ||||||
|  |      * | ||||||
|  |      * Because this is an async process, the inner callback doesn't have automatic transaction handling, so in case | ||||||
|  |      * you need to make some DB changes, you need to surround your call with api.transactional(...) | ||||||
|  |      * | ||||||
|  |      * @method | ||||||
|  |      * @param {function} callback - function to be executed while sync process is not running | ||||||
|  |      * @returns {Promise} - resolves once the callback is finished (callback is awaited) | ||||||
|  |      */ | ||||||
|  |     this.runOutsideOfSync = syncMutex.doExclusively; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * This object contains "at your risk" and "no BC guarantees" objects for advanced use cases. |      * This object contains "at your risk" and "no BC guarantees" objects for advanced use cases. | ||||||
|      * |      * | ||||||
| @@ -578,7 +635,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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
| @@ -54,7 +54,7 @@ const LOG_ALL_QUERIES = false; | |||||||
| }); | }); | ||||||
|  |  | ||||||
| function insert(tableName, rec, replace = false) { | function insert(tableName, rec, replace = false) { | ||||||
|     const keys = Object.keys(rec); |     const keys = Object.keys(rec || {}); | ||||||
|     if (keys.length === 0) { |     if (keys.length === 0) { | ||||||
|         log.error(`Can't insert empty object into table ${tableName}`); |         log.error(`Can't insert empty object into table ${tableName}`); | ||||||
|         return; |         return; | ||||||
| @@ -81,7 +81,7 @@ function replace(tableName, rec) { | |||||||
| } | } | ||||||
|  |  | ||||||
| function upsert(tableName, primaryKey, rec) { | function upsert(tableName, primaryKey, rec) { | ||||||
|     const keys = Object.keys(rec); |     const keys = Object.keys(rec || {}); | ||||||
|     if (keys.length === 0) { |     if (keys.length === 0) { | ||||||
|         log.error(`Can't upsert empty object into table ${tableName}`); |         log.error(`Can't upsert empty object into table ${tableName}`); | ||||||
|         return; |         return; | ||||||
| @@ -407,7 +407,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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BNoteRevision.html">BNoteRevision</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> |     <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="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
| @@ -194,7 +194,75 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|     <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_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line16">line 16</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line17">line 17</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  | <h4 class="name" id="froca"><span class="type-signature"></span>froca<span class="type-signature"> :Froca</span></h4> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     <h5>Type:</h5> | ||||||
|  |     <ul> | ||||||
|  |         <li> | ||||||
|  |              | ||||||
|  | <span class="param-type">Froca</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         </li> | ||||||
|  |     </ul> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line10">line 10</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -262,7 +330,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|     <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_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line28">line 28</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line29">line 29</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -330,7 +398,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|     <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_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line22">line 22</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line23">line 23</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -398,7 +466,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|     <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_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line18">line 18</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line19">line 19</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -466,7 +534,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|     <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_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line26">line 26</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line27">line 27</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -534,7 +602,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|     <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_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line20">line 20</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line21">line 21</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -602,7 +670,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|     <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_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line24">line 24</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line25">line 25</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -678,7 +746,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|     <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_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line32">line 32</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line33">line 33</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -780,7 +848,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
|     <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_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line37">line 37</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line38">line 38</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -844,7 +912,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
| </div> | </div> | ||||||
|  |  | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FNoteComplement.html">FNoteComplement</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul> |     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
| @@ -198,7 +198,75 @@ parents.</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_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line17">line 17</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line18">line 18</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  | <h4 class="name" id="froca"><span class="type-signature"></span>froca<span class="type-signature"> :Froca</span></h4> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     <h5>Type:</h5> | ||||||
|  |     <ul> | ||||||
|  |         <li> | ||||||
|  |              | ||||||
|  | <span class="param-type">Froca</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         </li> | ||||||
|  |     </ul> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line8">line 8</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -266,7 +334,7 @@ parents.</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_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line29">line 29</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line30">line 30</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -334,7 +402,7 @@ parents.</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_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line27">line 27</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line28">line 28</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -402,7 +470,7 @@ parents.</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_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line19">line 19</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line20">line 20</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -470,7 +538,7 @@ parents.</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_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line23">line 23</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line24">line 24</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -538,7 +606,7 @@ parents.</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_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line21">line 21</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line22">line 22</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -606,7 +674,7 @@ parents.</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_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line25">line 25</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line26">line 26</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -682,7 +750,7 @@ parents.</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_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line33">line 33</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line34">line 34</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -784,7 +852,7 @@ parents.</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_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line38">line 38</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line39">line 39</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -886,7 +954,7 @@ parents.</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_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line43">line 43</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line44">line 44</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -988,7 +1056,7 @@ parents.</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_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line48">line 48</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line49">line 49</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1017,7 +1085,7 @@ parents.</div> | |||||||
|  |  | ||||||
|          |          | ||||||
| <div class="param-desc"> | <div class="param-desc"> | ||||||
|     true if it's top level, meaning its parent is root note |     true if it's top level, meaning its parent is the root note | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -1056,7 +1124,7 @@ parents.</div> | |||||||
| </div> | </div> | ||||||
|  |  | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FNoteComplement.html">FNoteComplement</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul> |     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,790 +0,0 @@ | |||||||
| <!DOCTYPE html> |  | ||||||
| <html lang="en"> |  | ||||||
| <head> |  | ||||||
|     <meta charset="utf-8"> |  | ||||||
|     <title>JSDoc: Class: FNoteComplement</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: FNoteComplement</h1> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <section> |  | ||||||
|  |  | ||||||
| <header> |  | ||||||
|      |  | ||||||
|         <h2><span class="attribs"><span class="type-signature"></span></span>FNoteComplement<span class="signature">()</span><span class="type-signature"></span></h2> |  | ||||||
|          |  | ||||||
|             <div class="class-description">Complements the FNote with the main note content and other extra attributes</div> |  | ||||||
|          |  | ||||||
|      |  | ||||||
| </header> |  | ||||||
|  |  | ||||||
| <article> |  | ||||||
|     <div class="container-overview"> |  | ||||||
|      |  | ||||||
|          |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <h2>Constructor</h2> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <h4 class="name" id="FNoteComplement"><span class="type-signature"></span>new FNoteComplement<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_fnote_complement.js.html">entities/fnote_complement.js</a>, <a href="entities_fnote_complement.js.html#line4">line 4</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     </div> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|         <h3 class="subsection-title">Members</h3> |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <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> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="entities_fnote_complement.js.html">entities/fnote_complement.js</a>, <a href="entities_fnote_complement.js.html#line33">line 33</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <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> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="entities_fnote_complement.js.html">entities/fnote_complement.js</a>, <a href="entities_fnote_complement.js.html#line36">line 36</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <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> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="entities_fnote_complement.js.html">entities/fnote_complement.js</a>, <a href="entities_fnote_complement.js.html#line13">line 13</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <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> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="entities_fnote_complement.js.html">entities/fnote_complement.js</a>, <a href="entities_fnote_complement.js.html#line16">line 16</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <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> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="entities_fnote_complement.js.html">entities/fnote_complement.js</a>, <a href="entities_fnote_complement.js.html#line19">line 19</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <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> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="entities_fnote_complement.js.html">entities/fnote_complement.js</a>, <a href="entities_fnote_complement.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_fnote_complement.js.html">entities/fnote_complement.js</a>, <a href="entities_fnote_complement.js.html#line7">line 7</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="entities_fnote_complement.js.html">entities/fnote_complement.js</a>, <a href="entities_fnote_complement.js.html#line25">line 25</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="entities_fnote_complement.js.html">entities/fnote_complement.js</a>, <a href="entities_fnote_complement.js.html#line28">line 28</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </article> |  | ||||||
|  |  | ||||||
| </section> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| </div> |  | ||||||
|  |  | ||||||
| <nav> |  | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FNoteComplement.html">FNoteComplement</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul> |  | ||||||
| </nav> |  | ||||||
|  |  | ||||||
| <br class="clear"> |  | ||||||
|  |  | ||||||
| <footer> |  | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> |  | ||||||
| </footer> |  | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> |  | ||||||
| <script src="scripts/linenumber.js"> </script> |  | ||||||
| </body> |  | ||||||
| </html> |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										95
									
								
								docs/frontend_api/entities_fattachment.js.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								docs/frontend_api/entities_fattachment.js.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,95 @@ | |||||||
|  | <!DOCTYPE html> | ||||||
|  | <html lang="en"> | ||||||
|  | <head> | ||||||
|  |     <meta charset="utf-8"> | ||||||
|  |     <title>JSDoc: Source: entities/fattachment.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/fattachment.js</h1> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <section> | ||||||
|  |         <article> | ||||||
|  |             <pre class="prettyprint source linenums"><code>class FAttachment { | ||||||
|  |     constructor(froca, row) { | ||||||
|  |         /** @type {Froca} */ | ||||||
|  |         this.froca = froca; | ||||||
|  |  | ||||||
|  |         this.update(row); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     update(row) { | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.attachmentId = row.attachmentId; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.ownerId = row.ownerId; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.role = row.role; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.mime = row.mime; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.title = row.title; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.dateModified = row.dateModified; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.utcDateModified = row.utcDateModified; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.utcDateScheduledForErasureSince = row.utcDateScheduledForErasureSince; | ||||||
|  |  | ||||||
|  |         /** @type {int} optionally added to the entity */ | ||||||
|  |         this.contentLength = row.contentLength; | ||||||
|  |  | ||||||
|  |         this.froca.attachments[this.attachmentId] = this; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @returns {FNote} */ | ||||||
|  |     getNote() { | ||||||
|  |         return this.froca.notes[this.ownerId]; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @return {FBlob} */ | ||||||
|  |     async getBlob() { | ||||||
|  |         return await this.froca.getBlob('attachments', this.attachmentId); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | export default FAttachment; | ||||||
|  | </code></pre> | ||||||
|  |         </article> | ||||||
|  |     </section> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | </div> | ||||||
|  |  | ||||||
|  | <nav> | ||||||
|  |     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul> | ||||||
|  | </nav> | ||||||
|  |  | ||||||
|  | <br class="clear"> | ||||||
|  |  | ||||||
|  | <footer> | ||||||
|  |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> | ||||||
|  | </footer> | ||||||
|  |  | ||||||
|  | <script> prettyPrint(); </script> | ||||||
|  | <script src="scripts/linenumber.js"> </script> | ||||||
|  | </body> | ||||||
|  | </html> | ||||||
| @@ -34,6 +34,7 @@ | |||||||
|  */ |  */ | ||||||
| class FAttribute { | class FAttribute { | ||||||
|     constructor(froca, row) { |     constructor(froca, row) { | ||||||
|  |         /** @type {Froca} */ | ||||||
|         this.froca = froca; |         this.froca = froca; | ||||||
|  |  | ||||||
|         this.update(row); |         this.update(row); | ||||||
| @@ -115,7 +116,7 @@ export default FAttribute; | |||||||
| </div> | </div> | ||||||
|  |  | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FNoteComplement.html">FNoteComplement</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul> |     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
| <html lang="en"> | <html lang="en"> | ||||||
| <head> | <head> | ||||||
|     <meta charset="utf-8"> |     <meta charset="utf-8"> | ||||||
|     <title>JSDoc: Source: entities/fnote_complement.js</title> |     <title>JSDoc: Source: entities/fblob.js</title> | ||||||
| 
 | 
 | ||||||
|     <script src="scripts/prettify/prettify.js"> </script> |     <script src="scripts/prettify/prettify.js"> </script> | ||||||
|     <script src="scripts/prettify/lang-css.js"> </script> |     <script src="scripts/prettify/lang-css.js"> </script> | ||||||
| @@ -17,7 +17,7 @@ | |||||||
| 
 | 
 | ||||||
| <div id="main"> | <div id="main"> | ||||||
| 
 | 
 | ||||||
|     <h1 class="page-title">Source: entities/fnote_complement.js</h1> |     <h1 class="page-title">Source: entities/fblob.js</h1> | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -26,46 +26,45 @@ | |||||||
|      |      | ||||||
|     <section> |     <section> | ||||||
|         <article> |         <article> | ||||||
|             <pre class="prettyprint source linenums"><code>/** |             <pre class="prettyprint source linenums"><code>export default class FBlob { | ||||||
|  * Complements the FNote with the main note content and other extra attributes |  | ||||||
|  */ |  | ||||||
| class FNoteComplement { |  | ||||||
|     constructor(row) { |     constructor(row) { | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
|         this.noteId = row.noteId; |         this.blobId = row.blobId; | ||||||
| 
 | 
 | ||||||
|         /** |         /** | ||||||
|          * 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} |          * @type {string} | ||||||
|          */ |          */ | ||||||
|         this.content = row.content; |         this.content = row.content; | ||||||
| 
 |  | ||||||
|         /** @type {int} */ |  | ||||||
|         this.contentLength = row.contentLength; |         this.contentLength = row.contentLength; | ||||||
| 
 | 
 | ||||||
|         /** @type {string} */ |  | ||||||
|         this.dateCreated = row.dateCreated; |  | ||||||
| 
 |  | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
|         this.dateModified = row.dateModified; |         this.dateModified = row.dateModified; | ||||||
| 
 |  | ||||||
|         /** @type {string} */ |  | ||||||
|         this.utcDateCreated = row.utcDateCreated; |  | ||||||
| 
 |  | ||||||
|         /** @type {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 |     /** | ||||||
|  |      * @returns {*} | ||||||
|  |      * @throws Error in case of invalid JSON */ | ||||||
|  |     getJsonContent() { | ||||||
|  |         if (!this.content || !this.content.trim()) { | ||||||
|  |             return null; | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         /** @type {string} */ |         return JSON.parse(this.content); | ||||||
|         this.combinedDateModified = row.combinedDateModified; |     } | ||||||
| 
 | 
 | ||||||
|         /** @type {string} */ |     /** @returns {*|null} valid object or null if the content cannot be parsed as JSON */ | ||||||
|         this.combinedUtcDateModified = row.combinedUtcDateModified; |     getJsonContentSafely() { | ||||||
|  |         try { | ||||||
|  |             return this.getJsonContent(); | ||||||
|  |         } | ||||||
|  |         catch (e) { | ||||||
|  |             return null; | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 |  | ||||||
| export default FNoteComplement; |  | ||||||
| </code></pre> | </code></pre> | ||||||
|         </article> |         </article> | ||||||
|     </section> |     </section> | ||||||
| @@ -76,7 +75,7 @@ export default FNoteComplement; | |||||||
| </div> | </div> | ||||||
| 
 | 
 | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FNoteComplement.html">FNoteComplement</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul> |     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
| 
 | 
 | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
| @@ -32,6 +32,7 @@ | |||||||
|  */ |  */ | ||||||
| class FBranch { | class FBranch { | ||||||
|     constructor(froca, row) { |     constructor(froca, row) { | ||||||
|  |         /** @type {Froca} */ | ||||||
|         this.froca = froca; |         this.froca = froca; | ||||||
|  |  | ||||||
|         this.update(row); |         this.update(row); | ||||||
| @@ -72,7 +73,7 @@ class FBranch { | |||||||
|         return this.froca.getNote(this.parentNoteId); |         return this.froca.getNote(this.parentNoteId); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @returns {boolean} true if it's top level, meaning its parent is root note */ |     /** @returns {boolean} true if it's top level, meaning its parent is the root note */ | ||||||
|     isTopLevel() { |     isTopLevel() { | ||||||
|         return this.parentNoteId === 'root'; |         return this.parentNoteId === 'root'; | ||||||
|     } |     } | ||||||
| @@ -99,7 +100,7 @@ export default FBranch; | |||||||
| </div> | </div> | ||||||
|  |  | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FNoteComplement.html">FNoteComplement</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul> |     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
| @@ -29,7 +29,6 @@ | |||||||
|             <pre class="prettyprint source linenums"><code>import server from '../services/server.js'; |             <pre class="prettyprint source linenums"><code>import server from '../services/server.js'; | ||||||
| import noteAttributeCache from "../services/note_attribute_cache.js"; | import noteAttributeCache from "../services/note_attribute_cache.js"; | ||||||
| import ws from "../services/ws.js"; | import ws from "../services/ws.js"; | ||||||
| import options from "../services/options.js"; |  | ||||||
| import froca from "../services/froca.js"; | import froca from "../services/froca.js"; | ||||||
| import protectedSessionHolder from "../services/protected_session_holder.js"; | import protectedSessionHolder from "../services/protected_session_holder.js"; | ||||||
| import cssClassManager from "../services/css_class_manager.js"; | import cssClassManager from "../services/css_class_manager.js"; | ||||||
| @@ -60,6 +59,7 @@ class FNote { | |||||||
|      * @param {Object.<string, Object>} row |      * @param {Object.<string, Object>} row | ||||||
|      */ |      */ | ||||||
|     constructor(froca, row) { |     constructor(froca, row) { | ||||||
|  |         /** @type {Froca} */ | ||||||
|         this.froca = froca; |         this.froca = froca; | ||||||
|  |  | ||||||
|         /** @type {string[]} */ |         /** @type {string[]} */ | ||||||
| @@ -79,6 +79,9 @@ class FNote { | |||||||
|         /** @type {Object.<string, string>} */ |         /** @type {Object.<string, string>} */ | ||||||
|         this.childToBranch = {}; |         this.childToBranch = {}; | ||||||
|  |  | ||||||
|  |         /** @type {FAttachment[]|null} */ | ||||||
|  |         this.attachments = null; // lazy loaded | ||||||
|  |  | ||||||
|         this.update(row); |         this.update(row); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -145,10 +148,9 @@ class FNote { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     async getContent() { |     async getContent() { | ||||||
|         // we're not caching content since these objects are in froca and as such pretty long-lived |         const blob = await this.getBlob(); | ||||||
|         const note = await server.get(`notes/${this.noteId}`); |  | ||||||
|  |  | ||||||
|         return note.content; |         return blob?.content; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     async getJsonContent() { |     async getJsonContent() { | ||||||
| @@ -220,7 +222,7 @@ class FNote { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     // 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 a note path | ||||||
|     sortParents() { |     sortParents() { | ||||||
|         this.parents.sort((aNoteId, bNoteId) => { |         this.parents.sort((aNoteId, bNoteId) => { | ||||||
|             const aBranchId = this.parentToBranch[aNoteId]; |             const aBranchId = this.parentToBranch[aNoteId]; | ||||||
| @@ -253,6 +255,51 @@ class FNote { | |||||||
|         return await this.froca.getNotes(this.children); |         return await this.froca.getNotes(this.children); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** @returns {Promise<FAttachment[]>} */ | ||||||
|  |     async getAttachments() { | ||||||
|  |         if (!this.attachments) { | ||||||
|  |             this.attachments = await this.froca.getAttachmentsForNote(this.noteId); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return this.attachments; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @returns {Promise<FAttachment[]>} */ | ||||||
|  |     async getAttachmentsByRole(role) { | ||||||
|  |         return (await this.getAttachments()) | ||||||
|  |             .filter(attachment => attachment.role === role); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @returns {Promise<FAttachment>} */ | ||||||
|  |     async getAttachmentById(attachmentId) { | ||||||
|  |         const attachments = await this.getAttachments(); | ||||||
|  |  | ||||||
|  |         return attachments.find(att => att.attachmentId === attachmentId); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     isEligibleForConversionToAttachment() { | ||||||
|  |         if (this.type !== 'image' || !this.isContentAvailable() || this.hasChildren() || this.getParentBranches().length !== 1) { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         const targetRelations = this.getTargetRelations().filter(relation => relation.name === 'imageLink'); | ||||||
|  |  | ||||||
|  |         if (targetRelations.length > 1) { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         const parentNote = this.getParentNotes()[0]; // at this point note can have only one parent | ||||||
|  |         const referencingNote = targetRelations[0]?.getNote(); | ||||||
|  |  | ||||||
|  |         if (referencingNote && referencingNote !== parentNote) { | ||||||
|  |             return false; | ||||||
|  |         } else if (parentNote.type !== 'text' || !parentNote.isContentAvailable()) { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return true; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @param {string} [type] - (optional) attribute type to filter |      * @param {string} [type] - (optional) attribute type to filter | ||||||
|      * @param {string} [name] - (optional) attribute name to filter |      * @param {string} [name] - (optional) attribute name to filter | ||||||
| @@ -343,13 +390,10 @@ class FNote { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         const parentNotes = this.getParentNotes().filter(note => note.type !== 'search'); |         const parentNotes = this.getParentNotes().filter(note => note.type !== 'search'); | ||||||
|         let notePaths = []; |  | ||||||
|  |  | ||||||
|         if (parentNotes.length === 1) { // optimization for most common case |         const notePaths = parentNotes.length === 1 | ||||||
|             notePaths = parentNotes[0].getAllNotePaths(); |             ? parentNotes[0].getAllNotePaths() // optimization for the most common case | ||||||
|         } else { |             : parentNotes.flatMap(parentNote => parentNote.getAllNotePaths()); | ||||||
|             notePaths = parentNotes.flatMap(parentNote => parentNote.getAllNotePaths()); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         for (const notePath of notePaths) { |         for (const notePath of notePaths) { | ||||||
|             notePath.push(this.noteId); |             notePath.push(this.noteId); | ||||||
| @@ -360,7 +404,7 @@ class FNote { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @param {string} [hoistedNoteId='root'] |      * @param {string} [hoistedNoteId='root'] | ||||||
|      * @return {Array<{isArchived: boolean, isInHoistedSubTree: boolean, notePath: Array<string>, isHidden: boolean}>} |      * @return {Array<{isArchived: boolean, isInHoistedSubTree: boolean, isSearch: boolean, notePath: Array<string>, isHidden: boolean}>} | ||||||
|      */ |      */ | ||||||
|     getSortedNotePathRecords(hoistedNoteId = 'root') { |     getSortedNotePathRecords(hoistedNoteId = 'root') { | ||||||
|         const isHoistedRoot = hoistedNoteId === 'root'; |         const isHoistedRoot = hoistedNoteId === 'root'; | ||||||
| @@ -369,6 +413,7 @@ class FNote { | |||||||
|             notePath: path, |             notePath: path, | ||||||
|             isInHoistedSubTree: isHoistedRoot || path.includes(hoistedNoteId), |             isInHoistedSubTree: isHoistedRoot || path.includes(hoistedNoteId), | ||||||
|             isArchived: path.some(noteId => froca.notes[noteId].isArchived), |             isArchived: path.some(noteId => froca.notes[noteId].isArchived), | ||||||
|  |             isSearch: path.find(noteId => froca.notes[noteId].type === 'search'), | ||||||
|             isHidden: path.includes('_hidden') |             isHidden: path.includes('_hidden') | ||||||
|         })); |         })); | ||||||
|  |  | ||||||
| @@ -379,6 +424,8 @@ class FNote { | |||||||
|                 return a.isArchived ? 1 : -1; |                 return a.isArchived ? 1 : -1; | ||||||
|             } else if (a.isHidden !== b.isHidden) { |             } else if (a.isHidden !== b.isHidden) { | ||||||
|                 return a.isHidden ? 1 : -1; |                 return a.isHidden ? 1 : -1; | ||||||
|  |             } else if (a.isSearch !== b.isSearch) { | ||||||
|  |                 return a.isSearch ? 1 : -1; | ||||||
|             } else { |             } else { | ||||||
|                 return a.notePath.length - b.notePath.length; |                 return a.notePath.length - b.notePath.length; | ||||||
|             } |             } | ||||||
| @@ -388,7 +435,7 @@ class FNote { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Returns note path considered to be the "best" |      * Returns the note path considered to be the "best" | ||||||
|      * |      * | ||||||
|      * @param {string} [hoistedNoteId='root'] |      * @param {string} [hoistedNoteId='root'] | ||||||
|      * @return {string[]} array of noteIds constituting the particular note path |      * @return {string[]} array of noteIds constituting the particular note path | ||||||
| @@ -398,7 +445,7 @@ class FNote { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Returns note path considered to be the "best" |      * Returns the note path considered to be the "best" | ||||||
|      * |      * | ||||||
|      * @param {string} [hoistedNoteId='root'] |      * @param {string} [hoistedNoteId='root'] | ||||||
|      * @return {string} serialized note path (e.g. 'root/a1h315/js725h') |      * @return {string} serialized note path (e.g. 'root/a1h315/js725h') | ||||||
| @@ -413,7 +460,9 @@ class FNote { | |||||||
|      * @return boolean - true if there's no non-hidden path, note is not cloned to the visible tree |      * @return boolean - true if there's no non-hidden path, note is not cloned to the visible tree | ||||||
|      */ |      */ | ||||||
|     isHiddenCompletely() { |     isHiddenCompletely() { | ||||||
|         if (this.noteId === 'root') { |         if (this.noteId === '_hidden') { | ||||||
|  |             return true; | ||||||
|  |         } else if (this.noteId === 'root') { | ||||||
|             return false; |             return false; | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -538,17 +587,10 @@ class FNote { | |||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (options.is("hideIncludedImages_main")) { |  | ||||||
|             const imageLinks = this.getRelations('imageLink'); |  | ||||||
|  |  | ||||||
|             // image is already visible in the parent note so no need to display it separately in the book |  | ||||||
|             childBranches = childBranches.filter(branch => !imageLinks.find(rel => rel.value === branch.noteId)); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         // we're not checking hideArchivedNotes since that would mean we need to lazy load the child notes |         // we're not checking hideArchivedNotes since that would mean we need to lazy load the child notes | ||||||
|         // which would seriously slow down everything. |         // which would seriously slow down everything. | ||||||
|         // we check this flag only once user chooses to expand the parent. This has the negative consequence that |         // we check this flag only once user chooses to expand the parent. This has the negative consequence that | ||||||
|         // note may appear as folder but not contain any children when all of them are archived |         // note may appear as a folder but not contain any children when all of them are archived | ||||||
|  |  | ||||||
|         return childBranches; |         return childBranches; | ||||||
|     } |     } | ||||||
| @@ -592,7 +634,7 @@ class FNote { | |||||||
|     /** |     /** | ||||||
|      * @param {string} type - attribute type (label, relation, etc.) |      * @param {string} type - attribute type (label, relation, etc.) | ||||||
|      * @param {string} name - attribute name |      * @param {string} name - attribute name | ||||||
|      * @returns {FAttribute} 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. |      * @returns {FAttribute} attribute of the given type and name. If there are more such attributes, first is returned. Returns null if there's no such attribute belonging to this note. | ||||||
|      */ |      */ | ||||||
|     getOwnedAttribute(type, name) { |     getOwnedAttribute(type, name) { | ||||||
|         const attributes = this.getOwnedAttributes(); |         const attributes = this.getOwnedAttributes(); | ||||||
| @@ -603,7 +645,7 @@ class FNote { | |||||||
|     /** |     /** | ||||||
|      * @param {string} type - attribute type (label, relation, etc.) |      * @param {string} type - attribute type (label, relation, etc.) | ||||||
|      * @param {string} name - attribute name |      * @param {string} name - attribute name | ||||||
|      * @returns {FAttribute} 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. |      * @returns {FAttribute} attribute of the given type and name. If there are more such attributes, first is returned. Returns null if there's no such attribute belonging to this note. | ||||||
|      */ |      */ | ||||||
|     getAttribute(type, name) { |     getAttribute(type, name) { | ||||||
|         const attributes = this.getAttributes(); |         const attributes = this.getAttributes(); | ||||||
| @@ -614,7 +656,7 @@ class FNote { | |||||||
|     /** |     /** | ||||||
|      * @param {string} type - attribute type (label, relation, etc.) |      * @param {string} type - attribute type (label, relation, etc.) | ||||||
|      * @param {string} name - attribute name |      * @param {string} name - attribute name | ||||||
|      * @returns {string} attribute value of given type and name or null if no such attribute exists. |      * @returns {string} attribute value of the given type and name or null if no such attribute exists. | ||||||
|      */ |      */ | ||||||
|     getOwnedAttributeValue(type, name) { |     getOwnedAttributeValue(type, name) { | ||||||
|         const attr = this.getOwnedAttribute(type, name); |         const attr = this.getOwnedAttribute(type, name); | ||||||
| @@ -625,7 +667,7 @@ class FNote { | |||||||
|     /** |     /** | ||||||
|      * @param {string} type - attribute type (label, relation, etc.) |      * @param {string} type - attribute type (label, relation, etc.) | ||||||
|      * @param {string} name - attribute name |      * @param {string} name - attribute name | ||||||
|      * @returns {string} attribute value of given type and name or null if no such attribute exists. |      * @returns {string} attribute value of the given type and name or null if no such attribute exists. | ||||||
|      */ |      */ | ||||||
|     getAttributeValue(type, name) { |     getAttributeValue(type, name) { | ||||||
|         const attr = this.getAttribute(type, name); |         const attr = this.getAttribute(type, name); | ||||||
| @@ -757,7 +799,7 @@ class FNote { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     getPromotedDefinitionAttributes() { |     getPromotedDefinitionAttributes() { | ||||||
|         if (this.hasLabel('hidePromotedAttributes')) { |         if (this.isLabelTruthy('hidePromotedAttributes')) { | ||||||
|             return []; |             return []; | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -769,7 +811,7 @@ class FNote { | |||||||
|                 return def && def.isPromoted; |                 return def && def.isPromoted; | ||||||
|             }); |             }); | ||||||
|  |  | ||||||
|         // attrs are not resorted if position changes after initial load |         // attrs are not resorted if position changes after the initial load | ||||||
|         promotedAttrs.sort((a, b) => { |         promotedAttrs.sort((a, b) => { | ||||||
|             if (a.noteId === b.noteId) { |             if (a.noteId === b.noteId) { | ||||||
|                 return a.position < b.position ? -1 : 1; |                 return a.position < b.position ? -1 : 1; | ||||||
| @@ -835,7 +877,7 @@ class FNote { | |||||||
|     /** |     /** | ||||||
|      * Get relations which target this note |      * Get relations which target this note | ||||||
|      * |      * | ||||||
|      * @returns {FNote[]} |      * @returns {Promise<FNote[]>} | ||||||
|      */ |      */ | ||||||
|     async getTargetRelationSourceNotes() { |     async getTargetRelationSourceNotes() { | ||||||
|         const targetRelations = this.getTargetRelations(); |         const targetRelations = this.getTargetRelations(); | ||||||
| @@ -844,12 +886,16 @@ class FNote { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Return note complement which is most importantly note's content |      * @deprecated use getBlob() instead | ||||||
|      * |      * @return {Promise<FBlob>} | ||||||
|      * @returns {Promise<FNoteComplement>} |  | ||||||
|      */ |      */ | ||||||
|     async getNoteComplement() { |     async getNoteComplement() { | ||||||
|         return await this.froca.getNoteComplement(this.noteId); |         return this.getBlob(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @return {Promise<FBlob>} */ | ||||||
|  |     async getBlob() { | ||||||
|  |         return await this.froca.getBlob('notes', this.noteId); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     toString() { |     toString() { | ||||||
| @@ -958,6 +1004,10 @@ class FNote { | |||||||
|     isOptions() { |     isOptions() { | ||||||
|         return this.noteId.startsWith("_options"); |         return this.noteId.startsWith("_options"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     async getMetadata() { | ||||||
|  |         return await server.get(`notes/${this.noteId}/metadata`); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| export default FNote; | export default FNote; | ||||||
| @@ -971,7 +1021,7 @@ export default FNote; | |||||||
| </div> | </div> | ||||||
|  |  | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FNoteComplement.html">FNoteComplement</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul> |     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|   | |||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user