Add isDeletedByAddress

This commit is contained in:
Jon Staab
2024-07-22 11:54:19 -07:00
parent 69effe4f41
commit cfb0d01316
6 changed files with 14 additions and 11 deletions
+4 -4
View File
@@ -3097,7 +3097,7 @@
"dependencies": {
"@welshman/lib": "0.0.11",
"@welshman/net": "0.0.14",
"@welshman/util": "0.0.21",
"@welshman/util": "0.0.22",
"nostr-tools": "^2.7.0"
},
"devDependencies": {
@@ -3111,7 +3111,7 @@
"version": "0.0.12",
"license": "MIT",
"dependencies": {
"@welshman/util": "0.0.21"
"@welshman/util": "0.0.22"
},
"devDependencies": {
"gts": "^5.0.1",
@@ -3149,7 +3149,7 @@
"license": "MIT",
"dependencies": {
"@welshman/lib": "0.0.11",
"@welshman/util": "0.0.21",
"@welshman/util": "0.0.22",
"isomorphic-ws": "^5.0.0",
"ws": "^8.16.0"
},
@@ -3161,7 +3161,7 @@
},
"packages/util": {
"name": "@welshman/util",
"version": "0.0.21",
"version": "0.0.22",
"license": "MIT",
"dependencies": {
"@welshman/lib": "0.0.11",
+1 -1
View File
@@ -33,7 +33,7 @@
"dependencies": {
"@welshman/lib": "0.0.11",
"@welshman/net": "0.0.14",
"@welshman/util": "0.0.21",
"@welshman/util": "0.0.22",
"nostr-tools": "^2.7.0"
}
}
+1 -1
View File
@@ -31,6 +31,6 @@
"typescript": "~5.1.6"
},
"dependencies": {
"@welshman/util": "0.0.21"
"@welshman/util": "0.0.22"
}
}
+1 -1
View File
@@ -32,7 +32,7 @@
},
"dependencies": {
"@welshman/lib": "0.0.11",
"@welshman/util": "0.0.21",
"@welshman/util": "0.0.22",
"isomorphic-ws": "^5.0.0",
"ws": "^8.16.0"
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@welshman/util",
"version": "0.0.21",
"version": "0.0.22",
"author": "hodlbod",
"license": "MIT",
"description": "A collection of nostr-related utilities.",
+6 -3
View File
@@ -1,4 +1,4 @@
import {flatten, Emitter, max, sortBy, inc, chunk, sleep, uniq, omit, now, range, identity} from '@welshman/lib'
import {flatten, Emitter, sortBy, inc, chunk, sleep, uniq, omit, now, range, identity} from '@welshman/lib'
import {DELETE} from './Kinds'
import {EPOCH, matchFilter} from './Filters'
import {isReplaceable, isTrustedEvent} from './Events'
@@ -203,8 +203,11 @@ export class Repository extends Emitter {
return true
}
isDeleted = (event: TrustedEvent) =>
max([this.deletes.get(event.id) || 0, this.deletes.get(getAddress(event)) || 0]) > event.created_at
isDeletedByAddress = (event: TrustedEvent) => (this.deletes.get(getAddress(event)) || 0) > event.created_at
isDeletedById = (event: TrustedEvent) => (this.deletes.get(event.id) || 0) > event.created_at
isDeleted = (event: TrustedEvent) => this.isDeletedByAddress(event) || this.isDeletedById(event)
// Utilities