mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 21:02:28 +00:00
chore(ai): event schema validation tool + fixes
- Created `scripts/agent/validate-events.mjs` to verify all event builders produce valid events against the schema. - Instrumented `js/nostr/nip71.js` to validate NIP-71 events during construction (other builders in `js/nostrEventSchemas.js` were already instrumented). - Validated all 25 event types using the new tool. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
73c705831b
commit
39c4e2249d
2 files changed
+258
-248
No files matched your search
+12
-1
@@ -6,6 +6,10 @@ import {
|
||||
resolveInfoJsonUrl,
|
||||
} from "../utils/storagePointer.js";
|
||||
import { getCachedNostrTools } from "./toolkit.js";
|
||||
import {
|
||||
validateEventAgainstSchema,
|
||||
NOTE_TYPES,
|
||||
} from "../nostrEventSchemas.js";
|
||||
|
||||
function stringFromInput(value) {
|
||||
if (value === null || value === undefined) {
|
||||
@@ -934,13 +938,20 @@ export function buildNip71VideoEvent({
|
||||
tags.push(...pointerTags);
|
||||
}
|
||||
|
||||
return {
|
||||
const event = {
|
||||
kind: normalizeNip71Kind(metadata.kind),
|
||||
pubkey: normalizedPubkey,
|
||||
created_at: timestamp,
|
||||
tags,
|
||||
content: summary,
|
||||
};
|
||||
|
||||
validateEventAgainstSchema(
|
||||
event.kind === 22 ? NOTE_TYPES.NIP71_SHORT_VIDEO : NOTE_TYPES.NIP71_VIDEO,
|
||||
event,
|
||||
);
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
export function collectNip71PointerRequests(videos = []) {
|
||||
|
||||
Reference in new issue
Block a user