一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
42 行
1010 B
TypeScript
42 行
1010 B
TypeScript
import BaseCommand from './base-command';
|
|
import Folder from '@joplin/lib/models/Folder';
|
|
import Note from '@joplin/lib/models/Note';
|
|
import Tag from '@joplin/lib/models/Tag';
|
|
import { FolderEntity, NoteEntity } from '@joplin/lib/services/database/types';
|
|
|
|
class Command extends BaseCommand {
|
|
public override usage() {
|
|
return 'dump';
|
|
}
|
|
|
|
public override description() {
|
|
return 'Dumps the complete database as JSON.';
|
|
}
|
|
|
|
public override hidden() {
|
|
return true;
|
|
}
|
|
|
|
public override async action() {
|
|
let items: (NoteEntity | FolderEntity)[] = [];
|
|
const folders = await Folder.all();
|
|
for (let i = 0; i < folders.length; i++) {
|
|
const folder = folders[i];
|
|
const notes = await Note.previews(folder.id);
|
|
items.push(folder);
|
|
items = items.concat(notes);
|
|
}
|
|
|
|
const tags = await Tag.all();
|
|
for (let i = 0; i < tags.length; i++) {
|
|
tags[i].notes_ = await Tag.noteIds(tags[i].id);
|
|
}
|
|
|
|
items = items.concat(tags);
|
|
|
|
this.stdout(JSON.stringify(items));
|
|
}
|
|
}
|
|
|
|
module.exports = Command;
|