diff --git a/packages/controlflow/package.json b/packages/controlflow/package.json index a2407e4b..df009990 100644 --- a/packages/controlflow/package.json +++ b/packages/controlflow/package.json @@ -1,6 +1,6 @@ { "name": "@nostrwatch/controlflow", - "version": "0.2.0", + "version": "0.2.1", "description": "Provides exports for application control flow", "main": "index.js", "type": "module", diff --git a/packages/controlflow/src/scheduler.js b/packages/controlflow/src/scheduler.js index 79418c51..65395868 100644 --- a/packages/controlflow/src/scheduler.js +++ b/packages/controlflow/src/scheduler.js @@ -14,7 +14,6 @@ export class Scheduler { const totalInterval = this.workers.reduce((sum, worker) => sum + worker.interval, 0); let cumulativeOffset = 0; this.workers.forEach(worker => { - // console.log(worker) this.analysis[worker.name] = { interval: worker.interval, offset: this.calculateBestOffset(worker, cumulativeOffset, totalInterval), diff --git a/packages/nocap/package.json b/packages/nocap/package.json index afbed34e..7fecc120 100644 --- a/packages/nocap/package.json +++ b/packages/nocap/package.json @@ -1,6 +1,6 @@ { "name": "@nostrwatch/nocap", - "version": "0.4.2", + "version": "0.4.3", "main": "src/index.js", "type": "module", "license": "MIT", diff --git a/packages/nocap/src/classes/Base.js b/packages/nocap/src/classes/Base.js index 1eebee86..9d0b912b 100644 --- a/packages/nocap/src/classes/Base.js +++ b/packages/nocap/src/classes/Base.js @@ -138,7 +138,7 @@ export default class Base { return this.check([keys]) if( !(keys instanceof Array) || !keys.length) - return this.throw(`check(${keys}) failed. keys must be one (string) or several (array of strings).`) + return this.throw(new Error(`check(${keys}) failed. keys must be one (string) or several (array of strings).`)) this.checksRequested = keys this.evaluate_requested_checks() diff --git a/packages/nocap/src/classes/Validator.js b/packages/nocap/src/classes/Validator.js index 65727fd4..30caccb1 100644 --- a/packages/nocap/src/classes/Validator.js +++ b/packages/nocap/src/classes/Validator.js @@ -1,6 +1,5 @@ export class Validator { validate(key, value){ - // console.log(this) if(typeof this?.defaults?.[key] === 'undefined') throw new Error(`${this.constructor.name} does not have property '${key}'`) if(value && typeof this.defaults[key] !== typeof value) diff --git a/packages/nwcache/migrations/normalize_relay_urls.js b/packages/nwcache/migrations/normalize_relay_urls.js index bde37a0b..e32cd52e 100644 --- a/packages/nwcache/migrations/normalize_relay_urls.js +++ b/packages/nwcache/migrations/normalize_relay_urls.js @@ -36,11 +36,7 @@ const chunkArray = function(arr, chunkSize) { console.log(relaydb.relay.count.all()) const relays = await relaydb.relay.get.all() - const chunks = chunkArray(relays, 100) - - // console.log(chunks) - // process.exit() - + const chunks = chunkArray(relays, 100) let count = 0 for(const chunk of chunks){ diff --git a/packages/nwcache/mixins/checks.js b/packages/nwcache/mixins/checks.js index 9b4aed33..9e830f4d 100644 --- a/packages/nwcache/mixins/checks.js +++ b/packages/nwcache/mixins/checks.js @@ -17,7 +17,6 @@ export default class CheckMixin { } validate(RelayObj){ - // console.log(RelayObj) if(!RelayObj?.url) throw new Error("Relay object must have a url property") } diff --git a/packages/nwcache/mixins/relay.js b/packages/nwcache/mixins/relay.js index b0c5b26c..bccba11d 100644 --- a/packages/nwcache/mixins/relay.js +++ b/packages/nwcache/mixins/relay.js @@ -268,7 +268,6 @@ const relay_get = (db) => { const paymentRequired = db.check.info.get.all().filter( rci => rci?.data?.limitation && rci?.data?.limitation?.payment_required && rci.data.limitation.payment_required === true ).map( res => [ res.relay_id, res['#'] ] ) const relayIds = paymentRequired.map( r => r[0] ) const relayInfoIds = paymentRequired.map( r => r[1] ) - console.log('ids', relayIds) let relays = this.many(relayIds) relays = relays.filter( relay => relay.info.ref ) diff --git a/packages/nwcache/package.json b/packages/nwcache/package.json index 0e88ad6b..cc465613 100644 --- a/packages/nwcache/package.json +++ b/packages/nwcache/package.json @@ -1,6 +1,6 @@ { "name": "@nostrwatch/nwcache", - "version": "0.1.0", + "version": "0.1.1", "type": "module", "main": "index.js", "license": "MIT", diff --git a/packages/publisher/package.json b/packages/publisher/package.json index b15c18f5..7407c123 100644 --- a/packages/publisher/package.json +++ b/packages/publisher/package.json @@ -1,6 +1,6 @@ { "name": "@nostrwatch/publisher", - "version": "0.4.0", + "version": "0.4.1", "type": "module", "description": "Library for publishing nostr.watch relay status and publisher registration events", "main": "index.js", diff --git a/packages/publisher/src/Publisher.js b/packages/publisher/src/Publisher.js index e39213df..48ce931d 100644 --- a/packages/publisher/src/Publisher.js +++ b/packages/publisher/src/Publisher.js @@ -18,7 +18,6 @@ async function writeObjectToFile(obj) { try { await fs.writeFile(fileName, jsonContent); - // console.log(`File ${fileName} has been written.`); } catch (error) { console.error('Error writing file:', error); } @@ -79,12 +78,9 @@ export class Publisher { signEvent(event){ event.id = getEventHash(event) event.sig = getSignature(event, process.env.DAEMON_PRIVKEY || "") - // console.log('++signedEvent') - // console.dir(event) const valid = validateEvent(event) && verifySignature(event) if(!valid) throw new Error('generateEvent(): event does not validate') - // if(signedEvent.tags.filter( tag => tag[0]==='s' && tag[1]==='online' ).length > 0) console.log(signedEvent) return event } @@ -98,13 +94,10 @@ export class Publisher { async publishEvent(signedEvent){ // writeObjectToFile(signedEvent); - console.log const pool = new SimplePool(); const relays = config.publisher.to_relays let pubs = pool.publish(relays, signedEvent) - await Promise.all( pubs ).catch(console.error) - // console.log(pubs) - // process.exit() + await Promise.all( pubs ).catch( e => { log.error(`publishEvent(): Error: ${e}`) }) return Promise.all( pubs ) } @@ -137,7 +130,7 @@ export class PublisherNocap extends Publisher { const unsignedEvent = this.generateEvent(relay) signedEvents.push(this.signEvent(unsignedEvent)) } - await this.publishEvents(signedEvents).catch(console.error) + await this.publishEvents(signedEvents).catch( e => { log.error(`PublisherNocap::many(): Error: ${e}`) }) } } diff --git a/packages/publisher/src/kinds/Kind0.js b/packages/publisher/src/kinds/Kind0.js index d7fc7a39..cae20887 100644 --- a/packages/publisher/src/kinds/Kind0.js +++ b/packages/publisher/src/kinds/Kind0.js @@ -29,7 +29,7 @@ export class Kind0 extends Publisher { content = JSON.stringify(data) } catch(e){ - console.dir(data) + console.dir(`Kind0::generateContent(): Error: ${e}`) throw new Error('Was not able to stringify data for kind 0 content field.') } return content diff --git a/packages/seed/src/index.js b/packages/seed/src/index.js index 7a975d61..0d9cbff3 100644 --- a/packages/seed/src/index.js +++ b/packages/seed/src/index.js @@ -25,8 +25,6 @@ export const bootstrap = async (caller) => { api = emptyResponse(), events = emptyResponse() - // console.log(opts.sources, opts.sources.includes('api')) - if(opts.sources.includes('config')) configseed = [ config?.seed, Date.now() ] @@ -101,7 +99,7 @@ export const relaysFromStaticSeed = async (opts) => { const data = yaml.load(fileContents); return data?.relays? [ data.relays, Date.now() ]: emptyResponse() //update Date to reflect modification date of seed file. } catch (e) { - console.error(e); + logger.err(e); return emptyResponse() } } diff --git a/packages/seed/src/nwcache.js b/packages/seed/src/nwcache.js index 5dbf4090..270a6584 100644 --- a/packages/seed/src/nwcache.js +++ b/packages/seed/src/nwcache.js @@ -3,9 +3,6 @@ import config from './config.js' let $rcache -console.log(process.env.PWD, process.cwd()) -console.log('config', config) - if(!config?.cache_path) throw new Error("No LMDB path specified in config") diff --git a/packages/utils/config.js b/packages/utils/config.js index 6cac2aa5..eaba2fc1 100644 --- a/packages/utils/config.js +++ b/packages/utils/config.js @@ -25,14 +25,13 @@ export const loadConfigSync = function() { const fileContents = fs.readFileSync(configPath, 'utf8'); return yaml.load(fileContents); } catch (e) { - console.error(e); + console.error("loadConfigSync Error: ", e); throw new Error('config.yaml not found') } }; export const loadConfig = async function() { const handle_error = (e) => { - // console.error(e); return new Error('config.yaml not found') } const configPath = process.env.CONFIG_PATH || './config.yaml'; diff --git a/packages/utils/package.json b/packages/utils/package.json index 88c473cc..3ac4d9ae 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@nostrwatch/utils", - "version": "0.1.0", + "version": "0.1.2", "type": "module", "main": "index.js", "license": "MIT",