mirror of https://codeberg.org/pzp/pzp-dict.git
new API getFeedID()
This commit is contained in:
parent
b08f9baee9
commit
0937f3e8c6
13
lib/index.js
13
lib/index.js
|
@ -405,6 +405,18 @@ function initRecord(peer, config) {
|
|||
return record
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
* @param {string} subdomain
|
||||
* @returns {string}
|
||||
*/
|
||||
function getFeedID(subdomain) {
|
||||
if (!accountID) throw new Error('Cannot getFeedID() before loading')
|
||||
assertDBPlugin(peer)
|
||||
const domain = fromSubdomain(subdomain)
|
||||
return MsgV3.getMootID(accountID, domain)
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
* @param {Msg} msg
|
||||
|
@ -517,6 +529,7 @@ function initRecord(peer, config) {
|
|||
load,
|
||||
update,
|
||||
read,
|
||||
getFeedID,
|
||||
isRoot,
|
||||
isGhostable,
|
||||
getFieldRoots,
|
||||
|
|
|
@ -143,6 +143,8 @@ test('Record isGhostable', (t) => {
|
|||
const moot = MsgV3.createMoot(aliceID, 'record_v1__profile', aliceKeypair)
|
||||
const mootID = MsgV3.getMsgID(moot)
|
||||
|
||||
assert.equal(mootID, peer.record.getFeedID('profile'), 'getFeedID')
|
||||
|
||||
const tangle = peer.db.getTangle(mootID)
|
||||
const msgIDs = tangle.topoSort()
|
||||
|
||||
|
|
Loading…
Reference in New Issue