UNPKG

@authzed/authzed-node

Version:
151 lines (150 loc) 6.5 kB
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 { Struct } from "../../../google/protobuf/struct.js"; import { RelationshipUpdate } from "./core.js"; import { RelationshipFilter } from "./permission_service.js"; import { ZedToken } from "./core.js"; /** * WatchRequest specifies what mutations to watch for, and an optional start snapshot for when to start * watching. * * @generated from protobuf message authzed.api.v1.WatchRequest */ export interface WatchRequest { /** * optional_object_types is a filter of resource object types to watch for relationship changes. * If specified, only changes to the specified object types will be returned and * optional_relationship_filters cannot be used. * * @generated from protobuf field: repeated string optional_object_types = 1; */ optionalObjectTypes: string[]; /** * optional_start_cursor is the ZedToken holding the point-in-time at * which to start watching for changes. * If not specified, the watch will begin at the current head revision * of the datastore, returning any updates that occur after the caller * makes the request. * Note that if this cursor references a point-in-time containing data * that has been garbage collected, an error will be returned. * * @generated from protobuf field: authzed.api.v1.ZedToken optional_start_cursor = 2; */ optionalStartCursor?: ZedToken; /** * optional_relationship_filters, if specified, indicates the * filter(s) to apply to each relationship to be returned by watch. * The relationship will be returned as long as at least one filter matches, * this allows clients to match relationships on multiple filters on a single watch call. * If specified, optional_object_types cannot be used. * * @generated from protobuf field: repeated authzed.api.v1.RelationshipFilter optional_relationship_filters = 3; */ optionalRelationshipFilters: RelationshipFilter[]; /** * optional_update_kinds, if specified, indicates what kinds of mutations to include. * * @generated from protobuf field: repeated authzed.api.v1.WatchKind optional_update_kinds = 4; */ optionalUpdateKinds: WatchKind[]; } /** * WatchResponse contains all mutation events in ascending timestamp order, * from the requested start snapshot to a snapshot * encoded in the watch response. The client can use the snapshot to resume * watching where the previous watch response left off. * * @generated from protobuf message authzed.api.v1.WatchResponse */ export interface WatchResponse { /** * updates are the RelationshipUpdate events that have occurred since the * last watch response. * * @generated from protobuf field: repeated authzed.api.v1.RelationshipUpdate updates = 1; */ updates: RelationshipUpdate[]; /** * changes_through is the ZedToken that represents the point in time * that the watch response is current through. This token can be used * in a subsequent WatchRequest to resume watching from this point. * * @generated from protobuf field: authzed.api.v1.ZedToken changes_through = 2; */ changesThrough?: ZedToken; /** * optional_transaction_metadata is an optional field that returns the transaction metadata * given to SpiceDB during the transaction that produced the changes in this response. * This field may not exist if no transaction metadata was provided. * * @generated from protobuf field: google.protobuf.Struct optional_transaction_metadata = 3; */ optionalTransactionMetadata?: Struct; /** * schema_updated, if true, indicates that the schema was changed in this revision. * * @generated from protobuf field: bool schema_updated = 4; */ schemaUpdated: boolean; /** * is_checkpoint, if true, indicates that a checkpoint was reached. * A checkpoint indicates that the server guarantees that the client * will not observe any changes at a revision below or equal to the revision in this response. * * @generated from protobuf field: bool is_checkpoint = 5; */ isCheckpoint: boolean; } /** * @generated from protobuf enum authzed.api.v1.WatchKind */ export declare enum WatchKind { /** * Default, just relationship updates (for backwards compatibility) * * @generated from protobuf enum value: WATCH_KIND_UNSPECIFIED = 0; */ UNSPECIFIED = 0, /** * @generated from protobuf enum value: WATCH_KIND_INCLUDE_RELATIONSHIP_UPDATES = 1; */ INCLUDE_RELATIONSHIP_UPDATES = 1, /** * @generated from protobuf enum value: WATCH_KIND_INCLUDE_SCHEMA_UPDATES = 2; */ INCLUDE_SCHEMA_UPDATES = 2, /** * @generated from protobuf enum value: WATCH_KIND_INCLUDE_CHECKPOINTS = 3; */ INCLUDE_CHECKPOINTS = 3 } declare class WatchRequest$Type extends MessageType<WatchRequest> { constructor(); create(value?: PartialMessage<WatchRequest>): WatchRequest; internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: WatchRequest): WatchRequest; internalBinaryWrite(message: WatchRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter; } /** * @generated MessageType for protobuf message authzed.api.v1.WatchRequest */ export declare const WatchRequest: WatchRequest$Type; declare class WatchResponse$Type extends MessageType<WatchResponse> { constructor(); create(value?: PartialMessage<WatchResponse>): WatchResponse; internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: WatchResponse): WatchResponse; internalBinaryWrite(message: WatchResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter; } /** * @generated MessageType for protobuf message authzed.api.v1.WatchResponse */ export declare const WatchResponse: WatchResponse$Type; /** * @generated ServiceType for protobuf service authzed.api.v1.WatchService */ export declare const WatchService: ServiceType; export {};