feat: support filtered subscriptions
Some checks failed
Build and release / Build (push) Failing after 1m13s
Build and release / update-release-draft (push) Has been skipped
Build and release / Release (push) Has been skipped

This commit is contained in:
Morten Olsen
2025-12-10 23:46:52 +01:00
parent c7f9270ef2
commit 3c475ab5d6
3 changed files with 127 additions and 30 deletions

View File

@@ -28,8 +28,11 @@ class BaseError extends Error {
}
const createApi = async (runtime: StashRuntime = new StashRuntime()) => {
runtime.documents.on('upserted', (document) => {
console.log(document);
runtime.documents.subscribe({
filter: "metadata.foo = 'bar'",
fn: (document) => {
console.log(document);
},
});
const app = fastify().withTypeProvider<ZodTypeProvider>();
app.setValidatorCompiler(validatorCompiler);