Skip to content

basalt / drives/src / DriveChange

Type Alias: DriveChange ​

> DriveChange = { item: DriveItem; type: "upserted"; } | { externalId?: string; path?: string; type: "removed"; }

Defined in: drives/src/provider.ts:123

What changed since a delta cursor.

Union Members ​

Type Literal ​

{ item: DriveItem; type: "upserted"; }


Type Literal ​

{ externalId?: string; path?: string; type: "removed"; }

An item the provider says is gone.

Both fields are optional because the vendors genuinely disagree about what a deletion is, and phase 1 was hiding that behind a required id:

  • Google Drive and Microsoft Graph report a deletion against the item's id, which is what the import ledger is keyed by.
  • Dropbox does not. A deleted entry in files/list_folder is {".tag":"deleted", name, path_lower, path_display} — it carries no id at all, because the id belonged to the thing that no longer exists. The only handle is the path.

Putting a path in externalId would have kept the type tidy and made every ledger lookup silently miss. An adapter sets whichever it actually has (at least one), and the engine reports both to onRemoved so an app can correlate on the path it stored at import time (filesSink records it as metadata.drivePath).

Released under the MIT License.