Skip to content

Commit aab92cd

Browse files
docs(wac): document full checkAccess() return shape
The @returns for checkAccess() listed only {allowed, wacAllow}, but the function also returns paymentRequired/paid/balance/currency, which callers (and the noDebit test) rely on. Document the full shape.
1 parent cfdf385 commit aab92cd

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/wac/checker.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,18 @@ import { readLedger, getBalance, debit } from '../webledger.js';
2222
* Used by secondary/guard checks (e.g. the POST sidecar Control gate in
2323
* handlePost) so a single request cannot debit twice or charge silently;
2424
* the authoritative debit stays in the primary authorize() hook.
25-
* @returns {Promise<{allowed: boolean, wacAllow: string}>}
25+
* @returns {Promise<{
26+
* allowed: boolean,
27+
* wacAllow: string,
28+
* paymentRequired?: object|null,
29+
* paid?: number,
30+
* balance?: number,
31+
* currency?: string
32+
* }>}
33+
* `paymentRequired` carries the unmet PaymentCondition (present when a paid
34+
* grant is denied, including every `noDebit` denial). `paid`/`balance`/
35+
* `currency` are set only when a debit actually occurred. The no-ACL deny
36+
* path returns just `{allowed, wacAllow}`.
2637
*/
2738
export async function checkAccess({
2839
resourceUrl,

0 commit comments

Comments
 (0)