UNPKG

@authzed/authzed-js-node

Version:
195 lines 11.2 kB
// @generated by protobuf-ts 2.9.1 with parameter generate_dependencies,long_type_string,client_grpc1 // @generated from protobuf file "authzed/api/v1/watch_service.proto" (package "authzed.api.v1", syntax proto3) // tslint:disable import { ServiceType } from "@protobuf-ts/runtime-rpc"; import { UnknownFieldHandler } from "@protobuf-ts/runtime"; import { WireType } from "@protobuf-ts/runtime"; import { reflectionMergePartial } from "@protobuf-ts/runtime"; import { MESSAGE_TYPE } 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"; /** * @generated from protobuf enum authzed.api.v1.WatchKind */ export var WatchKind; (function (WatchKind) { /** * Default, just relationship updates (for backwards compatibility) * * @generated from protobuf enum value: WATCH_KIND_UNSPECIFIED = 0; */ WatchKind[WatchKind["UNSPECIFIED"] = 0] = "UNSPECIFIED"; /** * @generated from protobuf enum value: WATCH_KIND_INCLUDE_RELATIONSHIP_UPDATES = 1; */ WatchKind[WatchKind["INCLUDE_RELATIONSHIP_UPDATES"] = 1] = "INCLUDE_RELATIONSHIP_UPDATES"; /** * @generated from protobuf enum value: WATCH_KIND_INCLUDE_SCHEMA_UPDATES = 2; */ WatchKind[WatchKind["INCLUDE_SCHEMA_UPDATES"] = 2] = "INCLUDE_SCHEMA_UPDATES"; /** * @generated from protobuf enum value: WATCH_KIND_INCLUDE_CHECKPOINTS = 3; */ WatchKind[WatchKind["INCLUDE_CHECKPOINTS"] = 3] = "INCLUDE_CHECKPOINTS"; })(WatchKind || (WatchKind = {})); // @generated message type with reflection information, may provide speed optimized methods class WatchRequest$Type extends MessageType { constructor() { super("authzed.api.v1.WatchRequest", [ { no: 1, name: "optional_object_types", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/, options: { "buf.validate.field": { repeated: { minItems: "0", items: { string: { maxBytes: "128", pattern: "^([a-z][a-z0-9_]{1,62}[a-z0-9]/)*[a-z][a-z0-9_]{1,62}[a-z0-9]$" } } } }, "validate.rules": { repeated: { minItems: "0", items: { string: { maxBytes: "128", pattern: "^([a-z][a-z0-9_]{1,62}[a-z0-9]/)*[a-z][a-z0-9_]{1,62}[a-z0-9]$" } } } } } }, { no: 2, name: "optional_start_cursor", kind: "message", T: () => ZedToken }, { no: 3, name: "optional_relationship_filters", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => RelationshipFilter }, { no: 4, name: "optional_update_kinds", kind: "enum", repeat: 1 /*RepeatType.PACKED*/, T: () => ["authzed.api.v1.WatchKind", WatchKind, "WATCH_KIND_"] } ]); } create(value) { const message = { optionalObjectTypes: [], optionalRelationshipFilters: [], optionalUpdateKinds: [] }; globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) reflectionMergePartial(this, message, value); return message; } internalBinaryRead(reader, length, options, target) { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* repeated string optional_object_types */ 1: message.optionalObjectTypes.push(reader.string()); break; case /* authzed.api.v1.ZedToken optional_start_cursor */ 2: message.optionalStartCursor = ZedToken.internalBinaryRead(reader, reader.uint32(), options, message.optionalStartCursor); break; case /* repeated authzed.api.v1.RelationshipFilter optional_relationship_filters */ 3: message.optionalRelationshipFilters.push(RelationshipFilter.internalBinaryRead(reader, reader.uint32(), options)); break; case /* repeated authzed.api.v1.WatchKind optional_update_kinds */ 4: if (wireType === WireType.LengthDelimited) for (let e = reader.int32() + reader.pos; reader.pos < e;) message.optionalUpdateKinds.push(reader.int32()); else message.optionalUpdateKinds.push(reader.int32()); break; default: let u = options.readUnknownField; if (u === "throw") throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); let d = reader.skip(wireType); if (u !== false) (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message, writer, options) { /* repeated string optional_object_types = 1; */ for (let i = 0; i < message.optionalObjectTypes.length; i++) writer.tag(1, WireType.LengthDelimited).string(message.optionalObjectTypes[i]); /* authzed.api.v1.ZedToken optional_start_cursor = 2; */ if (message.optionalStartCursor) ZedToken.internalBinaryWrite(message.optionalStartCursor, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); /* repeated authzed.api.v1.RelationshipFilter optional_relationship_filters = 3; */ for (let i = 0; i < message.optionalRelationshipFilters.length; i++) RelationshipFilter.internalBinaryWrite(message.optionalRelationshipFilters[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join(); /* repeated authzed.api.v1.WatchKind optional_update_kinds = 4; */ if (message.optionalUpdateKinds.length) { writer.tag(4, WireType.LengthDelimited).fork(); for (let i = 0; i < message.optionalUpdateKinds.length; i++) writer.int32(message.optionalUpdateKinds[i]); writer.join(); } let u = options.writeUnknownFields; if (u !== false) (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); return writer; } } /** * @generated MessageType for protobuf message authzed.api.v1.WatchRequest */ export const WatchRequest = new WatchRequest$Type(); // @generated message type with reflection information, may provide speed optimized methods class WatchResponse$Type extends MessageType { constructor() { super("authzed.api.v1.WatchResponse", [ { no: 1, name: "updates", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => RelationshipUpdate }, { no: 2, name: "changes_through", kind: "message", T: () => ZedToken }, { no: 3, name: "optional_transaction_metadata", kind: "message", T: () => Struct }, { no: 4, name: "schema_updated", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, { no: 5, name: "is_checkpoint", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } ]); } create(value) { const message = { updates: [], schemaUpdated: false, isCheckpoint: false }; globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) reflectionMergePartial(this, message, value); return message; } internalBinaryRead(reader, length, options, target) { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* repeated authzed.api.v1.RelationshipUpdate updates */ 1: message.updates.push(RelationshipUpdate.internalBinaryRead(reader, reader.uint32(), options)); break; case /* authzed.api.v1.ZedToken changes_through */ 2: message.changesThrough = ZedToken.internalBinaryRead(reader, reader.uint32(), options, message.changesThrough); break; case /* google.protobuf.Struct optional_transaction_metadata */ 3: message.optionalTransactionMetadata = Struct.internalBinaryRead(reader, reader.uint32(), options, message.optionalTransactionMetadata); break; case /* bool schema_updated */ 4: message.schemaUpdated = reader.bool(); break; case /* bool is_checkpoint */ 5: message.isCheckpoint = reader.bool(); break; default: let u = options.readUnknownField; if (u === "throw") throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); let d = reader.skip(wireType); if (u !== false) (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message, writer, options) { /* repeated authzed.api.v1.RelationshipUpdate updates = 1; */ for (let i = 0; i < message.updates.length; i++) RelationshipUpdate.internalBinaryWrite(message.updates[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); /* authzed.api.v1.ZedToken changes_through = 2; */ if (message.changesThrough) ZedToken.internalBinaryWrite(message.changesThrough, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); /* google.protobuf.Struct optional_transaction_metadata = 3; */ if (message.optionalTransactionMetadata) Struct.internalBinaryWrite(message.optionalTransactionMetadata, writer.tag(3, WireType.LengthDelimited).fork(), options).join(); /* bool schema_updated = 4; */ if (message.schemaUpdated !== false) writer.tag(4, WireType.Varint).bool(message.schemaUpdated); /* bool is_checkpoint = 5; */ if (message.isCheckpoint !== false) writer.tag(5, WireType.Varint).bool(message.isCheckpoint); let u = options.writeUnknownFields; if (u !== false) (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); return writer; } } /** * @generated MessageType for protobuf message authzed.api.v1.WatchResponse */ export const WatchResponse = new WatchResponse$Type(); /** * @generated ServiceType for protobuf service authzed.api.v1.WatchService */ export const WatchService = new ServiceType("authzed.api.v1.WatchService", [ { name: "Watch", serverStreaming: true, options: { "google.api.http": { post: "/v1/watch", body: "*" }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["Watch"] } }, I: WatchRequest, O: WatchResponse } ]); //# sourceMappingURL=watch_service.js.map