@authzed/authzed-node
Version:
authzed client for nodejs
195 lines (194 loc) • 8.41 kB
TypeScript
import { ServiceType } from "@protobuf-ts/runtime-rpc";
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 { SubjectReference } from "../../v1/core.js";
import { ObjectReference } from "../../v1/core.js";
import { ZedToken } from "../../v1/core.js";
/**
* @generated from protobuf message authzed.api.materialize.v0.WatchPermissionsRequest
*/
export interface WatchPermissionsRequest {
/**
* permissions is a list of permissions to watch for changes. At least one permission must be specified, and it must
* be a subset or equal to the permissions that were enabled for the service.
*
* @generated from protobuf field: repeated authzed.api.materialize.v0.WatchedPermission permissions = 1;
*/
permissions: WatchedPermission[];
/**
* optional_starting_after is the revision token to start watching from. If not provided, the stream
* will start from the current revision at the moment of the request.
*
* @generated from protobuf field: authzed.api.v1.ZedToken optional_starting_after = 2;
*/
optionalStartingAfter?: ZedToken;
}
/**
* @generated from protobuf message authzed.api.materialize.v0.WatchedPermission
*/
export interface WatchedPermission {
/**
* resource_type is the type of the resource to watch for changes.
*
* @generated from protobuf field: string resource_type = 1;
*/
resourceType: string;
/**
* permission is the permission to watch for changes.
*
* @generated from protobuf field: string permission = 2;
*/
permission: string;
/**
* subject_type is the type of the subject to watch for changes.
*
* @generated from protobuf field: string subject_type = 3;
*/
subjectType: string;
/**
* optional_subject_relation is the relation on the subject to watch for changes.
*
* @generated from protobuf field: string optional_subject_relation = 4;
*/
optionalSubjectRelation: string;
}
/**
* @generated from protobuf message authzed.api.materialize.v0.WatchPermissionsResponse
*/
export interface WatchPermissionsResponse {
/**
* @generated from protobuf oneof: response
*/
response: {
oneofKind: "change";
/**
* change is the computed permission delta that has occurred as result of a mutation in origin SpiceDB.
* The consumer should apply this change to the current state of the computed permissions in their target system.
* Once an event arrives with completed_revision instead, the consumer shall consider there are not more changes
* originating from that revision.
*
* The consumer should keep track of the revision in order to resume streaming in the event of consumer restarts.
*
* @generated from protobuf field: authzed.api.materialize.v0.PermissionChange change = 1;
*/
change: PermissionChange;
} | {
oneofKind: "completedRevision";
/**
* completed_revision is the revision token that indicates all changes originating from a revision have been
* streamed and thus the revision should be considered completed. It may also be
* received without accompanying set of changes, indicating that a mutation in the origin SpiceDB cluster did
* not yield any effective changes in the computed permissions
*
* @generated from protobuf field: authzed.api.v1.ZedToken completed_revision = 2;
*/
completedRevision: ZedToken;
} | {
oneofKind: undefined;
};
}
/**
* @generated from protobuf message authzed.api.materialize.v0.PermissionChange
*/
export interface PermissionChange {
/**
* revision represents the revision at which the change occurred.
*
* @generated from protobuf field: authzed.api.v1.ZedToken revision = 1;
*/
revision?: ZedToken;
/**
* resource is the resource that the permission change is related to.
*
* @generated from protobuf field: authzed.api.v1.ObjectReference resource = 2;
*/
resource?: ObjectReference;
/**
* permission is the permission that has changed.
*
* @generated from protobuf field: string permission = 3;
*/
permission: string;
/**
* subject is the subject that the permission change is related to.
*
* @generated from protobuf field: authzed.api.v1.SubjectReference subject = 4;
*/
subject?: SubjectReference;
/**
* permissionship is the new permissionship of the subject over the resource after the change.
*
* @generated from protobuf field: authzed.api.materialize.v0.PermissionChange.Permissionship permissionship = 5;
*/
permissionship: PermissionChange_Permissionship;
}
/**
* @generated from protobuf enum authzed.api.materialize.v0.PermissionChange.Permissionship
*/
export declare enum PermissionChange_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
}
declare class WatchPermissionsRequest$Type extends MessageType<WatchPermissionsRequest> {
constructor();
create(value?: PartialMessage<WatchPermissionsRequest>): WatchPermissionsRequest;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: WatchPermissionsRequest): WatchPermissionsRequest;
internalBinaryWrite(message: WatchPermissionsRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message authzed.api.materialize.v0.WatchPermissionsRequest
*/
export declare const WatchPermissionsRequest: WatchPermissionsRequest$Type;
declare class WatchedPermission$Type extends MessageType<WatchedPermission> {
constructor();
create(value?: PartialMessage<WatchedPermission>): WatchedPermission;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: WatchedPermission): WatchedPermission;
internalBinaryWrite(message: WatchedPermission, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message authzed.api.materialize.v0.WatchedPermission
*/
export declare const WatchedPermission: WatchedPermission$Type;
declare class WatchPermissionsResponse$Type extends MessageType<WatchPermissionsResponse> {
constructor();
create(value?: PartialMessage<WatchPermissionsResponse>): WatchPermissionsResponse;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: WatchPermissionsResponse): WatchPermissionsResponse;
internalBinaryWrite(message: WatchPermissionsResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message authzed.api.materialize.v0.WatchPermissionsResponse
*/
export declare const WatchPermissionsResponse: WatchPermissionsResponse$Type;
declare class PermissionChange$Type extends MessageType<PermissionChange> {
constructor();
create(value?: PartialMessage<PermissionChange>): PermissionChange;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PermissionChange): PermissionChange;
internalBinaryWrite(message: PermissionChange, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message authzed.api.materialize.v0.PermissionChange
*/
export declare const PermissionChange: PermissionChange$Type;
/**
* @generated ServiceType for protobuf service authzed.api.materialize.v0.WatchPermissionsService
*/
export declare const WatchPermissionsService: ServiceType;
export {};