I've had a crack at building customizable validation for records as they're ingested (from jetstream, from backfill, or when created with a mutation).
With this PR, quickslices imports CommonJS "validatior" scripts from the lexicons.zip when paired with the lexicon JSON (eg. a app/bsky/feed/post.js next to app/bsky/feed/post.json), and then uses a partner NodeJS worker to only ingest records which the relevant function returns true (or Promise<true>) for.
The CommonJS must export a default function, and must return a boolean, or a Promise of a boolean:
exports.default = function(record) {
return !record.text?.startsWith('X');
}
Please note: This is the first time I've worked with Gleam (and I've only barely touched Erlang)! I've tested this with my own use case, but this was heavily driven by an AI โ I'd appreciate a thorough critique and any pointers!
Fixes #5