mirror of https://codeberg.org/pzp/pzp-goals.git
restructure index.js for better exported types
This commit is contained in:
parent
037aec208c
commit
d8a0f841fe
|
@ -4,3 +4,4 @@ pnpm-lock.yaml
|
||||||
package-lock.json
|
package-lock.json
|
||||||
coverage
|
coverage
|
||||||
*~
|
*~
|
||||||
|
lib/*.d.ts
|
23
lib/index.js
23
lib/index.js
|
@ -26,9 +26,7 @@ const Obz = require('obz')
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {{
|
* @param {{ db: PPPPPDB | null }} peer
|
||||||
* db: PPPPPDB | null,
|
|
||||||
* }} peer
|
|
||||||
* @returns {asserts peer is { db: PPPPPDB }}
|
* @returns {asserts peer is { db: PPPPPDB }}
|
||||||
*/
|
*/
|
||||||
function assertDBExists(peer) {
|
function assertDBExists(peer) {
|
||||||
|
@ -110,18 +108,11 @@ class GoalImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
/**
|
||||||
name: 'goals',
|
* @param {{ db: PPPPPDB | null }} peer
|
||||||
manifest: {},
|
* @param {unknown} config
|
||||||
permissions: {
|
|
||||||
anonymous: {},
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {{ db: PPPPPDB | null, close: ClosableHook }} peer
|
|
||||||
* @param {{ path: string; keypair: Keypair; }} config
|
|
||||||
*/
|
*/
|
||||||
init(peer, config) {
|
function initGoals(peer, config) {
|
||||||
assertDBExists(peer)
|
assertDBExists(peer)
|
||||||
// Constants:
|
// Constants:
|
||||||
const EMPTY_RANGE = /** @type {Range} */ ([1, 0])
|
const EMPTY_RANGE = /** @type {Range} */ ([1, 0])
|
||||||
|
@ -246,5 +237,7 @@ module.exports = {
|
||||||
list,
|
list,
|
||||||
listen,
|
listen,
|
||||||
}
|
}
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.name = 'goals'
|
||||||
|
exports.init = initGoals
|
||||||
|
|
Loading…
Reference in New Issue