Skip to content

basalt / drives/src / DriveConnection

Interface: DriveConnection ​

Defined in: drives/src/store.ts:31

A tenant's connection to one account at one provider.

A tenant may hold many connections to the same provider — "Drive Finance" and "Drive HR" are two rows with provider: 'google' and different labels, different credentials and independent sync cursors. Nothing in the model is keyed by (tenantId, provider), precisely so this works.

Properties ​

account? ​

> optional account?: DriveConnectionAccount

Defined in: drives/src/store.ts:39

Identity at the provider, for display and duplicate detection. Never credentials.


createdAt ​

> createdAt: number

Defined in: drives/src/store.ts:68


cursor? ​

> optional cursor?: string

Defined in: drives/src/store.ts:53

Incremental-sync cursor / delta token. Opaque.


id ​

> id: string

Defined in: drives/src/store.ts:32


label ​

> label: string

Defined in: drives/src/store.ts:37

Operator-chosen display name. Unique per tenant is a good app-level rule; not enforced here.


lastSyncedAt? ​

> optional lastSyncedAt?: number

Defined in: drives/src/store.ts:56


provider ​

> provider: string

Defined in: drives/src/store.ts:35

DriveProvider.name.


revision ​

> revision: number

Defined in: drives/src/store.ts:67

Optimistic-concurrency marker, bumped on every write.

It exists for one specific failure: two workers refreshing the same connection at the same moment against a provider that rotates refresh tokens (Microsoft does). Without it the second write overwrites the first with a refresh token the provider has already retired, and the connection dies at the next refresh. With it the loser is told, re-reads, and uses the winner's tokens.


rootId? ​

> optional rootId?: string

Defined in: drives/src/store.ts:41

Folder the connection is confined to. Absent means the account root.


scopes? ​

> optional scopes?: readonly string[]

Defined in: drives/src/store.ts:43


secret ​

> secret: string

Defined in: drives/src/store.ts:51

Sealed DriveTokens, as produced by DriveSecretBox.seal.

Bound by AAD to (tenantId, id, provider), so this column is worthless in any other row. It never leaves this package in readable form and never appears in a DriveConnectionView.


status ​

> status: DriveConnectionStatus

Defined in: drives/src/store.ts:42


tenantId ​

> tenantId: string

Defined in: drives/src/store.ts:33


updatedAt ​

> updatedAt: number

Defined in: drives/src/store.ts:69


watch? ​

> optional watch?: DriveConnectionWatch

Defined in: drives/src/store.ts:55

Push-subscription state, when the app registered one.

Released under the MIT License.