Skip to content

Commit

Permalink
use one fetch library, fix catch-all import
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed Jan 22, 2024
1 parent 533397e commit b8c69cf
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion apps/trawler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@nostr-fetch/adapter-nostr-tools": "0.13.1",
"@nostrwatch/controlflow": "^0.0.1",
"@nostrwatch/logger": "^0.0.1",
"@nostrwatch/nocap": "^0.1.0",
"@nostrwatch/nocap": "^0.1.1",
"@nostrwatch/nwcache": "^0.0.1",
"@nostrwatch/publisher": "^0.0.1",
"@nostrwatch/seed": "^0.0.1",
Expand Down
2 changes: 0 additions & 2 deletions packages/nocap/adapters/default/DnsAdapterDefault/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import fetch from 'cross-fetch'
// import { fetch } from 'fetch-h2'
// import doh from 'dohjs'

class DnsAdapterDefault {
constructor(parent){
Expand Down
5 changes: 2 additions & 3 deletions packages/nocap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nostrwatch/nocap",
"version": "0.1.1",
"version": "0.1.2",
"main": "src/index.js",
"type": "module",
"license": "MIT",
Expand All @@ -10,6 +10,7 @@
},
"dependencies": {
"@nostrwatch/logger": "^0.0.1",
"@nostrwatch/nocap-every-adapter-default": "^1.0.1",
"@nostrwatch/utils": "^0.0.1",
"fetch-h2": "3.0.2",
"get-ssl-certificate": "2.3.3",
Expand All @@ -18,8 +19,6 @@
"object-hash": "3.0.0",
"promise-deferred": "2.0.4",
"socks-proxy-agent": "8.0.2",
"ssl-checker": "2.0.8",
"ssl-validator": "3.0.0",
"vitest": "0.34.6"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/nocap/src/classes/Base.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { LatencyHelper } from "./LatencyHelper.js";
import { DeferredWrapper } from "./DeferredWrapper.js";
import { Counter } from "./Counter.js";

import AllDefaultAdapters from "@nostrwatch/nocap-every-adapter-default"
import EveryDefaultAdapter from "@nostrwatch/nocap-every-adapter-default"

import SAMPLE_EVENT from "../data/sample_event.js"

Expand Down Expand Up @@ -953,7 +953,7 @@ export default class {
* @returns {string[]} - The array of default adapter keys
*/
defaultAdapterKeys(){
return Object.keys(AllDefaultAdapters)
return Object.keys(EveryDefaultAdapter)
}

/**
Expand All @@ -970,7 +970,7 @@ export default class {
this.defaultAdapterKeys().forEach( adapterKey => {
const adapterType = this.getAdapterType(adapterKey)
if(!this.adapters?.[adapterType]){
this.useAdapter(AllDefaultAdapters[adapterKey])
this.useAdapter(EveryDefaultAdapter[adapterKey])
}
})
this.adaptersInitialized = true
Expand Down
3 changes: 0 additions & 3 deletions packages/nocap/src/classes/SessionHelper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
import { SessionHelper } from './SessionHelper.js'
import murmurhash from 'murmurhash'
import { random } from '../utils.js'
import * as utilsModule from '../utils.js'

describe('SessionHelper', () => {
let sessionHelper;
Expand Down Expand Up @@ -38,8 +37,6 @@ describe('SessionHelper', () => {
expect(key1 === key2).toBe(false)
})



it('should create hash ids correctly', () => {
const expectedSessionId = murmurhash.v3('session', sessionHelper.salt);
const expectedConnectId = murmurhash.v3('connect', sessionHelper.salt);
Expand Down

0 comments on commit b8c69cf

Please sign in to comment.