@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,12 @@
1
+ /**
2
+ * Error thrown when the key of a node or the identity of an edge is not a property of its type.
3
+ */
4
+ export declare class GraphKeyPropertyNotFound extends Error {
5
+ /**
6
+ * Creates a new {@link GraphKeyPropertyNotFound}.
7
+ * @param type - The node or edge type.
8
+ * @param property - The name of the key property.
9
+ */
10
+ constructor(type: Function, property: string);
11
+ }
12
+ //# sourceMappingURL=GraphKeyPropertyNotFound.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphKeyPropertyNotFound.d.ts","sourceRoot":"","sources":["../../../projections/graphs/GraphKeyPropertyNotFound.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IAC/C;;;;OAIG;IACH,YAAY,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAG3C;CACJ"}
@@ -0,0 +1,17 @@
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
+ * Error thrown when the key of a node or the identity of an edge is not a property of its type.
5
+ */
6
+ export class GraphKeyPropertyNotFound extends Error {
7
+ /**
8
+ * Creates a new {@link GraphKeyPropertyNotFound}.
9
+ * @param type - The node or edge type.
10
+ * @param property - The name of the key property.
11
+ */
12
+ constructor(type, property) {
13
+ super(`The key '${property}' of '${type.name}' is not a property of the type. Declare it with an initializer or with the field decorator so its type can be resolved.`);
14
+ this.name = 'GraphKeyPropertyNotFound';
15
+ }
16
+ }
17
+ //# sourceMappingURL=GraphKeyPropertyNotFound.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphKeyPropertyNotFound.js","sourceRoot":"","sources":["../../../projections/graphs/GraphKeyPropertyNotFound.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAC/C;;;;OAIG;IACH,YAAY,IAAc,EAAE,QAAgB;QACxC,KAAK,CAAC,YAAY,QAAQ,SAAS,IAAI,CAAC,IAAI,0HAA0H,CAAC,CAAC;QACxK,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IAC3C,CAAC;CACJ"}
@@ -0,0 +1,32 @@
1
+ import type { PropertyAccessor } from '@cratis/fundamentals';
2
+ import type { IAddBuilder } from '../declarative/IAddBuilder.js';
3
+ import type { ISetBuilder } from '../declarative/ISetBuilder.js';
4
+ import type { ISubtractBuilder } from '../declarative/ISubtractBuilder.js';
5
+ import type { IGraphMappingBuilder } from './IGraphMappingBuilder.js';
6
+ /**
7
+ * Implements the property mappings shared by nodes and edges, recording them as expressions by property name.
8
+ * @template TElement - The type of the node or edge.
9
+ * @template TEvent - The type of event.
10
+ * @template TSelf - The type of the builder, for continuation.
11
+ */
12
+ export declare abstract class GraphMappingBuilder<TElement, TEvent, TSelf> implements IGraphMappingBuilder<TElement, TEvent, TSelf> {
13
+ /** The property mapping expressions by property name. */
14
+ readonly properties: Record<string, string>;
15
+ /** Gets the builder to return for continuation. */
16
+ protected abstract get self(): TSelf;
17
+ /** @inheritdoc */
18
+ set(propertyAccessor: PropertyAccessor<TElement>): ISetBuilder<TEvent, TSelf>;
19
+ /** @inheritdoc */
20
+ add(propertyAccessor: PropertyAccessor<TElement>): IAddBuilder<TEvent, TSelf>;
21
+ /** @inheritdoc */
22
+ subtract(propertyAccessor: PropertyAccessor<TElement>): ISubtractBuilder<TEvent, TSelf>;
23
+ /** @inheritdoc */
24
+ increment(propertyAccessor: PropertyAccessor<TElement>): TSelf;
25
+ /** @inheritdoc */
26
+ decrement(propertyAccessor: PropertyAccessor<TElement>): TSelf;
27
+ /** @inheritdoc */
28
+ count(propertyAccessor: PropertyAccessor<TElement>): TSelf;
29
+ private readonly record;
30
+ private constant;
31
+ }
32
+ //# sourceMappingURL=GraphMappingBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphMappingBuilder.d.ts","sourceRoot":"","sources":["../../../projections/graphs/GraphMappingBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK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;CAInB"}
@@ -0,0 +1,48 @@
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 { AddBuilder } from '../declarative/AddBuilder.js';
4
+ import { SetBuilder } from '../declarative/SetBuilder.js';
5
+ import { SubtractBuilder } from '../declarative/SubtractBuilder.js';
6
+ import { propertyPathOf } from './propertyPathOf.js';
7
+ /**
8
+ * Implements the property mappings shared by nodes and edges, recording them as expressions by property name.
9
+ * @template TElement - The type of the node or edge.
10
+ * @template TEvent - The type of event.
11
+ * @template TSelf - The type of the builder, for continuation.
12
+ */
13
+ export class GraphMappingBuilder {
14
+ /** The property mapping expressions by property name. */
15
+ properties = {};
16
+ /** @inheritdoc */
17
+ set(propertyAccessor) {
18
+ return new SetBuilder(propertyPathOf(propertyAccessor), this.record, this.self);
19
+ }
20
+ /** @inheritdoc */
21
+ add(propertyAccessor) {
22
+ return new AddBuilder(propertyPathOf(propertyAccessor), this.record, this.self);
23
+ }
24
+ /** @inheritdoc */
25
+ subtract(propertyAccessor) {
26
+ return new SubtractBuilder(propertyPathOf(propertyAccessor), this.record, this.self);
27
+ }
28
+ /** @inheritdoc */
29
+ increment(propertyAccessor) {
30
+ return this.constant(propertyAccessor, '$increment');
31
+ }
32
+ /** @inheritdoc */
33
+ decrement(propertyAccessor) {
34
+ return this.constant(propertyAccessor, '$decrement');
35
+ }
36
+ /** @inheritdoc */
37
+ count(propertyAccessor) {
38
+ return this.constant(propertyAccessor, '$count');
39
+ }
40
+ record = (property, expression) => {
41
+ this.properties[property] = expression;
42
+ };
43
+ constant(propertyAccessor, expression) {
44
+ this.record(propertyPathOf(propertyAccessor), expression);
45
+ return this.self;
46
+ }
47
+ }
48
+ //# sourceMappingURL=GraphMappingBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphMappingBuilder.js","sourceRoot":"","sources":["../../../projections/graphs/GraphMappingBuilder.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,q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AAQ,EAAE;QACrE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC;IAC3C,CAAC,CAAC;IAEM,QAAQ,CAAC,gBAA4C,EAAE,UAAkB;QAC7E,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;CACJ"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Reads the property mappings the model-bound decorators on the members of a node or an edge declare per event type.
3
+ * @param prototype - The class prototype of the node or edge.
4
+ * @param properties - The names of the members to read.
5
+ * @returns For each event type, the property name to expression.
6
+ */
7
+ export declare function readGraphMemberMappings(prototype: object, properties: Iterable<string>): Map<Function, Record<string, string>>;
8
+ //# sourceMappingURL=GraphMemberMappings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphMemberMappings.d.ts","sourceRoot":"","sources":["../../../projections/graphs/GraphMemberMappings.ts"],"names":[],"mappings":"AAcA;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAoC9H"}
@@ -0,0 +1,54 @@
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 { constantValueExpression } from '../constantValueExpression.js';
4
+ import { eventContextPropertyExpression } from '../eventContextPropertyExpression.js';
5
+ import { getAddFromMetadata } from '../modelBound/addFrom.js';
6
+ import { getCountMetadata } from '../modelBound/count.js';
7
+ import { getDecrementMetadata } from '../modelBound/decrement.js';
8
+ import { getIncrementMetadata } from '../modelBound/increment.js';
9
+ import { getSetFromMetadata } from '../modelBound/setFrom.js';
10
+ import { getSetFromContextMetadata } from '../modelBound/setFromContext.js';
11
+ import { getSetValueMetadata } from '../modelBound/setValue.js';
12
+ import { getSubtractFromMetadata } from '../modelBound/subtractFrom.js';
13
+ /**
14
+ * Reads the property mappings the model-bound decorators on the members of a node or an edge declare per event type.
15
+ * @param prototype - The class prototype of the node or edge.
16
+ * @param properties - The names of the members to read.
17
+ * @returns For each event type, the property name to expression.
18
+ */
19
+ export function readGraphMemberMappings(prototype, properties) {
20
+ const result = new Map();
21
+ const record = (eventType, property, expression) => {
22
+ const mappings = result.get(eventType) ?? {};
23
+ mappings[property] = expression;
24
+ result.set(eventType, mappings);
25
+ };
26
+ for (const property of properties) {
27
+ for (const mapping of getSetFromMetadata(prototype, property)) {
28
+ record(mapping.eventType, property, mapping.eventPropertyName ?? property);
29
+ }
30
+ for (const mapping of getSetFromContextMetadata(prototype, property)) {
31
+ record(mapping.eventType, property, eventContextPropertyExpression(mapping.contextPropertyName ?? property));
32
+ }
33
+ for (const mapping of getSetValueMetadata(prototype, property)) {
34
+ record(mapping.eventType, property, constantValueExpression(mapping.value));
35
+ }
36
+ for (const mapping of getAddFromMetadata(prototype, property)) {
37
+ record(mapping.eventType, property, `$add(${mapping.eventPropertyName ?? property})`);
38
+ }
39
+ for (const mapping of getSubtractFromMetadata(prototype, property)) {
40
+ record(mapping.eventType, property, `$subtract(${mapping.eventPropertyName ?? property})`);
41
+ }
42
+ for (const mapping of getIncrementMetadata(prototype, property)) {
43
+ record(mapping.eventType, property, '$increment');
44
+ }
45
+ for (const mapping of getDecrementMetadata(prototype, property)) {
46
+ record(mapping.eventType, property, '$decrement');
47
+ }
48
+ for (const mapping of getCountMetadata(prototype, property)) {
49
+ record(mapping.eventType, property, '$count');
50
+ }
51
+ }
52
+ return result;
53
+ }
54
+ //# sourceMappingURL=GraphMemberMappings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphMemberMappings.js","sourceRoot":"","sources":["../../../projections/graphs/GraphMemberMappings.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAA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,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAClD,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { GraphEdgeModel } from './GraphEdgeModel.js';
2
+ import type { GraphNodeModel } from './GraphNodeModel.js';
3
+ /**
4
+ * Represents a graph as declared by the decorators or by the fluent builder, before it is turned into the
5
+ * definitions that are registered. Both forms produce this model, which is what makes them produce identical definitions.
6
+ */
7
+ export interface GraphModel {
8
+ /** The name of the graph. */
9
+ readonly name: string;
10
+ /** The nodes. */
11
+ readonly nodes: readonly GraphNodeModel[];
12
+ /** The edges. */
13
+ readonly edges: readonly GraphEdgeModel[];
14
+ }
15
+ //# sourceMappingURL=GraphModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphModel.d.ts","sourceRoot":"","sources":["../../../projections/graphs/GraphModel.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,UAAU;IACvB,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,iBAAiB;IACjB,QAAQ,CAAC,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;IAE1C,iBAAiB;IACjB,QAAQ,CAAC,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;CAC7C"}
@@ -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=GraphModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphModel.js","sourceRoot":"","sources":["../../../projections/graphs/GraphModel.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Error thrown when a model-bound node or edge does not say which graph it belongs to.
3
+ */
4
+ export declare class GraphNameRequired extends Error {
5
+ /**
6
+ * Creates a new {@link GraphNameRequired}.
7
+ * @param type - The node or edge type.
8
+ */
9
+ constructor(type: Function);
10
+ }
11
+ //# sourceMappingURL=GraphNameRequired.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNameRequired.d.ts","sourceRoot":"","sources":["../../../projections/graphs/GraphNameRequired.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IACxC;;;OAGG;IACH,YAAY,IAAI,EAAE,QAAQ,EAGzB;CACJ"}
@@ -0,0 +1,16 @@
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
+ * Error thrown when a model-bound node or edge does not say which graph it belongs to.
5
+ */
6
+ export class GraphNameRequired extends Error {
7
+ /**
8
+ * Creates a new {@link GraphNameRequired}.
9
+ * @param type - The node or edge type.
10
+ */
11
+ constructor(type) {
12
+ super(`The type '${type.name}' is a node or an edge but does not name its graph. Put the graph decorator on it, for example @graph('Organization').`);
13
+ this.name = 'GraphNameRequired';
14
+ }
15
+ }
16
+ //# sourceMappingURL=GraphNameRequired.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNameRequired.js","sourceRoot":"","sources":["../../../projections/graphs/GraphNameRequired.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACxC;;;OAGG;IACH,YAAY,IAAc;QACtB,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,wHAAwH,CAAC,CAAC;QACtJ,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IACpC,CAAC;CACJ"}
@@ -0,0 +1,34 @@
1
+ import type { Constructor, PropertyAccessor } from '@cratis/fundamentals';
2
+ import type { GraphNodeModel } from './GraphNodeModel.js';
3
+ import type { IGraphNodeBuilder } from './IGraphNodeBuilder.js';
4
+ import type { IGraphNodeFromBuilder } from './IGraphNodeFromBuilder.js';
5
+ import type { IGraphNodeRemovedWithBuilder } from './IGraphNodeRemovedWithBuilder.js';
6
+ /**
7
+ * Implements {@link IGraphNodeBuilder}.
8
+ * @template TNode - The type of node.
9
+ */
10
+ export declare class GraphNodeBuilder<TNode> implements IGraphNodeBuilder<TNode> {
11
+ private readonly _type;
12
+ private readonly _from;
13
+ private readonly _removedWith;
14
+ private _keyProperty?;
15
+ /**
16
+ * Creates a new {@link GraphNodeBuilder}.
17
+ * @param _type - The type of the node.
18
+ */
19
+ constructor(_type: Constructor<TNode>);
20
+ /** @inheritdoc */
21
+ identifiedBy(keyAccessor: PropertyAccessor<TNode>): IGraphNodeBuilder<TNode>;
22
+ /** @inheritdoc */
23
+ from<TEvent>(eventType: Constructor<TEvent>, configure?: (builder: IGraphNodeFromBuilder<TNode, TEvent>) => void): IGraphNodeBuilder<TNode>;
24
+ /** @inheritdoc */
25
+ removedWith<TEvent>(eventType: Constructor<TEvent>, configure?: (builder: IGraphNodeRemovedWithBuilder<TEvent>) => void): IGraphNodeBuilder<TNode>;
26
+ /**
27
+ * Builds the {@link GraphNodeModel}.
28
+ * @returns The model.
29
+ * @throws {NodeMustHaveExactlyOneKey} When no key is declared and the type does not have exactly one member with the graphKey decorator.
30
+ */
31
+ build(): GraphNodeModel;
32
+ private static keyOf;
33
+ }
34
+ //# sourceMappingURL=GraphNodeBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNodeBuilder.d.ts","sourceRoot":"","sources":["../../../projections/graphs/GraphNodeBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAM1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAItF;;;GAGG;AACH,qBAAa,gBAAgB,CAAC,KAAK,CAAE,YAAW,iBAAiB,CAAC,KAAK,CAAC;IASxD,OAAO,CAAC,QAAQ,CAAC,KAAK;IARlC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA4B;IAClD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAmC;IAChE,OAAO,CAAC,YAAY,CAAC,CAAS;IAE9B;;;OAGG;IACH,YAA6B,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,EAAI;IAE1D,kBAAkB;IAClB,YAAY,CAAC,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAG3E;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAK1I;IAED,kBAAkB;IAClB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,4BAA4B,CAAC,MAAM,CAAC,KAAK,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAKjJ;IAED;;;;OAIG;IACH,KAAK,IAAI,cAAc,CAQtB;IAED,OAAO,CAAC,MAAM,CAAC,KAAK;CAKvB"}
@@ -0,0 +1,66 @@
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 { getNodeMetadata } from './node.js';
5
+ import { GraphNodeFromBuilder } from './GraphNodeFromBuilder.js';
6
+ import { GraphNodeRemovedWithBuilder } from './GraphNodeRemovedWithBuilder.js';
7
+ import { isGraphKey } from './graphKey.js';
8
+ import { NodeMustHaveExactlyOneKey } from './NodeMustHaveExactlyOneKey.js';
9
+ import { propertyPathOf } from './propertyPathOf.js';
10
+ /**
11
+ * Implements {@link IGraphNodeBuilder}.
12
+ * @template TNode - The type of node.
13
+ */
14
+ export class GraphNodeBuilder {
15
+ _type;
16
+ _from = [];
17
+ _removedWith = [];
18
+ _keyProperty;
19
+ /**
20
+ * Creates a new {@link GraphNodeBuilder}.
21
+ * @param _type - The type of the node.
22
+ */
23
+ constructor(_type) {
24
+ this._type = _type;
25
+ }
26
+ /** @inheritdoc */
27
+ identifiedBy(keyAccessor) {
28
+ this._keyProperty = propertyPathOf(keyAccessor);
29
+ return this;
30
+ }
31
+ /** @inheritdoc */
32
+ from(eventType, configure) {
33
+ const builder = new GraphNodeFromBuilder();
34
+ configure?.(builder);
35
+ this._from.push({ eventType, key: builder.key, properties: builder.properties, updateOnly: builder.updateOnly });
36
+ return this;
37
+ }
38
+ /** @inheritdoc */
39
+ removedWith(eventType, configure) {
40
+ const builder = new GraphNodeRemovedWithBuilder();
41
+ configure?.(builder);
42
+ this._removedWith.push({ eventType, key: builder.key, detach: builder.detachEdges });
43
+ return this;
44
+ }
45
+ /**
46
+ * Builds the {@link GraphNodeModel}.
47
+ * @returns The model.
48
+ * @throws {NodeMustHaveExactlyOneKey} When no key is declared and the type does not have exactly one member with the graphKey decorator.
49
+ */
50
+ build() {
51
+ return {
52
+ type: this._type,
53
+ label: getNodeMetadata(this._type)?.label ?? this._type.name,
54
+ keyProperty: this._keyProperty ?? GraphNodeBuilder.keyOf(this._type),
55
+ from: this._from,
56
+ removedWith: this._removedWith
57
+ };
58
+ }
59
+ static keyOf(type) {
60
+ const keys = TypeIntrospector.getTrackedProperties(type).filter(member => isGraphKey(type.prototype, member));
61
+ if (keys.length !== 1)
62
+ throw new NodeMustHaveExactlyOneKey(type, keys.length);
63
+ return keys[0];
64
+ }
65
+ }
66
+ //# sourceMappingURL=GraphNodeBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNodeBuilder.js","sourceRoot":"","sources":["../../../projections/graphs/GraphNodeBuilder.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAGrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAI/E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IASI,KAAK;IARjB,KAAK,GAAyB,EAAE,CAAC;IACjC,YAAY,GAAgC,EAAE,CAAC;IACxD,YAAY,CAAU;IAE9B;;;OAGG;IACH,YAA6B,KAAyB;qBAAzB,KAAK;IAAuB,CAAC;IAE1D,kBAAkB;IAClB,YAAY,CAAC,WAAoC;QAC7C,IAAI,CAAC,YAAY,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,kBAAkB;IAClB,IAAI,CAAS,SAA8B,EAAE,SAAmE;QAC5G,MAAM,OAAO,GAAG,IAAI,oBAAoB,EAAiB,CAAC;QAC1D,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QACjH,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,kBAAkB;IAClB,WAAW,CAAS,SAA8B,EAAE,SAAmE;QACnH,MAAM,OAAO,GAAG,IAAI,2BAA2B,EAAU,CAAC;QAC1D,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC;QACrB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;QACrF,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACH,KAAK;QACD,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI;YAC5D,WAAW,EAAE,IAAI,CAAC,YAAY,IAAI,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;YACpE,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,WAAW,EAAE,IAAI,CAAC,YAAY;SACjC,CAAC;IACN,CAAC;IAEO,MAAM,CAAC,KAAK,CAAC,IAAc;QAC/B,MAAM,IAAI,GAAG,gBAAgB,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;QAC9G,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,yBAAyB,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9E,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;CACJ"}
@@ -0,0 +1,21 @@
1
+ import type { PropertyAccessor } from '@cratis/fundamentals';
2
+ import { GraphMappingBuilder } from './GraphMappingBuilder.js';
3
+ import type { IGraphNodeFromBuilder } from './IGraphNodeFromBuilder.js';
4
+ /**
5
+ * Implements {@link IGraphNodeFromBuilder}.
6
+ * @template TNode - The type of node.
7
+ * @template TEvent - The type of event.
8
+ */
9
+ export declare class GraphNodeFromBuilder<TNode, TEvent> extends GraphMappingBuilder<TNode, TEvent, IGraphNodeFromBuilder<TNode, TEvent>> implements IGraphNodeFromBuilder<TNode, TEvent> {
10
+ /** The expression for the key of the node, or undefined for the event source id. */
11
+ key?: string;
12
+ /** Whether the event only changes a node that already exists. */
13
+ updateOnly: boolean;
14
+ /** @inheritdoc */
15
+ protected get self(): IGraphNodeFromBuilder<TNode, TEvent>;
16
+ /** @inheritdoc */
17
+ usingKey(keyAccessor: PropertyAccessor<TEvent>): IGraphNodeFromBuilder<TNode, TEvent>;
18
+ /** @inheritdoc */
19
+ onlyWhenExisting(): IGraphNodeFromBuilder<TNode, TEvent>;
20
+ }
21
+ //# sourceMappingURL=GraphNodeFromBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNodeFromBuilder.d.ts","sourceRoot":"","sources":["../../../projections/graphs/GraphNodeFromBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGxE;;;;GAIG;AACH,qBAAa,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAE,SAAQ,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAC5H,YAAW,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC;IAC/C,oFAAoF;IACpF,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,iEAAiE;IACjE,UAAU,UAAS;IAEnB,kBAAkB;IAClB,SAAS,KAAK,IAAI,IAAI,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAEzD;IAED,kBAAkB;IAClB,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAAG,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAGpF;IAED,kBAAkB;IAClB,gBAAgB,IAAI,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAGvD;CACJ"}
@@ -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 { GraphMappingBuilder } from './GraphMappingBuilder.js';
4
+ import { propertyPathOf } from './propertyPathOf.js';
5
+ /**
6
+ * Implements {@link IGraphNodeFromBuilder}.
7
+ * @template TNode - The type of node.
8
+ * @template TEvent - The type of event.
9
+ */
10
+ export class GraphNodeFromBuilder extends GraphMappingBuilder {
11
+ /** The expression for the key of the node, or undefined for the event source id. */
12
+ key;
13
+ /** Whether the event only changes a node that already exists. */
14
+ updateOnly = false;
15
+ /** @inheritdoc */
16
+ get self() {
17
+ return this;
18
+ }
19
+ /** @inheritdoc */
20
+ usingKey(keyAccessor) {
21
+ this.key = propertyPathOf(keyAccessor);
22
+ return this;
23
+ }
24
+ /** @inheritdoc */
25
+ onlyWhenExisting() {
26
+ this.updateOnly = true;
27
+ return this;
28
+ }
29
+ }
30
+ //# sourceMappingURL=GraphNodeFromBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNodeFromBuilder.js","sourceRoot":"","sources":["../../../projections/graphs/GraphNodeFromBuilder.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAGrG,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;;GAIG;AACH,MAAM,OAAO,oBAAoC,SAAQ,mBAAwE;IAE7H,oFAAoF;IACpF,GAAG,CAAU;IAEb,iEAAiE;IACjE,UAAU,GAAG,KAAK,CAAC;IAEnB,kBAAkB;IAClB,IAAc,IAAI;QACd,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,kBAAkB;IAClB,QAAQ,CAAC,WAAqC;QAC1C,IAAI,CAAC,GAAG,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,kBAAkB;IAClB,gBAAgB;QACZ,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Represents how an event creates or updates a node.
3
+ */
4
+ export interface GraphNodeFromModel {
5
+ /** The event type. */
6
+ readonly eventType: Function;
7
+ /** The expression for the key of the node, or undefined for the event source id. */
8
+ readonly key?: string;
9
+ /** The property mapping expressions by node property name. */
10
+ readonly properties: Readonly<Record<string, string>>;
11
+ /** Whether the event only changes a node that already exists. */
12
+ readonly updateOnly: boolean;
13
+ }
14
+ //# sourceMappingURL=GraphNodeFromModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNodeFromModel.d.ts","sourceRoot":"","sources":["../../../projections/graphs/GraphNodeFromModel.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,sBAAsB;IACtB,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;IAE7B,oFAAoF;IACpF,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAEtB,8DAA8D;IAC9D,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAEtD,iEAAiE;IACjE,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAChC"}
@@ -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=GraphNodeFromModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNodeFromModel.js","sourceRoot":"","sources":["../../../projections/graphs/GraphNodeFromModel.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
@@ -0,0 +1,18 @@
1
+ import type { GraphNodeFromModel } from './GraphNodeFromModel.js';
2
+ import type { GraphNodeRemovedWithModel } from './GraphNodeRemovedWithModel.js';
3
+ /**
4
+ * Represents a node type with what it is projected from.
5
+ */
6
+ export interface GraphNodeModel {
7
+ /** The type of the node. */
8
+ readonly type: Function;
9
+ /** The node label. */
10
+ readonly label: string;
11
+ /** The name of the key property. */
12
+ readonly keyProperty: string;
13
+ /** The mappings that create or update nodes. */
14
+ readonly from: readonly GraphNodeFromModel[];
15
+ /** The mappings that delete nodes. */
16
+ readonly removedWith: readonly GraphNodeRemovedWithModel[];
17
+ }
18
+ //# sourceMappingURL=GraphNodeModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNodeModel.d.ts","sourceRoot":"","sources":["../../../projections/graphs/GraphNodeModel.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,4BAA4B;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAExB,sBAAsB;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,oCAAoC;IACpC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAE7C,sCAAsC;IACtC,QAAQ,CAAC,WAAW,EAAE,SAAS,yBAAyB,EAAE,CAAC;CAC9D"}
@@ -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=GraphNodeModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNodeModel.js","sourceRoot":"","sources":["../../../projections/graphs/GraphNodeModel.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
@@ -0,0 +1,17 @@
1
+ import type { PropertyAccessor } from '@cratis/fundamentals';
2
+ import type { IGraphNodeRemovedWithBuilder } from './IGraphNodeRemovedWithBuilder.js';
3
+ /**
4
+ * Implements {@link IGraphNodeRemovedWithBuilder}.
5
+ * @template TEvent - The type of event.
6
+ */
7
+ export declare class GraphNodeRemovedWithBuilder<TEvent> implements IGraphNodeRemovedWithBuilder<TEvent> {
8
+ /** The expression for the key of the node, or undefined for the event source id. */
9
+ key?: string;
10
+ /** Whether the edges attached to the node are deleted with it. */
11
+ detachEdges: boolean;
12
+ /** @inheritdoc */
13
+ usingKey(keyAccessor: PropertyAccessor<TEvent>): IGraphNodeRemovedWithBuilder<TEvent>;
14
+ /** @inheritdoc */
15
+ detach(): IGraphNodeRemovedWithBuilder<TEvent>;
16
+ }
17
+ //# sourceMappingURL=GraphNodeRemovedWithBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNodeRemovedWithBuilder.d.ts","sourceRoot":"","sources":["../../../projections/graphs/GraphNodeRemovedWithBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAGtF;;;GAGG;AACH,qBAAa,2BAA2B,CAAC,MAAM,CAAE,YAAW,4BAA4B,CAAC,MAAM,CAAC;IAC5F,oFAAoF;IACpF,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,kEAAkE;IAClE,WAAW,UAAS;IAEpB,kBAAkB;IAClB,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAAG,4BAA4B,CAAC,MAAM,CAAC,CAGpF;IAED,kBAAkB;IAClB,MAAM,IAAI,4BAA4B,CAAC,MAAM,CAAC,CAG7C;CACJ"}
@@ -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 { propertyPathOf } from './propertyPathOf.js';
4
+ /**
5
+ * Implements {@link IGraphNodeRemovedWithBuilder}.
6
+ * @template TEvent - The type of event.
7
+ */
8
+ export class GraphNodeRemovedWithBuilder {
9
+ /** The expression for the key of the node, or undefined for the event source id. */
10
+ key;
11
+ /** Whether the edges attached to the node are deleted with it. */
12
+ detachEdges = false;
13
+ /** @inheritdoc */
14
+ usingKey(keyAccessor) {
15
+ this.key = propertyPathOf(keyAccessor);
16
+ return this;
17
+ }
18
+ /** @inheritdoc */
19
+ detach() {
20
+ this.detachEdges = true;
21
+ return this;
22
+ }
23
+ }
24
+ //# sourceMappingURL=GraphNodeRemovedWithBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNodeRemovedWithBuilder.js","sourceRoot":"","sources":["../../../projections/graphs/GraphNodeRemovedWithBuilder.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAIrG,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;GAGG;AACH,MAAM,OAAO,2BAA2B;IACpC,oFAAoF;IACpF,GAAG,CAAU;IAEb,kEAAkE;IAClE,WAAW,GAAG,KAAK,CAAC;IAEpB,kBAAkB;IAClB,QAAQ,CAAC,WAAqC;QAC1C,IAAI,CAAC,GAAG,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,kBAAkB;IAClB,MAAM;QACF,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Represents how an event deletes a node.
3
+ */
4
+ export interface GraphNodeRemovedWithModel {
5
+ /** The event type. */
6
+ readonly eventType: Function;
7
+ /** The expression for the key of the node, or undefined for the event source id. */
8
+ readonly key?: string;
9
+ /** Whether the edges attached to the node are deleted with it. */
10
+ readonly detach: boolean;
11
+ }
12
+ //# sourceMappingURL=GraphNodeRemovedWithModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNodeRemovedWithModel.d.ts","sourceRoot":"","sources":["../../../projections/graphs/GraphNodeRemovedWithModel.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC,sBAAsB;IACtB,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;IAE7B,oFAAoF;IACpF,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAEtB,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC5B"}
@@ -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=GraphNodeRemovedWithModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNodeRemovedWithModel.js","sourceRoot":"","sources":["../../../projections/graphs/GraphNodeRemovedWithModel.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
@@ -0,0 +1,25 @@
1
+ import type { Constructor } from '@cratis/fundamentals';
2
+ import type { GraphModel } from './GraphModel.js';
3
+ import type { IGraphEdgeBuilder } from './IGraphEdgeBuilder.js';
4
+ import type { IGraphNodeBuilder } from './IGraphNodeBuilder.js';
5
+ import type { IGraphProjection } from './IGraphProjection.js';
6
+ import type { IGraphProjectionBuilder } from './IGraphProjectionBuilder.js';
7
+ /**
8
+ * Implements {@link IGraphProjectionBuilder}, collecting the nodes and edges a graph projection defines.
9
+ */
10
+ export declare class GraphProjectionBuilder implements IGraphProjectionBuilder {
11
+ private readonly _nodes;
12
+ private readonly _edges;
13
+ /** @inheritdoc */
14
+ node<TNode>(nodeType: Constructor<TNode>, configure: (builder: IGraphNodeBuilder<TNode>) => void): IGraphProjectionBuilder;
15
+ /** @inheritdoc */
16
+ edge<TEdge>(edgeType: Constructor<TEdge>, sourceType: Function, targetType: Function, configure: (builder: IGraphEdgeBuilder<TEdge>) => void): IGraphProjectionBuilder;
17
+ /**
18
+ * Builds the {@link GraphModel} of a graph projection.
19
+ * @param name - The name of the graph.
20
+ * @param projection - The graph projection to define the model with.
21
+ * @returns The model.
22
+ */
23
+ build(name: string, projection: IGraphProjection): GraphModel;
24
+ }
25
+ //# sourceMappingURL=GraphProjectionBuilder.d.ts.map