mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 16:48:50 +00:00
Compare commits
9 Commits
alexgleaso
...
v2.3.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5429142858 | ||
|
|
564c9bca17 | ||
|
|
0190ae94a7 | ||
|
|
e1bde08ff3 | ||
|
|
71456feb20 | ||
|
|
ca928c697b | ||
|
|
7b98cae7fa | ||
|
|
db53f37161 | ||
|
|
1691f0b51d |
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
@@ -15,4 +15,4 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: oven-sh/setup-bun@v1
|
- uses: oven-sh/setup-bun@v1
|
||||||
- run: bun i
|
- run: bun i
|
||||||
- run: npx jsr publish
|
- run: npx jsr publish --allow-slow-types
|
||||||
|
|||||||
@@ -99,17 +99,20 @@ export class AbstractRelay {
|
|||||||
this.ws.onerror = ev => {
|
this.ws.onerror = ev => {
|
||||||
reject((ev as any).message)
|
reject((ev as any).message)
|
||||||
if (this._connected) {
|
if (this._connected) {
|
||||||
|
this._connected = false
|
||||||
|
this.connectionPromise = undefined
|
||||||
this.onclose?.()
|
this.onclose?.()
|
||||||
this.closeAllSubscriptions('relay connection errored')
|
this.closeAllSubscriptions('relay connection errored')
|
||||||
this._connected = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ws.onclose = async () => {
|
this.ws.onclose = async () => {
|
||||||
this.connectionPromise = undefined
|
if (this._connected) {
|
||||||
this.onclose?.()
|
this._connected = false
|
||||||
this.closeAllSubscriptions('relay connection closed')
|
this.connectionPromise = undefined
|
||||||
this._connected = false
|
this.onclose?.()
|
||||||
|
this.closeAllSubscriptions('relay connection closed')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ws.onmessage = this._onmessage.bind(this)
|
this.ws.onmessage = this._onmessage.bind(this)
|
||||||
@@ -338,7 +341,7 @@ export class Subscription {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public close(reason: string = 'closed by caller') {
|
public close(reason: string = 'closed by caller') {
|
||||||
if (!this.closed) {
|
if (!this.closed && this.relay.connected) {
|
||||||
// if the connection was closed by the user calling .close() we will send a CLOSE message
|
// if the connection was closed by the user calling .close() we will send a CLOSE message
|
||||||
// otherwise this._open will be already set to false so we will skip this
|
// otherwise this._open will be already set to false so we will skip this
|
||||||
this.relay.send('["CLOSE",' + JSON.stringify(this.id) + ']')
|
this.relay.send('["CLOSE",' + JSON.stringify(this.id) + ']')
|
||||||
|
|||||||
41
jsr.json
41
jsr.json
@@ -1,5 +1,44 @@
|
|||||||
{
|
{
|
||||||
"name": "@nostr/tools",
|
"name": "@nostr/tools",
|
||||||
"version": "2.3.1",
|
"version": "2.3.1",
|
||||||
"exports": "./index.ts"
|
"exports": {
|
||||||
|
".": "./index.ts",
|
||||||
|
"./core": "./core.ts",
|
||||||
|
"./pure": "./pure.ts",
|
||||||
|
"./wasm": "./wasm.ts",
|
||||||
|
"./kinds": "./kinds.ts",
|
||||||
|
"./filter": "./filter.ts",
|
||||||
|
"./abstract-relay": "./abstract-relay.ts",
|
||||||
|
"./relay": "./relay.ts",
|
||||||
|
"./abstract-pool": "./abstract-pool.ts",
|
||||||
|
"./pool": "./pool.ts",
|
||||||
|
"./references": "./references.ts",
|
||||||
|
"./nip04": "./nip04.ts",
|
||||||
|
"./nip05": "./nip05.ts",
|
||||||
|
"./nip06": "./nip06.ts",
|
||||||
|
"./nip10": "./nip10.ts",
|
||||||
|
"./nip11": "./nip11.ts",
|
||||||
|
"./nip13": "./nip13.ts",
|
||||||
|
"./nip18": "./nip18.ts",
|
||||||
|
"./nip19": "./nip19.ts",
|
||||||
|
"./nip21": "./nip21.ts",
|
||||||
|
"./nip25": "./nip25.ts",
|
||||||
|
"./nip27": "./nip27.ts",
|
||||||
|
"./nip28": "./nip28.ts",
|
||||||
|
"./nip29": "./nip29.ts",
|
||||||
|
"./nip30": "./nip30.ts",
|
||||||
|
"./nip39": "./nip39.ts",
|
||||||
|
"./nip42": "./nip42.ts",
|
||||||
|
"./nip44": "./nip44.ts",
|
||||||
|
"./nip46": "./nip46.ts",
|
||||||
|
"./nip49": "./nip49.ts",
|
||||||
|
"./nip57": "./nip57.ts",
|
||||||
|
"./nip75": "./nip75.ts",
|
||||||
|
"./nip94": "./nip94.ts",
|
||||||
|
"./nip96": "./nip96.ts",
|
||||||
|
"./nip98": "./nip98.ts",
|
||||||
|
"./nip99": "./nip99.ts",
|
||||||
|
"./fakejson": "./fakejson.ts",
|
||||||
|
"./utils": "./utils.ts"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"name": "nostr-tools",
|
"name": "nostr-tools",
|
||||||
"version": "2.3.1",
|
"version": "2.3.2",
|
||||||
"description": "Tools for making a Nostr client.",
|
"description": "Tools for making a Nostr client.",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"lib": ["dom", "dom.iterable", "esnext"],
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "Bundler",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"emitDeclarationOnly": true,
|
"emitDeclarationOnly": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user