@cratis/chronicle 2.1.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/EventStore.ts +17 -1
  2. package/IEventStore.ts +16 -0
  3. package/auditing/CausationType.ts +10 -0
  4. package/compliance/ComplianceContracts.ts +84 -0
  5. package/compliance/IPIIManager.ts +17 -0
  6. package/compliance/PIIManager.ts +31 -0
  7. package/compliance/index.ts +2 -0
  8. package/connection/ChronicleConnection.ts +7 -1
  9. package/connection/ChronicleServices.ts +2 -0
  10. package/connection/Guid.ts +18 -0
  11. package/dist/EventStore.d.ts +8 -0
  12. package/dist/EventStore.d.ts.map +1 -1
  13. package/dist/EventStore.js +13 -1
  14. package/dist/EventStore.js.map +1 -1
  15. package/dist/IEventStore.d.ts +12 -0
  16. package/dist/IEventStore.d.ts.map +1 -1
  17. package/dist/auditing/CausationType.d.ts +8 -0
  18. package/dist/auditing/CausationType.d.ts.map +1 -1
  19. package/dist/auditing/CausationType.js +8 -0
  20. package/dist/auditing/CausationType.js.map +1 -1
  21. package/dist/compliance/ComplianceContracts.d.ts +40 -0
  22. package/dist/compliance/ComplianceContracts.d.ts.map +1 -1
  23. package/dist/compliance/ComplianceContracts.js +71 -0
  24. package/dist/compliance/ComplianceContracts.js.map +1 -1
  25. package/dist/compliance/IPIIManager.d.ts +15 -0
  26. package/dist/compliance/IPIIManager.d.ts.map +1 -0
  27. package/dist/compliance/IPIIManager.js +4 -0
  28. package/dist/compliance/IPIIManager.js.map +1 -0
  29. package/dist/compliance/PIIManager.d.ts +20 -0
  30. package/dist/compliance/PIIManager.d.ts.map +1 -0
  31. package/dist/compliance/PIIManager.js +30 -0
  32. package/dist/compliance/PIIManager.js.map +1 -0
  33. package/dist/compliance/index.d.ts +2 -0
  34. package/dist/compliance/index.d.ts.map +1 -1
  35. package/dist/compliance/index.js +1 -0
  36. package/dist/compliance/index.js.map +1 -1
  37. package/dist/connection/ChronicleConnection.d.ts +1 -0
  38. package/dist/connection/ChronicleConnection.d.ts.map +1 -1
  39. package/dist/connection/ChronicleConnection.js +6 -1
  40. package/dist/connection/ChronicleConnection.js.map +1 -1
  41. package/dist/connection/ChronicleServices.d.ts +2 -0
  42. package/dist/connection/ChronicleServices.d.ts.map +1 -1
  43. package/dist/connection/Guid.d.ts +5 -0
  44. package/dist/connection/Guid.d.ts.map +1 -1
  45. package/dist/connection/Guid.js +15 -0
  46. package/dist/connection/Guid.js.map +1 -1
  47. package/dist/eventSequences/AppendOperationsBroadcaster.d.ts +16 -0
  48. package/dist/eventSequences/AppendOperationsBroadcaster.d.ts.map +1 -0
  49. package/dist/eventSequences/AppendOperationsBroadcaster.js +77 -0
  50. package/dist/eventSequences/AppendOperationsBroadcaster.js.map +1 -0
  51. package/dist/eventSequences/AppendOptions.d.ts +7 -0
  52. package/dist/eventSequences/AppendOptions.d.ts.map +1 -1
  53. package/dist/eventSequences/AppendResult.d.ts +14 -0
  54. package/dist/eventSequences/AppendResult.d.ts.map +1 -1
  55. package/dist/eventSequences/AppendedEventWithResult.d.ts +13 -0
  56. package/dist/eventSequences/AppendedEventWithResult.d.ts.map +1 -0
  57. package/dist/eventSequences/AppendedEventWithResult.js +4 -0
  58. package/dist/eventSequences/AppendedEventWithResult.js.map +1 -0
  59. package/dist/eventSequences/CompleteStreamError.d.ts +17 -0
  60. package/dist/eventSequences/CompleteStreamError.d.ts.map +1 -0
  61. package/dist/eventSequences/CompleteStreamError.js +20 -0
  62. package/dist/eventSequences/CompleteStreamError.js.map +1 -0
  63. package/dist/eventSequences/CompleteStreamResult.d.ts +14 -0
  64. package/dist/eventSequences/CompleteStreamResult.d.ts.map +1 -0
  65. package/dist/eventSequences/CompleteStreamResult.js +4 -0
  66. package/dist/eventSequences/CompleteStreamResult.js.map +1 -0
  67. package/dist/eventSequences/ConcurrencyViolation.d.ts +13 -0
  68. package/dist/eventSequences/ConcurrencyViolation.d.ts.map +1 -0
  69. package/dist/eventSequences/ConcurrencyViolation.js +4 -0
  70. package/dist/eventSequences/ConcurrencyViolation.js.map +1 -0
  71. package/dist/eventSequences/EventForEventSourceId.d.ts +8 -0
  72. package/dist/eventSequences/EventForEventSourceId.d.ts.map +1 -1
  73. package/dist/eventSequences/EventSequence.d.ts +35 -1
  74. package/dist/eventSequences/EventSequence.d.ts.map +1 -1
  75. package/dist/eventSequences/EventSequence.js +350 -19
  76. package/dist/eventSequences/EventSequence.js.map +1 -1
  77. package/dist/eventSequences/IEventSequence.d.ts +85 -1
  78. package/dist/eventSequences/IEventSequence.d.ts.map +1 -1
  79. package/dist/eventSequences/WaitForCompletionResult.d.ts +11 -0
  80. package/dist/eventSequences/WaitForCompletionResult.d.ts.map +1 -0
  81. package/dist/eventSequences/WaitForCompletionResult.js +4 -0
  82. package/dist/eventSequences/WaitForCompletionResult.js.map +1 -0
  83. package/dist/eventSequences/index.d.ts +5 -0
  84. package/dist/eventSequences/index.d.ts.map +1 -1
  85. package/dist/eventSequences/index.js +1 -0
  86. package/dist/eventSequences/index.js.map +1 -1
  87. package/dist/eventStoreSubscriptions/EventStoreSubscriptions.d.ts +3 -0
  88. package/dist/eventStoreSubscriptions/EventStoreSubscriptions.d.ts.map +1 -1
  89. package/dist/eventStoreSubscriptions/EventStoreSubscriptions.js +9 -0
  90. package/dist/eventStoreSubscriptions/EventStoreSubscriptions.js.map +1 -1
  91. package/dist/eventStoreSubscriptions/IEventStoreSubscriptions.d.ts +6 -0
  92. package/dist/eventStoreSubscriptions/IEventStoreSubscriptions.d.ts.map +1 -1
  93. package/dist/eventStoreSubscriptions/contracts.d.ts +18 -0
  94. package/dist/eventStoreSubscriptions/contracts.d.ts.map +1 -1
  95. package/dist/eventStoreSubscriptions/contracts.js +106 -0
  96. package/dist/eventStoreSubscriptions/contracts.js.map +1 -1
  97. package/dist/events/constraints/Constraints.js +1 -1
  98. package/dist/events/constraints/Constraints.js.map +1 -1
  99. package/dist/externalServices/ExternalServiceBuilder.d.ts +42 -0
  100. package/dist/externalServices/ExternalServiceBuilder.d.ts.map +1 -0
  101. package/dist/externalServices/ExternalServiceBuilder.js +110 -0
  102. package/dist/externalServices/ExternalServiceBuilder.js.map +1 -0
  103. package/dist/externalServices/ExternalServices.d.ts +19 -0
  104. package/dist/externalServices/ExternalServices.d.ts.map +1 -0
  105. package/dist/externalServices/ExternalServices.js +30 -0
  106. package/dist/externalServices/ExternalServices.js.map +1 -0
  107. package/dist/externalServices/ExternalServicesContracts.d.ts +137 -0
  108. package/dist/externalServices/ExternalServicesContracts.d.ts.map +1 -0
  109. package/dist/externalServices/ExternalServicesContracts.js +654 -0
  110. package/dist/externalServices/ExternalServicesContracts.js.map +1 -0
  111. package/dist/externalServices/IExternalServiceBuilder.d.ts +67 -0
  112. package/dist/externalServices/IExternalServiceBuilder.d.ts.map +1 -0
  113. package/dist/externalServices/IExternalServiceBuilder.js +4 -0
  114. package/dist/externalServices/IExternalServiceBuilder.js.map +1 -0
  115. package/dist/externalServices/IExternalServices.d.ts +13 -0
  116. package/dist/externalServices/IExternalServices.d.ts.map +1 -0
  117. package/dist/externalServices/IExternalServices.js +4 -0
  118. package/dist/externalServices/IExternalServices.js.map +1 -0
  119. package/dist/externalServices/index.d.ts +5 -0
  120. package/dist/externalServices/index.d.ts.map +1 -0
  121. package/dist/externalServices/index.js +5 -0
  122. package/dist/externalServices/index.js.map +1 -0
  123. package/dist/identities/IIdentityManager.d.ts +17 -0
  124. package/dist/identities/IIdentityManager.d.ts.map +1 -0
  125. package/dist/identities/IIdentityManager.js +4 -0
  126. package/dist/identities/IIdentityManager.js.map +1 -0
  127. package/dist/identities/IdentityManager.d.ts +20 -0
  128. package/dist/identities/IdentityManager.d.ts.map +1 -0
  129. package/dist/identities/IdentityManager.js +31 -0
  130. package/dist/identities/IdentityManager.js.map +1 -0
  131. package/dist/identities/index.d.ts +3 -0
  132. package/dist/identities/index.d.ts.map +1 -0
  133. package/dist/identities/index.js +4 -0
  134. package/dist/identities/index.js.map +1 -0
  135. package/dist/index.d.ts +5 -1
  136. package/dist/index.d.ts.map +1 -1
  137. package/dist/index.js +5 -1
  138. package/dist/index.js.map +1 -1
  139. package/dist/observation/FailedPartition.d.ts +15 -0
  140. package/dist/observation/FailedPartition.d.ts.map +1 -0
  141. package/dist/observation/FailedPartition.js +4 -0
  142. package/dist/observation/FailedPartition.js.map +1 -0
  143. package/dist/observation/FailedPartitionAttempt.d.ts +15 -0
  144. package/dist/observation/FailedPartitionAttempt.d.ts.map +1 -0
  145. package/dist/observation/FailedPartitionAttempt.js +4 -0
  146. package/dist/observation/FailedPartitionAttempt.js.map +1 -0
  147. package/dist/observation/FailedPartitions.d.ts +24 -0
  148. package/dist/observation/FailedPartitions.d.ts.map +1 -0
  149. package/dist/observation/FailedPartitions.js +39 -0
  150. package/dist/observation/FailedPartitions.js.map +1 -0
  151. package/dist/observation/ICanBeNotifiedWhenPartitionReplayed.d.ts +19 -0
  152. package/dist/observation/ICanBeNotifiedWhenPartitionReplayed.d.ts.map +1 -0
  153. package/dist/observation/ICanBeNotifiedWhenPartitionReplayed.js +4 -0
  154. package/dist/observation/ICanBeNotifiedWhenPartitionReplayed.js.map +1 -0
  155. package/dist/observation/ICanBeNotifiedWhenReplay.d.ts +17 -0
  156. package/dist/observation/ICanBeNotifiedWhenReplay.d.ts.map +1 -0
  157. package/dist/observation/ICanBeNotifiedWhenReplay.js +4 -0
  158. package/dist/observation/ICanBeNotifiedWhenReplay.js.map +1 -0
  159. package/dist/observation/IFailedPartitions.d.ts +18 -0
  160. package/dist/observation/IFailedPartitions.d.ts.map +1 -0
  161. package/dist/observation/IFailedPartitions.js +4 -0
  162. package/dist/observation/IFailedPartitions.js.map +1 -0
  163. package/dist/observation/index.d.ts +6 -0
  164. package/dist/observation/index.d.ts.map +1 -1
  165. package/dist/observation/index.js +1 -0
  166. package/dist/observation/index.js.map +1 -1
  167. package/dist/observation/notifyReplayLifecycle.d.ts +13 -0
  168. package/dist/observation/notifyReplayLifecycle.d.ts.map +1 -0
  169. package/dist/observation/notifyReplayLifecycle.js +54 -0
  170. package/dist/observation/notifyReplayLifecycle.js.map +1 -0
  171. package/dist/observation/toClientFailedPartition.d.ts +9 -0
  172. package/dist/observation/toClientFailedPartition.d.ts.map +1 -0
  173. package/dist/observation/toClientFailedPartition.js +23 -0
  174. package/dist/observation/toClientFailedPartition.js.map +1 -0
  175. package/dist/projections/Projections.d.ts +0 -4
  176. package/dist/projections/Projections.d.ts.map +1 -1
  177. package/dist/projections/Projections.js +25 -103
  178. package/dist/projections/Projections.js.map +1 -1
  179. package/dist/projections/declarative/AddBuilder.d.ts +17 -0
  180. package/dist/projections/declarative/AddBuilder.d.ts.map +1 -0
  181. package/dist/projections/declarative/AddBuilder.js +28 -0
  182. package/dist/projections/declarative/AddBuilder.js.map +1 -0
  183. package/dist/projections/declarative/AddChildBuilder.d.ts +56 -0
  184. package/dist/projections/declarative/AddChildBuilder.d.ts.map +1 -0
  185. package/dist/projections/declarative/AddChildBuilder.js +72 -0
  186. package/dist/projections/declarative/AddChildBuilder.js.map +1 -0
  187. package/dist/projections/declarative/ChildrenBuilder.d.ts +28 -0
  188. package/dist/projections/declarative/ChildrenBuilder.d.ts.map +1 -0
  189. package/dist/projections/declarative/ChildrenBuilder.js +72 -0
  190. package/dist/projections/declarative/ChildrenBuilder.js.map +1 -0
  191. package/dist/projections/declarative/CompositeKeyBuilder.d.ts +16 -0
  192. package/dist/projections/declarative/CompositeKeyBuilder.d.ts.map +1 -0
  193. package/dist/projections/declarative/CompositeKeyBuilder.js +29 -0
  194. package/dist/projections/declarative/CompositeKeyBuilder.js.map +1 -0
  195. package/dist/projections/declarative/FromBuilder.d.ts +8 -6
  196. package/dist/projections/declarative/FromBuilder.d.ts.map +1 -1
  197. package/dist/projections/declarative/FromBuilder.js +44 -14
  198. package/dist/projections/declarative/FromBuilder.js.map +1 -1
  199. package/dist/projections/declarative/ICompositeKeyBuilder.d.ts +5 -0
  200. package/dist/projections/declarative/ICompositeKeyBuilder.d.ts.map +1 -1
  201. package/dist/projections/declarative/JoinBuilder.d.ts +7 -5
  202. package/dist/projections/declarative/JoinBuilder.d.ts.map +1 -1
  203. package/dist/projections/declarative/JoinBuilder.js +50 -16
  204. package/dist/projections/declarative/JoinBuilder.js.map +1 -1
  205. package/dist/projections/declarative/NestedBuilder.d.ts +24 -0
  206. package/dist/projections/declarative/NestedBuilder.d.ts.map +1 -0
  207. package/dist/projections/declarative/NestedBuilder.js +60 -0
  208. package/dist/projections/declarative/NestedBuilder.js.map +1 -0
  209. package/dist/projections/declarative/ProjectionBuilderCore.d.ts +127 -0
  210. package/dist/projections/declarative/ProjectionBuilderCore.d.ts.map +1 -0
  211. package/dist/projections/declarative/ProjectionBuilderCore.js +180 -0
  212. package/dist/projections/declarative/ProjectionBuilderCore.js.map +1 -0
  213. package/dist/projections/declarative/ProjectionBuilderFor.d.ts +6 -32
  214. package/dist/projections/declarative/ProjectionBuilderFor.d.ts.map +1 -1
  215. package/dist/projections/declarative/ProjectionBuilderFor.js +24 -118
  216. package/dist/projections/declarative/ProjectionBuilderFor.js.map +1 -1
  217. package/dist/projections/declarative/SubtractBuilder.d.ts +17 -0
  218. package/dist/projections/declarative/SubtractBuilder.d.ts.map +1 -0
  219. package/dist/projections/declarative/SubtractBuilder.js +28 -0
  220. package/dist/projections/declarative/SubtractBuilder.js.map +1 -0
  221. package/dist/projections/declarative/index.d.ts +9 -0
  222. package/dist/projections/declarative/index.d.ts.map +1 -1
  223. package/dist/projections/declarative/index.js +8 -0
  224. package/dist/projections/declarative/index.js.map +1 -1
  225. package/dist/projections/modelBound/childrenAndNestedBuilder.d.ts +90 -0
  226. package/dist/projections/modelBound/childrenAndNestedBuilder.d.ts.map +1 -0
  227. package/dist/projections/modelBound/childrenAndNestedBuilder.js +290 -0
  228. package/dist/projections/modelBound/childrenAndNestedBuilder.js.map +1 -0
  229. package/dist/reactors/ReactorSideEffects.d.ts +29 -0
  230. package/dist/reactors/ReactorSideEffects.d.ts.map +1 -0
  231. package/dist/reactors/ReactorSideEffects.js +70 -0
  232. package/dist/reactors/ReactorSideEffects.js.map +1 -0
  233. package/dist/reactors/Reactors.d.ts +4 -1
  234. package/dist/reactors/Reactors.d.ts.map +1 -1
  235. package/dist/reactors/Reactors.js +23 -4
  236. package/dist/reactors/Reactors.js.map +1 -1
  237. package/dist/reducers/Reducers.d.ts.map +1 -1
  238. package/dist/reducers/Reducers.js +15 -3
  239. package/dist/reducers/Reducers.js.map +1 -1
  240. package/dist/reducers/reducer.d.ts +9 -1
  241. package/dist/reducers/reducer.d.ts.map +1 -1
  242. package/dist/reducers/reducer.js +4 -2
  243. package/dist/reducers/reducer.js.map +1 -1
  244. package/dist/transactions/IUnitOfWork.d.ts +18 -0
  245. package/dist/transactions/IUnitOfWork.d.ts.map +1 -1
  246. package/dist/transactions/UnitOfWork.d.ts +9 -0
  247. package/dist/transactions/UnitOfWork.d.ts.map +1 -1
  248. package/dist/transactions/UnitOfWork.js +14 -0
  249. package/dist/transactions/UnitOfWork.js.map +1 -1
  250. package/dist/tsconfig.tsbuildinfo +1 -1
  251. package/eventSequences/AppendOperationsBroadcaster.ts +83 -0
  252. package/eventSequences/AppendOptions.ts +8 -0
  253. package/eventSequences/AppendResult.ts +16 -0
  254. package/eventSequences/AppendedEventWithResult.ts +17 -0
  255. package/eventSequences/CompleteStreamError.ts +20 -0
  256. package/eventSequences/CompleteStreamResult.ts +13 -0
  257. package/eventSequences/ConcurrencyViolation.ts +18 -0
  258. package/eventSequences/EventForEventSourceId.ts +12 -0
  259. package/eventSequences/EventSequence.spec.ts +588 -0
  260. package/eventSequences/EventSequence.ts +406 -20
  261. package/eventSequences/IEventSequence.ts +109 -1
  262. package/eventSequences/WaitForCompletionResult.ts +15 -0
  263. package/eventSequences/index.ts +5 -0
  264. package/eventStoreSubscriptions/EventStoreSubscriptions.spec.ts +52 -0
  265. package/eventStoreSubscriptions/EventStoreSubscriptions.ts +19 -1
  266. package/eventStoreSubscriptions/IEventStoreSubscriptions.ts +7 -0
  267. package/eventStoreSubscriptions/contracts.ts +126 -0
  268. package/events/constraints/Constraints.ts +1 -1
  269. package/externalServices/ExternalServiceBuilder.ts +128 -0
  270. package/externalServices/ExternalServices.ts +34 -0
  271. package/externalServices/ExternalServicesContracts.ts +709 -0
  272. package/externalServices/IExternalServiceBuilder.ts +76 -0
  273. package/externalServices/IExternalServices.ts +16 -0
  274. package/externalServices/index.ts +7 -0
  275. package/fundamentalsPeerRange.spec.ts +31 -0
  276. package/identities/IIdentityManager.ts +19 -0
  277. package/identities/IdentityManager.ts +32 -0
  278. package/identities/index.ts +5 -0
  279. package/index.ts +6 -0
  280. package/observation/FailedPartition.ts +21 -0
  281. package/observation/FailedPartitionAttempt.ts +21 -0
  282. package/observation/FailedPartitions.spec.ts +75 -0
  283. package/observation/FailedPartitions.ts +44 -0
  284. package/observation/ICanBeNotifiedWhenPartitionReplayed.ts +22 -0
  285. package/observation/ICanBeNotifiedWhenReplay.ts +20 -0
  286. package/observation/IFailedPartitions.ts +22 -0
  287. package/observation/index.ts +6 -0
  288. package/observation/notifyReplayLifecycle.spec.ts +98 -0
  289. package/observation/notifyReplayLifecycle.ts +61 -0
  290. package/observation/toClientFailedPartition.ts +26 -0
  291. package/package.json +16 -3
  292. package/projections/Projections.childrenAndNested.spec.ts +188 -0
  293. package/projections/Projections.spec.ts +131 -0
  294. package/projections/Projections.ts +37 -119
  295. package/projections/declarative/AddBuilder.ts +28 -0
  296. package/projections/declarative/AddChildBuilder.ts +97 -0
  297. package/projections/declarative/ChildrenBuilder.spec.ts +157 -0
  298. package/projections/declarative/ChildrenBuilder.ts +90 -0
  299. package/projections/declarative/CompositeKeyBuilder.spec.ts +117 -0
  300. package/projections/declarative/CompositeKeyBuilder.ts +38 -0
  301. package/projections/declarative/FromBuilder.ts +60 -15
  302. package/projections/declarative/ICompositeKeyBuilder.ts +6 -0
  303. package/projections/declarative/JoinBuilder.ts +66 -17
  304. package/projections/declarative/NestedBuilder.ts +76 -0
  305. package/projections/declarative/ProjectionBuilderCore.ts +257 -0
  306. package/projections/declarative/ProjectionBuilderFor.spec.ts +115 -0
  307. package/projections/declarative/ProjectionBuilderFor.ts +29 -168
  308. package/projections/declarative/SubtractBuilder.ts +28 -0
  309. package/projections/declarative/index.ts +9 -0
  310. package/projections/modelBound/childrenAndNestedBuilder.ts +354 -0
  311. package/reactors/ReactorSideEffects.spec.ts +182 -0
  312. package/reactors/ReactorSideEffects.ts +97 -0
  313. package/reactors/Reactors.ts +29 -4
  314. package/reducers/Reducers.spec.ts +87 -0
  315. package/reducers/Reducers.ts +15 -3
  316. package/reducers/reducer.spec.ts +40 -0
  317. package/reducers/reducer.ts +11 -2
  318. package/transactions/IUnitOfWork.ts +21 -0
  319. package/transactions/UnitOfWork.spec.ts +82 -0
  320. package/transactions/UnitOfWork.ts +20 -0
@@ -0,0 +1,709 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+
4
+ import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
5
+ import type { CallOptions } from 'nice-grpc-common';
6
+
7
+ // The generated `@cratis/chronicle.contracts` package does not (yet) re-export its
8
+ // `externalservices` proto module from its public barrel, so the wire types are mirrored
9
+ // here - the same approach used for `Source/compliance/ComplianceContracts.ts` and
10
+ // `Source/eventStoreSubscriptions/contracts.ts`.
11
+
12
+ /**
13
+ * The type of endpoint an external service exposes.
14
+ */
15
+ export enum ExternalServiceEndpointType {
16
+ Http = 0,
17
+ MsSql = 1,
18
+ PostgreSql = 2
19
+ }
20
+
21
+ /**
22
+ * Basic authentication credentials for an HTTP endpoint.
23
+ */
24
+ export interface BasicAuthorization {
25
+ Username: string;
26
+ Password: string;
27
+ }
28
+
29
+ /**
30
+ * A bearer token for an HTTP endpoint.
31
+ */
32
+ export interface BearerTokenAuthorization {
33
+ Token: string;
34
+ }
35
+
36
+ /**
37
+ * OAuth client credentials for an HTTP endpoint.
38
+ */
39
+ export interface OAuthAuthorization {
40
+ Authority: string;
41
+ ClientId: string;
42
+ ClientSecret: string;
43
+ }
44
+
45
+ /**
46
+ * The authorization configured for an HTTP endpoint - at most one of the three is set.
47
+ */
48
+ export interface OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization {
49
+ Value0: BasicAuthorization | undefined;
50
+ Value1: BearerTokenAuthorization | undefined;
51
+ Value2: OAuthAuthorization | undefined;
52
+ }
53
+
54
+ /**
55
+ * Configuration for an HTTP-based external service endpoint.
56
+ */
57
+ export interface HttpEndpointConfiguration {
58
+ Url: string;
59
+ Authorization: OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization | undefined;
60
+ Headers: { [key: string]: string };
61
+ }
62
+
63
+ /**
64
+ * Configuration for a database-based external service endpoint.
65
+ */
66
+ export interface DatabaseEndpointConfiguration {
67
+ Host: string;
68
+ Port: number;
69
+ Database: string;
70
+ Username: string;
71
+ Password: string;
72
+ Options: { [key: string]: string };
73
+ }
74
+
75
+ /**
76
+ * The endpoint configured for an external service - either Http or Database, based on Type.
77
+ */
78
+ export interface ExternalServiceEndpoint {
79
+ Type: ExternalServiceEndpointType;
80
+ Http: HttpEndpointConfiguration | undefined;
81
+ Database: DatabaseEndpointConfiguration | undefined;
82
+ }
83
+
84
+ /**
85
+ * The definition of an external service registration.
86
+ */
87
+ export interface ExternalServiceDefinition {
88
+ Id: string;
89
+ Name: string;
90
+ Endpoint: ExternalServiceEndpoint | undefined;
91
+ }
92
+
93
+ /**
94
+ * Request for registering external services with the Kernel.
95
+ */
96
+ export interface AddExternalServices {
97
+ EventStore: string;
98
+ ExternalServices: ExternalServiceDefinition[];
99
+ }
100
+
101
+ /**
102
+ * An empty protobuf message.
103
+ */
104
+ export interface Empty {}
105
+
106
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
107
+ export type DeepPartial<T> = T extends Builtin ? T
108
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
109
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
110
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
111
+ : Partial<T>;
112
+
113
+ interface MessageFns<T> {
114
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
115
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
116
+ fromJSON(object: unknown): T;
117
+ toJSON(message: T): unknown;
118
+ create(base?: DeepPartial<T>): T;
119
+ fromPartial(object: DeepPartial<T>): T;
120
+ }
121
+
122
+ function isSet(value: unknown): boolean {
123
+ return value !== null && value !== undefined;
124
+ }
125
+
126
+ interface StringMapEntry {
127
+ key: string;
128
+ value: string;
129
+ }
130
+
131
+ function encodeStringMapEntry(entry: StringMapEntry, writer: BinaryWriter): BinaryWriter {
132
+ if (entry.key !== '') {
133
+ writer.uint32(10).string(entry.key);
134
+ }
135
+ if (entry.value !== '') {
136
+ writer.uint32(18).string(entry.value);
137
+ }
138
+ return writer;
139
+ }
140
+
141
+ function decodeStringMapEntry(reader: BinaryReader, length: number): StringMapEntry {
142
+ const end = reader.pos + length;
143
+ const entry: StringMapEntry = { key: '', value: '' };
144
+ while (reader.pos < end) {
145
+ const tag = reader.uint32();
146
+ switch (tag >>> 3) {
147
+ case 1: entry.key = reader.string(); continue;
148
+ case 2: entry.value = reader.string(); continue;
149
+ }
150
+ if ((tag & 7) === 4 || tag === 0) break;
151
+ reader.skip(tag & 7);
152
+ }
153
+ return entry;
154
+ }
155
+
156
+ function encodeStringMap(map: { [key: string]: string }, writer: BinaryWriter, fieldNumber: number): void {
157
+ for (const [key, value] of Object.entries(map)) {
158
+ encodeStringMapEntry({ key, value }, writer.uint32((fieldNumber << 3) | 2).fork()).join();
159
+ }
160
+ }
161
+
162
+ function decodeStringMapEntryInto(reader: BinaryReader, map: { [key: string]: string }): void {
163
+ const entry = decodeStringMapEntry(reader, reader.uint32());
164
+ map[entry.key] = entry.value;
165
+ }
166
+
167
+ function stringMapFromJSON(value: unknown): { [key: string]: string } {
168
+ if (typeof value !== 'object' || value === null) {
169
+ return {};
170
+ }
171
+ return Object.fromEntries(Object.entries(value as Record<string, unknown>).map(([key, entryValue]) => [key, String(entryValue)]));
172
+ }
173
+
174
+ function stringMapFromPartial(value: { [key: string]: string } | undefined): { [key: string]: string } {
175
+ return Object.entries(value ?? {}).reduce((accumulator: { [key: string]: string }, [key, entryValue]) => {
176
+ if (entryValue !== undefined) {
177
+ accumulator[key] = entryValue;
178
+ }
179
+ return accumulator;
180
+ }, {});
181
+ }
182
+
183
+ export const EmptyMessage: MessageFns<Empty> = {
184
+ encode(_: Empty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
185
+ return writer;
186
+ },
187
+ decode(input: BinaryReader | Uint8Array, length?: number): Empty {
188
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
189
+ const end = length === undefined ? reader.len : reader.pos + length;
190
+ while (reader.pos < end) {
191
+ const tag = reader.uint32();
192
+ if ((tag & 7) === 4 || tag === 0) break;
193
+ reader.skip(tag & 7);
194
+ }
195
+ return {};
196
+ },
197
+ fromJSON(_: unknown): Empty {
198
+ return {};
199
+ },
200
+ toJSON(_: Empty): unknown {
201
+ return {};
202
+ },
203
+ create(base?: DeepPartial<Empty>): Empty {
204
+ return EmptyMessage.fromPartial(base ?? {});
205
+ },
206
+ fromPartial(_: DeepPartial<Empty>): Empty {
207
+ return {};
208
+ }
209
+ };
210
+
211
+ function createBaseBasicAuthorization(): BasicAuthorization {
212
+ return { Username: '', Password: '' };
213
+ }
214
+
215
+ export const BasicAuthorizationMessage: MessageFns<BasicAuthorization> = {
216
+ encode(message: BasicAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
217
+ if (message.Username !== '') writer.uint32(10).string(message.Username);
218
+ if (message.Password !== '') writer.uint32(18).string(message.Password);
219
+ return writer;
220
+ },
221
+ decode(input: BinaryReader | Uint8Array, length?: number): BasicAuthorization {
222
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
223
+ const end = length === undefined ? reader.len : reader.pos + length;
224
+ const message = createBaseBasicAuthorization();
225
+ while (reader.pos < end) {
226
+ const tag = reader.uint32();
227
+ switch (tag >>> 3) {
228
+ case 1: message.Username = reader.string(); continue;
229
+ case 2: message.Password = reader.string(); continue;
230
+ }
231
+ if ((tag & 7) === 4 || tag === 0) break;
232
+ reader.skip(tag & 7);
233
+ }
234
+ return message;
235
+ },
236
+ fromJSON(object: unknown): BasicAuthorization {
237
+ const value = object as { Username?: unknown; Password?: unknown };
238
+ return {
239
+ Username: typeof value.Username === 'string' ? value.Username : '',
240
+ Password: typeof value.Password === 'string' ? value.Password : ''
241
+ };
242
+ },
243
+ toJSON(message: BasicAuthorization): unknown {
244
+ return { Username: message.Username, Password: message.Password };
245
+ },
246
+ create(base?: DeepPartial<BasicAuthorization>): BasicAuthorization {
247
+ return BasicAuthorizationMessage.fromPartial(base ?? {});
248
+ },
249
+ fromPartial(object: DeepPartial<BasicAuthorization>): BasicAuthorization {
250
+ return { Username: object.Username ?? '', Password: object.Password ?? '' };
251
+ }
252
+ };
253
+
254
+ function createBaseBearerTokenAuthorization(): BearerTokenAuthorization {
255
+ return { Token: '' };
256
+ }
257
+
258
+ export const BearerTokenAuthorizationMessage: MessageFns<BearerTokenAuthorization> = {
259
+ encode(message: BearerTokenAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
260
+ if (message.Token !== '') writer.uint32(10).string(message.Token);
261
+ return writer;
262
+ },
263
+ decode(input: BinaryReader | Uint8Array, length?: number): BearerTokenAuthorization {
264
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
265
+ const end = length === undefined ? reader.len : reader.pos + length;
266
+ const message = createBaseBearerTokenAuthorization();
267
+ while (reader.pos < end) {
268
+ const tag = reader.uint32();
269
+ switch (tag >>> 3) {
270
+ case 1: message.Token = reader.string(); continue;
271
+ }
272
+ if ((tag & 7) === 4 || tag === 0) break;
273
+ reader.skip(tag & 7);
274
+ }
275
+ return message;
276
+ },
277
+ fromJSON(object: unknown): BearerTokenAuthorization {
278
+ const value = object as { Token?: unknown };
279
+ return { Token: typeof value.Token === 'string' ? value.Token : '' };
280
+ },
281
+ toJSON(message: BearerTokenAuthorization): unknown {
282
+ return { Token: message.Token };
283
+ },
284
+ create(base?: DeepPartial<BearerTokenAuthorization>): BearerTokenAuthorization {
285
+ return BearerTokenAuthorizationMessage.fromPartial(base ?? {});
286
+ },
287
+ fromPartial(object: DeepPartial<BearerTokenAuthorization>): BearerTokenAuthorization {
288
+ return { Token: object.Token ?? '' };
289
+ }
290
+ };
291
+
292
+ function createBaseOAuthAuthorization(): OAuthAuthorization {
293
+ return { Authority: '', ClientId: '', ClientSecret: '' };
294
+ }
295
+
296
+ export const OAuthAuthorizationMessage: MessageFns<OAuthAuthorization> = {
297
+ encode(message: OAuthAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
298
+ if (message.Authority !== '') writer.uint32(10).string(message.Authority);
299
+ if (message.ClientId !== '') writer.uint32(18).string(message.ClientId);
300
+ if (message.ClientSecret !== '') writer.uint32(26).string(message.ClientSecret);
301
+ return writer;
302
+ },
303
+ decode(input: BinaryReader | Uint8Array, length?: number): OAuthAuthorization {
304
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
305
+ const end = length === undefined ? reader.len : reader.pos + length;
306
+ const message = createBaseOAuthAuthorization();
307
+ while (reader.pos < end) {
308
+ const tag = reader.uint32();
309
+ switch (tag >>> 3) {
310
+ case 1: message.Authority = reader.string(); continue;
311
+ case 2: message.ClientId = reader.string(); continue;
312
+ case 3: message.ClientSecret = reader.string(); continue;
313
+ }
314
+ if ((tag & 7) === 4 || tag === 0) break;
315
+ reader.skip(tag & 7);
316
+ }
317
+ return message;
318
+ },
319
+ fromJSON(object: unknown): OAuthAuthorization {
320
+ const value = object as { Authority?: unknown; ClientId?: unknown; ClientSecret?: unknown };
321
+ return {
322
+ Authority: typeof value.Authority === 'string' ? value.Authority : '',
323
+ ClientId: typeof value.ClientId === 'string' ? value.ClientId : '',
324
+ ClientSecret: typeof value.ClientSecret === 'string' ? value.ClientSecret : ''
325
+ };
326
+ },
327
+ toJSON(message: OAuthAuthorization): unknown {
328
+ return { Authority: message.Authority, ClientId: message.ClientId, ClientSecret: message.ClientSecret };
329
+ },
330
+ create(base?: DeepPartial<OAuthAuthorization>): OAuthAuthorization {
331
+ return OAuthAuthorizationMessage.fromPartial(base ?? {});
332
+ },
333
+ fromPartial(object: DeepPartial<OAuthAuthorization>): OAuthAuthorization {
334
+ return {
335
+ Authority: object.Authority ?? '',
336
+ ClientId: object.ClientId ?? '',
337
+ ClientSecret: object.ClientSecret ?? ''
338
+ };
339
+ }
340
+ };
341
+
342
+ function createBaseOneOfAuthorization(): OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization {
343
+ return { Value0: undefined, Value1: undefined, Value2: undefined };
344
+ }
345
+
346
+ export const OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorizationMessage: MessageFns<OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization> = {
347
+ encode(message: OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
348
+ if (message.Value0 !== undefined) BasicAuthorizationMessage.encode(message.Value0, writer.uint32(10).fork()).join();
349
+ if (message.Value1 !== undefined) BearerTokenAuthorizationMessage.encode(message.Value1, writer.uint32(18).fork()).join();
350
+ if (message.Value2 !== undefined) OAuthAuthorizationMessage.encode(message.Value2, writer.uint32(26).fork()).join();
351
+ return writer;
352
+ },
353
+ decode(input: BinaryReader | Uint8Array, length?: number): OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization {
354
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
355
+ const end = length === undefined ? reader.len : reader.pos + length;
356
+ const message = createBaseOneOfAuthorization();
357
+ while (reader.pos < end) {
358
+ const tag = reader.uint32();
359
+ switch (tag >>> 3) {
360
+ case 1: message.Value0 = BasicAuthorizationMessage.decode(reader, reader.uint32()); continue;
361
+ case 2: message.Value1 = BearerTokenAuthorizationMessage.decode(reader, reader.uint32()); continue;
362
+ case 3: message.Value2 = OAuthAuthorizationMessage.decode(reader, reader.uint32()); continue;
363
+ }
364
+ if ((tag & 7) === 4 || tag === 0) break;
365
+ reader.skip(tag & 7);
366
+ }
367
+ return message;
368
+ },
369
+ fromJSON(object: unknown): OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization {
370
+ const value = object as { Value0?: unknown; Value1?: unknown; Value2?: unknown };
371
+ return {
372
+ Value0: isSet(value.Value0) ? BasicAuthorizationMessage.fromJSON(value.Value0) : undefined,
373
+ Value1: isSet(value.Value1) ? BearerTokenAuthorizationMessage.fromJSON(value.Value1) : undefined,
374
+ Value2: isSet(value.Value2) ? OAuthAuthorizationMessage.fromJSON(value.Value2) : undefined
375
+ };
376
+ },
377
+ toJSON(message: OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization): unknown {
378
+ return {
379
+ Value0: message.Value0 !== undefined ? BasicAuthorizationMessage.toJSON(message.Value0) : undefined,
380
+ Value1: message.Value1 !== undefined ? BearerTokenAuthorizationMessage.toJSON(message.Value1) : undefined,
381
+ Value2: message.Value2 !== undefined ? OAuthAuthorizationMessage.toJSON(message.Value2) : undefined
382
+ };
383
+ },
384
+ create(base?: DeepPartial<OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization>): OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization {
385
+ return OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorizationMessage.fromPartial(base ?? {});
386
+ },
387
+ fromPartial(object: DeepPartial<OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization>): OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization {
388
+ return {
389
+ Value0: object.Value0 !== undefined && object.Value0 !== null ? BasicAuthorizationMessage.fromPartial(object.Value0) : undefined,
390
+ Value1: object.Value1 !== undefined && object.Value1 !== null ? BearerTokenAuthorizationMessage.fromPartial(object.Value1) : undefined,
391
+ Value2: object.Value2 !== undefined && object.Value2 !== null ? OAuthAuthorizationMessage.fromPartial(object.Value2) : undefined
392
+ };
393
+ }
394
+ };
395
+
396
+ function createBaseHttpEndpointConfiguration(): HttpEndpointConfiguration {
397
+ return { Url: '', Authorization: undefined, Headers: {} };
398
+ }
399
+
400
+ export const HttpEndpointConfigurationMessage: MessageFns<HttpEndpointConfiguration> = {
401
+ encode(message: HttpEndpointConfiguration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
402
+ if (message.Url !== '') writer.uint32(10).string(message.Url);
403
+ if (message.Authorization !== undefined) {
404
+ OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorizationMessage.encode(message.Authorization, writer.uint32(18).fork()).join();
405
+ }
406
+ encodeStringMap(message.Headers, writer, 3);
407
+ return writer;
408
+ },
409
+ decode(input: BinaryReader | Uint8Array, length?: number): HttpEndpointConfiguration {
410
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
411
+ const end = length === undefined ? reader.len : reader.pos + length;
412
+ const message = createBaseHttpEndpointConfiguration();
413
+ while (reader.pos < end) {
414
+ const tag = reader.uint32();
415
+ switch (tag >>> 3) {
416
+ case 1: message.Url = reader.string(); continue;
417
+ case 2: message.Authorization = OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorizationMessage.decode(reader, reader.uint32()); continue;
418
+ case 3: decodeStringMapEntryInto(reader, message.Headers); continue;
419
+ }
420
+ if ((tag & 7) === 4 || tag === 0) break;
421
+ reader.skip(tag & 7);
422
+ }
423
+ return message;
424
+ },
425
+ fromJSON(object: unknown): HttpEndpointConfiguration {
426
+ const value = object as { Url?: unknown; Authorization?: unknown; Headers?: unknown };
427
+ return {
428
+ Url: typeof value.Url === 'string' ? value.Url : '',
429
+ Authorization: isSet(value.Authorization) ? OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorizationMessage.fromJSON(value.Authorization) : undefined,
430
+ Headers: stringMapFromJSON(value.Headers)
431
+ };
432
+ },
433
+ toJSON(message: HttpEndpointConfiguration): unknown {
434
+ return {
435
+ Url: message.Url,
436
+ Authorization: message.Authorization !== undefined ? OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorizationMessage.toJSON(message.Authorization) : undefined,
437
+ Headers: message.Headers
438
+ };
439
+ },
440
+ create(base?: DeepPartial<HttpEndpointConfiguration>): HttpEndpointConfiguration {
441
+ return HttpEndpointConfigurationMessage.fromPartial(base ?? {});
442
+ },
443
+ fromPartial(object: DeepPartial<HttpEndpointConfiguration>): HttpEndpointConfiguration {
444
+ return {
445
+ Url: object.Url ?? '',
446
+ Authorization: object.Authorization !== undefined && object.Authorization !== null
447
+ ? OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorizationMessage.fromPartial(object.Authorization)
448
+ : undefined,
449
+ Headers: stringMapFromPartial(object.Headers as { [key: string]: string } | undefined)
450
+ };
451
+ }
452
+ };
453
+
454
+ function createBaseDatabaseEndpointConfiguration(): DatabaseEndpointConfiguration {
455
+ return { Host: '', Port: 0, Database: '', Username: '', Password: '', Options: {} };
456
+ }
457
+
458
+ export const DatabaseEndpointConfigurationMessage: MessageFns<DatabaseEndpointConfiguration> = {
459
+ encode(message: DatabaseEndpointConfiguration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
460
+ if (message.Host !== '') writer.uint32(10).string(message.Host);
461
+ if (message.Port !== 0) writer.uint32(16).int32(message.Port);
462
+ if (message.Database !== '') writer.uint32(26).string(message.Database);
463
+ if (message.Username !== '') writer.uint32(34).string(message.Username);
464
+ if (message.Password !== '') writer.uint32(42).string(message.Password);
465
+ encodeStringMap(message.Options, writer, 6);
466
+ return writer;
467
+ },
468
+ decode(input: BinaryReader | Uint8Array, length?: number): DatabaseEndpointConfiguration {
469
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
470
+ const end = length === undefined ? reader.len : reader.pos + length;
471
+ const message = createBaseDatabaseEndpointConfiguration();
472
+ while (reader.pos < end) {
473
+ const tag = reader.uint32();
474
+ switch (tag >>> 3) {
475
+ case 1: message.Host = reader.string(); continue;
476
+ case 2: message.Port = reader.int32(); continue;
477
+ case 3: message.Database = reader.string(); continue;
478
+ case 4: message.Username = reader.string(); continue;
479
+ case 5: message.Password = reader.string(); continue;
480
+ case 6: decodeStringMapEntryInto(reader, message.Options); continue;
481
+ }
482
+ if ((tag & 7) === 4 || tag === 0) break;
483
+ reader.skip(tag & 7);
484
+ }
485
+ return message;
486
+ },
487
+ fromJSON(object: unknown): DatabaseEndpointConfiguration {
488
+ const value = object as {
489
+ Host?: unknown; Port?: unknown; Database?: unknown; Username?: unknown; Password?: unknown; Options?: unknown;
490
+ };
491
+ return {
492
+ Host: typeof value.Host === 'string' ? value.Host : '',
493
+ Port: typeof value.Port === 'number' ? value.Port : 0,
494
+ Database: typeof value.Database === 'string' ? value.Database : '',
495
+ Username: typeof value.Username === 'string' ? value.Username : '',
496
+ Password: typeof value.Password === 'string' ? value.Password : '',
497
+ Options: stringMapFromJSON(value.Options)
498
+ };
499
+ },
500
+ toJSON(message: DatabaseEndpointConfiguration): unknown {
501
+ return {
502
+ Host: message.Host,
503
+ Port: Math.round(message.Port),
504
+ Database: message.Database,
505
+ Username: message.Username,
506
+ Password: message.Password,
507
+ Options: message.Options
508
+ };
509
+ },
510
+ create(base?: DeepPartial<DatabaseEndpointConfiguration>): DatabaseEndpointConfiguration {
511
+ return DatabaseEndpointConfigurationMessage.fromPartial(base ?? {});
512
+ },
513
+ fromPartial(object: DeepPartial<DatabaseEndpointConfiguration>): DatabaseEndpointConfiguration {
514
+ return {
515
+ Host: object.Host ?? '',
516
+ Port: object.Port ?? 0,
517
+ Database: object.Database ?? '',
518
+ Username: object.Username ?? '',
519
+ Password: object.Password ?? '',
520
+ Options: stringMapFromPartial(object.Options as { [key: string]: string } | undefined)
521
+ };
522
+ }
523
+ };
524
+
525
+ function createBaseExternalServiceEndpoint(): ExternalServiceEndpoint {
526
+ return { Type: ExternalServiceEndpointType.Http, Http: undefined, Database: undefined };
527
+ }
528
+
529
+ export const ExternalServiceEndpointMessage: MessageFns<ExternalServiceEndpoint> = {
530
+ encode(message: ExternalServiceEndpoint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
531
+ if (message.Type !== ExternalServiceEndpointType.Http) writer.uint32(8).int32(message.Type);
532
+ if (message.Http !== undefined) HttpEndpointConfigurationMessage.encode(message.Http, writer.uint32(18).fork()).join();
533
+ if (message.Database !== undefined) DatabaseEndpointConfigurationMessage.encode(message.Database, writer.uint32(26).fork()).join();
534
+ return writer;
535
+ },
536
+ decode(input: BinaryReader | Uint8Array, length?: number): ExternalServiceEndpoint {
537
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
538
+ const end = length === undefined ? reader.len : reader.pos + length;
539
+ const message = createBaseExternalServiceEndpoint();
540
+ while (reader.pos < end) {
541
+ const tag = reader.uint32();
542
+ switch (tag >>> 3) {
543
+ case 1: message.Type = reader.int32(); continue;
544
+ case 2: message.Http = HttpEndpointConfigurationMessage.decode(reader, reader.uint32()); continue;
545
+ case 3: message.Database = DatabaseEndpointConfigurationMessage.decode(reader, reader.uint32()); continue;
546
+ }
547
+ if ((tag & 7) === 4 || tag === 0) break;
548
+ reader.skip(tag & 7);
549
+ }
550
+ return message;
551
+ },
552
+ fromJSON(object: unknown): ExternalServiceEndpoint {
553
+ const value = object as { Type?: unknown; Http?: unknown; Database?: unknown };
554
+ return {
555
+ Type: typeof value.Type === 'number' ? value.Type : ExternalServiceEndpointType.Http,
556
+ Http: isSet(value.Http) ? HttpEndpointConfigurationMessage.fromJSON(value.Http) : undefined,
557
+ Database: isSet(value.Database) ? DatabaseEndpointConfigurationMessage.fromJSON(value.Database) : undefined
558
+ };
559
+ },
560
+ toJSON(message: ExternalServiceEndpoint): unknown {
561
+ return {
562
+ Type: message.Type,
563
+ Http: message.Http !== undefined ? HttpEndpointConfigurationMessage.toJSON(message.Http) : undefined,
564
+ Database: message.Database !== undefined ? DatabaseEndpointConfigurationMessage.toJSON(message.Database) : undefined
565
+ };
566
+ },
567
+ create(base?: DeepPartial<ExternalServiceEndpoint>): ExternalServiceEndpoint {
568
+ return ExternalServiceEndpointMessage.fromPartial(base ?? {});
569
+ },
570
+ fromPartial(object: DeepPartial<ExternalServiceEndpoint>): ExternalServiceEndpoint {
571
+ return {
572
+ Type: object.Type ?? ExternalServiceEndpointType.Http,
573
+ Http: object.Http !== undefined && object.Http !== null ? HttpEndpointConfigurationMessage.fromPartial(object.Http) : undefined,
574
+ Database: object.Database !== undefined && object.Database !== null ? DatabaseEndpointConfigurationMessage.fromPartial(object.Database) : undefined
575
+ };
576
+ }
577
+ };
578
+
579
+ function createBaseExternalServiceDefinition(): ExternalServiceDefinition {
580
+ return { Id: '', Name: '', Endpoint: undefined };
581
+ }
582
+
583
+ export const ExternalServiceDefinitionMessage: MessageFns<ExternalServiceDefinition> = {
584
+ encode(message: ExternalServiceDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
585
+ if (message.Id !== '') writer.uint32(10).string(message.Id);
586
+ if (message.Name !== '') writer.uint32(18).string(message.Name);
587
+ if (message.Endpoint !== undefined) ExternalServiceEndpointMessage.encode(message.Endpoint, writer.uint32(26).fork()).join();
588
+ return writer;
589
+ },
590
+ decode(input: BinaryReader | Uint8Array, length?: number): ExternalServiceDefinition {
591
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
592
+ const end = length === undefined ? reader.len : reader.pos + length;
593
+ const message = createBaseExternalServiceDefinition();
594
+ while (reader.pos < end) {
595
+ const tag = reader.uint32();
596
+ switch (tag >>> 3) {
597
+ case 1: message.Id = reader.string(); continue;
598
+ case 2: message.Name = reader.string(); continue;
599
+ case 3: message.Endpoint = ExternalServiceEndpointMessage.decode(reader, reader.uint32()); continue;
600
+ }
601
+ if ((tag & 7) === 4 || tag === 0) break;
602
+ reader.skip(tag & 7);
603
+ }
604
+ return message;
605
+ },
606
+ fromJSON(object: unknown): ExternalServiceDefinition {
607
+ const value = object as { Id?: unknown; Name?: unknown; Endpoint?: unknown };
608
+ return {
609
+ Id: typeof value.Id === 'string' ? value.Id : '',
610
+ Name: typeof value.Name === 'string' ? value.Name : '',
611
+ Endpoint: isSet(value.Endpoint) ? ExternalServiceEndpointMessage.fromJSON(value.Endpoint) : undefined
612
+ };
613
+ },
614
+ toJSON(message: ExternalServiceDefinition): unknown {
615
+ return {
616
+ Id: message.Id,
617
+ Name: message.Name,
618
+ Endpoint: message.Endpoint !== undefined ? ExternalServiceEndpointMessage.toJSON(message.Endpoint) : undefined
619
+ };
620
+ },
621
+ create(base?: DeepPartial<ExternalServiceDefinition>): ExternalServiceDefinition {
622
+ return ExternalServiceDefinitionMessage.fromPartial(base ?? {});
623
+ },
624
+ fromPartial(object: DeepPartial<ExternalServiceDefinition>): ExternalServiceDefinition {
625
+ return {
626
+ Id: object.Id ?? '',
627
+ Name: object.Name ?? '',
628
+ Endpoint: object.Endpoint !== undefined && object.Endpoint !== null ? ExternalServiceEndpointMessage.fromPartial(object.Endpoint) : undefined
629
+ };
630
+ }
631
+ };
632
+
633
+ function createBaseAddExternalServices(): AddExternalServices {
634
+ return { EventStore: '', ExternalServices: [] };
635
+ }
636
+
637
+ export const AddExternalServicesMessage: MessageFns<AddExternalServices> = {
638
+ encode(message: AddExternalServices, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
639
+ if (message.EventStore !== '') writer.uint32(10).string(message.EventStore);
640
+ for (const externalService of message.ExternalServices) {
641
+ ExternalServiceDefinitionMessage.encode(externalService, writer.uint32(18).fork()).join();
642
+ }
643
+ return writer;
644
+ },
645
+ decode(input: BinaryReader | Uint8Array, length?: number): AddExternalServices {
646
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
647
+ const end = length === undefined ? reader.len : reader.pos + length;
648
+ const message = createBaseAddExternalServices();
649
+ while (reader.pos < end) {
650
+ const tag = reader.uint32();
651
+ switch (tag >>> 3) {
652
+ case 1: message.EventStore = reader.string(); continue;
653
+ case 2: message.ExternalServices.push(ExternalServiceDefinitionMessage.decode(reader, reader.uint32())); continue;
654
+ }
655
+ if ((tag & 7) === 4 || tag === 0) break;
656
+ reader.skip(tag & 7);
657
+ }
658
+ return message;
659
+ },
660
+ fromJSON(object: unknown): AddExternalServices {
661
+ const value = object as { EventStore?: unknown; ExternalServices?: unknown[] };
662
+ return {
663
+ EventStore: typeof value.EventStore === 'string' ? value.EventStore : '',
664
+ ExternalServices: Array.isArray(value.ExternalServices)
665
+ ? value.ExternalServices.map(externalService => ExternalServiceDefinitionMessage.fromJSON(externalService))
666
+ : []
667
+ };
668
+ },
669
+ toJSON(message: AddExternalServices): unknown {
670
+ return {
671
+ EventStore: message.EventStore,
672
+ ExternalServices: message.ExternalServices.map(externalService => ExternalServiceDefinitionMessage.toJSON(externalService))
673
+ };
674
+ },
675
+ create(base?: DeepPartial<AddExternalServices>): AddExternalServices {
676
+ return AddExternalServicesMessage.fromPartial(base ?? {});
677
+ },
678
+ fromPartial(object: DeepPartial<AddExternalServices>): AddExternalServices {
679
+ return {
680
+ EventStore: object.EventStore ?? '',
681
+ ExternalServices: object.ExternalServices?.map(externalService => ExternalServiceDefinitionMessage.fromPartial(externalService)) ?? []
682
+ };
683
+ }
684
+ };
685
+
686
+ /**
687
+ * External services gRPC service definition, for use with nice-grpc's client factory.
688
+ */
689
+ export const ExternalServicesDefinition = {
690
+ name: 'ExternalServices',
691
+ fullName: 'Cratis.Chronicle.Contracts.ExternalServices.ExternalServices',
692
+ methods: {
693
+ add: {
694
+ name: 'Add',
695
+ requestType: AddExternalServicesMessage,
696
+ requestStream: false,
697
+ responseType: EmptyMessage,
698
+ responseStream: false,
699
+ options: {}
700
+ }
701
+ }
702
+ } as const;
703
+
704
+ /**
705
+ * External services service client interface.
706
+ */
707
+ export interface ExternalServicesClient<CallOptionsExt = {}> {
708
+ add(request: DeepPartial<AddExternalServices>, options?: CallOptions & CallOptionsExt): Promise<Empty>;
709
+ }