// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.12.4 // protoc v5.28.3 // source: externalservices.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.ExternalServices"; export enum AuthorizationType { None = 0, Basic = 1, Bearer = 2, OAuth = 3, UNRECOGNIZED = -1, } export function authorizationTypeFromJSON(object: any): AuthorizationType { switch (object) { case 0: case "None": return AuthorizationType.None; case 1: case "Basic": return AuthorizationType.Basic; case 2: case "Bearer": return AuthorizationType.Bearer; case 3: case "OAuth": return AuthorizationType.OAuth; case -1: case "UNRECOGNIZED": default: return AuthorizationType.UNRECOGNIZED; } } export function authorizationTypeToJSON(object: AuthorizationType): string { switch (object) { case AuthorizationType.None: return "None"; case AuthorizationType.Basic: return "Basic"; case AuthorizationType.Bearer: return "Bearer"; case AuthorizationType.OAuth: return "OAuth"; case AuthorizationType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } export enum ExternalServiceEndpointType { Http = 0, MsSql = 1, PostgreSql = 2, UNRECOGNIZED = -1, } export function externalServiceEndpointTypeFromJSON(object: any): ExternalServiceEndpointType { switch (object) { case 0: case "Http": return ExternalServiceEndpointType.Http; case 1: case "MsSql": return ExternalServiceEndpointType.MsSql; case 2: case "PostgreSql": return ExternalServiceEndpointType.PostgreSql; case -1: case "UNRECOGNIZED": default: return ExternalServiceEndpointType.UNRECOGNIZED; } } export function externalServiceEndpointTypeToJSON(object: ExternalServiceEndpointType): string { switch (object) { case ExternalServiceEndpointType.Http: return "Http"; case ExternalServiceEndpointType.MsSql: return "MsSql"; case ExternalServiceEndpointType.PostgreSql: return "PostgreSql"; case ExternalServiceEndpointType.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 AddExternalServiceRequest { EventStore: string; Id: string; Name: string; EndpointType: ExternalServiceEndpointType; Url: string; AuthorizationType: AuthorizationType; BasicUsername: string; BasicPassword: string; BearerToken: string; OAuthAuthority: string; OAuthClientId: string; OAuthClientSecret: string; Headers: { [key: string]: string }; Host: string; Port: number; Database: string; Username: string; Password: string; Options: { [key: string]: string }; } export interface AddExternalServiceRequest_HeadersEntry { key: string; value: string; } export interface AddExternalServiceRequest_OptionsEntry { key: string; value: string; } export interface AddExternalServicesRequest { EventStore: string; ExternalServices: ExternalServiceDefinition[]; } export interface BasicAuthorization { Username: string; Password: string; } export interface BearerTokenAuthorization { Token: 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 DatabaseEndpointConfiguration { Host: string; Port: number; Database: string; Username: string; Password: string; Options: { [key: string]: string }; } export interface DatabaseEndpointConfiguration_OptionsEntry { key: string; value: string; } export interface ExternalServiceDefinition { Id: string; Name: string; Endpoint: ExternalServiceEndpoint | undefined; } export interface ExternalServiceEndpoint { Type: ExternalServiceEndpointType; Http: HttpEndpointConfiguration | undefined; Database: DatabaseEndpointConfiguration | undefined; } export interface ExternalServiceResponse { Id: string; Name: string; EndpointType: ExternalServiceEndpointType; Url: string; AuthorizationType: AuthorizationType; Headers: { [key: string]: string }; Host: string; Port: number; Database: string; Username: string; Options: { [key: string]: string }; } export interface ExternalServiceResponse_HeadersEntry { key: string; value: string; } export interface ExternalServiceResponse_OptionsEntry { key: string; value: string; } export interface GetExternalServicesRequest { EventStore: string; } export interface HttpEndpointConfiguration { Url: string; Authorization: OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization | undefined; Headers: { [key: string]: string }; } export interface HttpEndpointConfiguration_HeadersEntry { key: string; value: string; } export interface OAuthAuthorization { Authority: string; ClientId: string; ClientSecret: string; } export interface ObserveExternalServicesRequest { EventStore: string; } export interface OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization { Value0: BasicAuthorization | undefined; Value1: BearerTokenAuthorization | undefined; Value2: OAuthAuthorization | undefined; } export interface QueryResultIEnumerableExternalServiceResponse { /** default value could not be applied: 00000000-0000-0000-0000-000000000000 */ CorrelationId: Guid | undefined; IsAuthorized: boolean; ValidationResults: ValidationResult[]; ExceptionMessages: string[]; ExceptionStackTrace: string; Data: ExternalServiceResponse[]; } export interface RemoveExternalServiceRequest { EventStore: string; ExternalServiceId: string; } export interface RemoveExternalServicesRequest { EventStore: string; ExternalServices: string[]; } export interface ValidationResult { /** default value could not be applied: Error */ Severity: ValidationResultSeverity; Message: string; Members: string[]; } function createBaseAddExternalServiceRequest(): AddExternalServiceRequest { return { EventStore: "", Id: "", Name: "", EndpointType: 0, Url: "", AuthorizationType: 0, BasicUsername: "", BasicPassword: "", BearerToken: "", OAuthAuthority: "", OAuthClientId: "", OAuthClientSecret: "", Headers: {}, Host: "", Port: 0, Database: "", Username: "", Password: "", Options: {}, }; } export const AddExternalServiceRequest: MessageFns = { encode(message: AddExternalServiceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.EventStore !== "") { writer.uint32(10).string(message.EventStore); } if (message.Id !== "") { writer.uint32(18).string(message.Id); } if (message.Name !== "") { writer.uint32(26).string(message.Name); } if (message.EndpointType !== 0) { writer.uint32(32).int32(message.EndpointType); } if (message.Url !== "") { writer.uint32(42).string(message.Url); } if (message.AuthorizationType !== 0) { writer.uint32(48).int32(message.AuthorizationType); } if (message.BasicUsername !== "") { writer.uint32(58).string(message.BasicUsername); } if (message.BasicPassword !== "") { writer.uint32(66).string(message.BasicPassword); } if (message.BearerToken !== "") { writer.uint32(74).string(message.BearerToken); } if (message.OAuthAuthority !== "") { writer.uint32(82).string(message.OAuthAuthority); } if (message.OAuthClientId !== "") { writer.uint32(90).string(message.OAuthClientId); } if (message.OAuthClientSecret !== "") { writer.uint32(98).string(message.OAuthClientSecret); } globalThis.Object.entries(message.Headers).forEach(([key, value]: [string, string]) => { AddExternalServiceRequest_HeadersEntry.encode({ key: key as any, value }, writer.uint32(106).fork()).join(); }); if (message.Host !== "") { writer.uint32(114).string(message.Host); } if (message.Port !== 0) { writer.uint32(120).int32(message.Port); } if (message.Database !== "") { writer.uint32(130).string(message.Database); } if (message.Username !== "") { writer.uint32(138).string(message.Username); } if (message.Password !== "") { writer.uint32(146).string(message.Password); } globalThis.Object.entries(message.Options).forEach(([key, value]: [string, string]) => { AddExternalServiceRequest_OptionsEntry.encode({ key: key as any, value }, writer.uint32(154).fork()).join(); }); return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): AddExternalServiceRequest { 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 = createBaseAddExternalServiceRequest(); 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.Id = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.Name = reader.string(); continue; } case 4: { if (tag !== 32) { break; } message.EndpointType = reader.int32() as any; continue; } case 5: { if (tag !== 42) { break; } message.Url = reader.string(); continue; } case 6: { if (tag !== 48) { break; } message.AuthorizationType = reader.int32() as any; continue; } case 7: { if (tag !== 58) { break; } message.BasicUsername = reader.string(); continue; } case 8: { if (tag !== 66) { break; } message.BasicPassword = reader.string(); continue; } case 9: { if (tag !== 74) { break; } message.BearerToken = reader.string(); continue; } case 10: { if (tag !== 82) { break; } message.OAuthAuthority = reader.string(); continue; } case 11: { if (tag !== 90) { break; } message.OAuthClientId = reader.string(); continue; } case 12: { if (tag !== 98) { break; } message.OAuthClientSecret = reader.string(); continue; } case 13: { if (tag !== 106) { break; } const entry13 = AddExternalServiceRequest_HeadersEntry.decode(reader, reader.uint32()); if (entry13.value !== undefined) { message.Headers[entry13.key] = entry13.value; } continue; } case 14: { if (tag !== 114) { break; } message.Host = reader.string(); continue; } case 15: { if (tag !== 120) { break; } message.Port = reader.int32(); continue; } case 16: { if (tag !== 130) { break; } message.Database = reader.string(); continue; } case 17: { if (tag !== 138) { break; } message.Username = reader.string(); continue; } case 18: { if (tag !== 146) { break; } message.Password = reader.string(); continue; } case 19: { if (tag !== 154) { break; } const entry19 = AddExternalServiceRequest_OptionsEntry.decode(reader, reader.uint32()); if (entry19.value !== undefined) { message.Options[entry19.key] = entry19.value; } continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; } finally { (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; } }, fromJSON(object: any): AddExternalServiceRequest { return { EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "", Id: isSet(object.Id) ? globalThis.String(object.Id) : "", Name: isSet(object.Name) ? globalThis.String(object.Name) : "", EndpointType: isSet(object.EndpointType) ? externalServiceEndpointTypeFromJSON(object.EndpointType) : 0, Url: isSet(object.Url) ? globalThis.String(object.Url) : "", AuthorizationType: isSet(object.AuthorizationType) ? authorizationTypeFromJSON(object.AuthorizationType) : 0, BasicUsername: isSet(object.BasicUsername) ? globalThis.String(object.BasicUsername) : "", BasicPassword: isSet(object.BasicPassword) ? globalThis.String(object.BasicPassword) : "", BearerToken: isSet(object.BearerToken) ? globalThis.String(object.BearerToken) : "", OAuthAuthority: isSet(object.OAuthAuthority) ? globalThis.String(object.OAuthAuthority) : "", OAuthClientId: isSet(object.OAuthClientId) ? globalThis.String(object.OAuthClientId) : "", OAuthClientSecret: isSet(object.OAuthClientSecret) ? globalThis.String(object.OAuthClientSecret) : "", Headers: isObject(object.Headers) ? (globalThis.Object.entries(object.Headers) as [string, any][]).reduce( (acc: { [key: string]: string }, [key, value]: [string, any]) => { globalThis.Object.defineProperty(acc, key, { value: globalThis.String(value), enumerable: true, configurable: true, writable: true, }); return acc; }, {}, ) : {}, Host: isSet(object.Host) ? globalThis.String(object.Host) : "", Port: isSet(object.Port) ? globalThis.Number(object.Port) : 0, Database: isSet(object.Database) ? globalThis.String(object.Database) : "", Username: isSet(object.Username) ? globalThis.String(object.Username) : "", Password: isSet(object.Password) ? globalThis.String(object.Password) : "", Options: isObject(object.Options) ? (globalThis.Object.entries(object.Options) as [string, any][]).reduce( (acc: { [key: string]: string }, [key, value]: [string, any]) => { globalThis.Object.defineProperty(acc, key, { value: globalThis.String(value), enumerable: true, configurable: true, writable: true, }); return acc; }, {}, ) : {}, }; }, toJSON(message: AddExternalServiceRequest): unknown { const obj: any = {}; if (message.EventStore !== "") { obj.EventStore = message.EventStore; } if (message.Id !== "") { obj.Id = message.Id; } if (message.Name !== "") { obj.Name = message.Name; } if (message.EndpointType !== 0) { obj.EndpointType = externalServiceEndpointTypeToJSON(message.EndpointType); } if (message.Url !== "") { obj.Url = message.Url; } if (message.AuthorizationType !== 0) { obj.AuthorizationType = authorizationTypeToJSON(message.AuthorizationType); } if (message.BasicUsername !== "") { obj.BasicUsername = message.BasicUsername; } if (message.BasicPassword !== "") { obj.BasicPassword = message.BasicPassword; } if (message.BearerToken !== "") { obj.BearerToken = message.BearerToken; } if (message.OAuthAuthority !== "") { obj.OAuthAuthority = message.OAuthAuthority; } if (message.OAuthClientId !== "") { obj.OAuthClientId = message.OAuthClientId; } if (message.OAuthClientSecret !== "") { obj.OAuthClientSecret = message.OAuthClientSecret; } if (message.Headers) { const entries = globalThis.Object.entries(message.Headers) as [string, string][]; if (entries.length > 0) { obj.Headers = {}; entries.forEach(([k, v]) => { obj.Headers[k] = v; }); } } if (message.Host !== "") { obj.Host = message.Host; } if (message.Port !== 0) { obj.Port = Math.round(message.Port); } if (message.Database !== "") { obj.Database = message.Database; } if (message.Username !== "") { obj.Username = message.Username; } if (message.Password !== "") { obj.Password = message.Password; } if (message.Options) { const entries = globalThis.Object.entries(message.Options) as [string, string][]; if (entries.length > 0) { obj.Options = {}; entries.forEach(([k, v]) => { obj.Options[k] = v; }); } } return obj; }, create(base?: DeepPartial): AddExternalServiceRequest { return AddExternalServiceRequest.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): AddExternalServiceRequest { const message = createBaseAddExternalServiceRequest(); message.EventStore = object.EventStore ?? ""; message.Id = object.Id ?? ""; message.Name = object.Name ?? ""; message.EndpointType = object.EndpointType ?? 0; message.Url = object.Url ?? ""; message.AuthorizationType = object.AuthorizationType ?? 0; message.BasicUsername = object.BasicUsername ?? ""; message.BasicPassword = object.BasicPassword ?? ""; message.BearerToken = object.BearerToken ?? ""; message.OAuthAuthority = object.OAuthAuthority ?? ""; message.OAuthClientId = object.OAuthClientId ?? ""; message.OAuthClientSecret = object.OAuthClientSecret ?? ""; message.Headers = (globalThis.Object.entries(object.Headers ?? {}) as [string, string][]).reduce( (acc: { [key: string]: string }, [key, value]: [string, string]) => { if (value !== undefined) { acc[key] = globalThis.String(value); } return acc; }, {}, ); message.Host = object.Host ?? ""; message.Port = object.Port ?? 0; message.Database = object.Database ?? ""; message.Username = object.Username ?? ""; message.Password = object.Password ?? ""; message.Options = (globalThis.Object.entries(object.Options ?? {}) as [string, string][]).reduce( (acc: { [key: string]: string }, [key, value]: [string, string]) => { if (value !== undefined) { acc[key] = globalThis.String(value); } return acc; }, {}, ); return message; }, }; function createBaseAddExternalServiceRequest_HeadersEntry(): AddExternalServiceRequest_HeadersEntry { return { key: "", value: "" }; } export const AddExternalServiceRequest_HeadersEntry: MessageFns = { encode(message: AddExternalServiceRequest_HeadersEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); } if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): AddExternalServiceRequest_HeadersEntry { 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 = createBaseAddExternalServiceRequest_HeadersEntry(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.key = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.value = 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): AddExternalServiceRequest_HeadersEntry { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, toJSON(message: AddExternalServiceRequest_HeadersEntry): unknown { const obj: any = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== "") { obj.value = message.value; } return obj; }, create(base?: DeepPartial): AddExternalServiceRequest_HeadersEntry { return AddExternalServiceRequest_HeadersEntry.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): AddExternalServiceRequest_HeadersEntry { const message = createBaseAddExternalServiceRequest_HeadersEntry(); message.key = object.key ?? ""; message.value = object.value ?? ""; return message; }, }; function createBaseAddExternalServiceRequest_OptionsEntry(): AddExternalServiceRequest_OptionsEntry { return { key: "", value: "" }; } export const AddExternalServiceRequest_OptionsEntry: MessageFns = { encode(message: AddExternalServiceRequest_OptionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); } if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): AddExternalServiceRequest_OptionsEntry { 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 = createBaseAddExternalServiceRequest_OptionsEntry(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.key = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.value = 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): AddExternalServiceRequest_OptionsEntry { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, toJSON(message: AddExternalServiceRequest_OptionsEntry): unknown { const obj: any = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== "") { obj.value = message.value; } return obj; }, create(base?: DeepPartial): AddExternalServiceRequest_OptionsEntry { return AddExternalServiceRequest_OptionsEntry.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): AddExternalServiceRequest_OptionsEntry { const message = createBaseAddExternalServiceRequest_OptionsEntry(); message.key = object.key ?? ""; message.value = object.value ?? ""; return message; }, }; function createBaseAddExternalServicesRequest(): AddExternalServicesRequest { return { EventStore: "", ExternalServices: [] }; } export const AddExternalServicesRequest: MessageFns = { encode(message: AddExternalServicesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.EventStore !== "") { writer.uint32(10).string(message.EventStore); } for (const v of message.ExternalServices) { ExternalServiceDefinition.encode(v!, writer.uint32(18).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): AddExternalServicesRequest { 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 = createBaseAddExternalServicesRequest(); 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.ExternalServices.push(ExternalServiceDefinition.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): AddExternalServicesRequest { return { EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "", ExternalServices: globalThis.Array.isArray(object?.ExternalServices) ? object.ExternalServices.map((e: any) => ExternalServiceDefinition.fromJSON(e)) : [], }; }, toJSON(message: AddExternalServicesRequest): unknown { const obj: any = {}; if (message.EventStore !== "") { obj.EventStore = message.EventStore; } if (message.ExternalServices?.length) { obj.ExternalServices = message.ExternalServices.map((e) => ExternalServiceDefinition.toJSON(e)); } return obj; }, create(base?: DeepPartial): AddExternalServicesRequest { return AddExternalServicesRequest.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): AddExternalServicesRequest { const message = createBaseAddExternalServicesRequest(); message.EventStore = object.EventStore ?? ""; message.ExternalServices = object.ExternalServices?.map((e) => ExternalServiceDefinition.fromPartial(e)) || []; return message; }, }; function createBaseBasicAuthorization(): BasicAuthorization { return { Username: "", Password: "" }; } export const BasicAuthorization: MessageFns = { encode(message: BasicAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.Username !== "") { writer.uint32(10).string(message.Username); } if (message.Password !== "") { writer.uint32(18).string(message.Password); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): BasicAuthorization { 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 = createBaseBasicAuthorization(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.Username = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.Password = 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): BasicAuthorization { return { Username: isSet(object.Username) ? globalThis.String(object.Username) : "", Password: isSet(object.Password) ? globalThis.String(object.Password) : "", }; }, toJSON(message: BasicAuthorization): unknown { const obj: any = {}; if (message.Username !== "") { obj.Username = message.Username; } if (message.Password !== "") { obj.Password = message.Password; } return obj; }, create(base?: DeepPartial): BasicAuthorization { return BasicAuthorization.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): BasicAuthorization { const message = createBaseBasicAuthorization(); message.Username = object.Username ?? ""; message.Password = object.Password ?? ""; return message; }, }; function createBaseBearerTokenAuthorization(): BearerTokenAuthorization { return { Token: "" }; } export const BearerTokenAuthorization: MessageFns = { encode(message: BearerTokenAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.Token !== "") { writer.uint32(10).string(message.Token); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): BearerTokenAuthorization { 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 = createBaseBearerTokenAuthorization(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.Token = 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): BearerTokenAuthorization { return { Token: isSet(object.Token) ? globalThis.String(object.Token) : "" }; }, toJSON(message: BearerTokenAuthorization): unknown { const obj: any = {}; if (message.Token !== "") { obj.Token = message.Token; } return obj; }, create(base?: DeepPartial): BearerTokenAuthorization { return BearerTokenAuthorization.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): BearerTokenAuthorization { const message = createBaseBearerTokenAuthorization(); message.Token = object.Token ?? ""; 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 createBaseDatabaseEndpointConfiguration(): DatabaseEndpointConfiguration { return { Host: "", Port: 0, Database: "", Username: "", Password: "", Options: {} }; } export const DatabaseEndpointConfiguration: MessageFns = { encode(message: DatabaseEndpointConfiguration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.Host !== "") { writer.uint32(10).string(message.Host); } if (message.Port !== 0) { writer.uint32(16).int32(message.Port); } if (message.Database !== "") { writer.uint32(26).string(message.Database); } if (message.Username !== "") { writer.uint32(34).string(message.Username); } if (message.Password !== "") { writer.uint32(42).string(message.Password); } globalThis.Object.entries(message.Options).forEach(([key, value]: [string, string]) => { DatabaseEndpointConfiguration_OptionsEntry.encode({ key: key as any, value }, writer.uint32(50).fork()).join(); }); return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): DatabaseEndpointConfiguration { 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 = createBaseDatabaseEndpointConfiguration(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.Host = reader.string(); continue; } case 2: { if (tag !== 16) { break; } message.Port = reader.int32(); continue; } case 3: { if (tag !== 26) { break; } message.Database = reader.string(); continue; } case 4: { if (tag !== 34) { break; } message.Username = reader.string(); continue; } case 5: { if (tag !== 42) { break; } message.Password = reader.string(); continue; } case 6: { if (tag !== 50) { break; } const entry6 = DatabaseEndpointConfiguration_OptionsEntry.decode(reader, reader.uint32()); if (entry6.value !== undefined) { message.Options[entry6.key] = entry6.value; } continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; } finally { (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; } }, fromJSON(object: any): DatabaseEndpointConfiguration { return { Host: isSet(object.Host) ? globalThis.String(object.Host) : "", Port: isSet(object.Port) ? globalThis.Number(object.Port) : 0, Database: isSet(object.Database) ? globalThis.String(object.Database) : "", Username: isSet(object.Username) ? globalThis.String(object.Username) : "", Password: isSet(object.Password) ? globalThis.String(object.Password) : "", Options: isObject(object.Options) ? (globalThis.Object.entries(object.Options) as [string, any][]).reduce( (acc: { [key: string]: string }, [key, value]: [string, any]) => { globalThis.Object.defineProperty(acc, key, { value: globalThis.String(value), enumerable: true, configurable: true, writable: true, }); return acc; }, {}, ) : {}, }; }, toJSON(message: DatabaseEndpointConfiguration): unknown { const obj: any = {}; if (message.Host !== "") { obj.Host = message.Host; } if (message.Port !== 0) { obj.Port = Math.round(message.Port); } if (message.Database !== "") { obj.Database = message.Database; } if (message.Username !== "") { obj.Username = message.Username; } if (message.Password !== "") { obj.Password = message.Password; } if (message.Options) { const entries = globalThis.Object.entries(message.Options) as [string, string][]; if (entries.length > 0) { obj.Options = {}; entries.forEach(([k, v]) => { obj.Options[k] = v; }); } } return obj; }, create(base?: DeepPartial): DatabaseEndpointConfiguration { return DatabaseEndpointConfiguration.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): DatabaseEndpointConfiguration { const message = createBaseDatabaseEndpointConfiguration(); message.Host = object.Host ?? ""; message.Port = object.Port ?? 0; message.Database = object.Database ?? ""; message.Username = object.Username ?? ""; message.Password = object.Password ?? ""; message.Options = (globalThis.Object.entries(object.Options ?? {}) as [string, string][]).reduce( (acc: { [key: string]: string }, [key, value]: [string, string]) => { if (value !== undefined) { acc[key] = globalThis.String(value); } return acc; }, {}, ); return message; }, }; function createBaseDatabaseEndpointConfiguration_OptionsEntry(): DatabaseEndpointConfiguration_OptionsEntry { return { key: "", value: "" }; } export const DatabaseEndpointConfiguration_OptionsEntry: MessageFns = { encode(message: DatabaseEndpointConfiguration_OptionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); } if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): DatabaseEndpointConfiguration_OptionsEntry { 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 = createBaseDatabaseEndpointConfiguration_OptionsEntry(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.key = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.value = 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): DatabaseEndpointConfiguration_OptionsEntry { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, toJSON(message: DatabaseEndpointConfiguration_OptionsEntry): unknown { const obj: any = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== "") { obj.value = message.value; } return obj; }, create(base?: DeepPartial): DatabaseEndpointConfiguration_OptionsEntry { return DatabaseEndpointConfiguration_OptionsEntry.fromPartial(base ?? {}); }, fromPartial( object: DeepPartial, ): DatabaseEndpointConfiguration_OptionsEntry { const message = createBaseDatabaseEndpointConfiguration_OptionsEntry(); message.key = object.key ?? ""; message.value = object.value ?? ""; return message; }, }; function createBaseExternalServiceDefinition(): ExternalServiceDefinition { return { Id: "", Name: "", Endpoint: undefined }; } export const ExternalServiceDefinition: MessageFns = { encode(message: ExternalServiceDefinition, 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.Endpoint !== undefined) { ExternalServiceEndpoint.encode(message.Endpoint, writer.uint32(26).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): ExternalServiceDefinition { 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 = createBaseExternalServiceDefinition(); 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.Endpoint = ExternalServiceEndpoint.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): ExternalServiceDefinition { return { Id: isSet(object.Id) ? globalThis.String(object.Id) : "", Name: isSet(object.Name) ? globalThis.String(object.Name) : "", Endpoint: isSet(object.Endpoint) ? ExternalServiceEndpoint.fromJSON(object.Endpoint) : undefined, }; }, toJSON(message: ExternalServiceDefinition): unknown { const obj: any = {}; if (message.Id !== "") { obj.Id = message.Id; } if (message.Name !== "") { obj.Name = message.Name; } if (message.Endpoint !== undefined) { obj.Endpoint = ExternalServiceEndpoint.toJSON(message.Endpoint); } return obj; }, create(base?: DeepPartial): ExternalServiceDefinition { return ExternalServiceDefinition.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): ExternalServiceDefinition { const message = createBaseExternalServiceDefinition(); message.Id = object.Id ?? ""; message.Name = object.Name ?? ""; message.Endpoint = (object.Endpoint !== undefined && object.Endpoint !== null) ? ExternalServiceEndpoint.fromPartial(object.Endpoint) : undefined; return message; }, }; function createBaseExternalServiceEndpoint(): ExternalServiceEndpoint { return { Type: 0, Http: undefined, Database: undefined }; } export const ExternalServiceEndpoint: MessageFns = { encode(message: ExternalServiceEndpoint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.Type !== 0) { writer.uint32(8).int32(message.Type); } if (message.Http !== undefined) { HttpEndpointConfiguration.encode(message.Http, writer.uint32(18).fork()).join(); } if (message.Database !== undefined) { DatabaseEndpointConfiguration.encode(message.Database, writer.uint32(26).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): ExternalServiceEndpoint { 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 = createBaseExternalServiceEndpoint(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.Type = reader.int32() as any; continue; } case 2: { if (tag !== 18) { break; } message.Http = HttpEndpointConfiguration.decode(reader, reader.uint32()); continue; } case 3: { if (tag !== 26) { break; } message.Database = DatabaseEndpointConfiguration.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): ExternalServiceEndpoint { return { Type: isSet(object.Type) ? externalServiceEndpointTypeFromJSON(object.Type) : 0, Http: isSet(object.Http) ? HttpEndpointConfiguration.fromJSON(object.Http) : undefined, Database: isSet(object.Database) ? DatabaseEndpointConfiguration.fromJSON(object.Database) : undefined, }; }, toJSON(message: ExternalServiceEndpoint): unknown { const obj: any = {}; if (message.Type !== 0) { obj.Type = externalServiceEndpointTypeToJSON(message.Type); } if (message.Http !== undefined) { obj.Http = HttpEndpointConfiguration.toJSON(message.Http); } if (message.Database !== undefined) { obj.Database = DatabaseEndpointConfiguration.toJSON(message.Database); } return obj; }, create(base?: DeepPartial): ExternalServiceEndpoint { return ExternalServiceEndpoint.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): ExternalServiceEndpoint { const message = createBaseExternalServiceEndpoint(); message.Type = object.Type ?? 0; message.Http = (object.Http !== undefined && object.Http !== null) ? HttpEndpointConfiguration.fromPartial(object.Http) : undefined; message.Database = (object.Database !== undefined && object.Database !== null) ? DatabaseEndpointConfiguration.fromPartial(object.Database) : undefined; return message; }, }; function createBaseExternalServiceResponse(): ExternalServiceResponse { return { Id: "", Name: "", EndpointType: 0, Url: "", AuthorizationType: 0, Headers: {}, Host: "", Port: 0, Database: "", Username: "", Options: {}, }; } export const ExternalServiceResponse: MessageFns = { encode(message: ExternalServiceResponse, 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.EndpointType !== 0) { writer.uint32(24).int32(message.EndpointType); } if (message.Url !== "") { writer.uint32(34).string(message.Url); } if (message.AuthorizationType !== 0) { writer.uint32(40).int32(message.AuthorizationType); } globalThis.Object.entries(message.Headers).forEach(([key, value]: [string, string]) => { ExternalServiceResponse_HeadersEntry.encode({ key: key as any, value }, writer.uint32(50).fork()).join(); }); if (message.Host !== "") { writer.uint32(58).string(message.Host); } if (message.Port !== 0) { writer.uint32(64).int32(message.Port); } if (message.Database !== "") { writer.uint32(74).string(message.Database); } if (message.Username !== "") { writer.uint32(82).string(message.Username); } globalThis.Object.entries(message.Options).forEach(([key, value]: [string, string]) => { ExternalServiceResponse_OptionsEntry.encode({ key: key as any, value }, writer.uint32(90).fork()).join(); }); return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): ExternalServiceResponse { 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 = createBaseExternalServiceResponse(); 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 !== 24) { break; } message.EndpointType = reader.int32() as any; continue; } case 4: { if (tag !== 34) { break; } message.Url = reader.string(); continue; } case 5: { if (tag !== 40) { break; } message.AuthorizationType = reader.int32() as any; continue; } case 6: { if (tag !== 50) { break; } const entry6 = ExternalServiceResponse_HeadersEntry.decode(reader, reader.uint32()); if (entry6.value !== undefined) { message.Headers[entry6.key] = entry6.value; } continue; } case 7: { if (tag !== 58) { break; } message.Host = reader.string(); continue; } case 8: { if (tag !== 64) { break; } message.Port = reader.int32(); continue; } case 9: { if (tag !== 74) { break; } message.Database = reader.string(); continue; } case 10: { if (tag !== 82) { break; } message.Username = reader.string(); continue; } case 11: { if (tag !== 90) { break; } const entry11 = ExternalServiceResponse_OptionsEntry.decode(reader, reader.uint32()); if (entry11.value !== undefined) { message.Options[entry11.key] = entry11.value; } continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; } finally { (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; } }, fromJSON(object: any): ExternalServiceResponse { return { Id: isSet(object.Id) ? globalThis.String(object.Id) : "", Name: isSet(object.Name) ? globalThis.String(object.Name) : "", EndpointType: isSet(object.EndpointType) ? externalServiceEndpointTypeFromJSON(object.EndpointType) : 0, Url: isSet(object.Url) ? globalThis.String(object.Url) : "", AuthorizationType: isSet(object.AuthorizationType) ? authorizationTypeFromJSON(object.AuthorizationType) : 0, Headers: isObject(object.Headers) ? (globalThis.Object.entries(object.Headers) as [string, any][]).reduce( (acc: { [key: string]: string }, [key, value]: [string, any]) => { globalThis.Object.defineProperty(acc, key, { value: globalThis.String(value), enumerable: true, configurable: true, writable: true, }); return acc; }, {}, ) : {}, Host: isSet(object.Host) ? globalThis.String(object.Host) : "", Port: isSet(object.Port) ? globalThis.Number(object.Port) : 0, Database: isSet(object.Database) ? globalThis.String(object.Database) : "", Username: isSet(object.Username) ? globalThis.String(object.Username) : "", Options: isObject(object.Options) ? (globalThis.Object.entries(object.Options) as [string, any][]).reduce( (acc: { [key: string]: string }, [key, value]: [string, any]) => { globalThis.Object.defineProperty(acc, key, { value: globalThis.String(value), enumerable: true, configurable: true, writable: true, }); return acc; }, {}, ) : {}, }; }, toJSON(message: ExternalServiceResponse): unknown { const obj: any = {}; if (message.Id !== "") { obj.Id = message.Id; } if (message.Name !== "") { obj.Name = message.Name; } if (message.EndpointType !== 0) { obj.EndpointType = externalServiceEndpointTypeToJSON(message.EndpointType); } if (message.Url !== "") { obj.Url = message.Url; } if (message.AuthorizationType !== 0) { obj.AuthorizationType = authorizationTypeToJSON(message.AuthorizationType); } if (message.Headers) { const entries = globalThis.Object.entries(message.Headers) as [string, string][]; if (entries.length > 0) { obj.Headers = {}; entries.forEach(([k, v]) => { obj.Headers[k] = v; }); } } if (message.Host !== "") { obj.Host = message.Host; } if (message.Port !== 0) { obj.Port = Math.round(message.Port); } if (message.Database !== "") { obj.Database = message.Database; } if (message.Username !== "") { obj.Username = message.Username; } if (message.Options) { const entries = globalThis.Object.entries(message.Options) as [string, string][]; if (entries.length > 0) { obj.Options = {}; entries.forEach(([k, v]) => { obj.Options[k] = v; }); } } return obj; }, create(base?: DeepPartial): ExternalServiceResponse { return ExternalServiceResponse.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): ExternalServiceResponse { const message = createBaseExternalServiceResponse(); message.Id = object.Id ?? ""; message.Name = object.Name ?? ""; message.EndpointType = object.EndpointType ?? 0; message.Url = object.Url ?? ""; message.AuthorizationType = object.AuthorizationType ?? 0; message.Headers = (globalThis.Object.entries(object.Headers ?? {}) as [string, string][]).reduce( (acc: { [key: string]: string }, [key, value]: [string, string]) => { if (value !== undefined) { acc[key] = globalThis.String(value); } return acc; }, {}, ); message.Host = object.Host ?? ""; message.Port = object.Port ?? 0; message.Database = object.Database ?? ""; message.Username = object.Username ?? ""; message.Options = (globalThis.Object.entries(object.Options ?? {}) as [string, string][]).reduce( (acc: { [key: string]: string }, [key, value]: [string, string]) => { if (value !== undefined) { acc[key] = globalThis.String(value); } return acc; }, {}, ); return message; }, }; function createBaseExternalServiceResponse_HeadersEntry(): ExternalServiceResponse_HeadersEntry { return { key: "", value: "" }; } export const ExternalServiceResponse_HeadersEntry: MessageFns = { encode(message: ExternalServiceResponse_HeadersEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); } if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): ExternalServiceResponse_HeadersEntry { 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 = createBaseExternalServiceResponse_HeadersEntry(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.key = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.value = 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): ExternalServiceResponse_HeadersEntry { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, toJSON(message: ExternalServiceResponse_HeadersEntry): unknown { const obj: any = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== "") { obj.value = message.value; } return obj; }, create(base?: DeepPartial): ExternalServiceResponse_HeadersEntry { return ExternalServiceResponse_HeadersEntry.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): ExternalServiceResponse_HeadersEntry { const message = createBaseExternalServiceResponse_HeadersEntry(); message.key = object.key ?? ""; message.value = object.value ?? ""; return message; }, }; function createBaseExternalServiceResponse_OptionsEntry(): ExternalServiceResponse_OptionsEntry { return { key: "", value: "" }; } export const ExternalServiceResponse_OptionsEntry: MessageFns = { encode(message: ExternalServiceResponse_OptionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); } if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): ExternalServiceResponse_OptionsEntry { 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 = createBaseExternalServiceResponse_OptionsEntry(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.key = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.value = 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): ExternalServiceResponse_OptionsEntry { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, toJSON(message: ExternalServiceResponse_OptionsEntry): unknown { const obj: any = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== "") { obj.value = message.value; } return obj; }, create(base?: DeepPartial): ExternalServiceResponse_OptionsEntry { return ExternalServiceResponse_OptionsEntry.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): ExternalServiceResponse_OptionsEntry { const message = createBaseExternalServiceResponse_OptionsEntry(); message.key = object.key ?? ""; message.value = object.value ?? ""; return message; }, }; function createBaseGetExternalServicesRequest(): GetExternalServicesRequest { return { EventStore: "" }; } export const GetExternalServicesRequest: MessageFns = { encode(message: GetExternalServicesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.EventStore !== "") { writer.uint32(10).string(message.EventStore); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): GetExternalServicesRequest { 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 = createBaseGetExternalServicesRequest(); 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): GetExternalServicesRequest { return { EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "" }; }, toJSON(message: GetExternalServicesRequest): unknown { const obj: any = {}; if (message.EventStore !== "") { obj.EventStore = message.EventStore; } return obj; }, create(base?: DeepPartial): GetExternalServicesRequest { return GetExternalServicesRequest.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): GetExternalServicesRequest { const message = createBaseGetExternalServicesRequest(); message.EventStore = object.EventStore ?? ""; return message; }, }; function createBaseHttpEndpointConfiguration(): HttpEndpointConfiguration { return { Url: "", Authorization: undefined, Headers: {} }; } export const HttpEndpointConfiguration: MessageFns = { encode(message: HttpEndpointConfiguration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.Url !== "") { writer.uint32(10).string(message.Url); } if (message.Authorization !== undefined) { OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization.encode( message.Authorization, writer.uint32(18).fork(), ).join(); } globalThis.Object.entries(message.Headers).forEach(([key, value]: [string, string]) => { HttpEndpointConfiguration_HeadersEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join(); }); return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): HttpEndpointConfiguration { 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 = createBaseHttpEndpointConfiguration(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.Url = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.Authorization = OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization.decode( reader, reader.uint32(), ); continue; } case 3: { if (tag !== 26) { break; } const entry3 = HttpEndpointConfiguration_HeadersEntry.decode(reader, reader.uint32()); if (entry3.value !== undefined) { message.Headers[entry3.key] = entry3.value; } continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; } finally { (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; } }, fromJSON(object: any): HttpEndpointConfiguration { return { Url: isSet(object.Url) ? globalThis.String(object.Url) : "", Authorization: isSet(object.Authorization) ? OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization.fromJSON(object.Authorization) : undefined, Headers: isObject(object.Headers) ? (globalThis.Object.entries(object.Headers) as [string, any][]).reduce( (acc: { [key: string]: string }, [key, value]: [string, any]) => { globalThis.Object.defineProperty(acc, key, { value: globalThis.String(value), enumerable: true, configurable: true, writable: true, }); return acc; }, {}, ) : {}, }; }, toJSON(message: HttpEndpointConfiguration): unknown { const obj: any = {}; if (message.Url !== "") { obj.Url = message.Url; } if (message.Authorization !== undefined) { obj.Authorization = OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization.toJSON( message.Authorization, ); } if (message.Headers) { const entries = globalThis.Object.entries(message.Headers) as [string, string][]; if (entries.length > 0) { obj.Headers = {}; entries.forEach(([k, v]) => { obj.Headers[k] = v; }); } } return obj; }, create(base?: DeepPartial): HttpEndpointConfiguration { return HttpEndpointConfiguration.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): HttpEndpointConfiguration { const message = createBaseHttpEndpointConfiguration(); message.Url = object.Url ?? ""; message.Authorization = (object.Authorization !== undefined && object.Authorization !== null) ? OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization.fromPartial(object.Authorization) : undefined; message.Headers = (globalThis.Object.entries(object.Headers ?? {}) as [string, string][]).reduce( (acc: { [key: string]: string }, [key, value]: [string, string]) => { if (value !== undefined) { acc[key] = globalThis.String(value); } return acc; }, {}, ); return message; }, }; function createBaseHttpEndpointConfiguration_HeadersEntry(): HttpEndpointConfiguration_HeadersEntry { return { key: "", value: "" }; } export const HttpEndpointConfiguration_HeadersEntry: MessageFns = { encode(message: HttpEndpointConfiguration_HeadersEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); } if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): HttpEndpointConfiguration_HeadersEntry { 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 = createBaseHttpEndpointConfiguration_HeadersEntry(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.key = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.value = 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): HttpEndpointConfiguration_HeadersEntry { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, toJSON(message: HttpEndpointConfiguration_HeadersEntry): unknown { const obj: any = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== "") { obj.value = message.value; } return obj; }, create(base?: DeepPartial): HttpEndpointConfiguration_HeadersEntry { return HttpEndpointConfiguration_HeadersEntry.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): HttpEndpointConfiguration_HeadersEntry { const message = createBaseHttpEndpointConfiguration_HeadersEntry(); message.key = object.key ?? ""; message.value = object.value ?? ""; return message; }, }; function createBaseOAuthAuthorization(): OAuthAuthorization { return { Authority: "", ClientId: "", ClientSecret: "" }; } export const OAuthAuthorization: MessageFns = { encode(message: OAuthAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.Authority !== "") { writer.uint32(10).string(message.Authority); } if (message.ClientId !== "") { writer.uint32(18).string(message.ClientId); } if (message.ClientSecret !== "") { writer.uint32(26).string(message.ClientSecret); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): OAuthAuthorization { 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 = createBaseOAuthAuthorization(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.Authority = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.ClientId = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.ClientSecret = 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): OAuthAuthorization { return { Authority: isSet(object.Authority) ? globalThis.String(object.Authority) : "", ClientId: isSet(object.ClientId) ? globalThis.String(object.ClientId) : "", ClientSecret: isSet(object.ClientSecret) ? globalThis.String(object.ClientSecret) : "", }; }, toJSON(message: OAuthAuthorization): unknown { const obj: any = {}; if (message.Authority !== "") { obj.Authority = message.Authority; } if (message.ClientId !== "") { obj.ClientId = message.ClientId; } if (message.ClientSecret !== "") { obj.ClientSecret = message.ClientSecret; } return obj; }, create(base?: DeepPartial): OAuthAuthorization { return OAuthAuthorization.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): OAuthAuthorization { const message = createBaseOAuthAuthorization(); message.Authority = object.Authority ?? ""; message.ClientId = object.ClientId ?? ""; message.ClientSecret = object.ClientSecret ?? ""; return message; }, }; function createBaseObserveExternalServicesRequest(): ObserveExternalServicesRequest { return { EventStore: "" }; } export const ObserveExternalServicesRequest: MessageFns = { encode(message: ObserveExternalServicesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.EventStore !== "") { writer.uint32(10).string(message.EventStore); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): ObserveExternalServicesRequest { 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 = createBaseObserveExternalServicesRequest(); 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): ObserveExternalServicesRequest { return { EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "" }; }, toJSON(message: ObserveExternalServicesRequest): unknown { const obj: any = {}; if (message.EventStore !== "") { obj.EventStore = message.EventStore; } return obj; }, create(base?: DeepPartial): ObserveExternalServicesRequest { return ObserveExternalServicesRequest.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): ObserveExternalServicesRequest { const message = createBaseObserveExternalServicesRequest(); message.EventStore = object.EventStore ?? ""; return message; }, }; function createBaseOneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization(): OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization { return { Value0: undefined, Value1: undefined, Value2: undefined }; } export const OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization: MessageFns< OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization > = { encode( message: OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization, writer: BinaryWriter = new BinaryWriter(), ): BinaryWriter { if (message.Value0 !== undefined) { BasicAuthorization.encode(message.Value0, writer.uint32(10).fork()).join(); } if (message.Value1 !== undefined) { BearerTokenAuthorization.encode(message.Value1, writer.uint32(18).fork()).join(); } if (message.Value2 !== undefined) { OAuthAuthorization.encode(message.Value2, writer.uint32(26).fork()).join(); } return writer; }, decode( input: BinaryReader | Uint8Array, length?: number, ): OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization { 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 = createBaseOneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.Value0 = BasicAuthorization.decode(reader, reader.uint32()); continue; } case 2: { if (tag !== 18) { break; } message.Value1 = BearerTokenAuthorization.decode(reader, reader.uint32()); continue; } case 3: { if (tag !== 26) { break; } message.Value2 = OAuthAuthorization.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): OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization { return { Value0: isSet(object.Value0) ? BasicAuthorization.fromJSON(object.Value0) : undefined, Value1: isSet(object.Value1) ? BearerTokenAuthorization.fromJSON(object.Value1) : undefined, Value2: isSet(object.Value2) ? OAuthAuthorization.fromJSON(object.Value2) : undefined, }; }, toJSON(message: OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization): unknown { const obj: any = {}; if (message.Value0 !== undefined) { obj.Value0 = BasicAuthorization.toJSON(message.Value0); } if (message.Value1 !== undefined) { obj.Value1 = BearerTokenAuthorization.toJSON(message.Value1); } if (message.Value2 !== undefined) { obj.Value2 = OAuthAuthorization.toJSON(message.Value2); } return obj; }, create( base?: DeepPartial, ): OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization { return OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization.fromPartial(base ?? {}); }, fromPartial( object: DeepPartial, ): OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization { const message = createBaseOneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization(); message.Value0 = (object.Value0 !== undefined && object.Value0 !== null) ? BasicAuthorization.fromPartial(object.Value0) : undefined; message.Value1 = (object.Value1 !== undefined && object.Value1 !== null) ? BearerTokenAuthorization.fromPartial(object.Value1) : undefined; message.Value2 = (object.Value2 !== undefined && object.Value2 !== null) ? OAuthAuthorization.fromPartial(object.Value2) : undefined; return message; }, }; function createBaseQueryResultIEnumerableExternalServiceResponse(): QueryResultIEnumerableExternalServiceResponse { return { CorrelationId: undefined, IsAuthorized: false, ValidationResults: [], ExceptionMessages: [], ExceptionStackTrace: "", Data: [], }; } export const QueryResultIEnumerableExternalServiceResponse: MessageFns = { encode( message: QueryResultIEnumerableExternalServiceResponse, 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) { ExternalServiceResponse.encode(v!, writer.uint32(50).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryResultIEnumerableExternalServiceResponse { 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 = createBaseQueryResultIEnumerableExternalServiceResponse(); 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(ExternalServiceResponse.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): QueryResultIEnumerableExternalServiceResponse { 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) => ExternalServiceResponse.fromJSON(e)) : [], }; }, toJSON(message: QueryResultIEnumerableExternalServiceResponse): 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) => ExternalServiceResponse.toJSON(e)); } return obj; }, create( base?: DeepPartial, ): QueryResultIEnumerableExternalServiceResponse { return QueryResultIEnumerableExternalServiceResponse.fromPartial(base ?? {}); }, fromPartial( object: DeepPartial, ): QueryResultIEnumerableExternalServiceResponse { const message = createBaseQueryResultIEnumerableExternalServiceResponse(); 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) => ExternalServiceResponse.fromPartial(e)) || []; return message; }, }; function createBaseRemoveExternalServiceRequest(): RemoveExternalServiceRequest { return { EventStore: "", ExternalServiceId: "" }; } export const RemoveExternalServiceRequest: MessageFns = { encode(message: RemoveExternalServiceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.EventStore !== "") { writer.uint32(10).string(message.EventStore); } if (message.ExternalServiceId !== "") { writer.uint32(18).string(message.ExternalServiceId); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): RemoveExternalServiceRequest { 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 = createBaseRemoveExternalServiceRequest(); 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.ExternalServiceId = 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): RemoveExternalServiceRequest { return { EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "", ExternalServiceId: isSet(object.ExternalServiceId) ? globalThis.String(object.ExternalServiceId) : "", }; }, toJSON(message: RemoveExternalServiceRequest): unknown { const obj: any = {}; if (message.EventStore !== "") { obj.EventStore = message.EventStore; } if (message.ExternalServiceId !== "") { obj.ExternalServiceId = message.ExternalServiceId; } return obj; }, create(base?: DeepPartial): RemoveExternalServiceRequest { return RemoveExternalServiceRequest.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): RemoveExternalServiceRequest { const message = createBaseRemoveExternalServiceRequest(); message.EventStore = object.EventStore ?? ""; message.ExternalServiceId = object.ExternalServiceId ?? ""; return message; }, }; function createBaseRemoveExternalServicesRequest(): RemoveExternalServicesRequest { return { EventStore: "", ExternalServices: [] }; } export const RemoveExternalServicesRequest: MessageFns = { encode(message: RemoveExternalServicesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.EventStore !== "") { writer.uint32(10).string(message.EventStore); } for (const v of message.ExternalServices) { writer.uint32(18).string(v!); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): RemoveExternalServicesRequest { 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 = createBaseRemoveExternalServicesRequest(); 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.ExternalServices.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): RemoveExternalServicesRequest { return { EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "", ExternalServices: globalThis.Array.isArray(object?.ExternalServices) ? object.ExternalServices.map((e: any) => globalThis.String(e)) : [], }; }, toJSON(message: RemoveExternalServicesRequest): unknown { const obj: any = {}; if (message.EventStore !== "") { obj.EventStore = message.EventStore; } if (message.ExternalServices?.length) { obj.ExternalServices = message.ExternalServices; } return obj; }, create(base?: DeepPartial): RemoveExternalServicesRequest { return RemoveExternalServicesRequest.fromPartial(base ?? {}); }, fromPartial(object: DeepPartial): RemoveExternalServicesRequest { const message = createBaseRemoveExternalServicesRequest(); message.EventStore = object.EventStore ?? ""; message.ExternalServices = object.ExternalServices?.map((e) => 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 ExternalServicesDefinition = typeof ExternalServicesDefinition; export const ExternalServicesDefinition = { name: "ExternalServices", fullName: "Cratis.Chronicle.Contracts.ExternalServices.ExternalServices", methods: { addExternalService: { name: "AddExternalService", requestType: AddExternalServiceRequest as typeof AddExternalServiceRequest, requestStream: false, responseType: CommandResult as typeof CommandResult, responseStream: false, options: {}, }, addExternalServices: { name: "AddExternalServices", requestType: AddExternalServicesRequest as typeof AddExternalServicesRequest, requestStream: false, responseType: CommandResult as typeof CommandResult, responseStream: false, options: {}, }, getExternalServices: { name: "GetExternalServices", requestType: GetExternalServicesRequest as typeof GetExternalServicesRequest, requestStream: false, responseType: QueryResultIEnumerableExternalServiceResponse as typeof QueryResultIEnumerableExternalServiceResponse, responseStream: false, options: {}, }, observeExternalServices: { name: "ObserveExternalServices", requestType: ObserveExternalServicesRequest as typeof ObserveExternalServicesRequest, requestStream: false, responseType: QueryResultIEnumerableExternalServiceResponse as typeof QueryResultIEnumerableExternalServiceResponse, responseStream: true, options: {}, }, removeExternalService: { name: "RemoveExternalService", requestType: RemoveExternalServiceRequest as typeof RemoveExternalServiceRequest, requestStream: false, responseType: CommandResult as typeof CommandResult, responseStream: false, options: {}, }, removeExternalServices: { name: "RemoveExternalServices", requestType: RemoveExternalServicesRequest as typeof RemoveExternalServicesRequest, requestStream: false, responseType: CommandResult as typeof CommandResult, responseStream: false, options: {}, }, }, } as const; export interface ExternalServicesServiceImplementation { addExternalService( request: AddExternalServiceRequest, context: CallContext & CallContextExt, ): Promise>; addExternalServices( request: AddExternalServicesRequest, context: CallContext & CallContextExt, ): Promise>; getExternalServices( request: GetExternalServicesRequest, context: CallContext & CallContextExt, ): Promise>; observeExternalServices( request: ObserveExternalServicesRequest, context: CallContext & CallContextExt, ): ServerStreamingMethodResult>; removeExternalService( request: RemoveExternalServiceRequest, context: CallContext & CallContextExt, ): Promise>; removeExternalServices( request: RemoveExternalServicesRequest, context: CallContext & CallContextExt, ): Promise>; } export interface ExternalServicesClient { addExternalService( request: DeepPartial, options?: CallOptions & CallOptionsExt, ): Promise; addExternalServices( request: DeepPartial, options?: CallOptions & CallOptionsExt, ): Promise; getExternalServices( request: DeepPartial, options?: CallOptions & CallOptionsExt, ): Promise; observeExternalServices( request: DeepPartial, options?: CallOptions & CallOptionsExt, ): AsyncIterable; removeExternalService( request: DeepPartial, options?: CallOptions & CallOptionsExt, ): Promise; removeExternalServices( 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 isObject(value: any): boolean { return typeof value === "object" && value !== null; } 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; }