mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	Merge branch 'feature/typescript_backend_2' into feature/typescript_backend_3
This commit is contained in:
		
						commit
						0903cf2646
					
				| @ -183,7 +183,7 @@ function noteUpdated(entityRow: NoteRow) { | |||||||
|     const note = becca.notes[entityRow.noteId]; |     const note = becca.notes[entityRow.noteId]; | ||||||
| 
 | 
 | ||||||
|     if (note) { |     if (note) { | ||||||
|         // FIXME, this wouldn't have worked in the original implementation since the variable was named __flatTextCache.
 |         // TODO, this wouldn't have worked in the original implementation since the variable was named __flatTextCache.
 | ||||||
|         // type / mime could have been changed, and they are present in flatTextCache
 |         // type / mime could have been changed, and they are present in flatTextCache
 | ||||||
|         note.__flatTextCache = null; |         note.__flatTextCache = null; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -90,21 +90,21 @@ abstract class AbstractBeccaEntity<T extends AbstractBeccaEntity<T>> { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     hasStringContent(): boolean { |     hasStringContent(): boolean { | ||||||
|         // FIXME: Not sure why some entities don't implement it.
 |         // TODO: Not sure why some entities don't implement it.
 | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     abstract getPojo(): {}; |     abstract getPojo(): {}; | ||||||
| 
 | 
 | ||||||
|     get isDeleted(): boolean { |     get isDeleted(): boolean { | ||||||
|         // FIXME: Not sure why some entities don't implement it.
 |         // TODO: Not sure why some entities don't implement it.
 | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Saves entity - executes SQL, but doesn't commit the transaction on its own |      * Saves entity - executes SQL, but doesn't commit the transaction on its own | ||||||
|      */ |      */ | ||||||
|     // FIXME: opts not used but called a few times, maybe should be used by derived classes or passed to beforeSaving.
 |     // TODO: opts not used but called a few times, maybe should be used by derived classes or passed to beforeSaving.
 | ||||||
|     save(opts?: {}): this { |     save(opts?: {}): this { | ||||||
|         const constructorData = (this.constructor as unknown as ConstructorData<T>); |         const constructorData = (this.constructor as unknown as ConstructorData<T>); | ||||||
|         const entityName = constructorData.entityName; |         const entityName = constructorData.entityName; | ||||||
|  | |||||||
| @ -15,7 +15,7 @@ const attachmentRoleToNoteTypeMapping = { | |||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| interface ContentOpts { | interface ContentOpts { | ||||||
|     // FIXME: Found in bnote.ts, to check if it's actually used and not a typo.
 |     // TODO: Found in bnote.ts, to check if it's actually used and not a typo.
 | ||||||
|     forceSave?: boolean; |     forceSave?: boolean; | ||||||
| 
 | 
 | ||||||
|     /** will also save this BAttachment entity */ |     /** will also save this BAttachment entity */ | ||||||
| @ -135,7 +135,7 @@ class BAttachment extends AbstractBeccaEntity<BAttachment> { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     convertToNote(): { note: BNote, branch: BBranch } { |     convertToNote(): { note: BNote, branch: BBranch } { | ||||||
|         // FIXME: can this ever be "search"?
 |         // TODO: can this ever be "search"?
 | ||||||
|         if (this.type as string === 'search') { |         if (this.type as string === 'search') { | ||||||
|             throw new Error(`Note of type search cannot have child notes`); |             throw new Error(`Note of type search cannot have child notes`); | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| import { BlobRow } from "./rows"; | import { BlobRow } from "./rows"; | ||||||
| 
 | 
 | ||||||
| // FIXME: Why this does not extend the abstract becca?
 | // TODO: Why this does not extend the abstract becca?
 | ||||||
| class BBlob { | class BBlob { | ||||||
|     static get entityName() { return "blobs"; } |     static get entityName() { return "blobs"; } | ||||||
|     static get primaryKeyName() { return "blobId"; } |     static get primaryKeyName() { return "blobId"; } | ||||||
|  | |||||||
| @ -899,7 +899,7 @@ class BNote extends AbstractBeccaEntity<BNote> { | |||||||
|             const {searchResultNoteIds} = searchService.searchFromNote(this); |             const {searchResultNoteIds} = searchService.searchFromNote(this); | ||||||
| 
 | 
 | ||||||
|             const becca = this.becca; |             const becca = this.becca; | ||||||
|             return (searchResultNoteIds as string[])    // FIXME: remove cast once search is converted
 |             return (searchResultNoteIds as string[])    // TODO: remove cast once search is converted
 | ||||||
|                 .map(resultNoteId => becca.notes[resultNoteId]) |                 .map(resultNoteId => becca.notes[resultNoteId]) | ||||||
|                 .filter(note => !!note); |                 .filter(note => !!note); | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -88,7 +88,7 @@ class BRevision extends AbstractBeccaEntity<BRevision> { | |||||||
|      * |      * | ||||||
|      * This is the same approach as is used for Note's content. |      * This is the same approach as is used for Note's content. | ||||||
|      */ |      */ | ||||||
|     // FIXME: initial declaration included Buffer, but everywhere it's treated as a string.
 |     // TODO: initial declaration included Buffer, but everywhere it's treated as a string.
 | ||||||
|     getContent(): string { |     getContent(): string { | ||||||
|         return this._getContent() as string; |         return this._getContent() as string; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| // FIXME: Booleans should probably be numbers instead (as SQLite does not have booleans.);
 | // TODO: Booleans should probably be numbers instead (as SQLite does not have booleans.);
 | ||||||
| 
 | 
 | ||||||
| export interface AttachmentRow { | export interface AttachmentRow { | ||||||
|     attachmentId?: string; |     attachmentId?: string; | ||||||
|  | |||||||
| @ -10,7 +10,7 @@ import passwordService = require('./encryption/password'); | |||||||
| 
 | 
 | ||||||
| const noAuthentication = config.General && config.General.noAuthentication === true; | const noAuthentication = config.General && config.General.noAuthentication === true; | ||||||
| 
 | 
 | ||||||
| // FIXME: We are using custom types for request & response because couldn't extract those pesky express types.
 | // TODO: We are using custom types for request & response because couldn't extract those pesky express types.
 | ||||||
| interface Request { | interface Request { | ||||||
|     method: string; |     method: string; | ||||||
|     path: string; |     path: string; | ||||||
|  | |||||||
| @ -31,7 +31,7 @@ function changePassword(currentPassword: string, newPassword: string) { | |||||||
|         const newPasswordVerificationKey = utils.toBase64(myScryptService.getVerificationHash(newPassword)); |         const newPasswordVerificationKey = utils.toBase64(myScryptService.getVerificationHash(newPassword)); | ||||||
|          |          | ||||||
|         if (decryptedDataKey) { |         if (decryptedDataKey) { | ||||||
|             // FIXME: what should happen if the decrypted data key is null?
 |             // TODO: what should happen if the decrypted data key is null?
 | ||||||
|             passwordEncryptionService.setDataKey(newPassword, decryptedDataKey); |             passwordEncryptionService.setDataKey(newPassword, decryptedDataKey); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -762,7 +762,7 @@ function updateNoteData(noteId: string, content: string, attachments: BAttachmen | |||||||
|         const existingAttachmentsByTitle = utils.toMap(note.getAttachments({includeContentLength: false}), 'title'); |         const existingAttachmentsByTitle = utils.toMap(note.getAttachments({includeContentLength: false}), 'title'); | ||||||
| 
 | 
 | ||||||
|         for (const attachment of attachments) { |         for (const attachment of attachments) { | ||||||
|             // FIXME: The content property was extracted directly instead of `getContent`. To investigate.
 |             // TODO: The content property was extracted directly instead of `getContent`. To investigate.
 | ||||||
|             const {attachmentId, role, mime, title, position} = attachment; |             const {attachmentId, role, mime, title, position} = attachment; | ||||||
|             const content = attachment.getContent(); |             const content = attachment.getContent(); | ||||||
| 
 | 
 | ||||||
| @ -835,7 +835,7 @@ function undeleteBranch(branchId: string, deleteId: string, taskContext: TaskCon | |||||||
| 
 | 
 | ||||||
|         for (const attributeRow of attributeRows) { |         for (const attributeRow of attributeRows) { | ||||||
|             // relation might point to a note which hasn't been undeleted yet and would thus throw up
 |             // relation might point to a note which hasn't been undeleted yet and would thus throw up
 | ||||||
|             // FIXME: skipValidation is not used.
 |             // TODO: skipValidation is not used.
 | ||||||
|             new BAttribute(attributeRow).save({skipValidation: true}); |             new BAttribute(attributeRow).save({skipValidation: true}); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| @ -1015,7 +1015,7 @@ function duplicateSubtreeInner(origNote: BNote, origBranch: BBranch, newParentNo | |||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             // the relation targets may not be created yet, the mapping is pre-generated
 |             // the relation targets may not be created yet, the mapping is pre-generated
 | ||||||
|             // FIXME: This used to be `attr.save({skipValidation: true});`, but skipValidation is in beforeSaving.
 |             // TODO: This used to be `attr.save({skipValidation: true});`, but skipValidation is in beforeSaving.
 | ||||||
|             attr.save(); |             attr.save(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -39,7 +39,6 @@ class OrderByAndLimitExp extends Expression { | |||||||
| 
 | 
 | ||||||
|     execute(inputNoteSet: NoteSet, executionContext: {}, searchContext: SearchContext) { |     execute(inputNoteSet: NoteSet, executionContext: {}, searchContext: SearchContext) { | ||||||
|         if (!this.subExpression) { |         if (!this.subExpression) { | ||||||
|             // FIXME: who is setting the subexpression?
 |  | ||||||
|             throw new Error("Missing subexpression"); |             throw new Error("Missing subexpression"); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ | |||||||
| const Mutex = require('async-mutex').Mutex; | const Mutex = require('async-mutex').Mutex; | ||||||
| const instance = new Mutex(); | const instance = new Mutex(); | ||||||
| 
 | 
 | ||||||
| async function doExclusively<T>(func: () => void) { | async function doExclusively<T>(func: () => T) { | ||||||
|     const releaseMutex = await instance.acquire(); |     const releaseMutex = await instance.acquire(); | ||||||
| 
 | 
 | ||||||
|     try { |     try { | ||||||
|  | |||||||
| @ -82,7 +82,7 @@ function unescapeHtml(str: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function toObject<T, K extends string | number | symbol, V>(array: T[], fn: (item: T) => [K, V]): Record<K, V> { | function toObject<T, K extends string | number | symbol, V>(array: T[], fn: (item: T) => [K, V]): Record<K, V> { | ||||||
|     const obj: Record<K, V> = {} as Record<K, V>; // FIXME: unsafe?
 |     const obj: Record<K, V> = {} as Record<K, V>; // TODO: unsafe?
 | ||||||
| 
 | 
 | ||||||
|     for (const item of array) { |     for (const item of array) { | ||||||
|         const ret = fn(item); |         const ret = fn(item); | ||||||
| @ -98,7 +98,7 @@ function stripTags(text: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function union<T extends string | number | symbol>(a: T[], b: T[]): T[] { | function union<T extends string | number | symbol>(a: T[], b: T[]): T[] { | ||||||
|     const obj: Record<T, T> = {} as Record<T, T>; // FIXME: unsafe?
 |     const obj: Record<T, T> = {} as Record<T, T>; // TODO: unsafe?
 | ||||||
| 
 | 
 | ||||||
|     for (let i = a.length-1; i >= 0; i--) { |     for (let i = a.length-1; i >= 0; i--) { | ||||||
|         obj[a[i]] = a[i]; |         obj[a[i]] = a[i]; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran