@zanzibar-ts/model
v0.1.0
Published
Shared vocabulary for the zanzibar-ts packages — OpenFGA JSON model types, the expand-tree shape, and the error categories
Maintainers
Readme
@zanzibar-ts/model
The shared vocabulary underneath the zanzibar-ts packages:
the OpenFGA JSON model types (OpenFgaJsonModel and friends), the expand-tree shape, and
the error categories (ErrorCategory / ERROR_CATEGORIES).
Most applications want
@zanzibar-ts/core— the authorization engine — which depends on this package and re-exports what you need. Depend on@zanzibar-ts/modeldirectly only when you handle the OpenFGA JSON wire shapes or the error vocabulary without the engine.
import { deepStrictEqual as assertEquals } from 'node:assert/strict';
import { ERROR_CATEGORIES } from '@zanzibar-ts/model/errors';
import type { ErrorCategory } from '@zanzibar-ts/model/errors';
// the closed set of failure categories every read Result can carry
const conditionError: ErrorCategory = 'condition_error';
assertEquals(ERROR_CATEGORIES.includes(conditionError), true);Entry points: @zanzibar-ts/model/openfga-model (the JSON model IR), @zanzibar-ts/model/expand-tree
(the OpenFGA-shaped shallow expand tree), @zanzibar-ts/model/errors (the error contract — see the
error reference).
License
MIT
