mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	Compare commits
	
		
			1223 Commits
		
	
	
		
			v0.49.1-be
			...
			v0.59.2
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 63a70f2ffa | ||
|  | d8e9086bde | ||
|  | af4470ead1 | ||
|  | 7cda81ec68 | ||
|  | b1153f8d01 | ||
|  | 54e21bf249 | ||
|  | eebf329983 | ||
|  | 7b1d6c3937 | ||
|  | e6803e9a9b | ||
|  | 0b24011468 | ||
|  | 2699c995ee | ||
|  | 697f6ee2a9 | ||
|  | 35429f6a93 | ||
|  | 29eae4eeb6 | ||
|  | 8de67b6945 | ||
|  | 4f63284d41 | ||
|  | 0c806024fb | ||
|  | 9a08aa2ab5 | ||
|  | 02f218389b | ||
|  | 4cd54e5a9a | ||
|  | 6b4800d2d6 | ||
|  | f60e4a1355 | ||
|  | 03897c5c9d | ||
|  | ef90f1ff3f | ||
|  | 177a67f59b | ||
|  | 1e551581f8 | ||
|  | 62c2547557 | ||
|  | 2389ab30f8 | ||
|  | fdffc27bb6 | ||
|  | 540d19c67c | ||
|  | 46eebdc7aa | ||
|  | 700c6ffc75 | ||
|  | 6b013c05cc | ||
|  | f541bf186c | ||
|  | 9eb3075f65 | ||
|  | e2b8dfe96a | ||
|  | f883fde74a | ||
|  | ae6f2624a0 | ||
|  | ee2953a5e1 | ||
|  | ec8ed65feb | ||
|  | b70699ce1c | ||
|  | 44c0ecdbfa | ||
|  | 7be9db8b84 | ||
|  | 69d7684b0d | ||
|  | a88582c610 | ||
|  | 3fd0c01c05 | ||
|  | c16537aecf | ||
|  | 79f1eb6e5e | ||
|  | fc67dd4d0a | ||
|  | 232dad66d1 | ||
|  | ed30ec27e7 | ||
|  | eaab82551f | ||
|  | d343ff0d23 | ||
|  | 400b14e021 | ||
|  | 760c7b73ad | ||
|  | 97cadc3acf | ||
|  | 7d0117bd28 | ||
|  | 956682f2c7 | ||
|  | 4558e349b5 | ||
|  | 6f7b554cdc | ||
|  | 42e08284b0 | ||
|  | 127486fdf5 | ||
|  | 4ffe36e4d0 | ||
|  | 85403321cf | ||
|  | 22cea63863 | ||
|  | c95c5bb471 | ||
|  | cbabaa6b0c | ||
|  | 520ffecd36 | ||
|  | b1e2b5ba8e | ||
|  | 896a4fe981 | ||
|  | e9a2cacb5b | ||
|  | c190296bf9 | ||
|  | e411ad0eb1 | ||
|  | 17085e5578 | ||
|  | 33d6bb69c0 | ||
|  | 44629e6a0a | ||
|  | 78d61f157e | ||
|  | 3c0ba09a62 | ||
|  | e57d325bd6 | ||
|  | 260bc93a66 | ||
|  | a9296e2a39 | ||
|  | 8371703090 | ||
|  | fc7da015fe | ||
|  | adf222b5e8 | ||
|  | ade22ea825 | ||
|  | 2c8fb90ecb | ||
|  | c67644a2e3 | ||
|  | 346f6edd7e | ||
|  | 92f586486f | ||
|  | 15607becc6 | ||
|  | e7c6d912a4 | ||
|  | 290f7e2101 | ||
|  | 460b5fb3a4 | ||
|  | 88e09eb279 | ||
|  | 5e0fbea3b3 | ||
|  | 7b2c3afe4c | ||
|  | 2e181d0fb1 | ||
|  | 68a03211ce | ||
|  | 37ba76fdd8 | ||
|  | 78954268ab | ||
|  | b0528b62d8 | ||
|  | 2b4dfaef7f | ||
|  | ad887c4b12 | ||
|  | 63c62df787 | ||
|  | c68a67d148 | ||
|  | bd8568809f | ||
|  | 0bfb2631df | ||
|  | 3c57f08ef7 | ||
|  | a7b103e07a | ||
|  | 64e7150765 | ||
|  | a888f9aa04 | ||
|  | 2e9dbda077 | ||
|  | c474e65cae | ||
|  | f59e19d93b | ||
|  | 8a33645360 | ||
|  | 339d8a7378 | ||
|  | f2a19c56b1 | ||
|  | a98fd509c6 | ||
|  | a3149aecf4 | ||
|  | 6a6ae359b6 | ||
|  | 2fa1d812f6 | ||
|  | ef825371cf | ||
|  | b567775129 | ||
|  | 58d71bf8e3 | ||
|  | 9fd0b85ff2 | ||
|  | a5e21ea5f3 | ||
|  | 98620887d4 | ||
|  | 9eff08144c | ||
|  | 4ba72bc8d3 | ||
|  | f50a9c250a | ||
|  | 743979266a | ||
|  | 4f98c960ec | ||
|  | 424b624ea9 | ||
|  | a004a8b092 | ||
|  | df0f52aff9 | ||
|  | f7bd72ba2f | ||
|  | 038c0e78a6 | ||
|  | 2a2cbcd68b | ||
|  | be654e7a31 | ||
|  | 32bd74fe27 | ||
|  | 14da697a4e | ||
|  | 2525857c20 | ||
|  | c97ada3434 | ||
|  | c924790f3e | ||
|  | a110f24b05 | ||
|  | 8eaef3e1d8 | ||
|  | 082caf98e8 | ||
|  | 60602a2264 | ||
|  | 9479f1c1a1 | ||
|  | 88bc7402a2 | ||
|  | e7b3c3239b | ||
|  | 4f4c3ef3f3 | ||
|  | d7b0719788 | ||
|  | 7a457e4509 | ||
|  | decfeb366c | ||
|  | 420175f5ef | ||
|  | bdfdc0402d | ||
|  | bb8496cb3f | ||
|  | 4bdb94fbaa | ||
|  | 05c04a35a7 | ||
|  | 4385a02f6b | ||
|  | 397dd68666 | ||
|  | edbb60f2b5 | ||
|  | 5bf9c253f2 | ||
|  | b0cc177d84 | ||
|  | c60f25fb7c | ||
|  | 4ab90b694f | ||
|  | 87636f27ba | ||
|  | 571cb6d0eb | ||
|  | f738787202 | ||
|  | 4ae1b6e07b | ||
|  | 41b8f6882c | ||
|  | 43c5163f66 | ||
|  | 8a2a9b2ea6 | ||
|  | c70272e756 | ||
|  | 843f5d0da1 | ||
|  | 2242397280 | ||
|  | 8a641e1b4f | ||
|  | f86fb0d0a2 | ||
|  | a863da1dce | ||
|  | d7cae7d5bb | ||
|  | 19f4870280 | ||
|  | ac51d0d569 | ||
|  | 218f526a92 | ||
|  | 161b45aa12 | ||
|  | 397629587c | ||
|  | 034098fd06 | ||
|  | e03cc01e15 | ||
|  | 0995c56506 | ||
|  | 3a5fa2954d | ||
|  | 398480415e | ||
|  | 81013ed21a | ||
|  | 53360c147a | ||
|  | 9e47da3f03 | ||
|  | faefe10c15 | ||
|  | a4d3150a24 | ||
|  | e1f0676891 | ||
|  | 792ac9b77d | ||
|  | bbbd2f7e82 | ||
|  | d910191e83 | ||
|  | e8a9389e6d | ||
|  | 6dce13bc34 | ||
|  | 71cdea3902 | ||
|  | 85a6e8b47e | ||
|  | f02ad63e97 | ||
|  | 977399a73e | ||
|  | 5d4a2f2064 | ||
|  | c5ab6fa2fa | ||
|  | b80bf0ffb6 | ||
|  | bff7434921 | ||
|  | da161c7ce0 | ||
|  | 977a47bc27 | ||
|  | 957640f163 | ||
|  | 291ef87c9b | ||
|  | 115bf0af4d | ||
|  | e40f1fd11a | ||
|  | 797ddf6205 | ||
|  | ca4e1c19a7 | ||
|  | d2b906bc1b | ||
|  | 94dcaae12d | ||
|  | df47679c7f | ||
|  | d6f3b79f20 | ||
|  | c7556d9163 | ||
|  | 16c3833a36 | ||
|  | 007e45ad8c | ||
|  | b9b8b35342 | ||
|  | dd82b0f958 | ||
|  | f150c223bc | ||
|  | e76290e598 | ||
|  | 4f771cfa7a | ||
|  | aa3b26c965 | ||
|  | f4cf04232f | ||
|  | d36cf47974 | ||
|  | f809da58ec | ||
|  | ff1f01be8c | ||
|  | 0ddaa8f5c2 | ||
|  | 620bed73bb | ||
|  | c177d2b97b | ||
|  | 0758c82983 | ||
|  | ecc2ed7d73 | ||
|  | 4b779d7512 | ||
|  | 701911b766 | ||
|  | 5fea90491c | ||
|  | d665b7e584 | ||
|  | 7a8bbdced8 | ||
|  | affd8062e2 | ||
|  | 45b94ecaeb | ||
|  | acda37e334 | ||
|  | 2cfc43a4fd | ||
|  | fb789b7bd8 | ||
|  | b906efb23b | ||
|  | f249d6cb26 | ||
|  | afb6e860ea | ||
|  | 435e042ae9 | ||
|  | d64df5e3e7 | ||
|  | bd59802ca4 | ||
|  | 7c98ade72b | ||
|  | c6485f8e03 | ||
|  | a083917db1 | ||
|  | 3b5f2b86d5 | ||
|  | f08fbf7bca | ||
|  | e2b227df34 | ||
|  | 4c51588270 | ||
|  | b13ea72152 | ||
|  | 5a2907b670 | ||
|  | b6f7c604c7 | ||
|  | c5fb2cccd5 | ||
|  | 1d1e6ae782 | ||
|  | bff33932d9 | ||
|  | 392b89e6dd | ||
|  | 5ae0a5cf1e | ||
|  | 1a1fb126c1 | ||
|  | 5c4db266a4 | ||
|  | e5e0add1a2 | ||
|  | e1d20b8ff8 | ||
|  | c6a05d8853 | ||
|  | c34bccf7e8 | ||
|  | 0441e7396a | ||
|  | 698eb53006 | ||
|  | 3804d2df8c | ||
|  | 7147cc267e | ||
|  | 29713de6cd | ||
|  | 46f40ee534 | ||
|  | a882ad41c5 | ||
|  | 062e8c4b84 | ||
|  | 0f0ca51bd6 | ||
|  | af654a171f | ||
|  | 186e06bc01 | ||
|  | 4cc9bdf5e4 | ||
|  | e05e4bec32 | ||
|  | 5a3882f388 | ||
|  | 8ec2547b4a | ||
|  | 059c339c09 | ||
|  | 724f99f17c | ||
|  | 1b24276a4a | ||
|  | ea006993f6 | ||
|  | 7a46159539 | ||
|  | 50faa40bad | ||
|  | 9d9305300c | ||
|  | c89455f93f | ||
|  | 7c6d67f1ad | ||
|  | 8c4dda45ef | ||
|  | db5e76fe8c | ||
|  | 5413a1aa79 | ||
|  | e41104208a | ||
|  | 5fca606730 | ||
|  | 0de0b6fd06 | ||
|  | db6dbc7821 | ||
|  | e5171e434b | ||
|  | 2df7d99a91 | ||
|  | 6def541e78 | ||
|  | 5af506e268 | ||
|  | 967919b400 | ||
|  | 575f09d97f | ||
|  | c28383de4f | ||
|  | c496519095 | ||
|  | ecaa9a1d56 | ||
|  | d34a0a9fc0 | ||
|  | b202b43bf5 | ||
|  | 648dd73fa1 | ||
|  | 1640a8aa7d | ||
|  | 698a6bf91c | ||
|  | c409d7ff2a | ||
|  | f8dd175837 | ||
|  | 195c6a4089 | ||
|  | 6c431ae5ed | ||
|  | 8c01a77a7a | ||
|  | 239c68a33c | ||
|  | df3212c304 | ||
|  | 4026c2be4f | ||
|  | c6614bc85b | ||
|  | 31b3af4129 | ||
|  | c4b0c44919 | ||
|  | 223ca95829 | ||
|  | b9ae68d559 | ||
|  | e7470e31a0 | ||
|  | 1b6d0c9bbc | ||
|  | 75639c53f0 | ||
|  | 587387dd46 | ||
|  | ffb3c044fa | ||
|  | 921f75beba | ||
|  | f739259407 | ||
|  | 173b28062e | ||
|  | 4f51f73b89 | ||
|  | ca968a9e31 | ||
|  | 2957e1d78a | ||
|  | d1b989ac12 | ||
|  | e3047ee450 | ||
|  | f45478260e | ||
|  | 1bfd26ee8f | ||
|  | bbdb7375ff | ||
|  | 23322455a3 | ||
|  | c1d4d3fc8a | ||
|  | fc40e54261 | ||
|  | 87e833d373 | ||
|  | dcfa9c4c0b | ||
|  | c231b3cb79 | ||
|  | 1f468f81cc | ||
|  | 494f8d2153 | ||
|  | 0f822b2761 | ||
|  | 5ac332960e | ||
|  | dfb462cf35 | ||
|  | 342ae6e5e2 | ||
|  | eaf195e0c8 | ||
|  | 9460cfdc55 | ||
|  | c44bc60667 | ||
|  | 8d6801bb85 | ||
|  | c22b6b29e0 | ||
|  | 44997f5cd1 | ||
|  | 95f4195ca7 | ||
|  | 73eb585398 | ||
|  | 57d381b990 | ||
|  | e5ba6ff496 | ||
|  | 128023d34e | ||
|  | 653f80f7d8 | ||
|  | d06d4ba437 | ||
|  | 2a68bdb690 | ||
|  | 5f6a10ef22 | ||
|  | 2ad19ddd36 | ||
|  | 5fc9f5f3f9 | ||
|  | b9632a7814 | ||
|  | f336435adb | ||
|  | 9e83368f87 | ||
|  | d619a7a2d7 | ||
|  | 012fb1f50b | ||
|  | d64b575e60 | ||
|  | aec2c2d5cd | ||
|  | 0d06d5ccee | ||
|  | 74fdaad032 | ||
|  | d3bf0c1d8e | ||
|  | 27ce273d29 | ||
|  | cd60ad4267 | ||
|  | 56e01046c8 | ||
|  | 518a413de7 | ||
|  | 29923af17d | ||
|  | 99a5774148 | ||
|  | 46fdd15857 | ||
|  | 42cd333694 | ||
|  | aaa69f696b | ||
|  | 8ce9dcf4aa | ||
|  | 130ded91ff | ||
|  | 851465da62 | ||
|  | b85f335561 | ||
|  | 7b36709e18 | ||
|  | 0d50cdb0f5 | ||
|  | eec2ff043e | ||
|  | 0480f391d3 | ||
|  | 36c98e919a | ||
|  | 0e68e8069b | ||
|  | 7aa801fc1f | ||
|  | fc080f785b | ||
|  | 1a6c9be065 | ||
|  | b55c2d3dbc | ||
|  | 720fb0f73e | ||
|  | 0985314fb7 | ||
|  | e759b4846a | ||
|  | dacc2444c4 | ||
|  | 8ea3608bf1 | ||
|  | eecfce3cc9 | ||
|  | a402c79287 | ||
|  | a459230aa9 | ||
|  | e4f57ab2fe | ||
|  | 6a9ac6f90a | ||
|  | 6883b71ce7 | ||
|  | 70552d58ac | ||
|  | c7bda4d0be | ||
|  | e4e20c8007 | ||
|  | 2fbcd9aaf7 | ||
|  | ee667634ab | ||
|  | 7a8c69a6f9 | ||
|  | 723db97094 | ||
|  | 65be882b49 | ||
|  | 48765cc87d | ||
|  | e2f6191229 | ||
|  | 19126b7c6d | ||
|  | a76bef1a28 | ||
|  | a259bd8c3a | ||
|  | 4001953fd7 | ||
|  | 9a6df54832 | ||
|  | 29327bbc5d | ||
|  | bcb3a707f4 | ||
|  | 0a67af4f46 | ||
|  | b3c0b36ba6 | ||
|  | a3783b0113 | ||
|  | 059dca905c | ||
|  | 02d908df1e | ||
|  | 1a95e459eb | ||
|  | ae0c5a0c09 | ||
|  | 6f238f5f1a | ||
|  | 6cec8bcda8 | ||
|  | d388b4d814 | ||
|  | d9dac00a01 | ||
|  | 4961d9bb89 | ||
|  | 89e319c7a2 | ||
|  | f7e56cbffe | ||
|  | 3f115a7657 | ||
|  | 8fad8a1ce9 | ||
|  | 1b242a905b | ||
|  | c6e766f5c6 | ||
|  | 055bd77bd6 | ||
|  | 76f34e3eaf | ||
|  | acf3f5013c | ||
|  | 7f6edefad4 | ||
|  | 60fc621cd4 | ||
|  | bf4776a33c | ||
|  | 81a59f48e6 | ||
|  | 68eb04741d | ||
|  | 1037d814ec | ||
|  | e201f3536a | ||
|  | 3cb368c4de | ||
|  | df9f6ce33a | ||
|  | b3c87156c2 | ||
|  | d29a633529 | ||
|  | c92b451033 | ||
|  | 3122d0cc6b | ||
|  | f1eaa20e47 | ||
|  | 1d8b02055e | ||
|  | a7f4bf8289 | ||
|  | 8b0c60a046 | ||
|  | 3d4776f577 | ||
|  | 8a539dc514 | ||
|  | a707e7abf4 | ||
|  | 0fc9b2f203 | ||
|  | 9a4b72606d | ||
|  | 0a02e5be83 | ||
|  | 2467464433 | ||
|  | eb68ab6776 | ||
|  | 44b85d252d | ||
|  | 38d6fddc61 | ||
|  | 299007f66e | ||
|  | 47a92c8be8 | ||
|  | 9bc6cf7067 | ||
|  | 521d95021b | ||
|  | 5bc4d07aad | ||
|  | 51aa9a0d6e | ||
|  | 64d3ec940c | ||
|  | 6c37f2ce71 | ||
|  | 75bd38885b | ||
|  | b499640db8 | ||
|  | 999a9da299 | ||
|  | 441a59305b | ||
|  | b74f5a0a33 | ||
|  | 7d732eb73b | ||
|  | 44b68326a0 | ||
|  | d5732d7731 | ||
|  | 4e3d48fe7d | ||
|  | c7acfd4d4e | ||
|  | af6d738d56 | ||
|  | 06e6fec4ca | ||
|  | 12943cc808 | ||
|  | bbde7141b0 | ||
|  | f6ad1c6aa7 | ||
|  | c1127ec429 | ||
|  | 6ec734df13 | ||
|  | 867f7f3f59 | ||
|  | 1c52303bb3 | ||
|  | 876e6caa23 | ||
|  | 34f07b4376 | ||
|  | ffc28c8485 | ||
|  | 913e9ef6e0 | ||
|  | 14fb9c76b0 | ||
|  | c5435009d7 | ||
|  | 1d3132e447 | ||
|  | 63eb22c7ac | ||
|  | 657c54efd4 | ||
|  | 4f1f632a7d | ||
|  | 7e83d3a54d | ||
|  | c11cf41f30 | ||
|  | 8d30d5d689 | ||
|  | 01910d3231 | ||
|  | e22af42cd0 | ||
|  | 70c9292413 | ||
|  | c16f7a5e02 | ||
|  | b9c22fcbc8 | ||
|  | 4012ec7498 | ||
|  | 7d6d466284 | ||
|  | 36842f4a58 | ||
|  | dc62cf4805 | ||
|  | ed8acc7ee3 | ||
|  | 4116fe0a20 | ||
|  | a4e99662cb | ||
|  | c6d4eb486e | ||
|  | c2308b7a5d | ||
|  | 3e07c08043 | ||
|  | 5a3c50d9fb | ||
|  | 3e4a9f63fa | ||
|  | 6d4ef4ee3d | ||
|  | 20ff5627d8 | ||
|  | 1d26fd6bf0 | ||
|  | a9c0daa51a | ||
|  | e3b2bbdca5 | ||
|  | d905f7cc26 | ||
|  | fe3f24cdb0 | ||
|  | 971c709e87 | ||
|  | 7f78937543 | ||
|  | 41dac2bd1b | ||
|  | 85bf2a5706 | ||
|  | ce7937a3a3 | ||
|  | 7bb9d33245 | ||
|  | 1be89c094b | ||
|  | 73ad557784 | ||
|  | 9f744153e3 | ||
|  | 0c196ae3a5 | ||
|  | 15ed381f85 | ||
|  | 180051d252 | ||
|  | a19c58703f | ||
|  | fc43d9222a | ||
|  | af6bf08243 | ||
|  | fb6a0bc2a6 | ||
|  | 1f61c1b3b6 | ||
|  | fc69f3b8f3 | ||
|  | d4658b9c2a | ||
|  | 84f72edf1d | ||
|  | 552d872047 | ||
|  | 47235965d5 | ||
|  | 24e4455e91 | ||
|  | ea35b0c800 | ||
|  | 1a30087426 | ||
|  | 5e9d004ca2 | ||
|  | 513d1c020c | ||
|  | 05231bd1c2 | ||
|  | b816773d02 | ||
|  | 3c49ea6cb1 | ||
|  | 539eac4be7 | ||
|  | 8a6ead6d86 | ||
|  | 01a7ed8311 | ||
|  | cf6330dee6 | ||
|  | 6c39b6f548 | ||
|  | e7ef1b86cc | ||
|  | 3663d56917 | ||
|  | 135064a18f | ||
|  | 7233f58767 | ||
|  | 78238381a7 | ||
|  | ca03c41205 | ||
|  | 9b8474a728 | ||
|  | ecfce409d8 | ||
|  | b091e2222e | ||
|  | e8b8198eb8 | ||
|  | 261f1f0bf2 | ||
|  | 8588ed5eec | ||
|  | f161488c13 | ||
|  | 563808144e | ||
|  | 3c1f826ead | ||
|  | b2a63afc28 | ||
|  | 86d3a695ac | ||
|  | 7f566178d3 | ||
|  | 4af55d055e | ||
|  | be000be960 | ||
|  | afb6180cce | ||
|  | d63156a0d6 | ||
|  | 2556cd5aaa | ||
|  | 7109a12afd | ||
|  | 700e9fd912 | ||
|  | 6547b66228 | ||
|  | e9090b9154 | ||
|  | 5b73fe949e | ||
|  | 35fab7a23c | ||
|  | bf6d79f4ad | ||
|  | 24286c2a6c | ||
|  | 09641d9465 | ||
|  | e70a7bad1a | ||
|  | d386966342 | ||
|  | 09cfaeb9c4 | ||
|  | 934b1ad8c6 | ||
|  | 80dcb45415 | ||
|  | ad8b7f67b1 | ||
|  | 67b8f3206c | ||
|  | b965f77f4a | ||
|  | 84fc00465e | ||
|  | 9b0c8a19f9 | ||
|  | 8e7d26bf4f | ||
|  | df351a8d09 | ||
|  | 9ce0421ae7 | ||
|  | c85ec957ec | ||
|  | e93dd176c0 | ||
|  | 10676a8d0c | ||
|  | 8abcf571e8 | ||
|  | 78bca2477d | ||
|  | f241bc564c | ||
|  | 65942213de | ||
|  | 28f620d51d | ||
|  | aebdbdf8be | ||
|  | bb3734052a | ||
|  | 9a691c8227 | ||
|  | 3bd2732cee | ||
|  | ddb57e35f3 | ||
|  | d1f3ce0957 | ||
|  | d73da33b08 | ||
|  | 201ef7fcd5 | ||
|  | 5705efc998 | ||
|  | 2694bcff67 | ||
|  | df7c089344 | ||
|  | 6dee1f38f7 | ||
|  | 87e2f50c6d | ||
|  | 616e2c1c29 | ||
|  | 2335e40262 | ||
|  | 3a07c5fcc0 | ||
|  | 3c26e00fe1 | ||
|  | fc920becac | ||
|  | 8d608c3c1c | ||
|  | 08aa65bddb | ||
|  | 54900b35dc | ||
|  | 7696702a2a | ||
|  | 42cade17cb | ||
|  | 7565458332 | ||
|  | b86dbc088d | ||
|  | 0681ec9057 | ||
|  | 912f79f1af | ||
|  | 82c596d1e3 | ||
|  | b6f1611218 | ||
|  | 869c910801 | ||
|  | b3097b59c7 | ||
|  | 5ec359e929 | ||
|  | ffd73c0e57 | ||
|  | 12af3d05f0 | ||
|  | 30b2d15f3d | ||
|  | 23c06ebed8 | ||
|  | 8acd3851b0 | ||
|  | 1f6222a653 | ||
|  | 8a39699acd | ||
|  | dff2d3e989 | ||
|  | 53affed8d3 | ||
|  | a316ac5b35 | ||
|  | aed0a8126c | ||
|  | edff1be16d | ||
|  | 0beee408cf | ||
|  | e5fdd5128a | ||
|  | 46deceedc9 | ||
|  | 3ebfaec1bc | ||
|  | 4c93334d90 | ||
|  | 7c90f1a56d | ||
|  | c727a2bc1b | ||
|  | 6c43b92bf1 | ||
|  | ef6b7a85d5 | ||
|  | 6d990de450 | ||
|  | 91bc9eec93 | ||
|  | 698ffd886d | ||
|  | 5a37547b37 | ||
|  | 80887fd3c1 | ||
|  | 5444cc2009 | ||
|  | b8a89ee52a | ||
|  | bed0db9fa0 | ||
|  | 1afa32502f | ||
|  | d825a1a45a | ||
|  | 0e41f9d1bc | ||
|  | 0f92468ab2 | ||
|  | f890e9917f | ||
|  | 8902cb3117 | ||
|  | 61a0397963 | ||
|  | 8f5983fa01 | ||
|  | fb1b6ea34a | ||
|  | cce55eee63 | ||
|  | 20975fc635 | ||
|  | e42c527a19 | ||
|  | 500946c10b | ||
|  | f3662d1048 | ||
|  | 82d71797a7 | ||
|  | e82fa5ee82 | ||
|  | 3e7aa3d762 | ||
|  | 57c5b6d61f | ||
|  | e6358afb62 | ||
|  | 4ca59dcc5c | ||
|  | 9114b1befb | ||
|  | 52812c27a1 | ||
|  | 377922eccf | ||
|  | 0d2a112839 | ||
|  | ea20d23d11 | ||
|  | 1dfc37704f | ||
|  | 27261683bb | ||
|  | 1e5c18f6ff | ||
|  | 5cbcf6e6be | ||
|  | 0c4e5d2a19 | ||
|  | 570fabdc4a | ||
|  | 89a4165c77 | ||
|  | 1ad406ced5 | ||
|  | 7cdc181b47 | ||
|  | af16a5856a | ||
|  | ea3bce25d9 | ||
|  | 9b4ef6ea5e | ||
|  | c2c724aa00 | ||
|  | 95bbf5f405 | ||
|  | 12b3302687 | ||
|  | c575d47f0e | ||
|  | 02affece91 | ||
|  | 2f1a7e2093 | ||
|  | 4fc686bbbc | ||
|  | d1a763feef | ||
|  | 6972ae889a | ||
|  | 19c65e240e | ||
|  | ef49d20470 | ||
|  | 0d4275a260 | ||
|  | dbf1ac1e9d | ||
|  | e7db262559 | ||
|  | 3faae63b84 | ||
|  | 94867e07df | ||
|  | 33c272e86a | ||
|  | aa4dade1e5 | ||
|  | 7435cd4dc6 | ||
|  | 194ae41d19 | ||
|  | 42e262a1c2 | ||
|  | ae46b3df58 | ||
|  | e51276f532 | ||
|  | 2e1bef2df7 | ||
|  | 6b3077df0e | ||
|  | 1434effa22 | ||
|  | 67e69f1940 | ||
|  | 046db503d3 | ||
|  | 9827e30a61 | ||
|  | e21a1b56fa | ||
|  | 08e12e7349 | ||
|  | 5ed1631a35 | ||
|  | 8ac776f305 | ||
|  | 981fac8e50 | ||
|  | 8bb8ab96f1 | ||
|  | 0b0d1b59b9 | ||
|  | 57609a5952 | ||
|  | 4f86d769be | ||
|  | 6cb5144c09 | ||
|  | aee350b07b | ||
|  | 5ca7e39852 | ||
|  | 540aba39db | ||
|  | 9a8e677baf | ||
|  | c5bc23d511 | ||
|  | 7ac8dc6785 | ||
|  | 049261a8ee | ||
|  | 1d037d3f0f | ||
|  | b45df29937 | ||
|  | ec087ed328 | ||
|  | 9707094686 | ||
|  | eb8e5eafb6 | ||
|  | e140daa952 | ||
|  | 3255607b09 | ||
|  | 36c210d0dd | ||
|  | 595e16cc6f | ||
|  | 40bbe380d3 | ||
|  | 683b4ac73a | ||
|  | e0ad256194 | ||
|  | 0468ca6814 | ||
|  | 6ebf7ae94e | ||
|  | 5ccaf8b3b9 | ||
|  | 0e01c19414 | ||
|  | 1347d3fcc2 | ||
|  | ebd715ca1b | ||
|  | 73574ac890 | ||
|  | ca44edd48c | ||
|  | 312ffc110a | ||
|  | bc87bf12cf | ||
|  | 11412a258b | ||
|  | bc35efd565 | ||
|  | 416a723160 | ||
|  | 10322c5d0f | ||
|  | 7775d90b9a | ||
|  | fac9fef652 | ||
|  | f0ab1fb5a1 | ||
|  | f86fb129b6 | ||
|  | 63cabb13b6 | ||
|  | d3ee0aa8a8 | ||
|  | 6256bcde2d | ||
|  | df3fdb59c5 | ||
|  | 4cec856e21 | ||
|  | 8a43688a65 | ||
|  | 7edcd5d746 | ||
|  | ec6d93b34f | ||
|  | 0c6efb0cb7 | ||
|  | f8fd8e47a9 | ||
|  | 566111ce82 | ||
|  | 7ba619c71d | ||
|  | b678d87c80 | ||
|  | 4aaa0f8d8c | ||
|  | 1bfc5fb77f | ||
|  | 63f0e441b9 | ||
|  | 041b4ea442 | ||
|  | 2115b76047 | ||
|  | 117db9f1cc | ||
|  | b530bc548f | ||
|  | 8e23c15763 | ||
|  | 23e9bcfdc5 | ||
|  | 96c4934c00 | ||
|  | 31fb02f810 | ||
|  | 5fdb462ed5 | ||
|  | 7d76fb8bf5 | ||
|  | 0f7fa7a7b7 | ||
|  | e206d9cc68 | ||
|  | 2d33f570f4 | ||
|  | 15f8173add | ||
|  | 51bbc23270 | ||
|  | 7609bc78ec | ||
|  | b4ac41eff8 | ||
|  | f9bee7cd4e | ||
|  | f272238dde | ||
|  | 433003cf38 | ||
|  | 773cefe21d | ||
|  | 88fa51a34e | ||
|  | 4211d0feda | ||
|  | de1c76ee3c | ||
|  | ec4fac421b | ||
|  | f587e0dfd9 | ||
|  | b5214e6cea | ||
|  | 5fbaed61c1 | ||
|  | 9ce3e7e7d2 | ||
|  | e1cd09df36 | ||
|  | 27b55eb3ee | ||
|  | 8fcc76ad6d | ||
|  | ab0f0c5ced | ||
|  | 4837dd050b | ||
|  | c0c38a4b49 | ||
|  | 15a9ff4450 | ||
|  | 0a4f419e5e | ||
|  | 7fa531b3d6 | ||
|  | 3cfca27b54 | ||
|  | 93f0596b16 | ||
|  | b204014a11 | ||
|  | 98b579524c | ||
|  | 88586b0f25 | ||
|  | 103aa95ccf | ||
|  | 339a6d7817 | ||
|  | f252badba6 | ||
|  | fe27c80078 | ||
|  | 8052574950 | ||
|  | f19adf3ee0 | ||
|  | dcf31f8f95 | ||
|  | 93dd9274e7 | ||
|  | cce3f9a700 | ||
|  | 01155ad535 | ||
|  | ee217d6306 | ||
|  | ca35527aeb | ||
|  | 388dcadef3 | ||
|  | 8905148dbc | ||
|  | daa36192cc | ||
|  | ade77e5fb8 | ||
|  | f250b72563 | ||
|  | 37cb5f5e9a | ||
|  | 82fcc97ed2 | ||
|  | 53e9c8cdac | ||
|  | 541d451168 | ||
|  | 7c64dc9440 | ||
|  | 27570a7756 | ||
|  | d6931f7441 | ||
|  | 7d39d080f5 | ||
|  | 13ccd2ba67 | ||
|  | 81fd7397e4 | ||
|  | 6f75f944a3 | ||
|  | 308b0f7464 | ||
|  | 678e883044 | ||
|  | 819cf0907d | ||
|  | 942f17b2f4 | ||
|  | 2085dc5ed4 | ||
|  | a1d1b4580a | ||
|  | 9e089cc7cd | ||
|  | cd622cbdd7 | ||
|  | 4978a3ff1a | ||
|  | fca0b82610 | ||
|  | 6cef1082b2 | ||
|  | 37eb16b2f3 | ||
|  | c24c807921 | ||
|  | 5bc629d1c7 | ||
|  | 04379b4e1f | ||
|  | c51e6107a1 | ||
|  | bb7ad496bf | ||
|  | c50d8e85dc | ||
|  | 1d8664927d | ||
|  | dbb5d02ecf | ||
|  | 593a275795 | ||
|  | 6778e1e60e | ||
|  | 36308c307b | ||
|  | 078fc420b0 | ||
|  | 8ec814c29f | ||
|  | e87e065100 | ||
|  | 8318ab7ac0 | ||
|  | 87b75a9a22 | ||
|  | 8df3b0a5bd | ||
|  | 6906c82408 | ||
|  | 45edef2d71 | ||
|  | bf49648896 | ||
|  | 91d23c540a | ||
|  | 1cbf918024 | ||
|  | 26f3c1d453 | ||
|  | c421ee79b0 | ||
|  | 77f8474d83 | ||
|  | 9a04a76672 | ||
|  | 963c18b8e4 | ||
|  | bbbad67764 | ||
|  | 3491e71084 | ||
|  | c85f70e197 | ||
|  | 3df712b64f | ||
|  | 160bd0a790 | ||
|  | 81e0c6dcc2 | ||
|  | 11bd48a1b5 | ||
|  | 61657087f5 | ||
|  | 87f436c6ea | ||
|  | 065e4f55c3 | ||
|  | 92adcf82e4 | ||
|  | 06e0f2418c | ||
|  | 35c4c61d15 | ||
|  | a168edb168 | ||
|  | d2975bbd21 | ||
|  | 358e8c548c | ||
|  | f85ed672cc | ||
|  | 83f1a68bfd | ||
|  | 552e5d7d06 | ||
|  | 9c7f8cf5d8 | ||
|  | f0f9274a3c | ||
|  | 65c725c21e | ||
|  | dfa30358c5 | ||
|  | 2394fe6ed9 | ||
|  | 6cae68288d | ||
|  | 83afb89a16 | ||
|  | 93cc6b12ec | ||
|  | dc35df9f63 | ||
|  | 1a4bc0b989 | ||
|  | a37d75a08f | ||
|  | 8d510a3fdd | ||
|  | 7bcd1c3009 | ||
|  | 5dab189815 | ||
|  | a9dc62505d | ||
|  | 26e1ff4e16 | ||
|  | b3763eed61 | ||
|  | f9c01851ef | ||
|  | 6b61b0604a | ||
|  | f705c432fd | ||
|  | 70edd9a210 | ||
|  | 0a45b58784 | ||
|  | dbd312c88d | ||
|  | 11578b1bc3 | ||
|  | 569c80f551 | ||
|  | 3b58b83f8b | ||
|  | 643a5e5b16 | ||
|  | 4e4010e15e | ||
|  | 6bdaf050c5 | ||
|  | 05c8c6cfaa | ||
|  | 2441515666 | ||
|  | c42bcd6c59 | ||
|  | fc95bb8f18 | ||
|  | cb88f316db | ||
|  | e19ddc10d3 | ||
|  | d3e86acfaa | ||
|  | 536643ed3b | ||
|  | 9771b441ad | ||
|  | c295fdb142 | ||
|  | ee7aa3d3da | ||
|  | e437a9d70f | ||
|  | a8655fcd27 | ||
|  | aefc9f1593 | ||
|  | 73671671d7 | ||
|  | f53a93e828 | ||
|  | e156c6292b | ||
|  | e365521d5e | ||
|  | f354821f25 | ||
|  | 82e278a2a2 | ||
|  | b4d4606c73 | ||
|  | b14b7b6ad1 | ||
|  | 32aa7bb540 | ||
|  | 300f4ad357 | ||
|  | cf6b5c3b6e | ||
|  | f1c9dda366 | ||
|  | 7f01032b6d | ||
|  | f08afd4723 | ||
|  | afe2a03aef | ||
|  | 272bb136d8 | ||
|  | 27d0388d79 | ||
|  | 025032de42 | ||
|  | 15a3b42124 | ||
|  | 4266156cee | ||
|  | 45a66ab694 | ||
|  | 49f4ce7149 | ||
|  | 220df662ad | ||
|  | 6e535bac05 | ||
|  | 3b1dcc7199 | ||
|  | ae75ac424f | ||
|  | 5c46fe792d | ||
|  | a33b0f1e1c | ||
|  | bd28ed07d7 | ||
|  | 12185fbd32 | ||
|  | 24911da8db | ||
|  | da84d16421 | ||
|  | 53666cbfe8 | ||
|  | 8897d98bd9 | ||
|  | 93e485cea9 | ||
|  | 22363f5b74 | ||
|  | 2a2c82cd29 | ||
|  | 5ebe717da8 | ||
|  | 2f2d8327e4 | ||
|  | a894c19c2b | ||
|  | 0469962c5e | ||
|  | f6ebc76917 | ||
|  | 73425ec29d | ||
|  | 51e5f591b2 | ||
|  | d1b3d8a58a | ||
|  | 534c71491b | ||
|  | 987f8e9961 | ||
|  | a45cf033aa | ||
|  | 06b6097f29 | ||
|  | 75c8e700d4 | ||
|  | c1092c97b5 | ||
|  | a04becc4ec | ||
|  | f7d6bda49d | ||
|  | b250f0a3bf | ||
|  | df1d94ec61 | ||
|  | e00fcd93a1 | ||
|  | 0a95d0f6f5 | ||
|  | 569b8898ef | ||
|  | 102bfcebd0 | ||
|  | 091d6a1cf1 | ||
|  | 228564f843 | ||
|  | 17dd6141fb | ||
|  | 2f57d55bea | ||
|  | 0cd690d980 | ||
|  | 316a2aee1a | ||
|  | 77ce56ba84 | ||
|  | eba824a5b1 | ||
|  | c9e72f8fb9 | ||
|  | 4dd3fd9674 | ||
|  | 1690a55f7d | ||
|  | dd29fc26e3 | ||
|  | 67b5921d6c | ||
|  | 1b7bcc5cc1 | ||
|  | ea56bb772a | ||
|  | 9f33791922 | ||
|  | d940590add | ||
|  | a009b4cb6d | ||
|  | 781be527ce | ||
|  | f7e5d8f62d | ||
|  | d6c0fc734f | ||
|  | db79b5ff53 | ||
|  | 18d439dd44 | ||
|  | d2d2a6c086 | ||
|  | 5260689b8e | ||
|  | 78a2863b78 | ||
|  | 5481375347 | ||
|  | 4da2d2f516 | ||
|  | 23de8e881d | ||
|  | 59e8720866 | ||
|  | 67cce5f817 | ||
|  | 9924727729 | ||
|  | 6c9fc364a3 | ||
|  | 40598d2663 | ||
|  | 1aeb674733 | ||
|  | 832cac106e | ||
|  | 23daaa2387 | ||
|  | d6016f9b81 | ||
|  | 1dfde76b95 | ||
|  | 83f8fac088 | ||
|  | 0ca9bff61b | ||
|  | df91192b97 | ||
|  | 97fd550402 | ||
|  | eb579de199 | ||
|  | 5f2984aa57 | ||
|  | 98a79f6475 | ||
|  | c09da2b7eb | ||
|  | 600f74576d | ||
|  | a21c49cba7 | ||
|  | 91e3dd022a | ||
|  | 478eca47f4 | ||
|  | 1c4358086d | ||
|  | 0917fc8be1 | ||
|  | 6833959f3b | ||
|  | 398376108d | ||
|  | 61aa029582 | ||
|  | 46eaa63625 | ||
|  | 1b54596c5e | ||
|  | 2feb778d8d | ||
|  | 2075e89239 | ||
|  | be44431fde | ||
|  | 99cc4078c6 | ||
|  | b8b6b38a20 | ||
|  | efd8556129 | ||
|  | b10a76f150 | ||
|  | 780b520506 | ||
|  | 3055ed86ec | ||
|  | 4fc3305080 | ||
|  | d1b39ee8fa | ||
|  | 52b118df7f | ||
|  | a97a7cdcdd | ||
|  | 1aff3db81f | ||
|  | fc89e098b1 | ||
|  | 64172a7f6b | ||
|  | 66a6c76552 | ||
|  | c8884f1917 | ||
|  | 4933b901f6 | ||
|  | b679f4218d | ||
|  | 77c6c4617b | ||
|  | 8240a208dd | ||
|  | 1c34f73f61 | ||
|  | a5444fd6ad | ||
|  | 6fbd5a77e4 | ||
|  | c102089731 | ||
|  | 742ec44f55 | ||
|  | 7495777d97 | ||
|  | da4f26d7ce | ||
|  | fa2ffd7574 | ||
|  | d4325db207 | ||
|  | 48d93cb3da | ||
|  | 2248d98cc7 | ||
|  | ce046b2e20 | ||
|  | 4f4cbccf08 | ||
|  | 412c745e53 | ||
|  | 28df5d4aa2 | ||
|  | 42e85aefdc | ||
|  | 91e78998d1 | ||
|  | 6f406f9aa2 | ||
|  | 86fa80f3eb | ||
|  | 7119d08022 | ||
|  | 916ff5f2ee | ||
|  | 913d2c06f3 | ||
|  | cbb5b31f72 | ||
|  | 91dec23d5e | ||
|  | d04d356429 | ||
|  | be59f248e8 | ||
|  | 2d2641dbd7 | ||
|  | 96f4230bc1 | ||
|  | 1995b54770 | ||
|  | 7159b13c9d | ||
|  | f2732bcab7 | ||
|  | 0e9d76890b | ||
|  | 9df521109b | ||
|  | 75b65c396e | ||
|  | d4d48f3834 | ||
|  | b90ba3d1a9 | ||
|  | c448d34a38 | ||
|  | c33bc7e12c | ||
|  | c5366abf75 | ||
|  | 2532ea525d | ||
|  | d74371c9f5 | ||
|  | 9ee1c9f3da | ||
|  | 82ba0d5b1d | ||
|  | 590eea1183 | ||
|  | e6f3cc7988 | ||
|  | 7a650c605c | ||
|  | dfa7c64b1f | ||
|  | 82b2871a08 | ||
|  | e3114e0602 | ||
|  | e8acf3f9f3 | ||
|  | 2b10023055 | ||
|  | e25a904a84 | ||
|  | dcba6ad70d | ||
|  | ffdd917717 | ||
|  | 168645cce9 | ||
|  | f4c81ecefb | ||
|  | 5a85fe92aa | ||
|  | feffd57f24 | ||
|  | faf81ae056 | ||
|  | 003fec4b11 | ||
|  | 5ecb603e86 | ||
|  | 1fed71a92e | ||
|  | dad82ea4e8 | ||
|  | a38ccde8bc | ||
|  | 8120f1bf25 | ||
|  | 067251861d | ||
|  | 6bc8773d5f | ||
|  | f92016f9ec | ||
|  | 4e31af8c84 | ||
|  | 7e48d214ca | ||
|  | a910034c96 | ||
|  | 257cc66f62 | ||
|  | 00f24bdb63 | ||
|  | fada3fe623 | ||
|  | d97e454463 | ||
|  | 3128a7d62f | ||
|  | b8fe9a41db | ||
|  | 8366a94bde | ||
|  | f56123b864 | ||
|  | ae951bfe23 | ||
|  | 265401775b | 
							
								
								
									
										8
									
								
								.github/ISSUE_TEMPLATE/bug_report.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/ISSUE_TEMPLATE/bug_report.yml
									
									
									
									
										vendored
									
									
								
							| @@ -7,7 +7,7 @@ body: | |||||||
|   attributes: |   attributes: | ||||||
|     label: Trilium Version |     label: Trilium Version | ||||||
|     description: What version of Trilium are you using? |     description: What version of Trilium are you using? | ||||||
|     placeholder: 0.48.0-beta |     placeholder: 0.57.0-beta | ||||||
|   validations: |   validations: | ||||||
|     required: true |     required: true | ||||||
| - type: dropdown | - type: dropdown | ||||||
| @@ -44,3 +44,9 @@ body: | |||||||
|     description: A clear and concise description of the bug and any additional information. |     description: A clear and concise description of the bug and any additional information. | ||||||
|   validations: |   validations: | ||||||
|     required: true |     required: true | ||||||
|  | - type: textarea | ||||||
|  |   attributes: | ||||||
|  |     label: Error logs | ||||||
|  |     description: Please provide error logs, see [wiki page](https://github.com/zadam/trilium/wiki/Error-logs) for instructions on how to submit them. | ||||||
|  |   validations: | ||||||
|  |     required: false | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -9,3 +9,6 @@ config.ini | |||||||
| cert.key | cert.key | ||||||
| cert.crt | cert.crt | ||||||
| server-package.json | server-package.json | ||||||
|  | .idea/httpRequests/ | ||||||
|  | data/ | ||||||
|  | tmp/ | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ image: | |||||||
|   file: .gitpod.dockerfile |   file: .gitpod.dockerfile | ||||||
|  |  | ||||||
| tasks: | tasks: | ||||||
|     - before: nvm install 16.13.1 && nvm use 16.13.1 |     - before: nvm install 16.19.1 && nvm use 16.19.1 | ||||||
|       init: npm install |       init: npm install | ||||||
|       command: npm run start-server |       command: npm run start-server | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										15
									
								
								.idea/git_toolbox_prj.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								.idea/git_toolbox_prj.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <project version="4"> | ||||||
|  |   <component name="GitToolBoxProjectSettings"> | ||||||
|  |     <option name="commitMessageIssueKeyValidationOverride"> | ||||||
|  |       <BoolValueOverride> | ||||||
|  |         <option name="enabled" value="true" /> | ||||||
|  |       </BoolValueOverride> | ||||||
|  |     </option> | ||||||
|  |     <option name="commitMessageValidationEnabledOverride"> | ||||||
|  |       <BoolValueOverride> | ||||||
|  |         <option name="enabled" value="true" /> | ||||||
|  |       </BoolValueOverride> | ||||||
|  |     </option> | ||||||
|  |   </component> | ||||||
|  | </project> | ||||||
							
								
								
									
										2
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							| @@ -3,7 +3,7 @@ | |||||||
|   <component name="JavaScriptSettings"> |   <component name="JavaScriptSettings"> | ||||||
|     <option name="languageLevel" value="ES6" /> |     <option name="languageLevel" value="ES6" /> | ||||||
|   </component> |   </component> | ||||||
|   <component name="ProjectRootManager" version="2" languageLevel="JDK_16" project-jdk-name="openjdk-16" project-jdk-type="JavaSDK"> |   <component name="ProjectRootManager" version="2" languageLevel="JDK_16" default="true" project-jdk-name="openjdk-16" project-jdk-type="JavaSDK"> | ||||||
|     <output url="file://$PROJECT_DIR$/out" /> |     <output url="file://$PROJECT_DIR$/out" /> | ||||||
|   </component> |   </component> | ||||||
| </project> | </project> | ||||||
							
								
								
									
										3
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							| @@ -9,7 +9,8 @@ | |||||||
|                 "<node_internals>/**" |                 "<node_internals>/**" | ||||||
|             ], |             ], | ||||||
|             "env": { |             "env": { | ||||||
|                 "TRILIUM_ENV": "dev" |                 "TRILIUM_ENV": "dev", | ||||||
|  |                 "TRILIUM_DATA_DIR": "./data" | ||||||
|             }, |             }, | ||||||
|             "outputCapture": "std", |             "outputCapture": "std", | ||||||
|             "program": "${workspaceFolder}/src/www" |             "program": "${workspaceFolder}/src/www" | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								CODE_OF_CONDUCT
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								CODE_OF_CONDUCT
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | Please treat each other with respect and understanding. | ||||||
							
								
								
									
										27
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								Dockerfile
									
									
									
									
									
								
							| @@ -1,8 +1,12 @@ | |||||||
| FROM node:16.13.1-alpine | # !!! Don't try to build this Dockerfile directly, run it through bin/build-docker.sh script !!! | ||||||
|  | FROM node:16.19.1-alpine | ||||||
|  |  | ||||||
| # Create app directory | # Create app directory | ||||||
| WORKDIR /usr/src/app | WORKDIR /usr/src/app | ||||||
|  |  | ||||||
|  | # Bundle app source | ||||||
|  | COPY . . | ||||||
|  |  | ||||||
| COPY server-package.json package.json | COPY server-package.json package.json | ||||||
|  |  | ||||||
| # Install app dependencies | # Install app dependencies | ||||||
| @@ -17,13 +21,22 @@ RUN set -x \ | |||||||
|         nasm \ |         nasm \ | ||||||
|         libpng-dev \ |         libpng-dev \ | ||||||
|         python3 \ |         python3 \ | ||||||
|     && npm install --production \ |     && npm install \ | ||||||
|     && apk del .build-dependencies |     && apk del .build-dependencies \ | ||||||
|  |     && npm run webpack \ | ||||||
|  |     && npm prune --omit=dev \ | ||||||
|  |     && cp src/public/app/share.js src/public/app-dist/. \ | ||||||
|  |     && cp -r src/public/app/doc_notes src/public/app-dist/. \ | ||||||
|  |     && rm -rf src/public/app | ||||||
|  |  | ||||||
| # Bundle app source | # Some setup tools need to be kept | ||||||
| COPY . . | RUN apk add --no-cache su-exec shadow | ||||||
|  |  | ||||||
| USER node | # Add application user and setup proper volume permissions | ||||||
|  | RUN adduser -s /bin/false node; exit 0 | ||||||
|  |  | ||||||
|  | # Start the application | ||||||
| EXPOSE 8080 | EXPOSE 8080 | ||||||
| CMD [ "node", "./src/www" ] | CMD [ "./start-docker.sh" ] | ||||||
|  |  | ||||||
|  | HEALTHCHECK --start-period=10s CMD exec su-exec node node docker_healthcheck.js | ||||||
|   | |||||||
| @@ -1,43 +1,55 @@ | |||||||
| # Trilium笔记 | # Trilium Notes | ||||||
|  |  | ||||||
| [English](https://github.com/zadam/trilium/blob/master/README.md) | [Chinese](https://github.com/zadam/trilium/blob/master/README-ZH_CN.md) | [Russian](https://github.com/zadam/trilium/blob/master/README.ru.md) | [English](https://github.com/zadam/trilium/blob/master/README.md) | [Chinese](https://github.com/zadam/trilium/blob/master/README-ZH_CN.md) | [Russian](https://github.com/zadam/trilium/blob/master/README.ru.md) | ||||||
|  |  | ||||||
| [](https://gitter.im/trilium-notes/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | [](https://gitter.im/trilium-notes/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||||||
| Trilium Notes是一个分层的笔记应用程序,专注于建立大型个人知识库。请参阅[屏幕截图](https://github.com/zadam/trilium/wiki/Screenshot-tour)以快速了解: | Trilium Notes 是一个层次化的笔记应用程序,专注于建立大型个人知识库。请参阅[屏幕截图](https://github.com/zadam/trilium/wiki/Screenshot-tour)以快速了解: | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | Ukraine is currently suffering from Russian aggression, please consider donating to [one of these charities](https://old.reddit.com/r/ukraine/comments/s6g5un/want_to_support_ukraine_heres_a_list_of_charities/). | ||||||
|  |  | ||||||
|  | <img src="https://upload.wikimedia.org/wikipedia/commons/4/49/Flag_of_Ukraine.svg" alt="drawing" width="600"/> | ||||||
|  | <img src="https://signmyrocket.com//uploads/2b2a523cd0c0e76cdbba95a89a9636b2_1676971281.jpg" alt="Trilium Notes supports Ukraine!" width="600"/> | ||||||
|  |  | ||||||
| ## 特性 | ## 特性 | ||||||
|  |  | ||||||
| * 笔记可以排列成任意深的树。单个笔记可以放在树中的多个位置(请参阅[克隆](https://github.com/zadam/trilium/wiki/Cloning-notes)) | * 笔记可以排列成任意深的树。单个笔记可以放在树中的多个位置(请参阅[克隆](https://github.com/zadam/trilium/wiki/Cloning-notes)) | ||||||
| * 丰富的所见即所得笔记编辑功能,包括带有markdown[自动格式化功能的](https://github.com/zadam/trilium/wiki/Text-notes#autoformat)表格,图像和[数学](https://github.com/zadam/trilium/wiki/Text-notes#math-support) | * 丰富的所见即所得笔记编辑功能,包括带有 Markdown [自动格式化功能的](https://github.com/zadam/trilium/wiki/Text-notes#autoformat)表格,图像和[数学](https://github.com/zadam/trilium/wiki/Text-notes#math-support) | ||||||
| * 支持编辑[使用源代码的笔记](https://github.com/zadam/trilium/wiki/Code-notes),包括语法高亮显示 | * 支持编辑[使用源代码的笔记](https://github.com/zadam/trilium/wiki/Code-notes),包括语法高亮显示 | ||||||
| * 笔记之间快速[导航](https://github.com/zadam/trilium/wiki/Note-navigation),全文搜索和[笔记挂起](https://github.com/zadam/trilium/wiki/Note-hoisting) | * 笔记之间快速[导航](https://github.com/zadam/trilium/wiki/Note-navigation),全文搜索和[笔记聚焦](https://github.com/zadam/trilium/wiki/Note-hoisting) | ||||||
| * 无缝[笔记版本控制](https://github.com/zadam/trilium/wiki/Note-revisions) | * 无缝[笔记版本控制](https://github.com/zadam/trilium/wiki/Note-revisions) | ||||||
| * 笔记[属性](https://github.com/zadam/trilium/wiki/Attributes)可用于笔记组织,查询和高级[脚本编写](https://github.com/zadam/trilium/wiki/Scripts) | * 笔记[属性](https://github.com/zadam/trilium/wiki/Attributes)可用于笔记组织,查询和高级[脚本编写](https://github.com/zadam/trilium/wiki/Scripts) | ||||||
| * [同步](https://github.com/zadam/trilium/wiki/Synchronization)与自托管同步服务器 | * [同步](https://github.com/zadam/trilium/wiki/Synchronization)与自托管同步服务器 | ||||||
|  |   * 有一个[第三方提供的同步服务器托管服务](https://trilium.cc/paid-hosting) | ||||||
|  | * 公开地[分享](https://github.com/zadam/trilium/wiki/Sharing)(发布)笔记到互联网 | ||||||
| * 具有按笔记粒度的强大的[笔记加密](https://github.com/zadam/trilium/wiki/Protected-notes) | * 具有按笔记粒度的强大的[笔记加密](https://github.com/zadam/trilium/wiki/Protected-notes) | ||||||
|  | * 使用自带的 Excalidraw 来绘制图表(笔记类型“画布”) | ||||||
| * [关系图](https://github.com/zadam/trilium/wiki/Relation-map)和[链接图](https://github.com/zadam/trilium/wiki/Link-map),用于可视化笔记及其关系 | * [关系图](https://github.com/zadam/trilium/wiki/Relation-map)和[链接图](https://github.com/zadam/trilium/wiki/Link-map),用于可视化笔记及其关系 | ||||||
| * [脚本](https://github.com/zadam/trilium/wiki/Scripts)-请参阅[高级展示](https://github.com/zadam/trilium/wiki/Advanced-showcases) | * [脚本](https://github.com/zadam/trilium/wiki/Scripts) - 请参阅[高级功能展示](https://github.com/zadam/trilium/wiki/Advanced-showcases) | ||||||
| * 可用性和性能均能很好地扩展至超过10万个笔记 | * 在拥有超过 10 万条笔记时仍能保持良好的可用性和性能 | ||||||
| * 针对智能手机和平板电脑进行触摸优化的[移动前端](https://github.com/zadam/trilium/wiki/Mobile-frontend) | * 针对智能手机和平板电脑进行优化的[用于移动设备的前端](https://github.com/zadam/trilium/wiki/Mobile-frontend) | ||||||
| * [夜间主题](https://github.com/zadam/trilium/wiki/Themes) | * [夜间主题](https://github.com/zadam/trilium/wiki/Themes) | ||||||
| * [Evernote](https://github.com/zadam/trilium/wiki/Evernote-import)和[Markdown导入导出](https://github.com/zadam/trilium/wiki/Markdown) | * [Evernote](https://github.com/zadam/trilium/wiki/Evernote-import) 和 [Markdown 导入导出](https://github.com/zadam/trilium/wiki/Markdown)功能 | ||||||
| * [Web Clipper](https://github.com/zadam/trilium/wiki/Web-clipper)可轻松保存Web内容 | * 使用[网页剪藏](https://github.com/zadam/trilium/wiki/Web-clipper)轻松保存互联网上的内容 | ||||||
|  |  | ||||||
| ## 构建 | ## 构建 | ||||||
|  |  | ||||||
| Trilium是作为桌面应用程序(Linux和Windows)或服务器上托管的Web应用程序(Linux)提供的。Mac OS桌面版本可用,但[不受支持](https://github.com/zadam/trilium/wiki/FAQ#mac-os-support)。 | Trilium 可以用作桌面应用程序(Linux 和 Windows)或服务器(Linux)上托管的 Web 应用程序。虽然有 macOS 版本的桌面应用程序,但它[不受支持](https://github.com/zadam/trilium/wiki/FAQ#mac-os-support)。 | ||||||
|  |  | ||||||
| * 如果要在桌面上使用Trilium,请从[最新版本](https://github.com/zadam/trilium/releases/latest)下载适用于您平台的二进制[版本](https://github.com/zadam/trilium/releases/latest),解压缩该软件包并运行`trilium`可执行文件。 | * 如果要在桌面上使用 Trilium,请从[最新版本](https://github.com/zadam/trilium/releases/latest)下载适用于您平台的二进制版本,解压缩该软件包并运行`trilium`可执行文件。 | ||||||
| * 如果要在服务器上安装Trilium,请遵循[此页面](https://github.com/zadam/trilium/wiki/Server-installation)。 | * 如果要在服务器上安装 Trilium,请参考[此页面](https://github.com/zadam/trilium/wiki/Server-installation)。 | ||||||
|     * 当前仅支持(经过测试)最新的Chrome和Firefox浏览器。 |   * 当前仅支持(测试过)最近发布的 Chrome 和 Firefox 浏览器。 | ||||||
|  |  | ||||||
|  | Trilium 也提供 Flatpak: | ||||||
|  |  | ||||||
|  | [<img width="240" src="https://flathub.org/assets/badges/flathub-badge-en.png">](https://flathub.org/apps/details/com.github.zadam.trilium) | ||||||
|  |  | ||||||
| ## 文档 | ## 文档 | ||||||
|  |  | ||||||
| [有关文档页面的完整列表,请参见 Wiki。](https://github.com/zadam/trilium/wiki/) | [有关文档页面的完整列表,请参见 Wiki。](https://github.com/zadam/trilium/wiki/) | ||||||
|  |  | ||||||
| [中文Wiki在这里](https://github.com/baddate/trilium/wiki/) | * [Wiki 的中文翻译版本](https://github.com/baddate/trilium/wiki/) | ||||||
|  |  | ||||||
| 您还可以阅读[个人知识库模式](https://github.com/zadam/trilium/wiki/Patterns-of-personal-knowledge-base),以获取有关如何使用 Trilium 的灵感。 | 您还可以阅读[个人知识库模式](https://github.com/zadam/trilium/wiki/Patterns-of-personal-knowledge-base),以获取有关如何使用 Trilium 的灵感。 | ||||||
|  |  | ||||||
| @@ -47,7 +59,7 @@ Trilium是作为桌面应用程序(Linux和Windows)或服务器上托管的W | |||||||
|  |  | ||||||
| [](https://gitpod.io/#https://github.com/zadam/trilium) | [](https://gitpod.io/#https://github.com/zadam/trilium) | ||||||
|  |  | ||||||
| 或在本地克隆并运行 | 或者克隆本仓库到本地,并运行 | ||||||
|  |  | ||||||
| ``` | ``` | ||||||
| npm install | npm install | ||||||
| @@ -56,7 +68,15 @@ npm run start-server | |||||||
|  |  | ||||||
| ## 致谢 | ## 致谢 | ||||||
|  |  | ||||||
| * [CKEditor 5](https://github.com/ckeditor/ckeditor5) - 市场上最好的所见即所得编辑器,互动性强且聆听能力强的团队 | * [CKEditor 5](https://github.com/ckeditor/ckeditor5) - 市面上最好的所见即所得编辑器,拥有互动性强且聆听能力强的团队 | ||||||
| * [FancyTree](https://github.com/mar10/fancytree) - 一个非常丰富的关于树的库,强大的没有对手。没有它,Trilium Notes将不会如此。 | * [FancyTree](https://github.com/mar10/fancytree) - 一个非常丰富的关于树的库,强大到没有对手。没有它,Trilium Notes 将不会如此。 | ||||||
| * [CodeMirror](https://github.com/codemirror/CodeMirror) - 支持大量语言的代码编辑器 | * [CodeMirror](https://github.com/codemirror/CodeMirror) - 支持大量语言的代码编辑器 | ||||||
| * [jsPlumb](https://github.com/jsplumb/jsplumb)强大的可视化连接库。- 用于[关系图](https://github.com/zadam/trilium/wiki/Relation-map)和[链接图](https://github.com/zadam/trilium/wiki/Link-map) | * [jsPlumb](https://github.com/jsplumb/jsplumb) - 强大的可视化连接库。用于[关系图](https://github.com/zadam/trilium/wiki/Relation-map)和[链接图](https://github.com/zadam/trilium/wiki/Link-map) | ||||||
|  |  | ||||||
|  | ## 捐赠 | ||||||
|  |  | ||||||
|  | 你可以通过 GitHub Sponsors,[PayPal](https://paypal.me/za4am) 或者比特币 (bitcoin:bc1qv3svjn40v89mnkre5vyvs2xw6y8phaltl385d2) 来捐赠。 | ||||||
|  |  | ||||||
|  | ## 许可证 | ||||||
|  |  | ||||||
|  | 本程序是自由软件:你可以再发布本软件和/或修改本软件,只要你遵循 Free Software Foundation 发布的 GNU Affero General Public License 的第三版或者任何(由你选择)更晚的版本。 | ||||||
|   | |||||||
							
								
								
									
										38
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,13 +1,19 @@ | |||||||
| # Trilium Notes | # Trilium Notes | ||||||
|  |  | ||||||
| [English](https://github.com/zadam/trilium/blob/master/README.md) | [Chinese](https://github.com/zadam/trilium/blob/master/README-ZH_CN.md) | [Russian](https://github.com/zadam/trilium/blob/master/README.ru.md) | [](https://gitter.im/trilium-notes/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [English](https://github.com/zadam/trilium/blob/master/README.md) | [Chinese](https://github.com/zadam/trilium/blob/master/README-ZH_CN.md) | [Russian](https://github.com/zadam/trilium/blob/master/README.ru.md) | ||||||
|  |  | ||||||
| [](https://gitter.im/trilium-notes/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |  | ||||||
| Trilium Notes is a hierarchical note taking application with focus on building large personal knowledge bases. See [screenshots](https://github.com/zadam/trilium/wiki/Screenshot-tour) for quick overview: | Trilium Notes is a hierarchical note taking application with focus on building large personal knowledge bases. See [screenshots](https://github.com/zadam/trilium/wiki/Screenshot-tour) for quick overview: | ||||||
|  |  | ||||||
|  | <a href="https://github.com/zadam/trilium/wiki/Screenshot-tour"><img src="https://raw.githubusercontent.com/wiki/zadam/trilium/images/screenshot.png" alt="Trilium Screenshot" width="1000"></a> | ||||||
|  |  | ||||||
| ## Features | Ukraine is currently defending itself from Russian aggression, please consider [donating to Ukrainian Army or humanitarian charities](https://standforukraine.com/). | ||||||
|  |  | ||||||
|  | <p float="left"> | ||||||
|  |   <img src="https://upload.wikimedia.org/wikipedia/commons/4/49/Flag_of_Ukraine.svg" alt="drawing" width="400"/> | ||||||
|  |   <img src="https://signmyrocket.com//uploads/2b2a523cd0c0e76cdbba95a89a9636b2_1676971281.jpg" alt="Trilium Notes supports Ukraine!" width="570"/> | ||||||
|  | </p> | ||||||
|  |  | ||||||
|  | ## 🎁 Features | ||||||
|  |  | ||||||
| * Notes can be arranged into arbitrarily deep tree. Single note can be placed into multiple places in the tree (see [cloning](https://github.com/zadam/trilium/wiki/Cloning-notes)) | * Notes can be arranged into arbitrarily deep tree. Single note can be placed into multiple places in the tree (see [cloning](https://github.com/zadam/trilium/wiki/Cloning-notes)) | ||||||
| * Rich WYSIWYG note editing including e.g. tables, images and [math](https://github.com/zadam/trilium/wiki/Text-notes#math-support) with markdown [autoformat](https://github.com/zadam/trilium/wiki/Text-notes#autoformat) | * Rich WYSIWYG note editing including e.g. tables, images and [math](https://github.com/zadam/trilium/wiki/Text-notes#math-support) with markdown [autoformat](https://github.com/zadam/trilium/wiki/Text-notes#autoformat) | ||||||
| @@ -16,16 +22,22 @@ Trilium Notes is a hierarchical note taking application with focus on building l | |||||||
| * Seamless [note versioning](https://github.com/zadam/trilium/wiki/Note-revisions) | * Seamless [note versioning](https://github.com/zadam/trilium/wiki/Note-revisions) | ||||||
| * Note [attributes](https://github.com/zadam/trilium/wiki/Attributes) can be used for note organization, querying and advanced [scripting](https://github.com/zadam/trilium/wiki/Scripts) | * Note [attributes](https://github.com/zadam/trilium/wiki/Attributes) can be used for note organization, querying and advanced [scripting](https://github.com/zadam/trilium/wiki/Scripts) | ||||||
| * [Synchronization](https://github.com/zadam/trilium/wiki/Synchronization) with self-hosted sync server | * [Synchronization](https://github.com/zadam/trilium/wiki/Synchronization) with self-hosted sync server | ||||||
|  |   * there's a [3rd party service for hosting synchronisation server](https://trilium.cc/paid-hosting) | ||||||
|  | * [Sharing](https://github.com/zadam/trilium/wiki/Sharing) (publishing) notes to public internet | ||||||
| * Strong [note encryption](https://github.com/zadam/trilium/wiki/Protected-notes) with per-note granularity | * Strong [note encryption](https://github.com/zadam/trilium/wiki/Protected-notes) with per-note granularity | ||||||
|  | * Sketching diagrams with built-in Excalidraw (note type "canvas") | ||||||
| * [Relation maps](https://github.com/zadam/trilium/wiki/Relation-map) and [link maps](https://github.com/zadam/trilium/wiki/Link-map) for visualizing notes and their relations | * [Relation maps](https://github.com/zadam/trilium/wiki/Relation-map) and [link maps](https://github.com/zadam/trilium/wiki/Link-map) for visualizing notes and their relations | ||||||
| * [Scripting](https://github.com/zadam/trilium/wiki/Scripts) - see [Advanced showcases](https://github.com/zadam/trilium/wiki/Advanced-showcases) | * [Scripting](https://github.com/zadam/trilium/wiki/Scripts) - see [Advanced showcases](https://github.com/zadam/trilium/wiki/Advanced-showcases) | ||||||
|  | * [REST API](https://github.com/zadam/trilium/wiki/ETAPI) for automation | ||||||
| * Scales well in both usability and performance upwards of 100 000 notes | * Scales well in both usability and performance upwards of 100 000 notes | ||||||
| * Touch optimized [mobile frontend](https://github.com/zadam/trilium/wiki/Mobile-frontend) for smartphones and tablets | * Touch optimized [mobile frontend](https://github.com/zadam/trilium/wiki/Mobile-frontend) for smartphones and tablets | ||||||
| * [Night theme](https://github.com/zadam/trilium/wiki/Themes) | * [Night theme](https://github.com/zadam/trilium/wiki/Themes) | ||||||
| * [Evernote](https://github.com/zadam/trilium/wiki/Evernote-import) and [Markdown import & export](https://github.com/zadam/trilium/wiki/Markdown) | * [Evernote](https://github.com/zadam/trilium/wiki/Evernote-import) and [Markdown import & export](https://github.com/zadam/trilium/wiki/Markdown) | ||||||
| * [Web Clipper](https://github.com/zadam/trilium/wiki/Web-clipper) for easy saving of web content | * [Web Clipper](https://github.com/zadam/trilium/wiki/Web-clipper) for easy saving of web content | ||||||
|  |  | ||||||
| ## Builds | Check out [awesome-trilium](https://github.com/Nriver/awesome-trilium) for 3rd party themes, scripts, plugins and more. | ||||||
|  |  | ||||||
|  | ## 🏗 Builds | ||||||
|  |  | ||||||
| Trilium is provided as either desktop application (Linux and Windows) or web application hosted on your server (Linux). Mac OS desktop build is available, but it is [unsupported](https://github.com/zadam/trilium/wiki/FAQ#mac-os-support). | Trilium is provided as either desktop application (Linux and Windows) or web application hosted on your server (Linux). Mac OS desktop build is available, but it is [unsupported](https://github.com/zadam/trilium/wiki/FAQ#mac-os-support). | ||||||
|  |  | ||||||
| @@ -33,13 +45,17 @@ Trilium is provided as either desktop application (Linux and Windows) or web app | |||||||
| * If you want to install Trilium on server, follow [this page](https://github.com/zadam/trilium/wiki/Server-installation). | * If you want to install Trilium on server, follow [this page](https://github.com/zadam/trilium/wiki/Server-installation). | ||||||
|   * Currently only recent Chrome and Firefox are supported (tested) browsers. |   * Currently only recent Chrome and Firefox are supported (tested) browsers. | ||||||
|  |  | ||||||
| ## Documentation | Trilium is also provided as a Flatpak: | ||||||
|  |  | ||||||
|  | [<img width="240" src="https://flathub.org/assets/badges/flathub-badge-en.png">](https://flathub.org/apps/details/com.github.zadam.trilium) | ||||||
|  |  | ||||||
|  | ## 📝 Documentation | ||||||
|  |  | ||||||
| [See wiki for complete list of documentation pages.](https://github.com/zadam/trilium/wiki/) | [See wiki for complete list of documentation pages.](https://github.com/zadam/trilium/wiki/) | ||||||
|  |  | ||||||
| You can also read [Patterns of personal knowledge base](https://github.com/zadam/trilium/wiki/Patterns-of-personal-knowledge-base) to get some inspiration on how you might use Trilium. | You can also read [Patterns of personal knowledge base](https://github.com/zadam/trilium/wiki/Patterns-of-personal-knowledge-base) to get some inspiration on how you might use Trilium. | ||||||
|  |  | ||||||
| ## Contribute | ## 💻 Contribute | ||||||
|  |  | ||||||
| Use a browser based dev environment | Use a browser based dev environment | ||||||
|  |  | ||||||
| @@ -51,13 +67,17 @@ npm install | |||||||
| npm run start-server | npm run start-server | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| ## Shoutouts | ## 📢 Shoutouts | ||||||
|  |  | ||||||
| * [CKEditor 5](https://github.com/ckeditor/ckeditor5) - best WYSIWYG editor on the market, very interactive and listening team | * [CKEditor 5](https://github.com/ckeditor/ckeditor5) - best WYSIWYG editor on the market, very interactive and listening team | ||||||
| * [FancyTree](https://github.com/mar10/fancytree) - very feature rich tree library without real competition. Trilium Notes would not be the same without it. | * [FancyTree](https://github.com/mar10/fancytree) - very feature rich tree library without real competition. Trilium Notes would not be the same without it. | ||||||
| * [CodeMirror](https://github.com/codemirror/CodeMirror) - code editor with support for huge amount of languages | * [CodeMirror](https://github.com/codemirror/CodeMirror) - code editor with support for huge amount of languages | ||||||
| * [jsPlumb](https://github.com/jsplumb/jsplumb) - visual connectivity library without competition. Used in [relation maps](https://github.com/zadam/trilium/wiki/Relation-map) and [link maps](https://github.com/zadam/trilium/wiki/Link-map) | * [jsPlumb](https://github.com/jsplumb/jsplumb) - visual connectivity library without competition. Used in [relation maps](https://github.com/zadam/trilium/wiki/Relation-map) and [link maps](https://github.com/zadam/trilium/wiki/Link-map) | ||||||
|  |  | ||||||
| ## License | ## 🤝 Support | ||||||
|  |  | ||||||
|  | You can support Trilum using GitHub Sponsors, [PayPal](https://paypal.me/za4am) or Bitcoin (bitcoin:bc1qv3svjn40v89mnkre5vyvs2xw6y8phaltl385d2). | ||||||
|  |  | ||||||
|  | ## 🔑 License | ||||||
|  |  | ||||||
| This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||||||
|   | |||||||
| @@ -7,6 +7,11 @@ Trilium Notes – это приложение для заметок с иера | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | Ukraine is currently suffering from Russian aggression, please consider donating to [one of these charities](https://old.reddit.com/r/ukraine/comments/s6g5un/want_to_support_ukraine_heres_a_list_of_charities/). | ||||||
|  |  | ||||||
|  | <img src="https://upload.wikimedia.org/wikipedia/commons/4/49/Flag_of_Ukraine.svg" alt="drawing" width="600"/> | ||||||
|  | <img src="https://signmyrocket.com//uploads/2b2a523cd0c0e76cdbba95a89a9636b2_1676971281.jpg" alt="Trilium Notes supports Ukraine!" width="600"/> | ||||||
|  |  | ||||||
| ## Возможности | ## Возможности | ||||||
|  |  | ||||||
| * Заметки можно расположить в виде дерева произвольной глубины. Отдельную заметку можно разместить в нескольких местах дерева (см. [клонирование](https://github.com/zadam/trilium/wiki/Cloning-notes)) | * Заметки можно расположить в виде дерева произвольной глубины. Отдельную заметку можно разместить в нескольких местах дерева (см. [клонирование](https://github.com/zadam/trilium/wiki/Cloning-notes)) | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								TODO
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								TODO
									
									
									
									
									
								
							| @@ -1,3 +0,0 @@ | |||||||
| - new icon |  | ||||||
| - polish becca entities API |  | ||||||
| - separate private and public APIs in becca entities |  | ||||||
| @@ -27,6 +27,11 @@ cp images/app-icons/png/128x128.png $BUILD_DIR/icon.png | |||||||
| # removing software WebGL binaries because they are pretty huge and not necessary | # removing software WebGL binaries because they are pretty huge and not necessary | ||||||
| rm -r $BUILD_DIR/swiftshader | rm -r $BUILD_DIR/swiftshader | ||||||
|  |  | ||||||
|  | cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | ||||||
|  |  | ||||||
|  | cp -r dump-db $BUILD_DIR/ | ||||||
|  | rm -rf $BUILD_DIR/dump-db/node_modules | ||||||
|  |  | ||||||
| cp bin/tpl/trilium-portable.sh $BUILD_DIR/ | cp bin/tpl/trilium-portable.sh $BUILD_DIR/ | ||||||
| chmod 755 $BUILD_DIR/trilium-portable.sh | chmod 755 $BUILD_DIR/trilium-portable.sh | ||||||
|  |  | ||||||
|   | |||||||
| @@ -23,6 +23,11 @@ rm -rf $BUILD_DIR | |||||||
| # Mac build has by default useless directory level | # Mac build has by default useless directory level | ||||||
| mv "./dist/Trilium Notes-darwin-x64" $BUILD_DIR | mv "./dist/Trilium Notes-darwin-x64" $BUILD_DIR | ||||||
|  |  | ||||||
|  | cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | ||||||
|  |  | ||||||
|  | cp -r dump-db $BUILD_DIR/ | ||||||
|  | rm -rf $BUILD_DIR/dump-db/node_modules | ||||||
|  |  | ||||||
| echo "Zipping mac x64 electron distribution..." | echo "Zipping mac x64 electron distribution..." | ||||||
|  |  | ||||||
| VERSION=`jq -r ".version" package.json` | VERSION=`jq -r ".version" package.json` | ||||||
|   | |||||||
| @@ -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.13.1 | NODE_VERSION=16.19.1 | ||||||
|  |  | ||||||
| if [ "$1" != "DONTCOPY" ] | if [ "$1" != "DONTCOPY" ] | ||||||
| then | then | ||||||
| @@ -20,12 +20,19 @@ rm -r $PKG_DIR/node/lib/node_modules/npm | |||||||
| rm -r $PKG_DIR/node/include/node | rm -r $PKG_DIR/node/include/node | ||||||
|  |  | ||||||
| rm -r $PKG_DIR/node_modules/electron* | rm -r $PKG_DIR/node_modules/electron* | ||||||
|  | rm -r $PKG_DIR/webpack* | ||||||
|  | rm -r $PKG_DIR/electron.js | ||||||
|  |  | ||||||
| cp -r bin/better-sqlite3/linux-server-better_sqlite3.node $PKG_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node | cp -r bin/better-sqlite3/linux-server-better_sqlite3.node $PKG_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node | ||||||
|  |  | ||||||
| printf "#!/bin/sh\n./node/bin/node src/www" > $PKG_DIR/trilium.sh | printf "#!/bin/sh\n./node/bin/node src/www" > $PKG_DIR/trilium.sh | ||||||
| chmod 755 $PKG_DIR/trilium.sh | chmod 755 $PKG_DIR/trilium.sh | ||||||
|  |  | ||||||
|  | cp bin/tpl/anonymize-database.sql $PKG_DIR/ | ||||||
|  |  | ||||||
|  | cp -r dump-db $PKG_DIR/ | ||||||
|  | rm -rf $PKG_DIR/dump-db/node_modules | ||||||
|  |  | ||||||
| VERSION=`jq -r ".version" package.json` | VERSION=`jq -r ".version" package.json` | ||||||
|  |  | ||||||
| cd dist | cd dist | ||||||
|   | |||||||
| @@ -25,9 +25,12 @@ mv "./dist/Trilium Notes-win32-x64" $BUILD_DIR | |||||||
| # removing software WebGL binaries because they are pretty huge and not necessary | # removing software WebGL binaries because they are pretty huge and not necessary | ||||||
| rm -r $BUILD_DIR/swiftshader | rm -r $BUILD_DIR/swiftshader | ||||||
|  |  | ||||||
| cp bin/tpl/trilium-portable.bat $BUILD_DIR/ | cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | ||||||
| cp bin/tpl/trilium-no-cert-check.bat $BUILD_DIR/ |  | ||||||
| cp bin/tpl/trilium-safe-mode.bat $BUILD_DIR/ | cp -r dump-db $BUILD_DIR/ | ||||||
|  | rm -rf $BUILD_DIR/dump-db/node_modules | ||||||
|  |  | ||||||
|  | cp bin/tpl/trilium-{portable,no-cert-check,safe-mode}.bat $BUILD_DIR/ | ||||||
|  |  | ||||||
| echo "Zipping windows x64 electron distribution..." | echo "Zipping windows x64 electron distribution..." | ||||||
| VERSION=`jq -r ".version" package.json` | VERSION=`jq -r ".version" package.json` | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ if [[ $# -eq 0 ]] ; then | |||||||
|     exit 1 |     exit 1 | ||||||
| fi | fi | ||||||
|  |  | ||||||
| n exec 16.13.1 npm run webpack | n exec 16.19.1 npm run webpack | ||||||
|  |  | ||||||
| DIR=$1 | DIR=$1 | ||||||
|  |  | ||||||
| @@ -27,7 +27,7 @@ cp -r electron.js $DIR/ | |||||||
| cp webpack-* $DIR/ | cp webpack-* $DIR/ | ||||||
|  |  | ||||||
| # run in subshell (so we return to original dir) | # run in subshell (so we return to original dir) | ||||||
| (cd $DIR && n exec 16.13.1 npm install --only=prod) | (cd $DIR && n exec 16.19.1 npm install --only=prod) | ||||||
|  |  | ||||||
| # cleanup of useless files in dependencies | # cleanup of useless files in dependencies | ||||||
| rm -r $DIR/node_modules/image-q/demo | rm -r $DIR/node_modules/image-q/demo | ||||||
| @@ -44,8 +44,7 @@ find $DIR/node_modules -name demo -exec rm -rf {} \; | |||||||
|  |  | ||||||
| find $DIR/libraries -name "*.map" -type f -delete | find $DIR/libraries -name "*.map" -type f -delete | ||||||
|  |  | ||||||
| rm -r $DIR/src/public/app | cp $DIR/src/public/app/share.js $DIR/src/public/app-dist/ | ||||||
|  | cp -r $DIR/src/public/app/doc_notes $DIR/src/public/app-dist/ | ||||||
|  |  | ||||||
| sed -i -e 's/app\/desktop.js/app-dist\/desktop.js/g' $DIR/src/views/desktop.ejs | rm -rf $DIR/src/public/app | ||||||
| sed -i -e 's/app\/mobile.js/app-dist\/mobile.js/g' $DIR/src/views/mobile.ejs |  | ||||||
| sed -i -e 's/app\/setup.js/app-dist\/setup.js/g' $DIR/src/views/setup.ejs |  | ||||||
|   | |||||||
							
								
								
									
										7
									
								
								bin/create-anonymization-script.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								bin/create-anonymization-script.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | |||||||
|  | #!/usr/bin/env node | ||||||
|  |  | ||||||
|  | const anonymizationService = require('../src/services/anonymization'); | ||||||
|  | const fs = require('fs'); | ||||||
|  | const path = require('path'); | ||||||
|  |  | ||||||
|  | fs.writeFileSync(path.resolve(__dirname, 'tpl', 'anonymize-database.sql'), anonymizationService.getFullAnonymizationScript()); | ||||||
| @@ -2,6 +2,6 @@ | |||||||
|  |  | ||||||
| SCHEMA_FILE_PATH=db/schema.sql | SCHEMA_FILE_PATH=db/schema.sql | ||||||
|  |  | ||||||
| sqlite3 ~/trilium-data/document.db .schema | grep -v "sqlite_sequence" > "$SCHEMA_FILE_PATH" | sqlite3 ./data/document.db .schema | grep -v "sqlite_sequence" > "$SCHEMA_FILE_PATH" | ||||||
|  |  | ||||||
| echo "DB schema exported to $SCHEMA_FILE_PATH" | echo "DB schema exported to $SCHEMA_FILE_PATH" | ||||||
							
								
								
									
										57
									
								
								bin/release-flatpack.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										57
									
								
								bin/release-flatpack.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,57 @@ | |||||||
|  | #!/usr/bin/env bash | ||||||
|  |  | ||||||
|  | if [[ $# -eq 0 ]] ; then | ||||||
|  |     echo "Missing argument of new version" | ||||||
|  |     exit 1 | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | VERSION=$1 | ||||||
|  |  | ||||||
|  | if ! [[ ${VERSION} =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}(-.+)?$ ]] ; | ||||||
|  | then | ||||||
|  |     echo "Version ${VERSION} isn't in format X.Y.Z" | ||||||
|  |     exit 1 | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | VERSION_DATE=$(git log -1 --format=%aI "v${VERSION}" | cut -c -10) | ||||||
|  | VERSION_COMMIT=$(git rev-list -n 1 "v${VERSION}") | ||||||
|  |  | ||||||
|  | # expecting the directory at a specific path | ||||||
|  | cd ~/trilium-flathub || exit | ||||||
|  |  | ||||||
|  | if ! git diff-index --quiet HEAD --; then | ||||||
|  |     echo "There are uncommitted changes" | ||||||
|  |     exit 1 | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | BASE_BRANCH=master | ||||||
|  |  | ||||||
|  | if [[ "$VERSION" == *"beta"* ]]; then | ||||||
|  |     BASE_BRANCH=beta | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | git switch "${BASE_BRANCH}" | ||||||
|  | git pull | ||||||
|  |  | ||||||
|  | BRANCH=b${VERSION} | ||||||
|  |  | ||||||
|  | git branch "${BRANCH}" | ||||||
|  | git switch "${BRANCH}" | ||||||
|  |  | ||||||
|  | echo "Updating files with version ${VERSION}, date ${VERSION_DATE} and commit ${VERSION_COMMIT}" | ||||||
|  |  | ||||||
|  | flatpak-node-generator npm ../trilium/package-lock.json | ||||||
|  |  | ||||||
|  | xmlstarlet ed --inplace --update "/component/releases/release/@version" --value "${VERSION}" --update "/component/releases/release/@date" --value "${VERSION_DATE}" ./com.github.zadam.trilium.metainfo.xml | ||||||
|  |  | ||||||
|  | yq --inplace "(.modules[0].sources[0].tag = \"v${VERSION}\") | (.modules[0].sources[0].commit = \"${VERSION_COMMIT}\")" ./com.github.zadam.trilium.yml | ||||||
|  |  | ||||||
|  | git add ./generated-sources.json | ||||||
|  | git add ./com.github.zadam.trilium.metainfo.xml | ||||||
|  | git add ./com.github.zadam.trilium.yml | ||||||
|  |  | ||||||
|  | git commit -m "release $VERSION" | ||||||
|  | git push --set-upstream origin "${BRANCH}" | ||||||
|  |  | ||||||
|  | gh pr create --fill -B "${BASE_BRANCH}" | ||||||
|  | gh pr merge --auto --merge --delete-branch | ||||||
							
								
								
									
										166
									
								
								bin/tpl/anonymize-database.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										166
									
								
								bin/tpl/anonymize-database.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,166 @@ | |||||||
|  |  | ||||||
|  | UPDATE etapi_tokens SET tokenHash = 'API token hash value'; | ||||||
|  | UPDATE notes SET title = 'title' WHERE noteId != 'root' AND noteId NOT LIKE '\_%' ESCAPE '\'; | ||||||
|  | UPDATE note_contents SET content = 'text' WHERE content IS NOT NULL; | ||||||
|  | UPDATE note_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 branches SET prefix = 'prefix' WHERE prefix IS NOT NULL AND prefix != 'recovered'; | ||||||
|  | UPDATE options SET value = 'anonymized' WHERE name IN | ||||||
|  |                     ('documentId', 'documentSecret', 'encryptedDataKey', | ||||||
|  |                      'passwordVerificationHash', 'passwordVerificationSalt', | ||||||
|  |                      'passwordDerivedKeySalt', 'username', 'syncServerHost', 'syncProxy') | ||||||
|  |                       AND value != ''; | ||||||
|  |  | ||||||
|  | VACUUM; | ||||||
| @@ -1,4 +1,23 @@ | |||||||
|  | @echo off | ||||||
|  | :: Try to get powershell to launch Trilium since it deals with UTF-8 characters in current path | ||||||
|  | :: If there's no powershell available, fallback to unicode enabled command interpreter | ||||||
|  |  | ||||||
|  | WHERE powershell.exe > NUL 2>&1 | ||||||
|  | IF %ERRORLEVEL% NEQ 0 GOTO BATCH ELSE GOTO POWERSHELL | ||||||
|  |  | ||||||
|  | :POWERSHELL | ||||||
|  | powershell -ExecutionPolicy Bypass -NonInteractive -NoLogo "Set-Item -Path Env:NODE_TLS_REJECT_UNAUTHORIZED -Value 0; ./trilium.exe" | ||||||
|  | GOTO END | ||||||
|  |  | ||||||
|  | :BATCH | ||||||
|  | :: Make sure we support UTF-8 characters | ||||||
|  | chcp 65001 | ||||||
|  |  | ||||||
|  | :: Get Current Trilium executable directory and compute data directory | ||||||
| SET DIR=%~dp0 | SET DIR=%~dp0 | ||||||
| set NODE_TLS_REJECT_UNAUTHORIZED=0 | set NODE_TLS_REJECT_UNAUTHORIZED=0 | ||||||
| cd %DIR% | cd %DIR% | ||||||
| start trilium.exe | start trilium.exe | ||||||
|  | GOTO END | ||||||
|  |  | ||||||
|  | :END | ||||||
|   | |||||||
| @@ -1,4 +1,23 @@ | |||||||
|  | @echo off | ||||||
|  | :: Try to get powershell to launch Trilium since it deals with UTF-8 characters in current path | ||||||
|  | :: If there's no powershell available, fallback to unicode enabled command interpreter | ||||||
|  |  | ||||||
|  | WHERE powershell.exe > NUL 2>&1 | ||||||
|  | IF %ERRORLEVEL% NEQ 0 GOTO BATCH ELSE GOTO POWERSHELL | ||||||
|  |  | ||||||
|  | :POWERSHELL | ||||||
|  | powershell -ExecutionPolicy Bypass -NonInteractive -NoLogo "Set-Item -Path Env:TRILIUM_DATA_DIR -Value './trilium-data'; ./trilium.exe" | ||||||
|  | GOTO END | ||||||
|  |  | ||||||
|  | :BATCH | ||||||
|  | :: Make sure we support UTF-8 characters | ||||||
|  | chcp 65001 | ||||||
|  |  | ||||||
|  | :: Get Current Trilium executable directory and compute data directory | ||||||
| SET DIR=%~dp0 | SET DIR=%~dp0 | ||||||
| SET TRILIUM_DATA_DIR=%DIR%\trilium-data | SET TRILIUM_DATA_DIR=%DIR%\trilium-data | ||||||
| cd %DIR% | cd %DIR% | ||||||
| start trilium.exe | start trilium.exe | ||||||
|  | GOTO END | ||||||
|  |  | ||||||
|  | :END | ||||||
|   | |||||||
| @@ -1,4 +1,23 @@ | |||||||
|  | @echo off | ||||||
|  | :: Try to get powershell to launch Trilium since it deals with UTF-8 characters in current path | ||||||
|  | :: If there's no powershell available, fallback to unicode enabled command interpreter | ||||||
|  |  | ||||||
|  | WHERE powershell.exe > NUL 2>&1 | ||||||
|  | IF %ERRORLEVEL% NEQ 0 GOTO BATCH ELSE GOTO POWERSHELL | ||||||
|  |  | ||||||
|  | :POWERSHELL | ||||||
|  | powershell -ExecutionPolicy Bypass -NonInteractive -NoLogo "Set-Item -Path Env:TRILIUM_SAFE_MODE -Value 1; ./trilium.exe --disable-gpu" | ||||||
|  | GOTO END | ||||||
|  |  | ||||||
|  | :BATCH | ||||||
|  | :: Make sure we support UTF-8 characters | ||||||
|  | chcp 65001 | ||||||
|  |  | ||||||
|  | :: Get Current Trilium executable directory and compute data directory | ||||||
| SET DIR=%~dp0 | SET DIR=%~dp0 | ||||||
| SET TRILIUM_SAFE_MODE=1 | SET TRILIUM_SAFE_MODE=1 | ||||||
| cd %DIR% | cd %DIR% | ||||||
| start trilium.exe | start trilium.exe --disable-gpu | ||||||
|  | GOTO END | ||||||
|  |  | ||||||
|  | :END | ||||||
|   | |||||||
| @@ -3,5 +3,5 @@ | |||||||
| DIR=`dirname "$0"` | DIR=`dirname "$0"` | ||||||
| export TRILIUM_SAFE_MODE=1 | export TRILIUM_SAFE_MODE=1 | ||||||
|  |  | ||||||
| "$DIR/trilium" | "$DIR/trilium" --disable-gpu | ||||||
|  |  | ||||||
|   | |||||||
| @@ -21,3 +21,9 @@ 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= | ||||||
| keyPath= | keyPath= | ||||||
|  | # setting to give trust to reverse proxies, a comma-separated list of trusted rev. proxy IPs can be specified (CIDR notation is permitted), | ||||||
|  | # alternatively 'true' will make use of the leftmost IP in X-Forwarded-For, ultimately an integer can be used to tell about the number of hops between | ||||||
|  | # Trilium (which is hop 0) and the first trusted rev. proxy.  | ||||||
|  | # once set, expressjs will use the X-Forwarded-For header set by the rev. proxy to determinate the real IPs of clients. | ||||||
|  | # expressjs shortcuts are supported: loopback(127.0.0.1/8, ::1/128), linklocal(169.254.0.0/16, fe80::/10), uniquelocal(10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, fc00::/7) | ||||||
|  | trustedReverseProxy=false | ||||||
|   | |||||||
| @@ -1,11 +1,6 @@ | |||||||
| - drop branches.utcDateCreated - not used for anything |  | ||||||
| - drop options.utcDateCreated - not used for anything |  | ||||||
| - isDeleted = 0 by default | - isDeleted = 0 by default | ||||||
| - rename openTabs to openNoteContexts | - rename openTabs to openNoteContexts | ||||||
| - migrate black theme to dark theme |  | ||||||
| - 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) | ||||||
|   * readOnly=never - like autoReadOnlyDisabled |   * readOnly=never - like autoReadOnlyDisabled | ||||||
| - remove focusOnAttributesKeyboardShortcut |  | ||||||
| - rename white theme to "light" theme (it's not completely white and matches well to dark theme) |  | ||||||
|   | |||||||
							
								
								
									
										
											BIN
										
									
								
								db/demo.zip
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								db/demo.zip
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										1
									
								
								db/migrations/0184__NOOP.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								db/migrations/0184__NOOP.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | module.exports = () => console.log("NOOP, moved to migration 0189"); | ||||||
| @@ -10,8 +10,18 @@ CREATE TABLE IF NOT EXISTS "mig_entity_changes" ( | |||||||
|                                                 `utcDateChanged` TEXT NOT NULL |                                                 `utcDateChanged` TEXT NOT NULL | ||||||
| ); | ); | ||||||
|  |  | ||||||
| INSERT INTO mig_entity_changes (entityName, entityId, hash, isErased, changeId, sourceId, isSynced, utcDateChanged) | INSERT INTO mig_entity_changes (id, entityName, entityId, hash, isErased, changeId, sourceId, isSynced, utcDateChanged) | ||||||
|     SELECT entityName, entityId, hash, isErased, '', sourceId, isSynced, utcDateChanged FROM entity_changes; |     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; | DROP TABLE entity_changes; | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								db/migrations/0189__delete_username_option.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								db/migrations/0189__delete_username_option.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | DELETE FROM options WHERE name = 'username'; | ||||||
							
								
								
									
										15
									
								
								db/migrations/0190__change_to_etapi_tokens.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								db/migrations/0190__change_to_etapi_tokens.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | 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'; | ||||||
							
								
								
									
										10
									
								
								db/migrations/0191__hash_tokens.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								db/migrations/0191__hash_tokens.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | |||||||
|  | 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]); | ||||||
|  |     } | ||||||
|  | }; | ||||||
							
								
								
									
										20
									
								
								db/migrations/0192__add_memberId_to_entity_changes.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								db/migrations/0192__add_memberId_to_entity_changes.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | |||||||
|  | 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
									
								
								db/migrations/0193__add_index_to_changeId.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								db/migrations/0193__add_index_to_changeId.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | CREATE INDEX `IDX_entity_changes_changeId` ON `entity_changes` (`changeId`); | ||||||
| @@ -0,0 +1,2 @@ | |||||||
|  | -- 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'; | ||||||
							
								
								
									
										2
									
								
								db/migrations/0196__rename_bulk_actions.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								db/migrations/0196__rename_bulk_actions.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | |||||||
|  | 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
									
								
								db/migrations/0197__NOOP.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								db/migrations/0197__NOOP.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | module.exports = () => console.log("NOOP, increased because of protected notes IV change"); | ||||||
							
								
								
									
										6
									
								
								db/migrations/0198__rename_branchIds.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								db/migrations/0198__rename_branchIds.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | 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; | ||||||
							
								
								
									
										53
									
								
								db/migrations/0199__rename_ids.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								db/migrations/0199__rename_ids.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,53 @@ | |||||||
|  | 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'; | ||||||
							
								
								
									
										12
									
								
								db/migrations/0200__create_hidden_subtree.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								db/migrations/0200__create_hidden_subtree.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | 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); | ||||||
|  |     }); | ||||||
|  | }; | ||||||
							
								
								
									
										2
									
								
								db/migrations/0201__move_share_under_hidden.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								db/migrations/0201__move_share_under_hidden.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | |||||||
|  | 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'; | ||||||
| @@ -0,0 +1,2 @@ | |||||||
|  | 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'; | ||||||
							
								
								
									
										6
									
								
								db/migrations/0203__delete_singles_special_note.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								db/migrations/0203__delete_singles_special_note.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | 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'; | ||||||
							
								
								
									
										21
									
								
								db/migrations/0204__migrate_bookmarks_to_clones.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								db/migrations/0204__migrate_bookmarks_to_clones.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | 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'); | ||||||
|  |         } | ||||||
|  |     }); | ||||||
|  | }; | ||||||
							
								
								
									
										3
									
								
								db/migrations/0205__rename_note_types.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								db/migrations/0205__rename_note_types.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | 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'; | ||||||
							
								
								
									
										33
									
								
								db/migrations/0206__delete_search_and_sql_console_history.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								db/migrations/0206__delete_search_and_sql_console_history.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | |||||||
|  | // 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'); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     }); | ||||||
|  | }; | ||||||
							
								
								
									
										2
									
								
								db/migrations/0207__rename_search_and_sql_console.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								db/migrations/0207__rename_search_and_sql_console.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | |||||||
|  | UPDATE notes SET title = 'SQL Console History' WHERE noteId = '_sqlConsole'; | ||||||
|  | UPDATE notes SET title = 'Search History' WHERE noteId = '_search'; | ||||||
							
								
								
									
										13
									
								
								db/migrations/0208__remove_archived_from_hidden.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								db/migrations/0208__remove_archived_from_hidden.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | |||||||
|  | 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'); | ||||||
|  |         } | ||||||
|  |     }); | ||||||
|  | }; | ||||||
							
								
								
									
										5
									
								
								db/migrations/0209__rename_hoisted_labels.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								db/migrations/0209__rename_hoisted_labels.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | 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'; | ||||||
							
								
								
									
										24
									
								
								db/migrations/0210__consistency_checks.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								db/migrations/0210__consistency_checks.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | |||||||
|  | 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}`); | ||||||
|  |         } | ||||||
|  |     }); | ||||||
|  | }; | ||||||
							
								
								
									
										12
									
								
								db/migrations/0211__rename_branchIds.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								db/migrations/0211__rename_branchIds.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | -- 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; | ||||||
							
								
								
									
										21
									
								
								db/migrations/0212__delete_all_attributes_of_named_notes.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								db/migrations/0212__delete_all_attributes_of_named_notes.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | 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(); | ||||||
|  |  | ||||||
|  |         const hidden = becca.getNote("_hidden"); | ||||||
|  |  | ||||||
|  |         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"); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     }); | ||||||
|  | }; | ||||||
							
								
								
									
										48
									
								
								db/migrations/0213__migrate_scripts.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								db/migrations/0213__migrate_scripts.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,48 @@ | |||||||
|  | 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}`); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     }); | ||||||
|  | }; | ||||||
| @@ -5,15 +5,18 @@ CREATE TABLE IF NOT EXISTS "entity_changes" ( | |||||||
|                                                 `hash`	TEXT NOT NULL, |                                                 `hash`	TEXT NOT NULL, | ||||||
|                                                 `isErased` INT NOT NULL, |                                                 `isErased` INT NOT NULL, | ||||||
|                                                 `changeId` TEXT NOT NULL, |                                                 `changeId` TEXT NOT NULL, | ||||||
|                                                 `sourceId` TEXT NOT NULL, |                                                 `componentId` TEXT NOT NULL, | ||||||
|  |                                                 `instanceId` TEXT NOT NULL, | ||||||
|                                                 `isSynced` INTEGER NOT NULL, |                                                 `isSynced` INTEGER NOT NULL, | ||||||
|                                                 `utcDateChanged` TEXT NOT NULL |                                                 `utcDateChanged` TEXT NOT NULL | ||||||
|                                                 ); |                                                 ); | ||||||
| CREATE TABLE IF NOT EXISTS "api_tokens" | CREATE TABLE IF NOT EXISTS "etapi_tokens" | ||||||
| ( | ( | ||||||
|     apiTokenId TEXT PRIMARY KEY NOT NULL, |     etapiTokenId TEXT PRIMARY KEY NOT NULL, | ||||||
|     token TEXT NOT NULL, |     name TEXT NOT NULL, | ||||||
|  |     tokenHash TEXT NOT NULL, | ||||||
|     utcDateCreated TEXT NOT NULL, |     utcDateCreated TEXT NOT NULL, | ||||||
|  |     utcDateModified TEXT NOT NULL, | ||||||
|     isDeleted INT NOT NULL DEFAULT 0); |     isDeleted INT NOT NULL DEFAULT 0); | ||||||
| CREATE TABLE IF NOT EXISTS "branches" ( | CREATE TABLE IF NOT EXISTS "branches" ( | ||||||
|                                           `branchId`	TEXT NOT NULL, |                                           `branchId`	TEXT NOT NULL, | ||||||
| @@ -50,7 +53,7 @@ CREATE TABLE IF NOT EXISTS "note_revisions" (`noteRevisionId`	TEXT NOT NULL PRIM | |||||||
|                                              `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, |                                              `title`	TEXT NOT NULL, | ||||||
|                                              `isProtected`	INT NOT NULL DEFAULT 0, |                                              `isProtected`	INT NOT NULL DEFAULT 0, | ||||||
|                                              `utcDateLastEdited` TEXT NOT NULL, |                                              `utcDateLastEdited` TEXT NOT NULL, | ||||||
|                                              `utcDateCreated` TEXT NOT NULL, |                                              `utcDateCreated` TEXT NOT NULL, | ||||||
| @@ -63,7 +66,7 @@ CREATE TABLE IF NOT EXISTS "note_revision_contents" (`noteRevisionId`	TEXT NOT N | |||||||
| CREATE TABLE IF NOT EXISTS "options" | CREATE TABLE IF NOT EXISTS "options" | ||||||
| ( | ( | ||||||
|     name TEXT not null PRIMARY KEY, |     name TEXT not null PRIMARY KEY, | ||||||
|     value TEXT, |     value TEXT not null, | ||||||
|     isSynced INTEGER default 0 not null, |     isSynced INTEGER default 0 not null, | ||||||
|     utcDateModified TEXT NOT NULL |     utcDateModified TEXT NOT NULL | ||||||
| ); | ); | ||||||
| @@ -96,6 +99,7 @@ CREATE INDEX `IDX_note_revisions_utcDateCreated` ON `note_revisions` (`utcDateCr | |||||||
| CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`); | CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`); | ||||||
| CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`); | CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`); | ||||||
| CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`); | CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`); | ||||||
|  | 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); | ||||||
| CREATE INDEX IDX_attributes_noteId_index | CREATE INDEX IDX_attributes_noteId_index | ||||||
|   | |||||||
| @@ -1,17 +1,14 @@ | |||||||
| version: '2.1' | version: '2.1' | ||||||
| services: | services: | ||||||
|   trilium: |   trilium: | ||||||
|     build: |  | ||||||
|       context: . |  | ||||||
|     image: zadam/trilium |     image: zadam/trilium | ||||||
|     restart: always |     restart: always | ||||||
|     environment: |     environment: | ||||||
|       - TRILIUM_DATA_DIR=/data |       - TRILIUM_DATA_DIR=/home/node/trilium-data | ||||||
|     ports: |     ports: | ||||||
|       - "8080:8080" |       - "8080:8080" | ||||||
|     volumes: |     volumes: | ||||||
|       - trilium:/data |       - trilium:/home/node/trilium-data | ||||||
|  |  | ||||||
| volumes: | volumes: | ||||||
|   trilium: |   trilium: | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										43
									
								
								docker_healthcheck.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										43
									
								
								docker_healthcheck.js
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,43 @@ | |||||||
|  | const http = require("http"); | ||||||
|  | const ini = require("ini"); | ||||||
|  | const fs = require("fs"); | ||||||
|  | const dataDir = require("./src/services/data_dir"); | ||||||
|  | const config = ini.parse(fs.readFileSync(dataDir.CONFIG_INI_PATH, 'utf-8')); | ||||||
|  |  | ||||||
|  | if (config.https) { | ||||||
|  |     // 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 | ||||||
|  |     process.exit(0); | ||||||
|  |     return; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | const port = require('./src/services/port'); | ||||||
|  | const host = require('./src/services/host'); | ||||||
|  |  | ||||||
|  | const options = { timeout: 2000 }; | ||||||
|  |  | ||||||
|  | const callback = res => { | ||||||
|  |     console.log(`STATUS: ${res.statusCode}`); | ||||||
|  |     if (res.statusCode === 200) { | ||||||
|  |         process.exit(0); | ||||||
|  |     } else { | ||||||
|  |         process.exit(1); | ||||||
|  |     } | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | let request; | ||||||
|  |  | ||||||
|  | if (port !== 0) { // TCP socket. | ||||||
|  |     const url = `http://${host}:${port}/api/health-check`; | ||||||
|  |     request = http.request(url, options, callback); | ||||||
|  | } else { // Unix socket. | ||||||
|  |     options.socketPath = host; | ||||||
|  |     options.path = '/api/health-check'; | ||||||
|  |     request = http.request(options, callback); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | request.on("error", err => { | ||||||
|  |     console.log("ERROR"); | ||||||
|  |     process.exit(1); | ||||||
|  | }); | ||||||
|  | request.end(); | ||||||
							
								
								
									
										1000
									
								
								docs/backend_api/AbstractBeccaEntity.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1000
									
								
								docs/backend_api/AbstractBeccaEntity.html
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,378 +0,0 @@ | |||||||
| <!DOCTYPE html> |  | ||||||
| <html lang="en"> |  | ||||||
| <head> |  | ||||||
|     <meta charset="utf-8"> |  | ||||||
|     <title>JSDoc: Class: ApiToken</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: ApiToken</h1> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <section> |  | ||||||
|  |  | ||||||
| <header> |  | ||||||
|      |  | ||||||
|         <h2><span class="attribs"><span class="type-signature"></span></span>ApiToken<span class="signature">()</span><span class="type-signature"></span></h2> |  | ||||||
|          |  | ||||||
|             <div class="class-description">ApiToken is an entity representing token used to authenticate against Trilium API from client applications. Currently used only by Trilium Sender.</div> |  | ||||||
|          |  | ||||||
|      |  | ||||||
| </header> |  | ||||||
|  |  | ||||||
| <article> |  | ||||||
|     <div class="container-overview"> |  | ||||||
|      |  | ||||||
|          |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <h2>Constructor</h2> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <h4 class="name" id="ApiToken"><span class="type-signature"></span>new ApiToken<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_api_token.js.html">becca/entities/api_token.js</a>, <a href="becca_entities_api_token.js.html#line9">line 9</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     </div> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|         <h3 class="subsection-title">Members</h3> |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="apiTokenId"><span class="type-signature"></span>apiTokenId<span class="type-signature"> :string</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_api_token.js.html">becca/entities/api_token.js</a>, <a href="becca_entities_api_token.js.html#line18">line 18</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="token"><span class="type-signature"></span>token<span class="type-signature"> :string</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_api_token.js.html">becca/entities/api_token.js</a>, <a href="becca_entities_api_token.js.html#line20">line 20</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="utcDateCreated"><span class="type-signature"></span>utcDateCreated<span class="type-signature"> :string</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_api_token.js.html">becca/entities/api_token.js</a>, <a href="becca_entities_api_token.js.html#line22">line 22</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </article> |  | ||||||
|  |  | ||||||
| </section> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| </div> |  | ||||||
|  |  | ||||||
| <nav> |  | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> |  | ||||||
| </nav> |  | ||||||
|  |  | ||||||
| <br class="clear"> |  | ||||||
|  |  | ||||||
| <footer> |  | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |  | ||||||
| </footer> |  | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> |  | ||||||
| <script src="scripts/linenumber.js"> </script> |  | ||||||
| </body> |  | ||||||
| </html> |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1913
									
								
								docs/backend_api/BAttribute.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1913
									
								
								docs/backend_api/BAttribute.html
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1925
									
								
								docs/backend_api/BBranch.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1925
									
								
								docs/backend_api/BBranch.html
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1470
									
								
								docs/backend_api/BEtapiToken.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1470
									
								
								docs/backend_api/BEtapiToken.html
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2183
									
								
								docs/backend_api/BNoteRevision.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2183
									
								
								docs/backend_api/BNoteRevision.html
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1328
									
								
								docs/backend_api/BOption.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1328
									
								
								docs/backend_api/BOption.html
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1260
									
								
								docs/backend_api/BRecentNote.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1260
									
								
								docs/backend_api/BRecentNote.html
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,767 +0,0 @@ | |||||||
| <!DOCTYPE html> |  | ||||||
| <html lang="en"> |  | ||||||
| <head> |  | ||||||
|     <meta charset="utf-8"> |  | ||||||
|     <title>JSDoc: Class: Branch</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: Branch</h1> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <section> |  | ||||||
|  |  | ||||||
| <header> |  | ||||||
|      |  | ||||||
|         <h2><span class="attribs"><span class="type-signature"></span></span>Branch<span class="signature">()</span><span class="type-signature"></span></h2> |  | ||||||
|          |  | ||||||
|             <div class="class-description">Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple |  | ||||||
| parents.</div> |  | ||||||
|          |  | ||||||
|      |  | ||||||
| </header> |  | ||||||
|  |  | ||||||
| <article> |  | ||||||
|     <div class="container-overview"> |  | ||||||
|      |  | ||||||
|          |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <h2>Constructor</h2> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <h4 class="name" id="Branch"><span class="type-signature"></span>new Branch<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_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line12">line 12</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     </div> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|         <h3 class="subsection-title">Members</h3> |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="branchId"><span class="type-signature"></span>branchId<span class="type-signature"> :string</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line43">line 43</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="childNote"><span class="type-signature"></span>childNote<span class="type-signature"></span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line85">line 85</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="isExpanded"><span class="type-signature"></span>isExpanded<span class="type-signature"> :boolean</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">boolean</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line53">line 53</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"> :string</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line45">line 45</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="notePosition"><span class="type-signature"></span>notePosition<span class="type-signature"> :int</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">int</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line51">line 51</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="parentNote"><span class="type-signature"></span>parentNote<span class="type-signature"></span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line99">line 99</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="parentNoteId"><span class="type-signature"></span>parentNoteId<span class="type-signature"> :string</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line47">line 47</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="prefix"><span class="type-signature"></span>prefix<span class="type-signature"> :string</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line49">line 49</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="utcDateModified"><span class="type-signature"></span>utcDateModified<span class="type-signature"> :string</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line55">line 55</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </article> |  | ||||||
|  |  | ||||||
| </section> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| </div> |  | ||||||
|  |  | ||||||
| <nav> |  | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> |  | ||||||
| </nav> |  | ||||||
|  |  | ||||||
| <br class="clear"> |  | ||||||
|  |  | ||||||
| <footer> |  | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |  | ||||||
| </footer> |  | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> |  | ||||||
| <script src="scripts/linenumber.js"> </script> |  | ||||||
| </body> |  | ||||||
| </html> |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,446 +0,0 @@ | |||||||
| <!DOCTYPE html> |  | ||||||
| <html lang="en"> |  | ||||||
| <head> |  | ||||||
|     <meta charset="utf-8"> |  | ||||||
|     <title>JSDoc: Class: Option</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: Option</h1> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <section> |  | ||||||
|  |  | ||||||
| <header> |  | ||||||
|      |  | ||||||
|         <h2><span class="attribs"><span class="type-signature"></span></span>Option<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> |  | ||||||
|          |  | ||||||
|      |  | ||||||
| </header> |  | ||||||
|  |  | ||||||
| <article> |  | ||||||
|     <div class="container-overview"> |  | ||||||
|      |  | ||||||
|          |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <h2>Constructor</h2> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <h4 class="name" id="Option"><span class="type-signature"></span>new Option<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_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line9">line 9</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     </div> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|         <h3 class="subsection-title">Members</h3> |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="isSynced"><span class="type-signature"></span>isSynced<span class="type-signature"> :boolean</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">boolean</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line22">line 22</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="name"><span class="type-signature"></span>name<span class="type-signature"> :string</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line18">line 18</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="utcDateModified"><span class="type-signature"></span>utcDateModified<span class="type-signature"> :string</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line24">line 24</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="value"><span class="type-signature"></span>value<span class="type-signature"> :string</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line20">line 20</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </article> |  | ||||||
|  |  | ||||||
| </section> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| </div> |  | ||||||
|  |  | ||||||
| <nav> |  | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> |  | ||||||
| </nav> |  | ||||||
|  |  | ||||||
| <br class="clear"> |  | ||||||
|  |  | ||||||
| <footer> |  | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |  | ||||||
| </footer> |  | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> |  | ||||||
| <script src="scripts/linenumber.js"> </script> |  | ||||||
| </body> |  | ||||||
| </html> |  | ||||||
| @@ -1,378 +0,0 @@ | |||||||
| <!DOCTYPE html> |  | ||||||
| <html lang="en"> |  | ||||||
| <head> |  | ||||||
|     <meta charset="utf-8"> |  | ||||||
|     <title>JSDoc: Class: RecentNote</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: RecentNote</h1> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <section> |  | ||||||
|  |  | ||||||
| <header> |  | ||||||
|      |  | ||||||
|         <h2><span class="attribs"><span class="type-signature"></span></span>RecentNote<span class="signature">()</span><span class="type-signature"></span></h2> |  | ||||||
|          |  | ||||||
|             <div class="class-description">RecentNote represents recently visited note.</div> |  | ||||||
|          |  | ||||||
|      |  | ||||||
| </header> |  | ||||||
|  |  | ||||||
| <article> |  | ||||||
|     <div class="container-overview"> |  | ||||||
|      |  | ||||||
|          |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <h2>Constructor</h2> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <h4 class="name" id="RecentNote"><span class="type-signature"></span>new RecentNote<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_recent_note.js.html">becca/entities/recent_note.js</a>, <a href="becca_entities_recent_note.js.html#line9">line 9</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     </div> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|         <h3 class="subsection-title">Members</h3> |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"> :string</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_recent_note.js.html">becca/entities/recent_note.js</a>, <a href="becca_entities_recent_note.js.html#line17">line 17</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="notePath"><span class="type-signature"></span>notePath<span class="type-signature"> :string</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_recent_note.js.html">becca/entities/recent_note.js</a>, <a href="becca_entities_recent_note.js.html#line19">line 19</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
| <h4 class="name" id="utcDateCreated"><span class="type-signature"></span>utcDateCreated<span class="type-signature"> :string</span></h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="becca_entities_recent_note.js.html">becca/entities/recent_note.js</a>, <a href="becca_entities_recent_note.js.html#line21">line 21</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </article> |  | ||||||
|  |  | ||||||
| </section> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| </div> |  | ||||||
|  |  | ||||||
| <nav> |  | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> |  | ||||||
| </nav> |  | ||||||
|  |  | ||||||
| <br class="clear"> |  | ||||||
|  |  | ||||||
| <footer> |  | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |  | ||||||
| </footer> |  | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> |  | ||||||
| <script src="scripts/linenumber.js"> </script> |  | ||||||
| </body> |  | ||||||
| </html> |  | ||||||
							
								
								
									
										221
									
								
								docs/backend_api/becca_entities_abstract_becca_entity.js.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										221
									
								
								docs/backend_api/becca_entities_abstract_becca_entity.js.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,221 @@ | |||||||
|  | <!DOCTYPE html> | ||||||
|  | <html lang="en"> | ||||||
|  | <head> | ||||||
|  |     <meta charset="utf-8"> | ||||||
|  |     <title>JSDoc: Source: becca/entities/abstract_becca_entity.js</title> | ||||||
|  |  | ||||||
|  |     <script src="scripts/prettify/prettify.js"> </script> | ||||||
|  |     <script src="scripts/prettify/lang-css.js"> </script> | ||||||
|  |     <!--[if lt IE 9]> | ||||||
|  |       <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||||||
|  |     <![endif]--> | ||||||
|  |     <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||||||
|  |     <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||||||
|  | </head> | ||||||
|  |  | ||||||
|  | <body> | ||||||
|  |  | ||||||
|  | <div id="main"> | ||||||
|  |  | ||||||
|  |     <h1 class="page-title">Source: becca/entities/abstract_becca_entity.js</h1> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <section> | ||||||
|  |         <article> | ||||||
|  |             <pre class="prettyprint source linenums"><code>"use strict"; | ||||||
|  |  | ||||||
|  | const utils = require('../../services/utils'); | ||||||
|  | const sql = require('../../services/sql'); | ||||||
|  | const entityChangesService = require('../../services/entity_changes'); | ||||||
|  | const eventService = require("../../services/events"); | ||||||
|  | const dateUtils = require("../../services/date_utils"); | ||||||
|  | const cls = require("../../services/cls"); | ||||||
|  | const log = require("../../services/log"); | ||||||
|  |  | ||||||
|  | let becca = null; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Base class for all backend entities. | ||||||
|  |  */ | ||||||
|  | class AbstractBeccaEntity { | ||||||
|  |     /** @protected */ | ||||||
|  |     beforeSaving() { | ||||||
|  |         this.generateIdIfNecessary(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @protected */ | ||||||
|  |     generateIdIfNecessary() { | ||||||
|  |         if (!this[this.constructor.primaryKeyName]) { | ||||||
|  |             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 */ | ||||||
|  |     getUtcDateChanged() { | ||||||
|  |         return this.utcDateModified || this.utcDateCreated; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * @protected | ||||||
|  |      * @returns {Becca} | ||||||
|  |      */ | ||||||
|  |     get becca() { | ||||||
|  |         if (!becca) { | ||||||
|  |             becca = require('../becca'); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return becca; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @protected */ | ||||||
|  |     addEntityChange(isDeleted = false) { | ||||||
|  |         entityChangesService.addEntityChange({ | ||||||
|  |             entityName: this.constructor.entityName, | ||||||
|  |             entityId: this[this.constructor.primaryKeyName], | ||||||
|  |             hash: this.generateHash(isDeleted), | ||||||
|  |             isErased: false, | ||||||
|  |             utcDateChanged: this.getUtcDateChanged(), | ||||||
|  |             isSynced: this.constructor.entityName !== 'options' || !!this.isSynced | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @protected */ | ||||||
|  |     getPojoToSave() { | ||||||
|  |         return this.getPojo(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Saves entity - executes SQL, but doesn't commit the transaction on its own | ||||||
|  |      * | ||||||
|  |      * @returns {this} | ||||||
|  |      */ | ||||||
|  |     save(opts = {}) { | ||||||
|  |         const entityName = this.constructor.entityName; | ||||||
|  |         const primaryKeyName = this.constructor.primaryKeyName; | ||||||
|  |  | ||||||
|  |         const isNewEntity = !this[primaryKeyName]; | ||||||
|  |  | ||||||
|  |         if (this.beforeSaving) { | ||||||
|  |             this.beforeSaving(opts); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         const pojo = this.getPojoToSave(); | ||||||
|  |  | ||||||
|  |         sql.transactional(() => { | ||||||
|  |             sql.upsert(entityName, primaryKeyName, pojo); | ||||||
|  |  | ||||||
|  |             if (entityName === 'recent_notes') { | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             this.addEntityChange(false); | ||||||
|  |  | ||||||
|  |             if (!cls.isEntityEventsDisabled()) { | ||||||
|  |                 const eventPayload = { | ||||||
|  |                     entityName, | ||||||
|  |                     entity: this | ||||||
|  |                 }; | ||||||
|  |  | ||||||
|  |                 if (isNewEntity) { | ||||||
|  |                     eventService.emit(eventService.ENTITY_CREATED, eventPayload); | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |                 eventService.emit(eventService.ENTITY_CHANGED, eventPayload); | ||||||
|  |             } | ||||||
|  |         }); | ||||||
|  |  | ||||||
|  |         return this; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 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. | ||||||
|  |      * | ||||||
|  |      * @param [deleteId=null] | ||||||
|  |      */ | ||||||
|  |     markAsDeleted(deleteId = null) { | ||||||
|  |         const entityId = this[this.constructor.primaryKeyName]; | ||||||
|  |         const entityName = this.constructor.entityName; | ||||||
|  |  | ||||||
|  |         this.utcDateModified = dateUtils.utcNowDateTime(); | ||||||
|  |  | ||||||
|  |         sql.execute(`UPDATE ${entityName} SET isDeleted = 1, deleteId = ?, utcDateModified = ? | ||||||
|  |                            WHERE ${this.constructor.primaryKeyName} = ?`, | ||||||
|  |             [deleteId, this.utcDateModified, entityId]); | ||||||
|  |  | ||||||
|  |         if (this.dateModified) { | ||||||
|  |             this.dateModified = dateUtils.localNowDateTime(); | ||||||
|  |  | ||||||
|  |             sql.execute(`UPDATE ${entityName} SET dateModified = ? WHERE ${this.constructor.primaryKeyName} = ?`, | ||||||
|  |                 [this.dateModified, entityId]); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         log.info(`Marking ${entityName} ${entityId} as deleted`); | ||||||
|  |  | ||||||
|  |         this.addEntityChange(true); | ||||||
|  |  | ||||||
|  |         eventService.emit(eventService.ENTITY_DELETED, { entityName, entityId, entity: this }); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     markAsDeletedSimple() { | ||||||
|  |         const entityId = this[this.constructor.primaryKeyName]; | ||||||
|  |         const entityName = this.constructor.entityName; | ||||||
|  |  | ||||||
|  |         this.utcDateModified = dateUtils.utcNowDateTime(); | ||||||
|  |  | ||||||
|  |         sql.execute(`UPDATE ${entityName} SET isDeleted = 1, utcDateModified = ? | ||||||
|  |                            WHERE ${this.constructor.primaryKeyName} = ?`, | ||||||
|  |             [this.utcDateModified, entityId]); | ||||||
|  |  | ||||||
|  |         log.info(`Marking ${entityName} ${entityId} as deleted`); | ||||||
|  |  | ||||||
|  |         this.addEntityChange(true); | ||||||
|  |  | ||||||
|  |         eventService.emit(eventService.ENTITY_DELETED, { entityName, entityId, entity: this }); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | module.exports = AbstractBeccaEntity; | ||||||
|  | </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="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> | ||||||
|  | </nav> | ||||||
|  |  | ||||||
|  | <br class="clear"> | ||||||
|  |  | ||||||
|  | <footer> | ||||||
|  |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
|  | </footer> | ||||||
|  |  | ||||||
|  | <script> prettyPrint(); </script> | ||||||
|  | <script src="scripts/linenumber.js"> </script> | ||||||
|  | </body> | ||||||
|  | </html> | ||||||
| @@ -1,85 +0,0 @@ | |||||||
| <!DOCTYPE html> |  | ||||||
| <html lang="en"> |  | ||||||
| <head> |  | ||||||
|     <meta charset="utf-8"> |  | ||||||
|     <title>JSDoc: Source: becca/entities/api_token.js</title> |  | ||||||
|  |  | ||||||
|     <script src="scripts/prettify/prettify.js"> </script> |  | ||||||
|     <script src="scripts/prettify/lang-css.js"> </script> |  | ||||||
|     <!--[if lt IE 9]> |  | ||||||
|       <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> |  | ||||||
|     <![endif]--> |  | ||||||
|     <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> |  | ||||||
|     <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> |  | ||||||
| </head> |  | ||||||
|  |  | ||||||
| <body> |  | ||||||
|  |  | ||||||
| <div id="main"> |  | ||||||
|  |  | ||||||
|     <h1 class="page-title">Source: becca/entities/api_token.js</h1> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <section> |  | ||||||
|         <article> |  | ||||||
|             <pre class="prettyprint source linenums"><code>"use strict"; |  | ||||||
|  |  | ||||||
| const dateUtils = require('../../services/date_utils.js'); |  | ||||||
| const AbstractEntity = require("./abstract_entity.js"); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * ApiToken is an entity representing token used to authenticate against Trilium API from client applications. Currently used only by Trilium Sender. |  | ||||||
|  */ |  | ||||||
| class ApiToken extends AbstractEntity { |  | ||||||
|     static get entityName() { return "api_tokens"; } |  | ||||||
|     static get primaryKeyName() { return "apiTokenId"; } |  | ||||||
|     static get hashedProperties() { return ["apiTokenId", "token", "utcDateCreated"]; } |  | ||||||
|  |  | ||||||
|     constructor(row) { |  | ||||||
|         super(); |  | ||||||
|  |  | ||||||
|         /** @type {string} */ |  | ||||||
|         this.apiTokenId = row.apiTokenId; |  | ||||||
|         /** @type {string} */ |  | ||||||
|         this.token = row.token; |  | ||||||
|         /** @type {string} */ |  | ||||||
|         this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime(); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     getPojo() { |  | ||||||
|         return { |  | ||||||
|             apiTokenId: this.apiTokenId, |  | ||||||
|             token: this.token, |  | ||||||
|             utcDateCreated: this.utcDateCreated |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| module.exports = ApiToken; |  | ||||||
| </code></pre> |  | ||||||
|         </article> |  | ||||||
|     </section> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| </div> |  | ||||||
|  |  | ||||||
| <nav> |  | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> |  | ||||||
| </nav> |  | ||||||
|  |  | ||||||
| <br class="clear"> |  | ||||||
|  |  | ||||||
| <footer> |  | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |  | ||||||
| </footer> |  | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> |  | ||||||
| <script src="scripts/linenumber.js"> </script> |  | ||||||
| </body> |  | ||||||
| </html> |  | ||||||
| @@ -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/attribute.js</title> |     <title>JSDoc: Source: becca/entities/battribute.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/attribute.js</h1> |     <h1 class="page-title">Source: becca/entities/battribute.js</h1> | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -28,17 +28,20 @@ | |||||||
|         <article> |         <article> | ||||||
|             <pre class="prettyprint source linenums"><code>"use strict"; |             <pre class="prettyprint source linenums"><code>"use strict"; | ||||||
| 
 | 
 | ||||||
| const Note = require('./note.js'); | const BNote = require('./bnote'); | ||||||
| const AbstractEntity = require("./abstract_entity.js"); | const AbstractBeccaEntity = require("./abstract_becca_entity"); | ||||||
| const sql = require("../../services/sql.js"); | const sql = require("../../services/sql"); | ||||||
| const dateUtils = require("../../services/date_utils.js"); | const dateUtils = require("../../services/date_utils"); | ||||||
| const promotedAttributeDefinitionParser = require("../../services/promoted_attribute_definition_parser"); | const promotedAttributeDefinitionParser = require("../../services/promoted_attribute_definition_parser"); | ||||||
|  | const {sanitizeAttributeName} = require("../../services/sanitize_attribute_name"); | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Attribute is an abstract concept which has two real uses - label (key - value pair) |  * Attribute is an abstract concept which has two real uses - label (key - value pair) | ||||||
|  * and relation (representing named relationship between source and target note) |  * and relation (representing named relationship between source and target note) | ||||||
|  |  * | ||||||
|  |  * @extends AbstractBeccaEntity | ||||||
|  */ |  */ | ||||||
| class Attribute extends AbstractEntity { | class BAttribute extends AbstractBeccaEntity { | ||||||
|     static get entityName() { return "attributes"; } |     static get entityName() { return "attributes"; } | ||||||
|     static get primaryKeyName() { return "attributeId"; } |     static get primaryKeyName() { return "attributeId"; } | ||||||
|     static get hashedProperties() { return ["attributeId", "noteId", "type", "name", "value", "isInheritable"]; } |     static get hashedProperties() { return ["attributeId", "noteId", "type", "name", "value", "isInheritable"]; } | ||||||
| @@ -79,7 +82,7 @@ class Attribute extends AbstractEntity { | |||||||
|         /** @type {int} */ |         /** @type {int} */ | ||||||
|         this.position = position; |         this.position = position; | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
|         this.value = value; |         this.value = value || ""; | ||||||
|         /** @type {boolean} */ |         /** @type {boolean} */ | ||||||
|         this.isInheritable = !!isInheritable; |         this.isInheritable = !!isInheritable; | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
| @@ -95,7 +98,7 @@ class Attribute extends AbstractEntity { | |||||||
| 
 | 
 | ||||||
|         if (!(this.noteId in this.becca.notes)) { |         if (!(this.noteId in this.becca.notes)) { | ||||||
|             // entities can come out of order in sync, create skeleton which will be filled later |             // entities can come out of order in sync, create skeleton which will be filled later | ||||||
|             this.becca.addNote(this.noteId, new Note({noteId: this.noteId})); |             this.becca.addNote(this.noteId, new BNote({noteId: this.noteId})); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         this.becca.notes[this.noteId].ownedAttributes.push(this); |         this.becca.notes[this.noteId].ownedAttributes.push(this); | ||||||
| @@ -111,9 +114,23 @@ class Attribute extends AbstractEntity { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     validate() { | ||||||
|  |         if (!["label", "relation"].includes(this.type)) { | ||||||
|  |             throw new Error(`Invalid attribute type '${this.type}' in attribute '${this.attributeId}' of note '${this.noteId}'`); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (!this.name?.trim()) { | ||||||
|  |             throw new Error(`Invalid empty name in attribute '${this.attributeId}' of note '${this.noteId}'`); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (this.type === 'relation' && !(this.value in this.becca.notes)) { | ||||||
|  |             throw new Error(`Cannot save relation '${this.name}' of note '${this.noteId}' since it target not existing note '${this.value}'.`); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     get isAffectingSubtree() { |     get isAffectingSubtree() { | ||||||
|         return this.isInheritable |         return this.isInheritable | ||||||
|             || (this.type === 'relation' && this.name === 'template'); |             || (this.type === 'relation' && ['template', 'inherit'].includes(this.name)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     get targetNoteId() { // alias |     get targetNoteId() { // alias | ||||||
| @@ -135,14 +152,20 @@ class Attribute extends AbstractEntity { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @returns {Note|null} |      * @returns {BNote|null} | ||||||
|      */ |      */ | ||||||
|     getNote() { |     getNote() { | ||||||
|         return this.becca.getNote(this.noteId); |         const note = this.becca.getNote(this.noteId); | ||||||
|  | 
 | ||||||
|  |         if (!note) { | ||||||
|  |             throw new Error(`Note '${this.noteId}' of attribute '${this.attributeId}', type '${this.type}', name '${this.name}' does not exist.`); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         return note; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @returns {Note|null} |      * @returns {BNote|null} | ||||||
|      */ |      */ | ||||||
|     getTargetNote() { |     getTargetNote() { | ||||||
|         if (this.type !== 'relation') { |         if (this.type !== 'relation') { | ||||||
| @@ -157,7 +180,7 @@ class Attribute extends AbstractEntity { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @return {boolean} |      * @returns {boolean} | ||||||
|      */ |      */ | ||||||
|     isDefinition() { |     isDefinition() { | ||||||
|         return this.type === 'label' && (this.name.startsWith('label:') || this.name.startsWith('relation:')); |         return this.type === 'label' && (this.name.startsWith('label:') || this.name.startsWith('relation:')); | ||||||
| @@ -181,12 +204,14 @@ class Attribute extends AbstractEntity { | |||||||
|         return !(this.attributeId in this.becca.attributes); |         return !(this.attributeId in this.becca.attributes); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     beforeSaving() { |     beforeSaving(opts = {}) { | ||||||
|         if (!this.value) { |         if (!opts.skipValidation) { | ||||||
|             if (this.type === 'relation') { |             this.validate(); | ||||||
|                 throw new Error(`Cannot save relation ${this.name} since it does not target any note.`); |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         this.name = sanitizeAttributeName(this.name); | ||||||
|  | 
 | ||||||
|  |         if (!this.value) { | ||||||
|             // null value isn't allowed |             // null value isn't allowed | ||||||
|             this.value = ""; |             this.value = ""; | ||||||
|         } |         } | ||||||
| @@ -222,7 +247,7 @@ class Attribute extends AbstractEntity { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     createClone(type, name, value, isInheritable) { |     createClone(type, name, value, isInheritable) { | ||||||
|         return new Attribute({ |         return new BAttribute({ | ||||||
|             noteId: this.noteId, |             noteId: this.noteId, | ||||||
|             type: type, |             type: type, | ||||||
|             name: name, |             name: name, | ||||||
| @@ -234,7 +259,7 @@ class Attribute extends AbstractEntity { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| module.exports = Attribute; | module.exports = BAttribute; | ||||||
| </code></pre> | </code></pre> | ||||||
|         </article> |         </article> | ||||||
|     </section> |     </section> | ||||||
| @@ -245,13 +270,13 @@ module.exports = Attribute; | |||||||
| </div> | </div> | ||||||
| 
 | 
 | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> |     <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> | ||||||
| </nav> | </nav> | ||||||
| 
 | 
 | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
| 
 | 
 | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
| 
 | 
 | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
							
								
								
									
										328
									
								
								docs/backend_api/becca_entities_bbranch.js.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										328
									
								
								docs/backend_api/becca_entities_bbranch.js.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,328 @@ | |||||||
|  | <!DOCTYPE html> | ||||||
|  | <html lang="en"> | ||||||
|  | <head> | ||||||
|  |     <meta charset="utf-8"> | ||||||
|  |     <title>JSDoc: Source: becca/entities/bbranch.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/bbranch.js</h1> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <section> | ||||||
|  |         <article> | ||||||
|  |             <pre class="prettyprint source linenums"><code>"use strict"; | ||||||
|  |  | ||||||
|  | const BNote = require('./bnote'); | ||||||
|  | const AbstractBeccaEntity = require("./abstract_becca_entity"); | ||||||
|  | const dateUtils = require("../../services/date_utils"); | ||||||
|  | const utils = require("../../services/utils"); | ||||||
|  | const TaskContext = require("../../services/task_context"); | ||||||
|  | const cls = require("../../services/cls"); | ||||||
|  | const log = require("../../services/log"); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple | ||||||
|  |  * parents. | ||||||
|  |  * | ||||||
|  |  * Note that you should not rely on the branch's identity, since it can change easily with a note's move. | ||||||
|  |  * Always check noteId instead. | ||||||
|  |  * | ||||||
|  |  * @extends AbstractBeccaEntity | ||||||
|  |  */ | ||||||
|  | class BBranch extends AbstractBeccaEntity { | ||||||
|  |     static get entityName() { return "branches"; } | ||||||
|  |     static get primaryKeyName() { return "branchId"; } | ||||||
|  |     // notePosition is not part of hash because it would produce a lot of updates in case of reordering | ||||||
|  |     static get hashedProperties() { return ["branchId", "noteId", "parentNoteId", "prefix"]; } | ||||||
|  |  | ||||||
|  |     constructor(row) { | ||||||
|  |         super(); | ||||||
|  |  | ||||||
|  |         if (!row) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         this.updateFromRow(row); | ||||||
|  |         this.init(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     updateFromRow(row) { | ||||||
|  |         this.update([ | ||||||
|  |             row.branchId, | ||||||
|  |             row.noteId, | ||||||
|  |             row.parentNoteId, | ||||||
|  |             row.prefix, | ||||||
|  |             row.notePosition, | ||||||
|  |             row.isExpanded, | ||||||
|  |             row.utcDateModified | ||||||
|  |         ]); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     update([branchId, noteId, parentNoteId, prefix, notePosition, isExpanded, utcDateModified]) { | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.branchId = branchId; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.noteId = noteId; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.parentNoteId = parentNoteId; | ||||||
|  |         /** @type {string|null} */ | ||||||
|  |         this.prefix = prefix; | ||||||
|  |         /** @type {int} */ | ||||||
|  |         this.notePosition = notePosition; | ||||||
|  |         /** @type {boolean} */ | ||||||
|  |         this.isExpanded = !!isExpanded; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.utcDateModified = utcDateModified; | ||||||
|  |  | ||||||
|  |         return this; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     init() { | ||||||
|  |         if (this.branchId) { | ||||||
|  |             this.becca.branches[this.branchId] = this; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         this.becca.childParentToBranch[`${this.noteId}-${this.parentNoteId}`] = this; | ||||||
|  |  | ||||||
|  |         const childNote = this.childNote; | ||||||
|  |  | ||||||
|  |         if (!childNote.parentBranches.includes(this)) { | ||||||
|  |             childNote.parentBranches.push(this); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (this.noteId === 'root') { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         const parentNote = this.parentNote; | ||||||
|  |  | ||||||
|  |         if (!childNote.parents.includes(parentNote)) { | ||||||
|  |             childNote.parents.push(parentNote); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (!parentNote.children.includes(childNote)) { | ||||||
|  |             parentNote.children.push(childNote); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @returns {BNote} */ | ||||||
|  |     get childNote() { | ||||||
|  |         if (!(this.noteId in this.becca.notes)) { | ||||||
|  |             // entities can come out of order in sync/import, create skeleton which will be filled later | ||||||
|  |             this.becca.addNote(this.noteId, new BNote({noteId: this.noteId})); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return this.becca.notes[this.noteId]; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     getNote() { | ||||||
|  |         return this.childNote; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** @returns {BNote|undefined} - root branch will have undefined parent, all other branches have to have a parent note */ | ||||||
|  |     get parentNote() { | ||||||
|  |         if (!(this.parentNoteId in this.becca.notes) && this.parentNoteId !== 'none') { | ||||||
|  |             // entities can come out of order in sync/import, create skeleton which will be filled later | ||||||
|  |             this.becca.addNote(this.parentNoteId, new BNote({noteId: this.parentNoteId})); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return this.becca.notes[this.parentNoteId]; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     get isDeleted() { | ||||||
|  |         return !(this.branchId in this.becca.branches); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Branch is weak when its existence should not hinder deletion of its note. | ||||||
|  |      * As a result, note with only weak branches should be immediately deleted. | ||||||
|  |      * An example is shared or bookmarked clones - they are created automatically and exist for technical reasons, | ||||||
|  |      * not as user-intended actions. From user perspective, they don't count as real clones and for the purpose | ||||||
|  |      * of deletion should not act as a clone. | ||||||
|  |      * | ||||||
|  |      * @returns {boolean} | ||||||
|  |      */ | ||||||
|  |     get isWeak() { | ||||||
|  |         return ['_share', '_lbBookmarks'].includes(this.parentNoteId); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Delete a branch. If this is a last note's branch, delete the note as well. | ||||||
|  |      * | ||||||
|  |      * @param {string} [deleteId] - optional delete identified | ||||||
|  |      * @param {TaskContext} [taskContext] | ||||||
|  |      * | ||||||
|  |      * @returns {boolean} - true if note has been deleted, false otherwise | ||||||
|  |      */ | ||||||
|  |     deleteBranch(deleteId, taskContext) { | ||||||
|  |         if (!deleteId) { | ||||||
|  |             deleteId = utils.randomString(10); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (!taskContext) { | ||||||
|  |             taskContext = new TaskContext('no-progress-reporting'); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         taskContext.increaseProgressCount(); | ||||||
|  |  | ||||||
|  |         const note = this.getNote(); | ||||||
|  |  | ||||||
|  |         if (!taskContext.noteDeletionHandlerTriggered) { | ||||||
|  |             const parentBranches = note.getParentBranches(); | ||||||
|  |  | ||||||
|  |             if (parentBranches.length === 1 && parentBranches[0] === this) { | ||||||
|  |                 // needs to be run before branches and attributes are deleted and thus attached relations disappear | ||||||
|  |                 const handlers = require("../../services/handlers"); | ||||||
|  |                 handlers.runAttachedRelations(note, 'runOnNoteDeletion', note); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (this.noteId === 'root' | ||||||
|  |             || this.noteId === cls.getHoistedNoteId()) { | ||||||
|  |  | ||||||
|  |             throw new Error("Can't delete root or hoisted branch/note"); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         this.markAsDeleted(deleteId); | ||||||
|  |  | ||||||
|  |         const notDeletedBranches = note.getStrongParentBranches(); | ||||||
|  |  | ||||||
|  |         if (notDeletedBranches.length === 0) { | ||||||
|  |             for (const weakBranch of note.getParentBranches()) { | ||||||
|  |                 weakBranch.markAsDeleted(deleteId); | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             for (const childBranch of note.getChildBranches()) { | ||||||
|  |                 childBranch.deleteBranch(deleteId, taskContext); | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             // first delete children and then parent - this will show up better in recent changes | ||||||
|  |  | ||||||
|  |             log.info(`Deleting note ${note.noteId}`); | ||||||
|  |  | ||||||
|  |             this.becca.notes[note.noteId].isBeingDeleted = true; | ||||||
|  |  | ||||||
|  |             for (const attribute of note.getOwnedAttributes()) { | ||||||
|  |                 attribute.markAsDeleted(deleteId); | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             for (const relation of note.getTargetRelations()) { | ||||||
|  |                 relation.markAsDeleted(deleteId); | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             note.markAsDeleted(deleteId); | ||||||
|  |  | ||||||
|  |             return true; | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     beforeSaving() { | ||||||
|  |         if (!this.noteId || !this.parentNoteId) { | ||||||
|  |             throw new Error(`noteId and parentNoteId are mandatory properties for Branch`); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         this.branchId = `${this.parentNoteId}_${this.noteId}`; | ||||||
|  |  | ||||||
|  |         if (this.notePosition === undefined || this.notePosition === null) { | ||||||
|  |             let maxNotePos = 0; | ||||||
|  |  | ||||||
|  |             for (const childBranch of this.parentNote.getChildBranches()) { | ||||||
|  |                 if (maxNotePos < childBranch.notePosition | ||||||
|  |                     && childBranch.noteId !== '_hidden' // hidden has very large notePosition to always stay last | ||||||
|  |                 ) { | ||||||
|  |                     maxNotePos = childBranch.notePosition; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             this.notePosition = maxNotePos + 10; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (!this.isExpanded) { | ||||||
|  |             this.isExpanded = false; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (!this.prefix?.trim()) { | ||||||
|  |             this.prefix = null; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         this.utcDateModified = dateUtils.utcNowDateTime(); | ||||||
|  |  | ||||||
|  |         super.beforeSaving(); | ||||||
|  |  | ||||||
|  |         this.becca.branches[this.branchId] = this; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     getPojo() { | ||||||
|  |         return { | ||||||
|  |             branchId: this.branchId, | ||||||
|  |             noteId: this.noteId, | ||||||
|  |             parentNoteId: this.parentNoteId, | ||||||
|  |             prefix: this.prefix, | ||||||
|  |             notePosition: this.notePosition, | ||||||
|  |             isExpanded: this.isExpanded, | ||||||
|  |             isDeleted: false, | ||||||
|  |             utcDateModified: this.utcDateModified | ||||||
|  |         }; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     createClone(parentNoteId, notePosition) { | ||||||
|  |         const existingBranch = this.becca.getBranchFromChildAndParent(this.noteId, parentNoteId); | ||||||
|  |  | ||||||
|  |         if (existingBranch) { | ||||||
|  |             existingBranch.notePosition = notePosition; | ||||||
|  |             return existingBranch; | ||||||
|  |         } else { | ||||||
|  |             return new BBranch({ | ||||||
|  |                 noteId: this.noteId, | ||||||
|  |                 parentNoteId: parentNoteId, | ||||||
|  |                 notePosition: notePosition, | ||||||
|  |                 prefix: this.prefix, | ||||||
|  |                 isExpanded: this.isExpanded | ||||||
|  |             }); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | module.exports = BBranch; | ||||||
|  | </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="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> | ||||||
|  | </nav> | ||||||
|  |  | ||||||
|  | <br class="clear"> | ||||||
|  |  | ||||||
|  | <footer> | ||||||
|  |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
|  | </footer> | ||||||
|  |  | ||||||
|  | <script> prettyPrint(); </script> | ||||||
|  | <script src="scripts/linenumber.js"> </script> | ||||||
|  | </body> | ||||||
|  | </html> | ||||||
							
								
								
									
										129
									
								
								docs/backend_api/becca_entities_betapi_token.js.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										129
									
								
								docs/backend_api/becca_entities_betapi_token.js.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,129 @@ | |||||||
|  | <!DOCTYPE html> | ||||||
|  | <html lang="en"> | ||||||
|  | <head> | ||||||
|  |     <meta charset="utf-8"> | ||||||
|  |     <title>JSDoc: Source: becca/entities/betapi_token.js</title> | ||||||
|  |  | ||||||
|  |     <script src="scripts/prettify/prettify.js"> </script> | ||||||
|  |     <script src="scripts/prettify/lang-css.js"> </script> | ||||||
|  |     <!--[if lt IE 9]> | ||||||
|  |       <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||||||
|  |     <![endif]--> | ||||||
|  |     <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||||||
|  |     <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||||||
|  | </head> | ||||||
|  |  | ||||||
|  | <body> | ||||||
|  |  | ||||||
|  | <div id="main"> | ||||||
|  |  | ||||||
|  |     <h1 class="page-title">Source: becca/entities/betapi_token.js</h1> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <section> | ||||||
|  |         <article> | ||||||
|  |             <pre class="prettyprint source linenums"><code>"use strict"; | ||||||
|  |  | ||||||
|  | const dateUtils = require('../../services/date_utils'); | ||||||
|  | const AbstractBeccaEntity = require("./abstract_becca_entity"); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * EtapiToken is an entity representing token used to authenticate against Trilium REST API from client applications. | ||||||
|  |  * Used by: | ||||||
|  |  * - Trilium Sender | ||||||
|  |  * - ETAPI clients | ||||||
|  |  * | ||||||
|  |  * The format user is presented with is "<etapiTokenId>_<tokenHash>". This is also called "authToken" to distinguish it | ||||||
|  |  * from tokenHash and token. | ||||||
|  |  * | ||||||
|  |  * @extends AbstractBeccaEntity | ||||||
|  |  */ | ||||||
|  | class BEtapiToken extends AbstractBeccaEntity { | ||||||
|  |     static get entityName() { return "etapi_tokens"; } | ||||||
|  |     static get primaryKeyName() { return "etapiTokenId"; } | ||||||
|  |     static get hashedProperties() { return ["etapiTokenId", "name", "tokenHash", "utcDateCreated", "utcDateModified", "isDeleted"]; } | ||||||
|  |  | ||||||
|  |     constructor(row) { | ||||||
|  |         super(); | ||||||
|  |  | ||||||
|  |         if (!row) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         this.updateFromRow(row); | ||||||
|  |         this.init(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     updateFromRow(row) { | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.etapiTokenId = row.etapiTokenId; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.name = row.name; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.tokenHash = row.tokenHash; | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime(); | ||||||
|  |         /** @type {string} */ | ||||||
|  |         this.utcDateModified = row.utcDateModified || this.utcDateCreated; | ||||||
|  |         /** @type {boolean} */ | ||||||
|  |         this.isDeleted = !!row.isDeleted; | ||||||
|  |  | ||||||
|  |         if (this.etapiTokenId) { | ||||||
|  |             this.becca.etapiTokens[this.etapiTokenId] = this; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     init() { | ||||||
|  |         if (this.etapiTokenId) { | ||||||
|  |             this.becca.etapiTokens[this.etapiTokenId] = this; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     getPojo() { | ||||||
|  |         return { | ||||||
|  |             etapiTokenId: this.etapiTokenId, | ||||||
|  |             name: this.name, | ||||||
|  |             tokenHash: this.tokenHash, | ||||||
|  |             utcDateCreated: this.utcDateCreated, | ||||||
|  |             utcDateModified: this.utcDateModified, | ||||||
|  |             isDeleted: this.isDeleted | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     beforeSaving() { | ||||||
|  |         this.utcDateModified = dateUtils.utcNowDateTime(); | ||||||
|  |  | ||||||
|  |         super.beforeSaving(); | ||||||
|  |  | ||||||
|  |         this.becca.etapiTokens[this.etapiTokenId] = this; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | module.exports = BEtapiToken; | ||||||
|  | </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="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> | ||||||
|  | </nav> | ||||||
|  |  | ||||||
|  | <br class="clear"> | ||||||
|  |  | ||||||
|  | <footer> | ||||||
|  |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
|  | </footer> | ||||||
|  |  | ||||||
|  | <script> prettyPrint(); </script> | ||||||
|  | <script src="scripts/linenumber.js"> </script> | ||||||
|  | </body> | ||||||
|  | </html> | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -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/note_revision.js</title> |     <title>JSDoc: Source: becca/entities/bnote_revision.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/note_revision.js</h1> |     <h1 class="page-title">Source: becca/entities/bnote_revision.js</h1> | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -32,20 +32,22 @@ const protectedSessionService = require('../../services/protected_session'); | |||||||
| const utils = require('../../services/utils'); | const utils = require('../../services/utils'); | ||||||
| const sql = require('../../services/sql'); | const sql = require('../../services/sql'); | ||||||
| const dateUtils = require('../../services/date_utils'); | const dateUtils = require('../../services/date_utils'); | ||||||
| const becca = require('../becca.js'); | const becca = require('../becca'); | ||||||
| const entityChangesService = require('../../services/entity_changes'); | const entityChangesService = require('../../services/entity_changes'); | ||||||
| const AbstractEntity = require("./abstract_entity.js"); | const AbstractBeccaEntity = require("./abstract_becca_entity"); | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * NoteRevision represents snapshot of note's title and content at some point in the past. |  * NoteRevision represents 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 | ||||||
|  */ |  */ | ||||||
| class NoteRevision extends AbstractEntity { | class BNoteRevision extends AbstractBeccaEntity { | ||||||
|     static get entityName() { return "note_revisions"; } |     static get entityName() { return "note_revisions"; } | ||||||
|     static get primaryKeyName() { return "noteRevisionId"; } |     static get primaryKeyName() { return "noteRevisionId"; } | ||||||
|     static get hashedProperties() { return ["noteRevisionId", "noteId", "title", "isProtected", "dateLastEdited", "dateCreated", "utcDateLastEdited", "utcDateCreated", "utcDateModified"]; } |     static get hashedProperties() { return ["noteRevisionId", "noteId", "title", "isProtected", "dateLastEdited", "dateCreated", "utcDateLastEdited", "utcDateCreated", "utcDateModified"]; } | ||||||
| 
 | 
 | ||||||
|     constructor(row) { |     constructor(row, titleDecrypted = false) { | ||||||
|         super(); |         super(); | ||||||
| 
 | 
 | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
| @@ -73,13 +75,10 @@ class NoteRevision extends AbstractEntity { | |||||||
|         /** @type {number} */ |         /** @type {number} */ | ||||||
|         this.contentLength = row.contentLength; |         this.contentLength = row.contentLength; | ||||||
| 
 | 
 | ||||||
|         if (this.isProtected) { |         if (this.isProtected && !titleDecrypted) { | ||||||
|             if (protectedSessionService.isProtectedSessionAvailable()) { |             this.title = protectedSessionService.isProtectedSessionAvailable() | ||||||
|                 this.title = protectedSessionService.decryptString(this.title); |                 ? protectedSessionService.decryptString(this.title) | ||||||
|             } |                 : "[protected]"; | ||||||
|             else { |  | ||||||
|                 this.title = "[protected]"; |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -94,8 +93,8 @@ class NoteRevision extends AbstractEntity { | |||||||
| 
 | 
 | ||||||
|     /* |     /* | ||||||
|      * 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 it's own sync. Reason behind this hybrid design is that |      * part of NoteRevision entity with its own sync. Reason behind this hybrid design is that | ||||||
|      * content can be quite large and it's not necessary to load it / fill memory for any note access even |      * 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. | ||||||
| @@ -110,7 +109,7 @@ class NoteRevision extends AbstractEntity { | |||||||
|                 return undefined; |                 return undefined; | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
|                 throw new Error("Cannot find note revision content for noteRevisionId=" + this.noteRevisionId); |                 throw new Error(`Cannot find note revision content for noteRevisionId=${this.noteRevisionId}`); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| @@ -135,7 +134,7 @@ class NoteRevision extends AbstractEntity { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     setContent(content, ignoreMissingProtectedSession = false) { |     setContent(content) { | ||||||
|         const pojo = { |         const pojo = { | ||||||
|             noteRevisionId: this.noteRevisionId, |             noteRevisionId: this.noteRevisionId, | ||||||
|             content: content, |             content: content, | ||||||
| @@ -146,14 +145,14 @@ class NoteRevision extends AbstractEntity { | |||||||
|             if (protectedSessionService.isProtectedSessionAvailable()) { |             if (protectedSessionService.isProtectedSessionAvailable()) { | ||||||
|                 pojo.content = protectedSessionService.encrypt(pojo.content); |                 pojo.content = protectedSessionService.encrypt(pojo.content); | ||||||
|             } |             } | ||||||
|             else if (!ignoreMissingProtectedSession) { |             else { | ||||||
|                 throw new Error(`Cannot update content of noteRevisionId=${this.noteRevisionId} since we're out of protected session.`); |                 throw new Error(`Cannot update content of noteRevisionId=${this.noteRevisionId} since we're out of protected session.`); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         sql.upsert("note_revision_contents", "noteRevisionId", pojo); |         sql.upsert("note_revision_contents", "noteRevisionId", pojo); | ||||||
| 
 | 
 | ||||||
|         const hash = utils.hash(this.noteRevisionId + "|" + pojo.content.toString()); |         const hash = utils.hash(`${this.noteRevisionId}|${pojo.content.toString()}`); | ||||||
| 
 | 
 | ||||||
|         entityChangesService.addEntityChange({ |         entityChangesService.addEntityChange({ | ||||||
|             entityName: 'note_revision_contents', |             entityName: 'note_revision_contents', | ||||||
| @@ -195,14 +194,12 @@ class NoteRevision extends AbstractEntity { | |||||||
|             utcDateLastEdited: this.utcDateLastEdited, |             utcDateLastEdited: this.utcDateLastEdited, | ||||||
|             utcDateCreated: this.utcDateCreated, |             utcDateCreated: this.utcDateCreated, | ||||||
|             utcDateModified: this.utcDateModified, |             utcDateModified: this.utcDateModified, | ||||||
|             content: this.content, |  | ||||||
|             contentLength: this.contentLength |             contentLength: this.contentLength | ||||||
|         }; |         }; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     getPojoToSave() { |     getPojoToSave() { | ||||||
|         const pojo = this.getPojo(); |         const pojo = this.getPojo(); | ||||||
|         delete pojo.content; // not getting persisted |  | ||||||
|         delete pojo.contentLength; // not getting persisted |         delete pojo.contentLength; // not getting persisted | ||||||
| 
 | 
 | ||||||
|         if (pojo.isProtected) { |         if (pojo.isProtected) { | ||||||
| @@ -219,7 +216,7 @@ class NoteRevision extends AbstractEntity { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| module.exports = NoteRevision; | module.exports = BNoteRevision; | ||||||
| </code></pre> | </code></pre> | ||||||
|         </article> |         </article> | ||||||
|     </section> |     </section> | ||||||
| @@ -230,13 +227,13 @@ module.exports = NoteRevision; | |||||||
| </div> | </div> | ||||||
| 
 | 
 | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> |     <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> | ||||||
| </nav> | </nav> | ||||||
| 
 | 
 | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
| 
 | 
 | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
| 
 | 
 | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
| @@ -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/option.js</title> |     <title>JSDoc: Source: becca/entities/boption.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/option.js</h1> |     <h1 class="page-title">Source: becca/entities/boption.js</h1> | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -28,13 +28,15 @@ | |||||||
|         <article> |         <article> | ||||||
|             <pre class="prettyprint source linenums"><code>"use strict"; |             <pre class="prettyprint source linenums"><code>"use strict"; | ||||||
| 
 | 
 | ||||||
| const dateUtils = require('../../services/date_utils.js'); | const dateUtils = require('../../services/date_utils'); | ||||||
| const AbstractEntity = require("./abstract_entity.js"); | const AbstractBeccaEntity = require("./abstract_becca_entity"); | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Option represents name-value pair, either directly configurable by the user or some system property. |  * Option represents name-value pair, either directly configurable by the user or some system property. | ||||||
|  |  * | ||||||
|  |  * @extends AbstractBeccaEntity | ||||||
|  */ |  */ | ||||||
| class Option extends AbstractEntity { | class BOption extends AbstractBeccaEntity { | ||||||
|     static get entityName() { return "options"; } |     static get entityName() { return "options"; } | ||||||
|     static get primaryKeyName() { return "name"; } |     static get primaryKeyName() { return "name"; } | ||||||
|     static get hashedProperties() { return ["name", "value"]; } |     static get hashedProperties() { return ["name", "value"]; } | ||||||
| @@ -65,14 +67,12 @@ class Option extends AbstractEntity { | |||||||
|             name: this.name, |             name: this.name, | ||||||
|             value: this.value, |             value: this.value, | ||||||
|             isSynced: this.isSynced, |             isSynced: this.isSynced, | ||||||
|             utcDateModified: this.utcDateModified, |             utcDateModified: this.utcDateModified | ||||||
|             // utcDateCreated is scheduled for removal so the value does not matter |  | ||||||
|             utcDateCreated: dateUtils.utcNowDateTime() |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| module.exports = Option; | module.exports = BOption; | ||||||
| </code></pre> | </code></pre> | ||||||
|         </article> |         </article> | ||||||
|     </section> |     </section> | ||||||
| @@ -83,13 +83,13 @@ module.exports = Option; | |||||||
| </div> | </div> | ||||||
| 
 | 
 | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> |     <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> | ||||||
| </nav> | </nav> | ||||||
| 
 | 
 | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
| 
 | 
 | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
| 
 | 
 | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
| @@ -1,207 +0,0 @@ | |||||||
| <!DOCTYPE html> |  | ||||||
| <html lang="en"> |  | ||||||
| <head> |  | ||||||
|     <meta charset="utf-8"> |  | ||||||
|     <title>JSDoc: Source: becca/entities/branch.js</title> |  | ||||||
|  |  | ||||||
|     <script src="scripts/prettify/prettify.js"> </script> |  | ||||||
|     <script src="scripts/prettify/lang-css.js"> </script> |  | ||||||
|     <!--[if lt IE 9]> |  | ||||||
|       <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> |  | ||||||
|     <![endif]--> |  | ||||||
|     <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> |  | ||||||
|     <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> |  | ||||||
| </head> |  | ||||||
|  |  | ||||||
| <body> |  | ||||||
|  |  | ||||||
| <div id="main"> |  | ||||||
|  |  | ||||||
|     <h1 class="page-title">Source: becca/entities/branch.js</h1> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <section> |  | ||||||
|         <article> |  | ||||||
|             <pre class="prettyprint source linenums"><code>"use strict"; |  | ||||||
|  |  | ||||||
| const Note = require('./note.js'); |  | ||||||
| const AbstractEntity = require("./abstract_entity.js"); |  | ||||||
| const sql = require("../../services/sql.js"); |  | ||||||
| const dateUtils = require("../../services/date_utils.js"); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple |  | ||||||
|  * parents. |  | ||||||
|  */ |  | ||||||
| class Branch extends AbstractEntity { |  | ||||||
|     static get entityName() { return "branches"; } |  | ||||||
|     static get primaryKeyName() { return "branchId"; } |  | ||||||
|     // notePosition is not part of hash because it would produce a lot of updates in case of reordering |  | ||||||
|     static get hashedProperties() { return ["branchId", "noteId", "parentNoteId", "prefix"]; } |  | ||||||
|  |  | ||||||
|     constructor(row) { |  | ||||||
|         super(); |  | ||||||
|  |  | ||||||
|         if (!row) { |  | ||||||
|             return; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         this.updateFromRow(row); |  | ||||||
|         this.init(); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     updateFromRow(row) { |  | ||||||
|         this.update([ |  | ||||||
|             row.branchId, |  | ||||||
|             row.noteId, |  | ||||||
|             row.parentNoteId, |  | ||||||
|             row.prefix, |  | ||||||
|             row.notePosition, |  | ||||||
|             row.isExpanded, |  | ||||||
|             row.utcDateModified |  | ||||||
|         ]); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     update([branchId, noteId, parentNoteId, prefix, notePosition, isExpanded, utcDateModified]) { |  | ||||||
|         /** @type {string} */ |  | ||||||
|         this.branchId = branchId; |  | ||||||
|         /** @type {string} */ |  | ||||||
|         this.noteId = noteId; |  | ||||||
|         /** @type {string} */ |  | ||||||
|         this.parentNoteId = parentNoteId; |  | ||||||
|         /** @type {string} */ |  | ||||||
|         this.prefix = prefix; |  | ||||||
|         /** @type {int} */ |  | ||||||
|         this.notePosition = notePosition; |  | ||||||
|         /** @type {boolean} */ |  | ||||||
|         this.isExpanded = !!isExpanded; |  | ||||||
|         /** @type {string} */ |  | ||||||
|         this.utcDateModified = utcDateModified; |  | ||||||
|  |  | ||||||
|         return this; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     init() { |  | ||||||
|         if (this.branchId === 'root') { |  | ||||||
|             return; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         const childNote = this.childNote; |  | ||||||
|         const parentNote = this.parentNote; |  | ||||||
|  |  | ||||||
|         if (!childNote.parents.includes(parentNote)) { |  | ||||||
|             childNote.parents.push(parentNote); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (!childNote.parentBranches.includes(this)) { |  | ||||||
|             childNote.parentBranches.push(this); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (!parentNote.children.includes(childNote)) { |  | ||||||
|             parentNote.children.push(childNote); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         this.becca.branches[this.branchId] = this; |  | ||||||
|         this.becca.childParentToBranch[`${this.noteId}-${this.parentNoteId}`] = this; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** @returns {Note} */ |  | ||||||
|     get childNote() { |  | ||||||
|         if (!(this.noteId in this.becca.notes)) { |  | ||||||
|             // entities can come out of order in sync, create skeleton which will be filled later |  | ||||||
|             this.becca.addNote(this.noteId, new Note({noteId: this.noteId})); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         return this.becca.notes[this.noteId]; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     getNote() { |  | ||||||
|         return this.childNote; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** @returns {Note} */ |  | ||||||
|     get parentNote() { |  | ||||||
|         if (!(this.parentNoteId in this.becca.notes)) { |  | ||||||
|             // entities can come out of order in sync, create skeleton which will be filled later |  | ||||||
|             this.becca.addNote(this.parentNoteId, new Note({noteId: this.parentNoteId})); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         return this.becca.notes[this.parentNoteId]; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     get isDeleted() { |  | ||||||
|         return !(this.branchId in this.becca.branches); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     beforeSaving() { |  | ||||||
|         if (this.notePosition === undefined || this.notePosition === null) { |  | ||||||
|             // TODO finding new position can be refactored into becca |  | ||||||
|             const maxNotePos = sql.getValue('SELECT MAX(notePosition) FROM branches WHERE parentNoteId = ? AND isDeleted = 0', [this.parentNoteId]); |  | ||||||
|             this.notePosition = maxNotePos === null ? 0 : maxNotePos + 10; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (!this.isExpanded) { |  | ||||||
|             this.isExpanded = false; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         this.utcDateModified = dateUtils.utcNowDateTime(); |  | ||||||
|  |  | ||||||
|         super.beforeSaving(); |  | ||||||
|  |  | ||||||
|         this.becca.branches[this.branchId] = this; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     getPojo() { |  | ||||||
|         return { |  | ||||||
|             branchId: this.branchId, |  | ||||||
|             noteId: this.noteId, |  | ||||||
|             parentNoteId: this.parentNoteId, |  | ||||||
|             prefix: this.prefix, |  | ||||||
|             notePosition: this.notePosition, |  | ||||||
|             isExpanded: this.isExpanded, |  | ||||||
|             isDeleted: false, |  | ||||||
|             utcDateModified: this.utcDateModified, |  | ||||||
|             // not used for anything, will be later dropped |  | ||||||
|             utcDateCreated: dateUtils.utcNowDateTime() |  | ||||||
|         }; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     createClone(parentNoteId, notePosition) { |  | ||||||
|         return new Branch({ |  | ||||||
|             noteId: this.noteId, |  | ||||||
|             parentNoteId: parentNoteId, |  | ||||||
|             notePosition: notePosition, |  | ||||||
|             prefix: this.prefix, |  | ||||||
|             isExpanded: this.isExpanded |  | ||||||
|         }); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| module.exports = Branch; |  | ||||||
| </code></pre> |  | ||||||
|         </article> |  | ||||||
|     </section> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| </div> |  | ||||||
|  |  | ||||||
| <nav> |  | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> |  | ||||||
| </nav> |  | ||||||
|  |  | ||||||
| <br class="clear"> |  | ||||||
|  |  | ||||||
| <footer> |  | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |  | ||||||
| </footer> |  | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> |  | ||||||
| <script src="scripts/linenumber.js"> </script> |  | ||||||
| </body> |  | ||||||
| </html> |  | ||||||
| @@ -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/recent_note.js</title> |     <title>JSDoc: Source: becca/entities/brecent_note.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/recent_note.js</h1> |     <h1 class="page-title">Source: becca/entities/brecent_note.js</h1> | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -28,13 +28,15 @@ | |||||||
|         <article> |         <article> | ||||||
|             <pre class="prettyprint source linenums"><code>"use strict"; |             <pre class="prettyprint source linenums"><code>"use strict"; | ||||||
| 
 | 
 | ||||||
| const dateUtils = require('../../services/date_utils.js'); | const dateUtils = require('../../services/date_utils'); | ||||||
| const AbstractEntity = require("./abstract_entity.js"); | const AbstractBeccaEntity = require("./abstract_becca_entity"); | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * RecentNote represents recently visited note. |  * RecentNote represents recently visited note. | ||||||
|  |  * | ||||||
|  |  * @extends AbstractBeccaEntity | ||||||
|  */ |  */ | ||||||
| class RecentNote extends AbstractEntity { | class BRecentNote extends AbstractBeccaEntity { | ||||||
|     static get entityName() { return "recent_notes"; } |     static get entityName() { return "recent_notes"; } | ||||||
|     static get primaryKeyName() { return "noteId"; } |     static get primaryKeyName() { return "noteId"; } | ||||||
| 
 | 
 | ||||||
| @@ -58,7 +60,7 @@ class RecentNote extends AbstractEntity { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| module.exports = RecentNote; | module.exports = BRecentNote; | ||||||
| </code></pre> | </code></pre> | ||||||
|         </article> |         </article> | ||||||
|     </section> |     </section> | ||||||
| @@ -69,13 +71,13 @@ module.exports = RecentNote; | |||||||
| </div> | </div> | ||||||
| 
 | 
 | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> |     <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> | ||||||
| </nav> | </nav> | ||||||
| 
 | 
 | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
| 
 | 
 | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
| 
 | 
 | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -50,13 +50,13 @@ | |||||||
| </div> | </div> | ||||||
|  |  | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> |     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="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> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -28,8 +28,6 @@ | |||||||
|  |  | ||||||
| <header> | <header> | ||||||
|      |      | ||||||
|          |  | ||||||
|      |  | ||||||
| </header> | </header> | ||||||
|  |  | ||||||
| <article> | <article> | ||||||
| @@ -39,6 +37,50 @@ | |||||||
|  |  | ||||||
|          |          | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line3">line 3</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |      | ||||||
|     </div> |     </div> | ||||||
|  |  | ||||||
|      |      | ||||||
| @@ -208,7 +250,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line352">line 352</a> |         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line364">line 364</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -388,7 +430,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line343">line 343</a> |         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line355">line 355</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -590,7 +632,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line333">line 333</a> |         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line345">line 345</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -792,7 +834,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line309">line 309</a> |         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line321">line 321</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -994,7 +1036,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line320">line 320</a> |         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line332">line 332</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1196,7 +1238,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line299">line 299</a> |         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line311">line 311</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1252,13 +1294,13 @@ | |||||||
| </div> | </div> | ||||||
|  |  | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> |     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="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> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -42,37 +42,40 @@ const appInfo = require('./app_info'); | |||||||
| const searchService = require('./search/services/search'); | const searchService = require('./search/services/search'); | ||||||
| const SearchContext = require("./search/search_context"); | const SearchContext = require("./search/search_context"); | ||||||
| const becca = require("../becca/becca"); | const becca = require("../becca/becca"); | ||||||
|  | const ws = require("./ws"); | ||||||
|  | const SpacedUpdate = require("./spaced_update"); | ||||||
|  | const specialNotesService = require("./special_notes"); | ||||||
|  | const branchService = require("./branches"); | ||||||
|  | const exportService = require("./export/zip"); | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * This is the main backend API interface for scripts. It's published in the local "api" object. |  * <p>This is the main backend API interface for scripts. All the properties and methods are published in the "api" object | ||||||
|  |  * available in the JS backend notes. You can use e.g. <code>api.log(api.startNote.title);</code></p> | ||||||
|  * |  * | ||||||
|  * @constructor |  * @constructor | ||||||
|  * @hideconstructor |  | ||||||
|  */ |  */ | ||||||
| function BackendScriptApi(currentNote, apiParams) { | function BackendScriptApi(currentNote, apiParams) { | ||||||
|     /** @property {Note} note where script started executing */ |     /** @property {BNote} note where script started executing */ | ||||||
|     this.startNote = apiParams.startNote; |     this.startNote = apiParams.startNote; | ||||||
|     /** @property {Note} note where script is currently executing. Don't mix this up with concept of active note */ |     /** @property {BNote} note where script is currently executing. Don't mix this up with concept of active note */ | ||||||
|     this.currentNote = currentNote; |     this.currentNote = currentNote; | ||||||
|     /** @property {Entity} entity whose event triggered this executions */ |     /** @property {AbstractBeccaEntity} entity whose event triggered this executions */ | ||||||
|     this.originEntity = apiParams.originEntity; |     this.originEntity = apiParams.originEntity; | ||||||
|  |  | ||||||
|     for (const key in apiParams) { |     for (const key in apiParams) { | ||||||
|         this[key] = apiParams[key]; |         this[key] = apiParams[key]; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @property {axios} Axios library for HTTP requests. See https://axios-http.com/ for documentation */ |     /** | ||||||
|  |      * @property {axios} Axios library for HTTP requests. See {@link https://axios-http.com} for documentation | ||||||
|  |      * @deprecated use native (browser compatible) fetch() instead | ||||||
|  |      */ | ||||||
|     this.axios = axios; |     this.axios = axios; | ||||||
|     /** @property {dayjs} day.js library for date manipulation. See https://day.js.org/ for documentation */ |     /** @property {dayjs} day.js library for date manipulation. See {@link https://day.js.org} for documentation */ | ||||||
|     this.dayjs = dayjs; |     this.dayjs = dayjs; | ||||||
|     /** @property {axios} xml2js library for XML parsing. See https://github.com/Leonidas-from-XIV/node-xml2js for documentation */ |     /** @property {axios} xml2js library for XML parsing. See {@link https://github.com/Leonidas-from-XIV/node-xml2js} for documentation */ | ||||||
|     this.xml2js = xml2js; |     this.xml2js = xml2js; | ||||||
|  |  | ||||||
|     // DEPRECATED - use direct api.unescapeHtml |  | ||||||
|     this.utils = { |  | ||||||
|         unescapeHtml: utils.unescapeHtml |  | ||||||
|     }; |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Instance name identifies particular Trilium instance. It can be useful for scripts |      * Instance name identifies particular Trilium instance. It can be useful for scripts | ||||||
|      * if some action needs to happen on only one specific instance. |      * if some action needs to happen on only one specific instance. | ||||||
| @@ -84,32 +87,32 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|     /** |     /** | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} noteId |      * @param {string} noteId | ||||||
|      * @returns {Note|null} |      * @returns {BNote|null} | ||||||
|      */ |      */ | ||||||
|     this.getNote = noteId => becca.getNote(noteId); |     this.getNote = noteId => becca.getNote(noteId); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} branchId |      * @param {string} branchId | ||||||
|      * @returns {Branch|null} |      * @returns {BBranch|null} | ||||||
|      */ |      */ | ||||||
|     this.getBranch = branchId => becca.getBranch(branchId); |     this.getBranch = branchId => becca.getBranch(branchId); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} attributeId |      * @param {string} attributeId | ||||||
|      * @returns {Attribute|null} |      * @returns {BAttribute|null} | ||||||
|      */ |      */ | ||||||
|     this.getAttribute = attributeId => becca.getAttribute(attributeId); |     this.getAttribute = attributeId => becca.getAttribute(attributeId); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * This is a powerful search method - you can search by attributes and their values, e.g.: |      * This is a powerful search method - you can search by attributes and their values, e.g.: | ||||||
|      * "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search |      * "#dateModified =* MONTH AND #log". See {@link https://github.com/zadam/trilium/wiki/Search} for full documentation for all options | ||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} query |      * @param {string} query | ||||||
|      * @param {Object} [searchParams] |      * @param {Object} [searchParams] | ||||||
|      * @returns {Note[]} |      * @returns {BNote[]} | ||||||
|      */ |      */ | ||||||
|     this.searchForNotes = (query, searchParams = {}) => { |     this.searchForNotes = (query, searchParams = {}) => { | ||||||
|         if (searchParams.includeArchivedNotes === undefined) { |         if (searchParams.includeArchivedNotes === undefined) { | ||||||
| @@ -128,12 +131,12 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * This is a powerful search method - you can search by attributes and their values, e.g.: |      * This is a powerful search method - you can search by attributes and their values, e.g.: | ||||||
|      * "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search |      * "#dateModified =* MONTH AND #log". See {@link https://github.com/zadam/trilium/wiki/Search} for full documentation for all options | ||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} query |      * @param {string} query | ||||||
|      * @param {Object} [searchParams] |      * @param {Object} [searchParams] | ||||||
|      * @returns {Note|null} |      * @returns {BNote|null} | ||||||
|      */ |      */ | ||||||
|     this.searchForNote = (query, searchParams = {}) => { |     this.searchForNote = (query, searchParams = {}) => { | ||||||
|         const notes = this.searchForNotes(query, searchParams); |         const notes = this.searchForNotes(query, searchParams); | ||||||
| @@ -147,7 +150,7 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|      * @method |      * @method | ||||||
|      * @param {string} name - attribute name |      * @param {string} name - attribute name | ||||||
|      * @param {string} [value] - attribute value |      * @param {string} [value] - attribute value | ||||||
|      * @returns {Note[]} |      * @returns {BNote[]} | ||||||
|      */ |      */ | ||||||
|     this.getNotesWithLabel = attributeService.getNotesWithLabel; |     this.getNotesWithLabel = attributeService.getNotesWithLabel; | ||||||
|  |  | ||||||
| @@ -157,23 +160,23 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|      * @method |      * @method | ||||||
|      * @param {string} name - attribute name |      * @param {string} name - attribute name | ||||||
|      * @param {string} [value] - attribute value |      * @param {string} [value] - attribute value | ||||||
|      * @returns {Note|null} |      * @returns {BNote|null} | ||||||
|      */ |      */ | ||||||
|     this.getNoteWithLabel = attributeService.getNoteWithLabel; |     this.getNoteWithLabel = attributeService.getNoteWithLabel; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * If there's no branch between note and parent note, create one. Otherwise do nothing. |      * If there's no branch between note and parent note, create one. Otherwise, do nothing. | ||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} noteId |      * @param {string} noteId | ||||||
|      * @param {string} parentNoteId |      * @param {string} parentNoteId | ||||||
|      * @param {string} prefix - if branch will be create between note and parent note, set this prefix |      * @param {string} prefix - if branch will be created between note and parent note, set this prefix | ||||||
|      * @returns {void} |      * @returns {void} | ||||||
|      */ |      */ | ||||||
|     this.ensureNoteIsPresentInParent = cloningService.ensureNoteIsPresentInParent; |     this.ensureNoteIsPresentInParent = cloningService.ensureNoteIsPresentInParent; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * If there's a branch between note and parent note, remove it. Otherwise do nothing. |      * If there's a branch between note and parent note, remove it. Otherwise, do nothing. | ||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} noteId |      * @param {string} noteId | ||||||
| @@ -189,25 +192,19 @@ 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 create between note and parent note, set this prefix |      * @param {string} prefix - if branch will be created between note and parent note, set this prefix | ||||||
|      * @returns {void} |      * @returns {void} | ||||||
|      */ |      */ | ||||||
|     this.toggleNoteInParent = cloningService.toggleNoteInParent; |     this.toggleNoteInParent = cloningService.toggleNoteInParent; | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * @typedef {object} CreateNoteAttribute |  | ||||||
|      * @property {string} type - attribute type - label, relation etc. |  | ||||||
|      * @property {string} name - attribute name |  | ||||||
|      * @property {string} [value] - attribute value |  | ||||||
|      */ |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Create text note. See also createNewNote() for more options. |      * Create text note. See also createNewNote() for more options. | ||||||
|      * |      * | ||||||
|  |      * @method | ||||||
|      * @param {string} parentNoteId |      * @param {string} parentNoteId | ||||||
|      * @param {string} title |      * @param {string} title | ||||||
|      * @param {string} content |      * @param {string} content | ||||||
|      * @return {{note: Note, branch: Branch}} - object having "note" and "branch" keys representing respective objects |      * @returns {{note: BNote, branch: BBranch}} - object having "note" and "branch" keys representing respective objects | ||||||
|      */ |      */ | ||||||
|     this.createTextNote = (parentNoteId, title, content = '') => noteService.createNewNote({ |     this.createTextNote = (parentNoteId, title, content = '') => noteService.createNewNote({ | ||||||
|         parentNoteId, |         parentNoteId, | ||||||
| @@ -220,10 +217,11 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|      * Create data note - data in this context means object serializable to JSON. Created note will be of type 'code' and |      * Create data note - data in this context means object serializable to JSON. Created note will be of type 'code' and | ||||||
|      * JSON MIME type. See also createNewNote() for more options. |      * JSON MIME type. See also createNewNote() for more options. | ||||||
|      * |      * | ||||||
|  |      * @method | ||||||
|      * @param {string} parentNoteId |      * @param {string} parentNoteId | ||||||
|      * @param {string} title |      * @param {string} title | ||||||
|      * @param {object} content |      * @param {object} content | ||||||
|      * @return {{note: Note, branch: Branch}} object having "note" and "branch" keys representing respective objects |      * @returns {{note: BNote, branch: BBranch}} object having "note" and "branch" keys representing respective objects | ||||||
|      */ |      */ | ||||||
|     this.createDataNote = (parentNoteId, title, content = {}) => noteService.createNewNote({ |     this.createDataNote = (parentNoteId, title, content = {}) => noteService.createNewNote({ | ||||||
|         parentNoteId, |         parentNoteId, | ||||||
| @@ -233,43 +231,23 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|         mime: 'application/json' |         mime: 'application/json' | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * @typedef {object} CreateNewNoteParams |  | ||||||
|      * @property {string} parentNoteId - MANDATORY |  | ||||||
|      * @property {string} title - MANDATORY |  | ||||||
|      * @property {string|buffer} content - MANDATORY |  | ||||||
|      * @property {string} type - text, code, file, image, search, book, relation-map - MANDATORY |  | ||||||
|      * @property {string} mime - value is derived from default mimes for type |  | ||||||
|      * @property {boolean} isProtected - default is false |  | ||||||
|      * @property {boolean} isExpanded - default is false |  | ||||||
|      * @property {string} prefix - default is empty string |  | ||||||
|      * @property {int} notePosition - default is last existing notePosition in a parent + 10 |  | ||||||
|      */ |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @method |      * @method | ||||||
|      * |      * | ||||||
|      * @param {CreateNewNoteParams} [params] |      * @property {object} params | ||||||
|      * @returns {{note: Note, branch: Branch}} object contains newly created entities note and branch |      * @property {string} params.parentNoteId | ||||||
|  |      * @property {string} params.title | ||||||
|  |      * @property {string|buffer} params.content | ||||||
|  |      * @property {string} params.type - text, code, file, image, search, book, relationMap, canvas | ||||||
|  |      * @property {string} [params.mime] - value is derived from default mimes for type | ||||||
|  |      * @property {boolean} [params.isProtected=false] | ||||||
|  |      * @property {boolean} [params.isExpanded=false] | ||||||
|  |      * @property {string} [params.prefix=''] | ||||||
|  |      * @property {int} [params.notePosition] - default is last existing notePosition in a parent + 10 | ||||||
|  |      * @returns {{note: BNote, branch: BBranch}} object contains newly created entities note and branch | ||||||
|      */ |      */ | ||||||
|     this.createNewNote = noteService.createNewNote; |     this.createNewNote = noteService.createNewNote; | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * @typedef {object} CreateNoteAttribute |  | ||||||
|      * @property {string} type - attribute type - label, relation etc. |  | ||||||
|      * @property {string} name - attribute name |  | ||||||
|      * @property {string} [value] - attribute value |  | ||||||
|      */ |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * @typedef {object} CreateNoteExtraOptions |  | ||||||
|      * @property {boolean} [json=false] - should the note be JSON |  | ||||||
|      * @property {boolean} [isProtected=false] - should the note be protected |  | ||||||
|      * @property {string} [type='text'] - note type |  | ||||||
|      * @property {string} [mime='text/html'] - MIME type of the note |  | ||||||
|      * @property {CreateNoteAttribute[]} [attributes=[]] - attributes to be created for this note |  | ||||||
|      */ |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @method |      * @method | ||||||
|      * @deprecated please use createTextNote() with similar API for simpler use cases or createNewNote() for more complex needs |      * @deprecated please use createTextNote() with similar API for simpler use cases or createNewNote() for more complex needs | ||||||
| @@ -277,8 +255,16 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|      * @param {string} parentNoteId - create new note under this parent |      * @param {string} parentNoteId - create new note under this parent | ||||||
|      * @param {string} title |      * @param {string} title | ||||||
|      * @param {string} [content=""] |      * @param {string} [content=""] | ||||||
|      * @param {CreateNoteExtraOptions} [extraOptions={}] |      * @param {object} [extraOptions={}] | ||||||
|      * @returns {{note: Note, branch: Branch}} object contains newly created entities note and branch |      * @property {boolean} [extraOptions.json=false] - should the note be JSON | ||||||
|  |      * @property {boolean} [extraOptions.isProtected=false] - should the note be protected | ||||||
|  |      * @property {string} [extraOptions.type='text'] - note type | ||||||
|  |      * @property {string} [extraOptions.mime='text/html'] - MIME type of the note | ||||||
|  |      * @property {object[]} [extraOptions.attributes=[]] - attributes to be created for this note | ||||||
|  |      * @property {string} extraOptions.attributes.type - attribute type - label, relation etc. | ||||||
|  |      * @property {string} extraOptions.attributes.name - attribute name | ||||||
|  |      * @property {string} [extraOptions.attributes.value] - attribute value | ||||||
|  |      * @returns {{note: BNote, branch: BBranch}} object contains newly created entities note and branch | ||||||
|      */ |      */ | ||||||
|     this.createNote = (parentNoteId, title, content = "", extraOptions= {}) => { |     this.createNote = (parentNoteId, title, content = "", extraOptions= {}) => { | ||||||
|         extraOptions.parentNoteId = parentNoteId; |         extraOptions.parentNoteId = parentNoteId; | ||||||
| @@ -316,18 +302,42 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|         }); |         }); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  |     this.logMessages = {}; | ||||||
|  |     this.logSpacedUpdates = {}; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Log given message to trilium logs. |      * Log given message to trilium logs and log pane in UI | ||||||
|      * |      * | ||||||
|  |      * @method | ||||||
|      * @param message |      * @param message | ||||||
|  |      * @returns {void} | ||||||
|      */ |      */ | ||||||
|     this.log = message => log.info(`Script "${currentNote.title}" (${currentNote.noteId}): ${message}`); |     this.log = message => { | ||||||
|  |         log.info(message); | ||||||
|  |  | ||||||
|  |         const {noteId} = this.startNote; | ||||||
|  |  | ||||||
|  |         this.logMessages[noteId] = this.logMessages[noteId] || []; | ||||||
|  |         this.logSpacedUpdates[noteId] = this.logSpacedUpdates[noteId] || new SpacedUpdate(() => { | ||||||
|  |             const messages = this.logMessages[noteId]; | ||||||
|  |             this.logMessages[noteId] = []; | ||||||
|  |  | ||||||
|  |             ws.sendMessageToAllClients({ | ||||||
|  |                 type: 'api-log-messages', | ||||||
|  |                 noteId, | ||||||
|  |                 messages | ||||||
|  |             }); | ||||||
|  |         }, 100); | ||||||
|  |  | ||||||
|  |         this.logMessages[noteId].push(message); | ||||||
|  |         this.logSpacedUpdates[noteId].scheduleUpdate(); | ||||||
|  |     }; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Returns root note of the calendar. |      * Returns root note of the calendar. | ||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @returns {Note|null} |      * @returns {BNote|null} | ||||||
|      */ |      */ | ||||||
|     this.getRootCalendarNote = dateNoteService.getRootCalendarNote; |     this.getRootCalendarNote = dateNoteService.getRootCalendarNote; | ||||||
|  |  | ||||||
| @@ -336,15 +346,17 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} date in YYYY-MM-DD format |      * @param {string} date in YYYY-MM-DD format | ||||||
|      * @returns {Note|null} |      * @param {BNote} [rootNote] - specify calendar root note, normally leave empty to use the default calendar | ||||||
|  |      * @returns {BNote|null} | ||||||
|      */ |      */ | ||||||
|     this.getDateNote = dateNoteService.getDateNote; |     this.getDayNote = dateNoteService.getDayNote; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Returns today's day note. If such note doesn't exist, it is created. |      * Returns today's day note. If such note doesn't exist, it is created. | ||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @returns {Note|null} |      * @param {BNote} [rootNote] - specify calendar root note, normally leave empty to use the default calendar | ||||||
|  |      * @returns {BNote|null} | ||||||
|      */ |      */ | ||||||
|     this.getTodayNote = dateNoteService.getTodayNote; |     this.getTodayNote = dateNoteService.getTodayNote; | ||||||
|  |  | ||||||
| @@ -353,8 +365,10 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} date in YYYY-MM-DD format |      * @param {string} date in YYYY-MM-DD format | ||||||
|      * @param {object} options - "startOfTheWeek" - either "monday" (default) or "sunday" |      * @param {object} [options] | ||||||
|      * @returns {Note|null} |      * @param {string} [options.startOfTheWeek=monday] - either "monday" (default) or "sunday" | ||||||
|  |      * @param {BNote} [rootNote] - specify calendar root note, normally leave empty to use the default calendar | ||||||
|  |      * @returns {BNote|null} | ||||||
|      */ |      */ | ||||||
|     this.getWeekNote = dateNoteService.getWeekNote; |     this.getWeekNote = dateNoteService.getWeekNote; | ||||||
|  |  | ||||||
| @@ -363,7 +377,8 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} date in YYYY-MM format |      * @param {string} date in YYYY-MM format | ||||||
|      * @returns {Note|null} |      * @param {BNote} [rootNote] - specify calendar root note, normally leave empty to use the default calendar | ||||||
|  |      * @returns {BNote|null} | ||||||
|      */ |      */ | ||||||
|     this.getMonthNote = dateNoteService.getMonthNote; |     this.getMonthNote = dateNoteService.getMonthNote; | ||||||
|  |  | ||||||
| @@ -372,15 +387,29 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} year in YYYY format |      * @param {string} year in YYYY format | ||||||
|      * @returns {Note|null} |      * @param {BNote} [rootNote] - specify calendar root note, normally leave empty to use the default calendar | ||||||
|  |      * @returns {BNote|null} | ||||||
|      */ |      */ | ||||||
|     this.getYearNote = dateNoteService.getYearNote; |     this.getYearNote = dateNoteService.getYearNote; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|  |      * Sort child notes of a given note. | ||||||
|  |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} parentNoteId - this note's child notes will be sorted |      * @param {string} parentNoteId - this note's child notes will be sorted | ||||||
|  |      * @param {object} [sortConfig] | ||||||
|  |      * @property {string} [sortConfig.sortBy=title] - 'title', 'dateCreated', 'dateModified' or a label name | ||||||
|  |      *                                See {@link https://github.com/zadam/trilium/wiki/Sorting} for details. | ||||||
|  |      * @property {boolean} [sortConfig.reverse=false] | ||||||
|  |      * @property {boolean} [sortConfig.foldersFirst=false] | ||||||
|  |      * @returns {void} | ||||||
|      */ |      */ | ||||||
|     this.sortNotesByTitle = parentNoteId => treeService.sortNotes(parentNoteId); |     this.sortNotes = (parentNoteId, sortConfig = {}) => treeService.sortNotes( | ||||||
|  |         parentNoteId, | ||||||
|  |         sortConfig.sortBy || "title", | ||||||
|  |         !!sortConfig.reverse, | ||||||
|  |         !!sortConfig.foldersFirst | ||||||
|  |     ); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * This method finds note by its noteId and prefix and either sets it to the given parentNoteId |      * This method finds note by its noteId and prefix and either sets it to the given parentNoteId | ||||||
| @@ -389,10 +418,11 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|      * This method looks similar to toggleNoteInParent() but differs because we're looking up branch by prefix. |      * This method looks similar to toggleNoteInParent() but differs because we're looking up branch by prefix. | ||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @deprecated - this method is pretty confusing and serves specialized purpose only |      * @deprecated this method is pretty confusing and serves specialized purpose only | ||||||
|      * @param {string} noteId |      * @param {string} noteId | ||||||
|      * @param {string} prefix |      * @param {string} prefix | ||||||
|      * @param {string|null} parentNoteId |      * @param {string|null} parentNoteId | ||||||
|  |      * @returns {void} | ||||||
|      */ |      */ | ||||||
|     this.setNoteToParent = treeService.setNoteToParent; |     this.setNoteToParent = treeService.setNoteToParent; | ||||||
|  |  | ||||||
| @@ -436,14 +466,105 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @method |      * @method | ||||||
|      * @deprecated - this is now no-op since all the changes should be gracefully handled per widget |      * @returns {{syncVersion, appVersion, buildRevision, dbVersion, dataDirectory, buildDate}|*} - object representing basic info about running Trilium version | ||||||
|      */ |  | ||||||
|     this.refreshTree = () => {}; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * @return {{syncVersion, appVersion, buildRevision, dbVersion, dataDirectory, buildDate}|*} - object representing basic info about running Trilium version |  | ||||||
|      */ |      */ | ||||||
|     this.getAppInfo = () => appInfo |     this.getAppInfo = () => appInfo | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Creates a new launcher to the launchbar. If the launcher (id) already exists, it will be updated. | ||||||
|  |      * | ||||||
|  |      * @method | ||||||
|  |      * @param {object} opts | ||||||
|  |      * @property {string} opts.id - id of the launcher, only alphanumeric at least 6 characters long | ||||||
|  |      * @property {string} opts.type - one of | ||||||
|  |      *                          * "note" - activating the launcher will navigate to the target note (specified in targetNoteId param) | ||||||
|  |      *                          * "script" -  activating the launcher will execute the script (specified in scriptNoteId param) | ||||||
|  |      *                          * "customWidget" - the launcher will be rendered with a custom widget (specified in widgetNoteId param) | ||||||
|  |      * @property {string} opts.title | ||||||
|  |      * @property {boolean} [opts.isVisible=false] - if true, will be created in the "Visible launchers", otherwise in "Available launchers" | ||||||
|  |      * @property {string} [opts.icon] - name of the boxicon to be used (e.g. "bx-time") | ||||||
|  |      * @property {string} [opts.keyboardShortcut] - will activate the target note/script upon pressing, e.g. "ctrl+e" | ||||||
|  |      * @property {string} [opts.targetNoteId] - for type "note" | ||||||
|  |      * @property {string} [opts.scriptNoteId] - for type "script" | ||||||
|  |      * @property {string} [opts.widgetNoteId] - for type "customWidget" | ||||||
|  |      * @returns {{note: BNote}} | ||||||
|  |      */ | ||||||
|  |     this.createOrUpdateLauncher = opts => { | ||||||
|  |         if (!opts.id) { throw new Error("ID is a mandatory parameter for api.createOrUpdateLauncher(opts)"); } | ||||||
|  |         if (!opts.id.match(/[a-z0-9]{6,1000}/i)) { throw new Error(`ID must be an alphanumeric string at least 6 characters long.`); } | ||||||
|  |         if (!opts.type) { throw new Error("Launcher Type is a mandatory parameter for api.createOrUpdateLauncher(opts)"); } | ||||||
|  |         if (!["note", "script", "customWidget"].includes(opts.type)) { throw new Error(`Given launcher type '${opts.type}'`); } | ||||||
|  |         if (!opts.title?.trim()) { throw new Error("Title is a mandatory parameter for api.createOrUpdateLauncher(opts)"); } | ||||||
|  |         if (opts.type === 'note' && !opts.targetNoteId) { throw new Error("targetNoteId is mandatory for launchers of type 'note'"); } | ||||||
|  |         if (opts.type === 'script' && !opts.scriptNoteId) { throw new Error("scriptNoteId is mandatory for launchers of type 'script'"); } | ||||||
|  |         if (opts.type === 'customWidget' && !opts.widgetNoteId) { throw new Error("widgetNoteId is mandatory for launchers of type 'customWidget'"); } | ||||||
|  |  | ||||||
|  |         const parentNoteId = !!opts.isVisible ? '_lbVisibleLaunchers' : '_lbAvailableLaunchers'; | ||||||
|  |         const noteId = 'al_' + opts.id; | ||||||
|  |  | ||||||
|  |         const launcherNote = | ||||||
|  |             becca.getNote(opts.id) || | ||||||
|  |             specialNotesService.createLauncher({ | ||||||
|  |                 noteId: noteId, | ||||||
|  |                 parentNoteId: parentNoteId, | ||||||
|  |                 launcherType: opts.type, | ||||||
|  |             }).note; | ||||||
|  |  | ||||||
|  |         if (launcherNote.title !== opts.title) { | ||||||
|  |             launcherNote.title = opts.title; | ||||||
|  |             launcherNote.save(); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (launcherNote.getParentBranches().length === 1) { | ||||||
|  |             const branch = launcherNote.getParentBranches()[0]; | ||||||
|  |  | ||||||
|  |             if (branch.parentNoteId !== parentNoteId) { | ||||||
|  |                 branchService.moveBranchToNote(branch, parentNoteId); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (opts.type === 'note') { | ||||||
|  |             launcherNote.setRelation('target', opts.targetNoteId); | ||||||
|  |         } else if (opts.type === 'script') { | ||||||
|  |             launcherNote.setRelation('script', opts.scriptNoteId); | ||||||
|  |         } else if (opts.type === 'customWidget') { | ||||||
|  |             launcherNote.setRelation('widget', opts.widgetNoteId); | ||||||
|  |         } else { | ||||||
|  |             throw new Error(`Unrecognized launcher type '${opts.type}'`); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (opts.keyboardShortcut) { | ||||||
|  |             launcherNote.setLabel('keyboardShortcut', opts.keyboardShortcut); | ||||||
|  |         } else { | ||||||
|  |             launcherNote.removeLabel('keyboardShortcut'); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (opts.icon) { | ||||||
|  |             launcherNote.setLabel('iconClass', `bx ${opts.icon}`); | ||||||
|  |         } else { | ||||||
|  |             launcherNote.removeLabel('keyboardShortcut'); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return {note: launcherNote}; | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * @method | ||||||
|  |      * @param {string} noteId | ||||||
|  |      * @param {string} format - either 'html' or 'markdown' | ||||||
|  |      * @param {string} zipFilePath | ||||||
|  |      * @returns {Promise<void>} | ||||||
|  |      */ | ||||||
|  |     this.exportSubtreeToZipFile = async (noteId, format, zipFilePath) => await exportService.exportToZipFile(noteId, format, zipFilePath); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * This object contains "at your risk" and "no BC guarantees" objects for advanced use cases. | ||||||
|  |      * | ||||||
|  |      * @property {Becca} becca - provides access to the backend in-memory object graph, see {@link https://github.com/zadam/trilium/blob/master/src/becca/becca.js} | ||||||
|  |      */ | ||||||
|  |     this.__private = { | ||||||
|  |         becca | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| module.exports = BackendScriptApi; | module.exports = BackendScriptApi; | ||||||
| @@ -457,13 +578,13 @@ module.exports = BackendScriptApi; | |||||||
| </div> | </div> | ||||||
|  |  | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> |     <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> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -36,10 +36,13 @@ const log = require('./log'); | |||||||
| const Database = require('better-sqlite3'); | const Database = require('better-sqlite3'); | ||||||
| const dataDir = require('./data_dir'); | const dataDir = require('./data_dir'); | ||||||
| const cls = require('./cls'); | const cls = require('./cls'); | ||||||
|  | const fs = require("fs-extra"); | ||||||
|  |  | ||||||
| const dbConnection = new Database(dataDir.DOCUMENT_PATH); | const dbConnection = new Database(dataDir.DOCUMENT_PATH); | ||||||
| dbConnection.pragma('journal_mode = WAL'); | dbConnection.pragma('journal_mode = WAL'); | ||||||
|  |  | ||||||
|  | const LOG_ALL_QUERIES = false; | ||||||
|  |  | ||||||
| [`exit`, `SIGINT`, `SIGUSR1`, `SIGUSR2`, `SIGTERM`].forEach(eventType => { | [`exit`, `SIGINT`, `SIGUSR1`, `SIGUSR2`, `SIGTERM`].forEach(eventType => { | ||||||
|     process.on(eventType, () => { |     process.on(eventType, () => { | ||||||
|         if (dbConnection) { |         if (dbConnection) { | ||||||
| @@ -53,14 +56,20 @@ dbConnection.pragma('journal_mode = WAL'); | |||||||
| 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; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     const columns = keys.join(", "); |     const columns = keys.join(", "); | ||||||
|     const questionMarks = keys.map(p => "?").join(", "); |     const questionMarks = keys.map(p => "?").join(", "); | ||||||
|  |  | ||||||
|     const query = "INSERT " + (replace ? "OR REPLACE" : "") + " INTO " + tableName + "(" + columns + ") VALUES (" + questionMarks + ")"; |     const query = `INSERT | ||||||
|  |     ${replace ? "OR REPLACE" : ""} INTO | ||||||
|  |     ${tableName} | ||||||
|  |     ( | ||||||
|  |     ${columns} | ||||||
|  |     ) | ||||||
|  |     VALUES (${questionMarks})`; | ||||||
|  |  | ||||||
|     const res = execute(query, Object.values(rec)); |     const res = execute(query, Object.values(rec)); | ||||||
|  |  | ||||||
| @@ -74,13 +83,13 @@ 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; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     const columns = keys.join(", "); |     const columns = keys.join(", "); | ||||||
|  |  | ||||||
|     const questionMarks = keys.map(colName => "@" + colName).join(", "); |     const questionMarks = keys.map(colName => `@${colName}`).join(", "); | ||||||
|  |  | ||||||
|     const updateMarks = keys.map(colName => `${colName} = @${colName}`).join(", "); |     const updateMarks = keys.map(colName => `${colName} = @${colName}`).join(", "); | ||||||
|  |  | ||||||
| @@ -117,13 +126,7 @@ function getRowOrNull(query, params = []) { | |||||||
| } | } | ||||||
|  |  | ||||||
| function getValue(query, params = []) { | function getValue(query, params = []) { | ||||||
|     const row = getRowOrNull(query, params); |     return wrap(query, s => s.pluck().get(params)); | ||||||
|  |  | ||||||
|     if (!row) { |  | ||||||
|         return null; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     return row[Object.keys(row)[0]]; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| // smaller values can result in better performance due to better usage of statement cache | // smaller values can result in better performance due to better usage of statement cache | ||||||
| @@ -167,48 +170,37 @@ function getRawRows(query, params = []) { | |||||||
| } | } | ||||||
|  |  | ||||||
| function iterateRows(query, params = []) { | function iterateRows(query, params = []) { | ||||||
|  |     if (LOG_ALL_QUERIES) { | ||||||
|  |         console.log(query); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     return stmt(query).iterate(params); |     return stmt(query).iterate(params); | ||||||
| } | } | ||||||
|  |  | ||||||
| function getMap(query, params = []) { | function getMap(query, params = []) { | ||||||
|     const map = {}; |     const map = {}; | ||||||
|     const results = getRows(query, params); |     const results = getRawRows(query, params); | ||||||
|  |  | ||||||
|     for (const row of results) { |     for (const row of results) { | ||||||
|         const keys = Object.keys(row); |         map[row[0]] = row[1]; | ||||||
|  |  | ||||||
|         map[row[keys[0]]] = row[keys[1]]; |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return map; |     return map; | ||||||
| } | } | ||||||
|  |  | ||||||
| function getColumn(query, params = []) { | function getColumn(query, params = []) { | ||||||
|     const list = []; |     return wrap(query, s => s.pluck().all(params)); | ||||||
|     const result = getRows(query, params); |  | ||||||
|  |  | ||||||
|     if (result.length === 0) { |  | ||||||
|         return list; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     const key = Object.keys(result[0])[0]; |  | ||||||
|  |  | ||||||
|     for (const row of result) { |  | ||||||
|         list.push(row[key]); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     return list; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| function execute(query, params = []) { | function execute(query, params = []) { | ||||||
|     return wrap(query, s => s.run(params)); |     return wrap(query, s => s.run(params)); | ||||||
| } | } | ||||||
|  |  | ||||||
| function executeWithoutTransaction(query, params = []) { | function executeMany(query, params) { | ||||||
|     dbConnection.run(query, params); |     if (LOG_ALL_QUERIES) { | ||||||
|  |         console.log(query); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| function executeMany(query, params) { |  | ||||||
|     while (params.length > 0) { |     while (params.length > 0) { | ||||||
|         const curParams = params.slice(0, Math.min(params.length, PARAM_LIMIT)); |         const curParams = params.slice(0, Math.min(params.length, PARAM_LIMIT)); | ||||||
|         params = params.slice(curParams.length); |         params = params.slice(curParams.length); | ||||||
| @@ -229,6 +221,10 @@ function executeMany(query, params) { | |||||||
| } | } | ||||||
|  |  | ||||||
| function executeScript(query) { | function executeScript(query) { | ||||||
|  |     if (LOG_ALL_QUERIES) { | ||||||
|  |         console.log(query); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     return dbConnection.exec(query); |     return dbConnection.exec(query); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -236,6 +232,10 @@ function wrap(query, func) { | |||||||
|     const startTimestamp = Date.now(); |     const startTimestamp = Date.now(); | ||||||
|     let result; |     let result; | ||||||
|  |  | ||||||
|  |     if (LOG_ALL_QUERIES) { | ||||||
|  |         console.log(query); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     try { |     try { | ||||||
|         result = func(stmt(query)); |         result = func(stmt(query)); | ||||||
|     } |     } | ||||||
| @@ -276,14 +276,17 @@ function transactional(func) { | |||||||
|         return ret; |         return ret; | ||||||
|     } |     } | ||||||
|     catch (e) { |     catch (e) { | ||||||
|         const entityChanges = cls.getAndClearEntityChangeIds(); |         const entityChangeIds = cls.getAndClearEntityChangeIds(); | ||||||
|  |  | ||||||
|         if (entityChanges.length > 0) { |         if (entityChangeIds.length > 0) { | ||||||
|             log.info("Transaction rollback dirtied the becca, forcing reload."); |             log.info("Transaction rollback dirtied the becca, forcing reload."); | ||||||
|  |  | ||||||
|             require('../becca/becca_loader').load(); |             require('../becca/becca_loader').load(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         // the maxEntityChangeId has been incremented during failed transaction, need to recalculate | ||||||
|  |         require('./entity_changes').recalculateMaxEntityChangeId(); | ||||||
|  |  | ||||||
|         throw e; |         throw e; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -306,11 +309,20 @@ function fillParamList(paramIds, truncate = true) { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     // doing it manually to avoid this showing up on the sloq query list |     // doing it manually to avoid this showing up on the sloq query list | ||||||
|     const s = stmt(`INSERT INTO param_list VALUES ` + paramIds.map(paramId => `(?)`).join(','), paramIds); |     const s = stmt(`INSERT INTO param_list VALUES ${paramIds.map(paramId => `(?)`).join(',')}`, paramIds); | ||||||
|  |  | ||||||
|     s.run(paramIds); |     s.run(paramIds); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | async function copyDatabase(targetFilePath) { | ||||||
|  |     try { | ||||||
|  |         fs.unlinkSync(targetFilePath); | ||||||
|  |     } catch (e) { | ||||||
|  |     } // unlink throws exception if the file did not exist | ||||||
|  |  | ||||||
|  |     await dbConnection.backup(targetFilePath); | ||||||
|  | } | ||||||
|  |  | ||||||
| module.exports = { | module.exports = { | ||||||
|     dbConnection, |     dbConnection, | ||||||
|     insert, |     insert, | ||||||
| @@ -322,7 +334,7 @@ module.exports = { | |||||||
|      * @method |      * @method | ||||||
|      * @param {string} query - SQL query with ? used as parameter placeholder |      * @param {string} query - SQL query with ? used as parameter placeholder | ||||||
|      * @param {object[]} [params] - array of params if needed |      * @param {object[]} [params] - array of params if needed | ||||||
|      * @return [object] - single value |      * @returns [object] - single value | ||||||
|      */ |      */ | ||||||
|     getValue, |     getValue, | ||||||
|  |  | ||||||
| @@ -332,7 +344,7 @@ module.exports = { | |||||||
|      * @method |      * @method | ||||||
|      * @param {string} query - SQL query with ? used as parameter placeholder |      * @param {string} query - SQL query with ? used as parameter placeholder | ||||||
|      * @param {object[]} [params] - array of params if needed |      * @param {object[]} [params] - array of params if needed | ||||||
|      * @return {object} - map of column name to column value |      * @returns {object} - map of column name to column value | ||||||
|      */ |      */ | ||||||
|     getRow, |     getRow, | ||||||
|     getRowOrNull, |     getRowOrNull, | ||||||
| @@ -343,7 +355,7 @@ module.exports = { | |||||||
|      * @method |      * @method | ||||||
|      * @param {string} query - SQL query with ? used as parameter placeholder |      * @param {string} query - SQL query with ? used as parameter placeholder | ||||||
|      * @param {object[]} [params] - array of params if needed |      * @param {object[]} [params] - array of params if needed | ||||||
|      * @return {object[]} - array of all rows, each row is a map of column name to column value |      * @returns {object[]} - array of all rows, each row is a map of column name to column value | ||||||
|      */ |      */ | ||||||
|     getRows, |     getRows, | ||||||
|     getRawRows, |     getRawRows, | ||||||
| @@ -356,7 +368,7 @@ module.exports = { | |||||||
|      * @method |      * @method | ||||||
|      * @param {string} query - SQL query with ? used as parameter placeholder |      * @param {string} query - SQL query with ? used as parameter placeholder | ||||||
|      * @param {object[]} [params] - array of params if needed |      * @param {object[]} [params] - array of params if needed | ||||||
|      * @return {object} - map of first column to second column |      * @returns {object} - map of first column to second column | ||||||
|      */ |      */ | ||||||
|     getMap, |     getMap, | ||||||
|  |  | ||||||
| @@ -366,7 +378,7 @@ module.exports = { | |||||||
|      * @method |      * @method | ||||||
|      * @param {string} query - SQL query with ? used as parameter placeholder |      * @param {string} query - SQL query with ? used as parameter placeholder | ||||||
|      * @param {object[]} [params] - array of params if needed |      * @param {object[]} [params] - array of params if needed | ||||||
|      * @return {object[]} - array of first column of all returned rows |      * @returns {object[]} - array of first column of all returned rows | ||||||
|      */ |      */ | ||||||
|     getColumn, |     getColumn, | ||||||
|  |  | ||||||
| @@ -378,12 +390,12 @@ module.exports = { | |||||||
|      * @param {object[]} [params] - array of params if needed |      * @param {object[]} [params] - array of params if needed | ||||||
|      */ |      */ | ||||||
|     execute, |     execute, | ||||||
|     executeWithoutTransaction, |  | ||||||
|     executeMany, |     executeMany, | ||||||
|     executeScript, |     executeScript, | ||||||
|     transactional, |     transactional, | ||||||
|     upsert, |     upsert, | ||||||
|     fillParamList |     fillParamList, | ||||||
|  |     copyDatabase | ||||||
| }; | }; | ||||||
| </code></pre> | </code></pre> | ||||||
|         </article> |         </article> | ||||||
| @@ -395,13 +407,13 @@ module.exports = { | |||||||
| </div> | </div> | ||||||
|  |  | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> |     <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> | ||||||
| </nav> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
| <html lang="en"> | <html lang="en"> | ||||||
| <head> | <head> | ||||||
|     <meta charset="utf-8"> |     <meta charset="utf-8"> | ||||||
|     <title>JSDoc: Class: Attribute</title> |     <title>JSDoc: Class: FAttribute</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">Class: Attribute</h1> |     <h1 class="page-title">Class: FAttribute</h1> | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -28,7 +28,7 @@ | |||||||
| 
 | 
 | ||||||
| <header> | <header> | ||||||
|      |      | ||||||
|         <h2><span class="attribs"><span class="type-signature"></span></span>Attribute<span class="signature">()</span><span class="type-signature"></span></h2> |         <h2><span class="attribs"><span class="type-signature"></span></span>FAttribute<span class="signature">()</span><span class="type-signature"></span></h2> | ||||||
|          |          | ||||||
|             <div class="class-description">Attribute is an abstract concept which has two real uses - label (key - value pair) |             <div class="class-description">Attribute is an abstract concept which has two real uses - label (key - value pair) | ||||||
| and relation (representing named relationship between source and target note)</div> | and relation (representing named relationship between source and target note)</div> | ||||||
| @@ -46,7 +46,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
|     <h4 class="name" id="Attribute"><span class="type-signature"></span>new Attribute<span class="signature">()</span><span class="type-signature"></span></h4> |     <h4 class="name" id="FAttribute"><span class="type-signature"></span>new FAttribute<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| @@ -94,7 +94,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_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line7">line 7</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line7">line 7</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -194,7 +194,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_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line16">line 16</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line16">line 16</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -262,7 +262,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_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line28">line 28</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line28">line 28</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -330,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_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line22">line 22</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line22">line 22</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -398,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_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line18">line 18</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line18">line 18</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -466,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_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line26">line 26</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line26">line 26</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -534,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_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line20">line 20</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line20">line 20</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -602,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_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line24">line 24</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line24">line 24</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -630,7 +630,7 @@ and relation (representing named relationship between source and target note)</d | |||||||
|      |      | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
|     <h4 class="name" id="getNote"><span class="type-signature"></span>getNote<span class="signature">()</span><span class="type-signature"> → {<a href="NoteShort.html">NoteShort</a>}</span></h4> |     <h4 class="name" id="getNote"><span class="type-signature"></span>getNote<span class="signature">()</span><span class="type-signature"> → {<a href="FNote.html">FNote</a>}</span></h4> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| @@ -678,7 +678,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_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line32">line 32</a> |         <a href="entities_fattribute.js.html">entities/fattribute.js</a>, <a href="entities_fattribute.js.html#line32">line 32</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -714,7 +714,109 @@ and relation (representing named relationship between source and target note)</d | |||||||
|     </dt> |     </dt> | ||||||
|     <dd> |     <dd> | ||||||
|          |          | ||||||
| <span class="param-type"><a href="NoteShort.html">NoteShort</a></span> | <span class="param-type"><a href="FNote.html">FNote</a></span> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  | 
 | ||||||
|  |      | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |          | ||||||
|  |              | ||||||
|  | 
 | ||||||
|  |      | ||||||
|  | 
 | ||||||
|  |      | ||||||
|  |     <h4 class="name" id="getTargetNote"><span class="type-signature">(async) </span>getTargetNote<span class="signature">()</span><span class="type-signature"> → {Promise.<<a href="FNote.html">FNote</a>>}</span></h4> | ||||||
|  |      | ||||||
|  | 
 | ||||||
|  |      | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | <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#line37">line 37</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  | 
 | ||||||
|  |      | ||||||
|  | 
 | ||||||
|  |      | ||||||
|  | 
 | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | <h5>Returns:</h5> | ||||||
|  | 
 | ||||||
|  |          | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">Promise.<<a href="FNote.html">FNote</a>></span> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     </dd> |     </dd> | ||||||
| @@ -742,13 +844,13 @@ 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="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> |     <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> | </nav> | ||||||
| 
 | 
 | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
| 
 | 
 | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
| 
 | 
 | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
| @@ -2,7 +2,7 @@ | |||||||
| <html lang="en"> | <html lang="en"> | ||||||
| <head> | <head> | ||||||
|     <meta charset="utf-8"> |     <meta charset="utf-8"> | ||||||
|     <title>JSDoc: Class: Branch</title> |     <title>JSDoc: Class: FBranch</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">Class: Branch</h1> |     <h1 class="page-title">Class: FBranch</h1> | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -28,7 +28,7 @@ | |||||||
| 
 | 
 | ||||||
| <header> | <header> | ||||||
|      |      | ||||||
|         <h2><span class="attribs"><span class="type-signature"></span></span>Branch<span class="signature">()</span><span class="type-signature"></span></h2> |         <h2><span class="attribs"><span class="type-signature"></span></span>FBranch<span class="signature">()</span><span class="type-signature"></span></h2> | ||||||
|          |          | ||||||
|             <div class="class-description">Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple |             <div class="class-description">Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple | ||||||
| parents.</div> | parents.</div> | ||||||
| @@ -46,7 +46,7 @@ parents.</div> | |||||||
|      |      | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
|     <h4 class="name" id="Branch"><span class="type-signature"></span>new Branch<span class="signature">()</span><span class="type-signature"></span></h4> |     <h4 class="name" id="FBranch"><span class="type-signature"></span>new FBranch<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| @@ -94,7 +94,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_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line5">line 5</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line5">line 5</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -198,7 +198,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_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line17">line 17</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line17">line 17</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -266,7 +266,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_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line29">line 29</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line29">line 29</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -334,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_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line27">line 27</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line27">line 27</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -402,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_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line19">line 19</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line19">line 19</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -470,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_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line23">line 23</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line23">line 23</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -538,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_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line21">line 21</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line21">line 21</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -606,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_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line25">line 25</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line25">line 25</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -634,7 +634,7 @@ parents.</div> | |||||||
|      |      | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
|     <h4 class="name" id="getNote"><span class="type-signature">(async) </span>getNote<span class="signature">()</span><span class="type-signature"> → {<a href="NoteShort.html">NoteShort</a>}</span></h4> |     <h4 class="name" id="getNote"><span class="type-signature">(async) </span>getNote<span class="signature">()</span><span class="type-signature"> → {<a href="FNote.html">FNote</a>}</span></h4> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| @@ -682,7 +682,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_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line33">line 33</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line33">line 33</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -718,7 +718,7 @@ parents.</div> | |||||||
|     </dt> |     </dt> | ||||||
|     <dd> |     <dd> | ||||||
|          |          | ||||||
| <span class="param-type"><a href="NoteShort.html">NoteShort</a></span> | <span class="param-type"><a href="FNote.html">FNote</a></span> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     </dd> |     </dd> | ||||||
| @@ -736,7 +736,7 @@ parents.</div> | |||||||
|      |      | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
|     <h4 class="name" id="getNoteFromCache"><span class="type-signature"></span>getNoteFromCache<span class="signature">()</span><span class="type-signature"> → {<a href="NoteShort.html">NoteShort</a>}</span></h4> |     <h4 class="name" id="getNoteFromCache"><span class="type-signature"></span>getNoteFromCache<span class="signature">()</span><span class="type-signature"> → {<a href="FNote.html">FNote</a>}</span></h4> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| @@ -784,7 +784,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_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line38">line 38</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line38">line 38</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -820,7 +820,7 @@ parents.</div> | |||||||
|     </dt> |     </dt> | ||||||
|     <dd> |     <dd> | ||||||
|          |          | ||||||
| <span class="param-type"><a href="NoteShort.html">NoteShort</a></span> | <span class="param-type"><a href="FNote.html">FNote</a></span> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     </dd> |     </dd> | ||||||
| @@ -838,7 +838,7 @@ parents.</div> | |||||||
|      |      | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
|     <h4 class="name" id="getParentNote"><span class="type-signature">(async) </span>getParentNote<span class="signature">()</span><span class="type-signature"> → {<a href="NoteShort.html">NoteShort</a>}</span></h4> |     <h4 class="name" id="getParentNote"><span class="type-signature">(async) </span>getParentNote<span class="signature">()</span><span class="type-signature"> → {<a href="FNote.html">FNote</a>}</span></h4> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| @@ -886,7 +886,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_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line43">line 43</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line43">line 43</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -922,7 +922,7 @@ parents.</div> | |||||||
|     </dt> |     </dt> | ||||||
|     <dd> |     <dd> | ||||||
|          |          | ||||||
| <span class="param-type"><a href="NoteShort.html">NoteShort</a></span> | <span class="param-type"><a href="FNote.html">FNote</a></span> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     </dd> |     </dd> | ||||||
| @@ -988,7 +988,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_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line48">line 48</a> |         <a href="entities_fbranch.js.html">entities/fbranch.js</a>, <a href="entities_fbranch.js.html#line48">line 48</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -1056,13 +1056,13 @@ parents.</div> | |||||||
| </div> | </div> | ||||||
| 
 | 
 | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> |     <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> | </nav> | ||||||
| 
 | 
 | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
| 
 | 
 | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
| 
 | 
 | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -2,7 +2,7 @@ | |||||||
| <html lang="en"> | <html lang="en"> | ||||||
| <head> | <head> | ||||||
|     <meta charset="utf-8"> |     <meta charset="utf-8"> | ||||||
|     <title>JSDoc: Class: NoteComplement</title> |     <title>JSDoc: Class: FNoteComplement</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">Class: NoteComplement</h1> |     <h1 class="page-title">Class: FNoteComplement</h1> | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -28,9 +28,9 @@ | |||||||
| 
 | 
 | ||||||
| <header> | <header> | ||||||
|      |      | ||||||
|         <h2><span class="attribs"><span class="type-signature"></span></span>NoteComplement<span class="signature">()</span><span class="type-signature"></span></h2> |         <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 NoteShort with the main note content and other extra attributes</div> |             <div class="class-description">Complements the FNote with the main note content and other extra attributes</div> | ||||||
|          |          | ||||||
|      |      | ||||||
| </header> | </header> | ||||||
| @@ -45,7 +45,7 @@ | |||||||
|      |      | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
|     <h4 class="name" id="NoteComplement"><span class="type-signature"></span>new NoteComplement<span class="signature">()</span><span class="type-signature"></span></h4> |     <h4 class="name" id="FNoteComplement"><span class="type-signature"></span>new FNoteComplement<span class="signature">()</span><span class="type-signature"></span></h4> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| @@ -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="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line4">line 4</a> |         <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> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -193,7 +193,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line33">line 33</a> |         <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> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -261,7 +261,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line36">line 36</a> |         <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> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -333,7 +333,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line13">line 13</a> |         <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> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -401,7 +401,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line16">line 16</a> |         <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> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -469,7 +469,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line19">line 19</a> |         <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> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -537,7 +537,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line22">line 22</a> |         <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> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -605,7 +605,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line7">line 7</a> |         <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> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -673,7 +673,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line25">line 25</a> |         <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> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -741,7 +741,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line28">line 28</a> |         <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> |     </li></ul></dd> | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -775,13 +775,13 @@ | |||||||
| </div> | </div> | ||||||
| 
 | 
 | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> |     <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> | </nav> | ||||||
| 
 | 
 | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
| 
 | 
 | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
| 
 | 
 | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -2,7 +2,7 @@ | |||||||
| <html lang="en"> | <html lang="en"> | ||||||
| <head> | <head> | ||||||
|     <meta charset="utf-8"> |     <meta charset="utf-8"> | ||||||
|     <title>JSDoc: Source: entities/attribute.js</title> |     <title>JSDoc: Source: entities/fattribute.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/attribute.js</h1> |     <h1 class="page-title">Source: entities/fattribute.js</h1> | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -32,7 +32,7 @@ | |||||||
|  * Attribute is an abstract concept which has two real uses - label (key - value pair) |  * Attribute is an abstract concept which has two real uses - label (key - value pair) | ||||||
|  * and relation (representing named relationship between source and target note) |  * and relation (representing named relationship between source and target note) | ||||||
|  */ |  */ | ||||||
| class Attribute { | class FAttribute { | ||||||
|     constructor(froca, row) { |     constructor(froca, row) { | ||||||
|         this.froca = froca; |         this.froca = froca; | ||||||
| 
 | 
 | ||||||
| @@ -56,13 +56,24 @@ class Attribute { | |||||||
|         this.isInheritable = !!row.isInheritable; |         this.isInheritable = !!row.isInheritable; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** @returns {NoteShort} */ |     /** @returns {FNote} */ | ||||||
|     getNote() { |     getNote() { | ||||||
|         return this.froca.notes[this.noteId]; |         return this.froca.notes[this.noteId]; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** @returns {Promise<FNote>} */ | ||||||
|  |     async getTargetNote() { | ||||||
|  |         const targetNoteId = this.targetNoteId; | ||||||
|  | 
 | ||||||
|  |         return await this.froca.getNote(targetNoteId, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     get targetNoteId() { // alias |     get targetNoteId() { // alias | ||||||
|         return this.type === 'relation' ? this.value : undefined; |         if (this.type !== 'relation') { | ||||||
|  |             throw new Error(`Attribute ${this.attributeId} is not a relation`); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         return this.value; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     get isAutoLink() { |     get isAutoLink() { | ||||||
| @@ -70,7 +81,7 @@ class Attribute { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     get toString() { |     get toString() { | ||||||
|         return `Attribute(attributeId=${this.attributeId}, type=${this.type}, name=${this.name}, value=${this.value})`; |         return `FAttribute(attributeId=${this.attributeId}, type=${this.type}, name=${this.name}, value=${this.value})`; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     isDefinition() { |     isDefinition() { | ||||||
| @@ -93,7 +104,7 @@ class Attribute { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export default Attribute; | export default FAttribute; | ||||||
| </code></pre> | </code></pre> | ||||||
|         </article> |         </article> | ||||||
|     </section> |     </section> | ||||||
| @@ -104,13 +115,13 @@ export default Attribute; | |||||||
| </div> | </div> | ||||||
| 
 | 
 | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> |     <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> | </nav> | ||||||
| 
 | 
 | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
| 
 | 
 | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
| 
 | 
 | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
| @@ -2,7 +2,7 @@ | |||||||
| <html lang="en"> | <html lang="en"> | ||||||
| <head> | <head> | ||||||
|     <meta charset="utf-8"> |     <meta charset="utf-8"> | ||||||
|     <title>JSDoc: Source: entities/branch.js</title> |     <title>JSDoc: Source: entities/fbranch.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/branch.js</h1> |     <h1 class="page-title">Source: entities/fbranch.js</h1> | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -30,7 +30,7 @@ | |||||||
|  * Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple |  * Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple | ||||||
|  * parents. |  * parents. | ||||||
|  */ |  */ | ||||||
| class Branch { | class FBranch { | ||||||
|     constructor(froca, row) { |     constructor(froca, row) { | ||||||
|         this.froca = froca; |         this.froca = froca; | ||||||
| 
 | 
 | ||||||
| @@ -57,17 +57,17 @@ class Branch { | |||||||
|         this.fromSearchNote = !!row.fromSearchNote; |         this.fromSearchNote = !!row.fromSearchNote; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** @returns {NoteShort} */ |     /** @returns {FNote} */ | ||||||
|     async getNote() { |     async getNote() { | ||||||
|         return this.froca.getNote(this.noteId); |         return this.froca.getNote(this.noteId); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** @returns {NoteShort} */ |     /** @returns {FNote} */ | ||||||
|     getNoteFromCache() { |     getNoteFromCache() { | ||||||
|         return this.froca.getNoteFromCache(this.noteId); |         return this.froca.getNoteFromCache(this.noteId); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** @returns {NoteShort} */ |     /** @returns {FNote} */ | ||||||
|     async getParentNote() { |     async getParentNote() { | ||||||
|         return this.froca.getNote(this.parentNoteId); |         return this.froca.getNote(this.parentNoteId); | ||||||
|     } |     } | ||||||
| @@ -78,11 +78,17 @@ class Branch { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     get toString() { |     get toString() { | ||||||
|         return `Branch(branchId=${this.branchId})`; |         return `FBranch(branchId=${this.branchId})`; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     get pojo() { | ||||||
|  |         const pojo = {...this}; | ||||||
|  |         delete pojo.froca; | ||||||
|  |         return pojo; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export default Branch; | export default FBranch; | ||||||
| </code></pre> | </code></pre> | ||||||
|         </article> |         </article> | ||||||
|     </section> |     </section> | ||||||
| @@ -93,13 +99,13 @@ export default Branch; | |||||||
| </div> | </div> | ||||||
| 
 | 
 | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> |     <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> | </nav> | ||||||
| 
 | 
 | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
| 
 | 
 | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
| 
 | 
 | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
| @@ -2,7 +2,7 @@ | |||||||
| <html lang="en"> | <html lang="en"> | ||||||
| <head> | <head> | ||||||
|     <meta charset="utf-8"> |     <meta charset="utf-8"> | ||||||
|     <title>JSDoc: Source: entities/note_short.js</title> |     <title>JSDoc: Source: entities/fnote.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/note_short.js</h1> |     <h1 class="page-title">Source: entities/fnote.js</h1> | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -31,6 +31,8 @@ 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 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 cssClassManager from "../services/css_class_manager.js"; | ||||||
| 
 | 
 | ||||||
| const LABEL = 'label'; | const LABEL = 'label'; | ||||||
| const RELATION = 'relation'; | const RELATION = 'relation'; | ||||||
| @@ -41,18 +43,18 @@ const NOTE_TYPE_ICONS = { | |||||||
|     "code": "bx bx-code", |     "code": "bx bx-code", | ||||||
|     "render": "bx bx-extension", |     "render": "bx bx-extension", | ||||||
|     "search": "bx bx-file-find", |     "search": "bx bx-file-find", | ||||||
|     "relation-map": "bx bx-map-alt", |     "relationMap": "bx bx-map-alt", | ||||||
|     "book": "bx bx-book", |     "book": "bx bx-book", | ||||||
|     "note-map": "bx bx-map-alt", |     "noteMap": "bx bx-map-alt", | ||||||
|     "mermaid": "bx bx-selection" |     "mermaid": "bx bx-selection", | ||||||
|  |     "canvas": "bx bx-pen", | ||||||
|  |     "webView": "bx bx-globe-alt", | ||||||
|  |     "launcher": "bx bx-link", | ||||||
|  |     "doc": "bx bxs-file-doc", | ||||||
|  |     "contentWidget": "bx bxs-widget" | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /** | class FNote { | ||||||
|  * FIXME: since there's no "full note" anymore we can rename this to Note |  | ||||||
|  * |  | ||||||
|  * This note's representation is used in note tree and is kept in Froca. |  | ||||||
|  */ |  | ||||||
| class NoteShort { |  | ||||||
|     /** |     /** | ||||||
|      * @param {Froca} froca |      * @param {Froca} froca | ||||||
|      * @param {Object.<string, Object>} row |      * @param {Object.<string, Object>} row | ||||||
| @@ -139,8 +141,8 @@ class NoteShort { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     async getContent() { |     async getContent() { | ||||||
|         // we're not caching content since these objects are in froca and as such pretty long lived |         // we're not caching content since these objects are in froca and as such pretty long-lived | ||||||
|         const note = await server.get("notes/" + this.noteId); |         const note = await server.get(`notes/${this.noteId}`); | ||||||
| 
 | 
 | ||||||
|         return note.content; |         return note.content; | ||||||
|     } |     } | ||||||
| @@ -152,30 +154,50 @@ class NoteShort { | |||||||
|             return JSON.parse(content); |             return JSON.parse(content); | ||||||
|         } |         } | ||||||
|         catch (e) { |         catch (e) { | ||||||
|             console.log(`Cannot parse content of note ${this.noteId}: `, e.message); |             console.log(`Cannot parse content of note '${this.noteId}': `, e.message); | ||||||
| 
 | 
 | ||||||
|             return null; |             return null; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** @returns {string[]} */ |     /** | ||||||
|     getBranchIds() { |      * @returns {string[]} | ||||||
|  |      */ | ||||||
|  |     getParentBranchIds() { | ||||||
|         return Object.values(this.parentToBranch); |         return Object.values(this.parentToBranch); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** @returns {Branch[]} */ |     /** | ||||||
|     getBranches() { |      * @returns {string[]} | ||||||
|  |      * @deprecated use getParentBranchIds() instead | ||||||
|  |      */ | ||||||
|  |     getBranchIds() { | ||||||
|  |         return this.getParentBranchIds(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * @returns {FBranch[]} | ||||||
|  |      */ | ||||||
|  |     getParentBranches() { | ||||||
|         const branchIds = Object.values(this.parentToBranch); |         const branchIds = Object.values(this.parentToBranch); | ||||||
| 
 | 
 | ||||||
|         return this.froca.getBranches(branchIds); |         return this.froca.getBranches(branchIds); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * @returns {FBranch[]} | ||||||
|  |      * @deprecated use getParentBranches() instead | ||||||
|  |      */ | ||||||
|  |     getBranches() { | ||||||
|  |         return this.getParentBranches(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /** @returns {boolean} */ |     /** @returns {boolean} */ | ||||||
|     hasChildren() { |     hasChildren() { | ||||||
|         return this.children.length > 0; |         return this.children.length > 0; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** @returns {Branch[]} */ |     /** @returns {FBranch[]} */ | ||||||
|     getChildBranches() { |     getChildBranches() { | ||||||
|         // don't use Object.values() to guarantee order |         // don't use Object.values() to guarantee order | ||||||
|         const branchIds = this.children.map(childNoteId => this.childToBranch[childNoteId]); |         const branchIds = this.children.map(childNoteId => this.childToBranch[childNoteId]); | ||||||
| @@ -188,7 +210,7 @@ class NoteShort { | |||||||
|         return this.parents; |         return this.parents; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** @returns {NoteShort[]} */ |     /** @returns {FNote[]} */ | ||||||
|     getParentNotes() { |     getParentNotes() { | ||||||
|         return this.froca.getNotesFromCache(this.parents); |         return this.froca.getNotesFromCache(this.parents); | ||||||
|     } |     } | ||||||
| @@ -205,7 +227,7 @@ class NoteShort { | |||||||
| 
 | 
 | ||||||
|             const aNote = this.froca.getNoteFromCache([aNoteId]); |             const aNote = this.froca.getNoteFromCache([aNoteId]); | ||||||
| 
 | 
 | ||||||
|             if (aNote.hasLabel('archived')) { |             if (aNote.isArchived || aNote.isHiddenCompletely()) { | ||||||
|                 return 1; |                 return 1; | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
| @@ -213,12 +235,16 @@ class NoteShort { | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     get isArchived() { | ||||||
|  |         return this.hasAttribute('label', 'archived'); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /** @returns {string[]} */ |     /** @returns {string[]} */ | ||||||
|     getChildNoteIds() { |     getChildNoteIds() { | ||||||
|         return this.children; |         return this.children; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** @returns {Promise<NoteShort[]>} */ |     /** @returns {Promise<FNote[]>} */ | ||||||
|     async getChildNotes() { |     async getChildNotes() { | ||||||
|         return await this.froca.getNotes(this.children); |         return await this.froca.getNotes(this.children); | ||||||
|     } |     } | ||||||
| @@ -226,7 +252,7 @@ class NoteShort { | |||||||
|     /** |     /** | ||||||
|      * @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 {Attribute[]} all note's attributes, including inherited ones |      * @returns {FAttribute[]} all note's attributes, including inherited ones | ||||||
|      */ |      */ | ||||||
|     getOwnedAttributes(type, name) { |     getOwnedAttributes(type, name) { | ||||||
|         const attrs = this.attributes |         const attrs = this.attributes | ||||||
| @@ -239,7 +265,7 @@ class NoteShort { | |||||||
|     /** |     /** | ||||||
|      * @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 {Attribute[]} all note's attributes, including inherited ones |      * @returns {FAttribute[]} all note's attributes, including inherited ones | ||||||
|      */ |      */ | ||||||
|     getAttributes(type, name) { |     getAttributes(type, name) { | ||||||
|         return this.__filterAttrs(this.__getCachedAttributes([]), type, name); |         return this.__filterAttrs(this.__getCachedAttributes([]), type, name); | ||||||
| @@ -256,7 +282,8 @@ class NoteShort { | |||||||
|             const newPath = [...path, this.noteId]; |             const newPath = [...path, this.noteId]; | ||||||
|             const attrArrs = [ this.getOwnedAttributes() ]; |             const attrArrs = [ this.getOwnedAttributes() ]; | ||||||
| 
 | 
 | ||||||
|             if (this.noteId !== 'root') { |             // inheritable attrs on root are typically not intended to be applied to hidden subtree #3537 | ||||||
|  |             if (this.noteId !== 'root' && this.noteId !== '_hidden') { | ||||||
|                 for (const parentNote of this.getParentNotes()) { |                 for (const parentNote of this.getParentNotes()) { | ||||||
|                     // these virtual parent-child relationships are also loaded into froca |                     // these virtual parent-child relationships are also loaded into froca | ||||||
|                     if (parentNote.type !== 'search') { |                     if (parentNote.type !== 'search') { | ||||||
| @@ -265,11 +292,15 @@ class NoteShort { | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             for (const templateAttr of attrArrs.flat().filter(attr => attr.type === 'relation' && attr.name === 'template')) { |             for (const templateAttr of attrArrs.flat().filter(attr => attr.type === 'relation' && ['template', 'inherit'].includes(attr.name))) { | ||||||
|                 const templateNote = this.froca.notes[templateAttr.value]; |                 const templateNote = this.froca.notes[templateAttr.value]; | ||||||
| 
 | 
 | ||||||
|                 if (templateNote && templateNote.noteId !== this.noteId) { |                 if (templateNote && templateNote.noteId !== this.noteId) { | ||||||
|                     attrArrs.push(templateNote.__getCachedAttributes(newPath)); |                     attrArrs.push( | ||||||
|  |                         templateNote.__getCachedAttributes(newPath) | ||||||
|  |                             // template attr is used as a marker for templates, but it's not meant to be inherited | ||||||
|  |                             .filter(attr => !(attr.type === 'label' && (attr.name === 'template' || attr.name === 'workspacetemplate'))) | ||||||
|  |                     ); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
| @@ -289,7 +320,7 @@ class NoteShort { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     isRoot() { |     isRoot() { | ||||||
|         return this.noted |         return this.noteId === 'root'; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     getAllNotePaths(encounteredNoteIds = null) { |     getAllNotePaths(encounteredNoteIds = null) { | ||||||
| @@ -339,9 +370,9 @@ class NoteShort { | |||||||
|         const notePaths = this.getAllNotePaths().map(path => ({ |         const notePaths = this.getAllNotePaths().map(path => ({ | ||||||
|             notePath: path, |             notePath: path, | ||||||
|             isInHoistedSubTree: path.includes(hoistedNotePath), |             isInHoistedSubTree: path.includes(hoistedNotePath), | ||||||
|             isArchived: path.find(noteId => froca.notes[noteId].hasLabel('archived')), |             isArchived: path.find(noteId => froca.notes[noteId].isArchived), | ||||||
|             isSearch: path.find(noteId => froca.notes[noteId].type === 'search'), |             isSearch: path.find(noteId => froca.notes[noteId].type === 'search'), | ||||||
|             isHidden: path.includes("hidden") |             isHidden: path.includes('_hidden') | ||||||
|         })); |         })); | ||||||
| 
 | 
 | ||||||
|         notePaths.sort((a, b) => { |         notePaths.sort((a, b) => { | ||||||
| @@ -351,6 +382,8 @@ class NoteShort { | |||||||
|                 return a.isSearch ? 1 : -1; |                 return a.isSearch ? 1 : -1; | ||||||
|             } else if (a.isArchived !== b.isArchived) { |             } else if (a.isArchived !== b.isArchived) { | ||||||
|                 return a.isArchived ? 1 : -1; |                 return a.isArchived ? 1 : -1; | ||||||
|  |             } else if (a.isHidden !== b.isHidden) { | ||||||
|  |                 return a.isHidden ? 1 : -1; | ||||||
|             } else { |             } else { | ||||||
|                 return a.notePath.length - b.notePath.length; |                 return a.notePath.length - b.notePath.length; | ||||||
|             } |             } | ||||||
| @@ -359,11 +392,36 @@ class NoteShort { | |||||||
|         return notePaths; |         return notePaths; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * @return boolean - true if there's no non-hidden path, note is not cloned to the visible tree | ||||||
|  |      */ | ||||||
|  |     isHiddenCompletely() { | ||||||
|  |         if (this.noteId === 'root') { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         for (const parentNote of this.getParentNotes()) { | ||||||
|  |             if (parentNote.noteId === 'root') { | ||||||
|  |                 return false; | ||||||
|  |             } else if (parentNote.noteId === '_hidden') { | ||||||
|  |                 continue; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             if (!parentNote.isHiddenCompletely()) { | ||||||
|  |                 return false; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         return true; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     __filterAttrs(attributes, type, name) { |     __filterAttrs(attributes, type, name) { | ||||||
|  |         this.__validateTypeName(type, name); | ||||||
|  | 
 | ||||||
|         if (!type && !name) { |         if (!type && !name) { | ||||||
|             return attributes; |             return attributes; | ||||||
|         } else if (type && name) { |         } else if (type && name) { | ||||||
|             return attributes.filter(attr => attr.type === type && attr.name === name); |             return attributes.filter(attr => attr.name === name && attr.type === type); | ||||||
|         } else if (type) { |         } else if (type) { | ||||||
|             return attributes.filter(attr => attr.type === type); |             return attributes.filter(attr => attr.type === type); | ||||||
|         } else if (name) { |         } else if (name) { | ||||||
| @@ -377,9 +435,22 @@ class NoteShort { | |||||||
|         return attrs.filter(attr => attr.isInheritable); |         return attrs.filter(attr => attr.isInheritable); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     __validateTypeName(type, name) { | ||||||
|  |         if (type && type !== 'label' && type !== 'relation') { | ||||||
|  |             throw new Error(`Unrecognized attribute type '${type}'. Only 'label' and 'relation' are possible values.`); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (name) { | ||||||
|  |             const firstLetter = name.charAt(0); | ||||||
|  |             if (firstLetter === '#' || firstLetter === '~') { | ||||||
|  |                 throw new Error(`Detect '#' or '~' in the attribute's name. In the API, attribute names should be set without these characters.`); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * @param {string} [name] - label name to filter |      * @param {string} [name] - label name to filter | ||||||
|      * @returns {Attribute[]} all note's labels (attributes with type label), including inherited ones |      * @returns {FAttribute[]} all note's labels (attributes with type label), including inherited ones | ||||||
|      */ |      */ | ||||||
|     getOwnedLabels(name) { |     getOwnedLabels(name) { | ||||||
|         return this.getOwnedAttributes(LABEL, name); |         return this.getOwnedAttributes(LABEL, name); | ||||||
| @@ -387,7 +458,7 @@ class NoteShort { | |||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @param {string} [name] - label name to filter |      * @param {string} [name] - label name to filter | ||||||
|      * @returns {Attribute[]} all note's labels (attributes with type label), including inherited ones |      * @returns {FAttribute[]} all note's labels (attributes with type label), including inherited ones | ||||||
|      */ |      */ | ||||||
|     getLabels(name) { |     getLabels(name) { | ||||||
|         return this.getAttributes(LABEL, name); |         return this.getAttributes(LABEL, name); | ||||||
| @@ -406,6 +477,9 @@ class NoteShort { | |||||||
|         else if (this.noteId === 'root') { |         else if (this.noteId === 'root') { | ||||||
|             return "bx bx-chevrons-right"; |             return "bx bx-chevrons-right"; | ||||||
|         } |         } | ||||||
|  |         if (this.noteId === '_share') { | ||||||
|  |             return "bx bx-share-alt"; | ||||||
|  |         } | ||||||
|         else if (this.type === 'text') { |         else if (this.type === 'text') { | ||||||
|             if (this.isFolder()) { |             if (this.isFolder()) { | ||||||
|                 return "bx bx-folder"; |                 return "bx bx-folder"; | ||||||
| @@ -422,6 +496,11 @@ class NoteShort { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     getColorClass() { | ||||||
|  |         const color = this.getLabelValue("color"); | ||||||
|  |         return cssClassManager.createClassForColor(color); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     isFolder() { |     isFolder() { | ||||||
|         return this.type === 'search' |         return this.type === 'search' | ||||||
|             || this.getFilteredChildBranches().length > 0; |             || this.getFilteredChildBranches().length > 0; | ||||||
| @@ -431,7 +510,7 @@ class NoteShort { | |||||||
|         let childBranches = this.getChildBranches(); |         let childBranches = this.getChildBranches(); | ||||||
| 
 | 
 | ||||||
|         if (!childBranches) { |         if (!childBranches) { | ||||||
|             ws.logError(`No children for ${parentNote}. This shouldn't happen.`); |             ws.logError(`No children for '${this.noteId}'. This shouldn't happen.`); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| @@ -452,7 +531,7 @@ class NoteShort { | |||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @param {string} [name] - relation name to filter |      * @param {string} [name] - relation name to filter | ||||||
|      * @returns {Attribute[]} all note's relations (attributes with type relation), including inherited ones |      * @returns {FAttribute[]} all note's relations (attributes with type relation), including inherited ones | ||||||
|      */ |      */ | ||||||
|     getOwnedRelations(name) { |     getOwnedRelations(name) { | ||||||
|         return this.getOwnedAttributes(RELATION, name); |         return this.getOwnedAttributes(RELATION, name); | ||||||
| @@ -460,7 +539,7 @@ class NoteShort { | |||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @param {string} [name] - relation name to filter |      * @param {string} [name] - relation name to filter | ||||||
|      * @returns {Attribute[]} all note's relations (attributes with type relation), including inherited ones |      * @returns {FAttribute[]} all note's relations (attributes with type relation), including inherited ones | ||||||
|      */ |      */ | ||||||
|     getRelations(name) { |     getRelations(name) { | ||||||
|         return this.getAttributes(RELATION, name); |         return this.getAttributes(RELATION, name); | ||||||
| @@ -487,23 +566,23 @@ class NoteShort { | |||||||
|     /** |     /** | ||||||
|      * @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 {Attribute} attribute of given type and name. If there's more such attributes, first is  returned. Returns null if there's no such attribute belonging to this note. |      * @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. | ||||||
|      */ |      */ | ||||||
|     getOwnedAttribute(type, name) { |     getOwnedAttribute(type, name) { | ||||||
|         const attributes = this.getOwnedAttributes(type, name); |         const attributes = this.getOwnedAttributes(); | ||||||
| 
 | 
 | ||||||
|         return attributes.length > 0 ? attributes[0] : 0; |         return attributes.find(attr => attr.name === name && attr.type === type); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @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 {Attribute} attribute of given type and name. If there's more such attributes, first is  returned. Returns null if there's no such attribute belonging to this note. |      * @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. | ||||||
|      */ |      */ | ||||||
|     getAttribute(type, name) { |     getAttribute(type, name) { | ||||||
|         const attributes = this.getAttributes(type, name); |         const attributes = this.getAttributes(); | ||||||
| 
 | 
 | ||||||
|         return attributes.length > 0 ? attributes[0] : null; |         return attributes.find(attr => attr.name === name && attr.type === type); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -554,25 +633,25 @@ class NoteShort { | |||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @param {string} name - label name |      * @param {string} name - label name | ||||||
|      * @returns {Attribute} label if it exists, null otherwise |      * @returns {FAttribute} label if it exists, null otherwise | ||||||
|      */ |      */ | ||||||
|     getOwnedLabel(name) { return this.getOwnedAttribute(LABEL, name); } |     getOwnedLabel(name) { return this.getOwnedAttribute(LABEL, name); } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @param {string} name - label name |      * @param {string} name - label name | ||||||
|      * @returns {Attribute} label if it exists, null otherwise |      * @returns {FAttribute} label if it exists, null otherwise | ||||||
|      */ |      */ | ||||||
|     getLabel(name) { return this.getAttribute(LABEL, name); } |     getLabel(name) { return this.getAttribute(LABEL, name); } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @param {string} name - relation name |      * @param {string} name - relation name | ||||||
|      * @returns {Attribute} relation if it exists, null otherwise |      * @returns {FAttribute} relation if it exists, null otherwise | ||||||
|      */ |      */ | ||||||
|     getOwnedRelation(name) { return this.getOwnedAttribute(RELATION, name); } |     getOwnedRelation(name) { return this.getOwnedAttribute(RELATION, name); } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @param {string} name - relation name |      * @param {string} name - relation name | ||||||
|      * @returns {Attribute} relation if it exists, null otherwise |      * @returns {FAttribute} relation if it exists, null otherwise | ||||||
|      */ |      */ | ||||||
|     getRelation(name) { return this.getAttribute(RELATION, name); } |     getRelation(name) { return this.getAttribute(RELATION, name); } | ||||||
| 
 | 
 | ||||||
| @@ -602,7 +681,7 @@ class NoteShort { | |||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @param {string} name |      * @param {string} name | ||||||
|      * @returns {Promise<NoteShort>|null} target note of the relation or null (if target is empty or note was not found) |      * @returns {Promise<FNote>|null} target note of the relation or null (if target is empty or note was not found) | ||||||
|      */ |      */ | ||||||
|     async getRelationTarget(name) { |     async getRelationTarget(name) { | ||||||
|         const targets = await this.getRelationTargets(name); |         const targets = await this.getRelationTargets(name); | ||||||
| @@ -612,7 +691,7 @@ class NoteShort { | |||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @param {string} [name] - relation name to filter |      * @param {string} [name] - relation name to filter | ||||||
|      * @returns {Promise<NoteShort[]>} |      * @returns {Promise<FNote[]>} | ||||||
|      */ |      */ | ||||||
|     async getRelationTargets(name) { |     async getRelationTargets(name) { | ||||||
|         const relations = this.getRelations(name); |         const relations = this.getRelations(name); | ||||||
| @@ -626,10 +705,13 @@ class NoteShort { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @returns {NoteShort[]} |      * @returns {FNote[]} | ||||||
|      */ |      */ | ||||||
|     getTemplateNotes() { |     getNotesToInheritAttributesFrom() { | ||||||
|         const relations = this.getRelations('template'); |         const relations = [ | ||||||
|  |             ...this.getRelations('template'), | ||||||
|  |             ...this.getRelations('inherit') | ||||||
|  |         ]; | ||||||
| 
 | 
 | ||||||
|         return relations.map(rel => this.froca.notes[rel.value]); |         return relations.map(rel => this.froca.notes[rel.value]); | ||||||
|     } |     } | ||||||
| @@ -639,17 +721,22 @@ class NoteShort { | |||||||
|             return []; |             return []; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         return this.getAttributes() |         const promotedAttrs = this.getAttributes() | ||||||
|             .filter(attr => attr.isDefinition()) |             .filter(attr => attr.isDefinition()) | ||||||
|             .filter(attr => { |             .filter(attr => { | ||||||
|                 const def = attr.getDefinition(); |                 const def = attr.getDefinition(); | ||||||
| 
 | 
 | ||||||
|                 return def && def.isPromoted; |                 return def && def.isPromoted; | ||||||
|             }); |             }); | ||||||
|  | 
 | ||||||
|  |         // attrs are not resorted if position changes after initial load | ||||||
|  |         promotedAttrs.sort((a, b) => a.position < b.position ? -1 : 1); | ||||||
|  | 
 | ||||||
|  |         return promotedAttrs; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     hasAncestor(ancestorNote, visitedNoteIds = null) { |     hasAncestor(ancestorNoteId, followTemplates = false, visitedNoteIds = null) { | ||||||
|         if (this.noteId === ancestorNote.noteId) { |         if (this.noteId === ancestorNoteId) { | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| @@ -662,14 +749,16 @@ class NoteShort { | |||||||
| 
 | 
 | ||||||
|         visitedNoteIds.add(this.noteId); |         visitedNoteIds.add(this.noteId); | ||||||
| 
 | 
 | ||||||
|         for (const templateNote of this.getTemplateNotes()) { |         if (followTemplates) { | ||||||
|             if (templateNote.hasAncestor(ancestorNote, visitedNoteIds)) { |             for (const templateNote of this.getNotesToInheritAttributesFrom()) { | ||||||
|  |                 if (templateNote.hasAncestor(ancestorNoteId, followTemplates, visitedNoteIds)) { | ||||||
|                     return true; |                     return true; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         for (const parentNote of this.getParentNotes()) { |         for (const parentNote of this.getParentNotes()) { | ||||||
|             if (parentNote.hasAncestor(ancestorNote, visitedNoteIds)) { |             if (parentNote.hasAncestor(ancestorNoteId, followTemplates, visitedNoteIds)) { | ||||||
|                 return true; |                 return true; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| @@ -677,6 +766,10 @@ class NoteShort { | |||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     isInHiddenSubtree() { | ||||||
|  |         return this.noteId === '_hidden' || this.hasAncestor('_hidden'); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * @deprecated NOOP |      * @deprecated NOOP | ||||||
|      */ |      */ | ||||||
| @@ -685,7 +778,7 @@ class NoteShort { | |||||||
|     /** |     /** | ||||||
|      * Get relations which target this note |      * Get relations which target this note | ||||||
|      * |      * | ||||||
|      * @returns {Attribute[]} |      * @returns {FAttribute[]} | ||||||
|      */ |      */ | ||||||
|     getTargetRelations() { |     getTargetRelations() { | ||||||
|         return this.targetRelations |         return this.targetRelations | ||||||
| @@ -695,7 +788,7 @@ class NoteShort { | |||||||
|     /** |     /** | ||||||
|      * Get relations which target this note |      * Get relations which target this note | ||||||
|      * |      * | ||||||
|      * @returns {NoteShort[]} |      * @returns {FNote[]} | ||||||
|      */ |      */ | ||||||
|     async getTargetRelationSourceNotes() { |     async getTargetRelationSourceNotes() { | ||||||
|         const targetRelations = this.getTargetRelations(); |         const targetRelations = this.getTargetRelations(); | ||||||
| @@ -706,7 +799,7 @@ class NoteShort { | |||||||
|     /** |     /** | ||||||
|      * Return note complement which is most importantly note's content |      * Return note complement which is most importantly note's content | ||||||
|      * |      * | ||||||
|      * @return {Promise<NoteComplement>} |      * @returns {Promise<FNoteComplement>} | ||||||
|      */ |      */ | ||||||
|     async getNoteComplement() { |     async getNoteComplement() { | ||||||
|         return await this.froca.getNoteComplement(this.noteId); |         return await this.froca.getNoteComplement(this.noteId); | ||||||
| @@ -738,9 +831,9 @@ class NoteShort { | |||||||
|         return labels.length > 0 ? labels[0].value : ""; |         return labels.length > 0 ? labels[0].value : ""; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** @returns {boolean} true if this note is JavaScript (code or attachment) */ |     /** @returns {boolean} true if this note is JavaScript (code or file) */ | ||||||
|     isJavaScript() { |     isJavaScript() { | ||||||
|         return (this.type === "code" || this.type === "file") |         return (this.type === "code" || this.type === "file" || this.type === 'launcher') | ||||||
|             && (this.mime.startsWith("application/javascript") |             && (this.mime.startsWith("application/javascript") | ||||||
|                 || this.mime === "application/x-javascript" |                 || this.mime === "application/x-javascript" | ||||||
|                 || this.mime === "text/javascript"); |                 || this.mime === "text/javascript"); | ||||||
| @@ -777,18 +870,50 @@ class NoteShort { | |||||||
| 
 | 
 | ||||||
|         if (env === "frontend") { |         if (env === "frontend") { | ||||||
|             const bundleService = (await import("../services/bundle.js")).default; |             const bundleService = (await import("../services/bundle.js")).default; | ||||||
|             await bundleService.getAndExecuteBundle(this.noteId); |             return await bundleService.getAndExecuteBundle(this.noteId); | ||||||
|         } |         } | ||||||
|         else if (env === "backend") { |         else if (env === "backend") { | ||||||
|             await server.post('script/run/' + this.noteId); |             const resp = await server.post(`script/run/${this.noteId}`); | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|             throw new Error(`Unrecognized env type ${env} for note ${this.noteId}`); |             throw new Error(`Unrecognized env type ${env} for note ${this.noteId}`); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     isShared() { | ||||||
|  |         for (const parentNoteId of this.parents) { | ||||||
|  |             if (parentNoteId === 'root' || parentNoteId === 'none') { | ||||||
|  |                 continue; | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
| export default NoteShort; |             const parentNote = froca.notes[parentNoteId]; | ||||||
|  | 
 | ||||||
|  |             if (!parentNote || parentNote.type === 'search') { | ||||||
|  |                 continue; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             if (parentNote.noteId === '_share' || parentNote.isShared()) { | ||||||
|  |                 return true; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     isContentAvailable() { | ||||||
|  |         return !this.isProtected || protectedSessionHolder.isProtectedSessionAvailable() | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     isLaunchBarConfig() { | ||||||
|  |         return this.type === 'launcher' || ['_lbRoot', '_lbAvailableLaunchers', '_lbVisibleLaunchers'].includes(this.noteId); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     isOptions() { | ||||||
|  |         return this.noteId.startsWith("_options"); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export default FNote; | ||||||
| </code></pre> | </code></pre> | ||||||
|         </article> |         </article> | ||||||
|     </section> |     </section> | ||||||
| @@ -799,13 +924,13 @@ export default NoteShort; | |||||||
| </div> | </div> | ||||||
| 
 | 
 | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> |     <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> | </nav> | ||||||
| 
 | 
 | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
| 
 | 
 | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
| 
 | 
 | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
| @@ -2,7 +2,7 @@ | |||||||
| <html lang="en"> | <html lang="en"> | ||||||
| <head> | <head> | ||||||
|     <meta charset="utf-8"> |     <meta charset="utf-8"> | ||||||
|     <title>JSDoc: Source: entities/note_complement.js</title> |     <title>JSDoc: Source: entities/fnote_complement.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/note_complement.js</h1> |     <h1 class="page-title">Source: entities/fnote_complement.js</h1> | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| @@ -27,9 +27,9 @@ | |||||||
|     <section> |     <section> | ||||||
|         <article> |         <article> | ||||||
|             <pre class="prettyprint source linenums"><code>/** |             <pre class="prettyprint source linenums"><code>/** | ||||||
|  * Complements the NoteShort with the main note content and other extra attributes |  * Complements the FNote with the main note content and other extra attributes | ||||||
|  */ |  */ | ||||||
| class NoteComplement { | class FNoteComplement { | ||||||
|     constructor(row) { |     constructor(row) { | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
|         this.noteId = row.noteId; |         this.noteId = row.noteId; | ||||||
| @@ -65,7 +65,7 @@ class NoteComplement { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export default NoteComplement; | export default FNoteComplement; | ||||||
| </code></pre> | </code></pre> | ||||||
|         </article> |         </article> | ||||||
|     </section> |     </section> | ||||||
| @@ -76,13 +76,13 @@ export default NoteComplement; | |||||||
| </div> | </div> | ||||||
| 
 | 
 | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> |     <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> | </nav> | ||||||
| 
 | 
 | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
| 
 | 
 | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
| 
 | 
 | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
| @@ -1,440 +0,0 @@ | |||||||
| <!DOCTYPE html> |  | ||||||
| <html lang="en"> |  | ||||||
| <head> |  | ||||||
|     <meta charset="utf-8"> |  | ||||||
|     <title>JSDoc: Global</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">Global</h1> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <section> |  | ||||||
|  |  | ||||||
| <header> |  | ||||||
|      |  | ||||||
|         <h2></h2> |  | ||||||
|          |  | ||||||
|      |  | ||||||
| </header> |  | ||||||
|  |  | ||||||
| <article> |  | ||||||
|     <div class="container-overview"> |  | ||||||
|      |  | ||||||
|          |  | ||||||
|  |  | ||||||
|          |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|      |  | ||||||
|     </div> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|         <h3 class="subsection-title">Methods</h3> |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <h4 class="name" id="doRenderBody"><span class="type-signature">(async) </span>doRenderBody<span class="signature">()</span><span class="type-signature"></span></h4> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <div class="description"> |  | ||||||
|     for overriding |  | ||||||
| </div> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="widgets_collapsible_widget.js.html">widgets/collapsible_widget.js</a>, <a href="widgets_collapsible_widget.js.html#line34">line 34</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|         <h3 class="subsection-title">Type Definitions</h3> |  | ||||||
|  |  | ||||||
|          |  | ||||||
|                  |  | ||||||
| <h4 class="name" id="ToolbarButtonOptions">ToolbarButtonOptions</h4> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Type:</h5> |  | ||||||
|     <ul> |  | ||||||
|         <li> |  | ||||||
|              |  | ||||||
| <span class="param-type">Object</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         </li> |  | ||||||
|     </ul> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5 class="subsection-title">Properties:</h5> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
| <table class="props"> |  | ||||||
|     <thead> |  | ||||||
|     <tr> |  | ||||||
|          |  | ||||||
|         <th>Name</th> |  | ||||||
|          |  | ||||||
|  |  | ||||||
|         <th>Type</th> |  | ||||||
|  |  | ||||||
|          |  | ||||||
|         <th>Attributes</th> |  | ||||||
|          |  | ||||||
|  |  | ||||||
|          |  | ||||||
|  |  | ||||||
|         <th class="last">Description</th> |  | ||||||
|     </tr> |  | ||||||
|     </thead> |  | ||||||
|  |  | ||||||
|     <tbody> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|         <tr> |  | ||||||
|              |  | ||||||
|                 <td class="name"><code>title</code></td> |  | ||||||
|              |  | ||||||
|  |  | ||||||
|             <td class="type"> |  | ||||||
|              |  | ||||||
|                  |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|              |  | ||||||
|             </td> |  | ||||||
|  |  | ||||||
|              |  | ||||||
|                 <td class="attributes"> |  | ||||||
|                  |  | ||||||
|  |  | ||||||
|                  |  | ||||||
|                 </td> |  | ||||||
|              |  | ||||||
|  |  | ||||||
|              |  | ||||||
|  |  | ||||||
|             <td class="description last"></td> |  | ||||||
|         </tr> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|         <tr> |  | ||||||
|              |  | ||||||
|                 <td class="name"><code>icon</code></td> |  | ||||||
|              |  | ||||||
|  |  | ||||||
|             <td class="type"> |  | ||||||
|              |  | ||||||
|                  |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|              |  | ||||||
|             </td> |  | ||||||
|  |  | ||||||
|              |  | ||||||
|                 <td class="attributes"> |  | ||||||
|                  |  | ||||||
|                     <optional><br> |  | ||||||
|                  |  | ||||||
|  |  | ||||||
|                  |  | ||||||
|                 </td> |  | ||||||
|              |  | ||||||
|  |  | ||||||
|              |  | ||||||
|  |  | ||||||
|             <td class="description last">name of the boxicon to be used (e.g. "time" for "bx-time" icon)</td> |  | ||||||
|         </tr> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|         <tr> |  | ||||||
|              |  | ||||||
|                 <td class="name"><code>action</code></td> |  | ||||||
|              |  | ||||||
|  |  | ||||||
|             <td class="type"> |  | ||||||
|              |  | ||||||
|                  |  | ||||||
| <span class="param-type">function</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|              |  | ||||||
|             </td> |  | ||||||
|  |  | ||||||
|              |  | ||||||
|                 <td class="attributes"> |  | ||||||
|                  |  | ||||||
|  |  | ||||||
|                  |  | ||||||
|                 </td> |  | ||||||
|              |  | ||||||
|  |  | ||||||
|              |  | ||||||
|  |  | ||||||
|             <td class="description last">callback handling the click on the button</td> |  | ||||||
|         </tr> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|         <tr> |  | ||||||
|              |  | ||||||
|                 <td class="name"><code>shortcut</code></td> |  | ||||||
|              |  | ||||||
|  |  | ||||||
|             <td class="type"> |  | ||||||
|              |  | ||||||
|                  |  | ||||||
| <span class="param-type">string</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|              |  | ||||||
|             </td> |  | ||||||
|  |  | ||||||
|              |  | ||||||
|                 <td class="attributes"> |  | ||||||
|                  |  | ||||||
|                     <optional><br> |  | ||||||
|                  |  | ||||||
|  |  | ||||||
|                  |  | ||||||
|                 </td> |  | ||||||
|              |  | ||||||
|  |  | ||||||
|              |  | ||||||
|  |  | ||||||
|             <td class="description last">keyboard shortcut for the button, e.g. "alt+t"</td> |  | ||||||
|         </tr> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     </tbody> |  | ||||||
| </table> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <dt class="tag-source">Source:</dt> |  | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |  | ||||||
|         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line104">line 104</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|              |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </article> |  | ||||||
|  |  | ||||||
| </section> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| </div> |  | ||||||
|  |  | ||||||
| <nav> |  | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> |  | ||||||
| </nav> |  | ||||||
|  |  | ||||||
| <br class="clear"> |  | ||||||
|  |  | ||||||
| <footer> |  | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |  | ||||||
| </footer> |  | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> |  | ||||||
| <script src="scripts/linenumber.js"> </script> |  | ||||||
| </body> |  | ||||||
| </html> |  | ||||||
| @@ -50,13 +50,13 @@ | |||||||
| </div> | </div> | ||||||
|  |  | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> |     <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> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -35,22 +35,21 @@ import noteTooltipService from './note_tooltip.js'; | |||||||
| import protectedSessionService from './protected_session.js'; | import protectedSessionService from './protected_session.js'; | ||||||
| import dateNotesService from './date_notes.js'; | import dateNotesService from './date_notes.js'; | ||||||
| import searchService from './search.js'; | import searchService from './search.js'; | ||||||
| import CollapsibleWidget from '../widgets/collapsible_widget.js'; | import RightPanelWidget from '../widgets/right_panel_widget.js'; | ||||||
| import ws from "./ws.js"; | import ws from "./ws.js"; | ||||||
| import appContext from "./app_context.js"; | import appContext from "../components/app_context.js"; | ||||||
| import NoteContextAwareWidget from "../widgets/note_context_aware_widget.js"; | import NoteContextAwareWidget from "../widgets/note_context_aware_widget.js"; | ||||||
| import NoteContextCachingWidget from "../widgets/note_context_caching_widget.js"; |  | ||||||
| import BasicWidget from "../widgets/basic_widget.js"; | import BasicWidget from "../widgets/basic_widget.js"; | ||||||
|  | import SpacedUpdate from "./spaced_update.js"; | ||||||
|  | import shortcutService from "./shortcuts.js"; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * This is the main frontend API interface for scripts. It's published in the local "api" object. |  * <p>This is the main frontend API interface for scripts. All the properties and methods are published in the "api" object | ||||||
|  |  * available in the JS frontend notes. You can use e.g. <code>api.showMessage(api.startNote.title);</code></p> | ||||||
|  * |  * | ||||||
|  * @constructor |  * @constructor | ||||||
|  * @hideconstructor |  | ||||||
|  */ |  */ | ||||||
| function FrontendScriptApi(startNote, currentNote, originEntity = null, $container = null) { | function FrontendScriptApi(startNote, currentNote, originEntity = null, $container = null) { | ||||||
|     const $pluginButtons = $("#plugin-buttons"); |  | ||||||
|  |  | ||||||
|     /** @property {jQuery} container of all the rendered script content */ |     /** @property {jQuery} container of all the rendered script content */ | ||||||
|     this.$container = $container; |     this.$container = $container; | ||||||
|  |  | ||||||
| @@ -61,11 +60,20 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|     /** @property {object|null} entity whose event triggered this execution */ |     /** @property {object|null} entity whose event triggered this execution */ | ||||||
|     this.originEntity = originEntity; |     this.originEntity = originEntity; | ||||||
|  |  | ||||||
|     // to keep consistency with backend API |     /** @property {dayjs} day.js library for date manipulation. See {@link https://day.js.org} for documentation */ | ||||||
|     this.dayjs = dayjs; |     this.dayjs = dayjs; | ||||||
|  |  | ||||||
|     /** @property {CollapsibleWidget} */ |     /** | ||||||
|     this.CollapsibleWidget = CollapsibleWidget; |      * @property {RightPanelWidget} | ||||||
|  |      * @deprecated use api.RightPanelWidget instead | ||||||
|  |      */ | ||||||
|  |     this.CollapsibleWidget = RightPanelWidget; | ||||||
|  |  | ||||||
|  |     /** @property {RightPanelWidget} */ | ||||||
|  |     this.RightPanelWidget = RightPanelWidget; | ||||||
|  |  | ||||||
|  |     /** @property {NoteContextAwareWidget} */ | ||||||
|  |     this.NoteContextAwareWidget = NoteContextAwareWidget; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @property {NoteContextAwareWidget} |      * @property {NoteContextAwareWidget} | ||||||
| @@ -73,17 +81,17 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|      */ |      */ | ||||||
|     this.TabAwareWidget = NoteContextAwareWidget; |     this.TabAwareWidget = NoteContextAwareWidget; | ||||||
|  |  | ||||||
|     /** @property {NoteContextAwareWidget} */ |     /** | ||||||
|     this.NoteContextAwareWidget = NoteContextAwareWidget; |      * @property {NoteContextAwareWidget} | ||||||
|  |      * @deprecated use NoteContextAwareWidget instead | ||||||
|  |      */ | ||||||
|  |     this.TabCachingWidget = NoteContextAwareWidget; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @property {NoteContextCachingWidget} |      * @property {NoteContextAwareWidget} | ||||||
|      * @deprecated use NoteContextCachingWidget instead |      * @deprecated use NoteContextAwareWidget instead | ||||||
|      */ |      */ | ||||||
|     this.TabCachingWidget = NoteContextCachingWidget; |     this.NoteContextCachingWidget = NoteContextAwareWidget; | ||||||
|  |  | ||||||
|     /** @property {NoteContextAwareWidget} */ |  | ||||||
|     this.NoteContextCachingWidget = NoteContextCachingWidget; |  | ||||||
|  |  | ||||||
|     /** @property {BasicWidget} */ |     /** @property {BasicWidget} */ | ||||||
|     this.BasicWidget = BasicWidget; |     this.BasicWidget = BasicWidget; | ||||||
| @@ -103,7 +111,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|      * Activates newly created note. Compared to this.activateNote() also makes sure that frontend has been fully synced. |      * Activates newly created note. Compared to this.activateNote() also makes sure that frontend has been fully synced. | ||||||
|      * |      * | ||||||
|      * @param {string} notePath (or noteId) |      * @param {string} notePath (or noteId) | ||||||
|      * @return {Promise<void>} |      * @returns {Promise<void>} | ||||||
|      */ |      */ | ||||||
|     this.activateNewNote = async notePath => { |     this.activateNewNote = async notePath => { | ||||||
|         await ws.waitForMaxKnownEntityChangeId(); |         await ws.waitForMaxKnownEntityChangeId(); | ||||||
| @@ -115,14 +123,15 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|     /** |     /** | ||||||
|      * Open a note in a new tab. |      * Open a note in a new tab. | ||||||
|      * |      * | ||||||
|  |      * @method | ||||||
|      * @param {string} notePath (or noteId) |      * @param {string} notePath (or noteId) | ||||||
|      * @param {boolean} activate - set to true to activate the new tab, false to stay on the current tab |      * @param {boolean} activate - set to true to activate the new tab, false to stay on the current tab | ||||||
|      * @return {Promise<void>} |      * @returns {Promise<void>} | ||||||
|      */ |      */ | ||||||
|     this.openTabWithNote = async (notePath, activate) => { |     this.openTabWithNote = async (notePath, activate) => { | ||||||
|         await ws.waitForMaxKnownEntityChangeId(); |         await ws.waitForMaxKnownEntityChangeId(); | ||||||
|  |  | ||||||
|         await appContext.tabManager.openContextWithNote(notePath, activate); |         await appContext.tabManager.openContextWithNote(notePath, { activate }); | ||||||
|  |  | ||||||
|         if (activate) { |         if (activate) { | ||||||
|             appContext.triggerEvent('focusAndSelectTitle'); |             appContext.triggerEvent('focusAndSelectTitle'); | ||||||
| @@ -130,56 +139,47 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @typedef {Object} ToolbarButtonOptions |      * Open a note in a new split. | ||||||
|      * @property {string} title |      * | ||||||
|      * @property {string} [icon] - name of the boxicon to be used (e.g. "time" for "bx-time" icon) |      * @method | ||||||
|      * @property {function} action - callback handling the click on the button |      * @param {string} notePath (or noteId) | ||||||
|      * @property {string} [shortcut] - keyboard shortcut for the button, e.g. "alt+t" |      * @param {boolean} activate - set to true to activate the new split, false to stay on the current split | ||||||
|  |      * @returns {Promise<void>} | ||||||
|      */ |      */ | ||||||
|  |     this.openSplitWithNote = async (notePath, activate) => { | ||||||
|  |         await ws.waitForMaxKnownEntityChangeId(); | ||||||
|  |  | ||||||
|  |         const subContexts = appContext.tabManager.getActiveContext().getSubContexts(); | ||||||
|  |         const {ntxId} = subContexts[subContexts.length - 1]; | ||||||
|  |  | ||||||
|  |         appContext.triggerCommand("openNewNoteSplit", {ntxId, notePath}); | ||||||
|  |  | ||||||
|  |         if (activate) { | ||||||
|  |             appContext.triggerEvent('focusAndSelectTitle'); | ||||||
|  |         } | ||||||
|  |     }; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Adds new button the the plugin area. |      * Adds a new launcher to the launchbar. If the launcher (id) already exists, it will be updated. | ||||||
|      * |      * | ||||||
|      * @param {ToolbarButtonOptions} opts |      * @method | ||||||
|  |      * @deprecated you can now create/modify launchers in the top-left Menu -> Configure Launchbar | ||||||
|  |      *             for special needs there's also backend API's createOrUpdateLauncher() | ||||||
|  |      * @param {object} opts | ||||||
|  |      * @property {string} [opts.id] - id of the button, used to identify the old instances of this button to be replaced | ||||||
|  |      *                          ID is optional because of BC, but not specifying it is deprecated. ID can be alphanumeric only. | ||||||
|  |      * @property {string} opts.title | ||||||
|  |      * @property {string} [opts.icon] - name of the boxicon to be used (e.g. "time" for "bx-time" icon) | ||||||
|  |      * @property {function} opts.action - callback handling the click on the button | ||||||
|  |      * @property {string} [opts.shortcut] - keyboard shortcut for the button, e.g. "alt+t" | ||||||
|      */ |      */ | ||||||
|     this.addButtonToToolbar = opts => { |     this.addButtonToToolbar = async opts => { | ||||||
|         const buttonId = "toolbar-button-" + opts.title.replace(/\s/g, "-"); |         console.warn("api.addButtonToToolbar() has been deprecated since v0.58 and may be removed in the future. Use  Menu -> Configure Launchbar to create/update launchers instead."); | ||||||
|  |  | ||||||
|         let button; |         const {action, ...reqBody} = opts; | ||||||
|         if (utils.isMobile()) { |         reqBody.action = action.toString(); | ||||||
|             $('#plugin-buttons-placeholder').remove(); |  | ||||||
|             button = $('<a class="dropdown-item" href="#">') |  | ||||||
|                 .on('click', () => { |  | ||||||
|                     setTimeout(() => $pluginButtons.dropdown('hide'), 0); |  | ||||||
|                 }); |  | ||||||
|  |  | ||||||
|             if (opts.icon) { |         await server.put('special-notes/api-script-launcher', reqBody); | ||||||
|                 button.append($("<span>").addClass("bx bx-" + opts.icon)) |  | ||||||
|                     .append("&nbsp;"); |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             button.append($("<span>").text(opts.title)); |  | ||||||
|         } else { |  | ||||||
|             button = $('<span class="button-widget icon-action bx" data-toggle="tooltip" title="" data-placement="right"></span>') |  | ||||||
|                 .addClass("bx bx-" + (opts.icon || "question-mark")); |  | ||||||
|  |  | ||||||
|             button.attr("title", opts.title); |  | ||||||
|             button.tooltip({html: true}); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         button = button.on('click', opts.action); |  | ||||||
|  |  | ||||||
|         button.attr('id', buttonId); |  | ||||||
|  |  | ||||||
|         if ($("#" + buttonId).replaceWith(button).length === 0) { |  | ||||||
|             $pluginButtons.append(button); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (opts.shortcut) { |  | ||||||
|             utils.bindGlobalShortcut(opts.shortcut, opts.action); |  | ||||||
|  |  | ||||||
|             button.attr("title", "Shortcut " + opts.shortcut); |  | ||||||
|         } |  | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     function prepareParams(params) { |     function prepareParams(params) { | ||||||
| @@ -189,7 +189,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|  |  | ||||||
|         return params.map(p => { |         return params.map(p => { | ||||||
|             if (typeof p === "function") { |             if (typeof p === "function") { | ||||||
|                 return "!@#Function: " + p.toString(); |                 return `!@#Function: ${p.toString()}`; | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
|                 return p; |                 return p; | ||||||
| @@ -201,9 +201,10 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|      * Executes given anonymous function on the backend. |      * Executes given anonymous function on the backend. | ||||||
|      * Internally this serializes the anonymous function into string and sends it to backend via AJAX. |      * Internally this serializes the anonymous function into string and sends it to backend via AJAX. | ||||||
|      * |      * | ||||||
|  |      * @method | ||||||
|      * @param {string} script - script to be executed on the backend |      * @param {string} script - script to be executed on the backend | ||||||
|      * @param {Array.<?>} params - list of parameters to the anonymous function to be send to backend |      * @param {Array.<?>} params - list of parameters to the anonymous function to be sent to backend | ||||||
|      * @return {Promise<*>} return value of the executed function on the backend |      * @returns {Promise<*>} return value of the executed function on the backend | ||||||
|      */ |      */ | ||||||
|     this.runOnBackend = async (script, params = []) => { |     this.runOnBackend = async (script, params = []) => { | ||||||
|         if (typeof script === "function") { |         if (typeof script === "function") { | ||||||
| @@ -225,23 +226,17 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|             return ret.executionResult; |             return ret.executionResult; | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|             throw new Error("server error: " + ret.error); |             throw new Error(`server error: ${ret.error}`); | ||||||
|         } |         } | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * @deprecated new name of this API call is runOnBackend so use that |  | ||||||
|      * @method |  | ||||||
|      */ |  | ||||||
|     this.runOnServer = this.runOnBackend; |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * This is a powerful search method - you can search by attributes and their values, e.g.: |      * This is a powerful search method - you can search by attributes and their values, e.g.: | ||||||
|      * "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search |      * "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search | ||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} searchString |      * @param {string} searchString | ||||||
|      * @returns {Promise<NoteShort[]>} |      * @returns {Promise<FNote[]>} | ||||||
|      */ |      */ | ||||||
|     this.searchForNotes = async searchString => { |     this.searchForNotes = async searchString => { | ||||||
|         return await searchService.searchForNotes(searchString); |         return await searchService.searchForNotes(searchString); | ||||||
| @@ -253,7 +248,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} searchString |      * @param {string} searchString | ||||||
|      * @returns {Promise<NoteShort|null>} |      * @returns {Promise<FNote|null>} | ||||||
|      */ |      */ | ||||||
|     this.searchForNote = async searchString => { |     this.searchForNote = async searchString => { | ||||||
|         const notes = await this.searchForNotes(searchString); |         const notes = await this.searchForNotes(searchString); | ||||||
| @@ -264,8 +259,9 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|     /** |     /** | ||||||
|      * Returns note by given noteId. If note is missing from cache, it's loaded. |      * Returns note by given noteId. If note is missing from cache, it's loaded. | ||||||
|      ** |      ** | ||||||
|  |      * @method | ||||||
|      * @param {string} noteId |      * @param {string} noteId | ||||||
|      * @return {Promise<NoteShort>} |      * @returns {Promise<FNote>} | ||||||
|      */ |      */ | ||||||
|     this.getNote = async noteId => await froca.getNote(noteId); |     this.getNote = async noteId => await froca.getNote(noteId); | ||||||
|  |  | ||||||
| @@ -275,17 +271,18 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|      * This is often used to bulk-fill the cache with notes which would have to be picked one by one |      * This is often used to bulk-fill the cache with notes which would have to be picked one by one | ||||||
|      * otherwise (by e.g. createNoteLink()) |      * otherwise (by e.g. createNoteLink()) | ||||||
|      * |      * | ||||||
|  |      * @method | ||||||
|      * @param {string[]} noteIds |      * @param {string[]} noteIds | ||||||
|      * @param {boolean} [silentNotFoundError] - don't report error if the note is not found |      * @param {boolean} [silentNotFoundError] - don't report error if the note is not found | ||||||
|      * @return {Promise<NoteShort[]>} |      * @returns {Promise<FNote[]>} | ||||||
|      */ |      */ | ||||||
|     this.getNotes = async (noteIds, silentNotFoundError = false) => await froca.getNotes(noteIds, silentNotFoundError); |     this.getNotes = async (noteIds, silentNotFoundError = false) => await froca.getNotes(noteIds, silentNotFoundError); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Update frontend tree (note) cache from the backend. |      * Update frontend tree (note) cache from the backend. | ||||||
|      * |      * | ||||||
|      * @param {string[]} noteIds |  | ||||||
|      * @method |      * @method | ||||||
|  |      * @param {string[]} noteIds | ||||||
|      */ |      */ | ||||||
|     this.reloadNotes = async noteIds => await froca.reloadNotes(noteIds); |     this.reloadNotes = async noteIds => await froca.reloadNotes(noteIds); | ||||||
|  |  | ||||||
| @@ -293,7 +290,8 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|      * Instance name identifies particular Trilium instance. It can be useful for scripts |      * Instance name identifies particular Trilium instance. It can be useful for scripts | ||||||
|      * if some action needs to happen on only one specific instance. |      * if some action needs to happen on only one specific instance. | ||||||
|      * |      * | ||||||
|      * @return {string} |      * @method | ||||||
|  |      * @returns {string} | ||||||
|      */ |      */ | ||||||
|     this.getInstanceName = () => window.glob.instanceName; |     this.getInstanceName = () => window.glob.instanceName; | ||||||
|  |  | ||||||
| @@ -328,10 +326,22 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|     this.showError = toastService.showError; |     this.showError = toastService.showError; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|  |      * Trigger command. | ||||||
|  |      * | ||||||
|      * @method |      * @method | ||||||
|      * @deprecated - this is now no-op since all the changes should be gracefully handled per widget |      * @param {string} name | ||||||
|  |      * @param {object} data | ||||||
|      */ |      */ | ||||||
|     this.refreshTree = () => {}; |     this.triggerCommand = (name, data) => appContext.triggerCommand(name, data); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Trigger event. | ||||||
|  |      * | ||||||
|  |      * @method | ||||||
|  |      * @param {string} name | ||||||
|  |      * @param {object} data | ||||||
|  |      */ | ||||||
|  |     this.triggerEvent = (name, data) => appContext.triggerEvent(name, data); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Create note link (jQuery object) for given note. |      * Create note link (jQuery object) for given note. | ||||||
| @@ -341,58 +351,77 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|      * @param {object} [params] |      * @param {object} [params] | ||||||
|      * @param {boolean} [params.showTooltip=true] - enable/disable tooltip on the link |      * @param {boolean} [params.showTooltip=true] - enable/disable tooltip on the link | ||||||
|      * @param {boolean} [params.showNotePath=false] - show also whole note's path as part of the link |      * @param {boolean} [params.showNotePath=false] - show also whole note's path as part of the link | ||||||
|      * @param {string} [title=] - custom link tile with note's title as default |      * @param {boolean} [params.showNoteIcon=false] - show also note icon before the title | ||||||
|  |      * @param {string} [params.title=] - custom link tile with note's title as default | ||||||
|      */ |      */ | ||||||
|     this.createNoteLink = linkService.createNoteLink; |     this.createNoteLink = linkService.createNoteLink; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Adds given text to the editor cursor |      * Adds given text to the editor cursor | ||||||
|      * |      * | ||||||
|      * @param {string} text - this must be clear text, HTML is not supported. |  | ||||||
|      * @method |      * @method | ||||||
|  |      * @param {string} text - this must be clear text, HTML is not supported. | ||||||
|      */ |      */ | ||||||
|     this.addTextToActiveTabEditor = text => appContext.triggerCommand('addTextToActiveEditor', {text}); |     this.addTextToActiveContextEditor = text => appContext.triggerCommand('addTextToActiveEditor', {text}); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @method |      * @method | ||||||
|      * @returns {NoteShort} active note (loaded into right pane) |      * @returns {FNote} active note (loaded into right pane) | ||||||
|      */ |      */ | ||||||
|     this.getActiveTabNote = () => appContext.tabManager.getActiveContextNote(); |     this.getActiveContextNote = () => appContext.tabManager.getActiveContextNote(); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for a documentation on the returned instance. |      * See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for a documentation on the returned instance. | ||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param callback - method receiving "textEditor" instance |      * @returns {Promise<CKEditor>} instance of CKEditor | ||||||
|      */ |      */ | ||||||
|     this.getActiveTabTextEditor = callback => appContext.triggerCommand('executeInActiveEditor', {callback}); |     this.getActiveContextTextEditor = () => appContext.tabManager.getActiveContext()?.getTextEditor(); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * See https://codemirror.net/doc/manual.html#api | ||||||
|  |      * | ||||||
|  |      * @method | ||||||
|  |      * @returns {Promise<CodeMirror>} instance of CodeMirror | ||||||
|  |      */ | ||||||
|  |     this.getActiveContextCodeEditor = () => appContext.tabManager.getActiveContext()?.getCodeEditor(); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Get access to the widget handling note detail. Methods like `getWidgetType()` and `getTypeWidget()` to get to the | ||||||
|  |      * implementation of actual widget type. | ||||||
|  |      * | ||||||
|  |      * @method | ||||||
|  |      * @returns {Promise<NoteDetailWidget>} | ||||||
|  |      */ | ||||||
|  |     this.getActiveNoteDetailWidget = () => new Promise(resolve => appContext.triggerCommand('executeInActiveNoteDetailWidget', {callback: resolve})); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @method |      * @method | ||||||
|      * @returns {Promise<string|null>} returns note path of active note or null if there isn't active note |      * @returns {Promise<string|null>} returns note path of active note or null if there isn't active note | ||||||
|      */ |      */ | ||||||
|     this.getActiveTabNotePath = () => appContext.tabManager.getActiveContextNotePath(); |     this.getActiveContextNotePath = () => appContext.tabManager.getActiveContextNotePath(); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Returns component which owns given DOM element (the nearest parent component in DOM tree) | ||||||
|  |      * | ||||||
|  |      * @method | ||||||
|  |      * @param {Element} el - DOM element | ||||||
|  |      * @returns {Component} | ||||||
|  |      */ | ||||||
|  |     this.getComponentByEl = el => appContext.getComponentByEl(el); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @method |      * @method | ||||||
|      * @param {object} $el - jquery object on which to set up the tooltip |      * @param {object} $el - jquery object on which to set up the tooltip | ||||||
|  |      * @returns {Promise<void>} | ||||||
|      */ |      */ | ||||||
|     this.setupElementTooltip = noteTooltipService.setupElementTooltip; |     this.setupElementTooltip = noteTooltipService.setupElementTooltip; | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * @deprecated use protectNote and protectSubtree instead |  | ||||||
|      * @method |  | ||||||
|      */ |  | ||||||
|     this.protectActiveNote = async () => { |  | ||||||
|         const activeNote = appContext.tabManager.getActiveContextNote(); |  | ||||||
|  |  | ||||||
|         await protectedSessionService.protectNote(activeNote.noteId, true, false); |  | ||||||
|     }; |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} noteId |      * @param {string} noteId | ||||||
|      * @param {boolean} protect - true to protect note, false to unprotect |      * @param {boolean} protect - true to protect note, false to unprotect | ||||||
|  |      * @returns {Promise<void>} | ||||||
|      */ |      */ | ||||||
|     this.protectNote = async (noteId, protect) => { |     this.protectNote = async (noteId, protect) => { | ||||||
|         await protectedSessionService.protectNote(noteId, protect, false); |         await protectedSessionService.protectNote(noteId, protect, false); | ||||||
| @@ -402,6 +431,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|      * @method |      * @method | ||||||
|      * @param {string} noteId |      * @param {string} noteId | ||||||
|      * @param {boolean} protect - true to protect subtree, false to unprotect |      * @param {boolean} protect - true to protect subtree, false to unprotect | ||||||
|  |      * @returns {Promise<void>} | ||||||
|      */ |      */ | ||||||
|     this.protectSubTree = async (noteId, protect) => { |     this.protectSubTree = async (noteId, protect) => { | ||||||
|         await protectedSessionService.protectNote(noteId, protect, true); |         await protectedSessionService.protectNote(noteId, protect, true); | ||||||
| @@ -411,25 +441,25 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|      * Returns date-note for today. If it doesn't exist, it is automatically created. |      * Returns date-note for today. If it doesn't exist, it is automatically created. | ||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @return {Promise<NoteShort>} |      * @returns {Promise<FNote>} | ||||||
|      */ |      */ | ||||||
|     this.getTodayNote = dateNotesService.getTodayNote; |     this.getTodayNote = dateNotesService.getTodayNote; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Returns date-note. If it doesn't exist, it is automatically created. |      * Returns day note for a given date. If it doesn't exist, it is automatically created. | ||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} date - e.g. "2019-04-29" |      * @param {string} date - e.g. "2019-04-29" | ||||||
|      * @return {Promise<NoteShort>} |      * @returns {Promise<FNote>} | ||||||
|      */ |      */ | ||||||
|     this.getDateNote = dateNotesService.getDateNote; |     this.getDayNote = dateNotesService.getDayNote; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Returns date-note for the first date of the week of the given date. If it doesn't exist, it is automatically created. |      * Returns day note for the first date of the week of the given date. If it doesn't exist, it is automatically created. | ||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} date - e.g. "2019-04-29" |      * @param {string} date - e.g. "2019-04-29" | ||||||
|      * @return {Promise<NoteShort>} |      * @returns {Promise<FNote>} | ||||||
|      */ |      */ | ||||||
|      this.getWeekNote = dateNotesService.getWeekNote; |      this.getWeekNote = dateNotesService.getWeekNote; | ||||||
|  |  | ||||||
| @@ -438,7 +468,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} month - e.g. "2019-04" |      * @param {string} month - e.g. "2019-04" | ||||||
|      * @return {Promise<NoteShort>} |      * @returns {Promise<FNote>} | ||||||
|      */ |      */ | ||||||
|     this.getMonthNote = dateNotesService.getMonthNote; |     this.getMonthNote = dateNotesService.getMonthNote; | ||||||
|  |  | ||||||
| @@ -447,7 +477,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} year - e.g. "2019" |      * @param {string} year - e.g. "2019" | ||||||
|      * @return {Promise<NoteShort>} |      * @returns {Promise<FNote>} | ||||||
|      */ |      */ | ||||||
|     this.getYearNote = dateNotesService.getYearNote; |     this.getYearNote = dateNotesService.getYearNote; | ||||||
|  |  | ||||||
| @@ -456,7 +486,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|      * @param {string} noteId - set hoisted note. 'root' will effectively unhoist |      * @param {string} noteId - set hoisted note. 'root' will effectively unhoist | ||||||
|      * @return {Promise} |      * @returns {Promise<void>} | ||||||
|      */ |      */ | ||||||
|     this.setHoistedNoteId = (noteId) => { |     this.setHoistedNoteId = (noteId) => { | ||||||
|         const activeNoteContext = appContext.tabManager.getActiveContext(); |         const activeNoteContext = appContext.tabManager.getActiveContext(); | ||||||
| @@ -470,8 +500,11 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|      * @method |      * @method | ||||||
|      * @param {string} keyboardShortcut - e.g. "ctrl+shift+a" |      * @param {string} keyboardShortcut - e.g. "ctrl+shift+a" | ||||||
|      * @param {function} handler |      * @param {function} handler | ||||||
|  |      * @param {string} [namespace] - specify namespace of the handler for the cases where call for bind may be repeated. | ||||||
|  |      *                               If a handler with this ID exists, it's replaced by the new handler. | ||||||
|  |      * @returns {Promise<void>} | ||||||
|      */ |      */ | ||||||
|     this.bindGlobalShortcut = utils.bindGlobalShortcut; |     this.bindGlobalShortcut = shortcutService.bindGlobalShortcut; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Trilium runs in backend and frontend process, when something is changed on the backend from script, |      * Trilium runs in backend and frontend process, when something is changed on the backend from script, | ||||||
| @@ -481,6 +514,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|      * Typical use case is when new note has been created, we should wait until it is synced into frontend and only then activate it. |      * Typical use case is when new note has been created, we should wait until it is synced into frontend and only then activate it. | ||||||
|      * |      * | ||||||
|      * @method |      * @method | ||||||
|  |      * @returns {Promise<void>} | ||||||
|      */ |      */ | ||||||
|     this.waitUntilSynced = ws.waitForMaxKnownEntityChangeId; |     this.waitUntilSynced = ws.waitForMaxKnownEntityChangeId; | ||||||
|  |  | ||||||
| @@ -488,6 +522,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|      * This will refresh all currently opened notes which have included note specified in the parameter |      * This will refresh all currently opened notes which have included note specified in the parameter | ||||||
|      * |      * | ||||||
|      * @param includedNoteId - noteId of the included note |      * @param includedNoteId - noteId of the included note | ||||||
|  |      * @returns {Promise<void>} | ||||||
|      */ |      */ | ||||||
|     this.refreshIncludedNote = includedNoteId => appContext.triggerEvent('refreshIncludedNote', {noteId: includedNoteId}); |     this.refreshIncludedNote = includedNoteId => appContext.triggerEvent('refreshIncludedNote', {noteId: includedNoteId}); | ||||||
|  |  | ||||||
| @@ -499,6 +534,34 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|      * @returns {string} random string |      * @returns {string} random string | ||||||
|      */ |      */ | ||||||
|     this.randomString = utils.randomString; |     this.randomString = utils.randomString; | ||||||
|  |  | ||||||
|  |     this.logMessages = {}; | ||||||
|  |     this.logSpacedUpdates = {}; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Log given message to the log pane in UI | ||||||
|  |      * | ||||||
|  |      * @param message | ||||||
|  |      * @returns {void} | ||||||
|  |      */ | ||||||
|  |     this.log = message => { | ||||||
|  |         const {noteId} = this.startNote; | ||||||
|  |  | ||||||
|  |         message = `${utils.now()}: ${message}`; | ||||||
|  |  | ||||||
|  |         console.log(`Script ${noteId}: ${message}`); | ||||||
|  |  | ||||||
|  |         this.logMessages[noteId] = this.logMessages[noteId] || []; | ||||||
|  |         this.logSpacedUpdates[noteId] = this.logSpacedUpdates[noteId] || new SpacedUpdate(() => { | ||||||
|  |             const messages = this.logMessages[noteId]; | ||||||
|  |             this.logMessages[noteId] = []; | ||||||
|  |  | ||||||
|  |             appContext.triggerEvent("apiLogMessages", {noteId, messages}); | ||||||
|  |         }, 100); | ||||||
|  |  | ||||||
|  |         this.logMessages[noteId].push(message); | ||||||
|  |         this.logSpacedUpdates[noteId].scheduleUpdate(); | ||||||
|  |     }; | ||||||
| } | } | ||||||
|  |  | ||||||
| export default FrontendScriptApi; | export default FrontendScriptApi; | ||||||
| @@ -512,13 +575,13 @@ export default FrontendScriptApi; | |||||||
| </div> | </div> | ||||||
|  |  | ||||||
| <nav> | <nav> | ||||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> |     <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> | </nav> | ||||||
|  |  | ||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.1</a> | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user