// Offline desktop implementation of the repository seam: maps each operation to a // Tauri command backed by the on-device SQLite store (desktop/src-tauri/src/local). // Selected by index.ts when running inside the desktop shell with no server. // // Argument keys are camelCase; Tauri converts them to the Rust commands' snake_case // parameters (e.g. labelIds -> label_ids). A few operations have no offline meaning // yet (account auth, device linking, attachment upload, URL unfurl, file import) — // those reject with a clear message rather than silently failing; the board, editor, // capture, filters, labels, checklists and reminders all work fully offline. import { invoke } from "../desktop/bridge"; import type { Note, NoteRevision } from "../stores/notes"; import type { Label } from "../stores/labels"; import type { SavedFilter } from "../stores/savedFilters"; import type { Device } from "../stores/devices"; import type { TitleEntry } from "../stores/titles"; import type { User } from "../stores/session"; import type { PublicConfig } from "../stores/config"; import type { DeviceToken, ImportResult, Repo } from "./repo"; const NEEDS_SERVER = "That's not available offline — connect a server to use it."; export const local: Repo = { config: { get: () => invoke("config_get"), }, auth: { me: () => invoke("auth_me"), login: () => Promise.reject(new Error("You're offline — there's no account to sign in to.")), register: () => Promise.reject(new Error("You're offline — accounts are created on a server.")), logout: () => Promise.resolve(), }, devices: { list: () => Promise.resolve([]), create: () => Promise.reject(new Error(NEEDS_SERVER)), remove: () => Promise.resolve(), }, labels: { list: () => invoke("labels_list"), create: (name) => invoke