Rename everything to welshman

This commit is contained in:
Jon Staab
2024-04-22 13:18:56 -07:00
parent eb5ffe873e
commit 16b1f22a95
40 changed files with 144 additions and 161 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
# @coracle.social/feeds
# @welshman/feeds [![version](https://badgen.feeds/npm/v/@welshman/feeds)](https://npmjs.com/package/@welshman/feeds)
A custom feed compiler and loader for nostr.
+3 -3
View File
@@ -1,6 +1,6 @@
import {uniq, now, isNil} from '@coracle.social/lib'
import type {Rumor, Filter} from '@coracle.social/util'
import {Tags, getIdFilters, mergeFilters} from '@coracle.social/util'
import {uniq, now, isNil} from '@welshman/lib'
import type {Rumor, Filter} from '@welshman/util'
import {Tags, getIdFilters, mergeFilters} from '@welshman/util'
import type {RequestItem, DVMItem, Scope, Feed, DynamicFilter, FeedOptions} from './core'
import {FeedType, getSubFeeds} from './core'
+1 -1
View File
@@ -1,4 +1,4 @@
import type {Filter} from '@coracle.social/util'
import type {Filter} from '@welshman/util'
export enum FeedType {
Difference = "difference",
+3 -3
View File
@@ -1,6 +1,6 @@
import {inc, max, min, now} from '@coracle.social/lib'
import type {Rumor, Filter} from '@coracle.social/util'
import {EPOCH, guessFilterDelta} from '@coracle.social/util'
import {inc, max, min, now} from '@welshman/lib'
import type {Rumor, Filter} from '@welshman/util'
import {EPOCH, guessFilterDelta} from '@welshman/util'
import type {Feed, RequestItem, FeedOptions} from './core'
import {FeedType} from './core'
import {FeedCompiler} from './compiler'
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@coracle.social/feeds",
"version": "0.0.3",
"name": "@welshman/feeds",
"version": "0.0.1",
"author": "hodlbod",
"license": "MIT",
"description": "Utilities for building dynamic nostr feeds.",
@@ -31,6 +31,6 @@
"typescript": "~5.1.6"
},
"dependencies": {
"@coracle.social/util": "0.0.9"
"@welshman/util": "0.0.1"
}
}
+11
View File
@@ -0,0 +1,11 @@
# @welshman/lib [![version](https://badgen.net/npm/v/@welshman/lib)](https://npmjs.com/package/@welshman/lib)
Some general-purpose utilities used elsewhere in @welshman.
- `Deferred` is just a promise with `resolve` and `reject` methods.
- `Emitter` extends EventEmitter to support `emitter.on('*', ...)`.
- `Fluent` is a wrapper around arrays with chained methods that modify and copy the underlying array.
- `LRUCache` is an implementation of an LRU cache.
- `Worker` is an implementation of an asynchronous queue.
- `Tools` is a collection of general-purpose utility functions.
- `Store` is an implementation of svelte-like subscribable stores with extra features.
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@coracle.social/lib",
"version": "0.0.6",
"name": "@welshman/lib",
"version": "0.0.1",
"author": "hodlbod",
"license": "MIT",
"description": "A collection of utilities.",
@@ -1,4 +1,4 @@
import {Emitter, Worker} from '@coracle.social/lib'
import {Emitter, Worker} from '@welshman/lib'
import {AuthStatus, ConnectionMeta} from './ConnectionMeta'
import {Socket, isMessage, asMessage} from './Socket'
import type {SocketMessage} from './Socket'
@@ -1,5 +1,5 @@
import type {Event, Filter} from 'nostr-tools'
import type {Message} from '@coracle.social/util'
import type {Message} from '@welshman/util'
import type {Connection} from './Connection'
export type PublishMeta = {
@@ -1,6 +1,6 @@
import type {Event} from 'nostr-tools'
import {matchFilters, hasValidSignature} from '@coracle.social/util'
import type {Filter} from '@coracle.social/util'
import {matchFilters, hasValidSignature} from '@welshman/util'
import type {Filter} from '@welshman/util'
import {Pool} from "./Pool"
import {Executor} from "./Executor"
import {Relays} from "./target/Relays"
@@ -1,6 +1,6 @@
import type {Event, Filter} from 'nostr-tools'
import type {Emitter} from '@coracle.social/lib'
import type {Message} from '@coracle.social/util'
import type {Emitter} from '@welshman/lib'
import type {Message} from '@welshman/util'
import type {Connection} from './Connection'
import {NetworkContext} from './Context'
@@ -1,4 +1,4 @@
import {Emitter} from '@coracle.social/lib'
import {Emitter} from '@welshman/lib'
import {Connection} from "./Connection"
export class Pool extends Emitter {
@@ -1,7 +1,7 @@
import type {Event} from 'nostr-tools'
import {Emitter, now, randomId, defer} from '@coracle.social/lib'
import type {Deferred} from '@coracle.social/lib'
import {asEvent,} from '@coracle.social/util'
import {Emitter, now, randomId, defer} from '@welshman/lib'
import type {Deferred} from '@welshman/lib'
import {asEvent,} from '@welshman/util'
import {NetworkContext} from './Context'
export enum PublishStatus {
+20
View File
@@ -0,0 +1,20 @@
# @welshman/net [![version](https://badgen.net/npm/v/@welshman/net)](https://npmjs.com/package/@welshman/net)
Utilities having to do with connection management and nostr messages.
- `Connection` - a wrapper for `Socket` with send and receive queues, and a `ConnectionMeta` instance.
- `ConnectionMeta` - tracks stats for a given `Connection`.
- `Context` - an object containing a default `Pool` and global configuration options.
- `Executor` - implements common nostr flows on a given `target`
- `Pool` - a thin wrapper around `Map` which stores `Connection`s.
- `Publish` - utilities for publishing events.
- `Socket` - a wrapper around isomorphic-ws that handles json parsing/serialization.
- `Subscribe` - utilities for making requests against nostr relays.
- `Tracker` - tracks which relays a given event was seen on.
Executor `target`s extend `Emitter`, and have a `send` method, a `cleanup` method, and a `connections` getter. They are intended to be passed to an `Executor` for use.
- `targets/Multi` allows you to compose multiple targets together.
- `targets/Plex` takes an array of urls and a `Connection` and sends and receives wrapped nostr messages over that connection.
- `targets/Relay` takes a `Connection` and provides listeners for different verbs.
- `targets/Relays` takes an array of `Connection`s and provides listeners for different verbs, merging all events into a single stream.
@@ -1,6 +1,6 @@
import WebSocket from "isomorphic-ws"
import {Deferred, defer} from '@coracle.social/lib'
import type {Message} from '@coracle.social/util'
import {Deferred, defer} from '@welshman/lib'
import type {Message} from '@welshman/util'
export type PlexMessage = [{relays: string[]}, Message]
@@ -1,8 +1,8 @@
import type {Event} from 'nostr-tools'
import {Emitter, randomId, groupBy, batch, defer, uniq, uniqBy} from '@coracle.social/lib'
import type {Deferred} from '@coracle.social/lib'
import {matchFilters, mergeFilters} from '@coracle.social/util'
import type {Filter} from '@coracle.social/util'
import {Emitter, randomId, groupBy, batch, defer, uniq, uniqBy} from '@welshman/lib'
import type {Deferred} from '@welshman/lib'
import {matchFilters, mergeFilters} from '@welshman/util'
import type {Filter} from '@welshman/util'
import {Tracker} from "./Tracker"
import {Connection} from './Connection'
import {NetworkContext} from './Context'
@@ -1,4 +1,4 @@
import {writable} from '@coracle.social/lib'
import {writable} from '@welshman/lib'
export class Tracker {
data = writable(new Map<string, Set<string>>())
@@ -1,6 +1,6 @@
{
"name": "@coracle.social/network",
"version": "0.0.9",
"name": "@welshman/net",
"version": "0.0.1",
"author": "hodlbod",
"license": "MIT",
"description": "Utilities for connecting with nostr relays.",
@@ -32,8 +32,8 @@
"typescript": "~5.1.6"
},
"dependencies": {
"@coracle.social/lib": "0.0.6",
"@coracle.social/util": "0.0.9",
"@welshman/lib": "0.0.1",
"@welshman/util": "0.0.1",
"isomorphic-ws": "^5.0.0",
"ws": "^8.16.0"
}
@@ -1,5 +1,5 @@
import {Emitter} from '@coracle.social/lib'
import type {Message} from '@coracle.social/util'
import {Emitter} from '@welshman/lib'
import type {Message} from '@welshman/util'
import type {Target} from '../Executor'
export class Multi extends Emitter {
@@ -1,5 +1,5 @@
import {Emitter} from '@coracle.social/lib'
import type {Message} from '@coracle.social/util'
import {Emitter} from '@welshman/lib'
import type {Message} from '@welshman/util'
import type {PlexMessage} from '../Socket'
import type {Connection} from '../Connection'
@@ -1,5 +1,5 @@
import {Emitter} from '@coracle.social/lib'
import type {Message} from '@coracle.social/util'
import {Emitter} from '@welshman/lib'
import type {Message} from '@welshman/util'
import type {Connection} from '../Connection'
export class Relay extends Emitter {
@@ -1,5 +1,5 @@
import {Emitter} from '@coracle.social/lib'
import type {Message} from '@coracle.social/util'
import {Emitter} from '@welshman/lib'
import type {Message} from '@welshman/util'
import type {Connection} from '../Connection'
export class Relays extends Emitter {
+1 -1
View File
@@ -1,7 +1,7 @@
import type {Event, EventTemplate, UnsignedEvent} from 'nostr-tools'
export type {Event, EventTemplate, UnsignedEvent} from 'nostr-tools'
import {verifyEvent, getEventHash} from 'nostr-tools'
import {cached, now} from '@coracle.social/lib'
import {cached, now} from '@welshman/lib'
import {Tags} from './Tags'
import {addressFromEvent, encodeAddress} from './Address'
import {isEphemeralKind, isReplaceableKind, isPlainReplaceableKind, isParameterizedReplaceableKind} from './Kinds'
+1 -1
View File
@@ -1,6 +1,6 @@
import type {Event} from 'nostr-tools'
import {matchFilter as nostrToolsMatchFilter} from 'nostr-tools'
import {prop, avg, hash, groupBy, randomId, uniq} from '@coracle.social/lib'
import {prop, avg, hash, groupBy, randomId, uniq} from '@welshman/lib'
import type {Rumor} from './Events'
import {decodeAddress, addressFromEvent, encodeAddress} from './Address'
import {isReplaceableKind} from './Kinds'
-1
View File
@@ -1,5 +1,4 @@
import {kinds} from 'nostr-tools'
import {between} from '@coracle.social/lib'
export const isRegularKind = kinds.isRegularKind
export const isEphemeralKind = kinds.isEphemeralKind
+14
View File
@@ -0,0 +1,14 @@
# @welshman/util [![version](https://badgen.net/npm/v/@welshman/util)](https://npmjs.com/package/@welshman/util)
Some nostr-specific utilities. For the most part, these will not have side effects or manage state.
- `Address` utilities for dealing with nostr addresses.
- `Events` utilities for dealing with nostr events.
- `Filters` utilities for dealing with nostr filters.
- `Kinds` kind constants and related utility functions.
- `Links` utilities for encoding and decoding nostr links.
- `Relay` an implementation of an in-memory nostr relay.
- `Relays` utilities related to relay urls.
- `Router` is a utility for selecting relay urls based on user preferences and protocol hints.
- `Tags` convenient way to access and modify tags.
- `Zaps` utilities related to zaps.
+1 -1
View File
@@ -1,4 +1,4 @@
import {Emitter, uniq, omit, now, range, identity, pushToMapKey} from '@coracle.social/lib'
import {Emitter, uniq, omit, now, range, identity} from '@welshman/lib'
import {matchFilters, matchFilter} from './Filters'
import {encodeAddress, addressFromEvent} from './Address'
import {isReplaceable} from './Events'
+1 -1
View File
@@ -1,4 +1,4 @@
import {normalizeUrl, stripProtocol} from '@coracle.social/lib'
import {normalizeUrl, stripProtocol} from '@welshman/lib'
export const isShareableRelayUrl = (url: string) =>
Boolean(
+2 -2
View File
@@ -1,5 +1,5 @@
import {first, splitAt, identity, sortBy, uniq, shuffle, pushToMapKey} from '@coracle.social/lib'
import {Tags, Tag} from '@coracle.social/util'
import {first, splitAt, identity, sortBy, uniq, shuffle, pushToMapKey} from '@welshman/lib'
import {Tags, Tag} from '@welshman/util'
import type {Rumor} from './Events'
import {getAddress, isReplaceable} from './Events'
import {isShareableRelayUrl} from './Relays'
+2 -2
View File
@@ -1,6 +1,6 @@
import {EventTemplate} from 'nostr-tools'
import type {OmitStatics} from '@coracle.social/lib'
import {Fluent, ensurePlural, last} from '@coracle.social/lib'
import type {OmitStatics} from '@welshman/lib'
import {Fluent, ensurePlural, last} from '@welshman/lib'
import {isShareableRelayUrl, normalizeRelayUrl} from './Relays'
import type {Address} from './Address'
import {encodeAddress, decodeAddress} from './Address'
+1 -1
View File
@@ -1,5 +1,5 @@
import type {Event} from 'nostr-tools'
import {hexToBech32} from '@coracle.social/lib'
import {hexToBech32} from '@welshman/lib'
import {Tags} from "./Tags"
const DIVISORS = {
+4 -4
View File
@@ -1,9 +1,9 @@
{
"name": "@coracle.social/util",
"version": "0.0.9",
"name": "@welshman/util",
"version": "0.0.1",
"author": "hodlbod",
"license": "MIT",
"description": "A collection of utilities.",
"description": "A collection of nostr-related utilities.",
"publishConfig": {
"access": "public"
},
@@ -32,7 +32,7 @@
"typescript": "~5.1.6"
},
"dependencies": {
"@coracle.social/lib": "0.0.6",
"@welshman/lib": "0.0.1",
"nostr-tools": "^2.3.2"
}
}