// `events.list` — DESCRIPTOR (browser-safe). // // A reactive subscription over the synced ROWS (which live in `ctx.store`, not // `ctx.kv`). This is the contrast the template is built around: the rows are // relational data you query/stream; the cursor + markers that produced them are // durable KV. The runtime AND-merges the caller's tenant scope via the // `tenant()` mixin — no manual `eq('tenantId', …)` needed. import { defineQuery } from '@voltro/protocol' import { Schema } from 'effect' export const listEvents = defineQuery({ name: 'events.list', // Open: `tenant()` confines every delivery to the tenantId on the request, so // one caller's synced rows never reach another's subscription. With no auth // strategy configured that tenantId is the caller's own `x-tenant` header — // it shapes the feed, it does not authorize the caller — and a // `guards: [{ scope }]` would be unsatisfiable, denying 100% of traffic. openAccess: 'streams the synced event rows of the request\'s tenant (`tenant()` scopes every ' + 'delivery); the rows are this demo\'s own generated events. No auth strategy ships here, ' + 'so the tenant comes from the caller\'s `x-tenant` header — add a strategy, then a `guards:`.', input: Schema.Struct({}), output: Schema.Array( Schema.Struct({ id: Schema.String, externalId: Schema.String, kind: Schema.String, sequence: Schema.Number, tenantId: Schema.String, createdAt: Schema.Date, }), ), })