@cratis/chronicle 6.62.0 → 6.64.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 (448) hide show
  1. package/ChronicleClient.ts +86 -3
  2. package/artifacts/DefaultClientArtifactsProvider.ts +5 -0
  3. package/artifacts/IClientArtifactsProvider.ts +3 -0
  4. package/connection/ConnectionLifecycle.ts +42 -1
  5. package/dist/ChronicleClient.d.ts +28 -1
  6. package/dist/ChronicleClient.d.ts.map +1 -1
  7. package/dist/ChronicleClient.js +71 -3
  8. package/dist/ChronicleClient.js.map +1 -1
  9. package/dist/artifacts/DefaultClientArtifactsProvider.d.ts +2 -0
  10. package/dist/artifacts/DefaultClientArtifactsProvider.d.ts.map +1 -1
  11. package/dist/artifacts/DefaultClientArtifactsProvider.js +4 -0
  12. package/dist/artifacts/DefaultClientArtifactsProvider.js.map +1 -1
  13. package/dist/artifacts/IClientArtifactsProvider.d.ts +2 -0
  14. package/dist/artifacts/IClientArtifactsProvider.d.ts.map +1 -1
  15. package/dist/connection/ConnectionLifecycle.d.ts +24 -0
  16. package/dist/connection/ConnectionLifecycle.d.ts.map +1 -1
  17. package/dist/connection/ConnectionLifecycle.js +40 -1
  18. package/dist/connection/ConnectionLifecycle.js.map +1 -1
  19. package/dist/observation/ObservationReconnectBackoff.d.ts +64 -0
  20. package/dist/observation/ObservationReconnectBackoff.d.ts.map +1 -0
  21. package/dist/observation/ObservationReconnectBackoff.js +75 -0
  22. package/dist/observation/ObservationReconnectBackoff.js.map +1 -0
  23. package/dist/observation/ObservationStreamOutcome.d.ts +10 -0
  24. package/dist/observation/ObservationStreamOutcome.d.ts.map +1 -0
  25. package/dist/observation/ObservationStreamOutcome.js +4 -0
  26. package/dist/observation/ObservationStreamOutcome.js.map +1 -0
  27. package/dist/observation/classifyStreamError.d.ts +25 -0
  28. package/dist/observation/classifyStreamError.d.ts.map +1 -0
  29. package/dist/observation/classifyStreamError.js +55 -0
  30. package/dist/observation/classifyStreamError.js.map +1 -0
  31. package/dist/observation/for_ObservationReconnectBackoff/given/a_backoff.d.ts +13 -0
  32. package/dist/observation/for_ObservationReconnectBackoff/given/a_backoff.d.ts.map +1 -0
  33. package/dist/observation/for_ObservationReconnectBackoff/given/a_backoff.js +25 -0
  34. package/dist/observation/for_ObservationReconnectBackoff/given/a_backoff.js.map +1 -0
  35. package/dist/observation/for_ObservationReconnectBackoff/given/a_scripted_stream.d.ts +27 -0
  36. package/dist/observation/for_ObservationReconnectBackoff/given/a_scripted_stream.d.ts.map +1 -0
  37. package/dist/observation/for_ObservationReconnectBackoff/given/a_scripted_stream.js +36 -0
  38. package/dist/observation/for_ObservationReconnectBackoff/given/a_scripted_stream.js.map +1 -0
  39. package/dist/projections/for_Graphs/given/a_discovered_graph.d.ts +2 -1
  40. package/dist/projections/for_Graphs/given/a_discovered_graph.d.ts.map +1 -1
  41. package/dist/projections/for_Graphs/given/a_discovered_graph.js +3 -2
  42. package/dist/projections/for_Graphs/given/a_discovered_graph.js.map +1 -1
  43. package/dist/projections/for_Graphs/given/a_graph_with_views.d.ts +40 -0
  44. package/dist/projections/for_Graphs/given/a_graph_with_views.d.ts.map +1 -0
  45. package/dist/projections/for_Graphs/given/a_graph_with_views.js +80 -0
  46. package/dist/projections/for_Graphs/given/a_graph_with_views.js.map +1 -0
  47. package/dist/projections/for_Graphs/given/organization.d.ts +2 -1
  48. package/dist/projections/for_Graphs/given/organization.d.ts.map +1 -1
  49. package/dist/projections/for_Graphs/given/organization.js +3 -2
  50. package/dist/projections/for_Graphs/given/organization.js.map +1 -1
  51. package/dist/projections/graphs/Graphs.d.ts +5 -0
  52. package/dist/projections/graphs/Graphs.d.ts.map +1 -1
  53. package/dist/projections/graphs/Graphs.js +43 -0
  54. package/dist/projections/graphs/Graphs.js.map +1 -1
  55. package/dist/projections/graphs/IGraphs.d.ts +9 -2
  56. package/dist/projections/graphs/IGraphs.d.ts.map +1 -1
  57. package/dist/projections/graphs/index.d.ts +1 -0
  58. package/dist/projections/graphs/index.d.ts.map +1 -1
  59. package/dist/projections/graphs/index.js +1 -0
  60. package/dist/projections/graphs/index.js.map +1 -1
  61. package/dist/projections/graphs/views/AmbiguousDirection.d.ts +16 -0
  62. package/dist/projections/graphs/views/AmbiguousDirection.d.ts.map +1 -0
  63. package/dist/projections/graphs/views/AmbiguousDirection.js +21 -0
  64. package/dist/projections/graphs/views/AmbiguousDirection.js.map +1 -0
  65. package/dist/projections/graphs/views/DuplicateViewName.d.ts +16 -0
  66. package/dist/projections/graphs/views/DuplicateViewName.d.ts.map +1 -0
  67. package/dist/projections/graphs/views/DuplicateViewName.js +21 -0
  68. package/dist/projections/graphs/views/DuplicateViewName.js.map +1 -0
  69. package/dist/projections/graphs/views/EdgeNotIncidentOnRoot.d.ts +17 -0
  70. package/dist/projections/graphs/views/EdgeNotIncidentOnRoot.d.ts.map +1 -0
  71. package/dist/projections/graphs/views/EdgeNotIncidentOnRoot.js +22 -0
  72. package/dist/projections/graphs/views/EdgeNotIncidentOnRoot.js.map +1 -0
  73. package/dist/projections/graphs/views/EdgePropertyViewNotUsedAsTarget.d.ts +14 -0
  74. package/dist/projections/graphs/views/EdgePropertyViewNotUsedAsTarget.d.ts.map +1 -0
  75. package/dist/projections/graphs/views/EdgePropertyViewNotUsedAsTarget.js +19 -0
  76. package/dist/projections/graphs/views/EdgePropertyViewNotUsedAsTarget.js.map +1 -0
  77. package/dist/projections/graphs/views/EdgePropertyViewSharedAcrossEdges.d.ts +15 -0
  78. package/dist/projections/graphs/views/EdgePropertyViewSharedAcrossEdges.d.ts.map +1 -0
  79. package/dist/projections/graphs/views/EdgePropertyViewSharedAcrossEdges.js +20 -0
  80. package/dist/projections/graphs/views/EdgePropertyViewSharedAcrossEdges.js.map +1 -0
  81. package/dist/projections/graphs/views/FollowsOptions.d.ts +16 -0
  82. package/dist/projections/graphs/views/FollowsOptions.d.ts.map +1 -0
  83. package/dist/projections/graphs/views/FollowsOptions.js +4 -0
  84. package/dist/projections/graphs/views/FollowsOptions.js.map +1 -0
  85. package/dist/projections/graphs/views/GraphEdgeDirection.d.ts +10 -0
  86. package/dist/projections/graphs/views/GraphEdgeDirection.d.ts.map +1 -0
  87. package/dist/projections/graphs/views/GraphEdgeDirection.js +13 -0
  88. package/dist/projections/graphs/views/GraphEdgeDirection.js.map +1 -0
  89. package/dist/projections/graphs/views/GraphView.d.ts +13 -0
  90. package/dist/projections/graphs/views/GraphView.d.ts.map +1 -0
  91. package/dist/projections/graphs/views/GraphView.js +4 -0
  92. package/dist/projections/graphs/views/GraphView.js.map +1 -0
  93. package/dist/projections/graphs/views/GraphViewBuildResult.d.ts +15 -0
  94. package/dist/projections/graphs/views/GraphViewBuildResult.d.ts.map +1 -0
  95. package/dist/projections/graphs/views/GraphViewBuildResult.js +4 -0
  96. package/dist/projections/graphs/views/GraphViewBuildResult.js.map +1 -0
  97. package/dist/projections/graphs/views/GraphViewCardinality.d.ts +10 -0
  98. package/dist/projections/graphs/views/GraphViewCardinality.d.ts.map +1 -0
  99. package/dist/projections/graphs/views/GraphViewCardinality.js +13 -0
  100. package/dist/projections/graphs/views/GraphViewCardinality.js.map +1 -0
  101. package/dist/projections/graphs/views/GraphViewDefinition.d.ts +15 -0
  102. package/dist/projections/graphs/views/GraphViewDefinition.d.ts.map +1 -0
  103. package/dist/projections/graphs/views/GraphViewDefinition.js +4 -0
  104. package/dist/projections/graphs/views/GraphViewDefinition.js.map +1 -0
  105. package/dist/projections/graphs/views/GraphViewDefinitionBuilder.d.ts +30 -0
  106. package/dist/projections/graphs/views/GraphViewDefinitionBuilder.d.ts.map +1 -0
  107. package/dist/projections/graphs/views/GraphViewDefinitionBuilder.js +259 -0
  108. package/dist/projections/graphs/views/GraphViewDefinitionBuilder.js.map +1 -0
  109. package/dist/projections/graphs/views/GraphViewDefinitionSerializer.d.ts +21 -0
  110. package/dist/projections/graphs/views/GraphViewDefinitionSerializer.d.ts.map +1 -0
  111. package/dist/projections/graphs/views/GraphViewDefinitionSerializer.js +77 -0
  112. package/dist/projections/graphs/views/GraphViewDefinitionSerializer.js.map +1 -0
  113. package/dist/projections/graphs/views/GraphViewEdgeReference.d.ts +6 -0
  114. package/dist/projections/graphs/views/GraphViewEdgeReference.d.ts.map +1 -0
  115. package/dist/projections/graphs/views/GraphViewEdgeReference.js +4 -0
  116. package/dist/projections/graphs/views/GraphViewEdgeReference.js.map +1 -0
  117. package/dist/projections/graphs/views/GraphViewMember.d.ts +8 -0
  118. package/dist/projections/graphs/views/GraphViewMember.d.ts.map +1 -0
  119. package/dist/projections/graphs/views/GraphViewMember.js +4 -0
  120. package/dist/projections/graphs/views/GraphViewMember.js.map +1 -0
  121. package/dist/projections/graphs/views/GraphViewMemberKind.d.ts +12 -0
  122. package/dist/projections/graphs/views/GraphViewMemberKind.d.ts.map +1 -0
  123. package/dist/projections/graphs/views/GraphViewMemberKind.js +15 -0
  124. package/dist/projections/graphs/views/GraphViewMemberKind.js.map +1 -0
  125. package/dist/projections/graphs/views/GraphViewMemberMetadata.d.ts +22 -0
  126. package/dist/projections/graphs/views/GraphViewMemberMetadata.d.ts.map +1 -0
  127. package/dist/projections/graphs/views/GraphViewMemberMetadata.js +4 -0
  128. package/dist/projections/graphs/views/GraphViewMemberMetadata.js.map +1 -0
  129. package/dist/projections/graphs/views/GraphViewPropertyMember.d.ts +13 -0
  130. package/dist/projections/graphs/views/GraphViewPropertyMember.d.ts.map +1 -0
  131. package/dist/projections/graphs/views/GraphViewPropertyMember.js +4 -0
  132. package/dist/projections/graphs/views/GraphViewPropertyMember.js.map +1 -0
  133. package/dist/projections/graphs/views/GraphViewReason.d.ts +33 -0
  134. package/dist/projections/graphs/views/GraphViewReason.d.ts.map +1 -0
  135. package/dist/projections/graphs/views/GraphViewReason.js +36 -0
  136. package/dist/projections/graphs/views/GraphViewReason.js.map +1 -0
  137. package/dist/projections/graphs/views/GraphViewRelationMember.d.ts +21 -0
  138. package/dist/projections/graphs/views/GraphViewRelationMember.d.ts.map +1 -0
  139. package/dist/projections/graphs/views/GraphViewRelationMember.js +4 -0
  140. package/dist/projections/graphs/views/GraphViewRelationMember.js.map +1 -0
  141. package/dist/projections/graphs/views/GraphViewSchema.d.ts +10 -0
  142. package/dist/projections/graphs/views/GraphViewSchema.d.ts.map +1 -0
  143. package/dist/projections/graphs/views/GraphViewSchema.js +4 -0
  144. package/dist/projections/graphs/views/GraphViewSchema.js.map +1 -0
  145. package/dist/projections/graphs/views/GraphViewSchemaEdge.d.ts +14 -0
  146. package/dist/projections/graphs/views/GraphViewSchemaEdge.d.ts.map +1 -0
  147. package/dist/projections/graphs/views/GraphViewSchemaEdge.js +4 -0
  148. package/dist/projections/graphs/views/GraphViewSchemaEdge.js.map +1 -0
  149. package/dist/projections/graphs/views/GraphViewSchemaNode.d.ts +10 -0
  150. package/dist/projections/graphs/views/GraphViewSchemaNode.d.ts.map +1 -0
  151. package/dist/projections/graphs/views/GraphViewSchemaNode.js +4 -0
  152. package/dist/projections/graphs/views/GraphViewSchemaNode.js.map +1 -0
  153. package/dist/projections/graphs/views/GraphViewSerializerOptions.d.ts +9 -0
  154. package/dist/projections/graphs/views/GraphViewSerializerOptions.d.ts.map +1 -0
  155. package/dist/projections/graphs/views/GraphViewSerializerOptions.js +4 -0
  156. package/dist/projections/graphs/views/GraphViewSerializerOptions.js.map +1 -0
  157. package/dist/projections/graphs/views/RecursiveView.d.ts +15 -0
  158. package/dist/projections/graphs/views/RecursiveView.d.ts.map +1 -0
  159. package/dist/projections/graphs/views/RecursiveView.js +20 -0
  160. package/dist/projections/graphs/views/RecursiveView.js.map +1 -0
  161. package/dist/projections/graphs/views/RelationTargetNotAView.d.ts +16 -0
  162. package/dist/projections/graphs/views/RelationTargetNotAView.d.ts.map +1 -0
  163. package/dist/projections/graphs/views/RelationTargetNotAView.js +21 -0
  164. package/dist/projections/graphs/views/RelationTargetNotAView.js.map +1 -0
  165. package/dist/projections/graphs/views/TargetLabelMismatch.d.ts +18 -0
  166. package/dist/projections/graphs/views/TargetLabelMismatch.d.ts.map +1 -0
  167. package/dist/projections/graphs/views/TargetLabelMismatch.js +23 -0
  168. package/dist/projections/graphs/views/TargetLabelMismatch.js.map +1 -0
  169. package/dist/projections/graphs/views/UnknownEdge.d.ts +16 -0
  170. package/dist/projections/graphs/views/UnknownEdge.d.ts.map +1 -0
  171. package/dist/projections/graphs/views/UnknownEdge.js +21 -0
  172. package/dist/projections/graphs/views/UnknownEdge.js.map +1 -0
  173. package/dist/projections/graphs/views/UnknownEdgeProperty.d.ts +17 -0
  174. package/dist/projections/graphs/views/UnknownEdgeProperty.d.ts.map +1 -0
  175. package/dist/projections/graphs/views/UnknownEdgeProperty.js +22 -0
  176. package/dist/projections/graphs/views/UnknownEdgeProperty.js.map +1 -0
  177. package/dist/projections/graphs/views/UnknownNodeProperty.d.ts +17 -0
  178. package/dist/projections/graphs/views/UnknownNodeProperty.d.ts.map +1 -0
  179. package/dist/projections/graphs/views/UnknownNodeProperty.js +22 -0
  180. package/dist/projections/graphs/views/UnknownNodeProperty.js.map +1 -0
  181. package/dist/projections/graphs/views/ViewIsAlsoSchema.d.ts +14 -0
  182. package/dist/projections/graphs/views/ViewIsAlsoSchema.d.ts.map +1 -0
  183. package/dist/projections/graphs/views/ViewIsAlsoSchema.js +19 -0
  184. package/dist/projections/graphs/views/ViewIsAlsoSchema.js.map +1 -0
  185. package/dist/projections/graphs/views/ViewOfMetadata.d.ts +8 -0
  186. package/dist/projections/graphs/views/ViewOfMetadata.d.ts.map +1 -0
  187. package/dist/projections/graphs/views/ViewOfMetadata.js +4 -0
  188. package/dist/projections/graphs/views/ViewOfMetadata.js.map +1 -0
  189. package/dist/projections/graphs/views/ViewOfOptions.d.ts +6 -0
  190. package/dist/projections/graphs/views/ViewOfOptions.d.ts.map +1 -0
  191. package/dist/projections/graphs/views/ViewOfOptions.js +4 -0
  192. package/dist/projections/graphs/views/ViewOfOptions.js.map +1 -0
  193. package/dist/projections/graphs/views/ViewRootNotANode.d.ts +16 -0
  194. package/dist/projections/graphs/views/ViewRootNotANode.d.ts.map +1 -0
  195. package/dist/projections/graphs/views/ViewRootNotANode.js +21 -0
  196. package/dist/projections/graphs/views/ViewRootNotANode.js.map +1 -0
  197. package/dist/projections/graphs/views/declareGraphViewMember.d.ts +17 -0
  198. package/dist/projections/graphs/views/declareGraphViewMember.d.ts.map +1 -0
  199. package/dist/projections/graphs/views/declareGraphViewMember.js +31 -0
  200. package/dist/projections/graphs/views/declareGraphViewMember.js.map +1 -0
  201. package/dist/projections/graphs/views/follows.d.ts +13 -0
  202. package/dist/projections/graphs/views/follows.d.ts.map +1 -0
  203. package/dist/projections/graphs/views/follows.js +24 -0
  204. package/dist/projections/graphs/views/follows.js.map +1 -0
  205. package/dist/projections/graphs/views/fromEdge.d.ts +10 -0
  206. package/dist/projections/graphs/views/fromEdge.d.ts.map +1 -0
  207. package/dist/projections/graphs/views/fromEdge.js +15 -0
  208. package/dist/projections/graphs/views/fromEdge.js.map +1 -0
  209. package/dist/projections/graphs/views/index.d.ts +41 -0
  210. package/dist/projections/graphs/views/index.d.ts.map +1 -0
  211. package/dist/projections/graphs/views/index.js +28 -0
  212. package/dist/projections/graphs/views/index.js.map +1 -0
  213. package/dist/projections/graphs/views/viewKey.d.ts +8 -0
  214. package/dist/projections/graphs/views/viewKey.d.ts.map +1 -0
  215. package/dist/projections/graphs/views/viewKey.js +13 -0
  216. package/dist/projections/graphs/views/viewKey.js.map +1 -0
  217. package/dist/projections/graphs/views/viewOf.d.ts +22 -0
  218. package/dist/projections/graphs/views/viewOf.d.ts.map +1 -0
  219. package/dist/projections/graphs/views/viewOf.js +41 -0
  220. package/dist/projections/graphs/views/viewOf.js.map +1 -0
  221. package/dist/projections/graphs/views/viewProperty.d.ts +9 -0
  222. package/dist/projections/graphs/views/viewProperty.d.ts.map +1 -0
  223. package/dist/projections/graphs/views/viewProperty.js +14 -0
  224. package/dist/projections/graphs/views/viewProperty.js.map +1 -0
  225. package/dist/reactors/Reactors.d.ts +15 -5
  226. package/dist/reactors/Reactors.d.ts.map +1 -1
  227. package/dist/reactors/Reactors.js +95 -18
  228. package/dist/reactors/Reactors.js.map +1 -1
  229. package/dist/reactors/for_Reactors/when_reconnecting_the_observation_stream/given/a_reactor_whose_stream_ends.d.ts +26 -0
  230. package/dist/reactors/for_Reactors/when_reconnecting_the_observation_stream/given/a_reactor_whose_stream_ends.d.ts.map +1 -0
  231. package/dist/reactors/for_Reactors/when_reconnecting_the_observation_stream/given/a_reactor_whose_stream_ends.js +64 -0
  232. package/dist/reactors/for_Reactors/when_reconnecting_the_observation_stream/given/a_reactor_whose_stream_ends.js.map +1 -0
  233. package/dist/reducers/Reducers.d.ts +11 -5
  234. package/dist/reducers/Reducers.d.ts.map +1 -1
  235. package/dist/reducers/Reducers.js +93 -19
  236. package/dist/reducers/Reducers.js.map +1 -1
  237. package/dist/reducers/for_Reducers/when_reconnecting_the_observation_stream/given/a_reducer_whose_stream_ends.d.ts +25 -0
  238. package/dist/reducers/for_Reducers/when_reconnecting_the_observation_stream/given/a_reducer_whose_stream_ends.d.ts.map +1 -0
  239. package/dist/reducers/for_Reducers/when_reconnecting_the_observation_stream/given/a_reducer_whose_stream_ends.js +70 -0
  240. package/dist/reducers/for_Reducers/when_reconnecting_the_observation_stream/given/a_reducer_whose_stream_ends.js.map +1 -0
  241. package/dist/testing/InProcessAppendMetadata.d.ts +30 -0
  242. package/dist/testing/InProcessAppendMetadata.d.ts.map +1 -0
  243. package/dist/testing/InProcessAppendMetadata.js +107 -0
  244. package/dist/testing/InProcessAppendMetadata.js.map +1 -0
  245. package/dist/testing/InProcessBatchAppend.d.ts +62 -0
  246. package/dist/testing/InProcessBatchAppend.d.ts.map +1 -0
  247. package/dist/testing/InProcessBatchAppend.js +131 -0
  248. package/dist/testing/InProcessBatchAppend.js.map +1 -0
  249. package/dist/testing/InProcessEventPayload.d.ts +23 -0
  250. package/dist/testing/InProcessEventPayload.d.ts.map +1 -0
  251. package/dist/testing/InProcessEventPayload.js +94 -0
  252. package/dist/testing/InProcessEventPayload.js.map +1 -0
  253. package/dist/testing/InProcessEventReadCriteria.d.ts +9 -0
  254. package/dist/testing/InProcessEventReadCriteria.d.ts.map +1 -0
  255. package/dist/testing/InProcessEventReadCriteria.js +4 -0
  256. package/dist/testing/InProcessEventReadCriteria.js.map +1 -0
  257. package/dist/testing/InProcessEventReadFilter.d.ts +14 -0
  258. package/dist/testing/InProcessEventReadFilter.d.ts.map +1 -0
  259. package/dist/testing/InProcessEventReadFilter.js +31 -0
  260. package/dist/testing/InProcessEventReadFilter.js.map +1 -0
  261. package/dist/testing/InProcessEventSequence.d.ts +8 -5
  262. package/dist/testing/InProcessEventSequence.d.ts.map +1 -1
  263. package/dist/testing/InProcessEventSequence.js +59 -275
  264. package/dist/testing/InProcessEventSequence.js.map +1 -1
  265. package/dist/testing/InProcessEventSequenceEnvironment.d.ts +13 -0
  266. package/dist/testing/InProcessEventSequenceEnvironment.d.ts.map +1 -0
  267. package/dist/testing/InProcessEventSequenceEnvironment.js +4 -0
  268. package/dist/testing/InProcessEventSequenceEnvironment.js.map +1 -0
  269. package/dist/testing/InProcessSingleAppend.d.ts +34 -0
  270. package/dist/testing/InProcessSingleAppend.d.ts.map +1 -0
  271. package/dist/testing/InProcessSingleAppend.js +95 -0
  272. package/dist/testing/InProcessSingleAppend.js.map +1 -0
  273. package/dist/testing/projections/ProjectionCapabilities.d.ts +0 -8
  274. package/dist/testing/projections/ProjectionCapabilities.d.ts.map +1 -1
  275. package/dist/testing/projections/ProjectionCapabilities.js +21 -312
  276. package/dist/testing/projections/ProjectionCapabilities.js.map +1 -1
  277. package/dist/testing/projections/ProjectionCapabilityReject.d.ts +3 -0
  278. package/dist/testing/projections/ProjectionCapabilityReject.d.ts.map +1 -0
  279. package/dist/testing/projections/ProjectionCapabilityReject.js +4 -0
  280. package/dist/testing/projections/ProjectionCapabilityReject.js.map +1 -0
  281. package/dist/testing/projections/ProjectionCapabilityReporter.d.ts +12 -0
  282. package/dist/testing/projections/ProjectionCapabilityReporter.d.ts.map +1 -0
  283. package/dist/testing/projections/ProjectionCapabilityReporter.js +33 -0
  284. package/dist/testing/projections/ProjectionCapabilityReporter.js.map +1 -0
  285. package/dist/testing/projections/ProjectionDefinitionCapabilities.d.ts +11 -0
  286. package/dist/testing/projections/ProjectionDefinitionCapabilities.d.ts.map +1 -0
  287. package/dist/testing/projections/ProjectionDefinitionCapabilities.js +45 -0
  288. package/dist/testing/projections/ProjectionDefinitionCapabilities.js.map +1 -0
  289. package/dist/testing/projections/ProjectionEventSchemaResolver.d.ts +13 -0
  290. package/dist/testing/projections/ProjectionEventSchemaResolver.d.ts.map +1 -0
  291. package/dist/testing/projections/ProjectionEventSchemaResolver.js +22 -0
  292. package/dist/testing/projections/ProjectionEventSchemaResolver.js.map +1 -0
  293. package/dist/testing/projections/ProjectionExpressionCapabilities.d.ts +19 -0
  294. package/dist/testing/projections/ProjectionExpressionCapabilities.d.ts.map +1 -0
  295. package/dist/testing/projections/ProjectionExpressionCapabilities.js +103 -0
  296. package/dist/testing/projections/ProjectionExpressionCapabilities.js.map +1 -0
  297. package/dist/testing/projections/ProjectionInitialValueCapabilities.d.ts +16 -0
  298. package/dist/testing/projections/ProjectionInitialValueCapabilities.d.ts.map +1 -0
  299. package/dist/testing/projections/ProjectionInitialValueCapabilities.js +72 -0
  300. package/dist/testing/projections/ProjectionInitialValueCapabilities.js.map +1 -0
  301. package/dist/testing/projections/ProjectionMappingCapabilities.d.ts +21 -0
  302. package/dist/testing/projections/ProjectionMappingCapabilities.d.ts.map +1 -0
  303. package/dist/testing/projections/ProjectionMappingCapabilities.js +86 -0
  304. package/dist/testing/projections/ProjectionMappingCapabilities.js.map +1 -0
  305. package/dist/testing/projections/ProjectionMappingValidation.d.ts +9 -0
  306. package/dist/testing/projections/ProjectionMappingValidation.d.ts.map +1 -0
  307. package/dist/testing/projections/ProjectionMappingValidation.js +4 -0
  308. package/dist/testing/projections/ProjectionMappingValidation.js.map +1 -0
  309. package/dist/testing/projections/ProjectionReadModelCapabilities.d.ts +11 -0
  310. package/dist/testing/projections/ProjectionReadModelCapabilities.d.ts.map +1 -0
  311. package/dist/testing/projections/ProjectionReadModelCapabilities.js +40 -0
  312. package/dist/testing/projections/ProjectionReadModelCapabilities.js.map +1 -0
  313. package/dist/testing/projections/ProjectionRootCapabilities.d.ts +20 -0
  314. package/dist/testing/projections/ProjectionRootCapabilities.d.ts.map +1 -0
  315. package/dist/testing/projections/ProjectionRootCapabilities.js +73 -0
  316. package/dist/testing/projections/ProjectionRootCapabilities.js.map +1 -0
  317. package/dist/testing/projections/ProjectionScalarConverter.d.ts +21 -0
  318. package/dist/testing/projections/ProjectionScalarConverter.d.ts.map +1 -0
  319. package/dist/testing/projections/ProjectionScalarConverter.js +105 -0
  320. package/dist/testing/projections/ProjectionScalarConverter.js.map +1 -0
  321. package/dist/testing/projections/ProjectionSchemaCapabilities.d.ts +26 -0
  322. package/dist/testing/projections/ProjectionSchemaCapabilities.d.ts.map +1 -0
  323. package/dist/testing/projections/ProjectionSchemaCapabilities.js +109 -0
  324. package/dist/testing/projections/ProjectionSchemaCapabilities.js.map +1 -0
  325. package/dist/testing/projections/ProjectionValueConverter.d.ts +5 -0
  326. package/dist/testing/projections/ProjectionValueConverter.d.ts.map +1 -1
  327. package/dist/testing/projections/ProjectionValueConverter.js +36 -84
  328. package/dist/testing/projections/ProjectionValueConverter.js.map +1 -1
  329. package/dist/tsconfig.tsbuildinfo +1 -1
  330. package/dist/types/DecoratorType.d.ts +3 -1
  331. package/dist/types/DecoratorType.d.ts.map +1 -1
  332. package/dist/types/DecoratorType.js +2 -0
  333. package/dist/types/DecoratorType.js.map +1 -1
  334. package/for_ChronicleClient/when_reconnecting/and_an_observation_stream_lost_its_session.spec.ts +212 -0
  335. package/observation/ObservationReconnectBackoff.ts +109 -0
  336. package/observation/ObservationStreamOutcome.ts +12 -0
  337. package/observation/classifyStreamError.ts +67 -0
  338. package/observation/for_ObservationReconnectBackoff/given/a_backoff.ts +29 -0
  339. package/observation/for_ObservationReconnectBackoff/given/a_scripted_stream.ts +52 -0
  340. package/observation/for_ObservationReconnectBackoff/when_a_stream_delivered_before_it_ended.spec.ts +23 -0
  341. package/observation/for_ObservationReconnectBackoff/when_a_stream_stayed_open_before_it_ended.spec.ts +25 -0
  342. package/observation/for_ObservationReconnectBackoff/when_jittering_the_delay.spec.ts +24 -0
  343. package/observation/for_ObservationReconnectBackoff/when_streams_keep_ending_without_working.spec.ts +24 -0
  344. package/observation/for_ObservationReconnectBackoff/when_the_base_delay_is_not_positive.spec.ts +18 -0
  345. package/observation/for_ObservationReconnectBackoff/when_the_settings_are_not_finite.spec.ts +32 -0
  346. package/observation/for_ObservationReconnectBackoff/when_using_the_defaults.spec.ts +29 -0
  347. package/observation/for_classifyStreamError/when_classifying_a_stream_error.spec.ts +36 -0
  348. package/package.json +2 -2
  349. package/projections/for_Graphs/given/a_discovered_graph.ts +3 -2
  350. package/projections/for_Graphs/given/a_graph_with_views.ts +91 -0
  351. package/projections/for_Graphs/given/organization.ts +3 -2
  352. package/projections/for_Graphs/given/organization_with_views.fixture.ts +129 -0
  353. package/projections/for_Graphs/when_building_graph_views.spec.ts +218 -0
  354. package/projections/for_Graphs/when_declaring_an_invalid_graph_view.spec.ts +229 -0
  355. package/projections/for_Graphs/when_declaring_graph_views.standard.spec.ts +49 -0
  356. package/projections/for_Graphs/when_discovering_graph_views.spec.ts +58 -0
  357. package/projections/graphs/Graphs.ts +44 -0
  358. package/projections/graphs/IGraphs.ts +10 -2
  359. package/projections/graphs/index.ts +1 -0
  360. package/projections/graphs/views/AmbiguousDirection.ts +23 -0
  361. package/projections/graphs/views/DuplicateViewName.ts +23 -0
  362. package/projections/graphs/views/EdgeNotIncidentOnRoot.ts +24 -0
  363. package/projections/graphs/views/EdgePropertyViewNotUsedAsTarget.ts +21 -0
  364. package/projections/graphs/views/EdgePropertyViewSharedAcrossEdges.ts +22 -0
  365. package/projections/graphs/views/FollowsOptions.ts +20 -0
  366. package/projections/graphs/views/GraphEdgeDirection.ts +13 -0
  367. package/projections/graphs/views/GraphView.ts +18 -0
  368. package/projections/graphs/views/GraphViewBuildResult.ts +19 -0
  369. package/projections/graphs/views/GraphViewCardinality.ts +13 -0
  370. package/projections/graphs/views/GraphViewDefinition.ts +20 -0
  371. package/projections/graphs/views/GraphViewDefinitionBuilder.ts +322 -0
  372. package/projections/graphs/views/GraphViewDefinitionSerializer.ts +90 -0
  373. package/projections/graphs/views/GraphViewEdgeReference.ts +8 -0
  374. package/projections/graphs/views/GraphViewMember.ts +11 -0
  375. package/projections/graphs/views/GraphViewMemberKind.ts +16 -0
  376. package/projections/graphs/views/GraphViewMemberMetadata.ts +31 -0
  377. package/projections/graphs/views/GraphViewPropertyMember.ts +18 -0
  378. package/projections/graphs/views/GraphViewReason.ts +47 -0
  379. package/projections/graphs/views/GraphViewRelationMember.ts +29 -0
  380. package/projections/graphs/views/GraphViewSchema.ts +14 -0
  381. package/projections/graphs/views/GraphViewSchemaEdge.ts +20 -0
  382. package/projections/graphs/views/GraphViewSchemaNode.ts +14 -0
  383. package/projections/graphs/views/GraphViewSerializerOptions.ts +11 -0
  384. package/projections/graphs/views/RecursiveView.ts +22 -0
  385. package/projections/graphs/views/RelationTargetNotAView.ts +23 -0
  386. package/projections/graphs/views/TargetLabelMismatch.ts +25 -0
  387. package/projections/graphs/views/UnknownEdge.ts +23 -0
  388. package/projections/graphs/views/UnknownEdgeProperty.ts +24 -0
  389. package/projections/graphs/views/UnknownNodeProperty.ts +24 -0
  390. package/projections/graphs/views/ViewIsAlsoSchema.ts +21 -0
  391. package/projections/graphs/views/ViewOfMetadata.ts +11 -0
  392. package/projections/graphs/views/ViewOfOptions.ts +8 -0
  393. package/projections/graphs/views/ViewRootNotANode.ts +23 -0
  394. package/projections/graphs/views/declareGraphViewMember.ts +36 -0
  395. package/projections/graphs/views/follows.ts +28 -0
  396. package/projections/graphs/views/fromEdge.ts +17 -0
  397. package/projections/graphs/views/index.ts +43 -0
  398. package/projections/graphs/views/viewKey.ts +15 -0
  399. package/projections/graphs/views/viewOf.ts +50 -0
  400. package/projections/graphs/views/viewProperty.ts +16 -0
  401. package/reactors/Reactors.ts +101 -18
  402. package/reactors/for_Reactors/when_reconnecting_the_observation_stream/and_a_handler_failed_with_a_lost_session.spec.ts +32 -0
  403. package/reactors/for_Reactors/when_reconnecting_the_observation_stream/and_a_replaced_stream_fails_late.spec.ts +28 -0
  404. package/reactors/for_Reactors/when_reconnecting_the_observation_stream/and_a_stream_delivered_before_it_ended.spec.ts +24 -0
  405. package/reactors/for_Reactors/when_reconnecting_the_observation_stream/and_a_stream_stayed_open_before_it_ended.spec.ts +23 -0
  406. package/reactors/for_Reactors/when_reconnecting_the_observation_stream/and_it_is_disposed_while_waiting_to_reopen.spec.ts +27 -0
  407. package/reactors/for_Reactors/when_reconnecting_the_observation_stream/and_streams_keep_ending_without_working.spec.ts +24 -0
  408. package/reactors/for_Reactors/when_reconnecting_the_observation_stream/and_the_client_reconnected_after_streams_kept_ending.spec.ts +24 -0
  409. package/reactors/for_Reactors/when_reconnecting_the_observation_stream/and_the_client_reconnected_while_waiting_to_reopen.spec.ts +25 -0
  410. package/reactors/for_Reactors/when_reconnecting_the_observation_stream/and_the_kernel_lost_the_session.spec.ts +24 -0
  411. package/reactors/for_Reactors/when_reconnecting_the_observation_stream/given/a_reactor_whose_stream_ends.ts +69 -0
  412. package/reducers/Reducers.ts +99 -19
  413. package/reducers/for_Reducers/when_reconnecting_the_observation_stream/and_a_reducer_failed_with_a_lost_session.spec.ts +33 -0
  414. package/reducers/for_Reducers/when_reconnecting_the_observation_stream/and_a_replaced_stream_fails_late.spec.ts +28 -0
  415. package/reducers/for_Reducers/when_reconnecting_the_observation_stream/and_a_stream_delivered_before_it_ended.spec.ts +24 -0
  416. package/reducers/for_Reducers/when_reconnecting_the_observation_stream/and_a_stream_stayed_open_before_it_ended.spec.ts +23 -0
  417. package/reducers/for_Reducers/when_reconnecting_the_observation_stream/and_it_is_disposed_while_waiting_to_reopen.spec.ts +27 -0
  418. package/reducers/for_Reducers/when_reconnecting_the_observation_stream/and_streams_keep_ending_without_working.spec.ts +24 -0
  419. package/reducers/for_Reducers/when_reconnecting_the_observation_stream/and_the_client_reconnected_after_streams_kept_ending.spec.ts +24 -0
  420. package/reducers/for_Reducers/when_reconnecting_the_observation_stream/and_the_client_reconnected_while_waiting_to_reopen.spec.ts +25 -0
  421. package/reducers/for_Reducers/when_reconnecting_the_observation_stream/and_the_kernel_lost_the_session.spec.ts +24 -0
  422. package/reducers/for_Reducers/when_reconnecting_the_observation_stream/given/a_reducer_whose_stream_ends.ts +69 -0
  423. package/testing/InProcessAppendMetadata.ts +119 -0
  424. package/testing/InProcessBatchAppend.ts +142 -0
  425. package/testing/InProcessEventPayload.ts +100 -0
  426. package/testing/InProcessEventReadCriteria.ts +11 -0
  427. package/testing/InProcessEventReadFilter.ts +37 -0
  428. package/testing/InProcessEventSequence.ts +63 -257
  429. package/testing/InProcessEventSequenceEnvironment.ts +16 -0
  430. package/testing/InProcessSingleAppend.ts +99 -0
  431. package/testing/for_InProcessEventSequence/when_preserving_validation_and_commit_order.spec.ts +95 -0
  432. package/testing/projections/ProjectionCapabilities.ts +23 -279
  433. package/testing/projections/ProjectionCapabilityReject.ts +5 -0
  434. package/testing/projections/ProjectionCapabilityReporter.ts +31 -0
  435. package/testing/projections/ProjectionDefinitionCapabilities.ts +45 -0
  436. package/testing/projections/ProjectionEventSchemaResolver.ts +23 -0
  437. package/testing/projections/ProjectionExpressionCapabilities.ts +101 -0
  438. package/testing/projections/ProjectionInitialValueCapabilities.ts +73 -0
  439. package/testing/projections/ProjectionMappingCapabilities.ts +85 -0
  440. package/testing/projections/ProjectionMappingValidation.ts +12 -0
  441. package/testing/projections/ProjectionReadModelCapabilities.ts +42 -0
  442. package/testing/projections/ProjectionRootCapabilities.ts +75 -0
  443. package/testing/projections/ProjectionScalarConverter.ts +106 -0
  444. package/testing/projections/ProjectionSchemaCapabilities.ts +112 -0
  445. package/testing/projections/ProjectionValueConverter.ts +37 -76
  446. package/testing/projections/for_ProjectionCapabilities/when_reporting_the_first_unsupported_operation.spec.ts +74 -0
  447. package/testing/projections/for_ProjectionValueConverter/when_converting_structured_and_scalar_values.spec.ts +64 -0
  448. package/types/DecoratorType.ts +4 -1
@@ -0,0 +1,16 @@
1
+ import type { GraphEdgeDirection } from './GraphEdgeDirection.js';
2
+ import type { GraphViewCardinality } from './GraphViewCardinality.js';
3
+ /** Options of the follows decorator. */
4
+ export interface FollowsOptions {
5
+ /**
6
+ * Whether the relation yields a list or a single item. TypeScript erases generic arguments, so the type of the
7
+ * member cannot say which one it is. Defaults to {@link GraphViewCardinality.Many}.
8
+ */
9
+ readonly cardinality?: GraphViewCardinality;
10
+ /**
11
+ * The direction in which the edge is followed. It is derived from the labels of the edge, except for an edge
12
+ * that starts and ends at the same label, which needs it to be stated.
13
+ */
14
+ readonly direction?: GraphEdgeDirection;
15
+ }
16
+ //# sourceMappingURL=FollowsOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FollowsOptions.d.ts","sourceRoot":"","sources":["../../../../projections/graphs/views/FollowsOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,wCAAwC;AACxC,MAAM,WAAW,cAAc;IAC3B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,oBAAoB,CAAC;IAE5C;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC;CAC3C"}
@@ -0,0 +1,4 @@
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
+ export {};
4
+ //# sourceMappingURL=FollowsOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FollowsOptions.js","sourceRoot":"","sources":["../../../../projections/graphs/views/FollowsOptions.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Represents the direction in which a relation follows an edge, seen from the root node of the view.
3
+ */
4
+ export declare enum GraphEdgeDirection {
5
+ /** The root node is the source of the edge. */
6
+ Outgoing = "outgoing",
7
+ /** The root node is the target of the edge. */
8
+ Incoming = "incoming"
9
+ }
10
+ //# sourceMappingURL=GraphEdgeDirection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphEdgeDirection.d.ts","sourceRoot":"","sources":["../../../../projections/graphs/views/GraphEdgeDirection.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,oBAAY,kBAAkB;IAC1B,+CAA+C;IAC/C,QAAQ,aAAa;IAErB,+CAA+C;IAC/C,QAAQ,aAAa;CACxB"}
@@ -0,0 +1,13 @@
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
+ * Represents the direction in which a relation follows an edge, seen from the root node of the view.
5
+ */
6
+ export var GraphEdgeDirection;
7
+ (function (GraphEdgeDirection) {
8
+ /** The root node is the source of the edge. */
9
+ GraphEdgeDirection["Outgoing"] = "outgoing";
10
+ /** The root node is the target of the edge. */
11
+ GraphEdgeDirection["Incoming"] = "incoming";
12
+ })(GraphEdgeDirection || (GraphEdgeDirection = {}));
13
+ //# sourceMappingURL=GraphEdgeDirection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphEdgeDirection.js","sourceRoot":"","sources":["../../../../projections/graphs/views/GraphEdgeDirection.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG;;GAEG;AACH,MAAM,CAAN,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC1B,+CAA+C;IAC/C,2CAAqB,CAAA;IAErB,+CAA+C;IAC/C,2CAAqB,CAAA;AACzB,CAAC,EANW,kBAAkB,KAAlB,kBAAkB,QAM7B"}
@@ -0,0 +1,13 @@
1
+ import type { GraphViewMember } from './GraphViewMember.js';
2
+ /**
3
+ * Represents a view over a graph as it is declared: anchored at one node label, with its members in declaration order.
4
+ */
5
+ export interface GraphView {
6
+ /** The name of the view, unique in its graph. */
7
+ readonly name: string;
8
+ /** The label of the node the view is anchored at. */
9
+ readonly root: string;
10
+ /** The members of the view, in the order they are declared. */
11
+ readonly members: readonly GraphViewMember[];
12
+ }
13
+ //# sourceMappingURL=GraphView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphView.d.ts","sourceRoot":"","sources":["../../../../projections/graphs/views/GraphView.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,iDAAiD;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,CAAC;CAChD"}
@@ -0,0 +1,4 @@
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
+ export {};
4
+ //# sourceMappingURL=GraphView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphView.js","sourceRoot":"","sources":["../../../../projections/graphs/views/GraphView.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
@@ -0,0 +1,15 @@
1
+ import type { Constructor } from '@cratis/fundamentals';
2
+ import type { GraphViewDefinition } from './GraphViewDefinition.js';
3
+ /**
4
+ * Represents the outcome of building the views of one graph.
5
+ */
6
+ export interface GraphViewBuildResult {
7
+ /**
8
+ * The definition of the views. It is missing when any view of the graph is invalid: a view can be read only
9
+ * together with the views it nests, so the views of a graph are emitted together or not at all.
10
+ */
11
+ readonly definition?: GraphViewDefinition;
12
+ /** The views that are invalid, and why. The error of each carries the reason code. */
13
+ readonly failures: ReadonlyMap<Constructor, Error>;
14
+ }
15
+ //# sourceMappingURL=GraphViewBuildResult.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphViewBuildResult.d.ts","sourceRoot":"","sources":["../../../../projections/graphs/views/GraphViewBuildResult.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,mBAAmB,CAAC;IAE1C,sFAAsF;IACtF,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;CACtD"}
@@ -0,0 +1,4 @@
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
+ export {};
4
+ //# sourceMappingURL=GraphViewBuildResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphViewBuildResult.js","sourceRoot":"","sources":["../../../../projections/graphs/views/GraphViewBuildResult.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Represents how many related items a relation of a graph view yields.
3
+ */
4
+ export declare enum GraphViewCardinality {
5
+ /** A list of related items. A relation without any related node yields an empty list. */
6
+ Many = "many",
7
+ /** A single related item. A relation without any related node yields null. */
8
+ One = "one"
9
+ }
10
+ //# sourceMappingURL=GraphViewCardinality.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphViewCardinality.d.ts","sourceRoot":"","sources":["../../../../projections/graphs/views/GraphViewCardinality.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,oBAAY,oBAAoB;IAC5B,yFAAyF;IACzF,IAAI,SAAS;IAEb,8EAA8E;IAC9E,GAAG,QAAQ;CACd"}
@@ -0,0 +1,13 @@
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
+ * Represents how many related items a relation of a graph view yields.
5
+ */
6
+ export var GraphViewCardinality;
7
+ (function (GraphViewCardinality) {
8
+ /** A list of related items. A relation without any related node yields an empty list. */
9
+ GraphViewCardinality["Many"] = "many";
10
+ /** A single related item. A relation without any related node yields null. */
11
+ GraphViewCardinality["One"] = "one";
12
+ })(GraphViewCardinality || (GraphViewCardinality = {}));
13
+ //# sourceMappingURL=GraphViewCardinality.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphViewCardinality.js","sourceRoot":"","sources":["../../../../projections/graphs/views/GraphViewCardinality.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG;;GAEG;AACH,MAAM,CAAN,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC5B,yFAAyF;IACzF,qCAAa,CAAA;IAEb,8EAA8E;IAC9E,mCAAW,CAAA;AACf,CAAC,EANW,oBAAoB,KAApB,oBAAoB,QAM/B"}
@@ -0,0 +1,15 @@
1
+ import type { GraphView } from './GraphView.js';
2
+ import type { GraphViewSchema } from './GraphViewSchema.js';
3
+ /**
4
+ * Represents the views declared over a graph. It is the transport and conformance form of the views, shared by the
5
+ * Cratis clients: it is emitted from the declarations, never written by hand.
6
+ */
7
+ export interface GraphViewDefinition {
8
+ /** The name of the graph the views read. */
9
+ readonly graph: string;
10
+ /** The nodes and edges the views were validated against. It is written only when the serializer is asked to. */
11
+ readonly schema?: GraphViewSchema;
12
+ /** The views, sorted by name. */
13
+ readonly views: readonly GraphView[];
14
+ }
15
+ //# sourceMappingURL=GraphViewDefinition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphViewDefinition.d.ts","sourceRoot":"","sources":["../../../../projections/graphs/views/GraphViewDefinition.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,gHAAgH;IAChH,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAElC,iCAAiC;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;CACxC"}
@@ -0,0 +1,4 @@
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
+ export {};
4
+ //# sourceMappingURL=GraphViewDefinition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphViewDefinition.js","sourceRoot":"","sources":["../../../../projections/graphs/views/GraphViewDefinition.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
@@ -0,0 +1,30 @@
1
+ import type { Constructor } from '@cratis/fundamentals';
2
+ import type { GraphModel } from '../GraphModel.js';
3
+ import type { GraphViewBuildResult } from './GraphViewBuildResult.js';
4
+ /**
5
+ * Validates the views declared over a graph and builds their {@link GraphViewDefinition}. Every rule of a view has a
6
+ * reason code, carried by the error that reports it. One invalid view never stops the discovery of anything else; it
7
+ * is reported, and the views of its graph are then withheld as a whole, because a view is read together with the views
8
+ * it nests.
9
+ */
10
+ export declare class GraphViewDefinitionBuilder {
11
+ private readonly _schemaWriter;
12
+ /**
13
+ * Builds the definition of the views of one graph.
14
+ * @param model - The {@link GraphModel} the views read.
15
+ * @param views - The view types that name the graph.
16
+ * @returns The {@link GraphViewBuildResult}.
17
+ */
18
+ build(model: GraphModel, views: readonly Constructor[]): GraphViewBuildResult;
19
+ private edgeInfo;
20
+ private resolve;
21
+ private directionOf;
22
+ private validateAcrossViews;
23
+ private validateEdgeProperties;
24
+ private cycleThrough;
25
+ private member;
26
+ private edgeOf;
27
+ private edgeName;
28
+ private find;
29
+ }
30
+ //# sourceMappingURL=GraphViewDefinitionBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphViewDefinitionBuilder.d.ts","sourceRoot":"","sources":["../../../../projections/graphs/views/GraphViewDefinitionBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAUnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AA8DtE;;;;;GAKG;AACH,qBAAa,0BAA0B;IACnC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA2B;IAEzD;;;;;OAKG;IACH,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,oBAAoB,CA8C5E;IAED,OAAO,CAAC,QAAQ;IAUhB,OAAO,CAAC,OAAO;IA8Df,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,mBAAmB;IAsB3B,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,YAAY;IAoBpB,OAAO,CAAC,MAAM;IAkBd,OAAO,CAAC,MAAM;IAQd,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,IAAI;CAIf"}
@@ -0,0 +1,259 @@
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
+ import { TypeIntrospector } from '../../../types/index.js';
4
+ import { getEdgeMetadata } from '../edge.js';
5
+ import { GraphSchemaWriter } from '../GraphSchemaWriter.js';
6
+ import { isGraphElement } from '../isGraphElement.js';
7
+ import { AmbiguousDirection } from './AmbiguousDirection.js';
8
+ import { DuplicateViewName } from './DuplicateViewName.js';
9
+ import { EdgeNotIncidentOnRoot } from './EdgeNotIncidentOnRoot.js';
10
+ import { EdgePropertyViewNotUsedAsTarget } from './EdgePropertyViewNotUsedAsTarget.js';
11
+ import { EdgePropertyViewSharedAcrossEdges } from './EdgePropertyViewSharedAcrossEdges.js';
12
+ import { GraphEdgeDirection } from './GraphEdgeDirection.js';
13
+ import { GraphViewCardinality } from './GraphViewCardinality.js';
14
+ import { getGraphViewMemberMetadata } from './declareGraphViewMember.js';
15
+ import { GraphViewMemberKind } from './GraphViewMemberKind.js';
16
+ import { RecursiveView } from './RecursiveView.js';
17
+ import { RelationTargetNotAView } from './RelationTargetNotAView.js';
18
+ import { TargetLabelMismatch } from './TargetLabelMismatch.js';
19
+ import { UnknownEdge } from './UnknownEdge.js';
20
+ import { UnknownEdgeProperty } from './UnknownEdgeProperty.js';
21
+ import { UnknownNodeProperty } from './UnknownNodeProperty.js';
22
+ import { ViewIsAlsoSchema } from './ViewIsAlsoSchema.js';
23
+ import { getViewOfMetadata } from './viewOf.js';
24
+ import { ViewRootNotANode } from './ViewRootNotANode.js';
25
+ /**
26
+ * Validates the views declared over a graph and builds their {@link GraphViewDefinition}. Every rule of a view has a
27
+ * reason code, carried by the error that reports it. One invalid view never stops the discovery of anything else; it
28
+ * is reported, and the views of its graph are then withheld as a whole, because a view is read together with the views
29
+ * it nests.
30
+ */
31
+ export class GraphViewDefinitionBuilder {
32
+ _schemaWriter = new GraphSchemaWriter();
33
+ /**
34
+ * Builds the definition of the views of one graph.
35
+ * @param model - The {@link GraphModel} the views read.
36
+ * @param views - The view types that name the graph.
37
+ * @returns The {@link GraphViewBuildResult}.
38
+ */
39
+ build(model, views) {
40
+ const failures = new Map();
41
+ const nodes = new Map(model.nodes.map(node => [node.type, {
42
+ label: node.label,
43
+ keyProperty: node.keyProperty,
44
+ properties: Object.keys(this._schemaWriter.propertiesOf(node.type, []))
45
+ }]));
46
+ const edgesByClass = new Map();
47
+ const edgesByType = new Map();
48
+ for (const edge of model.edges) {
49
+ const info = this.edgeInfo(edge, nodes);
50
+ edgesByClass.set(edge.type, info);
51
+ edgesByType.set(edge.edgeType, info);
52
+ }
53
+ const declared = new Set(views);
54
+ const names = new Set();
55
+ const resolved = new Map();
56
+ for (const type of views) {
57
+ try {
58
+ resolved.set(type, this.resolve(model.name, type, declared, names, nodes, edgesByClass, edgesByType));
59
+ }
60
+ catch (error) {
61
+ failures.set(type, error instanceof Error ? error : new Error(String(error)));
62
+ }
63
+ }
64
+ this.validateAcrossViews(resolved, edgesByType, failures);
65
+ if (failures.size > 0)
66
+ return { failures };
67
+ const definition = {
68
+ graph: model.name,
69
+ schema: {
70
+ nodes: [...nodes.values()].map(node => ({ label: node.label, key: node.keyProperty, properties: node.properties })),
71
+ edges: [...edgesByType.values()].map(edge => ({
72
+ type: edge.edgeType,
73
+ source: edge.sourceLabel,
74
+ target: edge.targetLabel,
75
+ ...(edge.identifiedBy === undefined ? {} : { identifiedBy: edge.identifiedBy }),
76
+ properties: edge.properties
77
+ }))
78
+ },
79
+ views: [...resolved.values()]
80
+ .map(view => ({ name: view.name, root: view.node.label, members: view.members.map(member => this.member(member)) }))
81
+ .sort((left, right) => (left.name === right.name ? 0 : left.name < right.name ? -1 : 1))
82
+ };
83
+ return { definition, failures };
84
+ }
85
+ edgeInfo(edge, nodes) {
86
+ return {
87
+ edgeType: edge.edgeType,
88
+ identifiedBy: edge.identifyingProperty,
89
+ sourceLabel: nodes.get(edge.sourceNode)?.label ?? '',
90
+ targetLabel: nodes.get(edge.targetNode)?.label ?? '',
91
+ properties: Object.keys(this._schemaWriter.propertiesOf(edge.type, edge.excludedProperties))
92
+ };
93
+ }
94
+ resolve(graph, type, declared, names, nodes, edgesByClass, edgesByType) {
95
+ const metadata = getViewOfMetadata(type);
96
+ const name = metadata.name;
97
+ const duplicate = names.has(name);
98
+ names.add(name);
99
+ if (isGraphElement(type))
100
+ throw new ViewIsAlsoSchema(type);
101
+ if (duplicate)
102
+ throw new DuplicateViewName(type, graph, name);
103
+ const rootType = metadata.root();
104
+ const node = nodes.get(rootType);
105
+ if (node === undefined)
106
+ throw new ViewRootNotANode(type, graph, rootType);
107
+ const members = [];
108
+ for (const property of TypeIntrospector.getTrackedProperties(type)) {
109
+ const member = getGraphViewMemberMetadata(type.prototype, property);
110
+ if (member === undefined)
111
+ continue;
112
+ const requested = member.source ?? property;
113
+ switch (member.kind) {
114
+ case GraphViewMemberKind.Property: {
115
+ const source = member.isKey ? node.keyProperty : this.find(node.properties, requested);
116
+ if (source === undefined)
117
+ throw new UnknownNodeProperty(type, property, node.label, requested);
118
+ members.push({ kind: GraphViewMemberKind.Property, name: property, source });
119
+ break;
120
+ }
121
+ case GraphViewMemberKind.EdgeProperty:
122
+ members.push({ kind: GraphViewMemberKind.EdgeProperty, name: property, requested });
123
+ break;
124
+ case GraphViewMemberKind.Relation: {
125
+ const edge = this.edgeOf(member.edge, edgesByClass, edgesByType);
126
+ if (edge === undefined)
127
+ throw new UnknownEdge(type, property, this.edgeName(member.edge));
128
+ const direction = this.directionOf(type, property, edge, node, member.direction);
129
+ const target = member.view();
130
+ if (!declared.has(target))
131
+ throw new RelationTargetNotAView(type, property, target);
132
+ const expected = direction === GraphEdgeDirection.Outgoing ? edge.targetLabel : edge.sourceLabel;
133
+ const actual = nodes.get(getViewOfMetadata(target).root())?.label;
134
+ if (actual !== undefined && actual !== expected)
135
+ throw new TargetLabelMismatch(type, property, target, expected, actual);
136
+ members.push({
137
+ kind: GraphViewMemberKind.Relation,
138
+ name: property,
139
+ edge,
140
+ direction,
141
+ cardinality: member.cardinality ?? GraphViewCardinality.Many,
142
+ target,
143
+ targetName: getViewOfMetadata(target).name
144
+ });
145
+ break;
146
+ }
147
+ }
148
+ }
149
+ return { type, name, node, members };
150
+ }
151
+ directionOf(type, member, edge, node, explicit) {
152
+ const outgoing = edge.sourceLabel === node.label;
153
+ const incoming = edge.targetLabel === node.label;
154
+ if (!outgoing && !incoming)
155
+ throw new EdgeNotIncidentOnRoot(type, member, edge.edgeType, node.label);
156
+ if (outgoing && incoming) {
157
+ if (explicit === undefined)
158
+ throw new AmbiguousDirection(type, member, edge.edgeType);
159
+ return explicit;
160
+ }
161
+ const derived = outgoing ? GraphEdgeDirection.Outgoing : GraphEdgeDirection.Incoming;
162
+ // An explicit direction the edge cannot be followed in does not start at the root of the view.
163
+ if (explicit !== undefined && explicit !== derived)
164
+ throw new EdgeNotIncidentOnRoot(type, member, edge.edgeType, node.label);
165
+ return derived;
166
+ }
167
+ validateAcrossViews(resolved, edgesByType, failures) {
168
+ const used = new Map();
169
+ for (const view of resolved.values()) {
170
+ for (const member of view.members) {
171
+ if (member.kind !== GraphViewMemberKind.Relation)
172
+ continue;
173
+ const edges = used.get(member.target) ?? new Set();
174
+ edges.add(member.edge.edgeType);
175
+ used.set(member.target, edges);
176
+ }
177
+ }
178
+ for (const view of resolved.values()) {
179
+ try {
180
+ const cycle = this.cycleThrough(view, resolved);
181
+ if (cycle !== undefined)
182
+ throw new RecursiveView(view.type, cycle);
183
+ this.validateEdgeProperties(view, used.get(view.type), edgesByType);
184
+ }
185
+ catch (error) {
186
+ failures.set(view.type, error instanceof Error ? error : new Error(String(error)));
187
+ }
188
+ }
189
+ }
190
+ validateEdgeProperties(view, edges, edgesByType) {
191
+ const members = view.members.filter((member) => member.kind === GraphViewMemberKind.EdgeProperty);
192
+ if (members.length === 0)
193
+ return;
194
+ if (edges === undefined || edges.size === 0)
195
+ throw new EdgePropertyViewNotUsedAsTarget(view.type);
196
+ if (edges.size > 1)
197
+ throw new EdgePropertyViewSharedAcrossEdges(view.type, [...edges]);
198
+ const edge = edgesByType.get([...edges][0]);
199
+ for (const member of members) {
200
+ member.source = this.find(edge.properties, member.requested);
201
+ if (member.source === undefined)
202
+ throw new UnknownEdgeProperty(view.type, member.name, edge.edgeType, member.requested);
203
+ }
204
+ }
205
+ cycleThrough(start, resolved) {
206
+ const visited = new Set();
207
+ const walk = (current, path) => {
208
+ for (const member of current.members) {
209
+ if (member.kind !== GraphViewMemberKind.Relation)
210
+ continue;
211
+ const next = resolved.get(member.target);
212
+ if (next === undefined)
213
+ continue;
214
+ if (next === start)
215
+ return [...path, next.name];
216
+ if (visited.has(next.type))
217
+ continue;
218
+ visited.add(next.type);
219
+ const found = walk(next, [...path, next.name]);
220
+ if (found !== undefined)
221
+ return found;
222
+ }
223
+ return undefined;
224
+ };
225
+ return walk(start, [start.name]);
226
+ }
227
+ member(member) {
228
+ switch (member.kind) {
229
+ case GraphViewMemberKind.Relation:
230
+ return {
231
+ name: member.name,
232
+ kind: member.kind,
233
+ edge: member.edge.edgeType,
234
+ direction: member.direction,
235
+ cardinality: member.cardinality,
236
+ view: member.targetName
237
+ };
238
+ case GraphViewMemberKind.EdgeProperty:
239
+ return { name: member.name, kind: member.kind, source: member.source };
240
+ default:
241
+ return { name: member.name, kind: member.kind, source: member.source };
242
+ }
243
+ }
244
+ edgeOf(reference, edgesByClass, edgesByType) {
245
+ return typeof reference === 'string' ? edgesByType.get(reference) : edgesByClass.get(reference());
246
+ }
247
+ edgeName(reference) {
248
+ if (typeof reference === 'string')
249
+ return reference;
250
+ const type = reference();
251
+ return getEdgeMetadata(type)?.type ?? type.name;
252
+ }
253
+ // Names are matched without regard to case, and an exact match wins.
254
+ find(names, wanted) {
255
+ const lowered = wanted.toLowerCase();
256
+ return names.find(name => name === wanted) ?? names.find(name => name.toLowerCase() === lowered);
257
+ }
258
+ }
259
+ //# sourceMappingURL=GraphViewDefinitionBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphViewDefinitionBuilder.js","sourceRoot":"","sources":["../../../../projections/graphs/views/GraphViewDefinitionBuilder.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAGrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EA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AE,MAAM,EAAE,MAAM,CAAC,MAAO,EAAE,CAAC;YAC5E;gBACI,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;QAC/E,CAAC;IACL,CAAC;IAEO,MAAM,CACV,SAAiC,EACjC,YAA6C,EAC7C,WAA0C;QAE1C,OAAO,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC;IACtG,CAAC;IAEO,QAAQ,CAAC,SAAiC;QAC9C,IAAI,OAAO,SAAS,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAC;QACpD,MAAM,IAAI,GAAG,SAAS,EAAE,CAAC;QACzB,OAAO,eAAe,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC;IACpD,CAAC;IAED,qEAAqE;IAC7D,IAAI,CAAC,KAAwB,EAAE,MAAc;QACjD,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,CAAC;IACrG,CAAC;CACJ"}
@@ -0,0 +1,21 @@
1
+ import type { GraphViewDefinition } from './GraphViewDefinition.js';
2
+ import type { GraphViewSerializerOptions } from './GraphViewSerializerOptions.js';
3
+ /**
4
+ * Serializes a {@link GraphViewDefinition} canonically. The text is the same for every client that declares the same
5
+ * views: LF line endings, two-space indentation, a fixed order of properties, the views sorted by name in ordinal
6
+ * order, the members in declaration order and one trailing newline.
7
+ */
8
+ export declare class GraphViewDefinitionSerializer {
9
+ /**
10
+ * Serializes a definition.
11
+ * @param definition - The {@link GraphViewDefinition}.
12
+ * @param options - Whether to include the schema, which is the form of the conformance fixture.
13
+ * @returns The canonical text.
14
+ */
15
+ serialize(definition: GraphViewDefinition, options?: GraphViewSerializerOptions): string;
16
+ private schema;
17
+ private view;
18
+ private member;
19
+ private compareOrdinal;
20
+ }
21
+ //# sourceMappingURL=GraphViewDefinitionSerializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphViewDefinitionSerializer.d.ts","sourceRoot":"","sources":["../../../../projections/graphs/views/GraphViewDefinitionSerializer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGpE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAElF;;;;GAIG;AACH,qBAAa,6BAA6B;IACtC;;;;;OAKG;IACH,SAAS,CAAC,UAAU,EAAE,mBAAmB,EAAE,OAAO,GAAE,0BAA+B,GAAG,MAAM,CAc3F;IAED,OAAO,CAAC,MAAM;IAkBd,OAAO,CAAC,IAAI;IAcZ,OAAO,CAAC,MAAM;IAed,OAAO,CAAC,cAAc;CAIzB"}
@@ -0,0 +1,77 @@
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
+ import { GraphViewMemberKind } from './GraphViewMemberKind.js';
4
+ /**
5
+ * Serializes a {@link GraphViewDefinition} canonically. The text is the same for every client that declares the same
6
+ * views: LF line endings, two-space indentation, a fixed order of properties, the views sorted by name in ordinal
7
+ * order, the members in declaration order and one trailing newline.
8
+ */
9
+ export class GraphViewDefinitionSerializer {
10
+ /**
11
+ * Serializes a definition.
12
+ * @param definition - The {@link GraphViewDefinition}.
13
+ * @param options - Whether to include the schema, which is the form of the conformance fixture.
14
+ * @returns The canonical text.
15
+ */
16
+ serialize(definition, options = {}) {
17
+ const views = [...definition.views].sort((left, right) => this.compareOrdinal(left.name, right.name));
18
+ const lines = ['{', ` "graph": ${JSON.stringify(definition.graph)},`];
19
+ if (options.includeSchema === true && definition.schema !== undefined)
20
+ lines.push(...this.schema(definition.schema));
21
+ if (views.length === 0) {
22
+ lines.push(' "views": []');
23
+ }
24
+ else {
25
+ lines.push(' "views": [');
26
+ views.forEach((view, index) => lines.push(...this.view(view, index < views.length - 1)));
27
+ lines.push(' ]');
28
+ }
29
+ lines.push('}');
30
+ return `${lines.join('\n')}\n`;
31
+ }
32
+ schema(schema) {
33
+ const list = (names) => (names.length === 0 ? '[]' : `[ ${names.map(name => JSON.stringify(name)).join(', ')} ]`);
34
+ const nodes = schema.nodes.map(node => `{ "label": ${JSON.stringify(node.label)}, "key": ${JSON.stringify(node.key)}, "properties": ${list(node.properties)} }`);
35
+ const edges = schema.edges.map(edge => {
36
+ const identity = edge.identifiedBy === undefined ? '' : ` "identifiedBy": ${JSON.stringify(edge.identifiedBy)},`;
37
+ return `{ "type": ${JSON.stringify(edge.type)}, "source": ${JSON.stringify(edge.source)}, "target": ${JSON.stringify(edge.target)},${identity} "properties": ${list(edge.properties)} }`;
38
+ });
39
+ const block = (name, entries, last) => [
40
+ entries.length === 0 ? ` "${name}": []${last ? '' : ','}` : ` "${name}": [`,
41
+ ...(entries.length === 0 ? [] : [
42
+ ...entries.map((entry, index) => ` ${entry}${index < entries.length - 1 ? ',' : ''}`),
43
+ ` ]${last ? '' : ','}`
44
+ ])
45
+ ];
46
+ return [' "schema": {', ...block('nodes', nodes, false), ...block('edges', edges, true), ' },'];
47
+ }
48
+ view(view, hasNext) {
49
+ const lines = [' {', ` "name": ${JSON.stringify(view.name)},`, ` "root": ${JSON.stringify(view.root)},`];
50
+ if (view.members.length === 0) {
51
+ lines.push(' "members": []');
52
+ }
53
+ else {
54
+ lines.push(' "members": [');
55
+ view.members.forEach((member, index) => lines.push(` ${this.member(member)}${index < view.members.length - 1 ? ',' : ''}`));
56
+ lines.push(' ]');
57
+ }
58
+ lines.push(hasNext ? ' },' : ' }');
59
+ return lines;
60
+ }
61
+ member(member) {
62
+ const parts = [`"name": ${JSON.stringify(member.name)}`, `"kind": ${JSON.stringify(member.kind)}`];
63
+ if (member.kind === GraphViewMemberKind.Relation) {
64
+ parts.push(`"edge": ${JSON.stringify(member.edge)}`, `"direction": ${JSON.stringify(member.direction)}`, `"cardinality": ${JSON.stringify(member.cardinality)}`, `"view": ${JSON.stringify(member.view)}`);
65
+ }
66
+ else {
67
+ parts.push(`"source": ${JSON.stringify(member.source)}`);
68
+ }
69
+ return `{ ${parts.join(', ')} }`;
70
+ }
71
+ compareOrdinal(left, right) {
72
+ if (left === right)
73
+ return 0;
74
+ return left < right ? -1 : 1;
75
+ }
76
+ }
77
+ //# sourceMappingURL=GraphViewDefinitionSerializer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphViewDefinitionSerializer.js","sourceRoot":"","sources":["../../../../projections/graphs/views/GraphViewDefinitionSerializer.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAO/D;;;;GAIG;AACH,MAAM,OAAO,6BAA6B;IACtC;;;;;OAKG;IACH,SAAS,CAAC,UAA+B,EAAE,OAAO,GAA+B,EAAE;QAC/E,MAAM,KAAK,GAAG,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACtG,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,cAAc,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvE,IAAI,OAAO,CAAC,aAAa,KAAK,IAAI,IAAI,UAAU,CAAC,MAAM,KAAK,SAAS;YAAE,KAAK,CAAC,IAAI,CAAC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,CAAC,IAAI,CACN,WAAW,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EACxC,gBAAgB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,EAClD,kBAAkB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,EACtD,WAAW,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClD,CAAC;aAAM,CAAC;YACJ,KAAK,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,OAAO,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACrC,CAAC;IAEO,cAAc,CAAC,IAAY,EAAE,KAAa;QAC9C,IAAI,IAAI,KAAK,KAAK;YAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;CACJ"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Names the edge a relation follows: a function returning the edge class, which is resolved when the views are
3
+ * validated so the classes can be declared in any order, or the edge type string, for example MEMBER_OF.
4
+ */
5
+ export type GraphViewEdgeReference = (() => Function) | string;
6
+ //# sourceMappingURL=GraphViewEdgeReference.d.ts.map