// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.12.4 // protoc v5.28.3 // source: observation_eventstoresubscriptions.proto /* eslint-disable */ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import type { CallContext, CallOptions } from "nice-grpc-common"; import { Empty } from "./google/protobuf/empty"; export const protobufPackage = "Cratis.Chronicle.Contracts.Observation.EventStoreSubscriptions"; export interface AddEventStoreSubscriptions { TargetEventStore: string; Subscriptions: EventStoreSubscriptionDefinition[]; } export interface EventStoreSubscriptionDefinition { Identifier: string; SourceEventStore: string; EventTypes: EventType[]; } export interface EventType { Id: string; Generation: number; Tombstone: boolean; } export interface GetEventStoreSubscriptionsRequest { TargetEventStore: string; } export interface IEnumerableEventStoreSubscriptionDefinition { items: EventStoreSubscriptionDefinition[]; } export interface RemoveEventStoreSubscriptions { TargetEventStore: string; SubscriptionIds: string[]; } function createBaseAddEventStoreSubscriptions(): AddEventStoreSubscriptions { return { TargetEventStore: "", Subscriptions: [] }; } export const AddEventStoreSubscriptions: MessageFns = { encode(message: AddEventStoreSubscriptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.TargetEventStore !== "") { writer.uint32(10).string(message.TargetEventStore); } for (const v of message.Subscriptions) { EventStoreSubscriptionDefinition.encode(v!, writer.uint32(18).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): AddEventStoreSubscriptions { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; if (previousRecursionDepth >= 100) { throw new globalThis.Error("protobuf decode recursion limit exceeded"); } (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; try { const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAddEventStoreSubscriptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.TargetEventStore = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.Subscriptions.push(EventStoreSubscriptionDefinition.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; } finally { (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; } }, fromJSON(object: any): AddEventStoreSubscriptions { return { TargetEventStore: isSet(object.TargetEventStore) ? globalThis.String(object.TargetEventStore) : "", Subscriptions: globalThis.Array.isArray(object?.Subscriptions) ? object.Subscriptions.map((e: any) => EventStoreSubscriptionDefinition.fromJSON(e)) : [], }; }, toJSON(message: AddEventStoreSubscriptions): unknown { const obj: any = {}; if (message.TargetEventStore !== "") { obj.TargetEventStore = message.TargetEventStore; } if (message.Subscriptions?.length) { obj.Subscriptions = message.Subscriptions.map((e) => EventStoreSubscriptionDefinition.toJSON(e)); } return obj; }, create(base?: DeepPartial): AddEventStoreSubscriptions { return AddEventStoreSubscriptions.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): AddEventStoreSubscriptions { const message = createBaseAddEventStoreSubscriptions(); message.TargetEventStore = object.TargetEventStore ?? ""; message.Subscriptions = object.Subscriptions?.map((e) => EventStoreSubscriptionDefinition.fromPartial(e)) || []; return message; }, }; function createBaseEventStoreSubscriptionDefinition(): EventStoreSubscriptionDefinition { return { Identifier: "", SourceEventStore: "", EventTypes: [] }; } export const EventStoreSubscriptionDefinition: MessageFns = { encode(message: EventStoreSubscriptionDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.Identifier !== "") { writer.uint32(10).string(message.Identifier); } if (message.SourceEventStore !== "") { writer.uint32(18).string(message.SourceEventStore); } for (const v of message.EventTypes) { EventType.encode(v!, writer.uint32(26).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): EventStoreSubscriptionDefinition { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; if (previousRecursionDepth >= 100) { throw new globalThis.Error("protobuf decode recursion limit exceeded"); } (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; try { const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventStoreSubscriptionDefinition(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.Identifier = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.SourceEventStore = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.EventTypes.push(EventType.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; } finally { (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; } }, fromJSON(object: any): EventStoreSubscriptionDefinition { return { Identifier: isSet(object.Identifier) ? globalThis.String(object.Identifier) : "", SourceEventStore: isSet(object.SourceEventStore) ? globalThis.String(object.SourceEventStore) : "", EventTypes: globalThis.Array.isArray(object?.EventTypes) ? object.EventTypes.map((e: any) => EventType.fromJSON(e)) : [], }; }, toJSON(message: EventStoreSubscriptionDefinition): unknown { const obj: any = {}; if (message.Identifier !== "") { obj.Identifier = message.Identifier; } if (message.SourceEventStore !== "") { obj.SourceEventStore = message.SourceEventStore; } if (message.EventTypes?.length) { obj.EventTypes = message.EventTypes.map((e) => EventType.toJSON(e)); } return obj; }, create(base?: DeepPartial): EventStoreSubscriptionDefinition { return EventStoreSubscriptionDefinition.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): EventStoreSubscriptionDefinition { const message = createBaseEventStoreSubscriptionDefinition(); message.Identifier = object.Identifier ?? ""; message.SourceEventStore = object.SourceEventStore ?? ""; message.EventTypes = object.EventTypes?.map((e) => EventType.fromPartial(e)) || []; return message; }, }; function createBaseEventType(): EventType { return { Id: "", Generation: 0, Tombstone: false }; } export const EventType: MessageFns = { encode(message: EventType, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.Id !== "") { writer.uint32(10).string(message.Id); } if (message.Generation !== 0) { writer.uint32(16).uint32(message.Generation); } if (message.Tombstone !== false) { writer.uint32(24).bool(message.Tombstone); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): EventType { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; if (previousRecursionDepth >= 100) { throw new globalThis.Error("protobuf decode recursion limit exceeded"); } (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; try { const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventType(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.Id = reader.string(); continue; } case 2: { if (tag !== 16) { break; } message.Generation = reader.uint32(); continue; } case 3: { if (tag !== 24) { break; } message.Tombstone = reader.bool(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; } finally { (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; } }, fromJSON(object: any): EventType { return { Id: isSet(object.Id) ? globalThis.String(object.Id) : "", Generation: isSet(object.Generation) ? globalThis.Number(object.Generation) : 0, Tombstone: isSet(object.Tombstone) ? globalThis.Boolean(object.Tombstone) : false, }; }, toJSON(message: EventType): unknown { const obj: any = {}; if (message.Id !== "") { obj.Id = message.Id; } if (message.Generation !== 0) { obj.Generation = Math.round(message.Generation); } if (message.Tombstone !== false) { obj.Tombstone = message.Tombstone; } return obj; }, create(base?: DeepPartial): EventType { return EventType.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): EventType { const message = createBaseEventType(); message.Id = object.Id ?? ""; message.Generation = object.Generation ?? 0; message.Tombstone = object.Tombstone ?? false; return message; }, }; function createBaseGetEventStoreSubscriptionsRequest(): GetEventStoreSubscriptionsRequest { return { TargetEventStore: "" }; } export const GetEventStoreSubscriptionsRequest: MessageFns = { encode(message: GetEventStoreSubscriptionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.TargetEventStore !== "") { writer.uint32(10).string(message.TargetEventStore); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): GetEventStoreSubscriptionsRequest { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; if (previousRecursionDepth >= 100) { throw new globalThis.Error("protobuf decode recursion limit exceeded"); } (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; try { const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetEventStoreSubscriptionsRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.TargetEventStore = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; } finally { (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; } }, fromJSON(object: any): GetEventStoreSubscriptionsRequest { return { TargetEventStore: isSet(object.TargetEventStore) ? globalThis.String(object.TargetEventStore) : "" }; }, toJSON(message: GetEventStoreSubscriptionsRequest): unknown { const obj: any = {}; if (message.TargetEventStore !== "") { obj.TargetEventStore = message.TargetEventStore; } return obj; }, create(base?: DeepPartial): GetEventStoreSubscriptionsRequest { return GetEventStoreSubscriptionsRequest.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): GetEventStoreSubscriptionsRequest { const message = createBaseGetEventStoreSubscriptionsRequest(); message.TargetEventStore = object.TargetEventStore ?? ""; return message; }, }; function createBaseIEnumerableEventStoreSubscriptionDefinition(): IEnumerableEventStoreSubscriptionDefinition { return { items: [] }; } export const IEnumerableEventStoreSubscriptionDefinition: MessageFns = { encode( message: IEnumerableEventStoreSubscriptionDefinition, writer: BinaryWriter = new BinaryWriter(), ): BinaryWriter { for (const v of message.items) { EventStoreSubscriptionDefinition.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): IEnumerableEventStoreSubscriptionDefinition { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; if (previousRecursionDepth >= 100) { throw new globalThis.Error("protobuf decode recursion limit exceeded"); } (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; try { const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseIEnumerableEventStoreSubscriptionDefinition(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.items.push(EventStoreSubscriptionDefinition.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; } finally { (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; } }, fromJSON(object: any): IEnumerableEventStoreSubscriptionDefinition { return { items: globalThis.Array.isArray(object?.items) ? object.items.map((e: any) => EventStoreSubscriptionDefinition.fromJSON(e)) : [], }; }, toJSON(message: IEnumerableEventStoreSubscriptionDefinition): unknown { const obj: any = {}; if (message.items?.length) { obj.items = message.items.map((e) => EventStoreSubscriptionDefinition.toJSON(e)); } return obj; }, create(base?: DeepPartial): IEnumerableEventStoreSubscriptionDefinition { return IEnumerableEventStoreSubscriptionDefinition.fromPartial(base ?? {}); }, fromPartial( object: DeepPartial, ): IEnumerableEventStoreSubscriptionDefinition { const message = createBaseIEnumerableEventStoreSubscriptionDefinition(); message.items = object.items?.map((e) => EventStoreSubscriptionDefinition.fromPartial(e)) || []; return message; }, }; function createBaseRemoveEventStoreSubscriptions(): RemoveEventStoreSubscriptions { return { TargetEventStore: "", SubscriptionIds: [] }; } export const RemoveEventStoreSubscriptions: MessageFns = { encode(message: RemoveEventStoreSubscriptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.TargetEventStore !== "") { writer.uint32(10).string(message.TargetEventStore); } for (const v of message.SubscriptionIds) { writer.uint32(18).string(v!); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): RemoveEventStoreSubscriptions { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; if (previousRecursionDepth >= 100) { throw new globalThis.Error("protobuf decode recursion limit exceeded"); } (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; try { const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRemoveEventStoreSubscriptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.TargetEventStore = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.SubscriptionIds.push(reader.string()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; } finally { (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; } }, fromJSON(object: any): RemoveEventStoreSubscriptions { return { TargetEventStore: isSet(object.TargetEventStore) ? globalThis.String(object.TargetEventStore) : "", SubscriptionIds: globalThis.Array.isArray(object?.SubscriptionIds) ? object.SubscriptionIds.map((e: any) => globalThis.String(e)) : [], }; }, toJSON(message: RemoveEventStoreSubscriptions): unknown { const obj: any = {}; if (message.TargetEventStore !== "") { obj.TargetEventStore = message.TargetEventStore; } if (message.SubscriptionIds?.length) { obj.SubscriptionIds = message.SubscriptionIds; } return obj; }, create(base?: DeepPartial): RemoveEventStoreSubscriptions { return RemoveEventStoreSubscriptions.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): RemoveEventStoreSubscriptions { const message = createBaseRemoveEventStoreSubscriptions(); message.TargetEventStore = object.TargetEventStore ?? ""; message.SubscriptionIds = object.SubscriptionIds?.map((e) => e) || []; return message; }, }; export type EventStoreSubscriptionsDefinition = typeof EventStoreSubscriptionsDefinition; export const EventStoreSubscriptionsDefinition = { name: "EventStoreSubscriptions", fullName: "Cratis.Chronicle.Contracts.Observation.EventStoreSubscriptions.EventStoreSubscriptions", methods: { add: { name: "Add", requestType: AddEventStoreSubscriptions as typeof AddEventStoreSubscriptions, requestStream: false, responseType: Empty as typeof Empty, responseStream: false, options: {}, }, getSubscriptions: { name: "GetSubscriptions", requestType: GetEventStoreSubscriptionsRequest as typeof GetEventStoreSubscriptionsRequest, requestStream: false, responseType: IEnumerableEventStoreSubscriptionDefinition as typeof IEnumerableEventStoreSubscriptionDefinition, responseStream: false, options: {}, }, remove: { name: "Remove", requestType: RemoveEventStoreSubscriptions as typeof RemoveEventStoreSubscriptions, requestStream: false, responseType: Empty as typeof Empty, responseStream: false, options: {}, }, }, } as const; export interface EventStoreSubscriptionsServiceImplementation { add(request: AddEventStoreSubscriptions, context: CallContext & CallContextExt): Promise>; getSubscriptions( request: GetEventStoreSubscriptionsRequest, context: CallContext & CallContextExt, ): Promise>; remove(request: RemoveEventStoreSubscriptions, context: CallContext & CallContextExt): Promise>; } export interface EventStoreSubscriptionsClient { add(request: DeepPartial, options?: CallOptions & CallOptionsExt): Promise; getSubscriptions( request: DeepPartial, options?: CallOptions & CallOptionsExt, ): Promise; remove(request: DeepPartial, options?: CallOptions & CallOptionsExt): Promise; } type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; export type DeepPartial = T extends bigint ? string | number | bigint : T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; function isSet(value: any): boolean { return value !== null && value !== undefined; } export interface MessageFns { encode(message: T, writer?: BinaryWriter): BinaryWriter; decode(input: BinaryReader | Uint8Array, length?: number): T; fromJSON(object: any): T; toJSON(message: T): unknown; create(base?: DeepPartial): T; fromPartial(object: DeepPartial): T; }