orgnote-api 0.40.31 → 0.40.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api.d.ts +3 -1
- package/constants/i18n-keys.d.ts +29 -1
- package/constants/i18n-keys.js +3 -0
- package/encryption/__tests__/note-encryption.spec.js +2 -12
- package/mappers/index.d.ts +1 -1
- package/mappers/index.js +1 -1
- package/mappers/orgnode-to-file-meta.d.ts +3 -0
- package/mappers/{orgnode-to-note.js → orgnode-to-file-meta.js} +5 -4
- package/models/default-commands.d.ts +25 -1
- package/models/default-commands.js +26 -0
- package/models/encryption-store.d.ts +0 -3
- package/models/file-meta-store.d.ts +26 -0
- package/models/file-meta.d.ts +18 -0
- package/models/file-meta.js +1 -0
- package/models/file-search-store.d.ts +35 -0
- package/models/file-search-store.js +1 -0
- package/models/index.d.ts +3 -1
- package/models/index.js +3 -1
- package/models/repositories.d.ts +20 -30
- package/models/user.d.ts +8 -1
- package/package.json +1 -1
- package/mappers/orgnode-to-note.d.ts +0 -3
- package/models/note.d.ts +0 -40
- /package/models/{note.js → file-meta-store.js} +0 -0
package/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InlineEmbeddedWidget, MultilineEmbeddedWidget, OrgLineClass, SyncStoreDefinition, FileReaderStoreDefinition, CommandsStoreDefinition, CommandsGroupStoreDefinition, ModalStoreDefinition, SettingsStoreDefinition, SettingsUiStoreDefinition, MultipleUploadParams, UploadParams, CompletionStoreDefinition, PaneStoreDefinition, LayoutStoreDefinition, FileManagerStoreDefinition, UseScreenDetection, NotificationsStoreDefinition, BufferStoreDefinition, Repositories, LogStoreDefinition, UseSystemInfo, ContextMenuStoreDefinition, QueueStoreDefinition, FileGuardStoreDefinition, FileWatcherStoreDefinition, BuildOrgNoteUrl, AuthStoreDefinition } from './models/index.js';
|
|
1
|
+
import { InlineEmbeddedWidget, MultilineEmbeddedWidget, OrgLineClass, SyncStoreDefinition, FileReaderStoreDefinition, CommandsStoreDefinition, CommandsGroupStoreDefinition, ModalStoreDefinition, SettingsStoreDefinition, SettingsUiStoreDefinition, MultipleUploadParams, UploadParams, CompletionStoreDefinition, PaneStoreDefinition, LayoutStoreDefinition, FileManagerStoreDefinition, UseScreenDetection, NotificationsStoreDefinition, BufferStoreDefinition, Repositories, LogStoreDefinition, UseSystemInfo, ContextMenuStoreDefinition, QueueStoreDefinition, FileGuardStoreDefinition, FileWatcherStoreDefinition, BuildOrgNoteUrl, AuthStoreDefinition, FileSearchStoreDefinition, FileMetaStoreDefinition } from './models/index.js';
|
|
2
2
|
import { WebSocketClient } from './websocket/client.js';
|
|
3
3
|
import { WidgetType } from './models/widget-type.js';
|
|
4
4
|
import { NodeType } from 'org-mode-ast';
|
|
@@ -72,6 +72,8 @@ export interface OrgNoteApi {
|
|
|
72
72
|
useSync: SyncStoreDefinition;
|
|
73
73
|
useEditor: EditorStoreDefinition;
|
|
74
74
|
useBabel: BabelStoreDefinition;
|
|
75
|
+
useFileSearch: FileSearchStoreDefinition;
|
|
76
|
+
useFileMeta: FileMetaStoreDefinition;
|
|
75
77
|
app: App;
|
|
76
78
|
};
|
|
77
79
|
utils: {
|
package/constants/i18n-keys.d.ts
CHANGED
|
@@ -155,7 +155,9 @@ export declare enum i18n {
|
|
|
155
155
|
AUTH_GROUP = "auth",
|
|
156
156
|
TABS_COUNT = "tabsCount",
|
|
157
157
|
TOC_NO_ACTIVE_DOCUMENT = "no active document",
|
|
158
|
-
TOC_NO_HEADLINES_FOUND = "no headlines found"
|
|
158
|
+
TOC_NO_HEADLINES_FOUND = "no headlines found",
|
|
159
|
+
PICK_NOTE_TO_LINK = "pick note to link",
|
|
160
|
+
UNTITLED = "untitled"
|
|
159
161
|
}
|
|
160
162
|
export declare const I18N: {
|
|
161
163
|
REPORT_BUG: DefaultCommands.REPORT_BUG;
|
|
@@ -243,6 +245,30 @@ export declare const I18N: {
|
|
|
243
245
|
LOGIN: DefaultCommands.LOGIN;
|
|
244
246
|
LOGOUT: DefaultCommands.LOGOUT;
|
|
245
247
|
REMOVE_ACCOUNT: DefaultCommands.REMOVE_ACCOUNT;
|
|
248
|
+
INIT_SEARCH_INDEX: DefaultCommands.INIT_SEARCH_INDEX;
|
|
249
|
+
EDITOR_UNDO: DefaultCommands.EDITOR_UNDO;
|
|
250
|
+
EDITOR_REDO: DefaultCommands.EDITOR_REDO;
|
|
251
|
+
EDITOR_INSERT_HEADLINE: DefaultCommands.EDITOR_INSERT_HEADLINE;
|
|
252
|
+
EDITOR_INSERT_CODE_BLOCK: DefaultCommands.EDITOR_INSERT_CODE_BLOCK;
|
|
253
|
+
EDITOR_INSERT_QUOTE: DefaultCommands.EDITOR_INSERT_QUOTE;
|
|
254
|
+
EDITOR_INSERT_LATEX: DefaultCommands.EDITOR_INSERT_LATEX;
|
|
255
|
+
EDITOR_INSERT_LINK: DefaultCommands.EDITOR_INSERT_LINK;
|
|
256
|
+
EDITOR_INSERT_INTERNAL_LINK: DefaultCommands.EDITOR_INSERT_INTERNAL_LINK;
|
|
257
|
+
EDITOR_INSERT_IMAGE: DefaultCommands.EDITOR_INSERT_IMAGE;
|
|
258
|
+
EDITOR_INSERT_BOLD: DefaultCommands.EDITOR_INSERT_BOLD;
|
|
259
|
+
EDITOR_INSERT_ITALIC: DefaultCommands.EDITOR_INSERT_ITALIC;
|
|
260
|
+
EDITOR_INSERT_STRIKETHROUGH: DefaultCommands.EDITOR_INSERT_STRIKETHROUGH;
|
|
261
|
+
EDITOR_INSERT_INLINE_CODE: DefaultCommands.EDITOR_INSERT_INLINE_CODE;
|
|
262
|
+
EDITOR_INSERT_BULLET_LIST: DefaultCommands.EDITOR_INSERT_BULLET_LIST;
|
|
263
|
+
EDITOR_INSERT_NUMERIC_LIST: DefaultCommands.EDITOR_INSERT_NUMERIC_LIST;
|
|
264
|
+
EDITOR_INSERT_CHECK_LIST: DefaultCommands.EDITOR_INSERT_CHECK_LIST;
|
|
265
|
+
EDITOR_INSERT_HORIZONTAL_RULE: DefaultCommands.EDITOR_INSERT_HORIZONTAL_RULE;
|
|
266
|
+
EDITOR_INSERT_HTML_BLOCK: DefaultCommands.EDITOR_INSERT_HTML_BLOCK;
|
|
267
|
+
EDITOR_INSERT_CHECKBOX: DefaultCommands.EDITOR_INSERT_CHECKBOX;
|
|
268
|
+
EDITOR_INSERT_TABLE: DefaultCommands.EDITOR_INSERT_TABLE;
|
|
269
|
+
EDITOR_INSERT_TAG: DefaultCommands.EDITOR_INSERT_TAG;
|
|
270
|
+
EDITOR_INSERT_DATETIME: DefaultCommands.EDITOR_INSERT_DATETIME;
|
|
271
|
+
EDITOR_HIDE_KEYBOARD: DefaultCommands.EDITOR_HIDE_KEYBOARD;
|
|
246
272
|
LOADING: i18n.LOADING;
|
|
247
273
|
LOADING_MESSAGE_1: i18n.LOADING_MESSAGE_1;
|
|
248
274
|
LOADING_MESSAGE_2: i18n.LOADING_MESSAGE_2;
|
|
@@ -391,5 +417,7 @@ export declare const I18N: {
|
|
|
391
417
|
TABS_COUNT: i18n.TABS_COUNT;
|
|
392
418
|
TOC_NO_ACTIVE_DOCUMENT: i18n.TOC_NO_ACTIVE_DOCUMENT;
|
|
393
419
|
TOC_NO_HEADLINES_FOUND: i18n.TOC_NO_HEADLINES_FOUND;
|
|
420
|
+
PICK_NOTE_TO_LINK: i18n.PICK_NOTE_TO_LINK;
|
|
421
|
+
UNTITLED: i18n.UNTITLED;
|
|
394
422
|
};
|
|
395
423
|
export type I18N = i18n | DefaultCommands;
|
package/constants/i18n-keys.js
CHANGED
|
@@ -165,6 +165,9 @@ export var i18n;
|
|
|
165
165
|
// TOC
|
|
166
166
|
i18n["TOC_NO_ACTIVE_DOCUMENT"] = "no active document";
|
|
167
167
|
i18n["TOC_NO_HEADLINES_FOUND"] = "no headlines found";
|
|
168
|
+
// Editor
|
|
169
|
+
i18n["PICK_NOTE_TO_LINK"] = "pick note to link";
|
|
170
|
+
i18n["UNTITLED"] = "untitled";
|
|
168
171
|
})(i18n || (i18n = {}));
|
|
169
172
|
export const I18N = {
|
|
170
173
|
...i18n,
|
|
@@ -8,13 +8,6 @@ const testNote = {
|
|
|
8
8
|
title: 'Test note',
|
|
9
9
|
published: false,
|
|
10
10
|
},
|
|
11
|
-
createdAt: '2024-01-01T00:00:00.000Z',
|
|
12
|
-
updatedAt: '2024-01-01T00:00:00.000Z',
|
|
13
|
-
touchedAt: '2024-01-01T00:00:00.000Z',
|
|
14
|
-
filePath: ['/test/note.org'],
|
|
15
|
-
isMy: true,
|
|
16
|
-
bookmarked: false,
|
|
17
|
-
encrypted: false,
|
|
18
11
|
};
|
|
19
12
|
test('Should encrypt note via keys', async () => {
|
|
20
13
|
const noteText = '#+title: Test note\n\nBody text';
|
|
@@ -27,9 +20,7 @@ test('Should encrypt note via keys', async () => {
|
|
|
27
20
|
format: 'armored',
|
|
28
21
|
});
|
|
29
22
|
expect(encryptedNoteText.startsWith('-----BEGIN PGP MESSAGE-----')).toBe(true);
|
|
30
|
-
expect(encryptedNote.encrypted).toBe(true);
|
|
31
23
|
expect(encryptedNote.id).toBe(testNote.id);
|
|
32
|
-
expect(encryptedNote.meta.id).toBeUndefined();
|
|
33
24
|
});
|
|
34
25
|
test('Should decrypt note via keys', async () => {
|
|
35
26
|
const noteText = '#+title: Test note\n\nBody text';
|
|
@@ -41,15 +32,14 @@ test('Should decrypt note via keys', async () => {
|
|
|
41
32
|
privateKeyPassphrase,
|
|
42
33
|
format: 'armored',
|
|
43
34
|
});
|
|
44
|
-
const [decryptedNote, decryptedText] = await decryptNote(
|
|
35
|
+
const [decryptedNote, decryptedText] = await decryptNote(testNote, {
|
|
45
36
|
content: encryptedNoteText,
|
|
46
37
|
type: EncryptionType.GpgKeys,
|
|
47
38
|
publicKey: armoredPublicKey,
|
|
48
39
|
privateKey: armoredPrivateKey,
|
|
49
40
|
privateKeyPassphrase,
|
|
50
41
|
});
|
|
51
|
-
expect(decryptedNote.encrypted).toBe(false);
|
|
52
42
|
expect(decryptedNote.id).toBe(testNote.id);
|
|
53
|
-
expect(decryptedNote.meta
|
|
43
|
+
expect(decryptedNote.meta?.title).toBe('Test note');
|
|
54
44
|
expect(decryptedText).toBe(noteText);
|
|
55
45
|
});
|
package/mappers/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './orgnode-to-
|
|
1
|
+
export * from './orgnode-to-file-meta.js';
|
package/mappers/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./orgnode-to-
|
|
1
|
+
export * from "./orgnode-to-file-meta.js";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { splitPath } from "../utils/index.js";
|
|
2
|
-
export function
|
|
2
|
+
export function orgnodeToFileMeta(orgnode, fileInfo) {
|
|
3
3
|
return {
|
|
4
|
-
id: orgnode.meta.id,
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
id: orgnode.meta.id ?? '',
|
|
5
|
+
title: orgnode.meta.title,
|
|
6
|
+
description: orgnode.meta.description,
|
|
7
|
+
tags: orgnode.meta.fileTags,
|
|
7
8
|
filePath: splitPath(fileInfo.path),
|
|
8
9
|
touchedAt: fileInfo.atime && new Date(fileInfo.atime).toISOString(),
|
|
9
10
|
updatedAt: new Date(Math.max(fileInfo.mtime, fileInfo.ctime)).toISOString(),
|
|
@@ -83,5 +83,29 @@ export declare enum DefaultCommands {
|
|
|
83
83
|
OPEN_EXTENSIONS_MANAGER = "open extensions manager",
|
|
84
84
|
LOGIN = "login",
|
|
85
85
|
LOGOUT = "logout",
|
|
86
|
-
REMOVE_ACCOUNT = "remove account"
|
|
86
|
+
REMOVE_ACCOUNT = "remove account",
|
|
87
|
+
INIT_SEARCH_INDEX = "init search index",
|
|
88
|
+
EDITOR_UNDO = "undo",
|
|
89
|
+
EDITOR_REDO = "redo",
|
|
90
|
+
EDITOR_INSERT_HEADLINE = "insert headline",
|
|
91
|
+
EDITOR_INSERT_CODE_BLOCK = "insert code block",
|
|
92
|
+
EDITOR_INSERT_QUOTE = "insert quote",
|
|
93
|
+
EDITOR_INSERT_LATEX = "insert latex block",
|
|
94
|
+
EDITOR_INSERT_LINK = "insert link",
|
|
95
|
+
EDITOR_INSERT_INTERNAL_LINK = "insert internal link",
|
|
96
|
+
EDITOR_INSERT_IMAGE = "insert image",
|
|
97
|
+
EDITOR_INSERT_BOLD = "insert bold",
|
|
98
|
+
EDITOR_INSERT_ITALIC = "insert italic",
|
|
99
|
+
EDITOR_INSERT_STRIKETHROUGH = "insert strikethrough",
|
|
100
|
+
EDITOR_INSERT_INLINE_CODE = "insert inline code",
|
|
101
|
+
EDITOR_INSERT_BULLET_LIST = "insert bullet list",
|
|
102
|
+
EDITOR_INSERT_NUMERIC_LIST = "insert numeric list",
|
|
103
|
+
EDITOR_INSERT_CHECK_LIST = "insert check list",
|
|
104
|
+
EDITOR_INSERT_HORIZONTAL_RULE = "insert horizontal rule",
|
|
105
|
+
EDITOR_INSERT_HTML_BLOCK = "insert html block",
|
|
106
|
+
EDITOR_INSERT_CHECKBOX = "insert checkbox",
|
|
107
|
+
EDITOR_INSERT_TABLE = "insert table",
|
|
108
|
+
EDITOR_INSERT_TAG = "insert tag",
|
|
109
|
+
EDITOR_INSERT_DATETIME = "insert datetime",
|
|
110
|
+
EDITOR_HIDE_KEYBOARD = "hide keyboard"
|
|
87
111
|
}
|
|
@@ -105,4 +105,30 @@ export var DefaultCommands;
|
|
|
105
105
|
DefaultCommands["LOGIN"] = "login";
|
|
106
106
|
DefaultCommands["LOGOUT"] = "logout";
|
|
107
107
|
DefaultCommands["REMOVE_ACCOUNT"] = "remove account";
|
|
108
|
+
// Search
|
|
109
|
+
DefaultCommands["INIT_SEARCH_INDEX"] = "init search index";
|
|
110
|
+
// Editor commands
|
|
111
|
+
DefaultCommands["EDITOR_UNDO"] = "undo";
|
|
112
|
+
DefaultCommands["EDITOR_REDO"] = "redo";
|
|
113
|
+
DefaultCommands["EDITOR_INSERT_HEADLINE"] = "insert headline";
|
|
114
|
+
DefaultCommands["EDITOR_INSERT_CODE_BLOCK"] = "insert code block";
|
|
115
|
+
DefaultCommands["EDITOR_INSERT_QUOTE"] = "insert quote";
|
|
116
|
+
DefaultCommands["EDITOR_INSERT_LATEX"] = "insert latex block";
|
|
117
|
+
DefaultCommands["EDITOR_INSERT_LINK"] = "insert link";
|
|
118
|
+
DefaultCommands["EDITOR_INSERT_INTERNAL_LINK"] = "insert internal link";
|
|
119
|
+
DefaultCommands["EDITOR_INSERT_IMAGE"] = "insert image";
|
|
120
|
+
DefaultCommands["EDITOR_INSERT_BOLD"] = "insert bold";
|
|
121
|
+
DefaultCommands["EDITOR_INSERT_ITALIC"] = "insert italic";
|
|
122
|
+
DefaultCommands["EDITOR_INSERT_STRIKETHROUGH"] = "insert strikethrough";
|
|
123
|
+
DefaultCommands["EDITOR_INSERT_INLINE_CODE"] = "insert inline code";
|
|
124
|
+
DefaultCommands["EDITOR_INSERT_BULLET_LIST"] = "insert bullet list";
|
|
125
|
+
DefaultCommands["EDITOR_INSERT_NUMERIC_LIST"] = "insert numeric list";
|
|
126
|
+
DefaultCommands["EDITOR_INSERT_CHECK_LIST"] = "insert check list";
|
|
127
|
+
DefaultCommands["EDITOR_INSERT_HORIZONTAL_RULE"] = "insert horizontal rule";
|
|
128
|
+
DefaultCommands["EDITOR_INSERT_HTML_BLOCK"] = "insert html block";
|
|
129
|
+
DefaultCommands["EDITOR_INSERT_CHECKBOX"] = "insert checkbox";
|
|
130
|
+
DefaultCommands["EDITOR_INSERT_TABLE"] = "insert table";
|
|
131
|
+
DefaultCommands["EDITOR_INSERT_TAG"] = "insert tag";
|
|
132
|
+
DefaultCommands["EDITOR_INSERT_DATETIME"] = "insert datetime";
|
|
133
|
+
DefaultCommands["EDITOR_HIDE_KEYBOARD"] = "hide keyboard";
|
|
108
134
|
})(DefaultCommands || (DefaultCommands = {}));
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { BaseOrgNoteEncryption, OrgNoteEncryption, BaseOrgNoteDecryption } from './encryption.js';
|
|
2
|
-
import { NoteInfo } from './note.js';
|
|
3
2
|
import { StoreDefinition } from './store.js';
|
|
4
3
|
export interface EncryptionStore {
|
|
5
4
|
encrypt: (text: string, format?: BaseOrgNoteEncryption['format'], encryptionConfig?: OrgNoteEncryption) => Promise<string>;
|
|
6
5
|
decrypt: (content: string | Uint8Array, format?: BaseOrgNoteDecryption['format'], encryptionConfig?: OrgNoteEncryption) => Promise<string>;
|
|
7
|
-
encryptNote: (noteInfo: NoteInfo, noteText: string) => Promise<[NoteInfo, string]>;
|
|
8
|
-
decryptNote: (noteInfo: NoteInfo, noteText: string) => Promise<[NoteInfo, string | Uint8Array]>;
|
|
9
6
|
}
|
|
10
7
|
export type EncryptionStoreDefinition = StoreDefinition<EncryptionStore>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FileMeta } from './file-meta.js';
|
|
2
|
+
import type { StoreDefinition } from './store.js';
|
|
3
|
+
export interface FileMetaStore {
|
|
4
|
+
getById(id: string): Promise<FileMeta | undefined>;
|
|
5
|
+
getByIds(ids: string[]): Promise<FileMeta[]>;
|
|
6
|
+
getByPath(filePath: string[]): Promise<FileMeta | undefined>;
|
|
7
|
+
getAll(options?: {
|
|
8
|
+
limit?: number;
|
|
9
|
+
offset?: number;
|
|
10
|
+
tags?: string[];
|
|
11
|
+
}): Promise<FileMeta[]>;
|
|
12
|
+
count(tags?: string[]): Promise<number>;
|
|
13
|
+
getTagsStats(): Promise<{
|
|
14
|
+
tag: string;
|
|
15
|
+
count: number;
|
|
16
|
+
}[]>;
|
|
17
|
+
save(meta: FileMeta): Promise<void>;
|
|
18
|
+
saveBulk(metas: FileMeta[]): Promise<void>;
|
|
19
|
+
delete(target: {
|
|
20
|
+
id: string;
|
|
21
|
+
} | {
|
|
22
|
+
path: string[];
|
|
23
|
+
}): Promise<void>;
|
|
24
|
+
clear(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export type FileMetaStoreDefinition = StoreDefinition<FileMetaStore>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface FileMetaFilter {
|
|
2
|
+
limit?: number;
|
|
3
|
+
offset?: number;
|
|
4
|
+
tags?: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface FileMeta {
|
|
7
|
+
id: string;
|
|
8
|
+
filePath: string[];
|
|
9
|
+
title?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
tags?: string[];
|
|
12
|
+
links?: string[];
|
|
13
|
+
backlinks?: string[];
|
|
14
|
+
createdAt?: string;
|
|
15
|
+
updatedAt?: string;
|
|
16
|
+
touchedAt?: string;
|
|
17
|
+
deletedAt?: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Ref, ComputedRef } from 'vue';
|
|
2
|
+
import type { FileMeta } from './file-meta.js';
|
|
3
|
+
import type { StoreDefinition } from './store.js';
|
|
4
|
+
export interface FileSearchResult {
|
|
5
|
+
files: FileMeta[];
|
|
6
|
+
total: number;
|
|
7
|
+
query: string;
|
|
8
|
+
searchedAt: number;
|
|
9
|
+
}
|
|
10
|
+
export interface FileIndexStats {
|
|
11
|
+
indexed: number;
|
|
12
|
+
total: number;
|
|
13
|
+
}
|
|
14
|
+
export interface FileSearchStore {
|
|
15
|
+
isSearching: Ref<boolean>;
|
|
16
|
+
isIndexing: Ref<boolean>;
|
|
17
|
+
lastSearchResult: Ref<FileSearchResult | null>;
|
|
18
|
+
indexStats: ComputedRef<FileIndexStats>;
|
|
19
|
+
search(query: string, options?: {
|
|
20
|
+
limit?: number;
|
|
21
|
+
offset?: number;
|
|
22
|
+
}): Promise<FileMeta[]>;
|
|
23
|
+
indexFile(filePath: string): Promise<void>;
|
|
24
|
+
indexFiles(): Promise<void>;
|
|
25
|
+
processFile(filePath: string): Promise<void>;
|
|
26
|
+
removeFile(target: {
|
|
27
|
+
id: string;
|
|
28
|
+
} | {
|
|
29
|
+
path: string[];
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
loadIndex(): Promise<boolean>;
|
|
32
|
+
saveIndex(): Promise<void>;
|
|
33
|
+
clearIndex(): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export type FileSearchStoreDefinition = StoreDefinition<FileSearchStore>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/models/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './file-meta.js';
|
|
2
2
|
export * from './command.js';
|
|
3
3
|
export * from './completion.js';
|
|
4
4
|
export * from './extension.js';
|
|
@@ -76,6 +76,8 @@ export * from './cron-store.js';
|
|
|
76
76
|
export * from './git-store.js';
|
|
77
77
|
export * from './extension-registry-store.js';
|
|
78
78
|
export * from './theme-store.js';
|
|
79
|
+
export * from './file-search-store.js';
|
|
80
|
+
export * from './file-meta-store.js';
|
|
79
81
|
export * from './style-variant.js';
|
|
80
82
|
export * from './style-size.js';
|
|
81
83
|
export * from './repositories.js';
|
package/models/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./file-meta.js";
|
|
2
2
|
export * from "./command.js";
|
|
3
3
|
export * from "./completion.js";
|
|
4
4
|
export * from "./extension.js";
|
|
@@ -78,6 +78,8 @@ export * from "./cron-store.js";
|
|
|
78
78
|
export * from "./git-store.js";
|
|
79
79
|
export * from "./extension-registry-store.js";
|
|
80
80
|
export * from "./theme-store.js";
|
|
81
|
+
export * from "./file-search-store.js";
|
|
82
|
+
export * from "./file-meta-store.js";
|
|
81
83
|
// UI
|
|
82
84
|
export * from "./style-variant.js";
|
|
83
85
|
export * from "./style-size.js";
|
package/models/repositories.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ExtensionSource } from './extension.js';
|
|
2
|
-
import {
|
|
2
|
+
import { FileMeta } from './file-meta.js';
|
|
3
3
|
import { LayoutSnapshotRepository } from './layout-snapshot-repository.js';
|
|
4
4
|
import { LoggerRepository } from './log-repository.js';
|
|
5
|
-
import { NoteInfo } from './note.js';
|
|
6
5
|
import { QueueTask } from './queue-task.js';
|
|
7
6
|
export interface ExtensionSourceRepository {
|
|
8
7
|
get(extensionName: string): Promise<ExtensionSource | undefined>;
|
|
@@ -14,39 +13,23 @@ export interface ExtensionSourceRepository {
|
|
|
14
13
|
deleteBySource(source: string): Promise<void>;
|
|
15
14
|
clear(): Promise<void>;
|
|
16
15
|
}
|
|
17
|
-
export interface
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
getById(id: string): Promise<NoteInfo | undefined>;
|
|
23
|
-
getByPath(path: string[]): Promise<NoteInfo | undefined>;
|
|
24
|
-
getNotesInfo(options?: {
|
|
16
|
+
export interface FileRepository {
|
|
17
|
+
getById(id: string): Promise<FileMeta | undefined>;
|
|
18
|
+
getByIds(ids: string[]): Promise<FileMeta[]>;
|
|
19
|
+
getByPath(filePath: string[]): Promise<FileMeta | undefined>;
|
|
20
|
+
getAll(options?: {
|
|
25
21
|
limit?: number;
|
|
26
22
|
offset?: number;
|
|
27
|
-
searchText?: string;
|
|
28
23
|
tags?: string[];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
changes: Partial<NoteInfo>;
|
|
36
|
-
}[]): Promise<void>;
|
|
37
|
-
count(searchText?: string, tags?: string[]): Promise<number>;
|
|
38
|
-
getFilePaths(): Promise<FilePathInfo[]>;
|
|
39
|
-
touchNote(noteId: string): Promise<void>;
|
|
40
|
-
getTagsStatistic(): Promise<{
|
|
24
|
+
}): Promise<FileMeta[]>;
|
|
25
|
+
save(meta: FileMeta): Promise<void>;
|
|
26
|
+
saveBulk(metas: FileMeta[]): Promise<void>;
|
|
27
|
+
delete(id: string): Promise<void>;
|
|
28
|
+
count(tags?: string[]): Promise<number>;
|
|
29
|
+
getTagsStats(): Promise<{
|
|
41
30
|
tag: string;
|
|
42
31
|
count: number;
|
|
43
32
|
}[]>;
|
|
44
|
-
addBookmark(noteId: string): Promise<void>;
|
|
45
|
-
deleteBookmark(noteId: string): Promise<void>;
|
|
46
|
-
modify(modifyCallback: (note: NoteInfo, ref: {
|
|
47
|
-
value: NoteInfo;
|
|
48
|
-
}) => void): Promise<void>;
|
|
49
|
-
getIds(filterCb?: (n: NoteInfo) => boolean): Promise<string[]>;
|
|
50
33
|
clear(): Promise<void>;
|
|
51
34
|
}
|
|
52
35
|
export interface QueueRepository {
|
|
@@ -66,10 +49,17 @@ export interface QueueRepository {
|
|
|
66
49
|
clear(queueId: string): Promise<void>;
|
|
67
50
|
setStatus: (id: string, status: string) => Promise<void>;
|
|
68
51
|
}
|
|
52
|
+
export interface KeyValueRepository {
|
|
53
|
+
get(key: string): Promise<string | undefined>;
|
|
54
|
+
set(key: string, value: string): Promise<void>;
|
|
55
|
+
delete(key: string): Promise<void>;
|
|
56
|
+
clear(): Promise<void>;
|
|
57
|
+
}
|
|
69
58
|
export interface Repositories {
|
|
70
59
|
logRepository: LoggerRepository;
|
|
71
|
-
noteInfoRepository: NoteInfoRepository;
|
|
72
60
|
layoutSnapshotRepository: LayoutSnapshotRepository;
|
|
73
61
|
queueRepository: QueueRepository;
|
|
74
62
|
extensionSourceRepository: ExtensionSourceRepository;
|
|
63
|
+
keyValueRepository: KeyValueRepository;
|
|
64
|
+
fileRepository: FileRepository;
|
|
75
65
|
}
|
package/models/user.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { ModelsUserPersonalInfo } from "../remote-api/index.js";
|
|
2
|
-
|
|
2
|
+
export interface PublicUser {
|
|
3
|
+
id?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
nickName?: string;
|
|
6
|
+
avatarUrl?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
profileUrl?: string;
|
|
9
|
+
}
|
|
3
10
|
export type User = PublicUser;
|
|
4
11
|
export type PersonalInfo = ModelsUserPersonalInfo;
|
package/package.json
CHANGED
package/models/note.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { EncryptionType } from './encryption.js';
|
|
2
|
-
export interface NotesFilter {
|
|
3
|
-
searchText?: string;
|
|
4
|
-
userId?: string;
|
|
5
|
-
limit?: number;
|
|
6
|
-
offset?: number;
|
|
7
|
-
}
|
|
8
|
-
export interface NoteMeta {
|
|
9
|
-
id?: string;
|
|
10
|
-
title?: string;
|
|
11
|
-
description?: string;
|
|
12
|
-
fileTags?: string[];
|
|
13
|
-
previewImg?: string;
|
|
14
|
-
published?: boolean;
|
|
15
|
-
startup?: string;
|
|
16
|
-
images?: string[];
|
|
17
|
-
connectedNotes?: Record<string, string>;
|
|
18
|
-
}
|
|
19
|
-
export interface PublicUser {
|
|
20
|
-
id?: string;
|
|
21
|
-
name?: string;
|
|
22
|
-
nickName?: string;
|
|
23
|
-
avatarUrl?: string;
|
|
24
|
-
email?: string;
|
|
25
|
-
profileUrl?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface NoteInfo {
|
|
28
|
-
id?: string;
|
|
29
|
-
meta: NoteMeta;
|
|
30
|
-
createdAt?: string;
|
|
31
|
-
encryptionType?: EncryptionType;
|
|
32
|
-
updatedAt?: string;
|
|
33
|
-
touchedAt?: string;
|
|
34
|
-
deletedAt?: string;
|
|
35
|
-
filePath?: string[];
|
|
36
|
-
isMy?: boolean;
|
|
37
|
-
author?: PublicUser;
|
|
38
|
-
bookmarked?: boolean;
|
|
39
|
-
encrypted?: boolean;
|
|
40
|
-
}
|
|
File without changes
|