effx
API reference@effx/runtime

authority

API reference for @effx/runtime/authority

authority.ts overview


Exports Grouped by Category


utils

Capability

A kind of authority over a model, optionally narrowed to a focus. Nothing else of the authority model exists yet.

Example

import { Capability, Focus } from "@effx/runtime"
import { Schema } from "effect"
import assert from "node:assert"

const User = Schema.Struct({ id: Schema.String, email: Schema.String })
const ChangeEmail = Capability.make("User.ChangeEmail", {
  resource: User,
  focus: Focus.key(User, "email")
})

assert.strictEqual(ChangeEmail.name, "User.ChangeEmail")
assert.deepStrictEqual(ChangeEmail.focus?.path, ["email"])

Signature

declare const Capability: {
  make: (name: string, options: { readonly resource: Schema.Top; readonly focus?: FocusValue }) => CapabilityValue
  one: (cap: string) => { readonly _tag: "One"; readonly capability: string }
  any: (first: string, ...rest: string[]) => MultipleVariant<"Any">
  all: (first: string, ...rest: string[]) => MultipleVariant<"All">
  none: { readonly _tag: "None" }
}

Concealment

Source-only HTTP concealment policy values; authorization remains with the application.

Signature

declare const Concealment: {
  reveal: { readonly _tag: "Reveal" }
  notFound: (firstStage: string, ...rest: string[]) => { readonly _tag: "NotFound"; readonly stages: NonEmptyStrings }
}

Focus

Serializable focus identity (ADR 0007): a model root plus a key path. Optics are a later runtime mechanism.

Signature

declare const Focus: { key: (root: Schema.Top, ...path: ReadonlyArray<string>) => FocusValue }

On this page