utils.ts (548B)
1 import type { JobInputType } from "@radroots/events-bindings"; 2 import type { NostrEventTags } from "../../types/lib.js"; 3 4 export function get_job_input_data_for_marker( 5 tags: NostrEventTags, 6 marker: string, 7 input_type: JobInputType = "event", 8 ): string | undefined { 9 for (const t of tags) { 10 if (t[0] !== "i") continue; 11 if (t[2] !== input_type) continue; 12 const tag_marker = t.length >= 5 ? t[4] : t.length >= 4 ? t[3] : undefined; 13 if (tag_marker === marker) return t[1]; 14 } 15 return undefined; 16 }