mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	added some consistency checks for links and attributes
This commit is contained in:
		| @@ -288,7 +288,7 @@ | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -730,7 +730,7 @@ | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -3814,7 +3814,7 @@ transactional by default. | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -511,7 +511,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -216,7 +216,7 @@ | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -358,7 +358,7 @@ this is different concept than attribute/relation.</div> | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -446,7 +446,7 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
| <div class="description"> | <div class="description"> | ||||||
|     Finds notes with given attribute name and value. Only own attributes are considered, not inherited ones |     Finds child notes with given attribute name and value. Only own attributes are considered, not inherited ones | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -1622,7 +1622,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.js.html">entities/note.js</a>, <a href="entities_note.js.html#line520">line 520</a> |         <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line531">line 531</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1722,7 +1722,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.js.html">entities/note.js</a>, <a href="entities_note.js.html#line548">line 548</a> |         <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line559">line 559</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1826,7 +1826,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.js.html">entities/note.js</a>, <a href="entities_note.js.html#line534">line 534</a> |         <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line545">line 545</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -2525,6 +2525,10 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <div class="description"> | ||||||
|  |     Get list of links coming out of this note. | ||||||
|  | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -2566,7 +2570,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.js.html">entities/note.js</a>, <a href="entities_note.js.html#line504">line 504</a> |         <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line506">line 506</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -2670,7 +2674,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.js.html">entities/note.js</a>, <a href="entities_note.js.html#line513">line 513</a> |         <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line524">line 524</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -2874,7 +2878,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.js.html">entities/note.js</a>, <a href="entities_note.js.html#line560">line 560</a> |         <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line571">line 571</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -3930,6 +3934,110 @@ | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|  |     <h4 class="name" id="getTargetLinks"><span class="type-signature">(async) </span>getTargetLinks<span class="signature">()</span><span class="type-signature"> → {Promise.<Array.<<a href="Link.html">Link</a>>>}</span></h4> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <div class="description"> | ||||||
|  |     Get list of links targetting this note. | ||||||
|  | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl class="details"> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     <dt class="tag-source">Source:</dt> | ||||||
|  |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|  |         <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line515">line 515</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">Promise.<Array.<<a href="Link.html">Link</a>>></span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|     <h4 class="name" id="getTargetRelations"><span class="type-signature">(async) </span>getTargetRelations<span class="signature">()</span><span class="type-signature"> → {Promise.<Array.<<a href="Attribute.html">Attribute</a>>>}</span></h4> |     <h4 class="name" id="getTargetRelations"><span class="type-signature">(async) </span>getTargetRelations<span class="signature">()</span><span class="type-signature"> → {Promise.<Array.<<a href="Attribute.html">Attribute</a>>>}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -4258,7 +4366,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.js.html">entities/note.js</a>, <a href="entities_note.js.html#line527">line 527</a> |         <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line538">line 538</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -7189,7 +7297,7 @@ Cache is note instance scoped. | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -403,7 +403,7 @@ | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -311,7 +311,7 @@ | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -288,7 +288,7 @@ | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -75,7 +75,7 @@ module.exports = ApiToken;</code></pre> | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -151,7 +151,7 @@ module.exports = Attribute;</code></pre> | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -105,7 +105,7 @@ module.exports = Branch;</code></pre> | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -93,7 +93,7 @@ module.exports = Entity;</code></pre> | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -92,7 +92,7 @@ module.exports = Link;</code></pre> | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -461,7 +461,7 @@ class Note extends Entity { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Finds notes with given attribute name and value. Only own attributes are considered, not inherited ones |      * Finds child notes with given attribute name and value. Only own attributes are considered, not inherited ones | ||||||
|      * |      * | ||||||
|      * @param {string} type - attribute type (label, relation, etc.) |      * @param {string} type - attribute type (label, relation, etc.) | ||||||
|      * @param {string} name - attribute name |      * @param {string} name - attribute name | ||||||
| @@ -527,12 +527,23 @@ class Note extends Entity { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|  |      * Get list of links coming out of this note. | ||||||
|  |      * | ||||||
|      * @returns {Promise<Link[]>} |      * @returns {Promise<Link[]>} | ||||||
|      */ |      */ | ||||||
|     async getLinks() { |     async getLinks() { | ||||||
|         return await repository.getEntities("SELECT * FROM links WHERE noteId = ? AND isDeleted = 0", [this.noteId]); |         return await repository.getEntities("SELECT * FROM links WHERE noteId = ? AND isDeleted = 0", [this.noteId]); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Get list of links targetting this note. | ||||||
|  |      * | ||||||
|  |      * @returns {Promise<Link[]>} | ||||||
|  |      */ | ||||||
|  |     async getTargetLinks() { | ||||||
|  |         return await repository.getEntities("SELECT * FROM links WHERE targetNoteId = ? AND isDeleted = 0", [this.noteId]); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Return all links from this note, including deleted ones. |      * Return all links from this note, including deleted ones. | ||||||
|      * |      * | ||||||
| @@ -640,7 +651,7 @@ module.exports = Note;</code></pre> | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -91,7 +91,7 @@ module.exports = NoteRevision;</code></pre> | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -78,7 +78,7 @@ module.exports = Option;</code></pre> | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -75,7 +75,7 @@ module.exports = RecentNote;</code></pre> | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -594,7 +594,7 @@ | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -56,7 +56,7 @@ | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -278,7 +278,7 @@ module.exports = BackendScriptApi;</code></pre> | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:27 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -719,7 +719,7 @@ | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:28 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -2846,7 +2846,7 @@ Internally this serializes the anonymous function into string and sends it to ba | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:28 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -279,7 +279,7 @@ | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:28 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -1316,7 +1316,7 @@ Its notable omission is the note content.</div> | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:28 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -76,7 +76,7 @@ export default Branch;</code></pre> | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:28 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -64,7 +64,7 @@ export default NoteFull;</code></pre> | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:28 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -128,7 +128,7 @@ export default NoteShort;</code></pre> | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:28 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -339,7 +339,7 @@ | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:28 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -56,7 +56,7 @@ | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:28 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -271,7 +271,7 @@ export default FrontendScriptApi;</code></pre> | |||||||
| <br class="clear"> | <br class="clear"> | ||||||
|  |  | ||||||
| <footer> | <footer> | ||||||
|     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time) |     Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Nov 15 2018 13:33:28 GMT+0100 (Central European Standard Time) | ||||||
| </footer> | </footer> | ||||||
|  |  | ||||||
| <script> prettyPrint(); </script> | <script> prettyPrint(); </script> | ||||||
|   | |||||||
| @@ -499,12 +499,23 @@ class Note extends Entity { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|  |      * Get list of links coming out of this note. | ||||||
|  |      * | ||||||
|      * @returns {Promise<Link[]>} |      * @returns {Promise<Link[]>} | ||||||
|      */ |      */ | ||||||
|     async getLinks() { |     async getLinks() { | ||||||
|         return await repository.getEntities("SELECT * FROM links WHERE noteId = ? AND isDeleted = 0", [this.noteId]); |         return await repository.getEntities("SELECT * FROM links WHERE noteId = ? AND isDeleted = 0", [this.noteId]); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Get list of links targetting this note. | ||||||
|  |      * | ||||||
|  |      * @returns {Promise<Link[]>} | ||||||
|  |      */ | ||||||
|  |     async getTargetLinks() { | ||||||
|  |         return await repository.getEntities("SELECT * FROM links WHERE targetNoteId = ? AND isDeleted = 0", [this.noteId]); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Return all links from this note, including deleted ones. |      * Return all links from this note, including deleted ones. | ||||||
|      * |      * | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ | |||||||
| const build = require('./build'); | const build = require('./build'); | ||||||
| const packageJson = require('../../package'); | const packageJson = require('../../package'); | ||||||
|  |  | ||||||
| const APP_DB_VERSION = 115; | const APP_DB_VERSION = 116; | ||||||
| const SYNC_VERSION = 2; | const SYNC_VERSION = 2; | ||||||
|  |  | ||||||
| module.exports = { | module.exports = { | ||||||
|   | |||||||
| @@ -219,6 +219,65 @@ async function runAllChecks() { | |||||||
|             type == 'search'`, |             type == 'search'`, | ||||||
|         "Search note has children", errorList); |         "Search note has children", errorList); | ||||||
|  |  | ||||||
|  |     await fixEmptyRelationTargets(errorList); | ||||||
|  |  | ||||||
|  |     await runCheck(` | ||||||
|  |           SELECT  | ||||||
|  |             attributeId | ||||||
|  |           FROM  | ||||||
|  |             attributes | ||||||
|  |           WHERE  | ||||||
|  |             type != 'label'  | ||||||
|  |             AND type != 'label-definition'  | ||||||
|  |             AND type != 'relation' | ||||||
|  |             AND type != 'relation-definition'`, | ||||||
|  |         "Attribute has invalid type", errorList); | ||||||
|  |  | ||||||
|  |     await runCheck(` | ||||||
|  |           SELECT  | ||||||
|  |             attributeId | ||||||
|  |           FROM  | ||||||
|  |             attributes | ||||||
|  |             LEFT JOIN notes ON attributes.noteId = notes.noteId AND notes.isDeleted = 0 | ||||||
|  |           WHERE | ||||||
|  |             attributes.isDeleted = 0 | ||||||
|  |             AND notes.noteId IS NULL`, | ||||||
|  |         "Attribute reference to the owning note is broken", errorList); | ||||||
|  |  | ||||||
|  |     await runCheck(` | ||||||
|  |           SELECT | ||||||
|  |             attributeId | ||||||
|  |           FROM | ||||||
|  |             attributes | ||||||
|  |             LEFT JOIN notes AS targetNote ON attributes.value = targetNote.noteId AND targetNote.isDeleted = 0 | ||||||
|  |           WHERE | ||||||
|  |             attributes.type = 'relation' | ||||||
|  |             AND attributes.isDeleted = 0 | ||||||
|  |             AND targetNote.noteId IS NULL`, | ||||||
|  |         "Relation reference to the target note is broken", errorList); | ||||||
|  |  | ||||||
|  |     await runCheck(` | ||||||
|  |           SELECT  | ||||||
|  |             linkId | ||||||
|  |           FROM  | ||||||
|  |             links | ||||||
|  |           WHERE  | ||||||
|  |             type != 'image' | ||||||
|  |             AND type != 'hyper'`, | ||||||
|  |         "Link type is invalid", errorList); | ||||||
|  |  | ||||||
|  |     await runCheck(` | ||||||
|  |           SELECT  | ||||||
|  |             linkId | ||||||
|  |           FROM  | ||||||
|  |             links | ||||||
|  |             LEFT JOIN notes AS sourceNote ON sourceNote.noteId = links.noteId AND sourceNote.isDeleted = 0 | ||||||
|  |             LEFT JOIN notes AS targetNote ON targetNote.noteId = links.noteId AND targetNote.isDeleted = 0 | ||||||
|  |           WHERE  | ||||||
|  |             sourceNote.noteId IS NULL | ||||||
|  |             OR targetNote.noteId IS NULL`, | ||||||
|  |         "Link to source/target note link is broken", errorList); | ||||||
|  |  | ||||||
|     await runSyncRowChecks("notes", "noteId", errorList); |     await runSyncRowChecks("notes", "noteId", errorList); | ||||||
|     await runSyncRowChecks("note_revisions", "noteRevisionId", errorList); |     await runSyncRowChecks("note_revisions", "noteRevisionId", errorList); | ||||||
|     await runSyncRowChecks("branches", "branchId", errorList); |     await runSyncRowChecks("branches", "branchId", errorList); | ||||||
| @@ -233,8 +292,6 @@ async function runAllChecks() { | |||||||
|         await checkTreeCycles(errorList); |         await checkTreeCycles(errorList); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     await fixEmptyRelationTargets(errorList); |  | ||||||
|  |  | ||||||
|     return errorList; |     return errorList; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -332,9 +332,19 @@ async function deleteNote(branch) { | |||||||
|             await attribute.save(); |             await attribute.save(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         for (const attribute of await note.getTargetRelations()) { |         for (const relation of await note.getTargetRelations()) { | ||||||
|             attribute.isDeleted = true; |             relation.isDeleted = true; | ||||||
|             await attribute.save(); |             await relation.save(); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         for (const link of await note.getLinks()) { | ||||||
|  |             link.isDeleted = true; | ||||||
|  |             await link.save(); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         for (const link of await note.getTargetLinks()) { | ||||||
|  |             link.isDeleted = true; | ||||||
|  |             await link.save(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user