clone

a deno framework for local-first web apps that open instantly, work offline and sync when users choose

feat/141-demo-review-fixes
lofi / package / access / mod.ts
mod.ts 2.7K
1/**2 * Narrow private, direct-share, fixed-role group, and shared-field access3 * templates over raw Jazz schemas.4 *5 * Use {@link privateAccess}, {@link sharedAccess}, {@link groupAccess}, or6 * {@link sharedFieldAccess} to declare common authorization models. Runtime7 * operations require managed sync for collaboration and throw8 * {@link AccessError} when that precondition is not met. Raw Jazz policy9 * callbacks remain available through {@link defineAccessPolicies}.10 *11 * Group and sharing operations raise two catchable error families:12 * {@link AccessError} (narrow with {@link isAccessError}) for configuration,13 * identity, sync, and mutation failures, and {@link SharedFieldError} (narrow14 * with {@link isSharedFieldError}) when shared-field key material cannot be15 * established or reconciled.16 *17 * Shared-field hosting spans three entries. `@nzip/lofi/schema` declares the18 * encrypted columns (`s.sharedEncryptedText`, `s.sharedEncryptedJson`). This19 * entry compiles the directory and wrapped-key policies and runs the key20 * lifecycle through {@link createGroupOperations}: creation bootstraps the21 * first key and `reconcileSharedFieldKeys` repairs missing wraps. Pin22 * remediation for changed peer keys ({@link trustPeerKey}, with23 * `pinnedFingerprint` for inspection) lives on the main `@nzip/lofi` entry;24 * `trustPeerKey` is re-exported here because re-trusting a peer is an25 * authorization decision.26 *27 * @module28 */29export { AccessError, type AccessErrorCode, isAccessError } from "./errors.ts";30export {31 isSharedFieldError,32 SharedFieldError,33 type SharedFieldErrorCode,34} from "../schema/shared-crypto.ts";35export { trustPeerKey } from "../runtime/shared-field-keys.ts";36export {37 decodeSharingIdentity,38 decodeSharingIdentityDetails,39 encodeSharingIdentity,40 type SharingIdentity,41 sharingIdentity,42 type SharingIdentityDetails,43} from "./identity.ts";44export {45 type AccessRuntimeTable,46 createGroupOperations,47 createSharingOperations,48 type GroupMembershipRow,49 type GroupOperations,50 type GroupOperationsConfig,51 type Identified,52 type SharedGrantRow,53 type ShareLevel,54 type SharingOperations,55 type SharingOperationsConfig,56} from "./operations.ts";57export {58 type AccessTable,59 type AccessTemplate,60 defineAccessPolicies,61 groupAccess,62 type GroupAccessTemplate,63 privateAccess,64 type PrivateAccessTemplate,65 type RawAccessPolicyContext,66 type RawAccessPolicyExtension,67 type RuleBuilder,68 sharedAccess,69 type SharedAccessTemplate,70 sharedFieldAccess,71 type SharedFieldAccessTemplate,72 type TablePolicy,73} from "./policies.ts";74export {75 groupMembershipTable,76 type GroupRole,77 groupRoleCapabilities,78 groupRoles,79 sharedFieldDirectoryTable,80 sharedFieldKeyTable,81 sharedGrantTable,82} from "./schema.ts";