@authzed/authzed-node
Version:
authzed client for nodejs
291 lines (290 loc) • 11.3 kB
TypeScript
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
import type { IBinaryWriter } from "@protobuf-ts/runtime";
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
import type { IBinaryReader } from "@protobuf-ts/runtime";
import type { PartialMessage } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { PartialCaveatInfo } from "./core.js";
import { Struct } from "../../../google/protobuf/struct.js";
import { Timestamp } from "../../../google/protobuf/timestamp.js";
import { Duration } from "../../../google/protobuf/duration.js";
import { SubjectReference } from "./core.js";
import { ObjectReference } from "./core.js";
/**
* DebugInformation defines debug information returned by an API call in a footer when
* requested with a specific debugging header.
*
* The specific debug information returned will depend on the type of the API call made.
*
* See the github.com/authzed/authzed-go project for the specific header and footer names.
*
* @generated from protobuf message authzed.api.v1.DebugInformation
*/
export interface DebugInformation {
/**
* check holds debug information about a check request.
*
* @generated from protobuf field: authzed.api.v1.CheckDebugTrace check = 1;
*/
check?: CheckDebugTrace;
/**
* schema_used holds the schema used for the request.
*
* @generated from protobuf field: string schema_used = 2;
*/
schemaUsed: string;
}
/**
* CheckDebugTrace is a recursive trace of the requests made for resolving a CheckPermission
* API call.
*
* @generated from protobuf message authzed.api.v1.CheckDebugTrace
*/
export interface CheckDebugTrace {
/**
* resource holds the resource on which the Check was performed.
* for batched calls, the object_id field contains a comma-separated list of object IDs
* for all the resources checked in the batch.
*
* @generated from protobuf field: authzed.api.v1.ObjectReference resource = 1;
*/
resource?: ObjectReference;
/**
* permission holds the name of the permission or relation on which the Check was performed.
*
* @generated from protobuf field: string permission = 2;
*/
permission: string;
/**
* permission_type holds information indicating whether it was a permission or relation.
*
* @generated from protobuf field: authzed.api.v1.CheckDebugTrace.PermissionType permission_type = 3;
*/
permissionType: CheckDebugTrace_PermissionType;
/**
* subject holds the subject on which the Check was performed. This will be static across all calls within
* the same Check tree.
*
* @generated from protobuf field: authzed.api.v1.SubjectReference subject = 4;
*/
subject?: SubjectReference;
/**
* result holds the result of the Check call.
*
* @generated from protobuf field: authzed.api.v1.CheckDebugTrace.Permissionship result = 5;
*/
result: CheckDebugTrace_Permissionship;
/**
* caveat_evaluation_info holds information about the caveat evaluated for this step of the trace.
*
* @generated from protobuf field: authzed.api.v1.CaveatEvalInfo caveat_evaluation_info = 8;
*/
caveatEvaluationInfo?: CaveatEvalInfo;
/**
* duration holds the time spent executing this Check operation.
*
* @generated from protobuf field: google.protobuf.Duration duration = 9;
*/
duration?: Duration;
/**
* @generated from protobuf oneof: resolution
*/
resolution: {
oneofKind: "wasCachedResult";
/**
* was_cached_result, if true, indicates that the result was found in the cache and returned directly.
*
* @generated from protobuf field: bool was_cached_result = 6;
*/
wasCachedResult: boolean;
} | {
oneofKind: "subProblems";
/**
* sub_problems holds the sub problems that were executed to resolve the answer to this Check. An empty list
* and a permissionship of PERMISSIONSHIP_HAS_PERMISSION indicates the subject was found within this relation.
*
* @generated from protobuf field: authzed.api.v1.CheckDebugTrace.SubProblems sub_problems = 7;
*/
subProblems: CheckDebugTrace_SubProblems;
} | {
oneofKind: undefined;
};
/**
* optional_expires_at is the time at which at least one of the relationships used to
* compute this result, expires (if any). This is *not* related to the caching window.
*
* @generated from protobuf field: google.protobuf.Timestamp optional_expires_at = 10;
*/
optionalExpiresAt?: Timestamp;
/**
* trace_operation_id is a unique identifier for this trace's operation, that will
* be shared for all traces created for the same check operation in SpiceDB.
*
* In cases where SpiceDB performs automatic batching of subproblems, this ID can be used
* to correlate work that was shared across multiple traces.
*
* This identifier is generated by SpiceDB, is to be considered opaque to the caller
* and only guaranteed to be unique within the same overall Check or CheckBulk operation.
*
* @generated from protobuf field: string trace_operation_id = 11;
*/
traceOperationId: string;
/**
* source holds the source of the result. It is of the form:
* `<sourcetype>:<sourceid>`, where sourcetype can be, among others:
* `spicedb`, `materialize`, etc.
*
* @generated from protobuf field: string source = 12;
*/
source: string;
}
/**
* @generated from protobuf message authzed.api.v1.CheckDebugTrace.SubProblems
*/
export interface CheckDebugTrace_SubProblems {
/**
* @generated from protobuf field: repeated authzed.api.v1.CheckDebugTrace traces = 1;
*/
traces: CheckDebugTrace[];
}
/**
* @generated from protobuf enum authzed.api.v1.CheckDebugTrace.PermissionType
*/
export declare enum CheckDebugTrace_PermissionType {
/**
* @generated from protobuf enum value: PERMISSION_TYPE_UNSPECIFIED = 0;
*/
UNSPECIFIED = 0,
/**
* @generated from protobuf enum value: PERMISSION_TYPE_RELATION = 1;
*/
RELATION = 1,
/**
* @generated from protobuf enum value: PERMISSION_TYPE_PERMISSION = 2;
*/
PERMISSION = 2
}
/**
* @generated from protobuf enum authzed.api.v1.CheckDebugTrace.Permissionship
*/
export declare enum CheckDebugTrace_Permissionship {
/**
* @generated from protobuf enum value: PERMISSIONSHIP_UNSPECIFIED = 0;
*/
UNSPECIFIED = 0,
/**
* @generated from protobuf enum value: PERMISSIONSHIP_NO_PERMISSION = 1;
*/
NO_PERMISSION = 1,
/**
* @generated from protobuf enum value: PERMISSIONSHIP_HAS_PERMISSION = 2;
*/
HAS_PERMISSION = 2,
/**
* @generated from protobuf enum value: PERMISSIONSHIP_CONDITIONAL_PERMISSION = 3;
*/
CONDITIONAL_PERMISSION = 3
}
/**
* CaveatEvalInfo holds information about a caveat expression that was evaluated.
*
* @generated from protobuf message authzed.api.v1.CaveatEvalInfo
*/
export interface CaveatEvalInfo {
/**
* expression is the expression that was evaluated.
*
* @generated from protobuf field: string expression = 1;
*/
expression: string;
/**
* result is the result of the evaluation.
*
* @generated from protobuf field: authzed.api.v1.CaveatEvalInfo.Result result = 2;
*/
result: CaveatEvalInfo_Result;
/**
* context consists of any named values that were used for evaluating the caveat expression.
*
* @generated from protobuf field: google.protobuf.Struct context = 3;
*/
context?: Struct;
/**
* partial_caveat_info holds information of a partially-evaluated caveated response, if applicable.
*
* @generated from protobuf field: authzed.api.v1.PartialCaveatInfo partial_caveat_info = 4;
*/
partialCaveatInfo?: PartialCaveatInfo;
/**
* caveat_name is the name of the caveat that was executed, if applicable.
*
* @generated from protobuf field: string caveat_name = 5;
*/
caveatName: string;
}
/**
* @generated from protobuf enum authzed.api.v1.CaveatEvalInfo.Result
*/
export declare enum CaveatEvalInfo_Result {
/**
* @generated from protobuf enum value: RESULT_UNSPECIFIED = 0;
*/
UNSPECIFIED = 0,
/**
* @generated from protobuf enum value: RESULT_UNEVALUATED = 1;
*/
UNEVALUATED = 1,
/**
* @generated from protobuf enum value: RESULT_FALSE = 2;
*/
FALSE = 2,
/**
* @generated from protobuf enum value: RESULT_TRUE = 3;
*/
TRUE = 3,
/**
* @generated from protobuf enum value: RESULT_MISSING_SOME_CONTEXT = 4;
*/
MISSING_SOME_CONTEXT = 4
}
declare class DebugInformation$Type extends MessageType<DebugInformation> {
constructor();
create(value?: PartialMessage<DebugInformation>): DebugInformation;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DebugInformation): DebugInformation;
internalBinaryWrite(message: DebugInformation, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message authzed.api.v1.DebugInformation
*/
export declare const DebugInformation: DebugInformation$Type;
declare class CheckDebugTrace$Type extends MessageType<CheckDebugTrace> {
constructor();
create(value?: PartialMessage<CheckDebugTrace>): CheckDebugTrace;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CheckDebugTrace): CheckDebugTrace;
internalBinaryWrite(message: CheckDebugTrace, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message authzed.api.v1.CheckDebugTrace
*/
export declare const CheckDebugTrace: CheckDebugTrace$Type;
declare class CheckDebugTrace_SubProblems$Type extends MessageType<CheckDebugTrace_SubProblems> {
constructor();
create(value?: PartialMessage<CheckDebugTrace_SubProblems>): CheckDebugTrace_SubProblems;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CheckDebugTrace_SubProblems): CheckDebugTrace_SubProblems;
internalBinaryWrite(message: CheckDebugTrace_SubProblems, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message authzed.api.v1.CheckDebugTrace.SubProblems
*/
export declare const CheckDebugTrace_SubProblems: CheckDebugTrace_SubProblems$Type;
declare class CaveatEvalInfo$Type extends MessageType<CaveatEvalInfo> {
constructor();
create(value?: PartialMessage<CaveatEvalInfo>): CaveatEvalInfo;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CaveatEvalInfo): CaveatEvalInfo;
internalBinaryWrite(message: CaveatEvalInfo, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message authzed.api.v1.CaveatEvalInfo
*/
export declare const CaveatEvalInfo: CaveatEvalInfo$Type;
export {};