Merge remote-tracking branch 'origin/develop' into feature/ckeditor_lib

This commit is contained in:
Elian Doran 2025-05-07 13:13:52 +03:00
commit abf7cd86d3
No known key found for this signature in database
25 changed files with 1029 additions and 953 deletions

View File

@ -132,12 +132,18 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Set up node & dependencies
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: pnpm install --frozen-lockfile
- name: Update build info - name: Update build info
run: npm run chore:update-build-info run: pnpm run chore:update-build-info
- name: Docker meta - name: Docker meta
id: meta id: meta

2
.mailmap Normal file
View File

@ -0,0 +1,2 @@
Adam Zivner <adam.zivner@gmail.com>
Adam Zivner <zadam.apps@gmail.com>

View File

@ -38,7 +38,7 @@
"@playwright/test": "1.52.0", "@playwright/test": "1.52.0",
"@stylistic/eslint-plugin": "4.2.0", "@stylistic/eslint-plugin": "4.2.0",
"@types/express": "5.0.1", "@types/express": "5.0.1",
"@types/node": "22.15.3", "@types/node": "22.15.14",
"@types/yargs": "17.0.33", "@types/yargs": "17.0.33",
"@vitest/coverage-v8": "3.1.2", "@vitest/coverage-v8": "3.1.2",
"eslint": "9.24.0", "eslint": "9.24.0",
@ -49,7 +49,7 @@
"rcedit": "4.0.1", "rcedit": "4.0.1",
"rimraf": "6.0.1", "rimraf": "6.0.1",
"tslib": "2.8.1", "tslib": "2.8.1",
"typedoc": "0.28.3", "typedoc": "0.28.4",
"typedoc-plugin-missing-exports": "4.0.0" "typedoc-plugin-missing-exports": "4.0.0"
}, },
"optionalDependencies": { "optionalDependencies": {

View File

@ -23,15 +23,15 @@
"@popperjs/core": "2.11.8", "@popperjs/core": "2.11.8",
"@triliumnext/ckeditor5": "workspace:*", "@triliumnext/ckeditor5": "workspace:*",
"@triliumnext/commons": "workspace:*", "@triliumnext/commons": "workspace:*",
"bootstrap": "5.3.5", "bootstrap": "5.3.6",
"dayjs": "1.11.13", "dayjs": "1.11.13",
"dayjs-plugin-utc": "0.1.2", "dayjs-plugin-utc": "0.1.2",
"debounce": "2.2.0", "debounce": "2.2.0",
"draggabilly": "3.0.0", "draggabilly": "3.0.0",
"eslint-linter-browserify": "9.25.1", "eslint-linter-browserify": "9.26.0",
"force-graph": "1.49.5", "force-graph": "1.49.5",
"globals": "16.0.0", "globals": "16.0.0",
"i18next": "25.0.2", "i18next": "25.1.1",
"i18next-http-backend": "3.0.2", "i18next-http-backend": "3.0.2",
"jquery": "3.7.1", "jquery": "3.7.1",
"jquery-hotkeys": "0.2.2", "jquery-hotkeys": "0.2.2",

View File

@ -5,9 +5,9 @@
"description": "Tool to compare content of Trilium databases. Useful for debugging sync problems.", "description": "Tool to compare content of Trilium databases. Useful for debugging sync problems.",
"dependencies": { "dependencies": {
"colors": "1.4.0", "colors": "1.4.0",
"diff": "5.0.0", "diff": "7.0.0",
"sqlite": "5.1.1", "sqlite": "5.1.1",
"sqlite3": "5.1.5" "sqlite3": "5.1.7"
}, },
"nx": { "nx": {
"name": "db-compare", "name": "db-compare",
@ -69,7 +69,6 @@
} }
}, },
"devDependencies": { "devDependencies": {
"@types/colors": "1.2.4",
"@types/diff": "^7.0.2" "@types/diff": "^7.0.2"
} }
} }

View File

@ -0,0 +1 @@
TRILIUM_PORT=37743

View File

@ -18,8 +18,7 @@
"@types/electron-squirrel-startup": "1.0.2", "@types/electron-squirrel-startup": "1.0.2",
"@triliumnext/server": "workspace:*", "@triliumnext/server": "workspace:*",
"copy-webpack-plugin": "13.0.0", "copy-webpack-plugin": "13.0.0",
"electron": "35.2.2", "electron": "35.2.2",
"@electron/rebuild": "4.0.1",
"@electron-forge/cli": "7.8.0", "@electron-forge/cli": "7.8.0",
"@electron-forge/maker-deb": "7.8.0", "@electron-forge/maker-deb": "7.8.0",
"@electron-forge/maker-dmg": "7.8.0", "@electron-forge/maker-dmg": "7.8.0",
@ -55,12 +54,10 @@
"cache": true, "cache": true,
"configurations": { "configurations": {
"default": { "default": {
"command": "cross-env DEBUG=* tsx scripts/rebuild.mts", "command": "cross-env DEBUG=* tsx scripts/electron-rebuild.mts {projectRoot}/dist"
"cwd": "{projectRoot}"
}, },
"nixos": { "nixos": {
"command": "electron-rebuild -f -v $(nix-shell -p electron_35 --run \"electron --version\") dist/main.js -m dist", "command": "cross-env DEBUG=* tsx scripts/electron-rebuild.mts {projectRoot}/dist $(nix-shell -p electron_33 --run \"electron --version\")"
"cwd": "{projectRoot}"
} }
} }
}, },
@ -76,7 +73,25 @@
"cwd": "{projectRoot}/dist" "cwd": "{projectRoot}/dist"
}, },
"nixos": { "nixos": {
"command": "nix-shell -p electron_35 --run \"electron {projectRoot}/dist/main.js\"", "command": "nix-shell -p electron_33 --run \"electron {projectRoot}/dist/main.js\"",
"cwd": ".",
"forwardAllArgs": false
}
}
},
"serve-nodir": {
"executor": "nx:run-commands",
"dependsOn": [
"rebuild-deps"
],
"defaultConfiguration": "default",
"configurations": {
"default": {
"command": "electron .",
"cwd": "{projectRoot}/dist"
},
"nixos": {
"command": "nix-shell -p electron_33 --run \"electron {projectRoot}/dist/main.js\"",
"cwd": ".", "cwd": ".",
"forwardAllArgs": false "forwardAllArgs": false
} }

View File

@ -1,35 +0,0 @@
/**
* @module
*
* This script is used internally by the `rebuild-deps` target of the `desktop`. Normally we could use
* `electron-rebuild` CLI directly, but it would rebuild the monorepo-level dependencies and breaks
* the server build (and it doesn't expose a CLI option to override this).
*/
import { fileURLToPath } from "url";
import { dirname, join } from "path";
import { rebuild } from "@electron/rebuild"
import { readFileSync } from "fs";
const scriptDir = dirname(fileURLToPath(import.meta.url));
const rootDir = join(scriptDir, "..");
function getElectronVersion() {
const packageJsonPath = join(rootDir, "package.json");
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
return packageJson.devDependencies.electron;
}
function main() {
const distDir = join(rootDir, "dist");
rebuild({
// We force the project root path to avoid electron-rebuild from rebuilding the monorepo-level dependency and breaking the server.
projectRootPath: distDir,
buildPath: distDir,
force: true,
electronVersion: getElectronVersion(),
});
}
main();

View File

@ -4,7 +4,6 @@
"private": true, "private": true,
"description": "Desktop version of Trilium which imports the demo database (presented to new users at start-up) or the user guide and other documentation and saves the modifications for committing.", "description": "Desktop version of Trilium which imports the demo database (presented to new users at start-up) or the user guide and other documentation and saves the modifications for committing.",
"devDependencies": { "devDependencies": {
"@electron/rebuild": "4.0.1",
"@triliumnext/client": "workspace:*", "@triliumnext/client": "workspace:*",
"@triliumnext/desktop": "workspace:*", "@triliumnext/desktop": "workspace:*",
"@types/fs-extra": "11.0.4", "@types/fs-extra": "11.0.4",
@ -17,19 +16,19 @@
"targets": { "targets": {
"rebuild-deps": { "rebuild-deps": {
"executor": "nx:run-commands", "executor": "nx:run-commands",
"dependsOn": [ "build" ], "dependsOn": [
"build"
],
"defaultConfiguration": "default", "defaultConfiguration": "default",
"cache": true, "cache": true,
"configurations": { "configurations": {
"default": { "default": {
"command": "cross-env DEBUG=* tsx scripts/rebuild.mts", "command": "cross-env DEBUG=* tsx scripts/electron-rebuild.mts {projectRoot}/dist"
"cwd": "{projectRoot}"
}, },
"nixos": { "nixos": {
"command": "electron-rebuild -f -v $(nix-shell -p electron_35 --run \"electron --version\") dist/main.js -m dist", "command": "cross-env DEBUG=* tsx scripts/electron-rebuild.mts {projectRoot}/dist $(nix-shell -p electron_33 --run \"electron --version\")"
"cwd": "{projectRoot}"
} }
} }
}, },
"serve": { "serve": {
"executor": "nx:run-commands", "executor": "nx:run-commands",

View File

@ -1,37 +0,0 @@
/**
* @module
*
* This script is used internally by the `rebuild-deps` target of the `desktop`. Normally we could use
* `electron-rebuild` CLI directly, but it would rebuild the monorepo-level dependencies and breaks
* the server build (and it doesn't expose a CLI option to override this).
*/
// TODO: Deduplicate with apps/desktop/scripts/rebuild.ts.
import { fileURLToPath } from "url";
import { dirname, join } from "path";
import { rebuild } from "@electron/rebuild"
import { readFileSync } from "fs";
const scriptDir = dirname(fileURLToPath(import.meta.url));
const rootDir = join(scriptDir, "..");
function getElectronVersion() {
const packageJsonPath = join(rootDir, "package.json");
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
return packageJson.devDependencies.electron;
}
function main() {
const distDir = join(rootDir, "dist");
rebuild({
// We force the project root path to avoid electron-rebuild from rebuilding the monorepo-level dependency and breaking the server.
projectRootPath: distDir,
buildPath: distDir,
force: true,
electronVersion: getElectronVersion(),
});
}
main();

View File

@ -31,7 +31,7 @@
"@types/mime-types": "2.1.4", "@types/mime-types": "2.1.4",
"@types/multer": "1.4.12", "@types/multer": "1.4.12",
"@types/safe-compare": "1.1.2", "@types/safe-compare": "1.1.2",
"@types/sanitize-html": "2.15.0", "@types/sanitize-html": "2.16.0",
"@types/sax": "1.2.7", "@types/sax": "1.2.7",
"@types/serve-favicon": "2.5.7", "@types/serve-favicon": "2.5.7",
"@types/serve-static": "1.15.7", "@types/serve-static": "1.15.7",
@ -85,7 +85,7 @@
"html2plaintext": "2.1.4", "html2plaintext": "2.1.4",
"http-proxy-agent": "7.0.2", "http-proxy-agent": "7.0.2",
"https-proxy-agent": "7.0.6", "https-proxy-agent": "7.0.6",
"i18next": "25.0.2", "i18next": "25.1.1",
"i18next-fs-backend": "2.6.0", "i18next-fs-backend": "2.6.0",
"image-type": "5.2.0", "image-type": "5.2.0",
"ini": "5.0.0", "ini": "5.0.0",
@ -117,8 +117,8 @@
"tmp": "0.2.3", "tmp": "0.2.3",
"turndown": "7.2.0", "turndown": "7.2.0",
"unescape": "1.0.1", "unescape": "1.0.1",
"webpack": "5.99.7", "webpack": "5.99.8",
"ws": "8.18.1", "ws": "8.18.2",
"xml2js": "0.6.2", "xml2js": "0.6.2",
"yauzl": "3.2.0", "yauzl": "3.2.0",
"copy-webpack-plugin": "13.0.0" "copy-webpack-plugin": "13.0.0"

File diff suppressed because one or more lines are too long

View File

@ -124,14 +124,14 @@ function forceFullSync() {
* type: object * type: object
* properties: * properties:
* entityChanges: * entityChanges:
* type: list * type: array
* items: * items:
* $ref: '#/components/schemas/EntityChange' * $ref: '#/components/schemas/EntityChange'
* lastEntityChangeId: * lastEntityChangeId:
* type: integer * type: integer
* description: If `outstandingPullCount > 0`, pass this as parameter in your next request to continue. * description: If `outstandingPullCount > 0`, pass this as parameter in your next request to continue.
* outstandingPullCount: * outstandingPullCount:
* type: int * type: integer
* example: 42 * example: 42
* description: Number of changes not yet returned by the remote. * description: Number of changes not yet returned by the remote.
* security: * security:
@ -247,7 +247,7 @@ const partialRequests: Record<
* type: string * type: string
* description: Local instance ID * description: Local instance ID
* entities: * entities:
* type: list * type: array
* items: * items:
* $ref: '#/components/schemas/EntityChange' * $ref: '#/components/schemas/EntityChange'
* responses: * responses:

View File

@ -152,15 +152,15 @@ function getNotesAndBranchesAndAttributes(_noteIds: string[] | Set<string>) {
* type: object * type: object
* properties: * properties:
* branches: * branches:
* type: list * type: array
* items: * items:
* $ref: '#/components/schemas/Branch' * $ref: '#/components/schemas/Branch'
* notes: * notes:
* type: list * type: array
* items: * items:
* $ref: '#/components/schemas/Note' * $ref: '#/components/schemas/Note'
* attributes: * attributes:
* type: list * type: array
* items: * items:
* $ref: '#/components/schemas/Attribute' * $ref: '#/components/schemas/Attribute'
* security: * security:

View File

@ -62,6 +62,36 @@ function setPassword(req: Request, res: Response) {
res.redirect("login"); res.redirect("login");
} }
/**
* @swagger
* /login:
* post:
* tags:
* - auth
* summary: Log in using password
* description: This will give you a Trilium session, which is required for some other API endpoints. `totpToken` is only required if the user configured TOTP authentication.
* operationId: login-normal
* externalDocs:
* description: HMAC calculation
* url: https://github.com/TriliumNext/Notes/blob/v0.91.6/src/services/utils.ts#L62-L66
* requestBody:
* content:
* application/x-www-form-urlencoded:
* schema:
* type: object
* required:
* - password
* properties:
* password:
* type: string
* totpToken:
* type: string
* responses:
* '200':
* description: Successful operation
* '401':
* description: Password / TOTP mismatch
*/
function login(req: Request, res: Response) { function login(req: Request, res: Response) {
if (openID.isOpenIDEnabled()) { if (openID.isOpenIDEnabled()) {
res.oidc.login({ res.oidc.login({

View File

@ -47,9 +47,11 @@ export function listSyntaxHighlightingThemes() {
export function getStylesDirectory() { export function getStylesDirectory() {
if (isElectron && !isDev) { if (isElectron && !isDev) {
return "styles"; return "styles";
} else if (!isDev) {
return "node_modules/@highlightjs/cdn-assets/styles";
} else {
return join(__dirname, "../../node_modules/@highlightjs/cdn-assets/styles");
} }
return "node_modules/@highlightjs/cdn-assets/styles";
} }
/** /**

View File

@ -1,2 +1,2 @@
# attachments # attachments
<figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col> <col> <col> <col> <col></colgroup><thead><tr><th>Column Name</th><th>Data Type</th><th>Nullity</th><th>Default value</th><th>Description</th></tr></thead><tbody><tr><th><code>attachmentId</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>Unique ID (e.g. <code>qhC1vzU4nwSE</code>)</td></tr><tr><th><code>ownerId</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>The unique ID of a row in&nbsp;<a class="reference-link" href="notes.md">notes</a>.</td></tr><tr><th><code>role</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>The role of the attachment: <code>image</code> for images that are attached to a note.</td></tr><tr><th><code>mime</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>The MIME type of the attachment (e.g. <code>image/png</code>)</td></tr><tr><th><code>title</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>The title of the attachment.</td></tr><tr><th><code>isProtected</code></th><td>Integer</td><td>Non-null</td><td>0</td><td><code>1</code> if the entity is <a href="../Protected%20entities.md">protected</a>, <code>0</code> otherwise.</td></tr><tr><th><code>position</code></th><td>Integer</td><td>Non-null</td><td>0</td><td>Not sure where the position is relevant for attachments (saw it with values of 10 and 0).</td></tr><tr><th><code>blobId</code></th><td>Text</td><td>Nullable</td><td><code>null</code></td><td>The corresponding <code>blobId</code> from the&nbsp;<a class="reference-link" href="blobs.md">blobs</a>&nbsp;table.</td></tr><tr><th><code>dateModified</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>Localized modification date (e.g. <code>2023-11-08 18:43:44.204+0200</code>)</td></tr><tr><th><code>utcDateModified</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>Modification date in UTC format (e.g. <code>2023-11-08 16:43:44.204Z</code>)</td></tr><tr><th><code>utcDateScheduledForErasure</code></th><td>Text</td><td>Nullable</td><td><code>null</code></td><td>&nbsp;</td></tr><tr><th><code>isDeleted</code></th><td>Integer</td><td>Non-null</td><td>&nbsp;</td><td><code>1</code> if the entity is <a href="../Deleted%20notes.md">deleted</a>, <code>0</code> otherwise.</td></tr><tr><th><code>deleteId</code></th><td>Text</td><td>Nullable</td><td><code>null</code></td><td>&nbsp;</td></tr></tbody></table></figure> <figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col> <col> <col> <col> <col></colgroup><thead><tr><th>Column Name</th><th>Data Type</th><th>Nullity</th><th>Default value</th><th>Description</th></tr></thead><tbody><tr><th><code>attachmentId</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>Unique ID (e.g. <code>qhC1vzU4nwSE</code>)</td></tr><tr><th><code>ownerId</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>The unique ID of a row in&nbsp;<a class="reference-link" href="notes.md">notes</a>.</td></tr><tr><th><code>role</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>The role of the attachment: <code>image</code> for images that are attached to a note, <code>file</code> for uploaded files.</td></tr><tr><th><code>mime</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>The MIME type of the attachment (e.g. <code>image/png</code>)</td></tr><tr><th><code>title</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>The title of the attachment.</td></tr><tr><th><code>isProtected</code></th><td>Integer</td><td>Non-null</td><td>0</td><td><code>1</code> if the entity is <a href="../Protected%20entities.md">protected</a>, <code>0</code> otherwise.</td></tr><tr><th><code>position</code></th><td>Integer</td><td>Non-null</td><td>0</td><td>Not sure where the position is relevant for attachments (saw it with values of 10 and 0).</td></tr><tr><th><code>blobId</code></th><td>Text</td><td>Nullable</td><td><code>null</code></td><td>The corresponding <code>blobId</code> from the&nbsp;<a class="reference-link" href="blobs.md">blobs</a>&nbsp;table.</td></tr><tr><th><code>dateModified</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>Localized modification date (e.g. <code>2023-11-08 18:43:44.204+0200</code>)</td></tr><tr><th><code>utcDateModified</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>Modification date in UTC format (e.g. <code>2023-11-08 16:43:44.204Z</code>)</td></tr><tr><th><code>utcDateScheduledForErasure</code></th><td>Text</td><td>Nullable</td><td><code>null</code></td><td>&nbsp;</td></tr><tr><th><code>isDeleted</code></th><td>Integer</td><td>Non-null</td><td>&nbsp;</td><td><code>1</code> if the entity is <a href="../Deleted%20notes.md">deleted</a>, <code>0</code> otherwise.</td></tr><tr><th><code>deleteId</code></th><td>Text</td><td>Nullable</td><td><code>null</code></td><td>&nbsp;</td></tr></tbody></table></figure>

View File

@ -1,2 +1,2 @@
# blobs # blobs
<figure class="table"><table><thead><tr><th>Column Name</th><th>Data Type</th><th>Nullity</th><th>Default value</th><th>Description</th></tr></thead><tbody><tr><th><code>blobId</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>The unique ID of the blob (e.g. <code>XXbfAJXqWrYnSXcelLFA</code>).</td></tr><tr><th><code>content</code></th><td>Text</td><td>Nullable</td><td><code>null</code></td><td><p>The content of the blob, can be either:</p><ul><li>text (for plain text notes or HTML notes).</li><li>binary (for images and other types of attachments)</li></ul></td></tr><tr><th><code>dateModified</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>Localized modification date (e.g. <code>2023-11-08 18:43:44.204+0200</code>)</td></tr><tr><th><code>utcDateModified</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>Modification date in UTC format (e.g. <code>2023-11-08 16:43:44.204Z</code>)</td></tr></tbody></table></figure> <figure class="table"><table><thead><tr><th>Column Name</th><th>Data Type</th><th>Nullity</th><th>Default value</th><th>Description</th></tr></thead><tbody><tr><th><code>blobId</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>The unique ID of the blob (e.g. <code>XXbfAJXqWrYnSXcelLFA</code>).<p>Important: this ID is actually a hash of the content, see <code>AbstractBeccaEntity#saveBlob</code>! It is a logic error to modify an existing blob.</p></td></tr><tr><th><code>content</code></th><td>Text</td><td>Nullable</td><td><code>null</code></td><td><p>The content of the blob, can be either:</p><ul><li>text (for plain text notes or HTML notes).</li><li>binary (for images and other types of attachments)</li></ul></td></tr><tr><th><code>dateModified</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>Creation date with timezone offset (e.g. <code>2023-11-08 18:43:44.204+0200</code>)</td></tr><tr><th><code>utcDateModified</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>Creation date in UTC format (e.g. <code>2023-11-08 16:43:44.204Z</code>).<p>Blobs cannot be modified, so this timestamp specifies when the blob was created.</p></td></tr></tbody></table></figure>

View File

@ -1,2 +1,4 @@
# entity_changes # entity_changes
<figure class="table"><table><thead><tr><th>Column Name</th><th>Data Type</th><th>Nullity</th><th>Default value</th><th>Description</th></tr></thead><tbody><tr><th><code>id</code></th><td>Integer</td><td>Nullable</td><td>&nbsp;</td><td>A sequential numeric index of the entity change.</td></tr><tr><th><code>entityName</code></th><td>Text</td><td>Nullable</td><td>&nbsp;</td><td>The type of entity being changed (<code>attributes</code>, <code>branches</code>, <code>note_reordering</code>, etc.)</td></tr><tr><th><code>entityId</code></th><td>Text</td><td>Nullable</td><td>&nbsp;</td><td>The ID of the entity being changed.</td></tr><tr><th><code>hash</code></th><td>Text</td><td>Nullable</td><td>&nbsp;</td><td>TODO: Describe how the hash is calculated</td></tr><tr><th><code>isErased</code></th><td>Integer</td><td>Nullable</td><td>&nbsp;</td><td>TODO: What does this do?</td></tr><tr><th><code>changeId</code></th><td>Text</td><td>Nullable</td><td>&nbsp;</td><td>TODO: What does this do?</td></tr><tr><th><code>componentId</code></th><td>Text</td><td>Nullable</td><td>&nbsp;</td><td>TODO: What does this do?</td></tr><tr><th><code>instanceId</code></th><td>Text</td><td>Nullable</td><td>&nbsp;</td><td>TODO: What does this do?</td></tr><tr><th><code>isSynced</code></th><td>Integer</td><td>Nullable</td><td>&nbsp;</td><td>TODO: What does this do?</td></tr><tr><th><code>utcDateChanged</code></th><td>Text</td><td>Nullable</td><td>&nbsp;</td><td>Date of the entity change in UTC format (e.g. <code>2023-11-08 16:43:44.204Z</code>)</td></tr></tbody></table></figure> <figure class="table"><table><thead><tr><th>Column Name</th><th>Data Type</th><th>Nullity</th><th>Default value</th><th>Description</th></tr></thead><tbody><tr><th><code>id</code></th><td>Integer</td><td>Non-null</td><td>&nbsp;</td><td>A sequential numeric index of the entity change.</td></tr><tr><th><code>entityName</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>The type of entity being changed (<code>attributes</code>, <code>branches</code>, <code>note_reordering</code>, etc.)</td></tr><tr><th><code>entityId</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>The ID of the entity being changed.</td></tr><tr><th><code>hash</code></th><td>Text</td><td>Nullable (*)</td><td>&nbsp;</td><td>TODO: Describe how the hash is calculated</td></tr><tr><th><code>isErased</code></th><td>Integer (1 or 0)</td><td>Nullable (*)</td><td>&nbsp;</td><td>TODO: What does this do?</td></tr><tr><th><code>changeId</code></th><td>Text</td><td>Nullable (*)</td><td>&nbsp;</td><td>TODO: What does this do?</td></tr><tr><th><code>componentId</code></th><td>Text</td><td>Nullable (*)</td><td>&nbsp;</td><td><p>The ID of the UI component that caused this change.</p><p>Examples: <code>date-note</code>, <code>F-PoZMI0vc</code>, <code>NA</code> (catch all)</p></td></tr><tr><th><code>instanceId</code></th><td>Text</td><td>Nullable (*)</td><td>&nbsp;</td><td>The ID of the <a href="#root/pOsGYCXsbNQG/tC7s2alapj8V/Gzjqa934BdH4/c5xB8m4g2IY6">instance</a> that created this change.</td></tr><tr><th><code>isSynced</code></th><td>Integer (1 or 0)</td><td>Non-null</td><td>&nbsp;</td><td>TODO: What does this do?</td></tr><tr><th><code>utcDateChanged</code></th><td>Text</td><td>Non-null</td><td>&nbsp;</td><td>Date of the entity change in UTC format (e.g. <code>2023-11-08 16:43:44.204Z</code>)</td></tr></tbody></table></figure>
Nullable (\*) means all new values are non-null, old rows may contain null values.

View File

@ -34,4 +34,6 @@
* The application has been completely restructured to a `pnpm` mono-repo using NX. * The application has been completely restructured to a `pnpm` mono-repo using NX.
* This is only the beginning, where we have properly split the client, server and desktop apps. We'll integrate more and more repos as time goes by, especially the ckeditor. * This is only the beginning, where we have properly split the client, server and desktop apps. We'll integrate more and more repos as time goes by, especially the ckeditor.
* For documentation please consult [Notes/docs/Developer Guide/Developer Guide/Environment Setup.md at develop · TriliumNext/Notes](https://github.com/TriliumNext/Notes/blob/develop/docs/Developer%20Guide/Developer%20Guide/Environment%20Setup.md) and [Notes/docs/Developer Guide/Developer Guide/Project Structure.md at develop · TriliumNext/Notes](https://github.com/TriliumNext/Notes/blob/develop/docs/Developer%20Guide/Developer%20Guide/Project%20Structure.md). * For documentation please consult [Notes/docs/Developer Guide/Developer Guide/Environment Setup.md at develop · TriliumNext/Notes](https://github.com/TriliumNext/Notes/blob/develop/docs/Developer%20Guide/Developer%20Guide/Environment%20Setup.md) and [Notes/docs/Developer Guide/Developer Guide/Project Structure.md at develop · TriliumNext/Notes](https://github.com/TriliumNext/Notes/blob/develop/docs/Developer%20Guide/Developer%20Guide/Project%20Structure.md).
* A large number of [dependency updates](https://github.com/TriliumNext/Notes/milestone/13). * A large number of [dependency updates](https://github.com/TriliumNext/Notes/milestone/13).
* OpenAPI documentation fixes by @FliegendeWurst
* more info on several database table by @FliegendeWurst

View File

@ -16,6 +16,7 @@
"server:start-prod": "nx run server:start-prod", "server:start-prod": "nx run server:start-prod",
"electron:build": "nx build desktop", "electron:build": "nx build desktop",
"chore:ci-update-nightly-version": "tsx ./scripts/update-nightly-version.ts", "chore:ci-update-nightly-version": "tsx ./scripts/update-nightly-version.ts",
"chore:generate-openapi": "tsx ./scripts/generate-openapi.ts",
"chore:update-build-info": "tsx ./scripts/update-build-info.ts", "chore:update-build-info": "tsx ./scripts/update-build-info.ts",
"chore:update-version": "tsx ./scripts/update-version.ts", "chore:update-version": "tsx ./scripts/update-version.ts",
"test": "pnpm nx run-many -t test", "test": "pnpm nx run-many -t test",
@ -24,26 +25,27 @@
"private": true, "private": true,
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.8.0", "@eslint/js": "^9.8.0",
"@nx/devkit": "20.8.0", "@electron/rebuild": "4.0.1",
"@nx/esbuild": "20.8.0", "@nx/devkit": "21.0.0",
"@nx/eslint": "20.8.0", "@nx/esbuild": "21.0.0",
"@nx/eslint-plugin": "20.8.0", "@nx/eslint": "21.0.0",
"@nx/express": "20.8.0", "@nx/eslint-plugin": "21.0.0",
"@nx/js": "20.8.0", "@nx/express": "21.0.0",
"@nx/node": "20.8.0", "@nx/js": "21.0.0",
"@nx/playwright": "20.8.0", "@nx/node": "21.0.0",
"@nx/vite": "20.8.0", "@nx/playwright": "21.0.0",
"@nx/web": "20.8.0", "@nx/vite": "21.0.0",
"@nx/webpack": "20.8.0", "@nx/web": "21.0.0",
"@nx/webpack": "21.0.0",
"@playwright/test": "^1.36.0", "@playwright/test": "^1.36.0",
"@svgr/webpack": "^8.0.1", "@svgr/webpack": "^8.0.1",
"@swc-node/register": "~1.9.1", "@swc-node/register": "~1.10.0",
"@swc/cli": "~0.6.0", "@swc/cli": "~0.7.0",
"@swc/core": "~1.5.7", "@swc/core": "~1.11.0",
"@swc/helpers": "~0.5.11", "@swc/helpers": "~0.5.11",
"@triliumnext/server": "workspace:*", "@triliumnext/server": "workspace:*",
"@types/express": "^4.17.21", "@types/express": "^4.17.21",
"@types/node": "22.15.3", "@types/node": "22.15.14",
"@vitest/coverage-v8": "^3.0.5", "@vitest/coverage-v8": "^3.0.5",
"@vitest/ui": "^3.0.0", "@vitest/ui": "^3.0.0",
"chalk": "5.4.1", "chalk": "5.4.1",
@ -51,16 +53,16 @@
"esbuild": "^0.25.0", "esbuild": "^0.25.0",
"eslint": "^9.8.0", "eslint": "^9.8.0",
"eslint-config-prettier": "^10.0.0", "eslint-config-prettier": "^10.0.0",
"eslint-plugin-playwright": "^1.6.2", "eslint-plugin-playwright": "^2.0.0",
"jiti": "2.4.2", "jiti": "2.4.2",
"jsdom": "~22.1.0", "jsdom": "~26.1.0",
"jsonc-eslint-parser": "^2.1.0", "jsonc-eslint-parser": "^2.1.0",
"nx": "20.8.0", "nx": "21.0.0",
"react-refresh": "^0.10.0", "react-refresh": "^0.10.0",
"swc-loader": "0.1.15", "swc-loader": "0.2.6",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"tsx": "4.19.4", "tsx": "4.19.4",
"typescript": "~5.7.2", "typescript": "~5.8.0",
"typescript-eslint": "^8.19.0", "typescript-eslint": "^8.19.0",
"upath": "2.0.1", "upath": "2.0.1",
"vite": "^6.0.0", "vite": "^6.0.0",

1656
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,49 @@
/**
* @module
*
* This script is used internally by the `rebuild-deps` target of the `desktop`. Normally we could use
* `electron-rebuild` CLI directly, but it would rebuild the monorepo-level dependencies and breaks
* the server build (and it doesn't expose a CLI option to override this).
*/
import { join, resolve } from "path";
import { rebuild } from "@electron/rebuild"
import { readFileSync } from "fs";
function getElectronVersion(distDir: string) {
if (process.argv[3]) {
return process.argv[3];
}
const packageJsonPath = join(distDir, "package.json");
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
const electronVersion = packageJson?.devDependencies?.electron ?? packageJson?.dependencies?.electron;
if (!electronVersion) {
console.error(`Unable to retrieve Electron version in '${resolve(packageJsonPath)}'.`);
process.exit(3);
}
return electronVersion;
}
function main() {
const distDir = resolve(process.argv[2]);
if (!distDir) {
console.error("Missing root dir as argument.");
process.exit(1);
}
const electronVersion = getElectronVersion(distDir);
console.log(`Rebuilding ${distDir} with version ${electronVersion}...`);
rebuild({
// We force the project root path to avoid electron-rebuild from rebuilding the monorepo-level dependency and breaking the server.
projectRootPath: distDir,
buildPath: distDir,
force: true,
electronVersion,
});
}
main();

View File

@ -4,18 +4,24 @@ import swaggerJsdoc from "swagger-jsdoc";
import fs from "fs"; import fs from "fs";
/* /*
* Usage: npm run generate-openapi | tail -n1 > x.json * Usage: npm run chore:generate-openapi
* Output: ./apps/server/src/assets/openapi.json
* *
* Inspect generated file by opening it in https://editor-next.swagger.io/ * Inspect generated file by opening it in https://editor-next.swagger.io/
* *
*/ */
const scriptDir = dirname(fileURLToPath(import.meta.url));
const outputPath = join(scriptDir, "..", "apps", "server", "src", "assets", "openapi.json");
const packageJson = JSON.parse(fs.readFileSync(join(scriptDir, "..", "package.json"), 'utf8'));
const options = { const options = {
definition: { definition: {
openapi: "3.1.1", openapi: "3.1.1",
info: { info: {
title: "Trilium Notes - Sync server API", title: "Trilium Notes - Sync server API",
version: "0.96.6", version: packageJson["version"],
description: description:
"This is the internal sync server API used by Trilium Notes / TriliumNext Notes.\n\n_If you're looking for the officially supported External Trilium API, see [here](https://triliumnext.github.io/Docs/Wiki/etapi.html)._\n\nThis page does not yet list all routes. For a full list, see the [route controller](https://github.com/TriliumNext/Notes/blob/v0.91.6/src/routes/routes.ts).", "This is the internal sync server API used by Trilium Notes / TriliumNext Notes.\n\n_If you're looking for the officially supported External Trilium API, see [here](https://triliumnext.github.io/Docs/Wiki/etapi.html)._\n\nThis page does not yet list all routes. For a full list, see the [route controller](https://github.com/TriliumNext/Notes/blob/v0.91.6/src/routes/routes.ts).",
contact: { contact: {
@ -30,18 +36,17 @@ const options = {
}, },
apis: [ apis: [
// Put individual files here to have them ordered first. // Put individual files here to have them ordered first.
"./src/routes/api/setup.ts", "./apps/server/src/routes/api/setup.ts",
// all other files // all other files
"./src/routes/api/*.ts", "./apps/server/src/routes/api/*.ts",
"./bin/generate-openapi.js" "./apps/server/src/routes/*.ts",
"./scripts/generate-openapi.ts"
] ]
}; };
const openapiSpecification = swaggerJsdoc(options); const openapiSpecification = swaggerJsdoc(options);
const scriptDir = dirname(fileURLToPath(import.meta.url));
const outputPath = join(scriptDir, "..", "src", "routes", "api", "openapi.json");
fs.writeFileSync(outputPath, JSON.stringify(openapiSpecification)); fs.writeFileSync(outputPath, JSON.stringify(openapiSpecification));
console.log("Saved to ", outputPath); console.log("Saved to", outputPath);
/** /**
* @swagger * @swagger
@ -67,7 +72,7 @@ console.log("Saved to ", outputPath);
* $ref: "#/components/schemas/NoteId" * $ref: "#/components/schemas/NoteId"
* type: * type:
* type: string * type: string
* enum: ["attribute", "relation"] * enum: ["label", "relation"]
* name: * name:
* type: string * type: string
* example: "internalLink" * example: "internalLink"
@ -99,6 +104,7 @@ console.log("Saved to ", outputPath);
* $ref: "#/components/schemas/UtcDateTime" * $ref: "#/components/schemas/UtcDateTime"
* Branch: * Branch:
* type: object * type: object
* required: ["branchId", "noteId", "parentNoteId", "notePosition"]
* properties: * properties:
* branchId: * branchId:
* $ref: "#/components/schemas/BranchId" * $ref: "#/components/schemas/BranchId"
@ -141,6 +147,7 @@ console.log("Saved to ", outputPath);
* description: Encoded entity data. Object has one property for each database column. * description: Encoded entity data. Object has one property for each database column.
* Note: * Note:
* type: object * type: object
* required: ["noteId", "title", "isProtected", "type", "mime", "blobId"]
* properties: * properties:
* noteId: * noteId:
* $ref: "#/components/schemas/NoteId" * $ref: "#/components/schemas/NoteId"