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 857d4f0b42
2 changed files with 65 additions and 29 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);