NorthlightSDK

Grants

Following a person's grant to the app and reacting when it changes.

Exports of @north-light/sdk, read from the TypeScript compiler at build time. Types re-exported from @north-light/api are documented with that package.

GrantChanged

interface declared in resources/grant-watcher.ts

One grant reading GrantWatcher hands to onChanged. previous is the grant last delivered for this user in this process, or null on the first delivery (also after a restart, or after the user left and re-entered users()).

Prop

Type

GrantWatcher

class declared in resources/grant-watcher.ts

Follows the grants of the people an app names and hands each change to onChanged at least once. Build it with oauth.watchGrants(...), then start().

One turn per user is one grant.get; then the user goes to the back of the queue. A user whose last answer was delivered reads {wait, since: version}, so the runtime holds the read until the grant changes; a user with nothing delivered yet (first turn, a throwing onChanged) reads at once. Delivered versions are kept in memory: the app's rows are the durable record, and a restarted watcher delivers each user's current grant again.

Prop

Type

GrantWatchOptions

interface declared in resources/grant-watcher.ts

Prop

Type

On this page