UNPKG

@authzed/authzed-node

Version:
892 lines (891 loc) 44.5 kB
// @generated by protobuf-ts 2.9.1 with parameter generate_dependencies,long_type_string,client_grpc1 // @generated from protobuf file "authzed/api/v1/core.proto" (package "authzed.api.v1", syntax proto3) // tslint:disable import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; import type { IBinaryWriter } from "@protobuf-ts/runtime"; import { WireType } from "@protobuf-ts/runtime"; import type { BinaryReadOptions } from "@protobuf-ts/runtime"; import type { IBinaryReader } from "@protobuf-ts/runtime"; import { UnknownFieldHandler } from "@protobuf-ts/runtime"; import type { PartialMessage } 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 { Timestamp } from "../../../google/protobuf/timestamp.js"; /** * Relationship specifies how a resource relates to a subject. Relationships * form the data for the graph over which all permissions questions are * answered. * * @generated from protobuf message authzed.api.v1.Relationship */ export interface Relationship { /** * resource is the resource to which the subject is related, in some manner * * @generated from protobuf field: authzed.api.v1.ObjectReference resource = 1; */ resource?: ObjectReference; /** * relation is how the resource and subject are related. * * @generated from protobuf field: string relation = 2; */ relation: string; /** * subject is the subject to which the resource is related, in some manner. * * @generated from protobuf field: authzed.api.v1.SubjectReference subject = 3; */ subject?: SubjectReference; /** * optional_caveat is a reference to a the caveat that must be enforced over the relationship * * @generated from protobuf field: authzed.api.v1.ContextualizedCaveat optional_caveat = 4; */ optionalCaveat?: ContextualizedCaveat; /** * optional_expires_at is the time at which the relationship expires, if any. * * @generated from protobuf field: google.protobuf.Timestamp optional_expires_at = 5; */ optionalExpiresAt?: Timestamp; } /** * ContextualizedCaveat represents a reference to a caveat to be used by caveated relationships. * The context consists of key-value pairs that will be injected at evaluation time. * The keys must match the arguments defined on the caveat in the schema. * * @generated from protobuf message authzed.api.v1.ContextualizedCaveat */ export interface ContextualizedCaveat { /** * caveat_name is the name of the caveat expression to use, as defined in the schema * * @generated from protobuf field: string caveat_name = 1; */ caveatName: string; /** * context consists of any named values that are defined at write time for the caveat expression * * @generated from protobuf field: google.protobuf.Struct context = 2; */ context?: Struct; } /** * SubjectReference is used for referring to the subject portion of a * Relationship. The relation component is optional and is used for defining a * sub-relation on the subject, e.g. group:123#members * * @generated from protobuf message authzed.api.v1.SubjectReference */ export interface SubjectReference { /** * @generated from protobuf field: authzed.api.v1.ObjectReference object = 1; */ object?: ObjectReference; /** * @generated from protobuf field: string optional_relation = 2; */ optionalRelation: string; } /** * ObjectReference is used to refer to a specific object in the system. * * @generated from protobuf message authzed.api.v1.ObjectReference */ export interface ObjectReference { /** * @generated from protobuf field: string object_type = 1; */ objectType: string; /** * @generated from protobuf field: string object_id = 2; */ objectId: string; } /** * ZedToken is used to provide causality metadata between Write and Check * requests. * * See the authzed.api.v1.Consistency message for more information. * * @generated from protobuf message authzed.api.v1.ZedToken */ export interface ZedToken { /** * @generated from protobuf field: string token = 1; */ token: string; } /** * Cursor is used to provide resumption of listing between calls to APIs * such as LookupResources. * * @generated from protobuf message authzed.api.v1.Cursor */ export interface Cursor { /** * @generated from protobuf field: string token = 1; */ token: string; } /** * RelationshipUpdate is used for mutating a single relationship within the * service. * * CREATE will create the relationship only if it doesn't exist, and error * otherwise. * * TOUCH will upsert the relationship, and will not error if it * already exists. * * DELETE will delete the relationship. If the relationship does not exist, * this operation will no-op. * * @generated from protobuf message authzed.api.v1.RelationshipUpdate */ export interface RelationshipUpdate { /** * @generated from protobuf field: authzed.api.v1.RelationshipUpdate.Operation operation = 1; */ operation: RelationshipUpdate_Operation; /** * @generated from protobuf field: authzed.api.v1.Relationship relationship = 2; */ relationship?: Relationship; } /** * @generated from protobuf enum authzed.api.v1.RelationshipUpdate.Operation */ export enum RelationshipUpdate_Operation { /** * @generated from protobuf enum value: OPERATION_UNSPECIFIED = 0; */ UNSPECIFIED = 0, /** * @generated from protobuf enum value: OPERATION_CREATE = 1; */ CREATE = 1, /** * @generated from protobuf enum value: OPERATION_TOUCH = 2; */ TOUCH = 2, /** * @generated from protobuf enum value: OPERATION_DELETE = 3; */ DELETE = 3 } /** * PermissionRelationshipTree is used for representing a tree of a resource and * its permission relationships with other objects. * * @generated from protobuf message authzed.api.v1.PermissionRelationshipTree */ export interface PermissionRelationshipTree { /** * @generated from protobuf oneof: tree_type */ treeType: { oneofKind: "intermediate"; /** * @generated from protobuf field: authzed.api.v1.AlgebraicSubjectSet intermediate = 1; */ intermediate: AlgebraicSubjectSet; } | { oneofKind: "leaf"; /** * @generated from protobuf field: authzed.api.v1.DirectSubjectSet leaf = 2; */ leaf: DirectSubjectSet; } | { oneofKind: undefined; }; /** * @generated from protobuf field: authzed.api.v1.ObjectReference expanded_object = 3; */ expandedObject?: ObjectReference; /** * @generated from protobuf field: string expanded_relation = 4; */ expandedRelation: string; } /** * AlgebraicSubjectSet is a subject set which is computed based on applying the * specified operation to the operands according to the algebra of sets. * * UNION is a logical set containing the subject members from all operands. * * INTERSECTION is a logical set containing only the subject members which are * present in all operands. * * EXCLUSION is a logical set containing only the subject members which are * present in the first operand, and none of the other operands. * * @generated from protobuf message authzed.api.v1.AlgebraicSubjectSet */ export interface AlgebraicSubjectSet { /** * @generated from protobuf field: authzed.api.v1.AlgebraicSubjectSet.Operation operation = 1; */ operation: AlgebraicSubjectSet_Operation; /** * @generated from protobuf field: repeated authzed.api.v1.PermissionRelationshipTree children = 2; */ children: PermissionRelationshipTree[]; } /** * @generated from protobuf enum authzed.api.v1.AlgebraicSubjectSet.Operation */ export enum AlgebraicSubjectSet_Operation { /** * @generated from protobuf enum value: OPERATION_UNSPECIFIED = 0; */ UNSPECIFIED = 0, /** * @generated from protobuf enum value: OPERATION_UNION = 1; */ UNION = 1, /** * @generated from protobuf enum value: OPERATION_INTERSECTION = 2; */ INTERSECTION = 2, /** * @generated from protobuf enum value: OPERATION_EXCLUSION = 3; */ EXCLUSION = 3 } /** * DirectSubjectSet is a subject set which is simply a collection of subjects. * * @generated from protobuf message authzed.api.v1.DirectSubjectSet */ export interface DirectSubjectSet { /** * @generated from protobuf field: repeated authzed.api.v1.SubjectReference subjects = 1; */ subjects: SubjectReference[]; } /** * PartialCaveatInfo carries information necessary for the client to take action * in the event a response contains a partially evaluated caveat * * @generated from protobuf message authzed.api.v1.PartialCaveatInfo */ export interface PartialCaveatInfo { /** * missing_required_context is a list of one or more fields that were missing and prevented caveats * from being fully evaluated * * @generated from protobuf field: repeated string missing_required_context = 1; */ missingRequiredContext: string[]; } // @generated message type with reflection information, may provide speed optimized methods class Relationship$Type extends MessageType<Relationship> { constructor() { super("authzed.api.v1.Relationship", [ { no: 1, name: "resource", kind: "message", T: () => ObjectReference, options: { "buf.validate.field": { required: true }, "validate.rules": { message: { required: true } } } }, { no: 2, name: "relation", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "buf.validate.field": { string: { maxBytes: "64", pattern: "^[a-z][a-z0-9_]{1,62}[a-z0-9]$" } }, "validate.rules": { string: { maxBytes: "64", pattern: "^[a-z][a-z0-9_]{1,62}[a-z0-9]$" } } } }, { no: 3, name: "subject", kind: "message", T: () => SubjectReference, options: { "buf.validate.field": { required: true }, "validate.rules": { message: { required: true } } } }, { no: 4, name: "optional_caveat", kind: "message", T: () => ContextualizedCaveat, options: { "buf.validate.field": { required: false }, "validate.rules": { message: { required: false } } } }, { no: 5, name: "optional_expires_at", kind: "message", T: () => Timestamp } ]); } create(value?: PartialMessage<Relationship>): Relationship { const message = { relation: "" }; globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) reflectionMergePartial<Relationship>(this, message, value); return message; } internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Relationship): Relationship { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* authzed.api.v1.ObjectReference resource */ 1: message.resource = ObjectReference.internalBinaryRead(reader, reader.uint32(), options, message.resource); break; case /* string relation */ 2: message.relation = reader.string(); break; case /* authzed.api.v1.SubjectReference subject */ 3: message.subject = SubjectReference.internalBinaryRead(reader, reader.uint32(), options, message.subject); break; case /* authzed.api.v1.ContextualizedCaveat optional_caveat */ 4: message.optionalCaveat = ContextualizedCaveat.internalBinaryRead(reader, reader.uint32(), options, message.optionalCaveat); break; case /* google.protobuf.Timestamp optional_expires_at */ 5: message.optionalExpiresAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.optionalExpiresAt); 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: Relationship, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* authzed.api.v1.ObjectReference resource = 1; */ if (message.resource) ObjectReference.internalBinaryWrite(message.resource, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); /* string relation = 2; */ if (message.relation !== "") writer.tag(2, WireType.LengthDelimited).string(message.relation); /* authzed.api.v1.SubjectReference subject = 3; */ if (message.subject) SubjectReference.internalBinaryWrite(message.subject, writer.tag(3, WireType.LengthDelimited).fork(), options).join(); /* authzed.api.v1.ContextualizedCaveat optional_caveat = 4; */ if (message.optionalCaveat) ContextualizedCaveat.internalBinaryWrite(message.optionalCaveat, writer.tag(4, WireType.LengthDelimited).fork(), options).join(); /* google.protobuf.Timestamp optional_expires_at = 5; */ if (message.optionalExpiresAt) Timestamp.internalBinaryWrite(message.optionalExpiresAt, writer.tag(5, WireType.LengthDelimited).fork(), options).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.Relationship */ export const Relationship = new Relationship$Type(); // @generated message type with reflection information, may provide speed optimized methods class ContextualizedCaveat$Type extends MessageType<ContextualizedCaveat> { constructor() { super("authzed.api.v1.ContextualizedCaveat", [ { no: 1, name: "caveat_name", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "buf.validate.field": { string: { maxBytes: "128", pattern: "^([a-zA-Z0-9_][a-zA-Z0-9/_|-]{0,127})$" } }, "validate.rules": { string: { maxBytes: "128", pattern: "^([a-zA-Z0-9_][a-zA-Z0-9/_|-]{0,127})$" } } } }, { no: 2, name: "context", kind: "message", T: () => Struct, options: { "buf.validate.field": { required: false }, "validate.rules": { message: { required: false } } } } ]); } create(value?: PartialMessage<ContextualizedCaveat>): ContextualizedCaveat { const message = { caveatName: "" }; globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) reflectionMergePartial<ContextualizedCaveat>(this, message, value); return message; } internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ContextualizedCaveat): ContextualizedCaveat { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* string caveat_name */ 1: message.caveatName = reader.string(); break; case /* google.protobuf.Struct context */ 2: message.context = Struct.internalBinaryRead(reader, reader.uint32(), options, message.context); 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: ContextualizedCaveat, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* string caveat_name = 1; */ if (message.caveatName !== "") writer.tag(1, WireType.LengthDelimited).string(message.caveatName); /* google.protobuf.Struct context = 2; */ if (message.context) Struct.internalBinaryWrite(message.context, writer.tag(2, WireType.LengthDelimited).fork(), options).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.ContextualizedCaveat */ export const ContextualizedCaveat = new ContextualizedCaveat$Type(); // @generated message type with reflection information, may provide speed optimized methods class SubjectReference$Type extends MessageType<SubjectReference> { constructor() { super("authzed.api.v1.SubjectReference", [ { no: 1, name: "object", kind: "message", T: () => ObjectReference, options: { "buf.validate.field": { required: true }, "validate.rules": { message: { required: true } } } }, { no: 2, name: "optional_relation", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "buf.validate.field": { string: { maxBytes: "64", pattern: "^([a-z][a-z0-9_]{1,62}[a-z0-9])?$" } }, "validate.rules": { string: { maxBytes: "64", pattern: "^([a-z][a-z0-9_]{1,62}[a-z0-9])?$" } } } } ]); } create(value?: PartialMessage<SubjectReference>): SubjectReference { const message = { optionalRelation: "" }; globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) reflectionMergePartial<SubjectReference>(this, message, value); return message; } internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SubjectReference): SubjectReference { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* authzed.api.v1.ObjectReference object */ 1: message.object = ObjectReference.internalBinaryRead(reader, reader.uint32(), options, message.object); break; case /* string optional_relation */ 2: message.optionalRelation = reader.string(); 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: SubjectReference, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* authzed.api.v1.ObjectReference object = 1; */ if (message.object) ObjectReference.internalBinaryWrite(message.object, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); /* string optional_relation = 2; */ if (message.optionalRelation !== "") writer.tag(2, WireType.LengthDelimited).string(message.optionalRelation); 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.SubjectReference */ export const SubjectReference = new SubjectReference$Type(); // @generated message type with reflection information, may provide speed optimized methods class ObjectReference$Type extends MessageType<ObjectReference> { constructor() { super("authzed.api.v1.ObjectReference", [ { no: 1, name: "object_type", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "buf.validate.field": { string: { maxBytes: "128", pattern: "^([a-z][a-z0-9_]{1,61}[a-z0-9]/)*[a-z][a-z0-9_]{1,62}[a-z0-9]$" } }, "validate.rules": { string: { maxBytes: "128", pattern: "^([a-z][a-z0-9_]{1,61}[a-z0-9]/)*[a-z][a-z0-9_]{1,62}[a-z0-9]$" } } } }, { no: 2, name: "object_id", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "buf.validate.field": { string: { maxBytes: "1024", pattern: "^(([a-zA-Z0-9/_|\\-=+]{1,})|\\*)$" } }, "validate.rules": { string: { maxBytes: "1024", pattern: "^(([a-zA-Z0-9/_|\\-=+]{1,})|\\*)$" } } } } ]); } create(value?: PartialMessage<ObjectReference>): ObjectReference { const message = { objectType: "", objectId: "" }; globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) reflectionMergePartial<ObjectReference>(this, message, value); return message; } internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ObjectReference): ObjectReference { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* string object_type */ 1: message.objectType = reader.string(); break; case /* string object_id */ 2: message.objectId = reader.string(); 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: ObjectReference, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* string object_type = 1; */ if (message.objectType !== "") writer.tag(1, WireType.LengthDelimited).string(message.objectType); /* string object_id = 2; */ if (message.objectId !== "") writer.tag(2, WireType.LengthDelimited).string(message.objectId); 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.ObjectReference */ export const ObjectReference = new ObjectReference$Type(); // @generated message type with reflection information, may provide speed optimized methods class ZedToken$Type extends MessageType<ZedToken> { constructor() { super("authzed.api.v1.ZedToken", [ { no: 1, name: "token", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "buf.validate.field": { string: { minBytes: "1" } }, "validate.rules": { string: { minBytes: "1" } } } } ]); } create(value?: PartialMessage<ZedToken>): ZedToken { const message = { token: "" }; globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) reflectionMergePartial<ZedToken>(this, message, value); return message; } internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ZedToken): ZedToken { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* string token */ 1: message.token = reader.string(); 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: ZedToken, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* string token = 1; */ if (message.token !== "") writer.tag(1, WireType.LengthDelimited).string(message.token); 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.ZedToken */ export const ZedToken = new ZedToken$Type(); // @generated message type with reflection information, may provide speed optimized methods class Cursor$Type extends MessageType<Cursor> { constructor() { super("authzed.api.v1.Cursor", [ { no: 1, name: "token", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "buf.validate.field": { string: { minBytes: "1", maxBytes: "102400" } }, "validate.rules": { string: { minBytes: "1", maxBytes: "102400" } } } } ]); } create(value?: PartialMessage<Cursor>): Cursor { const message = { token: "" }; globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) reflectionMergePartial<Cursor>(this, message, value); return message; } internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Cursor): Cursor { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* string token */ 1: message.token = reader.string(); 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: Cursor, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* string token = 1; */ if (message.token !== "") writer.tag(1, WireType.LengthDelimited).string(message.token); 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.Cursor */ export const Cursor = new Cursor$Type(); // @generated message type with reflection information, may provide speed optimized methods class RelationshipUpdate$Type extends MessageType<RelationshipUpdate> { constructor() { super("authzed.api.v1.RelationshipUpdate", [ { no: 1, name: "operation", kind: "enum", T: () => ["authzed.api.v1.RelationshipUpdate.Operation", RelationshipUpdate_Operation, "OPERATION_"], options: { "buf.validate.field": { enum: { definedOnly: true, notIn: [0] } }, "validate.rules": { enum: { definedOnly: true, notIn: [0] } } } }, { no: 2, name: "relationship", kind: "message", T: () => Relationship, options: { "buf.validate.field": { required: true }, "validate.rules": { message: { required: true } } } } ]); } create(value?: PartialMessage<RelationshipUpdate>): RelationshipUpdate { const message = { operation: 0 }; globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) reflectionMergePartial<RelationshipUpdate>(this, message, value); return message; } internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: RelationshipUpdate): RelationshipUpdate { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* authzed.api.v1.RelationshipUpdate.Operation operation */ 1: message.operation = reader.int32(); break; case /* authzed.api.v1.Relationship relationship */ 2: message.relationship = Relationship.internalBinaryRead(reader, reader.uint32(), options, message.relationship); 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: RelationshipUpdate, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* authzed.api.v1.RelationshipUpdate.Operation operation = 1; */ if (message.operation !== 0) writer.tag(1, WireType.Varint).int32(message.operation); /* authzed.api.v1.Relationship relationship = 2; */ if (message.relationship) Relationship.internalBinaryWrite(message.relationship, writer.tag(2, WireType.LengthDelimited).fork(), options).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.RelationshipUpdate */ export const RelationshipUpdate = new RelationshipUpdate$Type(); // @generated message type with reflection information, may provide speed optimized methods class PermissionRelationshipTree$Type extends MessageType<PermissionRelationshipTree> { constructor() { super("authzed.api.v1.PermissionRelationshipTree", [ { no: 1, name: "intermediate", kind: "message", oneof: "treeType", T: () => AlgebraicSubjectSet }, { no: 2, name: "leaf", kind: "message", oneof: "treeType", T: () => DirectSubjectSet }, { no: 3, name: "expanded_object", kind: "message", T: () => ObjectReference }, { no: 4, name: "expanded_relation", kind: "scalar", T: 9 /*ScalarType.STRING*/ } ]); } create(value?: PartialMessage<PermissionRelationshipTree>): PermissionRelationshipTree { const message = { treeType: { oneofKind: undefined }, expandedRelation: "" }; globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) reflectionMergePartial<PermissionRelationshipTree>(this, message, value); return message; } internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PermissionRelationshipTree): PermissionRelationshipTree { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* authzed.api.v1.AlgebraicSubjectSet intermediate */ 1: message.treeType = { oneofKind: "intermediate", intermediate: AlgebraicSubjectSet.internalBinaryRead(reader, reader.uint32(), options, (message.treeType as any).intermediate) }; break; case /* authzed.api.v1.DirectSubjectSet leaf */ 2: message.treeType = { oneofKind: "leaf", leaf: DirectSubjectSet.internalBinaryRead(reader, reader.uint32(), options, (message.treeType as any).leaf) }; break; case /* authzed.api.v1.ObjectReference expanded_object */ 3: message.expandedObject = ObjectReference.internalBinaryRead(reader, reader.uint32(), options, message.expandedObject); break; case /* string expanded_relation */ 4: message.expandedRelation = reader.string(); 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: PermissionRelationshipTree, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* authzed.api.v1.AlgebraicSubjectSet intermediate = 1; */ if (message.treeType.oneofKind === "intermediate") AlgebraicSubjectSet.internalBinaryWrite(message.treeType.intermediate, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); /* authzed.api.v1.DirectSubjectSet leaf = 2; */ if (message.treeType.oneofKind === "leaf") DirectSubjectSet.internalBinaryWrite(message.treeType.leaf, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); /* authzed.api.v1.ObjectReference expanded_object = 3; */ if (message.expandedObject) ObjectReference.internalBinaryWrite(message.expandedObject, writer.tag(3, WireType.LengthDelimited).fork(), options).join(); /* string expanded_relation = 4; */ if (message.expandedRelation !== "") writer.tag(4, WireType.LengthDelimited).string(message.expandedRelation); 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.PermissionRelationshipTree */ export const PermissionRelationshipTree = new PermissionRelationshipTree$Type(); // @generated message type with reflection information, may provide speed optimized methods class AlgebraicSubjectSet$Type extends MessageType<AlgebraicSubjectSet> { constructor() { super("authzed.api.v1.AlgebraicSubjectSet", [ { no: 1, name: "operation", kind: "enum", T: () => ["authzed.api.v1.AlgebraicSubjectSet.Operation", AlgebraicSubjectSet_Operation, "OPERATION_"], options: { "buf.validate.field": { enum: { definedOnly: true, notIn: [0] } }, "validate.rules": { enum: { definedOnly: true, notIn: [0] } } } }, { no: 2, name: "children", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PermissionRelationshipTree, options: { "buf.validate.field": { repeated: { items: { required: true } } }, "validate.rules": { repeated: { items: { message: { required: true } } } } } } ]); } create(value?: PartialMessage<AlgebraicSubjectSet>): AlgebraicSubjectSet { const message = { operation: 0, children: [] }; globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) reflectionMergePartial<AlgebraicSubjectSet>(this, message, value); return message; } internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AlgebraicSubjectSet): AlgebraicSubjectSet { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* authzed.api.v1.AlgebraicSubjectSet.Operation operation */ 1: message.operation = reader.int32(); break; case /* repeated authzed.api.v1.PermissionRelationshipTree children */ 2: message.children.push(PermissionRelationshipTree.internalBinaryRead(reader, reader.uint32(), options)); 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: AlgebraicSubjectSet, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* authzed.api.v1.AlgebraicSubjectSet.Operation operation = 1; */ if (message.operation !== 0) writer.tag(1, WireType.Varint).int32(message.operation); /* repeated authzed.api.v1.PermissionRelationshipTree children = 2; */ for (let i = 0; i < message.children.length; i++) PermissionRelationshipTree.internalBinaryWrite(message.children[i], writer.tag(2, WireType.LengthDelimited).fork(), options).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.AlgebraicSubjectSet */ export const AlgebraicSubjectSet = new AlgebraicSubjectSet$Type(); // @generated message type with reflection information, may provide speed optimized methods class DirectSubjectSet$Type extends MessageType<DirectSubjectSet> { constructor() { super("authzed.api.v1.DirectSubjectSet", [ { no: 1, name: "subjects", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => SubjectReference } ]); } create(value?: PartialMessage<DirectSubjectSet>): DirectSubjectSet { const message = { subjects: [] }; globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) reflectionMergePartial<DirectSubjectSet>(this, message, value); return message; } internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DirectSubjectSet): DirectSubjectSet { 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.SubjectReference subjects */ 1: message.subjects.push(SubjectReference.internalBinaryRead(reader, reader.uint32(), options)); 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: DirectSubjectSet, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* repeated authzed.api.v1.SubjectReference subjects = 1; */ for (let i = 0; i < message.subjects.length; i++) SubjectReference.internalBinaryWrite(message.subjects[i], writer.tag(1, WireType.LengthDelimited).fork(), options).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.DirectSubjectSet */ export const DirectSubjectSet = new DirectSubjectSet$Type(); // @generated message type with reflection information, may provide speed optimized methods class PartialCaveatInfo$Type extends MessageType<PartialCaveatInfo> { constructor() { super("authzed.api.v1.PartialCaveatInfo", [ { no: 1, name: "missing_required_context", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/, options: { "buf.validate.field": { repeated: { minItems: "1" } }, "validate.rules": { repeated: { minItems: "1" } } } } ]); } create(value?: PartialMessage<PartialCaveatInfo>): PartialCaveatInfo { const message = { missingRequiredContext: [] }; globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) reflectionMergePartial<PartialCaveatInfo>(this, message, value); return message; } internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PartialCaveatInfo): PartialCaveatInfo { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* repeated string missing_required_context */ 1: message.missingRequiredContext.push(reader.string()); 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: PartialCaveatInfo, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* repeated string missing_required_context = 1; */ for (let i = 0; i < message.missingRequiredContext.length; i++) writer.tag(1, WireType.LengthDelimited).string(message.missingRequiredContext[i]); 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.PartialCaveatInfo */ export const PartialCaveatInfo = new PartialCaveatInfo$Type();