From 6fbd5a77e403ba2352cdfac8ca58d387829999d6 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 14 Jan 2022 19:53:59 +0100 Subject: [PATCH] forgotten note_types --- .gitignore | 3 +- docs/backend_api/Attribute.html | 4 +- docs/backend_api/BackendScriptApi.html | 6 +- docs/backend_api/Branch.html | 4 +- docs/backend_api/EtapiToken.html | 23 +- docs/backend_api/Note.html | 32 +- docs/backend_api/NoteRevision.html | 4 +- docs/backend_api/Option.html | 4 +- docs/backend_api/RecentNote.html | 4 +- .../becca_entities_attribute.js.html | 6 +- .../backend_api/becca_entities_branch.js.html | 4 +- .../becca_entities_etapi_token.js.html | 7 +- docs/backend_api/becca_entities_note.js.html | 12 +- .../becca_entities_note_revision.js.html | 4 +- .../backend_api/becca_entities_option.js.html | 4 +- .../becca_entities_recent_note.js.html | 4 +- docs/backend_api/global.html | 4 +- docs/backend_api/index.html | 4 +- docs/backend_api/module-sql.html | 1267 +++++++++++++++++ .../services_backend_script_api.js.html | 4 +- docs/backend_api/services_sql.js.html | 6 +- docs/frontend_api/entities_note_short.js.html | 2 +- package-lock.json | 24 +- package.json | 14 +- src/services/note_types.js | 12 + src/services/sql.js | 2 - 26 files changed, 1355 insertions(+), 109 deletions(-) create mode 100644 docs/backend_api/module-sql.html create mode 100644 src/services/note_types.js diff --git a/.gitignore b/.gitignore index 9ed58a696..831e25725 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ yarn-error.log config.ini cert.key cert.crt -server-package.json \ No newline at end of file +server-package.json +.idea/httpRequests/ diff --git a/docs/backend_api/Attribute.html b/docs/backend_api/Attribute.html index 3075fa69c..72b5ea2a3 100644 --- a/docs/backend_api/Attribute.html +++ b/docs/backend_api/Attribute.html @@ -1020,9 +1020,7 @@ and relation (representing named relationship between source and target note)
diff --git a/docs/backend_api/BackendScriptApi.html b/docs/backend_api/BackendScriptApi.html index 98244b299..0221756a2 100644 --- a/docs/backend_api/BackendScriptApi.html +++ b/docs/backend_api/BackendScriptApi.html @@ -614,7 +614,7 @@ -module:sql +module:sql @@ -6073,9 +6073,7 @@ exists, then we'll use that transaction.
diff --git a/docs/backend_api/Branch.html b/docs/backend_api/Branch.html index 8750faf57..cf98e4e82 100644 --- a/docs/backend_api/Branch.html +++ b/docs/backend_api/Branch.html @@ -752,9 +752,7 @@ parents.
diff --git a/docs/backend_api/EtapiToken.html b/docs/backend_api/EtapiToken.html index 8a212b1a0..0eefe143f 100644 --- a/docs/backend_api/EtapiToken.html +++ b/docs/backend_api/EtapiToken.html @@ -33,7 +33,10 @@
EtapiToken is an entity representing token used to authenticate against Trilium REST API from client applications. Used by: - Trilium Sender -- ETAPI clients
+- ETAPI clients + +The format user is presented with is "_". This is also called "authToken" to distinguish it +from tokenHash and token. @@ -96,7 +99,7 @@ Used by:
Source:
@@ -196,7 +199,7 @@ Used by:
Source:
@@ -264,7 +267,7 @@ Used by:
Source:
@@ -332,7 +335,7 @@ Used by:
Source:
@@ -400,7 +403,7 @@ Used by:
Source:
@@ -468,7 +471,7 @@ Used by:
Source:
@@ -536,7 +539,7 @@ Used by:
Source:
@@ -570,9 +573,7 @@ Used by:
diff --git a/docs/backend_api/Note.html b/docs/backend_api/Note.html index 4ccf84131..37f32b8f6 100644 --- a/docs/backend_api/Note.html +++ b/docs/backend_api/Note.html @@ -1619,7 +1619,7 @@
Source:
@@ -1721,7 +1721,7 @@
Source:
@@ -6588,7 +6588,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6695,7 +6695,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7741,7 +7741,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8504,7 +8504,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8684,7 +8684,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8864,7 +8864,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -9075,7 +9075,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -9255,7 +9255,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -9415,7 +9415,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -9657,7 +9657,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -9868,7 +9868,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -10079,7 +10079,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -10125,9 +10125,7 @@ This method can be significantly faster than the getAttribute()
diff --git a/docs/backend_api/NoteRevision.html b/docs/backend_api/NoteRevision.html index 61ca07da2..627628042 100644 --- a/docs/backend_api/NoteRevision.html +++ b/docs/backend_api/NoteRevision.html @@ -1290,9 +1290,7 @@ It's used for seamless note versioning.
diff --git a/docs/backend_api/Option.html b/docs/backend_api/Option.html index 9d0ba77e1..6778a7407 100644 --- a/docs/backend_api/Option.html +++ b/docs/backend_api/Option.html @@ -431,9 +431,7 @@
diff --git a/docs/backend_api/RecentNote.html b/docs/backend_api/RecentNote.html index ace80a7dd..1e3c22af3 100644 --- a/docs/backend_api/RecentNote.html +++ b/docs/backend_api/RecentNote.html @@ -363,9 +363,7 @@
diff --git a/docs/backend_api/becca_entities_attribute.js.html b/docs/backend_api/becca_entities_attribute.js.html index baf4e20c9..c3c28d026 100644 --- a/docs/backend_api/becca_entities_attribute.js.html +++ b/docs/backend_api/becca_entities_attribute.js.html @@ -79,7 +79,7 @@ class Attribute extends AbstractEntity { /** @type {int} */ this.position = position; /** @type {string} */ - this.value = value; + this.value = value || ""; /** @type {boolean} */ this.isInheritable = !!isInheritable; /** @type {string} */ @@ -245,9 +245,7 @@ module.exports = Attribute;
diff --git a/docs/backend_api/becca_entities_branch.js.html b/docs/backend_api/becca_entities_branch.js.html index daf68f4ed..9acf0a14f 100644 --- a/docs/backend_api/becca_entities_branch.js.html +++ b/docs/backend_api/becca_entities_branch.js.html @@ -193,9 +193,7 @@ module.exports = Branch;
diff --git a/docs/backend_api/becca_entities_etapi_token.js.html b/docs/backend_api/becca_entities_etapi_token.js.html index 3bf851b3e..8f74155d7 100644 --- a/docs/backend_api/becca_entities_etapi_token.js.html +++ b/docs/backend_api/becca_entities_etapi_token.js.html @@ -37,6 +37,9 @@ const sql = require("../../services/sql.js"); * 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. */ class EtapiToken extends AbstractEntity { static get entityName() { return "etapi_tokens"; } @@ -108,9 +111,7 @@ module.exports = EtapiToken;
diff --git a/docs/backend_api/becca_entities_note.js.html b/docs/backend_api/becca_entities_note.js.html index 54f2851ea..c34f9ca82 100644 --- a/docs/backend_api/becca_entities_note.js.html +++ b/docs/backend_api/becca_entities_note.js.html @@ -893,11 +893,13 @@ class Note extends AbstractEntity { this.ancestorCache = []; for (const parent of this.parents) { - if (!noteIds.has(parent.noteId)) { - this.ancestorCache.push(parent); - noteIds.add(parent.noteId); + if (noteIds.has(parent.noteId)) { + continue; } + this.ancestorCache.push(parent); + noteIds.add(parent.noteId); + for (const ancestorNote of parent.getAncestors()) { if (!noteIds.has(ancestorNote.noteId)) { this.ancestorCache.push(ancestorNote); @@ -1218,9 +1220,7 @@ module.exports = Note;
diff --git a/docs/backend_api/becca_entities_note_revision.js.html b/docs/backend_api/becca_entities_note_revision.js.html index ae8c931e4..c9a914a1e 100644 --- a/docs/backend_api/becca_entities_note_revision.js.html +++ b/docs/backend_api/becca_entities_note_revision.js.html @@ -230,9 +230,7 @@ module.exports = NoteRevision;
diff --git a/docs/backend_api/becca_entities_option.js.html b/docs/backend_api/becca_entities_option.js.html index dad91f487..54244d7f1 100644 --- a/docs/backend_api/becca_entities_option.js.html +++ b/docs/backend_api/becca_entities_option.js.html @@ -81,9 +81,7 @@ module.exports = Option;
diff --git a/docs/backend_api/becca_entities_recent_note.js.html b/docs/backend_api/becca_entities_recent_note.js.html index 09e1b0df6..9f3a32049 100644 --- a/docs/backend_api/becca_entities_recent_note.js.html +++ b/docs/backend_api/becca_entities_recent_note.js.html @@ -69,9 +69,7 @@ module.exports = RecentNote;
diff --git a/docs/backend_api/global.html b/docs/backend_api/global.html index 3ad688eae..44aefb433 100644 --- a/docs/backend_api/global.html +++ b/docs/backend_api/global.html @@ -1083,9 +1083,7 @@
diff --git a/docs/backend_api/index.html b/docs/backend_api/index.html index 01c6d411c..09371c322 100644 --- a/docs/backend_api/index.html +++ b/docs/backend_api/index.html @@ -50,9 +50,7 @@
diff --git a/docs/backend_api/module-sql.html b/docs/backend_api/module-sql.html new file mode 100644 index 000000000..4c32d5ffb --- /dev/null +++ b/docs/backend_api/module-sql.html @@ -0,0 +1,1267 @@ + + + + + JSDoc: Module: sql + + + + + + + + + + +
+ +

Module: sql

+ + + + + + +
+ +
+ + + +
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + +

Methods

+ + + + + + + +

(static) execute(query, paramsopt)

+ + + + + + +
+ Execute SQL +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
query + + +string + + + + + + + + + + SQL query with ? used as parameter placeholder
params + + +Array.<object> + + + + + + <optional>
+ + + + + +
array of params if needed
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

(static) getColumn(query, paramsopt) → {Array.<object>}

+ + + + + + +
+ Get a first column in an array. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
query + + +string + + + + + + + + + + SQL query with ? used as parameter placeholder
params + + +Array.<object> + + + + + + <optional>
+ + + + + +
array of params if needed
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ - array of first column of all returned rows +
+ + + +
+
+ Type +
+
+ +Array.<object> + + +
+
+ + + + + + + + + + + + + +

(static) getMap(query, paramsopt) → {object}

+ + + + + + +
+ Get a map of first column mapping to second column. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
query + + +string + + + + + + + + + + SQL query with ? used as parameter placeholder
params + + +Array.<object> + + + + + + <optional>
+ + + + + +
array of params if needed
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ - map of first column to second column +
+ + + +
+
+ Type +
+
+ +object + + +
+
+ + + + + + + + + + + + + +

(static) getRow(query, paramsopt) → {object}

+ + + + + + +
+ Get first returned row. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
query + + +string + + + + + + + + + + SQL query with ? used as parameter placeholder
params + + +Array.<object> + + + + + + <optional>
+ + + + + +
array of params if needed
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ - map of column name to column value +
+ + + +
+
+ Type +
+
+ +object + + +
+
+ + + + + + + + + + + + + +

(static) getRows(query, paramsopt) → {Array.<object>}

+ + + + + + +
+ Get all returned rows. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
query + + +string + + + + + + + + + + SQL query with ? used as parameter placeholder
params + + +Array.<object> + + + + + + <optional>
+ + + + + +
array of params if needed
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ - array of all rows, each row is a map of column name to column value +
+ + + +
+
+ Type +
+
+ +Array.<object> + + +
+
+ + + + + + + + + + + + + +

(static) getValue(query, paramsopt)

+ + + + + + +
+ Get single value from the given query - first column from first returned row. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
query + + +string + + + + + + + + + + SQL query with ? used as parameter placeholder
params + + +Array.<object> + + + + + + <optional>
+ + + + + +
array of params if needed
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ [object] - single value +
+ + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/backend_api/services_backend_script_api.js.html b/docs/backend_api/services_backend_script_api.js.html index 36f6b53d1..c90667e2a 100644 --- a/docs/backend_api/services_backend_script_api.js.html +++ b/docs/backend_api/services_backend_script_api.js.html @@ -467,9 +467,7 @@ module.exports = BackendScriptApi;
diff --git a/docs/backend_api/services_sql.js.html b/docs/backend_api/services_sql.js.html index 63f10fdd7..0f6652db6 100644 --- a/docs/backend_api/services_sql.js.html +++ b/docs/backend_api/services_sql.js.html @@ -30,8 +30,6 @@ /** * @module sql - * - * TODO: some methods (like getValue()) could use raw rows */ const log = require('./log'); @@ -389,9 +387,7 @@ module.exports = {
diff --git a/docs/frontend_api/entities_note_short.js.html b/docs/frontend_api/entities_note_short.js.html index f794709cf..a82770d7d 100644 --- a/docs/frontend_api/entities_note_short.js.html +++ b/docs/frontend_api/entities_note_short.js.html @@ -818,7 +818,7 @@ class NoteShort { const parentNote = froca.notes[parentNoteId]; - if (!parentNote) { + if (!parentNote || parentNote.type === 'search') { continue; } diff --git a/package-lock.json b/package-lock.json index ee751324b..682fc8731 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "electron-find": "1.0.7", "electron-window-state": "5.0.3", "express": "4.17.2", - "express-partial-content": "^1.0.2", + "express-partial-content": "1.0.2", "express-rate-limit": "6.1.0", "express-session": "1.17.2", "fs-extra": "10.0.0", @@ -37,7 +37,7 @@ "https-proxy-agent": "5.0.0", "image-type": "4.1.0", "ini": "2.0.0", - "is-animated": "^2.0.1", + "is-animated": "2.0.2", "is-svg": "4.3.2", "jimp": "0.16.1", "joplin-turndown-plugin-gfm": "1.0.12", @@ -45,11 +45,11 @@ "mime-types": "2.1.34", "multer": "1.4.4", "node-abi": "3.5.0", - "normalize-strings": "^1.1.1", + "normalize-strings": "1.1.1", "open": "8.4.0", "portscanner": "2.2.0", "rand-token": "1.0.1", - "request": "^2.88.2", + "request": "2.88.2", "rimraf": "3.0.2", "sanitize-filename": "1.6.3", "sanitize-html": "2.6.1", @@ -57,9 +57,9 @@ "semver": "7.3.5", "serve-favicon": "2.5.0", "session-file-store": "1.5.0", - "stream-throttle": "^0.1.3", + "stream-throttle": "0.1.3", "striptags": "3.2.0", - "tmp": "^0.2.1", + "tmp": "0.2.1", "turndown": "7.1.1", "unescape": "1.0.1", "ws": "8.4.0", @@ -6382,9 +6382,9 @@ } }, "node_modules/is-animated": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-animated/-/is-animated-2.0.1.tgz", - "integrity": "sha512-f61go8/mYdl6g7JOLbi6YtiJ1AKM9TFdNv2bVP7JlAHm5MPjnvveOkKPlm51beF9ulb5hsGeoqdSXrjJ7RNKHg==" + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-animated/-/is-animated-2.0.2.tgz", + "integrity": "sha512-+Hi3UdXHV/3ZgxdO9Ik45ciNhDlYrDOIdGz7Cj7ybddWnYBi4kwBuGMn79Xa2Js4VldgX5e3943Djsr/KYSPbA==" }, "node_modules/is-arrayish": { "version": "0.2.1", @@ -16261,9 +16261,9 @@ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" }, "is-animated": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-animated/-/is-animated-2.0.1.tgz", - "integrity": "sha512-f61go8/mYdl6g7JOLbi6YtiJ1AKM9TFdNv2bVP7JlAHm5MPjnvveOkKPlm51beF9ulb5hsGeoqdSXrjJ7RNKHg==" + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-animated/-/is-animated-2.0.2.tgz", + "integrity": "sha512-+Hi3UdXHV/3ZgxdO9Ik45ciNhDlYrDOIdGz7Cj7ybddWnYBi4kwBuGMn79Xa2Js4VldgX5e3943Djsr/KYSPbA==" }, "is-arrayish": { "version": "0.2.1", diff --git a/package.json b/package.json index f7d42a962..cc5f3d000 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "electron-window-state": "5.0.3", "@electron/remote": "2.0.1", "express": "4.17.2", - "express-partial-content": "^1.0.2", + "express-partial-content": "1.0.2", "express-rate-limit": "6.1.0", "express-session": "1.17.2", "fs-extra": "10.0.0", @@ -52,7 +52,7 @@ "https-proxy-agent": "5.0.0", "image-type": "4.1.0", "ini": "2.0.0", - "is-animated": "^2.0.1", + "is-animated": "2.0.2", "is-svg": "4.3.2", "jimp": "0.16.1", "joplin-turndown-plugin-gfm": "1.0.12", @@ -60,11 +60,11 @@ "mime-types": "2.1.34", "multer": "1.4.4", "node-abi": "3.5.0", - "normalize-strings": "^1.1.1", + "normalize-strings": "1.1.1", "open": "8.4.0", "portscanner": "2.2.0", "rand-token": "1.0.1", - "request": "^2.88.2", + "request": "2.88.2", "rimraf": "3.0.2", "sanitize-filename": "1.6.3", "sanitize-html": "2.6.1", @@ -72,12 +72,12 @@ "semver": "7.3.5", "serve-favicon": "2.5.0", "session-file-store": "1.5.0", - "stream-throttle": "^0.1.3", + "stream-throttle": "0.1.3", "striptags": "3.2.0", - "tmp": "^0.2.1", + "tmp": "0.2.1", "turndown": "7.1.1", "unescape": "1.0.1", - "ws": "8.4.0", + "ws": "8.4.1", "yauzl": "2.10.0" }, "devDependencies": { diff --git a/src/services/note_types.js b/src/services/note_types.js new file mode 100644 index 000000000..05a242c94 --- /dev/null +++ b/src/services/note_types.js @@ -0,0 +1,12 @@ +module.exports = [ + 'text', + 'code', + 'render', + 'file', + 'image', + 'search', + 'relation-map', + 'book', + 'note-map', + 'mermaid' +]; \ No newline at end of file diff --git a/src/services/sql.js b/src/services/sql.js index 7b5ed8bc0..4a13896f2 100644 --- a/src/services/sql.js +++ b/src/services/sql.js @@ -2,8 +2,6 @@ /** * @module sql - * - * TODO: some methods (like getValue()) could use raw rows */ const log = require('./log');