sundaysebasidian-byte/moonfga/fga does not have a README file

    TupleReader

    pub(open) trait TupleReader {
    fn read(Self, String, String) -> Array[Tuple]
    fn read_userset(Self, String, String) -> Array[Tuple]
    fn all_objects(Self, String) -> Array[String]
    fn all_users(Self) -> Array[String]
    }

    Trait used by the engine to read tuples. Implementations must return tuples visible for the given object and relation (including wildcard and userset tuples). Returned arrays must be caller-owned; all methods must see a consistent snapshot during evaluation. Empty results mean no matching data, never a backend failure. This synchronous trait has no error channel: fallible hosts must load a snapshot successfully before creating an Engine. See examples/tuple-reader for a standalone host and executable contract.

    FgaError

    pub suberror FgaError {
    FgaError(code~ : Int, message~ : String, line~ : Int, column~ : Int)
    }

    Error type shared by the parser, validator, store and engine.

    line and column are 1-based source positions when known; they are -1 for runtime errors that have no source location.

    AuthModel

    pub(all) struct AuthModel {
    schema_version : String
    types : Array[TypeDefinition]
    conditions : Map[String, Condition]
    condition_order : Array[String]
    spans : Map[String, Span]
    metadata : Map[String,
    Json
    ]
    }

    AuthModel::add_condition

    fn AuthModel::add_condition(self : AuthModel, c : Condition) -> Unit

    AuthModel::add_type

    fn AuthModel::add_type(self : AuthModel, t : TypeDefinition) -> Unit

    AuthModel::direct_restrictions

    fn AuthModel::direct_restrictions(self : AuthModel, type_name : String, relation : String) -> Array[TypeRestriction]

    AuthModel::find_condition

    fn AuthModel::find_condition(self : AuthModel, name : String) -> Condition?

    AuthModel::find_type

    fn AuthModel::find_type(self : AuthModel, name : String) -> TypeDefinition?

    AuthModel::new

    fn AuthModel::new(schema_version : String) -> AuthModel

    AuthModel::relation

    fn AuthModel::relation(self : AuthModel, type_name : String, relation : String) -> Userset raise FgaError

    Returns the rewrite for type#relation, raising a typed error when either the type or the relation is missing.

    AuthModel::set_span

    fn AuthModel::set_span(self : AuthModel, key : String, line : Int, column : Int) -> Unit

    AuthModel::span

    fn AuthModel::span(self : AuthModel, key : String) -> Span?

    CelValue

    pub(all) enum CelValue {
    VInt(Int64)
    VUint(UInt64)
    VDouble(Double)
    VBool(Bool)
    VString(String)
    VBytes(Bytes)
    VType(String)
    VProtoEmpty
    VProtoFields(String, CelValue?)
    VKeyMap(Array[(CelValue, CelValue)])
    VDuration(Int64)
    VTimestamp(Int64)
    VTimestampWide(Int64, Int)
    VTimestampPrecise(Int64, Int, Int)
    VList(Array[CelValue])
    VMap(Map[String, CelValue])
    VIp(String)
    VNull
    }

    A CEL runtime value. Durations are stored in nanoseconds and timestamps in milliseconds since the Unix epoch, with an optional sub-millisecond nanosecond remainder for precise RFC3339 inputs.

    CelValue::timestamp_offset

    fn CelValue::timestamp_offset(self : CelValue) -> Int

    Preserved numeric timezone offset used by CEL string(timestamp).

    CelValue::timestamp_parts

    fn CelValue::timestamp_parts(self : CelValue) -> (Int64, Int)?

    Timestamp components: epoch milliseconds and a non-negative nanosecond remainder below one millisecond.

    CelValue::timestamp_seconds

    fn CelValue::timestamp_seconds(self : CelValue) -> (Int64, Int)?

    Epoch seconds and normalized nanoseconds; unlike milliseconds these cover every protobuf int64 timestamp. Comparison follows Go's internal epoch.

    Condition

    pub(all) struct Condition {
    name : String
    expression : String
    parameters : Array[ConditionParam]
    }

    Condition::find_param

    fn Condition::find_param(self : Condition, name : String) -> ConditionParam?

    ConditionParam

    pub(all) struct ConditionParam {
    name : String
    type_name : String
    generic_type : String?
    }

    A condition parameter declaration such as x: int or xs: list<string>.

    ExecutionBudget

    pub struct ExecutionBudget {
    // private fields
    }

    Shared request work counter and optional host deadline/cancellation predicate. Create a fresh budget per request; copies share consumption and terminal state.

    ExecutionBudget::check

    fn ExecutionBudget::check(self : ExecutionBudget) -> Unit raise FgaError

    Checks the host predicate without consuming work. Failure is sticky.

    ExecutionBudget::new

    fn ExecutionBudget::new(steps? : Int, cancelled? : () -> Bool) -> ExecutionBudget

    ExecutionBudget::step

    fn ExecutionBudget::step(self : ExecutionBudget) -> Unit raise FgaError

    Consumes one portable unit of work; this counter is separate from CEL cost.

    Span

    pub(all) struct Span {
    line : Int
    column : Int
    }

    Tuple

    pub(all) struct Tuple {
    object : String
    relation : String
    user : String
    condition : TupleCondition?
    }

    Tuple::condition_name

    fn Tuple::condition_name(self : Tuple) -> String?

    Tuple::has_condition

    fn Tuple::has_condition(self : Tuple) -> Bool

    Tuple::key

    fn Tuple::key(self : Tuple) -> String

    TupleCondition

    pub(all) struct TupleCondition {
    name : String
    context : Map[String, CelValue]
    }

    TypeDefinition

    pub(all) struct TypeDefinition {
    name : String
    relations : Map[String, Userset]
    relation_order : Array[String]
    direct : Map[String, Array[TypeRestriction]]
    }

    TypeDefinition::has_direct

    fn TypeDefinition::has_direct(self : TypeDefinition, name : String) -> Bool

    TypeDefinition::new

    fn TypeDefinition::new(name : String) -> TypeDefinition

    TypeDefinition::relation_rewrite

    fn TypeDefinition::relation_rewrite(self : TypeDefinition, name : String) -> Userset?

    TypeDefinition::restrictions

    fn TypeDefinition::restrictions(self : TypeDefinition, name : String) -> Array[TypeRestriction]

    TypeDefinition::set_relation

    fn TypeDefinition::set_relation(self : TypeDefinition, name : String, rewrite : Userset, restrictions : Array[TypeRestriction]) -> Unit

    TypeRestriction

    pub(all) struct TypeRestriction {
    type_name : String
    relation : String?
    wildcard : Bool
    condition : String?
    }

    A typed wildcard, concrete user, userset or condition-restricted type restriction from directly_related_user_types.

    UserRef

    pub(all) struct UserRef {
    type_name : String
    id : String
    relation : String?
    }

    Resolved form of a tuple user string: type:id, type:* or type:id#relation.

    Userset

    pub(all) enum Userset {
    This
    Computed(String)
    TupleToUserset(String, String)
    Union(Array[Userset])
    Intersection(Array[Userset])
    Difference(Userset, Userset)
    }

    ERR_DEADLINE_EXCEEDED

    let ERR_DEADLINE_EXCEEDED : Int

    Cooperative request deadline/budget failure (OpenFGA deadline_exceeded).

    ERR_INVALID_TUPLE

    let ERR_INVALID_TUPLE : Int

    A tuple is syntactically invalid or does not satisfy type restrictions.

    ERR_INVALID_WRITE

    let ERR_INVALID_WRITE : Int

    Invalid write input.

    ERR_MODEL_NOT_FOUND

    let ERR_MODEL_NOT_FOUND : Int

    Authorization model not found.

    ERR_RELATION_NOT_FOUND

    let ERR_RELATION_NOT_FOUND : Int

    A relation referenced by a request does not exist on the type.

    ERR_RESOLUTION_TOO_COMPLEX

    let ERR_RESOLUTION_TOO_COMPLEX : Int

    Resolution exceeded the maximum relation rewrite depth.

    ERR_TYPE_NOT_FOUND

    let ERR_TYPE_NOT_FOUND : Int

    A type referenced by a request does not exist in the model.

    ERR_UNKNOWN_CONDITION

    let ERR_UNKNOWN_CONDITION : Int

    A referenced condition name is unknown.

    ERR_VALIDATION

    let ERR_VALIDATION : Int

    Validation error raised by request or model validation.

    MAX_RESOLUTION_DEPTH

    let MAX_RESOLUTION_DEPTH : Int

    Maximum relation rewrite depth used by OpenFGA.

    cel_map_find

    fn cel_map_find(entries : Array[(CelValue, CelValue)], key : CelValue) -> CelValue?

    Typed keys take precedence; cross-numeric fallback must be exact, rather than using CEL's mixed-double value-equality rounding.

    cel_numeric_compare

    fn cel_numeric_compare(a : CelValue, b : CelValue) -> Int?

    cel-go's mixed double comparison rounds the integer to binary64. Perform ties-to-even in the integer domain; same-type integer comparison stays exact.

    cel_value_eq

    fn cel_value_eq(a : CelValue, b : CelValue) -> Bool

    Structural equality with numeric coercion, used by CEL == and by the store when de-duplicating tuples.

    cel_value_size

    fn cel_value_size(value : CelValue) -> Int

    CEL's observable cost-model size, not a serialized byte length.

    cel_value_to_display

    fn cel_value_to_display(value : CelValue) -> String

    cel_value_to_json

    fn cel_value_to_json(value : CelValue) ->
    Json

    cel_value_type_name

    fn cel_value_type_name(value : CelValue) -> String

    context_from_json

    fn context_from_json(value :
    Json
    ?) -> Map[String, CelValue] raise FgaError

    error_code

    fn error_code(err : FgaError) -> Int

    error_message

    fn error_message(err : FgaError) -> String

    fail

    fn fail(code : Int, message : String) -> FgaError

    fail_at

    fn fail_at(code : Int, message : String, line : Int, column : Int) -> FgaError

    format_error

    fn format_error(err : FgaError) -> String

    is_valid_object

    fn is_valid_object(object : String) -> Bool

    is_valid_user

    fn is_valid_user(user : String) -> Bool

    True when the user string is syntactically valid OpenFGA user syntax.

    json_get_array

    fn json_get_array(value :
    Json
    , key : String) -> Array[
    Json
    ]

    json_get_bool

    fn json_get_bool(value :
    Json
    , key : String) -> Bool?

    json_get_object

    fn json_get_object(value :
    Json
    , key : String) ->
    Json
    ?

    json_get_string

    fn json_get_string(value :
    Json
    , key : String) -> String?

    json_object_get

    fn json_object_get(value :
    Json
    , key : String) ->
    Json
    ?

    json_object_to_value_map

    fn json_object_to_value_map(value :
    Json
    ) -> Map[String, CelValue] raise FgaError

    json_to_cel_value_raw

    fn json_to_cel_value_raw(value :
    Json
    ) -> CelValue

    matching_restriction_condition

    fn matching_restriction_condition(restrictions : Array[TypeRestriction], user : String) -> String? raise FgaError

    Returns the condition name permitted for a matching restriction facet, or None when the facet is unconditional.

    numeric_compare

    fn numeric_compare(a : CelValue, b : CelValue) -> Int?

    Compare without first rounding an integer to binary64. NaN is unordered.

    object_id

    fn object_id(object : String) -> String

    object_type

    fn object_type(object : String) -> String

    parse_user_ref

    fn parse_user_ref(user : String) -> UserRef?

    render_user_ref

    fn render_user_ref(u : UserRef) -> String

    Renders a user ref back to canonical OpenFGA syntax.

    restrictions_allow

    fn restrictions_allow(restrictions : Array[TypeRestriction], user : String) -> Bool

    Validates a concrete tuple user against the direct restrictions of a relation. This is the type-restriction filter applied when reading tuples.

    timestamp_from_seconds

    fn timestamp_from_seconds(seconds : Int64, nanos : Int64, offset? : Int) -> CelValue

    timestamp_to_rfc3339

    fn timestamp_to_rfc3339(value : CelValue) -> String

    CEL/condition JSON timestamp formatting. Preserve the input numeric timezone and nanoseconds; equality and arithmetic still compare the UTC instant.

    timestamp_value

    fn timestamp_value(ms : Int64, remainder : Int64, offset? : Int) -> CelValue

    Normalizes a timestamp remainder without narrowing the supported year range.

    tuple_from_json

    fn tuple_from_json(value :
    Json
    ) -> Tuple raise FgaError

    tuple_from_string

    fn tuple_from_string(raw : String) -> Tuple raise FgaError

    Parses the OpenFGA text form object#relation@user and the optional condition suffix [name:{"param": 1}].

    tuple_user_matches

    fn tuple_user_matches(u : UserRef, user : String) -> Bool

    tuples_from_json

    fn tuples_from_json(value :
    Json
    ?) -> Array[Tuple] raise FgaError

    tuples_from_text

    fn tuples_from_text(source : String) -> Array[Tuple] raise FgaError

    Reads one tuple per line, ignoring blank lines and # comments.

    user_type_name

    fn user_type_name(user : String) -> String