@exellix/exellix-runtime 3.5.1

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 (318) hide show
  1. package/README.md +422 -0
  2. package/dist/catalox-inventory/catalox-execution-matrix-inventory-cli.d.ts +4 -0
  3. package/dist/catalox-inventory/catalox-execution-matrix-inventory-cli.d.ts.map +1 -0
  4. package/dist/catalox-inventory/catalox-execution-matrix-inventory-cli.js +311 -0
  5. package/dist/catalox-inventory/catalox-execution-matrix-inventory-cli.js.map +1 -0
  6. package/dist/catalox-inventory/catalox-execution-matrix-inventory.d.ts +64 -0
  7. package/dist/catalox-inventory/catalox-execution-matrix-inventory.d.ts.map +1 -0
  8. package/dist/catalox-inventory/catalox-execution-matrix-inventory.js +226 -0
  9. package/dist/catalox-inventory/catalox-execution-matrix-inventory.js.map +1 -0
  10. package/dist/catalox-inventory/catalox-xmemory-entity-count-report.d.ts +145 -0
  11. package/dist/catalox-inventory/catalox-xmemory-entity-count-report.d.ts.map +1 -0
  12. package/dist/catalox-inventory/catalox-xmemory-entity-count-report.js +477 -0
  13. package/dist/catalox-inventory/catalox-xmemory-entity-count-report.js.map +1 -0
  14. package/dist/catalox-inventory/catalox-xmemory-entity-count-report.spec.d.ts +2 -0
  15. package/dist/catalox-inventory/catalox-xmemory-entity-count-report.spec.d.ts.map +1 -0
  16. package/dist/catalox-inventory/catalox-xmemory-entity-count-report.spec.js +34 -0
  17. package/dist/catalox-inventory/catalox-xmemory-entity-count-report.spec.js.map +1 -0
  18. package/dist/cli/argv.d.ts +5 -0
  19. package/dist/cli/argv.d.ts.map +1 -0
  20. package/dist/cli/argv.js +32 -0
  21. package/dist/cli/argv.js.map +1 -0
  22. package/dist/cli/commands/health.d.ts +2 -0
  23. package/dist/cli/commands/health.d.ts.map +1 -0
  24. package/dist/cli/commands/health.js +23 -0
  25. package/dist/cli/commands/health.js.map +1 -0
  26. package/dist/cli/commands/matrix-link.d.ts +2 -0
  27. package/dist/cli/commands/matrix-link.d.ts.map +1 -0
  28. package/dist/cli/commands/matrix-link.js +56 -0
  29. package/dist/cli/commands/matrix-link.js.map +1 -0
  30. package/dist/cli/commands/matrix-read.d.ts +2 -0
  31. package/dist/cli/commands/matrix-read.d.ts.map +1 -0
  32. package/dist/cli/commands/matrix-read.js +73 -0
  33. package/dist/cli/commands/matrix-read.js.map +1 -0
  34. package/dist/cli/env.d.ts +6 -0
  35. package/dist/cli/env.d.ts.map +1 -0
  36. package/dist/cli/env.js +39 -0
  37. package/dist/cli/env.js.map +1 -0
  38. package/dist/cli/exellix-runtime-cli.d.ts +3 -0
  39. package/dist/cli/exellix-runtime-cli.d.ts.map +1 -0
  40. package/dist/cli/exellix-runtime-cli.js +55 -0
  41. package/dist/cli/exellix-runtime-cli.js.map +1 -0
  42. package/dist/cli/help.d.ts +19 -0
  43. package/dist/cli/help.d.ts.map +1 -0
  44. package/dist/cli/help.js +94 -0
  45. package/dist/cli/help.js.map +1 -0
  46. package/dist/client-toolbox/bundle.d.ts +17 -0
  47. package/dist/client-toolbox/bundle.d.ts.map +1 -0
  48. package/dist/client-toolbox/bundle.js +17 -0
  49. package/dist/client-toolbox/bundle.js.map +1 -0
  50. package/dist/client-toolbox/client-toolbox.spec.d.ts +2 -0
  51. package/dist/client-toolbox/client-toolbox.spec.d.ts.map +1 -0
  52. package/dist/client-toolbox/client-toolbox.spec.js +145 -0
  53. package/dist/client-toolbox/client-toolbox.spec.js.map +1 -0
  54. package/dist/client-toolbox/index.d.ts +4 -0
  55. package/dist/client-toolbox/index.d.ts.map +1 -0
  56. package/dist/client-toolbox/index.js +4 -0
  57. package/dist/client-toolbox/index.js.map +1 -0
  58. package/dist/client-toolbox/matrix-config.d.ts +67 -0
  59. package/dist/client-toolbox/matrix-config.d.ts.map +1 -0
  60. package/dist/client-toolbox/matrix-config.js +140 -0
  61. package/dist/client-toolbox/matrix-config.js.map +1 -0
  62. package/dist/client-toolbox/matrix-materialize.d.ts +56 -0
  63. package/dist/client-toolbox/matrix-materialize.d.ts.map +1 -0
  64. package/dist/client-toolbox/matrix-materialize.js +130 -0
  65. package/dist/client-toolbox/matrix-materialize.js.map +1 -0
  66. package/dist/dev/matrix-read-dashboard-smoke.d.ts +2 -0
  67. package/dist/dev/matrix-read-dashboard-smoke.d.ts.map +1 -0
  68. package/dist/dev/matrix-read-dashboard-smoke.js +12 -0
  69. package/dist/dev/matrix-read-dashboard-smoke.js.map +1 -0
  70. package/dist/dev/runtime-real-dev-server.d.ts +2 -0
  71. package/dist/dev/runtime-real-dev-server.d.ts.map +1 -0
  72. package/dist/dev/runtime-real-dev-server.js +90 -0
  73. package/dist/dev/runtime-real-dev-server.js.map +1 -0
  74. package/dist/execution-matrix/catalox-loader.d.ts +55 -0
  75. package/dist/execution-matrix/catalox-loader.d.ts.map +1 -0
  76. package/dist/execution-matrix/catalox-loader.js +199 -0
  77. package/dist/execution-matrix/catalox-loader.js.map +1 -0
  78. package/dist/execution-matrix/catalox-matrix-host.d.ts +20 -0
  79. package/dist/execution-matrix/catalox-matrix-host.d.ts.map +1 -0
  80. package/dist/execution-matrix/catalox-matrix-host.js +19 -0
  81. package/dist/execution-matrix/catalox-matrix-host.js.map +1 -0
  82. package/dist/execution-matrix/collections.d.ts +16 -0
  83. package/dist/execution-matrix/collections.d.ts.map +1 -0
  84. package/dist/execution-matrix/collections.js +75 -0
  85. package/dist/execution-matrix/collections.js.map +1 -0
  86. package/dist/execution-matrix/config-store.d.ts +104 -0
  87. package/dist/execution-matrix/config-store.d.ts.map +1 -0
  88. package/dist/execution-matrix/config-store.js +273 -0
  89. package/dist/execution-matrix/config-store.js.map +1 -0
  90. package/dist/execution-matrix/constants.d.ts +19 -0
  91. package/dist/execution-matrix/constants.d.ts.map +1 -0
  92. package/dist/execution-matrix/constants.js +19 -0
  93. package/dist/execution-matrix/constants.js.map +1 -0
  94. package/dist/execution-matrix/contracts.d.ts +568 -0
  95. package/dist/execution-matrix/contracts.d.ts.map +1 -0
  96. package/dist/execution-matrix/contracts.js +44 -0
  97. package/dist/execution-matrix/contracts.js.map +1 -0
  98. package/dist/execution-matrix/data-source.d.ts +43 -0
  99. package/dist/execution-matrix/data-source.d.ts.map +1 -0
  100. package/dist/execution-matrix/data-source.js +307 -0
  101. package/dist/execution-matrix/data-source.js.map +1 -0
  102. package/dist/execution-matrix/eligibility.d.ts +48 -0
  103. package/dist/execution-matrix/eligibility.d.ts.map +1 -0
  104. package/dist/execution-matrix/eligibility.js +89 -0
  105. package/dist/execution-matrix/eligibility.js.map +1 -0
  106. package/dist/execution-matrix/execution-matrix-claim-pause.d.ts +20 -0
  107. package/dist/execution-matrix/execution-matrix-claim-pause.d.ts.map +1 -0
  108. package/dist/execution-matrix/execution-matrix-claim-pause.js +18 -0
  109. package/dist/execution-matrix/execution-matrix-claim-pause.js.map +1 -0
  110. package/dist/execution-matrix/execution-matrix-claim-pause.spec.d.ts +2 -0
  111. package/dist/execution-matrix/execution-matrix-claim-pause.spec.d.ts.map +1 -0
  112. package/dist/execution-matrix/execution-matrix-claim-pause.spec.js +23 -0
  113. package/dist/execution-matrix/execution-matrix-claim-pause.spec.js.map +1 -0
  114. package/dist/execution-matrix/execution-matrix.live.spec.d.ts +2 -0
  115. package/dist/execution-matrix/execution-matrix.live.spec.d.ts.map +1 -0
  116. package/dist/execution-matrix/execution-matrix.live.spec.js +152 -0
  117. package/dist/execution-matrix/execution-matrix.live.spec.js.map +1 -0
  118. package/dist/execution-matrix/execution-matrix.live.xmemory.spec.d.ts +2 -0
  119. package/dist/execution-matrix/execution-matrix.live.xmemory.spec.d.ts.map +1 -0
  120. package/dist/execution-matrix/execution-matrix.live.xmemory.spec.js +346 -0
  121. package/dist/execution-matrix/execution-matrix.live.xmemory.spec.js.map +1 -0
  122. package/dist/execution-matrix/execution-matrix.spec.d.ts +2 -0
  123. package/dist/execution-matrix/execution-matrix.spec.d.ts.map +1 -0
  124. package/dist/execution-matrix/execution-matrix.spec.js +1786 -0
  125. package/dist/execution-matrix/execution-matrix.spec.js.map +1 -0
  126. package/dist/execution-matrix/execution-mode.d.ts +34 -0
  127. package/dist/execution-matrix/execution-mode.d.ts.map +1 -0
  128. package/dist/execution-matrix/execution-mode.js +72 -0
  129. package/dist/execution-matrix/execution-mode.js.map +1 -0
  130. package/dist/execution-matrix/factory.d.ts +72 -0
  131. package/dist/execution-matrix/factory.d.ts.map +1 -0
  132. package/dist/execution-matrix/factory.js +77 -0
  133. package/dist/execution-matrix/factory.js.map +1 -0
  134. package/dist/execution-matrix/graph-engine-datafilters-reexport.spec.d.ts +2 -0
  135. package/dist/execution-matrix/graph-engine-datafilters-reexport.spec.d.ts.map +1 -0
  136. package/dist/execution-matrix/graph-engine-datafilters-reexport.spec.js +48 -0
  137. package/dist/execution-matrix/graph-engine-datafilters-reexport.spec.js.map +1 -0
  138. package/dist/execution-matrix/graph-entry-xmemory-load.d.ts +130 -0
  139. package/dist/execution-matrix/graph-entry-xmemory-load.d.ts.map +1 -0
  140. package/dist/execution-matrix/graph-entry-xmemory-load.js +146 -0
  141. package/dist/execution-matrix/graph-entry-xmemory-load.js.map +1 -0
  142. package/dist/execution-matrix/graph-entry-xmemory-load.spec.d.ts +2 -0
  143. package/dist/execution-matrix/graph-entry-xmemory-load.spec.d.ts.map +1 -0
  144. package/dist/execution-matrix/graph-entry-xmemory-load.spec.js +66 -0
  145. package/dist/execution-matrix/graph-entry-xmemory-load.spec.js.map +1 -0
  146. package/dist/execution-matrix/graph-operational-aggregates.d.ts +47 -0
  147. package/dist/execution-matrix/graph-operational-aggregates.d.ts.map +1 -0
  148. package/dist/execution-matrix/graph-operational-aggregates.js +137 -0
  149. package/dist/execution-matrix/graph-operational-aggregates.js.map +1 -0
  150. package/dist/execution-matrix/graph-operational-lifecycle.d.ts +43 -0
  151. package/dist/execution-matrix/graph-operational-lifecycle.d.ts.map +1 -0
  152. package/dist/execution-matrix/graph-operational-lifecycle.js +88 -0
  153. package/dist/execution-matrix/graph-operational-lifecycle.js.map +1 -0
  154. package/dist/execution-matrix/graph-operational.spec.d.ts +2 -0
  155. package/dist/execution-matrix/graph-operational.spec.d.ts.map +1 -0
  156. package/dist/execution-matrix/graph-operational.spec.js +203 -0
  157. package/dist/execution-matrix/graph-operational.spec.js.map +1 -0
  158. package/dist/execution-matrix/index.d.ts +73 -0
  159. package/dist/execution-matrix/index.d.ts.map +1 -0
  160. package/dist/execution-matrix/index.js +57 -0
  161. package/dist/execution-matrix/index.js.map +1 -0
  162. package/dist/execution-matrix/live-tier-open.d.ts +6 -0
  163. package/dist/execution-matrix/live-tier-open.d.ts.map +1 -0
  164. package/dist/execution-matrix/live-tier-open.js +6 -0
  165. package/dist/execution-matrix/live-tier-open.js.map +1 -0
  166. package/dist/execution-matrix/materializer.d.ts +99 -0
  167. package/dist/execution-matrix/materializer.d.ts.map +1 -0
  168. package/dist/execution-matrix/materializer.js +210 -0
  169. package/dist/execution-matrix/materializer.js.map +1 -0
  170. package/dist/execution-matrix/matrix-activix.d.ts +24 -0
  171. package/dist/execution-matrix/matrix-activix.d.ts.map +1 -0
  172. package/dist/execution-matrix/matrix-activix.js +34 -0
  173. package/dist/execution-matrix/matrix-activix.js.map +1 -0
  174. package/dist/execution-matrix/matrix-data-tier.d.ts +55 -0
  175. package/dist/execution-matrix/matrix-data-tier.d.ts.map +1 -0
  176. package/dist/execution-matrix/matrix-data-tier.js +74 -0
  177. package/dist/execution-matrix/matrix-data-tier.js.map +1 -0
  178. package/dist/execution-matrix/matrix-execute-graph-adapter.d.ts +43 -0
  179. package/dist/execution-matrix/matrix-execute-graph-adapter.d.ts.map +1 -0
  180. package/dist/execution-matrix/matrix-execute-graph-adapter.js +62 -0
  181. package/dist/execution-matrix/matrix-execute-graph-adapter.js.map +1 -0
  182. package/dist/execution-matrix/matrix-execute-graph-adapter.spec.d.ts +2 -0
  183. package/dist/execution-matrix/matrix-execute-graph-adapter.spec.d.ts.map +1 -0
  184. package/dist/execution-matrix/matrix-execute-graph-adapter.spec.js +60 -0
  185. package/dist/execution-matrix/matrix-execute-graph-adapter.spec.js.map +1 -0
  186. package/dist/execution-matrix/matrix-logxer.d.ts +15 -0
  187. package/dist/execution-matrix/matrix-logxer.d.ts.map +1 -0
  188. package/dist/execution-matrix/matrix-logxer.js +65 -0
  189. package/dist/execution-matrix/matrix-logxer.js.map +1 -0
  190. package/dist/execution-matrix/matrix-read-tier.d.ts +41 -0
  191. package/dist/execution-matrix/matrix-read-tier.d.ts.map +1 -0
  192. package/dist/execution-matrix/matrix-read-tier.js +41 -0
  193. package/dist/execution-matrix/matrix-read-tier.js.map +1 -0
  194. package/dist/execution-matrix/memorix-entity-type-helpers.d.ts +25 -0
  195. package/dist/execution-matrix/memorix-entity-type-helpers.d.ts.map +1 -0
  196. package/dist/execution-matrix/memorix-entity-type-helpers.js +32 -0
  197. package/dist/execution-matrix/memorix-entity-type-helpers.js.map +1 -0
  198. package/dist/execution-matrix/memorix-entity-type-helpers.spec.d.ts +2 -0
  199. package/dist/execution-matrix/memorix-entity-type-helpers.spec.d.ts.map +1 -0
  200. package/dist/execution-matrix/memorix-entity-type-helpers.spec.js +83 -0
  201. package/dist/execution-matrix/memorix-entity-type-helpers.spec.js.map +1 -0
  202. package/dist/execution-matrix/memorix-inference-persister.d.ts +73 -0
  203. package/dist/execution-matrix/memorix-inference-persister.d.ts.map +1 -0
  204. package/dist/execution-matrix/memorix-inference-persister.js +126 -0
  205. package/dist/execution-matrix/memorix-inference-persister.js.map +1 -0
  206. package/dist/execution-matrix/memorix-inference-persister.spec.d.ts +2 -0
  207. package/dist/execution-matrix/memorix-inference-persister.spec.d.ts.map +1 -0
  208. package/dist/execution-matrix/memorix-inference-persister.spec.js +117 -0
  209. package/dist/execution-matrix/memorix-inference-persister.spec.js.map +1 -0
  210. package/dist/execution-matrix/memorix-matrix-entity-facet.d.ts +71 -0
  211. package/dist/execution-matrix/memorix-matrix-entity-facet.d.ts.map +1 -0
  212. package/dist/execution-matrix/memorix-matrix-entity-facet.js +91 -0
  213. package/dist/execution-matrix/memorix-matrix-entity-facet.js.map +1 -0
  214. package/dist/execution-matrix/memorix-matrix-entity-facet.spec.d.ts +2 -0
  215. package/dist/execution-matrix/memorix-matrix-entity-facet.spec.d.ts.map +1 -0
  216. package/dist/execution-matrix/memorix-matrix-entity-facet.spec.js +151 -0
  217. package/dist/execution-matrix/memorix-matrix-entity-facet.spec.js.map +1 -0
  218. package/dist/execution-matrix/memorix-runtime-tier.d.ts +153 -0
  219. package/dist/execution-matrix/memorix-runtime-tier.d.ts.map +1 -0
  220. package/dist/execution-matrix/memorix-runtime-tier.js +185 -0
  221. package/dist/execution-matrix/memorix-runtime-tier.js.map +1 -0
  222. package/dist/execution-matrix/memorix-tier-statistics.d.ts +103 -0
  223. package/dist/execution-matrix/memorix-tier-statistics.d.ts.map +1 -0
  224. package/dist/execution-matrix/memorix-tier-statistics.js +164 -0
  225. package/dist/execution-matrix/memorix-tier-statistics.js.map +1 -0
  226. package/dist/execution-matrix/memory-store.d.ts +20 -0
  227. package/dist/execution-matrix/memory-store.d.ts.map +1 -0
  228. package/dist/execution-matrix/memory-store.js +185 -0
  229. package/dist/execution-matrix/memory-store.js.map +1 -0
  230. package/dist/execution-matrix/navigator.d.ts +97 -0
  231. package/dist/execution-matrix/navigator.d.ts.map +1 -0
  232. package/dist/execution-matrix/navigator.js +119 -0
  233. package/dist/execution-matrix/navigator.js.map +1 -0
  234. package/dist/execution-matrix/orchestrator.d.ts +204 -0
  235. package/dist/execution-matrix/orchestrator.d.ts.map +1 -0
  236. package/dist/execution-matrix/orchestrator.js +656 -0
  237. package/dist/execution-matrix/orchestrator.js.map +1 -0
  238. package/dist/execution-matrix/records-eligibility.d.ts +34 -0
  239. package/dist/execution-matrix/records-eligibility.d.ts.map +1 -0
  240. package/dist/execution-matrix/records-eligibility.js +110 -0
  241. package/dist/execution-matrix/records-eligibility.js.map +1 -0
  242. package/dist/execution-matrix/records-eligibility.spec.d.ts +2 -0
  243. package/dist/execution-matrix/records-eligibility.spec.d.ts.map +1 -0
  244. package/dist/execution-matrix/records-eligibility.spec.js +154 -0
  245. package/dist/execution-matrix/records-eligibility.spec.js.map +1 -0
  246. package/dist/execution-matrix/run-loop.d.ts +140 -0
  247. package/dist/execution-matrix/run-loop.d.ts.map +1 -0
  248. package/dist/execution-matrix/run-loop.js +350 -0
  249. package/dist/execution-matrix/run-loop.js.map +1 -0
  250. package/dist/execution-matrix/runtime-connectivity-health.d.ts +128 -0
  251. package/dist/execution-matrix/runtime-connectivity-health.d.ts.map +1 -0
  252. package/dist/execution-matrix/runtime-connectivity-health.js +253 -0
  253. package/dist/execution-matrix/runtime-connectivity-health.js.map +1 -0
  254. package/dist/execution-matrix/runtime-connectivity-health.spec.d.ts +2 -0
  255. package/dist/execution-matrix/runtime-connectivity-health.spec.d.ts.map +1 -0
  256. package/dist/execution-matrix/runtime-connectivity-health.spec.js +23 -0
  257. package/dist/execution-matrix/runtime-connectivity-health.spec.js.map +1 -0
  258. package/dist/execution-matrix/runtime-objects.d.ts +16 -0
  259. package/dist/execution-matrix/runtime-objects.d.ts.map +1 -0
  260. package/dist/execution-matrix/runtime-objects.js +20 -0
  261. package/dist/execution-matrix/runtime-objects.js.map +1 -0
  262. package/dist/execution-matrix/runtime-store.d.ts +114 -0
  263. package/dist/execution-matrix/runtime-store.d.ts.map +1 -0
  264. package/dist/execution-matrix/runtime-store.js +506 -0
  265. package/dist/execution-matrix/runtime-store.js.map +1 -0
  266. package/dist/execution-matrix/snapshot-runner.d.ts +50 -0
  267. package/dist/execution-matrix/snapshot-runner.d.ts.map +1 -0
  268. package/dist/execution-matrix/snapshot-runner.js +111 -0
  269. package/dist/execution-matrix/snapshot-runner.js.map +1 -0
  270. package/dist/execution-matrix/source-resolver-factories.d.ts +31 -0
  271. package/dist/execution-matrix/source-resolver-factories.d.ts.map +1 -0
  272. package/dist/execution-matrix/source-resolver-factories.js +71 -0
  273. package/dist/execution-matrix/source-resolver-factories.js.map +1 -0
  274. package/dist/execution-matrix/source-resolver-factories.spec.d.ts +2 -0
  275. package/dist/execution-matrix/source-resolver-factories.spec.d.ts.map +1 -0
  276. package/dist/execution-matrix/source-resolver-factories.spec.js +127 -0
  277. package/dist/execution-matrix/source-resolver-factories.spec.js.map +1 -0
  278. package/dist/execution-matrix/source-resolver.d.ts +31 -0
  279. package/dist/execution-matrix/source-resolver.d.ts.map +1 -0
  280. package/dist/execution-matrix/source-resolver.js +26 -0
  281. package/dist/execution-matrix/source-resolver.js.map +1 -0
  282. package/dist/execution-matrix/status.d.ts +7 -0
  283. package/dist/execution-matrix/status.d.ts.map +1 -0
  284. package/dist/execution-matrix/status.js +33 -0
  285. package/dist/execution-matrix/status.js.map +1 -0
  286. package/dist/execution-matrix/xmemory-entity-collections.d.ts +69 -0
  287. package/dist/execution-matrix/xmemory-entity-collections.d.ts.map +1 -0
  288. package/dist/execution-matrix/xmemory-entity-collections.js +120 -0
  289. package/dist/execution-matrix/xmemory-entity-collections.js.map +1 -0
  290. package/dist/execution-matrix/xmemory-entity-collections.spec.d.ts +2 -0
  291. package/dist/execution-matrix/xmemory-entity-collections.spec.d.ts.map +1 -0
  292. package/dist/execution-matrix/xmemory-entity-collections.spec.js +112 -0
  293. package/dist/execution-matrix/xmemory-entity-collections.spec.js.map +1 -0
  294. package/dist/execution-matrix/xmemory-op-tier.d.ts +172 -0
  295. package/dist/execution-matrix/xmemory-op-tier.d.ts.map +1 -0
  296. package/dist/execution-matrix/xmemory-op-tier.js +339 -0
  297. package/dist/execution-matrix/xmemory-op-tier.js.map +1 -0
  298. package/dist/execution-matrix/xmemory-op-tier.spec.d.ts +2 -0
  299. package/dist/execution-matrix/xmemory-op-tier.spec.d.ts.map +1 -0
  300. package/dist/execution-matrix/xmemory-op-tier.spec.js +198 -0
  301. package/dist/execution-matrix/xmemory-op-tier.spec.js.map +1 -0
  302. package/dist/execution-matrix/xronox-matrix-factory.d.ts +38 -0
  303. package/dist/execution-matrix/xronox-matrix-factory.d.ts.map +1 -0
  304. package/dist/execution-matrix/xronox-matrix-factory.js +77 -0
  305. package/dist/execution-matrix/xronox-matrix-factory.js.map +1 -0
  306. package/dist/execution-matrix/xronox-store-native-driver-hooks.d.ts +15 -0
  307. package/dist/execution-matrix/xronox-store-native-driver-hooks.d.ts.map +1 -0
  308. package/dist/execution-matrix/xronox-store-native-driver-hooks.js +41 -0
  309. package/dist/execution-matrix/xronox-store-native-driver-hooks.js.map +1 -0
  310. package/dist/test-fixtures/exellix-test-matrix-ids.d.ts +16 -0
  311. package/dist/test-fixtures/exellix-test-matrix-ids.d.ts.map +1 -0
  312. package/dist/test-fixtures/exellix-test-matrix-ids.js +16 -0
  313. package/dist/test-fixtures/exellix-test-matrix-ids.js.map +1 -0
  314. package/dist/test-fixtures/seed-exellix-test-matrix-config.d.ts +26 -0
  315. package/dist/test-fixtures/seed-exellix-test-matrix-config.d.ts.map +1 -0
  316. package/dist/test-fixtures/seed-exellix-test-matrix-config.js +82 -0
  317. package/dist/test-fixtures/seed-exellix-test-matrix-config.js.map +1 -0
  318. package/package.json +67 -0
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Read-only report: **entity type keys** from Catalox native catalog(s) and/or **scoped-data tier discovery**;
3
+ * `@x12i/xmemory-store` supplies namespace-scoped counts (same predicates as {@link getXmemoryTierStatistics}).
4
+ */
5
+ import type { Catalox, CataloxContext, UnifiedCatalogItem } from '@x12i/catalox';
6
+ import type { XmemoryDataTier, XmemoryMongoClient } from '../execution-matrix/memorix-runtime-tier.js';
7
+ import { MongoClient } from 'mongodb';
8
+ import { type ExecutionMatrixRuntime } from '../execution-matrix/runtime-store.js';
9
+ /** `entityCatalogId` / row **`catalogId`** when types come from tier statistics, not a Catalox catalog. */
10
+ export declare const SCOPED_DATA_TIER_ENTITY_DISCOVERY_CATALOG_ID: "__scoped_data_tier__";
11
+ /**
12
+ * Default **`groupByPaths.scoped_data`** for tier discovery — broader than **`DEFAULT_ENTITY_TYPE_PATHS.scoped_data`**
13
+ * so rows that only store the discriminator under **`data.*`** / **`metadata.*`** still bucket into real type keys.
14
+ */
15
+ export declare const DEFAULT_ENTITY_DISCOVERY_SCOPED_DATA_GROUP_PATHS: readonly ["$entityType", "$entity_type", "$data.entityType", "$data.entity_type", "$metadata.entityType", "$metadata.entity_type"];
16
+ /** `$match` fragment: any of the common scoped-data locations equals **`entityTypeKey`**. */
17
+ export declare function buildExtendedScopedDataEntityTypeFilter(entityTypeKey: string): Record<string, unknown>;
18
+ export type ScopedDataTierEntityTypeDiscovery = {
19
+ keys: string[];
20
+ scopedDataMatchedTotal: number;
21
+ /** Doc count in the **`__missing__`** bucket for {@link ScopedDataTierEntityTypeDiscovery.groupByPathsUsed}. */
22
+ missingBucketDocCount: number;
23
+ groupByPathsUsed: readonly string[];
24
+ };
25
+ export type TierDiscoveryDiagnostics = ScopedDataTierEntityTypeDiscovery & {
26
+ /** When **`keys`** is empty but **`scopedDataMatchedTotal`** is not. */
27
+ emptyKeysHint?: string;
28
+ };
29
+ export type CollectScopedDataEntityTypeDiscoveryOptions = {
30
+ signal?: AbortSignal;
31
+ /** Override **`groupByPaths.scoped_data`** (Mongo aggregation field paths, usually with **`$`** prefix). */
32
+ groupByPathsScopedData?: readonly string[];
33
+ };
34
+ /** Normalize one or many catalog ids: trim, drop empties, preserve first-seen order. */
35
+ export declare function normalizeEntityReportCatalogIds(catalogIds: string | readonly string[]): string[];
36
+ /**
37
+ * Resolves the xmemory **entity type key** for a Catalox native row (used as `entityTypeKey` in tier match).
38
+ * Order: explicit `data.*` fields, then **`itemId`** (common when each row is one entity slug).
39
+ */
40
+ export declare function entityTypeKeyFromCatalogItem(item: UnifiedCatalogItem): string | undefined;
41
+ export type CataloxXmemoryEntitySurfaceCounts = {
42
+ scopedData: number;
43
+ things: number;
44
+ scopedViews: number;
45
+ snapshots: number;
46
+ };
47
+ /** Execution matrix slice for one entity type (rows match {@link buildMatrixRowEntityTypeExtraFilter}; snapshots use `entityType`). */
48
+ export type CataloxXmemoryEntityMatrixSlice = {
49
+ matrixCatalogId: string;
50
+ matrixRunId?: string;
51
+ rows: number;
52
+ snapshots: number;
53
+ error?: string;
54
+ };
55
+ export type CataloxXmemoryEntityCountRow = {
56
+ catalogId: string;
57
+ itemId: string;
58
+ entityTypeKey: string;
59
+ counts: CataloxXmemoryEntitySurfaceCounts;
60
+ /** Present when {@link RunCataloxXmemoryEntityCountReportOptions.matrix} was passed. */
61
+ matrix?: CataloxXmemoryEntityMatrixSlice;
62
+ error?: string;
63
+ };
64
+ export type CataloxXmemoryEntityCountReport = {
65
+ kind: 'catalox-xmemory-entity-counts';
66
+ generatedAt: string;
67
+ namespace: string;
68
+ /** Comma-separated when multiple catalogs; {@link SCOPED_DATA_TIER_ENTITY_DISCOVERY_CATALOG_ID} for tier discovery. */
69
+ entityCatalogId: string;
70
+ context: CataloxContext;
71
+ mongo: {
72
+ opDb: string;
73
+ thingsDb: string;
74
+ scopedDataCollection: string;
75
+ viewsCollection: string;
76
+ snapshotsCollection: string;
77
+ };
78
+ catalogList: {
79
+ outcome: string;
80
+ error?: string;
81
+ itemCount: number;
82
+ };
83
+ /** Set when matrix counts were requested (see {@link RunCataloxXmemoryEntityCountReportOptions.matrix}). */
84
+ executionMatrix?: {
85
+ matrixCatalogId: string;
86
+ matrixRunId?: string;
87
+ mongoDb?: string;
88
+ };
89
+ /** Present for {@link runScopedDataEntityTypeDiscoveryReport} when tier statistics were used to list types. */
90
+ tierDiscoveryDiagnostics?: TierDiscoveryDiagnostics;
91
+ entities: CataloxXmemoryEntityCountRow[];
92
+ };
93
+ /**
94
+ * Parse a comma-separated list of Mongo field paths for **`groupByPaths.scoped_data`**.
95
+ * Paths without a leading **`$`** get **`$`** prefixed (e.g. **`data.entityType`** → **`$data.entityType`**).
96
+ */
97
+ export declare function parseTierDiscoveryGroupPathsCsv(raw: string | undefined): readonly string[] | undefined;
98
+ /**
99
+ * Paginates **`getXmemoryTierStatistics`** (`scoped_data` only) with configurable **`groupByPaths`**
100
+ * until all distinct **`typeKey`** values are collected for **`namespace`**.
101
+ */
102
+ export declare function collectScopedDataEntityTypeDiscovery(tier: XmemoryDataTier, namespace: string, options?: CollectScopedDataEntityTypeDiscoveryOptions): Promise<ScopedDataTierEntityTypeDiscovery>;
103
+ /** @returns Distinct type keys only — use {@link collectScopedDataEntityTypeDiscovery} for diagnostics. */
104
+ export declare function collectScopedDataEntityTypeKeys(tier: XmemoryDataTier, namespace: string, signal?: AbortSignal): Promise<string[]>;
105
+ export type RunCataloxXmemoryEntityCountReportOptions = {
106
+ context?: Partial<CataloxContext>;
107
+ pageSize?: number;
108
+ /**
109
+ * When set, each entity row includes **execution matrix** row + snapshot counts for that
110
+ * **`entityTypeKey`** (aligned with {@link fetchMemorixMatrixEntityFacet} / materialized `input.entityType`).
111
+ */
112
+ matrix?: {
113
+ runtime: ExecutionMatrixRuntime;
114
+ matrixCatalogId: string;
115
+ matrixRunId?: string;
116
+ /** Echoed on {@link CataloxXmemoryEntityCountReport.executionMatrix} for operators. */
117
+ mongoDb?: string;
118
+ };
119
+ signal?: AbortSignal;
120
+ /** Override **`groupByPaths.scoped_data`** for {@link runScopedDataEntityTypeDiscoveryReport} / {@link collectScopedDataEntityTypeDiscovery}. */
121
+ discoveryGroupByPathsScopedData?: readonly string[];
122
+ /**
123
+ * **`extended`**: scoped_data document counts use {@link buildExtendedScopedDataEntityTypeFilter} (nested + top-level).
124
+ * {@link runScopedDataEntityTypeDiscoveryReport} always uses **`extended`** for scoped_data counts.
125
+ */
126
+ scopedDataEntityMatch?: 'default' | 'extended';
127
+ };
128
+ /**
129
+ * Discovers **entity type keys** from scoped-data tier statistics for **`namespace`**, then emits the same
130
+ * per-type surface counts (and optional matrix slice) as {@link runCataloxXmemoryEntityCountReport}.
131
+ * Does **not** call Catalox.
132
+ */
133
+ export declare function runScopedDataEntityTypeDiscoveryReport(tier: XmemoryDataTier, namespace: string, options?: RunCataloxXmemoryEntityCountReportOptions): Promise<CataloxXmemoryEntityCountReport>;
134
+ /**
135
+ * Lists native items across **`catalogIds`**, derives {@link entityTypeKeyFromCatalogItem} per row, then counts
136
+ * Mongo tier documents per surface for **`namespace`**, and optional **execution matrix** row / snapshot counts.
137
+ *
138
+ * **`groupByPaths.scoped_data`** for tier statistics should use the same paths as
139
+ * **`RECOMMENDED_TIER_STATS_SCOPED_DATA_GROUP_PATHS`** in **`xmemory-op-tier.ts`** so catalog keys align with scoped-data buckets.
140
+ */
141
+ export declare function runCataloxXmemoryEntityCountReport(catalox: Catalox, tier: XmemoryDataTier, catalogIds: string | readonly string[], namespace: string, options?: RunCataloxXmemoryEntityCountReportOptions): Promise<CataloxXmemoryEntityCountReport>;
142
+ export declare function formatCataloxXmemoryEntityCountMarkdown(report: CataloxXmemoryEntityCountReport): string;
143
+ /** Minimal {@link XmemoryMongoClient} so tier `countMany` reaches op DB collections not registered on opStore. */
144
+ export declare function driverBackedMongoClientForXmemoryCli(driver: MongoClient): XmemoryMongoClient;
145
+ //# sourceMappingURL=catalox-xmemory-entity-count-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalox-xmemory-entity-count-report.d.ts","sourceRoot":"","sources":["../../src/catalox-inventory/catalox-xmemory-entity-count-report.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,477 @@
1
+ import { buildTierFetchMatch, countScopedDataDocuments, ENTITY_TYPES_LIMIT_MAX, getMemorixTierStatistics, TIER_STATS_MISSING_TYPE, } from '../execution-matrix/memorix-tier-statistics.js';
2
+ import { buildMatrixRowEntityTypeExtraFilter } from '../execution-matrix/memorix-entity-type-helpers.js';
3
+ import { buildMatrixRowReadFilter } from '../execution-matrix/runtime-store.js';
4
+ import { countXmemoryOpCollectionDocuments } from '../execution-matrix/xmemory-op-tier.js';
5
+ const DEFAULT_PAGE = 200;
6
+ /** `entityCatalogId` / row **`catalogId`** when types come from tier statistics, not a Catalox catalog. */
7
+ export const SCOPED_DATA_TIER_ENTITY_DISCOVERY_CATALOG_ID = '__scoped_data_tier__';
8
+ /**
9
+ * Default **`groupByPaths.scoped_data`** for tier discovery — broader than **`DEFAULT_ENTITY_TYPE_PATHS.scoped_data`**
10
+ * so rows that only store the discriminator under **`data.*`** / **`metadata.*`** still bucket into real type keys.
11
+ */
12
+ export const DEFAULT_ENTITY_DISCOVERY_SCOPED_DATA_GROUP_PATHS = [
13
+ '$entityType',
14
+ '$entity_type',
15
+ '$data.entityType',
16
+ '$data.entity_type',
17
+ '$metadata.entityType',
18
+ '$metadata.entity_type',
19
+ ];
20
+ /** `$match` fragment: any of the common scoped-data locations equals **`entityTypeKey`**. */
21
+ export function buildExtendedScopedDataEntityTypeFilter(entityTypeKey) {
22
+ return {
23
+ $or: [
24
+ { entityType: entityTypeKey },
25
+ { entity_type: entityTypeKey },
26
+ { 'data.entityType': entityTypeKey },
27
+ { 'data.entity_type': entityTypeKey },
28
+ { 'metadata.entityType': entityTypeKey },
29
+ { 'metadata.entity_type': entityTypeKey },
30
+ ],
31
+ };
32
+ }
33
+ function readDataString(data, key) {
34
+ if (!data || typeof data !== 'object' || Array.isArray(data))
35
+ return undefined;
36
+ const v = data[key];
37
+ return typeof v === 'string' && v.trim() ? v.trim() : undefined;
38
+ }
39
+ /** Normalize one or many catalog ids: trim, drop empties, preserve first-seen order. */
40
+ export function normalizeEntityReportCatalogIds(catalogIds) {
41
+ const raw = typeof catalogIds === 'string' ? [catalogIds] : [...catalogIds];
42
+ const out = [];
43
+ const seen = new Set();
44
+ for (const r of raw) {
45
+ const t = String(r ?? '').trim();
46
+ if (!t || seen.has(t))
47
+ continue;
48
+ seen.add(t);
49
+ out.push(t);
50
+ }
51
+ return out;
52
+ }
53
+ /**
54
+ * Resolves the xmemory **entity type key** for a Catalox native row (used as `entityTypeKey` in tier match).
55
+ * Order: explicit `data.*` fields, then **`itemId`** (common when each row is one entity slug).
56
+ */
57
+ export function entityTypeKeyFromCatalogItem(item) {
58
+ const d = item.data;
59
+ return (readDataString(d, 'entityType') ??
60
+ readDataString(d, 'typeKey') ??
61
+ readDataString(d, 'memorixEntityType') ??
62
+ readDataString(d, 'memorixEntityName') ??
63
+ readDataString(d, 'thingType') ??
64
+ readDataString(d, 'xmemoryEntityType') ??
65
+ (typeof item.itemId === 'string' && item.itemId.trim() ? item.itemId.trim() : undefined));
66
+ }
67
+ async function countSurfacesForEntityType(tier, namespace, entityTypeKey, scopedDataMatch = 'default') {
68
+ const scopedScope = scopedDataMatch === 'extended'
69
+ ? { namespace, extraMatch: buildExtendedScopedDataEntityTypeFilter(entityTypeKey) }
70
+ : { namespace, entityTypeKey };
71
+ const facetScope = { namespace, entityTypeKey };
72
+ const thingsCol = tier.corpusStore.collection(tier.env.thingsCollection);
73
+ const viewsCol = tier.opStore.collection(tier.env.viewsCollection);
74
+ const [scopedData, things, scopedViews, snapshots] = await Promise.all([
75
+ countScopedDataDocuments(tier, scopedScope, {}),
76
+ thingsCol.countMatching(buildTierFetchMatch(facetScope, 'things')),
77
+ viewsCol.countMatching(buildTierFetchMatch(facetScope, 'scoped_views')),
78
+ countXmemoryOpCollectionDocuments(tier, tier.env.snapshotsCollection, buildTierFetchMatch(facetScope, 'snapshots')),
79
+ ]);
80
+ return { scopedData, things, scopedViews, snapshots };
81
+ }
82
+ async function countMatrixForEntityType(runtime, matrixCatalogId, matrixRunId, entityTypeKey) {
83
+ const rowFilter = buildMatrixRowReadFilter(matrixCatalogId, matrixRunId, undefined, undefined, buildMatrixRowEntityTypeExtraFilter(entityTypeKey));
84
+ const [rows, snapshots] = await Promise.all([
85
+ runtime.countRowsMatching(rowFilter),
86
+ runtime.countSnapshots({ matrixCatalogId, matrixRunId, entityType: entityTypeKey }),
87
+ ]);
88
+ return { rows, snapshots };
89
+ }
90
+ /**
91
+ * Parse a comma-separated list of Mongo field paths for **`groupByPaths.scoped_data`**.
92
+ * Paths without a leading **`$`** get **`$`** prefixed (e.g. **`data.entityType`** → **`$data.entityType`**).
93
+ */
94
+ export function parseTierDiscoveryGroupPathsCsv(raw) {
95
+ if (!raw?.trim())
96
+ return undefined;
97
+ return raw
98
+ .split(',')
99
+ .map((s) => s.trim())
100
+ .filter(Boolean)
101
+ .map((p) => (p.startsWith('$') ? p : `$${p}`));
102
+ }
103
+ /**
104
+ * Paginates **`getXmemoryTierStatistics`** (`scoped_data` only) with configurable **`groupByPaths`**
105
+ * until all distinct **`typeKey`** values are collected for **`namespace`**.
106
+ */
107
+ export async function collectScopedDataEntityTypeDiscovery(tier, namespace, options) {
108
+ const paths = options?.groupByPathsScopedData && options.groupByPathsScopedData.length > 0
109
+ ? options.groupByPathsScopedData
110
+ : DEFAULT_ENTITY_DISCOVERY_SCOPED_DATA_GROUP_PATHS;
111
+ const keys = new Set();
112
+ let missingBucketDocCount = 0;
113
+ let scopedDataMatchedTotal = 0;
114
+ let skip = 0;
115
+ const limit = ENTITY_TYPES_LIMIT_MAX;
116
+ for (;;) {
117
+ const stats = await getMemorixTierStatistics(tier, {
118
+ namespace,
119
+ entityTypesSkip: skip,
120
+ entityTypesLimit: limit,
121
+ surfaces: ['scoped_data'],
122
+ groupByPaths: { scoped_data: [...paths] },
123
+ force: true,
124
+ signal: options?.signal,
125
+ });
126
+ const sec = stats.scopedData;
127
+ if (skip === 0)
128
+ scopedDataMatchedTotal = sec.matchedDocTotal;
129
+ for (const e of sec.entityTypes) {
130
+ const k = String(e.typeKey ?? '');
131
+ if (!k)
132
+ continue;
133
+ if (k === TIER_STATS_MISSING_TYPE) {
134
+ missingBucketDocCount = Math.max(missingBucketDocCount, e.docCount ?? 0);
135
+ }
136
+ else {
137
+ keys.add(k);
138
+ }
139
+ }
140
+ if (!sec.entityTypesHasMore)
141
+ break;
142
+ skip += limit;
143
+ }
144
+ return {
145
+ keys: [...keys].sort((a, b) => a.localeCompare(b)),
146
+ scopedDataMatchedTotal,
147
+ missingBucketDocCount,
148
+ groupByPathsUsed: paths,
149
+ };
150
+ }
151
+ /** @returns Distinct type keys only — use {@link collectScopedDataEntityTypeDiscovery} for diagnostics. */
152
+ export async function collectScopedDataEntityTypeKeys(tier, namespace, signal) {
153
+ const d = await collectScopedDataEntityTypeDiscovery(tier, namespace, { signal });
154
+ return d.keys;
155
+ }
156
+ async function appendCountsForEntityTypeKey(entityTypeKey, catalogId, itemId, tier, namespace, matrixOpt, scopedDataMatch) {
157
+ try {
158
+ const counts = await countSurfacesForEntityType(tier, namespace, entityTypeKey, scopedDataMatch);
159
+ let matrixSlice;
160
+ if (matrixOpt !== undefined) {
161
+ try {
162
+ const { rows, snapshots } = await countMatrixForEntityType(matrixOpt.runtime, matrixOpt.matrixCatalogId, matrixOpt.matrixRunId, entityTypeKey);
163
+ matrixSlice = {
164
+ matrixCatalogId: matrixOpt.matrixCatalogId,
165
+ ...(matrixOpt.matrixRunId ? { matrixRunId: matrixOpt.matrixRunId } : {}),
166
+ rows,
167
+ snapshots,
168
+ };
169
+ }
170
+ catch (me) {
171
+ matrixSlice = {
172
+ matrixCatalogId: matrixOpt.matrixCatalogId,
173
+ ...(matrixOpt.matrixRunId ? { matrixRunId: matrixOpt.matrixRunId } : {}),
174
+ rows: 0,
175
+ snapshots: 0,
176
+ error: me instanceof Error ? me.message : String(me),
177
+ };
178
+ }
179
+ }
180
+ return {
181
+ catalogId,
182
+ itemId,
183
+ entityTypeKey,
184
+ counts,
185
+ ...(matrixSlice !== undefined ? { matrix: matrixSlice } : {}),
186
+ };
187
+ }
188
+ catch (e) {
189
+ return {
190
+ catalogId,
191
+ itemId,
192
+ entityTypeKey,
193
+ counts: { scopedData: 0, things: 0, scopedViews: 0, snapshots: 0 },
194
+ error: e instanceof Error ? e.message : String(e),
195
+ };
196
+ }
197
+ }
198
+ /**
199
+ * Discovers **entity type keys** from scoped-data tier statistics for **`namespace`**, then emits the same
200
+ * per-type surface counts (and optional matrix slice) as {@link runCataloxXmemoryEntityCountReport}.
201
+ * Does **not** call Catalox.
202
+ */
203
+ export async function runScopedDataEntityTypeDiscoveryReport(tier, namespace, options) {
204
+ const matrixOpt = options?.matrix;
205
+ const executionMatrixMeta = matrixOpt !== undefined
206
+ ? {
207
+ matrixCatalogId: matrixOpt.matrixCatalogId,
208
+ ...(matrixOpt.matrixRunId ? { matrixRunId: matrixOpt.matrixRunId } : {}),
209
+ ...(matrixOpt.mongoDb ? { mongoDb: matrixOpt.mongoDb } : {}),
210
+ }
211
+ : undefined;
212
+ const discoveryPaths = options?.discoveryGroupByPathsScopedData;
213
+ const disc = await collectScopedDataEntityTypeDiscovery(tier, namespace, {
214
+ signal: options?.signal,
215
+ ...(discoveryPaths?.length ? { groupByPathsScopedData: discoveryPaths } : {}),
216
+ });
217
+ let emptyKeysHint;
218
+ if (disc.keys.length === 0 && disc.scopedDataMatchedTotal === 0) {
219
+ emptyKeysHint =
220
+ 'No scoped_data documents matched this namespace (verify namespace spelling, MONGO_URI, op DB, and SCOPED_DATA_COLLECTION / X_SCOPED_DATA_COLLECTION).';
221
+ }
222
+ else if (disc.keys.length === 0 && disc.missingBucketDocCount > 0) {
223
+ emptyKeysHint =
224
+ 'Scoped_data rows exist for this namespace, but every document fell into the __missing__ bucket for the configured group paths — set --entity-discovery-group-paths or XMEMORY_ENTITY_DISCOVERY_GROUP_PATHS to match your document shape.';
225
+ }
226
+ else if (disc.keys.length === 0) {
227
+ emptyKeysHint =
228
+ 'Scoped_data matched the namespace but no typed entity buckets were returned — inspect tier statistics vs document fields.';
229
+ }
230
+ const tierDiscoveryDiagnostics = {
231
+ ...disc,
232
+ ...(emptyKeysHint ? { emptyKeysHint } : {}),
233
+ };
234
+ const entities = [];
235
+ for (const entityTypeKey of disc.keys) {
236
+ entities.push(await appendCountsForEntityTypeKey(entityTypeKey, SCOPED_DATA_TIER_ENTITY_DISCOVERY_CATALOG_ID, entityTypeKey, tier, namespace, matrixOpt, 'extended'));
237
+ }
238
+ const env = tier.env;
239
+ return {
240
+ kind: 'catalox-xmemory-entity-counts',
241
+ generatedAt: new Date().toISOString(),
242
+ namespace,
243
+ entityCatalogId: SCOPED_DATA_TIER_ENTITY_DISCOVERY_CATALOG_ID,
244
+ context: {
245
+ superAdmin: true,
246
+ userId: 'exellix-runtime-scoped-data-entity-discovery',
247
+ actor: { type: 'system', id: '@exellix/exellix-runtime' },
248
+ ...options?.context,
249
+ },
250
+ mongo: {
251
+ opDb: env.opDb,
252
+ thingsDb: env.thingsDb,
253
+ scopedDataCollection: env.scopedDataCollection,
254
+ viewsCollection: env.viewsCollection,
255
+ snapshotsCollection: env.snapshotsCollection,
256
+ },
257
+ catalogList: {
258
+ outcome: 'scoped_data_tier_entity_types',
259
+ itemCount: disc.keys.length,
260
+ },
261
+ ...(executionMatrixMeta !== undefined ? { executionMatrix: executionMatrixMeta } : {}),
262
+ tierDiscoveryDiagnostics,
263
+ entities,
264
+ };
265
+ }
266
+ /**
267
+ * Lists native items across **`catalogIds`**, derives {@link entityTypeKeyFromCatalogItem} per row, then counts
268
+ * Mongo tier documents per surface for **`namespace`**, and optional **execution matrix** row / snapshot counts.
269
+ *
270
+ * **`groupByPaths.scoped_data`** for tier statistics should use the same paths as
271
+ * **`RECOMMENDED_TIER_STATS_SCOPED_DATA_GROUP_PATHS`** in **`xmemory-op-tier.ts`** so catalog keys align with scoped-data buckets.
272
+ */
273
+ export async function runCataloxXmemoryEntityCountReport(catalox, tier, catalogIds, namespace, options) {
274
+ const ids = normalizeEntityReportCatalogIds(catalogIds);
275
+ if (ids.length === 0) {
276
+ throw new Error('runCataloxXmemoryEntityCountReport: at least one non-empty catalog id is required');
277
+ }
278
+ const ctx = {
279
+ superAdmin: true,
280
+ userId: 'exellix-runtime-catalox-xmemory-entity-counts',
281
+ actor: { type: 'system', id: '@exellix/exellix-runtime' },
282
+ ...options?.context,
283
+ };
284
+ const pageSize = Math.max(50, Math.min(options?.pageSize ?? DEFAULT_PAGE, 2000));
285
+ const matrixOpt = options?.matrix;
286
+ const executionMatrixMeta = matrixOpt !== undefined
287
+ ? {
288
+ matrixCatalogId: matrixOpt.matrixCatalogId,
289
+ ...(matrixOpt.matrixRunId ? { matrixRunId: matrixOpt.matrixRunId } : {}),
290
+ ...(matrixOpt.mongoDb ? { mongoDb: matrixOpt.mongoDb } : {}),
291
+ }
292
+ : undefined;
293
+ const rows = [];
294
+ let listOutcome = 'ok';
295
+ let listError;
296
+ outer: for (const catalogId of ids) {
297
+ let offset = 0;
298
+ for (;;) {
299
+ try {
300
+ const page = await catalox.listCatalogItems(ctx, catalogId, {
301
+ limit: pageSize,
302
+ offset,
303
+ scope: { superAdmin: true },
304
+ });
305
+ if (page.listOutcome !== 'ok') {
306
+ listOutcome = page.listOutcome;
307
+ listError = `${catalogId}: ${page.issues?.map((i) => `${i.severity ?? ''}:${JSON.stringify(i)}`).join('; ') ?? 'list failed'}`;
308
+ break outer;
309
+ }
310
+ for (const item of page.items)
311
+ rows.push({ item, sourceCatalogId: catalogId });
312
+ if (page.items.length < pageSize)
313
+ break;
314
+ offset += page.items.length;
315
+ }
316
+ catch (e) {
317
+ listError = `${catalogId}: ${e instanceof Error ? e.message : String(e)}`;
318
+ listOutcome = 'error';
319
+ break outer;
320
+ }
321
+ }
322
+ }
323
+ const entities = [];
324
+ for (const { item, sourceCatalogId } of rows) {
325
+ const entityTypeKey = entityTypeKeyFromCatalogItem(item);
326
+ if (!entityTypeKey) {
327
+ entities.push({
328
+ catalogId: sourceCatalogId,
329
+ itemId: item.itemId,
330
+ entityTypeKey: '',
331
+ counts: { scopedData: 0, things: 0, scopedViews: 0, snapshots: 0 },
332
+ error: 'no_entity_type_key (set data.entityType or similar, or use itemId as the type slug)',
333
+ });
334
+ continue;
335
+ }
336
+ entities.push(await appendCountsForEntityTypeKey(entityTypeKey, sourceCatalogId, item.itemId, tier, namespace, matrixOpt, options?.scopedDataEntityMatch ?? 'default'));
337
+ }
338
+ const env = tier.env;
339
+ return {
340
+ kind: 'catalox-xmemory-entity-counts',
341
+ generatedAt: new Date().toISOString(),
342
+ namespace,
343
+ entityCatalogId: ids.join(','),
344
+ context: ctx,
345
+ mongo: {
346
+ opDb: env.opDb,
347
+ thingsDb: env.thingsDb,
348
+ scopedDataCollection: env.scopedDataCollection,
349
+ viewsCollection: env.viewsCollection,
350
+ snapshotsCollection: env.snapshotsCollection,
351
+ },
352
+ catalogList: { outcome: listOutcome, ...(listError ? { error: listError } : {}), itemCount: rows.length },
353
+ ...(executionMatrixMeta !== undefined ? { executionMatrix: executionMatrixMeta } : {}),
354
+ entities,
355
+ };
356
+ }
357
+ export function formatCataloxXmemoryEntityCountMarkdown(report) {
358
+ const em = report.executionMatrix;
359
+ const isTierDiscovery = report.entityCatalogId === SCOPED_DATA_TIER_ENTITY_DISCOVERY_CATALOG_ID;
360
+ const title = isTierDiscovery
361
+ ? '# xmemory: scoped-data entity types → surface counts'
362
+ : '# Catalox → xmemory entity counts';
363
+ const catalogLabel = isTierDiscovery
364
+ ? `**Discovery:** scoped-data tier (\`${SCOPED_DATA_TIER_ENTITY_DISCOVERY_CATALOG_ID}\`)`
365
+ : `**Entity catalog(s):** \`${report.entityCatalogId}\``;
366
+ const lines = [
367
+ title,
368
+ '',
369
+ `- **Generated:** ${report.generatedAt}`,
370
+ `- **Namespace:** ${report.namespace}`,
371
+ `- ${catalogLabel}`,
372
+ `- **Catalog / discovery list:** ${report.catalogList.outcome} (${report.catalogList.itemCount} rows)`,
373
+ `- **Mongo:** opDb \`${report.mongo.opDb}\` · scopedData \`${report.mongo.scopedDataCollection}\` · views \`${report.mongo.viewsCollection}\` · snapshots \`${report.mongo.snapshotsCollection}\` · thingsDb \`${report.mongo.thingsDb}\``,
374
+ ...(isTierDiscovery
375
+ ? [
376
+ '',
377
+ `_Entity type keys come from \`getXmemoryTierStatistics\` (\`scoped_data\` only) with broader default \`groupByPaths.scoped_data\` than stock tier stats so nested \`data.*\` / \`metadata.*\` discriminators still bucket. Paginated at \`${ENTITY_TYPES_LIMIT_MAX}\` types per page. Per-row **scopedData** counts use \`buildExtendedScopedDataEntityTypeFilter\`; things / views / snapshots still match top-level \`entityTypeKey\`._`,
378
+ ]
379
+ : []),
380
+ ...(report.tierDiscoveryDiagnostics
381
+ ? [
382
+ '',
383
+ '### Tier discovery diagnostics',
384
+ '',
385
+ `- **scopedDataMatchedTotal:** ${report.tierDiscoveryDiagnostics.scopedDataMatchedTotal}`,
386
+ `- **missingBucketDocCount (\`__missing__\`):** ${report.tierDiscoveryDiagnostics.missingBucketDocCount}`,
387
+ `- **groupByPathsUsed:** ${report.tierDiscoveryDiagnostics.groupByPathsUsed.map((p) => `\`${p}\``).join(', ')}`,
388
+ ...(report.tierDiscoveryDiagnostics.emptyKeysHint
389
+ ? ['', `_**Hint:** ${report.tierDiscoveryDiagnostics.emptyKeysHint}_`]
390
+ : []),
391
+ ]
392
+ : []),
393
+ ...(em
394
+ ? [
395
+ '',
396
+ `### Execution matrix`,
397
+ '',
398
+ `- **matrixCatalogId:** \`${em.matrixCatalogId}\`${em.matrixRunId ? ` · **matrixRunId:** \`${em.matrixRunId}\`` : ''}${em.mongoDb ? ` · **DB:** \`${em.mongoDb}\`` : ''}`,
399
+ ]
400
+ : []),
401
+ '',
402
+ em
403
+ ? '| itemId | entityTypeKey | scopedData | things | scopedViews | snapshots | matrixRows | matrixSnapshots |'
404
+ : '| itemId | entityTypeKey | scopedData | things | scopedViews | snapshots |',
405
+ em
406
+ ? '|--------|---------------|------------:|------:|-------------:|----------:|-------------:|----------------:|'
407
+ : '|--------|---------------|------------:|------:|-------------:|----------:|',
408
+ ];
409
+ for (const r of report.entities) {
410
+ const c = r.counts;
411
+ const err = r.error ? ` ⚠ ${r.error}` : '';
412
+ const m = r.matrix;
413
+ const mErr = m?.error ? ` ⚠ ${m.error}` : '';
414
+ if (em) {
415
+ lines.push(`| ${r.itemId} | ${r.entityTypeKey || '—'} | ${c.scopedData} | ${c.things} | ${c.scopedViews} | ${c.snapshots} | ${m?.rows ?? '—'} | ${m?.snapshots ?? '—'} |${err}${mErr}`);
416
+ }
417
+ else {
418
+ lines.push(`| ${r.itemId} | ${r.entityTypeKey || '—'} | ${c.scopedData} | ${c.things} | ${c.scopedViews} | ${c.snapshots} |${err}`);
419
+ }
420
+ }
421
+ return lines.join('\n');
422
+ }
423
+ /** Minimal {@link XmemoryMongoClient} so tier `countMany` reaches op DB collections not registered on opStore. */
424
+ export function driverBackedMongoClientForXmemoryCli(driver) {
425
+ return {
426
+ findById: async ({ database, collection, id, idField, projection }) => {
427
+ const field = idField ?? '_id';
428
+ return driver.db(database).collection(collection).findOne({ [field]: id }, {
429
+ projection,
430
+ });
431
+ },
432
+ findMany: async ({ database, collection, filter, projection, limit, skip }) => {
433
+ let cur = driver.db(database).collection(collection).find(filter ?? {}, { projection });
434
+ if (skip !== undefined)
435
+ cur = cur.skip(skip);
436
+ if (limit !== undefined)
437
+ cur = cur.limit(limit);
438
+ return cur.toArray();
439
+ },
440
+ countMany: async ({ database, collection, filter }) => {
441
+ return driver.db(database).collection(collection).countDocuments(filter ?? {});
442
+ },
443
+ upsertOne: async ({ database, collection, filter, set, setOnInsert }) => {
444
+ const col = driver.db(database).collection(collection);
445
+ const r = await col.updateOne(filter, { $set: set, ...(setOnInsert && Object.keys(setOnInsert).length > 0 ? { $setOnInsert: setOnInsert } : {}) }, { upsert: true });
446
+ return {
447
+ matchedCount: r.matchedCount,
448
+ modifiedCount: r.modifiedCount,
449
+ upsertedCount: r.upsertedCount ?? 0,
450
+ };
451
+ },
452
+ findOne: async ({ database, collection, filter, projection }) => {
453
+ return driver.db(database).collection(collection).findOne(filter ?? {}, { projection });
454
+ },
455
+ createIndex: async ({ database, collection, spec, options }) => {
456
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
457
+ await driver.db(database).collection(collection).createIndex(spec, options);
458
+ },
459
+ updateOne: async ({ database, collection, filter, update, options }) => {
460
+ const r = await driver.db(database).collection(collection).updateOne(filter, update, options);
461
+ return {
462
+ matchedCount: r.matchedCount,
463
+ modifiedCount: r.modifiedCount,
464
+ upsertedCount: r.upsertedCount,
465
+ };
466
+ },
467
+ updateMany: async ({ database, collection, filter, update }) => {
468
+ const r = await driver.db(database).collection(collection).updateMany(filter, update);
469
+ return { matchedCount: r.matchedCount, modifiedCount: r.modifiedCount };
470
+ },
471
+ deleteOne: async ({ database, collection, filter }) => {
472
+ const r = await driver.db(database).collection(collection).deleteOne(filter);
473
+ return { deletedCount: r.deletedCount };
474
+ },
475
+ };
476
+ }
477
+ //# sourceMappingURL=catalox-xmemory-entity-count-report.js.map