Split app/core up into domain-oriented files

This commit is contained in:
Jon Staab
2026-06-08 15:33:38 -07:00
parent ea6b63de53
commit 926b31de78
171 changed files with 2902 additions and 2628 deletions
+28
View File
@@ -0,0 +1,28 @@
import type {TrustedEvent} from "@welshman/util"
import {DELETE, getTag, makeEvent} from "@welshman/util"
import {publishThunk, tagEvent} from "@welshman/app"
import {PROTECTED} from "@app/groups"
export type DeleteParams = {
protect: boolean
event: TrustedEvent
tags?: string[][]
}
export const makeDelete = ({protect, event, tags = []}: DeleteParams) => {
const thisTags = [["k", String(event.kind)], ...tagEvent(event), ...tags]
const groupTag = getTag("h", event.tags)
if (groupTag) {
thisTags.push(groupTag)
}
if (protect) {
thisTags.push(PROTECTED)
}
return makeEvent(DELETE, {tags: thisTags})
}
export const publishDelete = ({relays, ...params}: DeleteParams & {relays: string[]}) =>
publishThunk({event: makeDelete(params), relays})