yanki 2.0.4 → 2.0.5
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/dist/bin/cli.js +915 -94
- package/dist/lib/index.d.ts +39 -11
- package/dist/lib/index.js +180 -100
- package/dist/standalone/index.d.ts +73 -35
- package/dist/standalone/index.js +861 -87
- package/package.json +18 -17
- package/readme.md +10 -39
- package/dist/.DS_Store +0 -0
package/dist/lib/index.d.ts
CHANGED
|
@@ -82,20 +82,32 @@ type GlobalOptions = {
|
|
|
82
82
|
* invoke a sync to AnkiWeb. This is the equivalent of pushing the "sync"
|
|
83
83
|
* button in the Anki app.
|
|
84
84
|
*/
|
|
85
|
-
ankiWeb: boolean;
|
|
86
|
-
|
|
85
|
+
ankiWeb: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Override where "/" should resolve to... useful in Obsidian to set the vault
|
|
88
|
+
* path as the "root"
|
|
89
|
+
*/
|
|
90
|
+
basePath: string | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Run Anki's "Check Database" command after sync updates that might produce
|
|
93
|
+
* card corruption
|
|
94
|
+
*/
|
|
87
95
|
checkDatabase: boolean;
|
|
88
96
|
cwd: string;
|
|
89
97
|
dryRun: boolean;
|
|
90
98
|
/**
|
|
91
99
|
* Exposed for Obsidian, currently only used for getting URL content hashes
|
|
92
|
-
* and inferring MIME types of URLs without extensions.
|
|
93
|
-
*
|
|
94
|
-
*
|
|
100
|
+
* and inferring MIME types of URLs without extensions. Note that
|
|
101
|
+
* ankiConnectOptions ALSO has a fetch adapter option specifically for
|
|
102
|
+
* communicating with Anki-Connect.
|
|
95
103
|
*/
|
|
96
104
|
fetchAdapter: FetchAdapter | undefined;
|
|
97
105
|
fileAdapter: FileAdapter | undefined;
|
|
98
|
-
manageFilenames: ManageFilenames;
|
|
106
|
+
manageFilenames: ManageFilenames;
|
|
107
|
+
/**
|
|
108
|
+
* Only applies if manageFilenames is `true`. Will _not_ truncate
|
|
109
|
+
* user-specified file names in other cases.
|
|
110
|
+
*/
|
|
99
111
|
maxFilenameLength: number;
|
|
100
112
|
namespace: string; /** Ensures that wiki-style links work correctly */
|
|
101
113
|
obsidianVault: string | undefined; /** Exposed for testing only */
|
|
@@ -104,7 +116,12 @@ type GlobalOptions = {
|
|
|
104
116
|
* Whether to treat single newlines in Markdown as line breaks in the
|
|
105
117
|
* resulting HTML (Obsidian has an application-level setting for this)
|
|
106
118
|
*/
|
|
107
|
-
strictLineBreaks: boolean;
|
|
119
|
+
strictLineBreaks: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Only consider exact noteId matches between the local and remote copies to
|
|
122
|
+
* be equivalent, don't match local notes with "orphaned" remote notes based
|
|
123
|
+
* on content
|
|
124
|
+
*/
|
|
108
125
|
strictMatching: boolean; /** Sync image, video, and audio assets to Anki's media storage system */
|
|
109
126
|
syncMediaAssets: SyncMediaAssets;
|
|
110
127
|
};
|
|
@@ -122,8 +139,10 @@ type CleanResult = Simplify<Pick<GlobalOptions, 'ankiWeb' | 'dryRun' | 'namespac
|
|
|
122
139
|
* Deletes all remote notes in Anki associated with the given namespace.
|
|
123
140
|
*
|
|
124
141
|
* Use with significant caution. Mostly useful for testing.
|
|
142
|
+
*
|
|
125
143
|
* @returns The IDs of the notes that were deleted
|
|
126
|
-
* @throws {Error} If Anki is unreachable or another error occurs during
|
|
144
|
+
* @throws {Error} If Anki is unreachable or another error occurs during
|
|
145
|
+
* deletion.
|
|
127
146
|
*/
|
|
128
147
|
declare function cleanNotes(options?: PartialDeep<CleanOptions>): Promise<CleanResult>;
|
|
129
148
|
declare function formatCleanResult(result: CleanResult, verbose?: boolean): string;
|
|
@@ -152,7 +171,12 @@ type LocalNote = {
|
|
|
152
171
|
};
|
|
153
172
|
//#endregion
|
|
154
173
|
//#region src/lib/actions/rename.d.ts
|
|
155
|
-
type RenameNotesOptions = Pick<GlobalOptions, 'dryRun' | 'fileAdapter' | 'manageFilenames' | 'maxFilenameLength'
|
|
174
|
+
type RenameNotesOptions = Pick<GlobalOptions, 'dryRun' | 'fileAdapter' | 'manageFilenames' | 'maxFilenameLength'
|
|
175
|
+
/**
|
|
176
|
+
* Included because this can technically change the content of the "first
|
|
177
|
+
* line" of a card
|
|
178
|
+
*/
|
|
179
|
+
| 'strictLineBreaks'>;
|
|
156
180
|
type RenameFilesResult = {
|
|
157
181
|
dryRun: boolean;
|
|
158
182
|
notes: LocalNote[];
|
|
@@ -199,9 +223,11 @@ type SyncNotesResult = Simplify<Pick<GlobalOptions, 'ankiWeb' | 'dryRun' | 'name
|
|
|
199
223
|
}>;
|
|
200
224
|
/**
|
|
201
225
|
* Syncs local notes to Anki.
|
|
226
|
+
*
|
|
202
227
|
* @param allLocalNotes All the YankiNotes to sync
|
|
228
|
+
*
|
|
203
229
|
* @returns The synced notes (with new IDs where applicable), plus some stats
|
|
204
|
-
*
|
|
230
|
+
* about the sync
|
|
205
231
|
* @throws {Error} For various reasons...
|
|
206
232
|
*/
|
|
207
233
|
declare function syncNotes(allLocalNotes: YankiNote[], options?: PartialDeep<SyncNotesOptions>): Promise<SyncNotesResult>;
|
|
@@ -223,9 +249,11 @@ type SyncFilesResult = Simplify<Omit<SyncNotesResult, 'synced'> & {
|
|
|
223
249
|
*
|
|
224
250
|
* Most importantly, it updates the note IDs in the frontmatter of the local
|
|
225
251
|
* files.
|
|
252
|
+
*
|
|
226
253
|
* @param allLocalFilePaths Array of paths to the local markdown files
|
|
254
|
+
*
|
|
227
255
|
* @returns The synced files (with new IDs where applicable), plus some stats
|
|
228
|
-
*
|
|
256
|
+
* about the sync
|
|
229
257
|
* @throws {Error} If syncing fails or file operations encounter an error.
|
|
230
258
|
*/
|
|
231
259
|
declare function syncFiles(allLocalFilePaths: string[], options?: PartialDeep<SyncFilesOptions>): Promise<SyncFilesResult>;
|