// The live incident feed — the heart of the status page. Deliberately OPEN, so // an anonymous visitor's browser can subscribe: `useSubscription('app', // 'incidents.live')`. Every insert/update to `incidents` lands as a delta, so a // newly-declared incident (or a resolve) shows up on every open status page // within seconds — no polling. // // This template is the clearest place in the library to see that `openAccess:` // and `guards:` are two spellings of the SAME obligation, not a strict option // and a lax one. The reads here are open on purpose; the four mutations beside // them carry `guards: [{ scope: 'status:write' }]` and are satisfiable through // the real role map in `authz.ts`. Both are decisions. What the framework // refuses to boot on is neither. import { defineQuery } from '@voltro/protocol' import { Schema } from 'effect' export const incidentsLive = defineQuery({ name: 'incidents.live', openAccess: 'the public incident feed a status page exists to publish — title, impact, status and ' + 'timestamps of THIS operator\'s own incidents, nothing caller-derived and no personal ' + 'data. A status page that requires a login is useless during the outage it reports.', input: Schema.Struct({}), output: Schema.Array( Schema.Struct({ id: Schema.String, title: Schema.String, impact: Schema.String, status: Schema.String, startedAt: Schema.Date, resolvedAt: Schema.NullOr(Schema.Date), }), ), })