Skip to content

ISnapshot

Defined in: src/types/ISnapshot.ts:24

A complete, serializable picture of an AccessControl instance — everything needed to reconstruct it. Produced by AccessControl#snapshot and consumed by AccessControl#restore.

It bundles the three structures that otherwise persist separately:

  • grants — the role → resource → action rules (incl. conditions & $extend).
  • requirements — the require() gates, by scope.
  • vocabulary — the setup() input (groups, categories, custom actions).

All three are plain JSON, so a snapshot round-trips through JSON.stringify / a JSONB column and back:

const snap = ac.snapshot();
await db.savePolicy(JSON.stringify(snap));
// …later, on boot:
const ac2 = new AccessControl().restore(await db.loadPolicy());

grants: IGrants

Defined in: src/types/ISnapshot.ts:26

Grant rules in object form (the AccessControl#getGrants shape).


requirements: IRequirements

Defined in: src/types/ISnapshot.ts:28

require() gates by scope (the AccessControl#getRequirements shape).


vocabulary: ISetup

Defined in: src/types/ISnapshot.ts:30

setup() vocabulary — groups, categories and custom actions.