restructure index.js for better exported types

This commit is contained in:
Andre Staltz 2023-09-20 15:33:32 +03:00
parent 037aec208c
commit d8a0f841fe
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
2 changed files with 123 additions and 129 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ pnpm-lock.yaml
package-lock.json package-lock.json
coverage coverage
*~ *~
lib/*.d.ts

View File

@ -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',
manifest: {},
permissions: {
anonymous: {},
},
/** /**
* @param {{ db: PPPPPDB | null, close: ClosableHook }} peer * @param {{ db: PPPPPDB | null }} peer
* @param {{ path: string; keypair: Keypair; }} config * @param {unknown} 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