(noteId?: NoteId, nook?: NookId)
| 255 | ) |
| 256 | }, |
| 257 | async getNewNotesToUpload(noteId?: NoteId, nook?: NookId) { |
| 258 | const remoteTemplates = await ky |
| 259 | .selectFrom('remoteTemplate') |
| 260 | .selectAll() |
| 261 | .execute() |
| 262 | const notesAndStuff = await this.getNewNotesToUploadDom(noteId) |
| 263 | return await Promise.all( |
| 264 | notesAndStuff |
| 265 | .map(([, note]) => { |
| 266 | const remoteIds = objKeys(note.remotes) |
| 267 | .map((remoteNook) => { |
| 268 | if (nook != null && remoteNook !== nook) return null |
| 269 | const rt = |
| 270 | remoteTemplates.find( |
| 271 | (rt) => |
| 272 | rt.localId === note.templateId && remoteNook === rt.nook, |
| 273 | ) ?? |
| 274 | C.toastImpossible( |
| 275 | `No template found for id '${note.templateId}' with nook '${remoteNook}'.`, |
| 276 | ) |
| 277 | return fromLDbId<RemoteTemplateId | null>(rt.remoteId) |
| 278 | }) |
| 279 | .filter(notEmpty) |
| 280 | return domainToCreateRemote(note, remoteIds) |
| 281 | }) |
| 282 | .map(async (n) => await remotifyNote(n).then((x) => x.note)), |
| 283 | ) |
| 284 | }, |
| 285 | async getNewNotesToUploadDom(noteId?: NoteId) { |
| 286 | const remoteNotes = await ky |
| 287 | .selectFrom('remoteNote') |
nothing calls this directly
no test coverage detected