Separate general purpose utils and protocol-related utils
This commit is contained in:
@@ -2,9 +2,9 @@ import EventEmitter from "events"
|
||||
import type {Event} from 'nostr-tools'
|
||||
import type {Executor} from "./Executor"
|
||||
import type {Connection} from './Connection'
|
||||
import type {Filter} from '../util/Filters'
|
||||
import {matchFilters} from "../util/Filters"
|
||||
import {hasValidSignature} from "../util/Events"
|
||||
import type {Filter} from '../protocol/Filters'
|
||||
import {matchFilters} from "../protocol/Filters"
|
||||
import {hasValidSignature} from "../protocol/Events"
|
||||
|
||||
export type SubscriptionOpts = {
|
||||
executor: Executor
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
export * from "./connect/Connection"
|
||||
export * from "./connect/ConnectionMeta"
|
||||
export * from "./connect/Executor"
|
||||
export * from "./connect/Pool"
|
||||
export * from "./connect/Socket"
|
||||
export * from "./connect/Subscription"
|
||||
export * from "./connect/target/Multi"
|
||||
export * from "./connect/target/Plex"
|
||||
export * from "./connect/target/Relay"
|
||||
export * from "./connect/target/Relays"
|
||||
export * from "./protocol/Address"
|
||||
export * from "./util/Deferred"
|
||||
export * from "./util/Emitter"
|
||||
export * from "./protocol/Events"
|
||||
export * from "./protocol/Filters"
|
||||
export * from "./util/Fluent"
|
||||
export * from "./protocol/Kinds"
|
||||
export * from "./util/LRUCache"
|
||||
export * from "./util/Queue"
|
||||
export * from "./protocol/Relays"
|
||||
export * from "./protocol/Router"
|
||||
export * from "./protocol/Tags"
|
||||
export * from "./util/Tools"
|
||||
@@ -0,0 +1,7 @@
|
||||
export * from './Deferred'
|
||||
export * from './Emitter'
|
||||
export * from './Fluent'
|
||||
export * from './LRUCache'
|
||||
export * from './Queue'
|
||||
export * from './Tools'
|
||||
export {default as normalizeUrl} from './normalize-url'
|
||||
@@ -1,7 +1,6 @@
|
||||
import type {Event, EventTemplate, UnsignedEvent} from 'nostr-tools'
|
||||
import {verifyEvent, getEventHash} from 'nostr-tools'
|
||||
import {cached} from "./LRUCache"
|
||||
import {now} from './Tools'
|
||||
import {cached, now} from "../util"
|
||||
import {Tags} from './Tags'
|
||||
import {addressFromEvent, encodeAddress} from './Address'
|
||||
import {isEphemeralKind, isReplaceableKind, isPlainReplaceableKind, isParameterizedReplaceableKind} from './Kinds'
|
||||
@@ -1,4 +1,4 @@
|
||||
import {between} from './Tools'
|
||||
import {between} from '../util'
|
||||
|
||||
export const isEphemeralKind = (kind: number) => between(19999, 29999, kind)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import normalizeUrl from "./normalize-url"
|
||||
import {stripProtocol} from './Tools'
|
||||
import {normalizeUrl, stripProtocol} from "../util"
|
||||
|
||||
export const isShareableRelayUrl = (url: string) =>
|
||||
Boolean(
|
||||
@@ -1,8 +1,8 @@
|
||||
import type {EventTemplate, UnsignedEvent} from 'nostr-tools'
|
||||
import {first, uniq, shuffle} from '../util'
|
||||
import type {Rumor} from './Events'
|
||||
import {getAddress, isReplaceable} from './Events'
|
||||
import {Tag, Tags} from './Tags'
|
||||
import {first, uniq, shuffle} from './Tools'
|
||||
import {GROUP_DEFINITION, COMMUNITY_DEFINITION} from './Kinds'
|
||||
import {addressFromEvent, decodeAddress} from './Address'
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import {EventTemplate} from 'nostr-tools'
|
||||
import {Fluent} from './Fluent'
|
||||
import type {OmitStatics} from './Tools'
|
||||
import {last} from './Tools'
|
||||
import type {OmitStatics} from '../util'
|
||||
import {Fluent, last} from '../util'
|
||||
import {isShareableRelayUrl, normalizeRelayUrl} from './Relays'
|
||||
import type {Address} from './Address'
|
||||
import {encodeAddress, decodeAddress} from './Address'
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"targets": [
|
||||
{"extname": ".cjs", "module": "commonjs"},
|
||||
{"extname": ".mjs", "module": "esnext", "moduleResolution": "node"}
|
||||
],
|
||||
"projects": ["tsconfig.json"]
|
||||
|
||||
Reference in New Issue
Block a user