Skip to content

Graphorin API reference v0.8.0


Graphorin API reference / @graphorin/store-sqlite / / SqlitePairingStore

Class: SqlitePairingStore

Defined in: packages/store-sqlite/src/pairing-store.ts:52

Default PairingStore implementation (migration 034). Expiry policy lives in the access controller of @graphorin/channels; this store only filters by the timestamps it is handed.

Stable

Implements

Constructors

Constructor

ts
new SqlitePairingStore(conn): SqlitePairingStore;

Defined in: packages/store-sqlite/src/pairing-store.ts:54

Parameters

ParameterType
connSqliteConnection

Returns

SqlitePairingStore

Methods

addPairedPeer()

ts
addPairedPeer(peer): Promise<void>;

Defined in: packages/store-sqlite/src/pairing-store.ts:117

Parameters

ParameterType
peerPairedPeerRecord

Returns

Promise&lt;void&gt;

Implementation of

PairingStore.addPairedPeer


countPendingRequests()

ts
countPendingRequests(channelId, nowIso): Promise<number>;

Defined in: packages/store-sqlite/src/pairing-store.ts:98

Count pending requests on a channel whose expiresAt is after nowIso.

Parameters

ParameterType
channelIdstring
nowIsostring

Returns

Promise&lt;number&gt;

Implementation of

PairingStore.countPendingRequests


deleteRequest()

ts
deleteRequest(channelId, code): Promise<void>;

Defined in: packages/store-sqlite/src/pairing-store.ts:91

Parameters

ParameterType
channelIdstring
codestring

Returns

Promise&lt;void&gt;

Implementation of

PairingStore.deleteRequest


findRequestByCode()

ts
findRequestByCode(channelId, code): Promise<
  | PairingRequestRecord
| null>;

Defined in: packages/store-sqlite/src/pairing-store.ts:83

Parameters

ParameterType
channelIdstring
codestring

Returns

Promise< | PairingRequestRecord | null>

Implementation of

PairingStore.findRequestByCode


findRequestByPeer()

ts
findRequestByPeer(peer): Promise<
  | PairingRequestRecord
| null>;

Defined in: packages/store-sqlite/src/pairing-store.ts:74

Parameters

ParameterType
peerPairingPeerRef

Returns

Promise< | PairingRequestRecord | null>

Implementation of

PairingStore.findRequestByPeer


isPaired()

ts
isPaired(peer): Promise<boolean>;

Defined in: packages/store-sqlite/src/pairing-store.ts:126

Parameters

ParameterType
peerPairingPeerRef

Returns

Promise&lt;boolean&gt;

Implementation of

PairingStore.isPaired


listPairedPeers()

ts
listPairedPeers(channelId?): Promise<readonly PairedPeerRecord[]>;

Defined in: packages/store-sqlite/src/pairing-store.ts:143

Parameters

ParameterType
channelId?string

Returns

Promise&lt;readonly PairedPeerRecord[]&gt;

Implementation of

PairingStore.listPairedPeers


pruneExpiredRequests()

ts
pruneExpiredRequests(nowIso): Promise<number>;

Defined in: packages/store-sqlite/src/pairing-store.ts:106

Delete requests whose expiresAt is at or before nowIso; returns the number removed.

Parameters

ParameterType
nowIsostring

Returns

Promise&lt;number&gt;

Implementation of

PairingStore.pruneExpiredRequests


removePairedPeer()

ts
removePairedPeer(peer): Promise<void>;

Defined in: packages/store-sqlite/src/pairing-store.ts:135

Parameters

ParameterType
peerPairingPeerRef

Returns

Promise&lt;void&gt;

Implementation of

PairingStore.removePairedPeer


upsertRequest()

ts
upsertRequest(request): Promise<void>;

Defined in: packages/store-sqlite/src/pairing-store.ts:58

Insert or replace the (single) pending request for the peer.

Parameters

ParameterType
requestPairingRequestRecord

Returns

Promise&lt;void&gt;

Implementation of

PairingStore.upsertRequest