@cratis/chronicle 6.63.0 → 6.65.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 (411) hide show
  1. package/README.md +1 -1
  2. package/artifacts/DefaultClientArtifactsProvider.ts +5 -0
  3. package/artifacts/IClientArtifactsProvider.ts +3 -0
  4. package/connection/ChronicleConnection.ts +17 -7
  5. package/connection/ChronicleConnectionString.spec.ts +85 -0
  6. package/connection/ChronicleConnectionString.ts +186 -12
  7. package/connection/ChronicleTlsMaterial.spec.ts +160 -0
  8. package/connection/ChronicleTlsMaterial.ts +121 -0
  9. package/connection/CompatibilityPreflight.ts +9 -1
  10. package/connection/LeastConnectionsLoadBalancerStrategy.ts +4 -2
  11. package/connection/LoadBalancerStrategyFactory.ts +7 -2
  12. package/connection/TokenProvider.ts +4 -1
  13. package/connection/fetchOAuthAccessToken.ts +4 -2
  14. package/connection/for_CompatibilityPreflight/when_verifying/with_the_check_skipped.spec.ts +23 -0
  15. package/dist/artifacts/DefaultClientArtifactsProvider.d.ts +2 -0
  16. package/dist/artifacts/DefaultClientArtifactsProvider.d.ts.map +1 -1
  17. package/dist/artifacts/DefaultClientArtifactsProvider.js +4 -0
  18. package/dist/artifacts/DefaultClientArtifactsProvider.js.map +1 -1
  19. package/dist/artifacts/IClientArtifactsProvider.d.ts +2 -0
  20. package/dist/artifacts/IClientArtifactsProvider.d.ts.map +1 -1
  21. package/dist/connection/ChronicleConnection.d.ts +1 -0
  22. package/dist/connection/ChronicleConnection.d.ts.map +1 -1
  23. package/dist/connection/ChronicleConnection.js +15 -7
  24. package/dist/connection/ChronicleConnection.js.map +1 -1
  25. package/dist/connection/ChronicleConnectionString.d.ts +50 -1
  26. package/dist/connection/ChronicleConnectionString.d.ts.map +1 -1
  27. package/dist/connection/ChronicleConnectionString.js +154 -12
  28. package/dist/connection/ChronicleConnectionString.js.map +1 -1
  29. package/dist/connection/ChronicleTlsMaterial.d.ts +54 -0
  30. package/dist/connection/ChronicleTlsMaterial.d.ts.map +1 -0
  31. package/dist/connection/ChronicleTlsMaterial.js +88 -0
  32. package/dist/connection/ChronicleTlsMaterial.js.map +1 -0
  33. package/dist/connection/CompatibilityPreflight.d.ts +2 -1
  34. package/dist/connection/CompatibilityPreflight.d.ts.map +1 -1
  35. package/dist/connection/CompatibilityPreflight.js +6 -1
  36. package/dist/connection/CompatibilityPreflight.js.map +1 -1
  37. package/dist/connection/LeastConnectionsLoadBalancerStrategy.d.ts +2 -1
  38. package/dist/connection/LeastConnectionsLoadBalancerStrategy.d.ts.map +1 -1
  39. package/dist/connection/LeastConnectionsLoadBalancerStrategy.js +3 -2
  40. package/dist/connection/LeastConnectionsLoadBalancerStrategy.js.map +1 -1
  41. package/dist/connection/LoadBalancerStrategyFactory.d.ts +2 -1
  42. package/dist/connection/LoadBalancerStrategyFactory.d.ts.map +1 -1
  43. package/dist/connection/LoadBalancerStrategyFactory.js +3 -2
  44. package/dist/connection/LoadBalancerStrategyFactory.js.map +1 -1
  45. package/dist/connection/TokenProvider.d.ts +4 -1
  46. package/dist/connection/TokenProvider.d.ts.map +1 -1
  47. package/dist/connection/TokenProvider.js +5 -1
  48. package/dist/connection/TokenProvider.js.map +1 -1
  49. package/dist/connection/fetchOAuthAccessToken.d.ts +2 -1
  50. package/dist/connection/fetchOAuthAccessToken.d.ts.map +1 -1
  51. package/dist/connection/fetchOAuthAccessToken.js +3 -2
  52. package/dist/connection/fetchOAuthAccessToken.js.map +1 -1
  53. package/dist/projections/for_Graphs/given/a_discovered_graph.d.ts +2 -1
  54. package/dist/projections/for_Graphs/given/a_discovered_graph.d.ts.map +1 -1
  55. package/dist/projections/for_Graphs/given/a_discovered_graph.js +3 -2
  56. package/dist/projections/for_Graphs/given/a_discovered_graph.js.map +1 -1
  57. package/dist/projections/for_Graphs/given/a_graph_with_views.d.ts +40 -0
  58. package/dist/projections/for_Graphs/given/a_graph_with_views.d.ts.map +1 -0
  59. package/dist/projections/for_Graphs/given/a_graph_with_views.js +80 -0
  60. package/dist/projections/for_Graphs/given/a_graph_with_views.js.map +1 -0
  61. package/dist/projections/for_Graphs/given/organization.d.ts +2 -1
  62. package/dist/projections/for_Graphs/given/organization.d.ts.map +1 -1
  63. package/dist/projections/for_Graphs/given/organization.js +3 -2
  64. package/dist/projections/for_Graphs/given/organization.js.map +1 -1
  65. package/dist/projections/graphs/Graphs.d.ts +5 -0
  66. package/dist/projections/graphs/Graphs.d.ts.map +1 -1
  67. package/dist/projections/graphs/Graphs.js +43 -0
  68. package/dist/projections/graphs/Graphs.js.map +1 -1
  69. package/dist/projections/graphs/IGraphs.d.ts +9 -2
  70. package/dist/projections/graphs/IGraphs.d.ts.map +1 -1
  71. package/dist/projections/graphs/index.d.ts +1 -0
  72. package/dist/projections/graphs/index.d.ts.map +1 -1
  73. package/dist/projections/graphs/index.js +1 -0
  74. package/dist/projections/graphs/index.js.map +1 -1
  75. package/dist/projections/graphs/views/AmbiguousDirection.d.ts +16 -0
  76. package/dist/projections/graphs/views/AmbiguousDirection.d.ts.map +1 -0
  77. package/dist/projections/graphs/views/AmbiguousDirection.js +21 -0
  78. package/dist/projections/graphs/views/AmbiguousDirection.js.map +1 -0
  79. package/dist/projections/graphs/views/DuplicateViewName.d.ts +16 -0
  80. package/dist/projections/graphs/views/DuplicateViewName.d.ts.map +1 -0
  81. package/dist/projections/graphs/views/DuplicateViewName.js +21 -0
  82. package/dist/projections/graphs/views/DuplicateViewName.js.map +1 -0
  83. package/dist/projections/graphs/views/EdgeNotIncidentOnRoot.d.ts +17 -0
  84. package/dist/projections/graphs/views/EdgeNotIncidentOnRoot.d.ts.map +1 -0
  85. package/dist/projections/graphs/views/EdgeNotIncidentOnRoot.js +22 -0
  86. package/dist/projections/graphs/views/EdgeNotIncidentOnRoot.js.map +1 -0
  87. package/dist/projections/graphs/views/EdgePropertyViewNotUsedAsTarget.d.ts +14 -0
  88. package/dist/projections/graphs/views/EdgePropertyViewNotUsedAsTarget.d.ts.map +1 -0
  89. package/dist/projections/graphs/views/EdgePropertyViewNotUsedAsTarget.js +19 -0
  90. package/dist/projections/graphs/views/EdgePropertyViewNotUsedAsTarget.js.map +1 -0
  91. package/dist/projections/graphs/views/EdgePropertyViewSharedAcrossEdges.d.ts +15 -0
  92. package/dist/projections/graphs/views/EdgePropertyViewSharedAcrossEdges.d.ts.map +1 -0
  93. package/dist/projections/graphs/views/EdgePropertyViewSharedAcrossEdges.js +20 -0
  94. package/dist/projections/graphs/views/EdgePropertyViewSharedAcrossEdges.js.map +1 -0
  95. package/dist/projections/graphs/views/FollowsOptions.d.ts +16 -0
  96. package/dist/projections/graphs/views/FollowsOptions.d.ts.map +1 -0
  97. package/dist/projections/graphs/views/FollowsOptions.js +4 -0
  98. package/dist/projections/graphs/views/FollowsOptions.js.map +1 -0
  99. package/dist/projections/graphs/views/GraphEdgeDirection.d.ts +10 -0
  100. package/dist/projections/graphs/views/GraphEdgeDirection.d.ts.map +1 -0
  101. package/dist/projections/graphs/views/GraphEdgeDirection.js +13 -0
  102. package/dist/projections/graphs/views/GraphEdgeDirection.js.map +1 -0
  103. package/dist/projections/graphs/views/GraphView.d.ts +13 -0
  104. package/dist/projections/graphs/views/GraphView.d.ts.map +1 -0
  105. package/dist/projections/graphs/views/GraphView.js +4 -0
  106. package/dist/projections/graphs/views/GraphView.js.map +1 -0
  107. package/dist/projections/graphs/views/GraphViewBuildResult.d.ts +15 -0
  108. package/dist/projections/graphs/views/GraphViewBuildResult.d.ts.map +1 -0
  109. package/dist/projections/graphs/views/GraphViewBuildResult.js +4 -0
  110. package/dist/projections/graphs/views/GraphViewBuildResult.js.map +1 -0
  111. package/dist/projections/graphs/views/GraphViewCardinality.d.ts +10 -0
  112. package/dist/projections/graphs/views/GraphViewCardinality.d.ts.map +1 -0
  113. package/dist/projections/graphs/views/GraphViewCardinality.js +13 -0
  114. package/dist/projections/graphs/views/GraphViewCardinality.js.map +1 -0
  115. package/dist/projections/graphs/views/GraphViewDefinition.d.ts +15 -0
  116. package/dist/projections/graphs/views/GraphViewDefinition.d.ts.map +1 -0
  117. package/dist/projections/graphs/views/GraphViewDefinition.js +4 -0
  118. package/dist/projections/graphs/views/GraphViewDefinition.js.map +1 -0
  119. package/dist/projections/graphs/views/GraphViewDefinitionBuilder.d.ts +30 -0
  120. package/dist/projections/graphs/views/GraphViewDefinitionBuilder.d.ts.map +1 -0
  121. package/dist/projections/graphs/views/GraphViewDefinitionBuilder.js +259 -0
  122. package/dist/projections/graphs/views/GraphViewDefinitionBuilder.js.map +1 -0
  123. package/dist/projections/graphs/views/GraphViewDefinitionSerializer.d.ts +21 -0
  124. package/dist/projections/graphs/views/GraphViewDefinitionSerializer.d.ts.map +1 -0
  125. package/dist/projections/graphs/views/GraphViewDefinitionSerializer.js +77 -0
  126. package/dist/projections/graphs/views/GraphViewDefinitionSerializer.js.map +1 -0
  127. package/dist/projections/graphs/views/GraphViewEdgeReference.d.ts +6 -0
  128. package/dist/projections/graphs/views/GraphViewEdgeReference.d.ts.map +1 -0
  129. package/dist/projections/graphs/views/GraphViewEdgeReference.js +4 -0
  130. package/dist/projections/graphs/views/GraphViewEdgeReference.js.map +1 -0
  131. package/dist/projections/graphs/views/GraphViewMember.d.ts +8 -0
  132. package/dist/projections/graphs/views/GraphViewMember.d.ts.map +1 -0
  133. package/dist/projections/graphs/views/GraphViewMember.js +4 -0
  134. package/dist/projections/graphs/views/GraphViewMember.js.map +1 -0
  135. package/dist/projections/graphs/views/GraphViewMemberKind.d.ts +12 -0
  136. package/dist/projections/graphs/views/GraphViewMemberKind.d.ts.map +1 -0
  137. package/dist/projections/graphs/views/GraphViewMemberKind.js +15 -0
  138. package/dist/projections/graphs/views/GraphViewMemberKind.js.map +1 -0
  139. package/dist/projections/graphs/views/GraphViewMemberMetadata.d.ts +22 -0
  140. package/dist/projections/graphs/views/GraphViewMemberMetadata.d.ts.map +1 -0
  141. package/dist/projections/graphs/views/GraphViewMemberMetadata.js +4 -0
  142. package/dist/projections/graphs/views/GraphViewMemberMetadata.js.map +1 -0
  143. package/dist/projections/graphs/views/GraphViewPropertyMember.d.ts +13 -0
  144. package/dist/projections/graphs/views/GraphViewPropertyMember.d.ts.map +1 -0
  145. package/dist/projections/graphs/views/GraphViewPropertyMember.js +4 -0
  146. package/dist/projections/graphs/views/GraphViewPropertyMember.js.map +1 -0
  147. package/dist/projections/graphs/views/GraphViewReason.d.ts +33 -0
  148. package/dist/projections/graphs/views/GraphViewReason.d.ts.map +1 -0
  149. package/dist/projections/graphs/views/GraphViewReason.js +36 -0
  150. package/dist/projections/graphs/views/GraphViewReason.js.map +1 -0
  151. package/dist/projections/graphs/views/GraphViewRelationMember.d.ts +21 -0
  152. package/dist/projections/graphs/views/GraphViewRelationMember.d.ts.map +1 -0
  153. package/dist/projections/graphs/views/GraphViewRelationMember.js +4 -0
  154. package/dist/projections/graphs/views/GraphViewRelationMember.js.map +1 -0
  155. package/dist/projections/graphs/views/GraphViewSchema.d.ts +10 -0
  156. package/dist/projections/graphs/views/GraphViewSchema.d.ts.map +1 -0
  157. package/dist/projections/graphs/views/GraphViewSchema.js +4 -0
  158. package/dist/projections/graphs/views/GraphViewSchema.js.map +1 -0
  159. package/dist/projections/graphs/views/GraphViewSchemaEdge.d.ts +14 -0
  160. package/dist/projections/graphs/views/GraphViewSchemaEdge.d.ts.map +1 -0
  161. package/dist/projections/graphs/views/GraphViewSchemaEdge.js +4 -0
  162. package/dist/projections/graphs/views/GraphViewSchemaEdge.js.map +1 -0
  163. package/dist/projections/graphs/views/GraphViewSchemaNode.d.ts +10 -0
  164. package/dist/projections/graphs/views/GraphViewSchemaNode.d.ts.map +1 -0
  165. package/dist/projections/graphs/views/GraphViewSchemaNode.js +4 -0
  166. package/dist/projections/graphs/views/GraphViewSchemaNode.js.map +1 -0
  167. package/dist/projections/graphs/views/GraphViewSerializerOptions.d.ts +9 -0
  168. package/dist/projections/graphs/views/GraphViewSerializerOptions.d.ts.map +1 -0
  169. package/dist/projections/graphs/views/GraphViewSerializerOptions.js +4 -0
  170. package/dist/projections/graphs/views/GraphViewSerializerOptions.js.map +1 -0
  171. package/dist/projections/graphs/views/RecursiveView.d.ts +15 -0
  172. package/dist/projections/graphs/views/RecursiveView.d.ts.map +1 -0
  173. package/dist/projections/graphs/views/RecursiveView.js +20 -0
  174. package/dist/projections/graphs/views/RecursiveView.js.map +1 -0
  175. package/dist/projections/graphs/views/RelationTargetNotAView.d.ts +16 -0
  176. package/dist/projections/graphs/views/RelationTargetNotAView.d.ts.map +1 -0
  177. package/dist/projections/graphs/views/RelationTargetNotAView.js +21 -0
  178. package/dist/projections/graphs/views/RelationTargetNotAView.js.map +1 -0
  179. package/dist/projections/graphs/views/TargetLabelMismatch.d.ts +18 -0
  180. package/dist/projections/graphs/views/TargetLabelMismatch.d.ts.map +1 -0
  181. package/dist/projections/graphs/views/TargetLabelMismatch.js +23 -0
  182. package/dist/projections/graphs/views/TargetLabelMismatch.js.map +1 -0
  183. package/dist/projections/graphs/views/UnknownEdge.d.ts +16 -0
  184. package/dist/projections/graphs/views/UnknownEdge.d.ts.map +1 -0
  185. package/dist/projections/graphs/views/UnknownEdge.js +21 -0
  186. package/dist/projections/graphs/views/UnknownEdge.js.map +1 -0
  187. package/dist/projections/graphs/views/UnknownEdgeProperty.d.ts +17 -0
  188. package/dist/projections/graphs/views/UnknownEdgeProperty.d.ts.map +1 -0
  189. package/dist/projections/graphs/views/UnknownEdgeProperty.js +22 -0
  190. package/dist/projections/graphs/views/UnknownEdgeProperty.js.map +1 -0
  191. package/dist/projections/graphs/views/UnknownNodeProperty.d.ts +17 -0
  192. package/dist/projections/graphs/views/UnknownNodeProperty.d.ts.map +1 -0
  193. package/dist/projections/graphs/views/UnknownNodeProperty.js +22 -0
  194. package/dist/projections/graphs/views/UnknownNodeProperty.js.map +1 -0
  195. package/dist/projections/graphs/views/ViewIsAlsoSchema.d.ts +14 -0
  196. package/dist/projections/graphs/views/ViewIsAlsoSchema.d.ts.map +1 -0
  197. package/dist/projections/graphs/views/ViewIsAlsoSchema.js +19 -0
  198. package/dist/projections/graphs/views/ViewIsAlsoSchema.js.map +1 -0
  199. package/dist/projections/graphs/views/ViewOfMetadata.d.ts +8 -0
  200. package/dist/projections/graphs/views/ViewOfMetadata.d.ts.map +1 -0
  201. package/dist/projections/graphs/views/ViewOfMetadata.js +4 -0
  202. package/dist/projections/graphs/views/ViewOfMetadata.js.map +1 -0
  203. package/dist/projections/graphs/views/ViewOfOptions.d.ts +6 -0
  204. package/dist/projections/graphs/views/ViewOfOptions.d.ts.map +1 -0
  205. package/dist/projections/graphs/views/ViewOfOptions.js +4 -0
  206. package/dist/projections/graphs/views/ViewOfOptions.js.map +1 -0
  207. package/dist/projections/graphs/views/ViewRootNotANode.d.ts +16 -0
  208. package/dist/projections/graphs/views/ViewRootNotANode.d.ts.map +1 -0
  209. package/dist/projections/graphs/views/ViewRootNotANode.js +21 -0
  210. package/dist/projections/graphs/views/ViewRootNotANode.js.map +1 -0
  211. package/dist/projections/graphs/views/declareGraphViewMember.d.ts +17 -0
  212. package/dist/projections/graphs/views/declareGraphViewMember.d.ts.map +1 -0
  213. package/dist/projections/graphs/views/declareGraphViewMember.js +31 -0
  214. package/dist/projections/graphs/views/declareGraphViewMember.js.map +1 -0
  215. package/dist/projections/graphs/views/follows.d.ts +13 -0
  216. package/dist/projections/graphs/views/follows.d.ts.map +1 -0
  217. package/dist/projections/graphs/views/follows.js +24 -0
  218. package/dist/projections/graphs/views/follows.js.map +1 -0
  219. package/dist/projections/graphs/views/fromEdge.d.ts +10 -0
  220. package/dist/projections/graphs/views/fromEdge.d.ts.map +1 -0
  221. package/dist/projections/graphs/views/fromEdge.js +15 -0
  222. package/dist/projections/graphs/views/fromEdge.js.map +1 -0
  223. package/dist/projections/graphs/views/index.d.ts +41 -0
  224. package/dist/projections/graphs/views/index.d.ts.map +1 -0
  225. package/dist/projections/graphs/views/index.js +28 -0
  226. package/dist/projections/graphs/views/index.js.map +1 -0
  227. package/dist/projections/graphs/views/viewKey.d.ts +8 -0
  228. package/dist/projections/graphs/views/viewKey.d.ts.map +1 -0
  229. package/dist/projections/graphs/views/viewKey.js +13 -0
  230. package/dist/projections/graphs/views/viewKey.js.map +1 -0
  231. package/dist/projections/graphs/views/viewOf.d.ts +22 -0
  232. package/dist/projections/graphs/views/viewOf.d.ts.map +1 -0
  233. package/dist/projections/graphs/views/viewOf.js +41 -0
  234. package/dist/projections/graphs/views/viewOf.js.map +1 -0
  235. package/dist/projections/graphs/views/viewProperty.d.ts +9 -0
  236. package/dist/projections/graphs/views/viewProperty.d.ts.map +1 -0
  237. package/dist/projections/graphs/views/viewProperty.js +14 -0
  238. package/dist/projections/graphs/views/viewProperty.js.map +1 -0
  239. package/dist/testing/InProcessAppendMetadata.d.ts +30 -0
  240. package/dist/testing/InProcessAppendMetadata.d.ts.map +1 -0
  241. package/dist/testing/InProcessAppendMetadata.js +107 -0
  242. package/dist/testing/InProcessAppendMetadata.js.map +1 -0
  243. package/dist/testing/InProcessBatchAppend.d.ts +62 -0
  244. package/dist/testing/InProcessBatchAppend.d.ts.map +1 -0
  245. package/dist/testing/InProcessBatchAppend.js +131 -0
  246. package/dist/testing/InProcessBatchAppend.js.map +1 -0
  247. package/dist/testing/InProcessEventPayload.d.ts +23 -0
  248. package/dist/testing/InProcessEventPayload.d.ts.map +1 -0
  249. package/dist/testing/InProcessEventPayload.js +94 -0
  250. package/dist/testing/InProcessEventPayload.js.map +1 -0
  251. package/dist/testing/InProcessEventReadCriteria.d.ts +9 -0
  252. package/dist/testing/InProcessEventReadCriteria.d.ts.map +1 -0
  253. package/dist/testing/InProcessEventReadCriteria.js +4 -0
  254. package/dist/testing/InProcessEventReadCriteria.js.map +1 -0
  255. package/dist/testing/InProcessEventReadFilter.d.ts +14 -0
  256. package/dist/testing/InProcessEventReadFilter.d.ts.map +1 -0
  257. package/dist/testing/InProcessEventReadFilter.js +31 -0
  258. package/dist/testing/InProcessEventReadFilter.js.map +1 -0
  259. package/dist/testing/InProcessEventSequence.d.ts +8 -5
  260. package/dist/testing/InProcessEventSequence.d.ts.map +1 -1
  261. package/dist/testing/InProcessEventSequence.js +59 -275
  262. package/dist/testing/InProcessEventSequence.js.map +1 -1
  263. package/dist/testing/InProcessEventSequenceEnvironment.d.ts +13 -0
  264. package/dist/testing/InProcessEventSequenceEnvironment.d.ts.map +1 -0
  265. package/dist/testing/InProcessEventSequenceEnvironment.js +4 -0
  266. package/dist/testing/InProcessEventSequenceEnvironment.js.map +1 -0
  267. package/dist/testing/InProcessSingleAppend.d.ts +34 -0
  268. package/dist/testing/InProcessSingleAppend.d.ts.map +1 -0
  269. package/dist/testing/InProcessSingleAppend.js +95 -0
  270. package/dist/testing/InProcessSingleAppend.js.map +1 -0
  271. package/dist/testing/projections/ProjectionCapabilities.d.ts +0 -8
  272. package/dist/testing/projections/ProjectionCapabilities.d.ts.map +1 -1
  273. package/dist/testing/projections/ProjectionCapabilities.js +21 -312
  274. package/dist/testing/projections/ProjectionCapabilities.js.map +1 -1
  275. package/dist/testing/projections/ProjectionCapabilityReject.d.ts +3 -0
  276. package/dist/testing/projections/ProjectionCapabilityReject.d.ts.map +1 -0
  277. package/dist/testing/projections/ProjectionCapabilityReject.js +4 -0
  278. package/dist/testing/projections/ProjectionCapabilityReject.js.map +1 -0
  279. package/dist/testing/projections/ProjectionCapabilityReporter.d.ts +12 -0
  280. package/dist/testing/projections/ProjectionCapabilityReporter.d.ts.map +1 -0
  281. package/dist/testing/projections/ProjectionCapabilityReporter.js +33 -0
  282. package/dist/testing/projections/ProjectionCapabilityReporter.js.map +1 -0
  283. package/dist/testing/projections/ProjectionDefinitionCapabilities.d.ts +11 -0
  284. package/dist/testing/projections/ProjectionDefinitionCapabilities.d.ts.map +1 -0
  285. package/dist/testing/projections/ProjectionDefinitionCapabilities.js +45 -0
  286. package/dist/testing/projections/ProjectionDefinitionCapabilities.js.map +1 -0
  287. package/dist/testing/projections/ProjectionEventSchemaResolver.d.ts +13 -0
  288. package/dist/testing/projections/ProjectionEventSchemaResolver.d.ts.map +1 -0
  289. package/dist/testing/projections/ProjectionEventSchemaResolver.js +22 -0
  290. package/dist/testing/projections/ProjectionEventSchemaResolver.js.map +1 -0
  291. package/dist/testing/projections/ProjectionExpressionCapabilities.d.ts +19 -0
  292. package/dist/testing/projections/ProjectionExpressionCapabilities.d.ts.map +1 -0
  293. package/dist/testing/projections/ProjectionExpressionCapabilities.js +103 -0
  294. package/dist/testing/projections/ProjectionExpressionCapabilities.js.map +1 -0
  295. package/dist/testing/projections/ProjectionInitialValueCapabilities.d.ts +16 -0
  296. package/dist/testing/projections/ProjectionInitialValueCapabilities.d.ts.map +1 -0
  297. package/dist/testing/projections/ProjectionInitialValueCapabilities.js +72 -0
  298. package/dist/testing/projections/ProjectionInitialValueCapabilities.js.map +1 -0
  299. package/dist/testing/projections/ProjectionMappingCapabilities.d.ts +21 -0
  300. package/dist/testing/projections/ProjectionMappingCapabilities.d.ts.map +1 -0
  301. package/dist/testing/projections/ProjectionMappingCapabilities.js +86 -0
  302. package/dist/testing/projections/ProjectionMappingCapabilities.js.map +1 -0
  303. package/dist/testing/projections/ProjectionMappingValidation.d.ts +9 -0
  304. package/dist/testing/projections/ProjectionMappingValidation.d.ts.map +1 -0
  305. package/dist/testing/projections/ProjectionMappingValidation.js +4 -0
  306. package/dist/testing/projections/ProjectionMappingValidation.js.map +1 -0
  307. package/dist/testing/projections/ProjectionReadModelCapabilities.d.ts +11 -0
  308. package/dist/testing/projections/ProjectionReadModelCapabilities.d.ts.map +1 -0
  309. package/dist/testing/projections/ProjectionReadModelCapabilities.js +40 -0
  310. package/dist/testing/projections/ProjectionReadModelCapabilities.js.map +1 -0
  311. package/dist/testing/projections/ProjectionRootCapabilities.d.ts +20 -0
  312. package/dist/testing/projections/ProjectionRootCapabilities.d.ts.map +1 -0
  313. package/dist/testing/projections/ProjectionRootCapabilities.js +73 -0
  314. package/dist/testing/projections/ProjectionRootCapabilities.js.map +1 -0
  315. package/dist/testing/projections/ProjectionScalarConverter.d.ts +21 -0
  316. package/dist/testing/projections/ProjectionScalarConverter.d.ts.map +1 -0
  317. package/dist/testing/projections/ProjectionScalarConverter.js +105 -0
  318. package/dist/testing/projections/ProjectionScalarConverter.js.map +1 -0
  319. package/dist/testing/projections/ProjectionSchemaCapabilities.d.ts +26 -0
  320. package/dist/testing/projections/ProjectionSchemaCapabilities.d.ts.map +1 -0
  321. package/dist/testing/projections/ProjectionSchemaCapabilities.js +109 -0
  322. package/dist/testing/projections/ProjectionSchemaCapabilities.js.map +1 -0
  323. package/dist/testing/projections/ProjectionValueConverter.d.ts +5 -0
  324. package/dist/testing/projections/ProjectionValueConverter.d.ts.map +1 -1
  325. package/dist/testing/projections/ProjectionValueConverter.js +36 -84
  326. package/dist/testing/projections/ProjectionValueConverter.js.map +1 -1
  327. package/dist/tsconfig.tsbuildinfo +1 -1
  328. package/dist/types/DecoratorType.d.ts +3 -1
  329. package/dist/types/DecoratorType.d.ts.map +1 -1
  330. package/dist/types/DecoratorType.js +2 -0
  331. package/dist/types/DecoratorType.js.map +1 -1
  332. package/for_ChronicleOptions/when_configuring_keep_alive/with_skip_keep_alive.spec.ts +1 -1
  333. package/package.json +2 -2
  334. package/projections/for_Graphs/given/a_discovered_graph.ts +3 -2
  335. package/projections/for_Graphs/given/a_graph_with_views.ts +91 -0
  336. package/projections/for_Graphs/given/organization.ts +3 -2
  337. package/projections/for_Graphs/given/organization_with_views.fixture.ts +129 -0
  338. package/projections/for_Graphs/when_building_graph_views.spec.ts +218 -0
  339. package/projections/for_Graphs/when_declaring_an_invalid_graph_view.spec.ts +229 -0
  340. package/projections/for_Graphs/when_declaring_graph_views.standard.spec.ts +49 -0
  341. package/projections/for_Graphs/when_discovering_graph_views.spec.ts +58 -0
  342. package/projections/graphs/Graphs.ts +44 -0
  343. package/projections/graphs/IGraphs.ts +10 -2
  344. package/projections/graphs/index.ts +1 -0
  345. package/projections/graphs/views/AmbiguousDirection.ts +23 -0
  346. package/projections/graphs/views/DuplicateViewName.ts +23 -0
  347. package/projections/graphs/views/EdgeNotIncidentOnRoot.ts +24 -0
  348. package/projections/graphs/views/EdgePropertyViewNotUsedAsTarget.ts +21 -0
  349. package/projections/graphs/views/EdgePropertyViewSharedAcrossEdges.ts +22 -0
  350. package/projections/graphs/views/FollowsOptions.ts +20 -0
  351. package/projections/graphs/views/GraphEdgeDirection.ts +13 -0
  352. package/projections/graphs/views/GraphView.ts +18 -0
  353. package/projections/graphs/views/GraphViewBuildResult.ts +19 -0
  354. package/projections/graphs/views/GraphViewCardinality.ts +13 -0
  355. package/projections/graphs/views/GraphViewDefinition.ts +20 -0
  356. package/projections/graphs/views/GraphViewDefinitionBuilder.ts +322 -0
  357. package/projections/graphs/views/GraphViewDefinitionSerializer.ts +90 -0
  358. package/projections/graphs/views/GraphViewEdgeReference.ts +8 -0
  359. package/projections/graphs/views/GraphViewMember.ts +11 -0
  360. package/projections/graphs/views/GraphViewMemberKind.ts +16 -0
  361. package/projections/graphs/views/GraphViewMemberMetadata.ts +31 -0
  362. package/projections/graphs/views/GraphViewPropertyMember.ts +18 -0
  363. package/projections/graphs/views/GraphViewReason.ts +47 -0
  364. package/projections/graphs/views/GraphViewRelationMember.ts +29 -0
  365. package/projections/graphs/views/GraphViewSchema.ts +14 -0
  366. package/projections/graphs/views/GraphViewSchemaEdge.ts +20 -0
  367. package/projections/graphs/views/GraphViewSchemaNode.ts +14 -0
  368. package/projections/graphs/views/GraphViewSerializerOptions.ts +11 -0
  369. package/projections/graphs/views/RecursiveView.ts +22 -0
  370. package/projections/graphs/views/RelationTargetNotAView.ts +23 -0
  371. package/projections/graphs/views/TargetLabelMismatch.ts +25 -0
  372. package/projections/graphs/views/UnknownEdge.ts +23 -0
  373. package/projections/graphs/views/UnknownEdgeProperty.ts +24 -0
  374. package/projections/graphs/views/UnknownNodeProperty.ts +24 -0
  375. package/projections/graphs/views/ViewIsAlsoSchema.ts +21 -0
  376. package/projections/graphs/views/ViewOfMetadata.ts +11 -0
  377. package/projections/graphs/views/ViewOfOptions.ts +8 -0
  378. package/projections/graphs/views/ViewRootNotANode.ts +23 -0
  379. package/projections/graphs/views/declareGraphViewMember.ts +36 -0
  380. package/projections/graphs/views/follows.ts +28 -0
  381. package/projections/graphs/views/fromEdge.ts +17 -0
  382. package/projections/graphs/views/index.ts +43 -0
  383. package/projections/graphs/views/viewKey.ts +15 -0
  384. package/projections/graphs/views/viewOf.ts +50 -0
  385. package/projections/graphs/views/viewProperty.ts +16 -0
  386. package/testing/InProcessAppendMetadata.ts +119 -0
  387. package/testing/InProcessBatchAppend.ts +142 -0
  388. package/testing/InProcessEventPayload.ts +100 -0
  389. package/testing/InProcessEventReadCriteria.ts +11 -0
  390. package/testing/InProcessEventReadFilter.ts +37 -0
  391. package/testing/InProcessEventSequence.ts +63 -257
  392. package/testing/InProcessEventSequenceEnvironment.ts +16 -0
  393. package/testing/InProcessSingleAppend.ts +99 -0
  394. package/testing/for_InProcessEventSequence/when_preserving_validation_and_commit_order.spec.ts +95 -0
  395. package/testing/projections/ProjectionCapabilities.ts +23 -279
  396. package/testing/projections/ProjectionCapabilityReject.ts +5 -0
  397. package/testing/projections/ProjectionCapabilityReporter.ts +31 -0
  398. package/testing/projections/ProjectionDefinitionCapabilities.ts +45 -0
  399. package/testing/projections/ProjectionEventSchemaResolver.ts +23 -0
  400. package/testing/projections/ProjectionExpressionCapabilities.ts +101 -0
  401. package/testing/projections/ProjectionInitialValueCapabilities.ts +73 -0
  402. package/testing/projections/ProjectionMappingCapabilities.ts +85 -0
  403. package/testing/projections/ProjectionMappingValidation.ts +12 -0
  404. package/testing/projections/ProjectionReadModelCapabilities.ts +42 -0
  405. package/testing/projections/ProjectionRootCapabilities.ts +75 -0
  406. package/testing/projections/ProjectionScalarConverter.ts +106 -0
  407. package/testing/projections/ProjectionSchemaCapabilities.ts +112 -0
  408. package/testing/projections/ProjectionValueConverter.ts +37 -76
  409. package/testing/projections/for_ProjectionCapabilities/when_reporting_the_first_unsupported_operation.spec.ts +74 -0
  410. package/testing/projections/for_ProjectionValueConverter/when_converting_structured_and_scalar_values.spec.ts +64 -0
  411. package/types/DecoratorType.ts +4 -1
@@ -0,0 +1,160 @@
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 { execFileSync } from 'node:child_process';
5
+ import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
6
+ import { createServer, type Server } from 'node:https';
7
+ import type { AddressInfo } from 'node:net';
8
+ import { tmpdir } from 'node:os';
9
+ import { join } from 'node:path';
10
+ import { afterAll, beforeAll, describe, expect, it } from 'vitest';
11
+ import { ChronicleConnectionString } from './ChronicleConnectionString.js';
12
+ import { loadTlsMaterial } from './ChronicleTlsMaterial.js';
13
+ import { fetchOAuthAccessToken } from './fetchOAuthAccessToken.js';
14
+
15
+ const directory = mkdtempSync(join(tmpdir(), 'chronicle-tls-'));
16
+
17
+ function hasOpenSsl(): boolean {
18
+ try {
19
+ execFileSync('openssl', ['version'], { stdio: 'ignore' });
20
+ return true;
21
+ } catch {
22
+ return false;
23
+ }
24
+ }
25
+
26
+ const openSslAvailable = hasOpenSsl();
27
+
28
+ interface Identity {
29
+ certificate: string;
30
+ key: string;
31
+ }
32
+
33
+ function openssl(...args: string[]): void {
34
+ execFileSync('openssl', args, { cwd: directory, stdio: 'ignore' });
35
+ }
36
+
37
+ /** Generates a self-signed certificate valid for localhost, with its PKCS#8 private key. */
38
+ function generateIdentity(name: string): Identity {
39
+ openssl('req', '-x509', '-newkey', 'rsa:2048', '-nodes', '-keyout', `${name}.key`, '-out', `${name}.pem`,
40
+ '-subj', `/CN=${name}`, '-addext', 'subjectAltName=DNS:localhost,IP:127.0.0.1', '-days', '2');
41
+ return { certificate: join(directory, `${name}.pem`), key: join(directory, `${name}.key`) };
42
+ }
43
+
44
+ function connectionStringFor(options: string): ChronicleConnectionString {
45
+ return new ChronicleConnectionString(`chronicle://localhost:35000?${options}`);
46
+ }
47
+
48
+ describe.skipIf(!openSslAvailable)('ChronicleTlsMaterial', () => {
49
+ let server: { identity: Identity; client: Identity; stranger: Identity };
50
+
51
+ beforeAll(() => {
52
+ server = {
53
+ identity: generateIdentity('server'),
54
+ client: generateIdentity('client'),
55
+ stranger: generateIdentity('stranger')
56
+ };
57
+ });
58
+
59
+ afterAll(() => rmSync(directory, { recursive: true, force: true }));
60
+
61
+ describe('when the connection string names no TLS material', () => {
62
+ it('should be empty', () => expect(loadTlsMaterial(connectionStringFor('skipTlsValidation=false')).isEmpty).toBe(true));
63
+ });
64
+
65
+ describe('when the CA certificate file is missing', () => {
66
+ it('should fail even while validation is skipped', () =>
67
+ expect(() => loadTlsMaterial(connectionStringFor('caCertificatePath=%2Fno%2Fsuch.pem'))).toThrow(/Cannot read the CA certificate file/));
68
+ });
69
+
70
+ describe('when the CA certificate file holds no certificates', () => {
71
+ it('should fail', () => {
72
+ const path = join(directory, 'empty.pem');
73
+ writeFileSync(path, 'not a certificate');
74
+ expect(() => loadTlsMaterial(connectionStringFor(`caCertificatePath=${encodeURIComponent(path)}`))).toThrow(/does not contain any PEM certificates/);
75
+ });
76
+ });
77
+
78
+ describe('when a client certificate is a PKCS#12 file with the wrong password', () => {
79
+ it('should fail', () => {
80
+ openssl('pkcs12', '-export', '-in', 'client.pem', '-inkey', 'client.key', '-out', 'client.p12', '-passout', 'pass:changeit');
81
+ const path = encodeURIComponent(join(directory, 'client.p12'));
82
+ expect(() => loadTlsMaterial(connectionStringFor(`certificatePath=${path}&certificatePassword=wrong`))).toThrow(/could not be loaded/);
83
+ expect(loadTlsMaterial(connectionStringFor(`certificatePath=${path}&certificatePassword=changeit`)).isEmpty).toBe(false);
84
+ });
85
+ });
86
+
87
+ describe('when a client certificate is a PEM bundle with the key listed first', () => {
88
+ it('should load', () => {
89
+ const path = join(directory, 'bundle.pem');
90
+ writeFileSync(path, readFileSync(server.client.key, 'latin1') + readFileSync(server.client.certificate, 'latin1'));
91
+ expect(loadTlsMaterial(connectionStringFor(`certificatePath=${encodeURIComponent(path)}`)).isEmpty).toBe(false);
92
+ });
93
+ });
94
+
95
+ describe('when a client certificate PEM has no private key', () => {
96
+ it('should fail', () => {
97
+ expect(() => loadTlsMaterial(connectionStringFor(`certificatePath=${encodeURIComponent(server.client.certificate)}`))).toThrow(/both a certificate and a private key/);
98
+ });
99
+ });
100
+
101
+ describe('when fetching a token from a TLS server', () => {
102
+ const listen = async (requireClientCertificate: boolean): Promise<{ instance: Server; endpoint: string }> => {
103
+ const instance = createServer({
104
+ key: readFileSync(server.identity.key),
105
+ cert: readFileSync(server.identity.certificate),
106
+ ca: readFileSync(server.client.certificate),
107
+ requestCert: requireClientCertificate,
108
+ rejectUnauthorized: requireClientCertificate
109
+ }, (_request, response) => {
110
+ response.setHeader('content-type', 'application/json');
111
+ response.end(JSON.stringify({ access_token: 'token', expires_in: 3600 }));
112
+ });
113
+ await new Promise<void>(resolve => instance.listen(0, '127.0.0.1', resolve));
114
+ return { instance, endpoint: `https://localhost:${(instance.address() as AddressInfo).port}/connect/token` };
115
+ };
116
+
117
+ it('should validate the server against the configured certificate authority', async () => {
118
+ const { instance, endpoint } = await listen(false);
119
+ try {
120
+ const trusted = loadTlsMaterial(connectionStringFor(`caCertificatePath=${encodeURIComponent(server.identity.certificate)}`));
121
+ await expect(fetchOAuthAccessToken(endpoint, 'id', 'secret', false, trusted)).resolves.toMatchObject({ access_token: 'token' });
122
+ } finally {
123
+ instance.close();
124
+ }
125
+ });
126
+
127
+ it('should reject a server the configured certificate authority does not vouch for', async () => {
128
+ const { instance, endpoint } = await listen(false);
129
+ try {
130
+ const stranger = loadTlsMaterial(connectionStringFor(`caCertificatePath=${encodeURIComponent(server.stranger.certificate)}`));
131
+ await expect(fetchOAuthAccessToken(endpoint, 'id', 'secret', false, stranger)).rejects.toThrow();
132
+ } finally {
133
+ instance.close();
134
+ }
135
+ });
136
+
137
+ it('should ignore the certificate authority while validation is skipped', async () => {
138
+ const { instance, endpoint } = await listen(false);
139
+ try {
140
+ const stranger = loadTlsMaterial(connectionStringFor(`caCertificatePath=${encodeURIComponent(server.stranger.certificate)}`));
141
+ await expect(fetchOAuthAccessToken(endpoint, 'id', 'secret', true, stranger)).resolves.toMatchObject({ access_token: 'token' });
142
+ } finally {
143
+ instance.close();
144
+ }
145
+ });
146
+
147
+ it('should present the client certificate to a server that requires one', async () => {
148
+ const { instance, endpoint } = await listen(true);
149
+ try {
150
+ const bundle = join(directory, 'mutual.pem');
151
+ writeFileSync(bundle, readFileSync(server.client.certificate, 'latin1') + readFileSync(server.client.key, 'latin1'));
152
+ const material = loadTlsMaterial(connectionStringFor(`certificatePath=${encodeURIComponent(bundle)}`));
153
+ await expect(fetchOAuthAccessToken(endpoint, 'id', 'secret', true, material)).resolves.toMatchObject({ access_token: 'token' });
154
+ await expect(fetchOAuthAccessToken(endpoint, 'id', 'secret', true)).rejects.toThrow();
155
+ } finally {
156
+ instance.close();
157
+ }
158
+ });
159
+ });
160
+ });
@@ -0,0 +1,121 @@
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 { readFileSync } from 'node:fs';
5
+ import { createSecureContext } from 'node:tls';
6
+
7
+ /** The connection string options that name TLS material. */
8
+ export interface ChronicleTlsMaterialSource {
9
+ readonly caCertificatePath?: string;
10
+ readonly certificatePath?: string;
11
+ readonly certificatePassword?: string;
12
+ }
13
+
14
+ /** The Node TLS options a Chronicle connection hands to its HTTPS clients and gRPC channel. */
15
+ export interface ChronicleTlsConnectOptions {
16
+ ca?: Buffer;
17
+ pfx?: Buffer;
18
+ cert?: Buffer;
19
+ key?: Buffer;
20
+ passphrase?: string;
21
+ rejectUnauthorized: boolean;
22
+ }
23
+
24
+ interface ClientIdentity {
25
+ readonly pfx?: Buffer;
26
+ readonly cert?: Buffer;
27
+ readonly key?: Buffer;
28
+ readonly passphrase?: string;
29
+ }
30
+
31
+ const certificateBlock = /-----BEGIN CERTIFICATE-----/;
32
+ const privateKeyBlock = /-----BEGIN (?:ENCRYPTED |RSA |EC )?PRIVATE KEY-----/;
33
+
34
+ function readFile(path: string, description: string): Buffer {
35
+ try {
36
+ return readFileSync(path);
37
+ } catch (error) {
38
+ throw new Error(`Cannot read the ${description} '${path}': ${error instanceof Error ? error.message : String(error)}`, { cause: error });
39
+ }
40
+ }
41
+
42
+ /**
43
+ * The TLS material a connection string names: the client identity from `certificatePath` and the certificate
44
+ * authorities from `caCertificatePath`.
45
+ *
46
+ * It is loaded once when the connection is created, so a missing or unreadable file fails the connection setup
47
+ * instead of every reconnect - and also when validation is skipped or TLS is disabled, so the option cannot lie
48
+ * dormant until validation is switched on.
49
+ */
50
+ export class ChronicleTlsMaterial {
51
+ /** No TLS material beyond the platform defaults. */
52
+ static readonly None = new ChronicleTlsMaterial();
53
+
54
+ constructor(
55
+ private readonly _certificateAuthorities?: Buffer,
56
+ private readonly _identity?: ClientIdentity
57
+ ) {}
58
+
59
+ /** Whether this configures anything beyond the platform defaults. */
60
+ get isEmpty(): boolean {
61
+ return this._certificateAuthorities === undefined && this._identity === undefined;
62
+ }
63
+
64
+ /**
65
+ * The options for a Node TLS client. The certificate authorities replace the system trust store, and
66
+ * only when certificate validation is on.
67
+ */
68
+ connectOptions(skipTlsValidation: boolean): ChronicleTlsConnectOptions {
69
+ return {
70
+ ...(!skipTlsValidation && this._certificateAuthorities ? { ca: this._certificateAuthorities } : {}),
71
+ ...this._identity,
72
+ rejectUnauthorized: !skipTlsValidation
73
+ };
74
+ }
75
+ }
76
+
77
+ /**
78
+ * Loads the TLS material `source` names.
79
+ *
80
+ * `caCertificatePath` is a PEM file with one or more certificate authorities. `certificatePath` is a PKCS#12
81
+ * file (`.p12`/`.pfx`), or a PEM file holding the certificate chain and the private key; `certificatePassword`
82
+ * unlocks either.
83
+ * @throws When a file is missing, unreadable or holds no usable material.
84
+ */
85
+ export function loadTlsMaterial(source: ChronicleTlsMaterialSource): ChronicleTlsMaterial {
86
+ const authorities = source.caCertificatePath ? loadCertificateAuthorities(source.caCertificatePath) : undefined;
87
+ const identity = source.certificatePath ? loadClientIdentity(source.certificatePath, source.certificatePassword) : undefined;
88
+ return authorities === undefined && identity === undefined ? ChronicleTlsMaterial.None : new ChronicleTlsMaterial(authorities, identity);
89
+ }
90
+
91
+ function loadCertificateAuthorities(path: string): Buffer {
92
+ const contents = readFile(path, 'CA certificate file');
93
+ if (!certificateBlock.test(contents.toString('latin1'))) {
94
+ throw new Error(`The CA certificate file '${path}' does not contain any PEM certificates.`);
95
+ }
96
+
97
+ return contents;
98
+ }
99
+
100
+ function loadClientIdentity(path: string, password: string | undefined): ClientIdentity {
101
+ const contents = readFile(path, 'client certificate');
102
+ const text = contents.toString('latin1');
103
+ const isPem = text.includes('-----BEGIN');
104
+ if (isPem && (!certificateBlock.test(text) || !privateKeyBlock.test(text))) {
105
+ throw new Error(`The client certificate '${path}' must hold both a certificate and a private key.`);
106
+ }
107
+
108
+ const identity: ClientIdentity = isPem
109
+ ? { cert: contents, key: contents, passphrase: password }
110
+ : { pfx: contents, passphrase: password };
111
+
112
+ // Building the context validates the password and that the key belongs to the certificate, now rather
113
+ // than on the first connection attempt.
114
+ try {
115
+ createSecureContext(identity);
116
+ } catch (error) {
117
+ throw new Error(`The client certificate '${path}' could not be loaded: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
118
+ }
119
+
120
+ return identity;
121
+ }
@@ -15,10 +15,18 @@ const protocolVersion = (require('@cratis/chronicle.contracts/package.json') as
15
15
  export class CompatibilityPreflight {
16
16
  private _verification?: Promise<void>;
17
17
 
18
- constructor(private readonly _connections: ConnectionServiceClient, private readonly _timeout: number) {}
18
+ constructor(
19
+ private readonly _connections: ConnectionServiceClient,
20
+ private readonly _timeout: number,
21
+ private readonly _skip: boolean = false
22
+ ) {}
19
23
 
20
24
  /** Shares in-flight checks and caches verdicts for this channel; transient failures can be retried. */
21
25
  verify(): Promise<void> {
26
+ if (this._skip) {
27
+ return Promise.resolve();
28
+ }
29
+
22
30
  if (!this._verification) {
23
31
  const verification = runInBackgroundContext(() => this.check()).catch(error => {
24
32
  if (!(error instanceof IncompatibleChronicleServer) && this._verification === verification) {
@@ -3,6 +3,7 @@
3
3
 
4
4
  import { Agent } from 'undici';
5
5
  import type { ChronicleServerAddress } from './ChronicleConnectionString.js';
6
+ import { ChronicleTlsMaterial } from './ChronicleTlsMaterial.js';
6
7
  import { formatServerAddress } from './formatServerAddress.js';
7
8
  import type { ILoadBalancerStrategy } from './ILoadBalancerStrategy.js';
8
9
 
@@ -37,9 +38,10 @@ export class LeastConnectionsLoadBalancerStrategy implements ILoadBalancerStrate
37
38
  */
38
39
  constructor(
39
40
  private readonly _skipTlsValidation: boolean,
40
- private readonly _maxJitterMs: number = DEFAULT_MAX_JITTER_MS
41
+ private readonly _maxJitterMs: number = DEFAULT_MAX_JITTER_MS,
42
+ tlsMaterial: ChronicleTlsMaterial = ChronicleTlsMaterial.None
41
43
  ) {
42
- this._dispatcher = new Agent({ connect: { rejectUnauthorized: !this._skipTlsValidation } });
44
+ this._dispatcher = new Agent({ connect: tlsMaterial.connectOptions(this._skipTlsValidation) });
43
45
  }
44
46
 
45
47
  async select(candidates: ChronicleServerAddress[]): Promise<ChronicleServerAddress> {
@@ -1,6 +1,7 @@
1
1
  // Copyright (c) Cratis. All rights reserved.
2
2
  // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
3
 
4
+ import { ChronicleTlsMaterial } from './ChronicleTlsMaterial.js';
4
5
  import type { ILoadBalancerStrategy } from './ILoadBalancerStrategy.js';
5
6
  import { LeastConnectionsLoadBalancerStrategy } from './LeastConnectionsLoadBalancerStrategy.js';
6
7
  import { LoadBalancerMode } from './LoadBalancerMode.js';
@@ -14,14 +15,18 @@ import { RoundRobinLoadBalancerStrategy } from './RoundRobinLoadBalancerStrategy
14
15
  * (an explicit `skipTlsValidation=false` always requires it) for strategies that probe candidates over HTTP (currently only {@link LoadBalancerMode.LeastConnections}).
15
16
  * @returns The load balancer strategy instance.
16
17
  */
17
- export function createLoadBalancerStrategy(mode: LoadBalancerMode, skipTlsValidation: boolean): ILoadBalancerStrategy {
18
+ export function createLoadBalancerStrategy(
19
+ mode: LoadBalancerMode,
20
+ skipTlsValidation: boolean,
21
+ tlsMaterial: ChronicleTlsMaterial = ChronicleTlsMaterial.None
22
+ ): ILoadBalancerStrategy {
18
23
  switch (mode) {
19
24
  case LoadBalancerMode.RoundRobin:
20
25
  return new RoundRobinLoadBalancerStrategy();
21
26
  case LoadBalancerMode.Random:
22
27
  return new RandomLoadBalancerStrategy();
23
28
  case LoadBalancerMode.LeastConnections:
24
- return new LeastConnectionsLoadBalancerStrategy(skipTlsValidation);
29
+ return new LeastConnectionsLoadBalancerStrategy(skipTlsValidation, undefined, tlsMaterial);
25
30
  default:
26
31
  throw new Error(`Unknown load balancer mode: ${mode}`);
27
32
  }
@@ -1,6 +1,7 @@
1
1
  // Copyright (c) Cratis. All rights reserved.
2
2
  // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
3
 
4
+ import { ChronicleTlsMaterial } from './ChronicleTlsMaterial.js';
4
5
  import { fetchOAuthAccessToken, OAuthTokenHttpError, type OAuthTokenResponse } from './fetchOAuthAccessToken.js';
5
6
  import { runInBackgroundContext } from '../telemetry/runInBackgroundContext.js';
6
7
 
@@ -76,6 +77,7 @@ export class OAuthTokenProvider implements ITokenProvider {
76
77
  * @param skipTlsValidation - The effective setting: `true` skips TLS certificate chain validation, `false` requires it.
77
78
  * Defaults to `true`, matching the connection string default in this release.
78
79
  * @param _fetchToken - Test-only seam replacing the OAuth2 token request.
80
+ * @param _tlsMaterial - The client certificate and certificate authorities the token request uses.
79
81
  */
80
82
  constructor(
81
83
  private readonly _tokenEndpoint: string,
@@ -83,7 +85,8 @@ export class OAuthTokenProvider implements ITokenProvider {
83
85
  clientSecret: string,
84
86
  skipTlsValidation: boolean = true,
85
87
  private readonly _fetchToken: () => Promise<OAuthTokenResponse> = () =>
86
- fetchOAuthAccessToken(this._tokenEndpoint, clientId, clientSecret, skipTlsValidation)
88
+ fetchOAuthAccessToken(this._tokenEndpoint, clientId, clientSecret, skipTlsValidation, this._tlsMaterial),
89
+ private readonly _tlsMaterial: ChronicleTlsMaterial = ChronicleTlsMaterial.None
87
90
  ) {}
88
91
 
89
92
  async getAccessToken(): Promise<string | undefined> {
@@ -3,6 +3,7 @@
3
3
 
4
4
  import * as http from 'http';
5
5
  import * as https from 'https';
6
+ import { ChronicleTlsMaterial } from './ChronicleTlsMaterial.js';
6
7
 
7
8
  /**
8
9
  * The shape of a successful OAuth2 token response.
@@ -41,7 +42,8 @@ export function fetchOAuthAccessToken(
41
42
  tokenEndpoint: string,
42
43
  clientId: string,
43
44
  clientSecret: string,
44
- skipTlsValidation: boolean
45
+ skipTlsValidation: boolean,
46
+ tlsMaterial: ChronicleTlsMaterial = ChronicleTlsMaterial.None
45
47
  ): Promise<OAuthTokenResponse> {
46
48
  const params = new URLSearchParams();
47
49
  params.append('grant_type', 'client_credentials');
@@ -63,7 +65,7 @@ export function fetchOAuthAccessToken(
63
65
  },
64
66
  // Chain validation is skipped only when the effective skipTlsValidation is true
65
67
  // (an explicit false always requires it), matching the gRPC channel's credentials for the same connection string.
66
- ...(isHttps && skipTlsValidation ? { rejectUnauthorized: false } : {})
68
+ ...(isHttps && (skipTlsValidation || !tlsMaterial.isEmpty) ? tlsMaterial.connectOptions(skipTlsValidation) : {})
67
69
  }, response => {
68
70
  let data = '';
69
71
 
@@ -0,0 +1,23 @@
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 { beforeEach, chai, describe, it, vi } from 'vitest';
5
+ import type { ConnectionServiceClient } from '@cratis/chronicle.contracts';
6
+ import { CompatibilityPreflight } from '../../CompatibilityPreflight.js';
7
+
8
+ chai.should();
9
+
10
+ describe('when verifying with the check skipped', () => {
11
+ let check: ReturnType<typeof vi.fn>;
12
+ let preflight: CompatibilityPreflight;
13
+
14
+ beforeEach(() => {
15
+ check = vi.fn();
16
+ preflight = new CompatibilityPreflight({ checkCompatibility: check } as unknown as ConnectionServiceClient, 1000, true);
17
+ });
18
+
19
+ it('should resolve without asking the kernel', async () => {
20
+ await preflight.verify();
21
+ check.mock.calls.should.have.lengthOf(0);
22
+ });
23
+ });
@@ -38,5 +38,7 @@ export declare class DefaultClientArtifactsProvider implements IClientArtifactsP
38
38
  get graphElements(): Constructor[];
39
39
  /** @inheritdoc */
40
40
  get graphProjections(): Constructor[];
41
+ /** @inheritdoc */
42
+ get graphViews(): Constructor[];
41
43
  }
42
44
  //# sourceMappingURL=DefaultClientArtifactsProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultClientArtifactsProvider.d.ts","sourceRoot":"","sources":["../../artifacts/DefaultClientArtifactsProvider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAK5D;;GAEG;AACH,qBAAa,8BAA+B,YAAW,wBAAwB;IAQ/D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAPvC,0EAA0E;IAC1E,MAAM,CAAC,QAAQ,CAAC,OAAO,iCAA8D;IAErF;;;OAGG;IACH,YAA6B,UAAU,EAAE,cAAc,EAAI;IAE3D,kBAAkB;IAClB,IAAI,UAAU,IAAI,WAAW,EAAE,CAE9B;IAED,kBAAkB;IAClB,IAAI,UAAU,IAAI,WAAW,EAAE,CAe9B;IAED,kBAAkB;IAClB,IAAI,QAAQ,IAAI,WAAW,EAAE,CAE5B;IAED,kBAAkB;IAClB,IAAI,QAAQ,IAAI,WAAW,EAAE,CAE5B;IAED,kBAAkB;IAClB,IAAI,OAAO,IAAI,WAAW,EAAE,CAE3B;IAED,kBAAkB;IAClB,IAAI,WAAW,IAAI,WAAW,EAAE,CAE/B;IAED,kBAAkB;IAClB,IAAI,WAAW,IAAI,WAAW,EAAE,CAE/B;IAED,kBAAkB;IAClB,IAAI,QAAQ,IAAI,WAAW,EAAE,CAE5B;IAED,IAAI,mBAAmB,IAAI,WAAW,EAAE,CAEvC;IAED,kBAAkB;IAClB,IAAI,iBAAiB,IAAI,WAAW,EAAE,CAErC;IAED,kBAAkB;IAClB,IAAI,YAAY,IAAI,WAAW,EAAE,CAEhC;IAED,kBAAkB;IAClB,IAAI,aAAa,IAAI,WAAW,EAAE,CAEjC;IAED,kBAAkB;IAClB,IAAI,gBAAgB,IAAI,WAAW,EAAE,CAEpC;CACJ"}
1
+ {"version":3,"file":"DefaultClientArtifactsProvider.d.ts","sourceRoot":"","sources":["../../artifacts/DefaultClientArtifactsProvider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAK5D;;GAEG;AACH,qBAAa,8BAA+B,YAAW,wBAAwB;IAQ/D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAPvC,0EAA0E;IAC1E,MAAM,CAAC,QAAQ,CAAC,OAAO,iCAA8D;IAErF;;;OAGG;IACH,YAA6B,UAAU,EAAE,cAAc,EAAI;IAE3D,kBAAkB;IAClB,IAAI,UAAU,IAAI,WAAW,EAAE,CAE9B;IAED,kBAAkB;IAClB,IAAI,UAAU,IAAI,WAAW,EAAE,CAe9B;IAED,kBAAkB;IAClB,IAAI,QAAQ,IAAI,WAAW,EAAE,CAE5B;IAED,kBAAkB;IAClB,IAAI,QAAQ,IAAI,WAAW,EAAE,CAE5B;IAED,kBAAkB;IAClB,IAAI,OAAO,IAAI,WAAW,EAAE,CAE3B;IAED,kBAAkB;IAClB,IAAI,WAAW,IAAI,WAAW,EAAE,CAE/B;IAED,kBAAkB;IAClB,IAAI,WAAW,IAAI,WAAW,EAAE,CAE/B;IAED,kBAAkB;IAClB,IAAI,QAAQ,IAAI,WAAW,EAAE,CAE5B;IAED,IAAI,mBAAmB,IAAI,WAAW,EAAE,CAEvC;IAED,kBAAkB;IAClB,IAAI,iBAAiB,IAAI,WAAW,EAAE,CAErC;IAED,kBAAkB;IAClB,IAAI,YAAY,IAAI,WAAW,EAAE,CAEhC;IAED,kBAAkB;IAClB,IAAI,aAAa,IAAI,WAAW,EAAE,CAEjC;IAED,kBAAkB;IAClB,IAAI,gBAAgB,IAAI,WAAW,EAAE,CAEpC;IAED,kBAAkB;IAClB,IAAI,UAAU,IAAI,WAAW,EAAE,CAE9B;CACJ"}
@@ -85,5 +85,9 @@ export class DefaultClientArtifactsProvider {
85
85
  get graphProjections() {
86
86
  return this.discoverer.getTypesByDecoratorType(DecoratorType.GraphProjection);
87
87
  }
88
+ /** @inheritdoc */
89
+ get graphViews() {
90
+ return this.discoverer.getTypesByDecoratorType(DecoratorType.GraphView);
91
+ }
88
92
  }
89
93
  //# sourceMappingURL=DefaultClientArtifactsProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultClientArtifactsProvider.js","sourceRoot":"","sources":["../../artifacts/DefaultClientArtifactsProvider.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAIrG,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAEzE;;GAEG;AACH,MAAM,OAAO,8BAA8B;IAQV,UAAU;IAPvC,0EAA0E;IAC1E,MAAM,CAAU,OAAO,GAAG,IAAI,8BAA8B,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAErF;;;OAGG;IACH,YAA6B,UAA0B;0BA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,OAAO,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACzE,CAAC;IAED,kBAAkB;IAClB,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC7E,CAAC;IAED,kBAAkB;IAClB,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC7E,CAAC;IAED,kBAAkB;IAClB,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED,IAAI,mBAAmB;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACrF,CAAC;IAED,kBAAkB;IAClB,IAAI,iBAAiB;QACjB,OAAO,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IAClB,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IAC9E,CAAC;IAED,kBAAkB;IAClB,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IAC/E,CAAC;IAED,kBAAkB;IAClB,IAAI,gBAAgB;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IAClF,CAAC;CACJ"}
1
+ {"version":3,"file":"DefaultClientArtifactsProvider.js","sourceRoot":"","sources":["../../artifacts/DefaultClientArtifactsProvider.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAIrG,OAAO,EAA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AW,CAAC,CAAC;IAC9E,CAAC;IAED,kBAAkB;IAClB,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IAC/E,CAAC;IAED,kBAAkB;IAClB,IAAI,gBAAgB;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IAClF,CAAC;IAED,kBAAkB;IAClB,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAC5E,CAAC;CACJ"}
@@ -29,5 +29,7 @@ export interface IClientArtifactsProvider {
29
29
  readonly graphElements?: Constructor[];
30
30
  /** Gets discovered fluent graph projection constructors. Optional so existing providers keep working. */
31
31
  readonly graphProjections?: Constructor[];
32
+ /** Gets discovered graph view constructors. Optional so existing providers keep working. */
33
+ readonly graphViews?: Constructor[];
32
34
  }
33
35
  //# sourceMappingURL=IClientArtifactsProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IClientArtifactsProvider.d.ts","sourceRoot":"","sources":["../../artifacts/IClientArtifactsProvider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,+CAA+C;IAC/C,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,CAAC;IAEnC,+CAA+C;IAC/C,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,CAAC;IAEnC,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,WAAW,EAAE,CAAC;IAEjC,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,WAAW,EAAE,CAAC;IAEjC,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,CAAC;IAEhC,+CAA+C;IAC/C,QAAQ,CAAC,WAAW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C;IAEjC,yDAAyD;IACzD,QAAQ,CAAC,mBAAmB,EAAE,WAAW,EAAE,CAAC;IAE5C,sEAAsE;IACtE,QAAQ,CAAC,iBAAiB,EAAE,WAAW,EAAE,CAAC;IAE1C,yGAAyG;IACzG,QAAQ,CAAC,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAEtC,qGAAqG;IACrG,QAAQ,CAAC,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC;IAEvC,yGAAyG;IACzG,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,EAAE,CAAC;IAE1C,4FAA4F;IAC5F,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,EAAE,CAAC;CACvC"}
@@ -61,6 +61,7 @@ export declare class ChronicleConnection implements ChronicleServices {
61
61
  private readonly _tokenProviders;
62
62
  private readonly _addressResolver;
63
63
  private readonly _loadBalancerStrategy;
64
+ private readonly _tlsMaterial;
64
65
  private _isConnected;
65
66
  private _warnedAboutSkippedTlsValidation;
66
67
  private _clientsReady?;
@@ -1 +1 @@
1
- {"version":3,"file":"ChronicleConnection.d.ts","sourceRoot":"","sources":["../../connection/ChronicleConnection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwB,KAAK,kBAAkB,EAAuB,MAAM,eAAe,CAAC;AAEnG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAGvE,OAAO,EAyBH,KAAK,uBAAuB,EAC/B,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAE,yBAAyB,EAA+B,MAAM,gCAAgC,CAAC;AAExG,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,0BAA0B,CAAC;AAOlC;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACvC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B,gFAAgF;IAChF,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAE1B;;OAEG;IACH,gBAAgB,CAAC,EAA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31
  _loadBalancerStrategy;
32
+ _tlsMaterial;
32
33
  _isConnected = false;
33
34
  _warnedAboutSkippedTlsValidation = false;
34
35
  _clientsReady;
@@ -45,11 +46,14 @@ export class ChronicleConnection {
45
46
  else {
46
47
  this._connectionString = ChronicleConnectionString.Default;
47
48
  }
48
- if (!this._connectionString.apiKey && (!!this._connectionString.username !== !!this._connectionString.password)) {
49
+ if (!this._connectionString.noAuthentication && !this._connectionString.apiKey && (!!this._connectionString.username !== !!this._connectionString.password)) {
49
50
  throw new Error('Connection string must contain both username and password, or neither');
50
51
  }
51
52
  this._addressResolver = new ChronicleServerAddressResolver();
52
- this._loadBalancerStrategy = createLoadBalancerStrategy(this._connectionString.loadBalancer, this._connectionString.skipTlsValidation);
53
+ // Loaded once, up front: a missing or unreadable certificate file fails the connection setup here rather
54
+ // than on every reconnect - or not at all until validation is switched on.
55
+ this._tlsMaterial = this._connectionString.loadTlsMaterial();
56
+ this._loadBalancerStrategy = createLoadBalancerStrategy(this._connectionString.loadBalancer, this._connectionString.skipTlsValidation, this._tlsMaterial);
53
57
  if (!_options.deferClientCreation) {
54
58
  this._clientsReady = this.startClientCreation();
55
59
  // Building the initial channel is async (address resolution + load balancer
@@ -194,12 +198,12 @@ export class ChronicleConnection {
194
198
  const selected = await this._loadBalancerStrategy.select(candidates);
195
199
  const serverAddress = formatServerAddress(selected);
196
200
  const tokenProvider = this.createTokenProvider(selected);
197
- const credentials = this._options.credentials ?? this._connectionString.createCredentials();
201
+ const credentials = this._options.credentials ?? this._connectionString.createCredentials(this._tlsMaterial);
198
202
  this._channel = createChannel(serverAddress, credentials, channelOptions);
199
203
  // nice-grpc invokes the last middleware first: auth retries re-enter propagation.
200
204
  const factory = createClientFactory().use(traceContextMiddleware).use(this.createAuthMiddleware(tokenProvider));
201
205
  this._connections = factory.create(ConnectionServiceDefinition, this._channel);
202
- this._compatibility = new CompatibilityPreflight(this._connections, this._options.connectTimeout ?? 10_000);
206
+ this._compatibility = new CompatibilityPreflight(this._connections, this._options.connectTimeout ?? 10_000, this._connectionString.skipCompatibilityCheck);
203
207
  const eventSequenceFactory = factory.use(this._compatibility.middleware());
204
208
  this._services = {
205
209
  eventStores: factory.create(EventStoresDefinition, this._channel),
@@ -240,7 +244,7 @@ export class ChronicleConnection {
240
244
  const channelHosts = this._options.credentials ? [] : remoteOnly(candidateHosts);
241
245
  // OAuth token requests (every mode except an API key) always skip validation, against
242
246
  // the explicit authority when set, otherwise the selected server.
243
- const tokenHosts = this._connectionString.apiKey
247
+ const tokenHosts = this._connectionString.apiKey || this._connectionString.noAuthentication
244
248
  ? []
245
249
  : remoteOnly(this._options.authority ? [new URL(this._options.authority).hostname] : candidateHosts);
246
250
  if (channelHosts.length === 0 && tokenHosts.length === 0)
@@ -259,6 +263,10 @@ export class ChronicleConnection {
259
263
  createTokenProvider(selected) {
260
264
  const hasUsername = !!this._connectionString.username;
261
265
  const hasApiKey = !!this._connectionString.apiKey;
266
+ // Asking for no authentication is deliberate and beats anything else the connection string carries.
267
+ if (this._connectionString.noAuthentication) {
268
+ return new NoOpTokenProvider();
269
+ }
262
270
  if (hasApiKey) {
263
271
  return new NoOpTokenProvider();
264
272
  }
@@ -286,7 +294,7 @@ export class ChronicleConnection {
286
294
  const endpoint = `${scheme}://${authorityHost.includes(':') && !authorityHost.startsWith('[') ? `[${authorityHost}]` : authorityHost}:${authorityPort}/connect/token`;
287
295
  let provider = this._tokenProviders.get(endpoint);
288
296
  if (!provider) {
289
- provider = new OAuthTokenProvider(endpoint, username, password, this._connectionString.skipTlsValidation);
297
+ provider = new OAuthTokenProvider(endpoint, username, password, this._connectionString.skipTlsValidation, undefined, this._tlsMaterial);
290
298
  this._tokenProviders.set(endpoint, provider);
291
299
  }
292
300
  return provider;
@@ -317,7 +325,7 @@ export class ChronicleConnection {
317
325
  metadata.set('authorization', `Bearer ${token}`);
318
326
  options.metadata = metadata;
319
327
  }
320
- else if (connectionString.apiKey) {
328
+ else if (connectionString.apiKey && !connectionString.noAuthentication) {
321
329
  const metadata = options.metadata ? Metadata(options.metadata) : Metadata();
322
330
  metadata.set('api-key', connectionString.apiKey);
323
331
  options.metadata = metadata;