import { defineQuery } from '@voltro/protocol' import { Schema } from 'effect' export const listOrders = defineQuery({ name: 'orders.list', source: 'orders', // Open: `tenant()` confines every delivery to the tenantId on the request, so // one tenant's orders never reach another's subscription, and the rows carry // only sku / amount / status — no customer identity. With no auth strategy // configured that tenantId is the caller's own `x-tenant` header, and a // `guards: [{ scope }]` would be unsatisfiable: an anonymous Subject holds no // scopes, so the guard would deny 100% of traffic. openAccess: 'lists the request tenant\'s own orders (sku, amount, status — no customer identity); ' + '`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:`.', input: Schema.Struct({}), output: Schema.Array(Schema.Struct({ id: Schema.String, sku: Schema.String, totalCents: Schema.Number, status: Schema.String, tenantId: Schema.String, })), })