import { defineQuery } from '@voltro/protocol' import { Schema } from 'effect' export const listNotes = defineQuery({ name: 'notes.list', source: 'notes', // Open: `tenant()` confines every delivery to the tenantId on the request, so // one tenant's notes never reach another's subscription. With no auth // strategy configured that tenantId comes from the caller's own `x-tenant` // header — result shaping, not access control — and a `guards: [{ scope }]` // would be unsatisfiable, denying 100% of traffic rather than some of it. // // Worth stating in the OBSERVABILITY template specifically: a denied call is // still a span and still a metric. Traces show you what happened, not who was // allowed to make it happen. openAccess: 'lists notes for the request\'s tenant only (`tenant()` scopes every delivery). No auth ' + 'strategy ships here, so the tenant comes from the caller\'s `x-tenant` header — add a ' + 'strategy, then a `guards:`. Tracing records calls; it does not authorize them.', input: Schema.Struct({}), output: Schema.Array(Schema.Struct({ id: Schema.String, title: Schema.String, body: Schema.String, done: Schema.Boolean, })), })