GuardAgent.authorize
function · packages/guard/src/agent.ts:66
authorize<Input, Model>(
interaction: 'Update' | 'Delete' | InteractionKey,
row: (request: { readonly input: Input; readonly model: Model }) => MayRow,
): (request: {
readonly input: Input
readonly model: Model
}) => boolean | { readonly allowed: false; readonly reason: string }A capability's authorize: the row the request names, read from the
Model, must not refuse the principal interaction. A row not read yet,
or whose read failed, refuses: there is no row to act on, and a refusal
may be why. A row whose answer does not say (its rule reads another row)
is allowed: the server decides. A refusal its rule explained says so, as
the agent's error.
ts
authorize: GuardAgent.authorize(Archive.key, ({ input, model }) =>
Data.get(TodoRow, input.id).read(model),
)