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
|
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
|
* @public
|
||||||
* @param {Msg} msg
|
* @param {Msg} msg
|
||||||
|
@ -517,6 +529,7 @@ function initRecord(peer, config) {
|
||||||
load,
|
load,
|
||||||
update,
|
update,
|
||||||
read,
|
read,
|
||||||
|
getFeedID,
|
||||||
isRoot,
|
isRoot,
|
||||||
isGhostable,
|
isGhostable,
|
||||||
getFieldRoots,
|
getFieldRoots,
|
||||||
|
|
|
@ -143,6 +143,8 @@ test('Record isGhostable', (t) => {
|
||||||
const moot = MsgV3.createMoot(aliceID, 'record_v1__profile', aliceKeypair)
|
const moot = MsgV3.createMoot(aliceID, 'record_v1__profile', aliceKeypair)
|
||||||
const mootID = MsgV3.getMsgID(moot)
|
const mootID = MsgV3.getMsgID(moot)
|
||||||
|
|
||||||
|
assert.equal(mootID, peer.record.getFeedID('profile'), 'getFeedID')
|
||||||
|
|
||||||
const tangle = peer.db.getTangle(mootID)
|
const tangle = peer.db.getTangle(mootID)
|
||||||
const msgIDs = tangle.topoSort()
|
const msgIDs = tangle.topoSort()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue