// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.15.3 // protoc v5.28.3 // source: eventsources.proto /* eslint-disable */ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import type { CallContext, CallOptions } from "nice-grpc-common"; import { Guid } from "./protobuf-net/bcl"; export const protobufPackage = "Cratis.Chronicle.Contracts.EventSources"; export enum ConcurrencyDimensions { /** CONCURRENCY_DIMENSIONS_None - this is a composite/flags enumeration */ CONCURRENCY_DIMENSIONS_None = 0, EventSourceId = 1, EventSourceType = 2, EventStreamType = 4, EventStreamId = 8, UNRECOGNIZED = -1, } export function concurrencyDimensionsFromJSON(object: any): ConcurrencyDimensions { switch (object) { case 0: case "CONCURRENCY_DIMENSIONS_None": return ConcurrencyDimensions.CONCURRENCY_DIMENSIONS_None; case 1: case "EventSourceId": return ConcurrencyDimensions.EventSourceId; case 2: case "EventSourceType": return ConcurrencyDimensions.EventSourceType; case 4: case "EventStreamType": return ConcurrencyDimensions.EventStreamType; case 8: case "EventStreamId": return ConcurrencyDimensions.EventStreamId; case -1: case "UNRECOGNIZED": default: return ConcurrencyDimensions.UNRECOGNIZED; } } export function concurrencyDimensionsToJSON(object: ConcurrencyDimensions): string { switch (object) { case ConcurrencyDimensions.CONCURRENCY_DIMENSIONS_None: return "CONCURRENCY_DIMENSIONS_None"; case ConcurrencyDimensions.EventSourceId: return "EventSourceId"; case ConcurrencyDimensions.EventSourceType: return "EventSourceType"; case ConcurrencyDimensions.EventStreamType: return "EventStreamType"; case ConcurrencyDimensions.EventStreamId: return "EventStreamId"; case ConcurrencyDimensions.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } export enum EventSourceOwner { EVENT_SOURCE_OWNER_None = 0, Client = 1, Kernel = 2, UNRECOGNIZED = -1, } export function eventSourceOwnerFromJSON(object: any): EventSourceOwner { switch (object) { case 0: case "EVENT_SOURCE_OWNER_None": return EventSourceOwner.EVENT_SOURCE_OWNER_None; case 1: case "Client": return EventSourceOwner.Client; case 2: case "Kernel": return EventSourceOwner.Kernel; case -1: case "UNRECOGNIZED": default: return EventSourceOwner.UNRECOGNIZED; } } export function eventSourceOwnerToJSON(object: EventSourceOwner): string { switch (object) { case EventSourceOwner.EVENT_SOURCE_OWNER_None: return "EVENT_SOURCE_OWNER_None"; case EventSourceOwner.Client: return "Client"; case EventSourceOwner.Kernel: return "Kernel"; case EventSourceOwner.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } export enum ValidationResultSeverity { Unknown = 0, Information = 1, Warning = 2, Error = 3, UNRECOGNIZED = -1, } export function validationResultSeverityFromJSON(object: any): ValidationResultSeverity { switch (object) { case 0: case "Unknown": return ValidationResultSeverity.Unknown; case 1: case "Information": return ValidationResultSeverity.Information; case 2: case "Warning": return ValidationResultSeverity.Warning; case 3: case "Error": return ValidationResultSeverity.Error; case -1: case "UNRECOGNIZED": default: return ValidationResultSeverity.UNRECOGNIZED; } } export function validationResultSeverityToJSON(object: ValidationResultSeverity): string { switch (object) { case ValidationResultSeverity.Unknown: return "Unknown"; case ValidationResultSeverity.Information: return "Information"; case ValidationResultSeverity.Warning: return "Warning"; case ValidationResultSeverity.Error: return "Error"; case ValidationResultSeverity.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } export interface AllEventSourcesRequest { EventStore: string; } export interface CommandResult { /** default value could not be applied: 00000000-0000-0000-0000-000000000000 */ CorrelationId: Guid | undefined; IsAuthorized: boolean; ValidationResults: ValidationResult[]; ExceptionMessages: string[]; ExceptionStackTrace: string; AuthorizationFailureReason: string; } export interface EventSourceDefinition { Name: string; Description: string; Owner: EventSourceOwner; Concurrency: ConcurrencyDimensions; Streams: EventStreamDefinition[]; } export interface EventSourceDetailsResponse { Id: string; Name: string; Description: string; Owner: EventSourceOwner; Concurrency: ConcurrencyDimensions; Streams: EventStreamDefinition[]; } export interface EventStreamDefinition { Name: string; Description: string; Concurrency: ConcurrencyDimensions; } export interface ObserveEventSourcesRequest { EventStore: string; } export interface QueryResultIEnumerableEventSourceDetailsResponse { /** default value could not be applied: 00000000-0000-0000-0000-000000000000 */ CorrelationId: Guid | undefined; IsAuthorized: boolean; ValidationResults: ValidationResult[]; ExceptionMessages: string[]; ExceptionStackTrace: string; Data: EventSourceDetailsResponse[]; } export interface RegisterEventSourcesRequest { EventStore: string; Sources: EventSourceDefinition[]; } export interface ValidationResult { /** default value could not be applied: Error */ Severity: ValidationResultSeverity; Message: string; Members: string[]; } function createBaseAllEventSourcesRequest(): AllEventSourcesRequest { return { EventStore: "" }; } export const AllEventSourcesRequest: MessageFns = { encode(message: AllEventSourcesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.EventStore !== "") { writer.uint32(10).string(message.EventStore); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): AllEventSourcesRequest { 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 = createBaseAllEventSourcesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.EventStore = 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): AllEventSourcesRequest { return { EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "" }; }, toJSON(message: AllEventSourcesRequest): unknown { const obj: any = {}; if (message.EventStore !== "") { obj.EventStore = message.EventStore; } return obj; }, create(base?: DeepPartial): AllEventSourcesRequest { return AllEventSourcesRequest.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): AllEventSourcesRequest { const message = createBaseAllEventSourcesRequest(); message.EventStore = object.EventStore ?? ""; return message; }, }; function createBaseCommandResult(): CommandResult { return { CorrelationId: undefined, IsAuthorized: false, ValidationResults: [], ExceptionMessages: [], ExceptionStackTrace: "", AuthorizationFailureReason: "", }; } export const CommandResult: MessageFns = { encode(message: CommandResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.CorrelationId !== undefined) { Guid.encode(message.CorrelationId, writer.uint32(10).fork()).join(); } if (message.IsAuthorized !== false) { writer.uint32(16).bool(message.IsAuthorized); } for (const v of message.ValidationResults) { ValidationResult.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.ExceptionMessages) { writer.uint32(34).string(v!); } if (message.ExceptionStackTrace !== "") { writer.uint32(42).string(message.ExceptionStackTrace); } if (message.AuthorizationFailureReason !== "") { writer.uint32(50).string(message.AuthorizationFailureReason); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): CommandResult { 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 = createBaseCommandResult(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.CorrelationId = Guid.decode(reader, reader.uint32()); continue; } case 2: { if (tag !== 16) { break; } message.IsAuthorized = reader.bool(); continue; } case 3: { if (tag !== 26) { break; } message.ValidationResults.push(ValidationResult.decode(reader, reader.uint32())); continue; } case 4: { if (tag !== 34) { break; } message.ExceptionMessages.push(reader.string()); continue; } case 5: { if (tag !== 42) { break; } message.ExceptionStackTrace = reader.string(); continue; } case 6: { if (tag !== 50) { break; } message.AuthorizationFailureReason = 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): CommandResult { return { CorrelationId: isSet(object.CorrelationId) ? Guid.fromJSON(object.CorrelationId) : undefined, IsAuthorized: isSet(object.IsAuthorized) ? globalThis.Boolean(object.IsAuthorized) : false, ValidationResults: globalThis.Array.isArray(object?.ValidationResults) ? object.ValidationResults.map((e: any) => ValidationResult.fromJSON(e)) : [], ExceptionMessages: globalThis.Array.isArray(object?.ExceptionMessages) ? object.ExceptionMessages.map((e: any) => globalThis.String(e)) : [], ExceptionStackTrace: isSet(object.ExceptionStackTrace) ? globalThis.String(object.ExceptionStackTrace) : "", AuthorizationFailureReason: isSet(object.AuthorizationFailureReason) ? globalThis.String(object.AuthorizationFailureReason) : "", }; }, toJSON(message: CommandResult): unknown { const obj: any = {}; if (message.CorrelationId !== undefined) { obj.CorrelationId = Guid.toJSON(message.CorrelationId); } if (message.IsAuthorized !== false) { obj.IsAuthorized = message.IsAuthorized; } if (message.ValidationResults?.length) { obj.ValidationResults = message.ValidationResults.map((e) => ValidationResult.toJSON(e)); } if (message.ExceptionMessages?.length) { obj.ExceptionMessages = message.ExceptionMessages; } if (message.ExceptionStackTrace !== "") { obj.ExceptionStackTrace = message.ExceptionStackTrace; } if (message.AuthorizationFailureReason !== "") { obj.AuthorizationFailureReason = message.AuthorizationFailureReason; } return obj; }, create(base?: DeepPartial): CommandResult { return CommandResult.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): CommandResult { const message = createBaseCommandResult(); message.CorrelationId = (object.CorrelationId !== undefined && object.CorrelationId !== null) ? Guid.fromPartial(object.CorrelationId) : undefined; message.IsAuthorized = object.IsAuthorized ?? false; message.ValidationResults = object.ValidationResults?.map((e) => ValidationResult.fromPartial(e)) || []; message.ExceptionMessages = object.ExceptionMessages?.map((e) => e) || []; message.ExceptionStackTrace = object.ExceptionStackTrace ?? ""; message.AuthorizationFailureReason = object.AuthorizationFailureReason ?? ""; return message; }, }; function createBaseEventSourceDefinition(): EventSourceDefinition { return { Name: "", Description: "", Owner: 0, Concurrency: 0, Streams: [] }; } export const EventSourceDefinition: MessageFns = { encode(message: EventSourceDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.Name !== "") { writer.uint32(10).string(message.Name); } if (message.Description !== "") { writer.uint32(18).string(message.Description); } if (message.Owner !== 0) { writer.uint32(24).int32(message.Owner); } if (message.Concurrency !== 0) { writer.uint32(32).int32(message.Concurrency); } for (const v of message.Streams) { EventStreamDefinition.encode(v!, writer.uint32(42).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): EventSourceDefinition { 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 = createBaseEventSourceDefinition(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.Name = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.Description = reader.string(); continue; } case 3: { if (tag !== 24) { break; } message.Owner = reader.int32() as any; continue; } case 4: { if (tag !== 32) { break; } message.Concurrency = reader.int32() as any; continue; } case 5: { if (tag !== 42) { break; } message.Streams.push(EventStreamDefinition.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): EventSourceDefinition { return { Name: isSet(object.Name) ? globalThis.String(object.Name) : "", Description: isSet(object.Description) ? globalThis.String(object.Description) : "", Owner: isSet(object.Owner) ? eventSourceOwnerFromJSON(object.Owner) : 0, Concurrency: isSet(object.Concurrency) ? concurrencyDimensionsFromJSON(object.Concurrency) : 0, Streams: globalThis.Array.isArray(object?.Streams) ? object.Streams.map((e: any) => EventStreamDefinition.fromJSON(e)) : [], }; }, toJSON(message: EventSourceDefinition): unknown { const obj: any = {}; if (message.Name !== "") { obj.Name = message.Name; } if (message.Description !== "") { obj.Description = message.Description; } if (message.Owner !== 0) { obj.Owner = eventSourceOwnerToJSON(message.Owner); } if (message.Concurrency !== 0) { obj.Concurrency = concurrencyDimensionsToJSON(message.Concurrency); } if (message.Streams?.length) { obj.Streams = message.Streams.map((e) => EventStreamDefinition.toJSON(e)); } return obj; }, create(base?: DeepPartial): EventSourceDefinition { return EventSourceDefinition.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): EventSourceDefinition { const message = createBaseEventSourceDefinition(); message.Name = object.Name ?? ""; message.Description = object.Description ?? ""; message.Owner = object.Owner ?? 0; message.Concurrency = object.Concurrency ?? 0; message.Streams = object.Streams?.map((e) => EventStreamDefinition.fromPartial(e)) || []; return message; }, }; function createBaseEventSourceDetailsResponse(): EventSourceDetailsResponse { return { Id: "", Name: "", Description: "", Owner: 0, Concurrency: 0, Streams: [] }; } export const EventSourceDetailsResponse: MessageFns = { encode(message: EventSourceDetailsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.Id !== "") { writer.uint32(10).string(message.Id); } if (message.Name !== "") { writer.uint32(18).string(message.Name); } if (message.Description !== "") { writer.uint32(26).string(message.Description); } if (message.Owner !== 0) { writer.uint32(32).int32(message.Owner); } if (message.Concurrency !== 0) { writer.uint32(40).int32(message.Concurrency); } for (const v of message.Streams) { EventStreamDefinition.encode(v!, writer.uint32(50).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): EventSourceDetailsResponse { 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 = createBaseEventSourceDetailsResponse(); 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 !== 18) { break; } message.Name = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.Description = reader.string(); continue; } case 4: { if (tag !== 32) { break; } message.Owner = reader.int32() as any; continue; } case 5: { if (tag !== 40) { break; } message.Concurrency = reader.int32() as any; continue; } case 6: { if (tag !== 50) { break; } message.Streams.push(EventStreamDefinition.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): EventSourceDetailsResponse { return { Id: isSet(object.Id) ? globalThis.String(object.Id) : "", Name: isSet(object.Name) ? globalThis.String(object.Name) : "", Description: isSet(object.Description) ? globalThis.String(object.Description) : "", Owner: isSet(object.Owner) ? eventSourceOwnerFromJSON(object.Owner) : 0, Concurrency: isSet(object.Concurrency) ? concurrencyDimensionsFromJSON(object.Concurrency) : 0, Streams: globalThis.Array.isArray(object?.Streams) ? object.Streams.map((e: any) => EventStreamDefinition.fromJSON(e)) : [], }; }, toJSON(message: EventSourceDetailsResponse): unknown { const obj: any = {}; if (message.Id !== "") { obj.Id = message.Id; } if (message.Name !== "") { obj.Name = message.Name; } if (message.Description !== "") { obj.Description = message.Description; } if (message.Owner !== 0) { obj.Owner = eventSourceOwnerToJSON(message.Owner); } if (message.Concurrency !== 0) { obj.Concurrency = concurrencyDimensionsToJSON(message.Concurrency); } if (message.Streams?.length) { obj.Streams = message.Streams.map((e) => EventStreamDefinition.toJSON(e)); } return obj; }, create(base?: DeepPartial): EventSourceDetailsResponse { return EventSourceDetailsResponse.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): EventSourceDetailsResponse { const message = createBaseEventSourceDetailsResponse(); message.Id = object.Id ?? ""; message.Name = object.Name ?? ""; message.Description = object.Description ?? ""; message.Owner = object.Owner ?? 0; message.Concurrency = object.Concurrency ?? 0; message.Streams = object.Streams?.map((e) => EventStreamDefinition.fromPartial(e)) || []; return message; }, }; function createBaseEventStreamDefinition(): EventStreamDefinition { return { Name: "", Description: "", Concurrency: 0 }; } export const EventStreamDefinition: MessageFns = { encode(message: EventStreamDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.Name !== "") { writer.uint32(10).string(message.Name); } if (message.Description !== "") { writer.uint32(18).string(message.Description); } if (message.Concurrency !== 0) { writer.uint32(24).int32(message.Concurrency); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): EventStreamDefinition { 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 = createBaseEventStreamDefinition(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.Name = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.Description = reader.string(); continue; } case 3: { if (tag !== 24) { break; } message.Concurrency = reader.int32() as any; continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; } finally { (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; } }, fromJSON(object: any): EventStreamDefinition { return { Name: isSet(object.Name) ? globalThis.String(object.Name) : "", Description: isSet(object.Description) ? globalThis.String(object.Description) : "", Concurrency: isSet(object.Concurrency) ? concurrencyDimensionsFromJSON(object.Concurrency) : 0, }; }, toJSON(message: EventStreamDefinition): unknown { const obj: any = {}; if (message.Name !== "") { obj.Name = message.Name; } if (message.Description !== "") { obj.Description = message.Description; } if (message.Concurrency !== 0) { obj.Concurrency = concurrencyDimensionsToJSON(message.Concurrency); } return obj; }, create(base?: DeepPartial): EventStreamDefinition { return EventStreamDefinition.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): EventStreamDefinition { const message = createBaseEventStreamDefinition(); message.Name = object.Name ?? ""; message.Description = object.Description ?? ""; message.Concurrency = object.Concurrency ?? 0; return message; }, }; function createBaseObserveEventSourcesRequest(): ObserveEventSourcesRequest { return { EventStore: "" }; } export const ObserveEventSourcesRequest: MessageFns = { encode(message: ObserveEventSourcesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.EventStore !== "") { writer.uint32(10).string(message.EventStore); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): ObserveEventSourcesRequest { 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 = createBaseObserveEventSourcesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.EventStore = 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): ObserveEventSourcesRequest { return { EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "" }; }, toJSON(message: ObserveEventSourcesRequest): unknown { const obj: any = {}; if (message.EventStore !== "") { obj.EventStore = message.EventStore; } return obj; }, create(base?: DeepPartial): ObserveEventSourcesRequest { return ObserveEventSourcesRequest.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): ObserveEventSourcesRequest { const message = createBaseObserveEventSourcesRequest(); message.EventStore = object.EventStore ?? ""; return message; }, }; function createBaseQueryResultIEnumerableEventSourceDetailsResponse(): QueryResultIEnumerableEventSourceDetailsResponse { return { CorrelationId: undefined, IsAuthorized: false, ValidationResults: [], ExceptionMessages: [], ExceptionStackTrace: "", Data: [], }; } export const QueryResultIEnumerableEventSourceDetailsResponse: MessageFns< QueryResultIEnumerableEventSourceDetailsResponse > = { encode( message: QueryResultIEnumerableEventSourceDetailsResponse, writer: BinaryWriter = new BinaryWriter(), ): BinaryWriter { if (message.CorrelationId !== undefined) { Guid.encode(message.CorrelationId, writer.uint32(10).fork()).join(); } if (message.IsAuthorized !== false) { writer.uint32(16).bool(message.IsAuthorized); } for (const v of message.ValidationResults) { ValidationResult.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.ExceptionMessages) { writer.uint32(34).string(v!); } if (message.ExceptionStackTrace !== "") { writer.uint32(42).string(message.ExceptionStackTrace); } for (const v of message.Data) { EventSourceDetailsResponse.encode(v!, writer.uint32(50).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryResultIEnumerableEventSourceDetailsResponse { 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 = createBaseQueryResultIEnumerableEventSourceDetailsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.CorrelationId = Guid.decode(reader, reader.uint32()); continue; } case 2: { if (tag !== 16) { break; } message.IsAuthorized = reader.bool(); continue; } case 3: { if (tag !== 26) { break; } message.ValidationResults.push(ValidationResult.decode(reader, reader.uint32())); continue; } case 4: { if (tag !== 34) { break; } message.ExceptionMessages.push(reader.string()); continue; } case 5: { if (tag !== 42) { break; } message.ExceptionStackTrace = reader.string(); continue; } case 6: { if (tag !== 50) { break; } message.Data.push(EventSourceDetailsResponse.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): QueryResultIEnumerableEventSourceDetailsResponse { return { CorrelationId: isSet(object.CorrelationId) ? Guid.fromJSON(object.CorrelationId) : undefined, IsAuthorized: isSet(object.IsAuthorized) ? globalThis.Boolean(object.IsAuthorized) : false, ValidationResults: globalThis.Array.isArray(object?.ValidationResults) ? object.ValidationResults.map((e: any) => ValidationResult.fromJSON(e)) : [], ExceptionMessages: globalThis.Array.isArray(object?.ExceptionMessages) ? object.ExceptionMessages.map((e: any) => globalThis.String(e)) : [], ExceptionStackTrace: isSet(object.ExceptionStackTrace) ? globalThis.String(object.ExceptionStackTrace) : "", Data: globalThis.Array.isArray(object?.Data) ? object.Data.map((e: any) => EventSourceDetailsResponse.fromJSON(e)) : [], }; }, toJSON(message: QueryResultIEnumerableEventSourceDetailsResponse): unknown { const obj: any = {}; if (message.CorrelationId !== undefined) { obj.CorrelationId = Guid.toJSON(message.CorrelationId); } if (message.IsAuthorized !== false) { obj.IsAuthorized = message.IsAuthorized; } if (message.ValidationResults?.length) { obj.ValidationResults = message.ValidationResults.map((e) => ValidationResult.toJSON(e)); } if (message.ExceptionMessages?.length) { obj.ExceptionMessages = message.ExceptionMessages; } if (message.ExceptionStackTrace !== "") { obj.ExceptionStackTrace = message.ExceptionStackTrace; } if (message.Data?.length) { obj.Data = message.Data.map((e) => EventSourceDetailsResponse.toJSON(e)); } return obj; }, create( base?: DeepPartial, ): QueryResultIEnumerableEventSourceDetailsResponse { return QueryResultIEnumerableEventSourceDetailsResponse.fromPartial(base ?? {}); }, fromPartial( object: DeepPartial, ): QueryResultIEnumerableEventSourceDetailsResponse { const message = createBaseQueryResultIEnumerableEventSourceDetailsResponse(); message.CorrelationId = (object.CorrelationId !== undefined && object.CorrelationId !== null) ? Guid.fromPartial(object.CorrelationId) : undefined; message.IsAuthorized = object.IsAuthorized ?? false; message.ValidationResults = object.ValidationResults?.map((e) => ValidationResult.fromPartial(e)) || []; message.ExceptionMessages = object.ExceptionMessages?.map((e) => e) || []; message.ExceptionStackTrace = object.ExceptionStackTrace ?? ""; message.Data = object.Data?.map((e) => EventSourceDetailsResponse.fromPartial(e)) || []; return message; }, }; function createBaseRegisterEventSourcesRequest(): RegisterEventSourcesRequest { return { EventStore: "", Sources: [] }; } export const RegisterEventSourcesRequest: MessageFns = { encode(message: RegisterEventSourcesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.EventStore !== "") { writer.uint32(10).string(message.EventStore); } for (const v of message.Sources) { EventSourceDefinition.encode(v!, writer.uint32(18).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): RegisterEventSourcesRequest { 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 = createBaseRegisterEventSourcesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.EventStore = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.Sources.push(EventSourceDefinition.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): RegisterEventSourcesRequest { return { EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "", Sources: globalThis.Array.isArray(object?.Sources) ? object.Sources.map((e: any) => EventSourceDefinition.fromJSON(e)) : [], }; }, toJSON(message: RegisterEventSourcesRequest): unknown { const obj: any = {}; if (message.EventStore !== "") { obj.EventStore = message.EventStore; } if (message.Sources?.length) { obj.Sources = message.Sources.map((e) => EventSourceDefinition.toJSON(e)); } return obj; }, create(base?: DeepPartial): RegisterEventSourcesRequest { return RegisterEventSourcesRequest.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): RegisterEventSourcesRequest { const message = createBaseRegisterEventSourcesRequest(); message.EventStore = object.EventStore ?? ""; message.Sources = object.Sources?.map((e) => EventSourceDefinition.fromPartial(e)) || []; return message; }, }; function createBaseValidationResult(): ValidationResult { return { Severity: 0, Message: "", Members: [] }; } export const ValidationResult: MessageFns = { encode(message: ValidationResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.Severity !== 0) { writer.uint32(8).int32(message.Severity); } if (message.Message !== "") { writer.uint32(18).string(message.Message); } for (const v of message.Members) { writer.uint32(26).string(v!); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): ValidationResult { 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 = createBaseValidationResult(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.Severity = reader.int32() as any; continue; } case 2: { if (tag !== 18) { break; } message.Message = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.Members.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): ValidationResult { return { Severity: isSet(object.Severity) ? validationResultSeverityFromJSON(object.Severity) : 0, Message: isSet(object.Message) ? globalThis.String(object.Message) : "", Members: globalThis.Array.isArray(object?.Members) ? object.Members.map((e: any) => globalThis.String(e)) : [], }; }, toJSON(message: ValidationResult): unknown { const obj: any = {}; if (message.Severity !== 0) { obj.Severity = validationResultSeverityToJSON(message.Severity); } if (message.Message !== "") { obj.Message = message.Message; } if (message.Members?.length) { obj.Members = message.Members; } return obj; }, create(base?: DeepPartial): ValidationResult { return ValidationResult.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): ValidationResult { const message = createBaseValidationResult(); message.Severity = object.Severity ?? 0; message.Message = object.Message ?? ""; message.Members = object.Members?.map((e) => e) || []; return message; }, }; export type EventSourcesDefinition = typeof EventSourcesDefinition; export const EventSourcesDefinition = { name: "EventSources", fullName: "Cratis.Chronicle.Contracts.EventSources.EventSources", methods: { allEventSources: { name: "AllEventSources", requestType: AllEventSourcesRequest as typeof AllEventSourcesRequest, requestStream: false, responseType: QueryResultIEnumerableEventSourceDetailsResponse as typeof QueryResultIEnumerableEventSourceDetailsResponse, responseStream: false, options: {}, }, observeEventSources: { name: "ObserveEventSources", requestType: ObserveEventSourcesRequest as typeof ObserveEventSourcesRequest, requestStream: false, responseType: QueryResultIEnumerableEventSourceDetailsResponse as typeof QueryResultIEnumerableEventSourceDetailsResponse, responseStream: true, options: {}, }, registerEventSources: { name: "RegisterEventSources", requestType: RegisterEventSourcesRequest as typeof RegisterEventSourcesRequest, requestStream: false, responseType: CommandResult as typeof CommandResult, responseStream: false, options: {}, }, }, } as const; export interface EventSourcesServiceImplementation { allEventSources( request: AllEventSourcesRequest, context: CallContext & CallContextExt, ): Promise>; observeEventSources( request: ObserveEventSourcesRequest, context: CallContext & CallContextExt, ): ServerStreamingMethodResult>; registerEventSources( request: RegisterEventSourcesRequest, context: CallContext & CallContextExt, ): Promise>; } export interface EventSourcesClient { allEventSources( request: DeepPartial, options?: CallOptions & CallOptionsExt, ): Promise; observeEventSources( request: DeepPartial, options?: CallOptions & CallOptionsExt, ): AsyncIterable; registerEventSources( 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 type ServerStreamingMethodResult = { [Symbol.asyncIterator](): AsyncIterator }; 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; }