@cratis/chronicle 6.59.0 → 6.60.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 (359) hide show
  1. package/ChronicleClient.ts +1 -1
  2. package/ChronicleOptions.ts +11 -0
  3. package/EventStore.ts +9 -1
  4. package/IEventStore.ts +7 -0
  5. package/README.md +1 -1
  6. package/artifacts/DefaultClientArtifactsProvider.ts +13 -1
  7. package/artifacts/IClientArtifactsProvider.ts +6 -0
  8. package/dist/ChronicleClient.js +1 -1
  9. package/dist/ChronicleClient.js.map +1 -1
  10. package/dist/ChronicleOptions.d.ts +7 -0
  11. package/dist/ChronicleOptions.d.ts.map +1 -1
  12. package/dist/ChronicleOptions.js +8 -0
  13. package/dist/ChronicleOptions.js.map +1 -1
  14. package/dist/EventStore.d.ts +3 -1
  15. package/dist/EventStore.d.ts.map +1 -1
  16. package/dist/EventStore.js +7 -1
  17. package/dist/EventStore.js.map +1 -1
  18. package/dist/IEventStore.d.ts +6 -0
  19. package/dist/IEventStore.d.ts.map +1 -1
  20. package/dist/artifacts/DefaultClientArtifactsProvider.d.ts +4 -0
  21. package/dist/artifacts/DefaultClientArtifactsProvider.d.ts.map +1 -1
  22. package/dist/artifacts/DefaultClientArtifactsProvider.js +11 -1
  23. package/dist/artifacts/DefaultClientArtifactsProvider.js.map +1 -1
  24. package/dist/artifacts/IClientArtifactsProvider.d.ts +4 -0
  25. package/dist/artifacts/IClientArtifactsProvider.d.ts.map +1 -1
  26. package/dist/projections/Projections.d.ts.map +1 -1
  27. package/dist/projections/Projections.js +3 -30
  28. package/dist/projections/Projections.js.map +1 -1
  29. package/dist/projections/for_Graphs/given/a_discovered_graph.d.ts +29 -0
  30. package/dist/projections/for_Graphs/given/a_discovered_graph.d.ts.map +1 -0
  31. package/dist/projections/for_Graphs/given/a_discovered_graph.js +19 -0
  32. package/dist/projections/for_Graphs/given/a_discovered_graph.js.map +1 -0
  33. package/dist/projections/for_Graphs/given/a_fake_connection.d.ts +24 -0
  34. package/dist/projections/for_Graphs/given/a_fake_connection.d.ts.map +1 -0
  35. package/dist/projections/for_Graphs/given/a_fake_connection.js +17 -0
  36. package/dist/projections/for_Graphs/given/a_fake_connection.js.map +1 -0
  37. package/dist/projections/for_Graphs/given/organization.d.ts +43 -0
  38. package/dist/projections/for_Graphs/given/organization.d.ts.map +1 -0
  39. package/dist/projections/for_Graphs/given/organization.js +84 -0
  40. package/dist/projections/for_Graphs/given/organization.js.map +1 -0
  41. package/dist/projections/graphs/EdgeCanHaveOnlyOneIdentifyingKey.d.ts +11 -0
  42. package/dist/projections/graphs/EdgeCanHaveOnlyOneIdentifyingKey.d.ts.map +1 -0
  43. package/dist/projections/graphs/EdgeCanHaveOnlyOneIdentifyingKey.js +16 -0
  44. package/dist/projections/graphs/EdgeCanHaveOnlyOneIdentifyingKey.js.map +1 -0
  45. package/dist/projections/graphs/EdgeMustHaveOneSourceAndOneTarget.d.ts +11 -0
  46. package/dist/projections/graphs/EdgeMustHaveOneSourceAndOneTarget.d.ts.map +1 -0
  47. package/dist/projections/graphs/EdgeMustHaveOneSourceAndOneTarget.js +16 -0
  48. package/dist/projections/graphs/EdgeMustHaveOneSourceAndOneTarget.js.map +1 -0
  49. package/dist/projections/graphs/GraphDeclaredMoreThanOnce.d.ts +11 -0
  50. package/dist/projections/graphs/GraphDeclaredMoreThanOnce.d.ts.map +1 -0
  51. package/dist/projections/graphs/GraphDeclaredMoreThanOnce.js +16 -0
  52. package/dist/projections/graphs/GraphDeclaredMoreThanOnce.js.map +1 -0
  53. package/dist/projections/graphs/GraphDefinitionBuilder.d.ts +24 -0
  54. package/dist/projections/graphs/GraphDefinitionBuilder.d.ts.map +1 -0
  55. package/dist/projections/graphs/GraphDefinitionBuilder.js +145 -0
  56. package/dist/projections/graphs/GraphDefinitionBuilder.js.map +1 -0
  57. package/dist/projections/graphs/GraphEdgeBuilder.d.ts +41 -0
  58. package/dist/projections/graphs/GraphEdgeBuilder.d.ts.map +1 -0
  59. package/dist/projections/graphs/GraphEdgeBuilder.js +94 -0
  60. package/dist/projections/graphs/GraphEdgeBuilder.js.map +1 -0
  61. package/dist/projections/graphs/GraphEdgeFromBuilder.d.ts +25 -0
  62. package/dist/projections/graphs/GraphEdgeFromBuilder.d.ts.map +1 -0
  63. package/dist/projections/graphs/GraphEdgeFromBuilder.js +37 -0
  64. package/dist/projections/graphs/GraphEdgeFromBuilder.js.map +1 -0
  65. package/dist/projections/graphs/GraphEdgeFromModel.d.ts +16 -0
  66. package/dist/projections/graphs/GraphEdgeFromModel.d.ts.map +1 -0
  67. package/dist/projections/graphs/GraphEdgeFromModel.js +4 -0
  68. package/dist/projections/graphs/GraphEdgeFromModel.js.map +1 -0
  69. package/dist/projections/graphs/GraphEdgeModel.d.ts +24 -0
  70. package/dist/projections/graphs/GraphEdgeModel.d.ts.map +1 -0
  71. package/dist/projections/graphs/GraphEdgeModel.js +4 -0
  72. package/dist/projections/graphs/GraphEdgeModel.js.map +1 -0
  73. package/dist/projections/graphs/GraphEdgeRemovedWithBuilder.d.ts +21 -0
  74. package/dist/projections/graphs/GraphEdgeRemovedWithBuilder.d.ts.map +1 -0
  75. package/dist/projections/graphs/GraphEdgeRemovedWithBuilder.js +31 -0
  76. package/dist/projections/graphs/GraphEdgeRemovedWithBuilder.js.map +1 -0
  77. package/dist/projections/graphs/GraphEdgeRemovedWithModel.d.ts +14 -0
  78. package/dist/projections/graphs/GraphEdgeRemovedWithModel.d.ts.map +1 -0
  79. package/dist/projections/graphs/GraphEdgeRemovedWithModel.js +4 -0
  80. package/dist/projections/graphs/GraphEdgeRemovedWithModel.js.map +1 -0
  81. package/dist/projections/graphs/GraphElementCannotBeReadModel.d.ts +11 -0
  82. package/dist/projections/graphs/GraphElementCannotBeReadModel.d.ts.map +1 -0
  83. package/dist/projections/graphs/GraphElementCannotBeReadModel.js +16 -0
  84. package/dist/projections/graphs/GraphElementCannotBeReadModel.js.map +1 -0
  85. package/dist/projections/graphs/GraphHasDuplicateElement.d.ts +13 -0
  86. package/dist/projections/graphs/GraphHasDuplicateElement.d.ts.map +1 -0
  87. package/dist/projections/graphs/GraphHasDuplicateElement.js +18 -0
  88. package/dist/projections/graphs/GraphHasDuplicateElement.js.map +1 -0
  89. package/dist/projections/graphs/GraphKeyPropertyNotFound.d.ts +12 -0
  90. package/dist/projections/graphs/GraphKeyPropertyNotFound.d.ts.map +1 -0
  91. package/dist/projections/graphs/GraphKeyPropertyNotFound.js +17 -0
  92. package/dist/projections/graphs/GraphKeyPropertyNotFound.js.map +1 -0
  93. package/dist/projections/graphs/GraphMappingBuilder.d.ts +32 -0
  94. package/dist/projections/graphs/GraphMappingBuilder.d.ts.map +1 -0
  95. package/dist/projections/graphs/GraphMappingBuilder.js +48 -0
  96. package/dist/projections/graphs/GraphMappingBuilder.js.map +1 -0
  97. package/dist/projections/graphs/GraphMemberMappings.d.ts +8 -0
  98. package/dist/projections/graphs/GraphMemberMappings.d.ts.map +1 -0
  99. package/dist/projections/graphs/GraphMemberMappings.js +54 -0
  100. package/dist/projections/graphs/GraphMemberMappings.js.map +1 -0
  101. package/dist/projections/graphs/GraphModel.d.ts +15 -0
  102. package/dist/projections/graphs/GraphModel.d.ts.map +1 -0
  103. package/dist/projections/graphs/GraphModel.js +4 -0
  104. package/dist/projections/graphs/GraphModel.js.map +1 -0
  105. package/dist/projections/graphs/GraphNameRequired.d.ts +11 -0
  106. package/dist/projections/graphs/GraphNameRequired.d.ts.map +1 -0
  107. package/dist/projections/graphs/GraphNameRequired.js +16 -0
  108. package/dist/projections/graphs/GraphNameRequired.js.map +1 -0
  109. package/dist/projections/graphs/GraphNodeBuilder.d.ts +34 -0
  110. package/dist/projections/graphs/GraphNodeBuilder.d.ts.map +1 -0
  111. package/dist/projections/graphs/GraphNodeBuilder.js +66 -0
  112. package/dist/projections/graphs/GraphNodeBuilder.js.map +1 -0
  113. package/dist/projections/graphs/GraphNodeFromBuilder.d.ts +21 -0
  114. package/dist/projections/graphs/GraphNodeFromBuilder.d.ts.map +1 -0
  115. package/dist/projections/graphs/GraphNodeFromBuilder.js +30 -0
  116. package/dist/projections/graphs/GraphNodeFromBuilder.js.map +1 -0
  117. package/dist/projections/graphs/GraphNodeFromModel.d.ts +14 -0
  118. package/dist/projections/graphs/GraphNodeFromModel.d.ts.map +1 -0
  119. package/dist/projections/graphs/GraphNodeFromModel.js +4 -0
  120. package/dist/projections/graphs/GraphNodeFromModel.js.map +1 -0
  121. package/dist/projections/graphs/GraphNodeModel.d.ts +18 -0
  122. package/dist/projections/graphs/GraphNodeModel.d.ts.map +1 -0
  123. package/dist/projections/graphs/GraphNodeModel.js +4 -0
  124. package/dist/projections/graphs/GraphNodeModel.js.map +1 -0
  125. package/dist/projections/graphs/GraphNodeRemovedWithBuilder.d.ts +17 -0
  126. package/dist/projections/graphs/GraphNodeRemovedWithBuilder.d.ts.map +1 -0
  127. package/dist/projections/graphs/GraphNodeRemovedWithBuilder.js +24 -0
  128. package/dist/projections/graphs/GraphNodeRemovedWithBuilder.js.map +1 -0
  129. package/dist/projections/graphs/GraphNodeRemovedWithModel.d.ts +12 -0
  130. package/dist/projections/graphs/GraphNodeRemovedWithModel.d.ts.map +1 -0
  131. package/dist/projections/graphs/GraphNodeRemovedWithModel.js +4 -0
  132. package/dist/projections/graphs/GraphNodeRemovedWithModel.js.map +1 -0
  133. package/dist/projections/graphs/GraphProjectionBuilder.d.ts +25 -0
  134. package/dist/projections/graphs/GraphProjectionBuilder.d.ts.map +1 -0
  135. package/dist/projections/graphs/GraphProjectionBuilder.js +36 -0
  136. package/dist/projections/graphs/GraphProjectionBuilder.js.map +1 -0
  137. package/dist/projections/graphs/GraphRegistration.d.ts +14 -0
  138. package/dist/projections/graphs/GraphRegistration.d.ts.map +1 -0
  139. package/dist/projections/graphs/GraphRegistration.js +4 -0
  140. package/dist/projections/graphs/GraphRegistration.js.map +1 -0
  141. package/dist/projections/graphs/GraphSchemaWriter.d.ts +28 -0
  142. package/dist/projections/graphs/GraphSchemaWriter.d.ts.map +1 -0
  143. package/dist/projections/graphs/GraphSchemaWriter.js +76 -0
  144. package/dist/projections/graphs/GraphSchemaWriter.js.map +1 -0
  145. package/dist/projections/graphs/Graphs.d.ts +39 -0
  146. package/dist/projections/graphs/Graphs.d.ts.map +1 -0
  147. package/dist/projections/graphs/Graphs.js +144 -0
  148. package/dist/projections/graphs/Graphs.js.map +1 -0
  149. package/dist/projections/graphs/IGraphEdgeBuilder.d.ts +37 -0
  150. package/dist/projections/graphs/IGraphEdgeBuilder.d.ts.map +1 -0
  151. package/dist/projections/graphs/IGraphEdgeBuilder.js +4 -0
  152. package/dist/projections/graphs/IGraphEdgeBuilder.js.map +1 -0
  153. package/dist/projections/graphs/IGraphEdgeFromBuilder.d.ts +29 -0
  154. package/dist/projections/graphs/IGraphEdgeFromBuilder.d.ts.map +1 -0
  155. package/dist/projections/graphs/IGraphEdgeFromBuilder.js +4 -0
  156. package/dist/projections/graphs/IGraphEdgeFromBuilder.js.map +1 -0
  157. package/dist/projections/graphs/IGraphEdgeRemovedWithBuilder.d.ts +27 -0
  158. package/dist/projections/graphs/IGraphEdgeRemovedWithBuilder.d.ts.map +1 -0
  159. package/dist/projections/graphs/IGraphEdgeRemovedWithBuilder.js +4 -0
  160. package/dist/projections/graphs/IGraphEdgeRemovedWithBuilder.js.map +1 -0
  161. package/dist/projections/graphs/IGraphMappingBuilder.d.ts +49 -0
  162. package/dist/projections/graphs/IGraphMappingBuilder.d.ts.map +1 -0
  163. package/dist/projections/graphs/IGraphMappingBuilder.js +4 -0
  164. package/dist/projections/graphs/IGraphMappingBuilder.js.map +1 -0
  165. package/dist/projections/graphs/IGraphNodeBuilder.d.ts +32 -0
  166. package/dist/projections/graphs/IGraphNodeBuilder.d.ts.map +1 -0
  167. package/dist/projections/graphs/IGraphNodeBuilder.js +4 -0
  168. package/dist/projections/graphs/IGraphNodeBuilder.js.map +1 -0
  169. package/dist/projections/graphs/IGraphNodeFromBuilder.d.ts +21 -0
  170. package/dist/projections/graphs/IGraphNodeFromBuilder.d.ts.map +1 -0
  171. package/dist/projections/graphs/IGraphNodeFromBuilder.js +4 -0
  172. package/dist/projections/graphs/IGraphNodeFromBuilder.js.map +1 -0
  173. package/dist/projections/graphs/IGraphNodeRemovedWithBuilder.d.ts +19 -0
  174. package/dist/projections/graphs/IGraphNodeRemovedWithBuilder.d.ts.map +1 -0
  175. package/dist/projections/graphs/IGraphNodeRemovedWithBuilder.js +4 -0
  176. package/dist/projections/graphs/IGraphNodeRemovedWithBuilder.js.map +1 -0
  177. package/dist/projections/graphs/IGraphProjection.d.ts +13 -0
  178. package/dist/projections/graphs/IGraphProjection.d.ts.map +1 -0
  179. package/dist/projections/graphs/IGraphProjection.js +4 -0
  180. package/dist/projections/graphs/IGraphProjection.js.map +1 -0
  181. package/dist/projections/graphs/IGraphProjectionBuilder.d.ts +26 -0
  182. package/dist/projections/graphs/IGraphProjectionBuilder.d.ts.map +1 -0
  183. package/dist/projections/graphs/IGraphProjectionBuilder.js +4 -0
  184. package/dist/projections/graphs/IGraphProjectionBuilder.js.map +1 -0
  185. package/dist/projections/graphs/IGraphs.d.ts +27 -0
  186. package/dist/projections/graphs/IGraphs.d.ts.map +1 -0
  187. package/dist/projections/graphs/IGraphs.js +4 -0
  188. package/dist/projections/graphs/IGraphs.js.map +1 -0
  189. package/dist/projections/graphs/ModelBoundGraphReader.d.ts +30 -0
  190. package/dist/projections/graphs/ModelBoundGraphReader.d.ts.map +1 -0
  191. package/dist/projections/graphs/ModelBoundGraphReader.js +112 -0
  192. package/dist/projections/graphs/ModelBoundGraphReader.js.map +1 -0
  193. package/dist/projections/graphs/NestedObjectInGraph.d.ts +12 -0
  194. package/dist/projections/graphs/NestedObjectInGraph.d.ts.map +1 -0
  195. package/dist/projections/graphs/NestedObjectInGraph.js +17 -0
  196. package/dist/projections/graphs/NestedObjectInGraph.js.map +1 -0
  197. package/dist/projections/graphs/NodeMustHaveExactlyOneKey.d.ts +12 -0
  198. package/dist/projections/graphs/NodeMustHaveExactlyOneKey.d.ts.map +1 -0
  199. package/dist/projections/graphs/NodeMustHaveExactlyOneKey.js +17 -0
  200. package/dist/projections/graphs/NodeMustHaveExactlyOneKey.js.map +1 -0
  201. package/dist/projections/graphs/UnknownGraphEventProperty.d.ts +13 -0
  202. package/dist/projections/graphs/UnknownGraphEventProperty.d.ts.map +1 -0
  203. package/dist/projections/graphs/UnknownGraphEventProperty.js +18 -0
  204. package/dist/projections/graphs/UnknownGraphEventProperty.js.map +1 -0
  205. package/dist/projections/graphs/UnknownGraphNode.d.ts +12 -0
  206. package/dist/projections/graphs/UnknownGraphNode.d.ts.map +1 -0
  207. package/dist/projections/graphs/UnknownGraphNode.js +17 -0
  208. package/dist/projections/graphs/UnknownGraphNode.js.map +1 -0
  209. package/dist/projections/graphs/edge.d.ts +23 -0
  210. package/dist/projections/graphs/edge.d.ts.map +1 -0
  211. package/dist/projections/graphs/edge.js +29 -0
  212. package/dist/projections/graphs/edge.js.map +1 -0
  213. package/dist/projections/graphs/edgeFrom.d.ts +31 -0
  214. package/dist/projections/graphs/edgeFrom.d.ts.map +1 -0
  215. package/dist/projections/graphs/edgeFrom.js +26 -0
  216. package/dist/projections/graphs/edgeFrom.js.map +1 -0
  217. package/dist/projections/graphs/edgeRemovedWith.d.ts +22 -0
  218. package/dist/projections/graphs/edgeRemovedWith.d.ts.map +1 -0
  219. package/dist/projections/graphs/edgeRemovedWith.js +25 -0
  220. package/dist/projections/graphs/edgeRemovedWith.js.map +1 -0
  221. package/dist/projections/graphs/edgeSource.d.ts +22 -0
  222. package/dist/projections/graphs/edgeSource.d.ts.map +1 -0
  223. package/dist/projections/graphs/edgeSource.js +30 -0
  224. package/dist/projections/graphs/edgeSource.js.map +1 -0
  225. package/dist/projections/graphs/edgeTarget.d.ts +22 -0
  226. package/dist/projections/graphs/edgeTarget.d.ts.map +1 -0
  227. package/dist/projections/graphs/edgeTarget.js +30 -0
  228. package/dist/projections/graphs/edgeTarget.js.map +1 -0
  229. package/dist/projections/graphs/graph.d.ts +16 -0
  230. package/dist/projections/graphs/graph.d.ts.map +1 -0
  231. package/dist/projections/graphs/graph.js +24 -0
  232. package/dist/projections/graphs/graph.js.map +1 -0
  233. package/dist/projections/graphs/graphKey.d.ts +16 -0
  234. package/dist/projections/graphs/graphKey.d.ts.map +1 -0
  235. package/dist/projections/graphs/graphKey.js +28 -0
  236. package/dist/projections/graphs/graphKey.js.map +1 -0
  237. package/dist/projections/graphs/graphProjection.d.ts +21 -0
  238. package/dist/projections/graphs/graphProjection.d.ts.map +1 -0
  239. package/dist/projections/graphs/graphProjection.js +28 -0
  240. package/dist/projections/graphs/graphProjection.js.map +1 -0
  241. package/dist/projections/graphs/index.d.ts +48 -0
  242. package/dist/projections/graphs/index.d.ts.map +1 -0
  243. package/dist/projections/graphs/index.js +27 -0
  244. package/dist/projections/graphs/index.js.map +1 -0
  245. package/dist/projections/graphs/isGraphElement.d.ts +7 -0
  246. package/dist/projections/graphs/isGraphElement.d.ts.map +1 -0
  247. package/dist/projections/graphs/isGraphElement.js +13 -0
  248. package/dist/projections/graphs/isGraphElement.js.map +1 -0
  249. package/dist/projections/graphs/node.d.ts +22 -0
  250. package/dist/projections/graphs/node.d.ts.map +1 -0
  251. package/dist/projections/graphs/node.js +29 -0
  252. package/dist/projections/graphs/node.js.map +1 -0
  253. package/dist/projections/graphs/nodeFrom.d.ts +31 -0
  254. package/dist/projections/graphs/nodeFrom.d.ts.map +1 -0
  255. package/dist/projections/graphs/nodeFrom.js +26 -0
  256. package/dist/projections/graphs/nodeFrom.js.map +1 -0
  257. package/dist/projections/graphs/nodeRemovedWith.d.ts +28 -0
  258. package/dist/projections/graphs/nodeRemovedWith.d.ts.map +1 -0
  259. package/dist/projections/graphs/nodeRemovedWith.js +25 -0
  260. package/dist/projections/graphs/nodeRemovedWith.js.map +1 -0
  261. package/dist/projections/graphs/propertyPathOf.d.ts +8 -0
  262. package/dist/projections/graphs/propertyPathOf.d.ts.map +1 -0
  263. package/dist/projections/graphs/propertyPathOf.js +14 -0
  264. package/dist/projections/graphs/propertyPathOf.js.map +1 -0
  265. package/dist/projections/index.d.ts +1 -0
  266. package/dist/projections/index.d.ts.map +1 -1
  267. package/dist/projections/index.js +1 -0
  268. package/dist/projections/index.js.map +1 -1
  269. package/dist/projections/registerProjectionWithRetry.d.ts +15 -0
  270. package/dist/projections/registerProjectionWithRetry.d.ts.map +1 -0
  271. package/dist/projections/registerProjectionWithRetry.js +44 -0
  272. package/dist/projections/registerProjectionWithRetry.js.map +1 -0
  273. package/dist/readModels/rootReadModelTypes.d.ts.map +1 -1
  274. package/dist/readModels/rootReadModelTypes.js +3 -1
  275. package/dist/readModels/rootReadModelTypes.js.map +1 -1
  276. package/dist/sinks/WellKnownSinks.d.ts +4 -0
  277. package/dist/sinks/WellKnownSinks.d.ts.map +1 -1
  278. package/dist/sinks/WellKnownSinks.js +5 -1
  279. package/dist/sinks/WellKnownSinks.js.map +1 -1
  280. package/dist/tsconfig.tsbuildinfo +1 -1
  281. package/dist/types/DecoratorType.d.ts +5 -1
  282. package/dist/types/DecoratorType.d.ts.map +1 -1
  283. package/dist/types/DecoratorType.js +4 -0
  284. package/dist/types/DecoratorType.js.map +1 -1
  285. package/for_ChronicleOptions/when_configuring_the_graph_sink/with_graph_sink_type.spec.ts +22 -0
  286. package/package.json +3 -3
  287. package/projections/Projections.ts +4 -29
  288. package/projections/for_Graphs/given/a_discovered_graph.ts +21 -0
  289. package/projections/for_Graphs/given/a_fake_connection.ts +19 -0
  290. package/projections/for_Graphs/given/organization.ts +96 -0
  291. package/projections/for_Graphs/when_building_a_fluent_graph.spec.ts +112 -0
  292. package/projections/for_Graphs/when_building_a_model_bound_graph.spec.ts +91 -0
  293. package/projections/for_Graphs/when_declaring_an_edge_with_an_identity.spec.ts +137 -0
  294. package/projections/for_Graphs/when_declaring_an_invalid_graph.spec.ts +199 -0
  295. package/projections/for_Graphs/when_declaring_with_standard_decorators.standard.spec.ts +92 -0
  296. package/projections/for_Graphs/when_discovering_graph_elements.spec.ts +32 -0
  297. package/projections/for_Graphs/when_mapping_properties.spec.ts +159 -0
  298. package/projections/for_Graphs/when_registering_graphs.spec.ts +56 -0
  299. package/projections/graphs/EdgeCanHaveOnlyOneIdentifyingKey.ts +16 -0
  300. package/projections/graphs/EdgeMustHaveOneSourceAndOneTarget.ts +16 -0
  301. package/projections/graphs/GraphDeclaredMoreThanOnce.ts +16 -0
  302. package/projections/graphs/GraphDefinitionBuilder.ts +166 -0
  303. package/projections/graphs/GraphEdgeBuilder.ts +107 -0
  304. package/projections/graphs/GraphEdgeFromBuilder.ts +47 -0
  305. package/projections/graphs/GraphEdgeFromModel.ts +22 -0
  306. package/projections/graphs/GraphEdgeModel.ts +34 -0
  307. package/projections/graphs/GraphEdgeRemovedWithBuilder.ts +39 -0
  308. package/projections/graphs/GraphEdgeRemovedWithModel.ts +19 -0
  309. package/projections/graphs/GraphElementCannotBeReadModel.ts +16 -0
  310. package/projections/graphs/GraphHasDuplicateElement.ts +18 -0
  311. package/projections/graphs/GraphKeyPropertyNotFound.ts +17 -0
  312. package/projections/graphs/GraphMappingBuilder.ts +65 -0
  313. package/projections/graphs/GraphMemberMappings.ts +57 -0
  314. package/projections/graphs/GraphModel.ts +20 -0
  315. package/projections/graphs/GraphNameRequired.ts +16 -0
  316. package/projections/graphs/GraphNodeBuilder.ts +76 -0
  317. package/projections/graphs/GraphNodeFromBuilder.ts +38 -0
  318. package/projections/graphs/GraphNodeFromModel.ts +19 -0
  319. package/projections/graphs/GraphNodeModel.ts +25 -0
  320. package/projections/graphs/GraphNodeRemovedWithBuilder.ts +30 -0
  321. package/projections/graphs/GraphNodeRemovedWithModel.ts +16 -0
  322. package/projections/graphs/GraphProjectionBuilder.ts +52 -0
  323. package/projections/graphs/GraphRegistration.ts +19 -0
  324. package/projections/graphs/GraphSchemaWriter.ts +80 -0
  325. package/projections/graphs/Graphs.ts +165 -0
  326. package/projections/graphs/IGraphEdgeBuilder.ts +43 -0
  327. package/projections/graphs/IGraphEdgeFromBuilder.ts +34 -0
  328. package/projections/graphs/IGraphEdgeRemovedWithBuilder.ts +32 -0
  329. package/projections/graphs/IGraphMappingBuilder.ts +57 -0
  330. package/projections/graphs/IGraphNodeBuilder.ts +37 -0
  331. package/projections/graphs/IGraphNodeFromBuilder.ts +25 -0
  332. package/projections/graphs/IGraphNodeRemovedWithBuilder.ts +23 -0
  333. package/projections/graphs/IGraphProjection.ts +16 -0
  334. package/projections/graphs/IGraphProjectionBuilder.ts +34 -0
  335. package/projections/graphs/IGraphs.ts +33 -0
  336. package/projections/graphs/ModelBoundGraphReader.ts +119 -0
  337. package/projections/graphs/NestedObjectInGraph.ts +17 -0
  338. package/projections/graphs/NodeMustHaveExactlyOneKey.ts +17 -0
  339. package/projections/graphs/UnknownGraphEventProperty.ts +18 -0
  340. package/projections/graphs/UnknownGraphNode.ts +17 -0
  341. package/projections/graphs/edge.ts +40 -0
  342. package/projections/graphs/edgeFrom.ts +48 -0
  343. package/projections/graphs/edgeRemovedWith.ts +36 -0
  344. package/projections/graphs/edgeSource.ts +39 -0
  345. package/projections/graphs/edgeTarget.ts +39 -0
  346. package/projections/graphs/graph.ts +28 -0
  347. package/projections/graphs/graphKey.ts +31 -0
  348. package/projections/graphs/graphProjection.ts +39 -0
  349. package/projections/graphs/index.ts +50 -0
  350. package/projections/graphs/isGraphElement.ts +14 -0
  351. package/projections/graphs/node.ts +40 -0
  352. package/projections/graphs/nodeFrom.ts +48 -0
  353. package/projections/graphs/nodeRemovedWith.ts +44 -0
  354. package/projections/graphs/propertyPathOf.ts +15 -0
  355. package/projections/index.ts +1 -0
  356. package/projections/registerProjectionWithRetry.ts +53 -0
  357. package/readModels/rootReadModelTypes.ts +3 -1
  358. package/sinks/WellKnownSinks.ts +7 -1
  359. package/types/DecoratorType.ts +7 -1
@@ -0,0 +1,26 @@
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 'reflect-metadata';
4
+ const METADATA_KEY = 'chronicle:graph:edgeFrom';
5
+ /**
6
+ * Class decorator that creates or updates an edge when an event is observed. Both end nodes are created without
7
+ * properties when they do not exist.
8
+ * @param eventType - The event constructor.
9
+ * @param options - The event properties that hold the keys of the end nodes and, optionally, the identity of the edge.
10
+ * @returns A class decorator.
11
+ */
12
+ export function edgeFrom(eventType, options) {
13
+ return (target) => {
14
+ const existing = Reflect.getMetadata(METADATA_KEY, target) ?? [];
15
+ Reflect.defineMetadata(METADATA_KEY, [...existing, { eventType, ...options }], target);
16
+ };
17
+ }
18
+ /**
19
+ * Retrieves all edgeFrom metadata stored on the given class constructor.
20
+ * @param target - The class constructor.
21
+ * @returns An array of edgeFrom metadata entries.
22
+ */
23
+ export function getEdgeFromMetadata(target) {
24
+ return Reflect.getMetadata(METADATA_KEY, target) ?? [];
25
+ }
26
+ //# sourceMappingURL=edgeFrom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edgeFrom.js","sourceRoot":"","sources":["../../../projections/graphs/edgeFrom.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAqB1B,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,SAAmB,EAAE,OAAwB;IAClE,OAAO,CAAC,MAAc,EAAE,EAAE;QACtB,MAAM,QAAQ,GAAuB,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;QACrF,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC,GAAG,QAAQ,EAAE,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAC3F,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAgB;IAChD,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,22 @@
1
+ import 'reflect-metadata';
2
+ import type { ChronicleClassDecorator } from '../../types/standardDecoratorMetadata.js';
3
+ import type { EdgeFromOptions } from './edgeFrom.js';
4
+ /** Metadata stored by the edgeRemovedWith class decorator. */
5
+ export interface EdgeRemovedWithMetadata extends EdgeFromOptions {
6
+ /** The event constructor. */
7
+ readonly eventType: Function;
8
+ }
9
+ /**
10
+ * Class decorator that deletes an edge when an event is observed. The nodes at both ends stay.
11
+ * @param eventType - The event constructor.
12
+ * @param options - The event properties that hold the keys of the end nodes and, optionally, the identity of the edge.
13
+ * @returns A class decorator.
14
+ */
15
+ export declare function edgeRemovedWith(eventType: Function, options: EdgeFromOptions): ChronicleClassDecorator;
16
+ /**
17
+ * Retrieves all edgeRemovedWith metadata stored on the given class constructor.
18
+ * @param target - The class constructor.
19
+ * @returns An array of edgeRemovedWith metadata entries.
20
+ */
21
+ export declare function getEdgeRemovedWithMetadata(target: Function): EdgeRemovedWithMetadata[];
22
+ //# sourceMappingURL=edgeRemovedWith.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edgeRemovedWith.d.ts","sourceRoot":"","sources":["../../../projections/graphs/edgeRemovedWith.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,8DAA8D;AAC9D,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC5D,6BAA6B;IAC7B,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;CAChC;AAID;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,GAAG,uBAAuB,CAKtG;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,QAAQ,GAAG,uBAAuB,EAAE,CAEtF"}
@@ -0,0 +1,25 @@
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 'reflect-metadata';
4
+ const METADATA_KEY = 'chronicle:graph:edgeRemovedWith';
5
+ /**
6
+ * Class decorator that deletes an edge when an event is observed. The nodes at both ends stay.
7
+ * @param eventType - The event constructor.
8
+ * @param options - The event properties that hold the keys of the end nodes and, optionally, the identity of the edge.
9
+ * @returns A class decorator.
10
+ */
11
+ export function edgeRemovedWith(eventType, options) {
12
+ return (target) => {
13
+ const existing = Reflect.getMetadata(METADATA_KEY, target) ?? [];
14
+ Reflect.defineMetadata(METADATA_KEY, [...existing, { eventType, ...options }], target);
15
+ };
16
+ }
17
+ /**
18
+ * Retrieves all edgeRemovedWith metadata stored on the given class constructor.
19
+ * @param target - The class constructor.
20
+ * @returns An array of edgeRemovedWith metadata entries.
21
+ */
22
+ export function getEdgeRemovedWithMetadata(target) {
23
+ return Reflect.getMetadata(METADATA_KEY, target) ?? [];
24
+ }
25
+ //# sourceMappingURL=edgeRemovedWith.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edgeRemovedWith.js","sourceRoot":"","sources":["../../../projections/graphs/edgeRemovedWith.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAU1B,MAAM,YAAY,GAAG,iCAAiC,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,SAAmB,EAAE,OAAwB;IACzE,OAAO,CAAC,MAAc,EAAE,EAAE;QACtB,MAAM,QAAQ,GAA8B,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;QAC5F,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC,GAAG,QAAQ,EAAE,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAC3F,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAgB;IACvD,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,22 @@
1
+ import 'reflect-metadata';
2
+ import { ChroniclePropertyDecorator } from '../../types/propertyDecoratorMetadata.js';
3
+ /** Metadata stored by the edgeSource property decorator. */
4
+ export interface EdgeSourceMetadata {
5
+ /** The type of the node. */
6
+ readonly nodeType: Function;
7
+ }
8
+ /**
9
+ * Property decorator that marks the member of an edge that holds the key of the node the edge starts at.
10
+ * The member is not a property of the edge.
11
+ * @param nodeType - The type of the node.
12
+ * @returns A property decorator.
13
+ */
14
+ export declare function edgeSource(nodeType: Function): ChroniclePropertyDecorator;
15
+ /**
16
+ * Retrieves the metadata stored by the edgeSource decorator on a property.
17
+ * @param target - The class prototype.
18
+ * @param propertyKey - The property name.
19
+ * @returns The metadata, or undefined when the property is not marked.
20
+ */
21
+ export declare function getEdgeSourceMetadata(target: object, propertyKey: string): EdgeSourceMetadata | undefined;
22
+ //# sourceMappingURL=edgeSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edgeSource.d.ts","sourceRoot":"","sources":["../../../projections/graphs/edgeSource.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,0BAA0B,EAAyC,MAAM,0CAA0C,CAAC;AAE7H,4DAA4D;AAC5D,MAAM,WAAW,kBAAkB;IAC/B,4BAA4B;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC/B;AAID;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,0BAA0B,CAOzE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAEzG"}
@@ -0,0 +1,30 @@
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 'reflect-metadata';
4
+ import { TypeIntrospector } from '../../types/index.js';
5
+ import { decorateProperty, getPropertyMetadata } from '../../types/propertyDecoratorMetadata.js';
6
+ const METADATA_KEY = 'chronicle:graph:edgeSource';
7
+ /**
8
+ * Property decorator that marks the member of an edge that holds the key of the node the edge starts at.
9
+ * The member is not a property of the edge.
10
+ * @param nodeType - The type of the node.
11
+ * @returns A property decorator.
12
+ */
13
+ export function edgeSource(nodeType) {
14
+ return decorateProperty((target, propertyKey) => {
15
+ const key = propertyKey.toString();
16
+ TypeIntrospector.trackProperty(target.constructor, key);
17
+ const metadata = { nodeType };
18
+ Reflect.defineMetadata(METADATA_KEY, metadata, target, key);
19
+ });
20
+ }
21
+ /**
22
+ * Retrieves the metadata stored by the edgeSource decorator on a property.
23
+ * @param target - The class prototype.
24
+ * @param propertyKey - The property name.
25
+ * @returns The metadata, or undefined when the property is not marked.
26
+ */
27
+ export function getEdgeSourceMetadata(target, propertyKey) {
28
+ return getPropertyMetadata(METADATA_KEY, target, propertyKey);
29
+ }
30
+ //# sourceMappingURL=edgeSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edgeSource.js","sourceRoot":"","sources":["../../../projections/graphs/edgeSource.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAA8B,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAQ7H,MAAM,YAAY,GAAG,4BAA4B,CAAC;AAElD;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,QAAkB;IACzC,OAAO,gBAAgB,CAAC,CAAC,MAAc,EAAE,WAA4B,EAAE,EAAE;QACrE,MAAM,GAAG,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QACnC,gBAAgB,CAAC,aAAa,CAAE,MAAoC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACvF,MAAM,QAAQ,GAAuB,EAAE,QAAQ,EAAE,CAAC;QAClD,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAc,EAAE,WAAmB;IACrE,OAAO,mBAAmB,CAAqB,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AACtF,CAAC"}
@@ -0,0 +1,22 @@
1
+ import 'reflect-metadata';
2
+ import { ChroniclePropertyDecorator } from '../../types/propertyDecoratorMetadata.js';
3
+ /** Metadata stored by the edgeTarget property decorator. */
4
+ export interface EdgeTargetMetadata {
5
+ /** The type of the node. */
6
+ readonly nodeType: Function;
7
+ }
8
+ /**
9
+ * Property decorator that marks the member of an edge that holds the key of the node the edge ends at.
10
+ * The member is not a property of the edge.
11
+ * @param nodeType - The type of the node.
12
+ * @returns A property decorator.
13
+ */
14
+ export declare function edgeTarget(nodeType: Function): ChroniclePropertyDecorator;
15
+ /**
16
+ * Retrieves the metadata stored by the edgeTarget decorator on a property.
17
+ * @param target - The class prototype.
18
+ * @param propertyKey - The property name.
19
+ * @returns The metadata, or undefined when the property is not marked.
20
+ */
21
+ export declare function getEdgeTargetMetadata(target: object, propertyKey: string): EdgeTargetMetadata | undefined;
22
+ //# sourceMappingURL=edgeTarget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edgeTarget.d.ts","sourceRoot":"","sources":["../../../projections/graphs/edgeTarget.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,0BAA0B,EAAyC,MAAM,0CAA0C,CAAC;AAE7H,4DAA4D;AAC5D,MAAM,WAAW,kBAAkB;IAC/B,4BAA4B;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC/B;AAID;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,0BAA0B,CAOzE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAEzG"}
@@ -0,0 +1,30 @@
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 'reflect-metadata';
4
+ import { TypeIntrospector } from '../../types/index.js';
5
+ import { decorateProperty, getPropertyMetadata } from '../../types/propertyDecoratorMetadata.js';
6
+ const METADATA_KEY = 'chronicle:graph:edgeTarget';
7
+ /**
8
+ * Property decorator that marks the member of an edge that holds the key of the node the edge ends at.
9
+ * The member is not a property of the edge.
10
+ * @param nodeType - The type of the node.
11
+ * @returns A property decorator.
12
+ */
13
+ export function edgeTarget(nodeType) {
14
+ return decorateProperty((target, propertyKey) => {
15
+ const key = propertyKey.toString();
16
+ TypeIntrospector.trackProperty(target.constructor, key);
17
+ const metadata = { nodeType };
18
+ Reflect.defineMetadata(METADATA_KEY, metadata, target, key);
19
+ });
20
+ }
21
+ /**
22
+ * Retrieves the metadata stored by the edgeTarget decorator on a property.
23
+ * @param target - The class prototype.
24
+ * @param propertyKey - The property name.
25
+ * @returns The metadata, or undefined when the property is not marked.
26
+ */
27
+ export function getEdgeTargetMetadata(target, propertyKey) {
28
+ return getPropertyMetadata(METADATA_KEY, target, propertyKey);
29
+ }
30
+ //# sourceMappingURL=edgeTarget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edgeTarget.js","sourceRoot":"","sources":["../../../projections/graphs/edgeTarget.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAA8B,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAQ7H,MAAM,YAAY,GAAG,4BAA4B,CAAC;AAElD;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,QAAkB;IACzC,OAAO,gBAAgB,CAAC,CAAC,MAAc,EAAE,WAA4B,EAAE,EAAE;QACrE,MAAM,GAAG,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QACnC,gBAAgB,CAAC,aAAa,CAAE,MAAoC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACvF,MAAM,QAAQ,GAAuB,EAAE,QAAQ,EAAE,CAAC;QAClD,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAc,EAAE,WAAmB;IACrE,OAAO,mBAAmB,CAAqB,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AACtF,CAAC"}
@@ -0,0 +1,16 @@
1
+ import 'reflect-metadata';
2
+ import type { ChronicleClassDecorator } from '../../types/standardDecoratorMetadata.js';
3
+ /**
4
+ * Class decorator that names the graph a node, an edge or a graph projection belongs to.
5
+ * All the nodes and edges that name the same graph are registered as one graph.
6
+ * @param name - The name of the graph. It is also the name of the read model the graph is registered as.
7
+ * @returns A class decorator.
8
+ */
9
+ export declare function graph(name: string): ChronicleClassDecorator;
10
+ /**
11
+ * Retrieves the graph name stored by the graph decorator.
12
+ * @param target - The class constructor.
13
+ * @returns The name of the graph, or undefined when the type does not name one.
14
+ */
15
+ export declare function getGraphName(target: Function): string | undefined;
16
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../projections/graphs/graph.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAIxF;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,uBAAuB,CAI3D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAEjE"}
@@ -0,0 +1,24 @@
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 'reflect-metadata';
4
+ const METADATA_KEY = 'chronicle:graph';
5
+ /**
6
+ * Class decorator that names the graph a node, an edge or a graph projection belongs to.
7
+ * All the nodes and edges that name the same graph are registered as one graph.
8
+ * @param name - The name of the graph. It is also the name of the read model the graph is registered as.
9
+ * @returns A class decorator.
10
+ */
11
+ export function graph(name) {
12
+ return (target) => {
13
+ Reflect.defineMetadata(METADATA_KEY, name, target);
14
+ };
15
+ }
16
+ /**
17
+ * Retrieves the graph name stored by the graph decorator.
18
+ * @param target - The class constructor.
19
+ * @returns The name of the graph, or undefined when the type does not name one.
20
+ */
21
+ export function getGraphName(target) {
22
+ return Reflect.getMetadata(METADATA_KEY, target);
23
+ }
24
+ //# sourceMappingURL=graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.js","sourceRoot":"","sources":["../../../projections/graphs/graph.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAG1B,MAAM,YAAY,GAAG,iBAAiB,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,IAAY;IAC9B,OAAO,CAAC,MAAc,EAAE,EAAE;QACtB,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,MAAgB;IACzC,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,CAAuB,CAAC;AAC3E,CAAC"}
@@ -0,0 +1,16 @@
1
+ import 'reflect-metadata';
2
+ import { ChroniclePropertyDecorator } from '../../types/propertyDecoratorMetadata.js';
3
+ /**
4
+ * Property decorator that marks the unique key of a node, or the property that identifies an edge among edges of the
5
+ * same type between the same two nodes.
6
+ * @returns A property decorator.
7
+ */
8
+ export declare function graphKey(): ChroniclePropertyDecorator;
9
+ /**
10
+ * Gets whether a property is marked with the graphKey decorator.
11
+ * @param target - The class prototype.
12
+ * @param propertyKey - The property name.
13
+ * @returns True if it is marked, false if not.
14
+ */
15
+ export declare function isGraphKey(target: object, propertyKey: string): boolean;
16
+ //# sourceMappingURL=graphKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphKey.d.ts","sourceRoot":"","sources":["../../../projections/graphs/graphKey.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,0BAA0B,EAAyC,MAAM,0CAA0C,CAAC;AAI7H;;;;GAIG;AACH,wBAAgB,QAAQ,IAAI,0BAA0B,CAMrD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAEvE"}
@@ -0,0 +1,28 @@
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 'reflect-metadata';
4
+ import { TypeIntrospector } from '../../types/index.js';
5
+ import { decorateProperty, getPropertyMetadata } from '../../types/propertyDecoratorMetadata.js';
6
+ const METADATA_KEY = 'chronicle:graph:key';
7
+ /**
8
+ * Property decorator that marks the unique key of a node, or the property that identifies an edge among edges of the
9
+ * same type between the same two nodes.
10
+ * @returns A property decorator.
11
+ */
12
+ export function graphKey() {
13
+ return decorateProperty((target, propertyKey) => {
14
+ const key = propertyKey.toString();
15
+ TypeIntrospector.trackProperty(target.constructor, key);
16
+ Reflect.defineMetadata(METADATA_KEY, true, target, key);
17
+ });
18
+ }
19
+ /**
20
+ * Gets whether a property is marked with the graphKey decorator.
21
+ * @param target - The class prototype.
22
+ * @param propertyKey - The property name.
23
+ * @returns True if it is marked, false if not.
24
+ */
25
+ export function isGraphKey(target, propertyKey) {
26
+ return getPropertyMetadata(METADATA_KEY, target, propertyKey) === true;
27
+ }
28
+ //# sourceMappingURL=graphKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphKey.js","sourceRoot":"","sources":["../../../projections/graphs/graphKey.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAA8B,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE7H,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAE3C;;;;GAIG;AACH,MAAM,UAAU,QAAQ;IACpB,OAAO,gBAAgB,CAAC,CAAC,MAAc,EAAE,WAA4B,EAAE,EAAE;QACrE,MAAM,GAAG,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QACnC,gBAAgB,CAAC,aAAa,CAAE,MAAoC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACvF,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,WAAmB;IAC1D,OAAO,mBAAmB,CAAU,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,KAAK,IAAI,CAAC;AACpF,CAAC"}
@@ -0,0 +1,21 @@
1
+ import 'reflect-metadata';
2
+ import type { ChronicleClassDecorator } from '../../types/standardDecoratorMetadata.js';
3
+ /** Metadata stored by the graphProjection class decorator. */
4
+ export interface GraphProjectionMetadata {
5
+ /** The name of the graph. */
6
+ readonly name: string;
7
+ }
8
+ /**
9
+ * Class decorator that marks a class implementing IGraphProjection as a graph projection, declared with a fluent builder.
10
+ * @param name - The name of the graph, which is also the name of the read model the graph is registered as.
11
+ * Defaults to the name of the class.
12
+ * @returns A class decorator.
13
+ */
14
+ export declare function graphProjection(name?: string): ChronicleClassDecorator;
15
+ /**
16
+ * Retrieves the metadata stored by the graphProjection decorator.
17
+ * @param target - The class constructor.
18
+ * @returns The metadata, or undefined when the class is not a graph projection.
19
+ */
20
+ export declare function getGraphProjectionMetadata(target: Function): GraphProjectionMetadata | undefined;
21
+ //# sourceMappingURL=graphProjection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphProjection.d.ts","sourceRoot":"","sources":["../../../projections/graphs/graphProjection.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAExF,8DAA8D;AAC9D,MAAM,WAAW,uBAAuB;IACpC,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB;AAID;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,uBAAuB,CAOtE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,QAAQ,GAAG,uBAAuB,GAAG,SAAS,CAEhG"}
@@ -0,0 +1,28 @@
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 'reflect-metadata';
4
+ import { DecoratorType, TypeDiscoverer } from '../../types/index.js';
5
+ const METADATA_KEY = 'chronicle:graph:projection';
6
+ /**
7
+ * Class decorator that marks a class implementing IGraphProjection as a graph projection, declared with a fluent builder.
8
+ * @param name - The name of the graph, which is also the name of the read model the graph is registered as.
9
+ * Defaults to the name of the class.
10
+ * @returns A class decorator.
11
+ */
12
+ export function graphProjection(name) {
13
+ return (target) => {
14
+ const type = target;
15
+ const metadata = { name: name ?? type.name };
16
+ Reflect.defineMetadata(METADATA_KEY, metadata, target);
17
+ TypeDiscoverer.default.register(DecoratorType.GraphProjection, type);
18
+ };
19
+ }
20
+ /**
21
+ * Retrieves the metadata stored by the graphProjection decorator.
22
+ * @param target - The class constructor.
23
+ * @returns The metadata, or undefined when the class is not a graph projection.
24
+ */
25
+ export function getGraphProjectionMetadata(target) {
26
+ return Reflect.getMetadata(METADATA_KEY, target);
27
+ }
28
+ //# sourceMappingURL=graphProjection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphProjection.js","sourceRoot":"","sources":["../../../projections/graphs/graphProjection.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AASrE,MAAM,YAAY,GAAG,4BAA4B,CAAC;AAElD;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,IAAa;IACzC,OAAO,CAAC,MAAc,EAAE,EAAE;QACtB,MAAM,IAAI,GAAG,MAAkB,CAAC;QAChC,MAAM,QAAQ,GAA4B,EAAE,IAAI,EAAE,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACtE,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QACvD,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,eAAe,EAAE,IAAmB,CAAC,CAAC;IACxF,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAgB;IACvD,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,CAAwC,CAAC;AAC5F,CAAC"}
@@ -0,0 +1,48 @@
1
+ export { graph, getGraphName } from './graph.js';
2
+ export { node, getNodeMetadata } from './node.js';
3
+ export type { NodeMetadata } from './node.js';
4
+ export { edge, getEdgeMetadata } from './edge.js';
5
+ export type { EdgeMetadata } from './edge.js';
6
+ export { graphProjection, getGraphProjectionMetadata } from './graphProjection.js';
7
+ export type { GraphProjectionMetadata } from './graphProjection.js';
8
+ export { graphKey, isGraphKey } from './graphKey.js';
9
+ export { edgeSource, getEdgeSourceMetadata } from './edgeSource.js';
10
+ export type { EdgeSourceMetadata } from './edgeSource.js';
11
+ export { edgeTarget, getEdgeTargetMetadata } from './edgeTarget.js';
12
+ export type { EdgeTargetMetadata } from './edgeTarget.js';
13
+ export { nodeFrom, getNodeFromMetadata } from './nodeFrom.js';
14
+ export type { NodeFromOptions, NodeFromMetadata } from './nodeFrom.js';
15
+ export { nodeRemovedWith, getNodeRemovedWithMetadata } from './nodeRemovedWith.js';
16
+ export type { NodeRemovedWithOptions, NodeRemovedWithMetadata } from './nodeRemovedWith.js';
17
+ export { edgeFrom, getEdgeFromMetadata } from './edgeFrom.js';
18
+ export type { EdgeFromOptions, EdgeFromMetadata } from './edgeFrom.js';
19
+ export { edgeRemovedWith, getEdgeRemovedWithMetadata } from './edgeRemovedWith.js';
20
+ export type { EdgeRemovedWithMetadata } from './edgeRemovedWith.js';
21
+ export { isGraphElement } from './isGraphElement.js';
22
+ export type { IGraphProjection } from './IGraphProjection.js';
23
+ export type { IGraphProjectionBuilder } from './IGraphProjectionBuilder.js';
24
+ export type { IGraphNodeBuilder } from './IGraphNodeBuilder.js';
25
+ export type { IGraphNodeFromBuilder } from './IGraphNodeFromBuilder.js';
26
+ export type { IGraphNodeRemovedWithBuilder } from './IGraphNodeRemovedWithBuilder.js';
27
+ export type { IGraphEdgeBuilder } from './IGraphEdgeBuilder.js';
28
+ export type { IGraphEdgeFromBuilder } from './IGraphEdgeFromBuilder.js';
29
+ export type { IGraphEdgeRemovedWithBuilder } from './IGraphEdgeRemovedWithBuilder.js';
30
+ export type { IGraphMappingBuilder } from './IGraphMappingBuilder.js';
31
+ export type { IGraphs } from './IGraphs.js';
32
+ export { Graphs } from './Graphs.js';
33
+ export type { GraphRegistration } from './GraphRegistration.js';
34
+ export type { GraphModel } from './GraphModel.js';
35
+ export type { GraphNodeModel } from './GraphNodeModel.js';
36
+ export type { GraphEdgeModel } from './GraphEdgeModel.js';
37
+ export { NodeMustHaveExactlyOneKey } from './NodeMustHaveExactlyOneKey.js';
38
+ export { EdgeMustHaveOneSourceAndOneTarget } from './EdgeMustHaveOneSourceAndOneTarget.js';
39
+ export { EdgeCanHaveOnlyOneIdentifyingKey } from './EdgeCanHaveOnlyOneIdentifyingKey.js';
40
+ export { NestedObjectInGraph } from './NestedObjectInGraph.js';
41
+ export { UnknownGraphEventProperty } from './UnknownGraphEventProperty.js';
42
+ export { UnknownGraphNode } from './UnknownGraphNode.js';
43
+ export { GraphNameRequired } from './GraphNameRequired.js';
44
+ export { GraphKeyPropertyNotFound } from './GraphKeyPropertyNotFound.js';
45
+ export { GraphElementCannotBeReadModel } from './GraphElementCannotBeReadModel.js';
46
+ export { GraphHasDuplicateElement } from './GraphHasDuplicateElement.js';
47
+ export { GraphDeclaredMoreThanOnce } from './GraphDeclaredMoreThanOnce.js';
48
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../projections/graphs/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AACnF,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACpE,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACpE,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC9D,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AACnF,YAAY,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC9D,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AACnF,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,YAAY,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,YAAY,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,YAAY,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACtF,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,YAAY,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,YAAY,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACtF,YAAY,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAC3F,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,27 @@
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 { graph, getGraphName } from './graph.js';
4
+ export { node, getNodeMetadata } from './node.js';
5
+ export { edge, getEdgeMetadata } from './edge.js';
6
+ export { graphProjection, getGraphProjectionMetadata } from './graphProjection.js';
7
+ export { graphKey, isGraphKey } from './graphKey.js';
8
+ export { edgeSource, getEdgeSourceMetadata } from './edgeSource.js';
9
+ export { edgeTarget, getEdgeTargetMetadata } from './edgeTarget.js';
10
+ export { nodeFrom, getNodeFromMetadata } from './nodeFrom.js';
11
+ export { nodeRemovedWith, getNodeRemovedWithMetadata } from './nodeRemovedWith.js';
12
+ export { edgeFrom, getEdgeFromMetadata } from './edgeFrom.js';
13
+ export { edgeRemovedWith, getEdgeRemovedWithMetadata } from './edgeRemovedWith.js';
14
+ export { isGraphElement } from './isGraphElement.js';
15
+ export { Graphs } from './Graphs.js';
16
+ export { NodeMustHaveExactlyOneKey } from './NodeMustHaveExactlyOneKey.js';
17
+ export { EdgeMustHaveOneSourceAndOneTarget } from './EdgeMustHaveOneSourceAndOneTarget.js';
18
+ export { EdgeCanHaveOnlyOneIdentifyingKey } from './EdgeCanHaveOnlyOneIdentifyingKey.js';
19
+ export { NestedObjectInGraph } from './NestedObjectInGraph.js';
20
+ export { UnknownGraphEventProperty } from './UnknownGraphEventProperty.js';
21
+ export { UnknownGraphNode } from './UnknownGraphNode.js';
22
+ export { GraphNameRequired } from './GraphNameRequired.js';
23
+ export { GraphKeyPropertyNotFound } from './GraphKeyPropertyNotFound.js';
24
+ export { GraphElementCannotBeReadModel } from './GraphElementCannotBeReadModel.js';
25
+ export { GraphHasDuplicateElement } from './GraphHasDuplicateElement.js';
26
+ export { GraphDeclaredMoreThanOnce } from './GraphDeclaredMoreThanOnce.js';
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../projections/graphs/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAEnF,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAEnF,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAEnF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAWrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAKrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAC3F,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Gets whether a type is a node or an edge of a property graph.
3
+ * @param type - The type to check.
4
+ * @returns True if it is a node or an edge, false if not.
5
+ */
6
+ export declare function isGraphElement(type: Function): boolean;
7
+ //# sourceMappingURL=isGraphElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isGraphElement.d.ts","sourceRoot":"","sources":["../../../projections/graphs/isGraphElement.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAEtD"}
@@ -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
+ import { getEdgeMetadata } from './edge.js';
4
+ import { getNodeMetadata } from './node.js';
5
+ /**
6
+ * Gets whether a type is a node or an edge of a property graph.
7
+ * @param type - The type to check.
8
+ * @returns True if it is a node or an edge, false if not.
9
+ */
10
+ export function isGraphElement(type) {
11
+ return getNodeMetadata(type) !== undefined || getEdgeMetadata(type) !== undefined;
12
+ }
13
+ //# sourceMappingURL=isGraphElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isGraphElement.js","sourceRoot":"","sources":["../../../projections/graphs/isGraphElement.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAc;IACzC,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;AACtF,CAAC"}
@@ -0,0 +1,22 @@
1
+ import 'reflect-metadata';
2
+ import type { ChronicleClassDecorator } from '../../types/standardDecoratorMetadata.js';
3
+ /** Metadata stored by the node class decorator. */
4
+ export interface NodeMetadata {
5
+ /** The node label. */
6
+ readonly label: string;
7
+ }
8
+ /**
9
+ * Class decorator that marks a class as a node in a property graph. The properties of the class are the
10
+ * properties of the node, and the member with the graphKey decorator holds its unique key. Which events create,
11
+ * update and remove nodes is declared with nodeFrom, nodeRemovedWith and the property mapping decorators.
12
+ * @param label - The node label. Defaults to the name of the class.
13
+ * @returns A class decorator.
14
+ */
15
+ export declare function node(label?: string): ChronicleClassDecorator;
16
+ /**
17
+ * Retrieves the metadata stored by the node decorator.
18
+ * @param target - The class constructor.
19
+ * @returns The metadata, or undefined when the class is not a node.
20
+ */
21
+ export declare function getNodeMetadata(target: Function): NodeMetadata | undefined;
22
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../projections/graphs/node.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAExF,mDAAmD;AACnD,MAAM,WAAW,YAAY;IACzB,sBAAsB;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CAC1B;AAID;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,uBAAuB,CAO5D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,QAAQ,GAAG,YAAY,GAAG,SAAS,CAE1E"}
@@ -0,0 +1,29 @@
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 'reflect-metadata';
4
+ import { DecoratorType, TypeDiscoverer } from '../../types/index.js';
5
+ const METADATA_KEY = 'chronicle:graph:node';
6
+ /**
7
+ * Class decorator that marks a class as a node in a property graph. The properties of the class are the
8
+ * properties of the node, and the member with the graphKey decorator holds its unique key. Which events create,
9
+ * update and remove nodes is declared with nodeFrom, nodeRemovedWith and the property mapping decorators.
10
+ * @param label - The node label. Defaults to the name of the class.
11
+ * @returns A class decorator.
12
+ */
13
+ export function node(label) {
14
+ return (target) => {
15
+ const type = target;
16
+ const metadata = { label: label ?? type.name };
17
+ Reflect.defineMetadata(METADATA_KEY, metadata, target);
18
+ TypeDiscoverer.default.register(DecoratorType.GraphElement, type);
19
+ };
20
+ }
21
+ /**
22
+ * Retrieves the metadata stored by the node decorator.
23
+ * @param target - The class constructor.
24
+ * @returns The metadata, or undefined when the class is not a node.
25
+ */
26
+ export function getNodeMetadata(target) {
27
+ return Reflect.getMetadata(METADATA_KEY, target);
28
+ }
29
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../../projections/graphs/node.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AASrE,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAAC,KAAc;IAC/B,OAAO,CAAC,MAAc,EAAE,EAAE;QACtB,MAAM,IAAI,GAAG,MAAkB,CAAC;QAChC,MAAM,QAAQ,GAAiB,EAAE,KAAK,EAAE,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QAC7D,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QACvD,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,YAAY,EAAE,IAAmB,CAAC,CAAC;IACrF,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAgB;IAC5C,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,CAA6B,CAAC;AACjF,CAAC"}
@@ -0,0 +1,31 @@
1
+ import 'reflect-metadata';
2
+ import type { ChronicleClassDecorator } from '../../types/standardDecoratorMetadata.js';
3
+ /** Options for the nodeFrom class decorator. */
4
+ export interface NodeFromOptions {
5
+ /** The name of the event property that holds the key of the node. Defaults to the event source id. */
6
+ readonly key?: string;
7
+ /** A constant key. Every event then updates the same node. */
8
+ readonly constantKey?: string;
9
+ /** Only set properties on a node that already exists, instead of creating it. */
10
+ readonly updateOnly?: boolean;
11
+ }
12
+ /** Metadata stored by the nodeFrom class decorator. */
13
+ export interface NodeFromMetadata extends NodeFromOptions {
14
+ /** The event constructor. */
15
+ readonly eventType: Function;
16
+ }
17
+ /**
18
+ * Class decorator that creates or updates a node when an event is observed. Properties of the node are mapped by
19
+ * name from an event property of the same name, or explicitly with the property mapping decorators.
20
+ * @param eventType - The event constructor.
21
+ * @param options - Optional key and update-only configuration.
22
+ * @returns A class decorator.
23
+ */
24
+ export declare function nodeFrom(eventType: Function, options?: NodeFromOptions): ChronicleClassDecorator;
25
+ /**
26
+ * Retrieves all nodeFrom metadata stored on the given class constructor.
27
+ * @param target - The class constructor.
28
+ * @returns An array of nodeFrom metadata entries.
29
+ */
30
+ export declare function getNodeFromMetadata(target: Function): NodeFromMetadata[];
31
+ //# sourceMappingURL=nodeFrom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodeFrom.d.ts","sourceRoot":"","sources":["../../../projections/graphs/nodeFrom.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAExF,gDAAgD;AAChD,MAAM,WAAW,eAAe;IAC5B,sGAAsG;IACtG,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAEtB,8DAA8D;IAC9D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B,iFAAiF;IACjF,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,uDAAuD;AACvD,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACrD,6BAA6B;IAC7B,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;CAChC;AAID;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,uBAAuB,CAKhG;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,GAAG,gBAAgB,EAAE,CAExE"}