@ffschrattenecker/tm1-mcp-server 6.0.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 (475) hide show
  1. package/CHANGELOG.md +1211 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE +34 -0
  4. package/README.md +276 -0
  5. package/dist/config.d.ts +35 -0
  6. package/dist/config.js +238 -0
  7. package/dist/http-transport.d.ts +8 -0
  8. package/dist/http-transport.js +132 -0
  9. package/dist/index.d.ts +18 -0
  10. package/dist/index.js +164 -0
  11. package/dist/lib/callgraph/callGraph.d.ts +124 -0
  12. package/dist/lib/callgraph/callGraph.js +334 -0
  13. package/dist/lib/callgraph/choreGraph.d.ts +23 -0
  14. package/dist/lib/callgraph/choreGraph.js +102 -0
  15. package/dist/lib/callgraph/dataFlow.d.ts +74 -0
  16. package/dist/lib/callgraph/dataFlow.js +271 -0
  17. package/dist/lib/callgraph/datasourceMembership.d.ts +31 -0
  18. package/dist/lib/callgraph/datasourceMembership.js +142 -0
  19. package/dist/lib/callgraph/lintTypes.d.ts +28 -0
  20. package/dist/lib/callgraph/lintTypes.js +2 -0
  21. package/dist/lib/callgraph/mdxMembers.d.ts +29 -0
  22. package/dist/lib/callgraph/mdxMembers.js +97 -0
  23. package/dist/lib/callgraph/referenceIndex.d.ts +179 -0
  24. package/dist/lib/callgraph/referenceIndex.js +584 -0
  25. package/dist/lib/callgraph/rulesLinter.d.ts +55 -0
  26. package/dist/lib/callgraph/rulesLinter.js +776 -0
  27. package/dist/lib/callgraph/rulesParser.d.ts +26 -0
  28. package/dist/lib/callgraph/rulesParser.js +71 -0
  29. package/dist/lib/callgraph/subsetUsage.d.ts +16 -0
  30. package/dist/lib/callgraph/subsetUsage.js +134 -0
  31. package/dist/lib/callgraph/tiParser.d.ts +21 -0
  32. package/dist/lib/callgraph/tiParser.js +672 -0
  33. package/dist/lib/callgraph/tiSignatures.d.ts +32 -0
  34. package/dist/lib/callgraph/tiSignatures.js +6185 -0
  35. package/dist/lib/callgraph/tm1-adapter.d.ts +32 -0
  36. package/dist/lib/callgraph/tm1-adapter.js +159 -0
  37. package/dist/lib/callgraph/types.d.ts +53 -0
  38. package/dist/lib/callgraph/types.js +2 -0
  39. package/dist/lib/callgraph/variableEnv.d.ts +86 -0
  40. package/dist/lib/callgraph/variableEnv.js +214 -0
  41. package/dist/lib/cell-address.d.ts +12 -0
  42. package/dist/lib/cell-address.js +71 -0
  43. package/dist/lib/complexity/antipatterns.d.ts +22 -0
  44. package/dist/lib/complexity/antipatterns.js +302 -0
  45. package/dist/lib/complexity/comment-classifier.d.ts +24 -0
  46. package/dist/lib/complexity/comment-classifier.js +43 -0
  47. package/dist/lib/complexity/cross-process.d.ts +78 -0
  48. package/dist/lib/complexity/cross-process.js +114 -0
  49. package/dist/lib/complexity/process-metrics.d.ts +78 -0
  50. package/dist/lib/complexity/process-metrics.js +278 -0
  51. package/dist/lib/complexity/rules-metrics.d.ts +31 -0
  52. package/dist/lib/complexity/rules-metrics.js +99 -0
  53. package/dist/lib/concurrency.d.ts +11 -0
  54. package/dist/lib/concurrency.js +27 -0
  55. package/dist/lib/control-name.d.ts +10 -0
  56. package/dist/lib/control-name.js +10 -0
  57. package/dist/lib/coordinate-error.d.ts +3 -0
  58. package/dist/lib/coordinate-error.js +29 -0
  59. package/dist/lib/credential-format.d.ts +23 -0
  60. package/dist/lib/credential-format.js +25 -0
  61. package/dist/lib/cube-stats/fetcher.d.ts +106 -0
  62. package/dist/lib/cube-stats/fetcher.js +194 -0
  63. package/dist/lib/feeders/brackets.d.ts +47 -0
  64. package/dist/lib/feeders/brackets.js +195 -0
  65. package/dist/lib/feeders/element-type-cache.d.ts +42 -0
  66. package/dist/lib/feeders/element-type-cache.js +86 -0
  67. package/dist/lib/feeders/static-heuristics.d.ts +101 -0
  68. package/dist/lib/feeders/static-heuristics.js +202 -0
  69. package/dist/lib/git-process.d.ts +67 -0
  70. package/dist/lib/git-process.js +243 -0
  71. package/dist/lib/mask-secrets.d.ts +10 -0
  72. package/dist/lib/mask-secrets.js +99 -0
  73. package/dist/lib/mdx.d.ts +3 -0
  74. package/dist/lib/mdx.js +13 -0
  75. package/dist/lib/naming/odata-filter.d.ts +15 -0
  76. package/dist/lib/naming/odata-filter.js +81 -0
  77. package/dist/lib/naming/rules.d.ts +34 -0
  78. package/dist/lib/naming/rules.js +215 -0
  79. package/dist/lib/pro-parser.d.ts +19 -0
  80. package/dist/lib/pro-parser.js +260 -0
  81. package/dist/lib/pro-serializer.d.ts +19 -0
  82. package/dist/lib/pro-serializer.js +170 -0
  83. package/dist/lib/process-parts-schema.d.ts +45 -0
  84. package/dist/lib/process-parts-schema.js +46 -0
  85. package/dist/lib/process-refs.d.ts +88 -0
  86. package/dist/lib/process-refs.js +441 -0
  87. package/dist/lib/rules-outline.d.ts +29 -0
  88. package/dist/lib/rules-outline.js +68 -0
  89. package/dist/lib/rules-patch.d.ts +6 -0
  90. package/dist/lib/rules-patch.js +59 -0
  91. package/dist/lib/safe-regex.d.ts +15 -0
  92. package/dist/lib/safe-regex.js +37 -0
  93. package/dist/lib/sample-cells.d.ts +48 -0
  94. package/dist/lib/sample-cells.js +146 -0
  95. package/dist/lib/slim-json-schema.d.ts +20 -0
  96. package/dist/lib/slim-json-schema.js +68 -0
  97. package/dist/lib/strip-comments.d.ts +23 -0
  98. package/dist/lib/strip-comments.js +61 -0
  99. package/dist/lib/tm1-events.d.ts +16 -0
  100. package/dist/lib/tm1-events.js +29 -0
  101. package/dist/lib/v12-compat/deprecated-ti.d.ts +17 -0
  102. package/dist/lib/v12-compat/deprecated-ti.js +257 -0
  103. package/dist/lib/v12-compat/scanner.d.ts +10 -0
  104. package/dist/lib/v12-compat/scanner.js +43 -0
  105. package/dist/lib/variables-ui-data.d.ts +26 -0
  106. package/dist/lib/variables-ui-data.js +77 -0
  107. package/dist/load-env.d.ts +2 -0
  108. package/dist/load-env.js +29 -0
  109. package/dist/logger.d.ts +4 -0
  110. package/dist/logger.js +60 -0
  111. package/dist/prompts/index.d.ts +3 -0
  112. package/dist/prompts/index.js +141 -0
  113. package/dist/resources/index.d.ts +5 -0
  114. package/dist/resources/index.js +237 -0
  115. package/dist/resources/list-handler.d.ts +40 -0
  116. package/dist/resources/list-handler.js +86 -0
  117. package/dist/resources/subscriptions.d.ts +19 -0
  118. package/dist/resources/subscriptions.js +80 -0
  119. package/dist/schemas/cells.d.ts +17 -0
  120. package/dist/schemas/cells.js +13 -0
  121. package/dist/schemas/common.d.ts +16 -0
  122. package/dist/schemas/common.js +14 -0
  123. package/dist/schemas/index.d.ts +10 -0
  124. package/dist/schemas/index.js +23 -0
  125. package/dist/schemas/metadata.d.ts +70 -0
  126. package/dist/schemas/metadata.js +47 -0
  127. package/dist/schemas/monitoring.d.ts +95 -0
  128. package/dist/schemas/monitoring.js +69 -0
  129. package/dist/schemas/processes.d.ts +74 -0
  130. package/dist/schemas/processes.js +66 -0
  131. package/dist/schemas/scheduling.d.ts +13 -0
  132. package/dist/schemas/scheduling.js +13 -0
  133. package/dist/schemas/security.d.ts +19 -0
  134. package/dist/schemas/security.js +16 -0
  135. package/dist/schemas/subsets.d.ts +12 -0
  136. package/dist/schemas/subsets.js +12 -0
  137. package/dist/schemas/views.d.ts +9 -0
  138. package/dist/schemas/views.js +9 -0
  139. package/dist/session-manager.d.ts +79 -0
  140. package/dist/session-manager.js +281 -0
  141. package/dist/tm1-client/connection/profile.d.ts +13 -0
  142. package/dist/tm1-client/connection/profile.js +99 -0
  143. package/dist/tm1-client/dispatcher.d.ts +5 -0
  144. package/dist/tm1-client/dispatcher.js +31 -0
  145. package/dist/tm1-client/http.d.ts +81 -0
  146. package/dist/tm1-client/http.js +547 -0
  147. package/dist/tm1-client/services/batch-service.d.ts +123 -0
  148. package/dist/tm1-client/services/batch-service.js +455 -0
  149. package/dist/tm1-client/services/cell-service.d.ts +71 -0
  150. package/dist/tm1-client/services/cell-service.js +333 -0
  151. package/dist/tm1-client/services/cellset-transform.d.ts +26 -0
  152. package/dist/tm1-client/services/cellset-transform.js +80 -0
  153. package/dist/tm1-client/services/chore-service.d.ts +68 -0
  154. package/dist/tm1-client/services/chore-service.js +179 -0
  155. package/dist/tm1-client/services/chore-status.d.ts +11 -0
  156. package/dist/tm1-client/services/chore-status.js +127 -0
  157. package/dist/tm1-client/services/cube-service.d.ts +134 -0
  158. package/dist/tm1-client/services/cube-service.js +294 -0
  159. package/dist/tm1-client/services/dimension-service.d.ts +118 -0
  160. package/dist/tm1-client/services/dimension-service.js +249 -0
  161. package/dist/tm1-client/services/element-service.d.ts +245 -0
  162. package/dist/tm1-client/services/element-service.js +809 -0
  163. package/dist/tm1-client/services/fallback.d.ts +44 -0
  164. package/dist/tm1-client/services/fallback.js +72 -0
  165. package/dist/tm1-client/services/file-service.d.ts +53 -0
  166. package/dist/tm1-client/services/file-service.js +218 -0
  167. package/dist/tm1-client/services/hierarchy-service.d.ts +129 -0
  168. package/dist/tm1-client/services/hierarchy-service.js +332 -0
  169. package/dist/tm1-client/services/monitoring-service.d.ts +34 -0
  170. package/dist/tm1-client/services/monitoring-service.js +123 -0
  171. package/dist/tm1-client/services/odata-page.d.ts +71 -0
  172. package/dist/tm1-client/services/odata-page.js +87 -0
  173. package/dist/tm1-client/services/process-service.d.ts +278 -0
  174. package/dist/tm1-client/services/process-service.js +874 -0
  175. package/dist/tm1-client/services/process-status.d.ts +21 -0
  176. package/dist/tm1-client/services/process-status.js +89 -0
  177. package/dist/tm1-client/services/security-service.d.ts +50 -0
  178. package/dist/tm1-client/services/security-service.js +93 -0
  179. package/dist/tm1-client/services/server-service.d.ts +116 -0
  180. package/dist/tm1-client/services/server-service.js +504 -0
  181. package/dist/tm1-client/services/subset-service.d.ts +37 -0
  182. package/dist/tm1-client/services/subset-service.js +122 -0
  183. package/dist/tm1-client/services/view-service.d.ts +46 -0
  184. package/dist/tm1-client/services/view-service.js +287 -0
  185. package/dist/tm1-client.d.ts +56 -0
  186. package/dist/tm1-client.js +126 -0
  187. package/dist/tools/analysis/analyze-callgraph.d.ts +28 -0
  188. package/dist/tools/analysis/analyze-callgraph.js +350 -0
  189. package/dist/tools/analysis/analyze-chore-graph.d.ts +2 -0
  190. package/dist/tools/analysis/analyze-chore-graph.js +148 -0
  191. package/dist/tools/analysis/analyze-object-usage.d.ts +2 -0
  192. package/dist/tools/analysis/analyze-object-usage.js +143 -0
  193. package/dist/tools/analysis/audit-complexity.d.ts +2 -0
  194. package/dist/tools/analysis/audit-complexity.js +255 -0
  195. package/dist/tools/analysis/audit-feeders.d.ts +2 -0
  196. package/dist/tools/analysis/audit-feeders.js +417 -0
  197. package/dist/tools/analysis/audit-naming.d.ts +2 -0
  198. package/dist/tools/analysis/audit-naming.js +379 -0
  199. package/dist/tools/analysis/check-v12-readiness.d.ts +2 -0
  200. package/dist/tools/analysis/check-v12-readiness.js +136 -0
  201. package/dist/tools/analysis/find-orphan-dimensions.d.ts +2 -0
  202. package/dist/tools/analysis/find-orphan-dimensions.js +55 -0
  203. package/dist/tools/analysis/invalidate-callgraph-cache.d.ts +2 -0
  204. package/dist/tools/analysis/invalidate-callgraph-cache.js +40 -0
  205. package/dist/tools/analysis/trace-data-flow.d.ts +2 -0
  206. package/dist/tools/analysis/trace-data-flow.js +138 -0
  207. package/dist/tools/annotations.d.ts +12 -0
  208. package/dist/tools/annotations.js +61 -0
  209. package/dist/tools/celldata/check-feeders.d.ts +2 -0
  210. package/dist/tools/celldata/check-feeders.js +48 -0
  211. package/dist/tools/celldata/check-writable-coords.d.ts +2 -0
  212. package/dist/tools/celldata/check-writable-coords.js +126 -0
  213. package/dist/tools/celldata/execute-mdx.d.ts +17 -0
  214. package/dist/tools/celldata/execute-mdx.js +126 -0
  215. package/dist/tools/celldata/get-cell-value.d.ts +2 -0
  216. package/dist/tools/celldata/get-cell-value.js +30 -0
  217. package/dist/tools/celldata/get-view-definition.d.ts +2 -0
  218. package/dist/tools/celldata/get-view-definition.js +29 -0
  219. package/dist/tools/celldata/get-view.d.ts +2 -0
  220. package/dist/tools/celldata/get-view.js +55 -0
  221. package/dist/tools/celldata/sample-cells.d.ts +2 -0
  222. package/dist/tools/celldata/sample-cells.js +101 -0
  223. package/dist/tools/celldata/trace-cell-calculation.d.ts +2 -0
  224. package/dist/tools/celldata/trace-cell-calculation.js +53 -0
  225. package/dist/tools/celldata/trace-feeders.d.ts +2 -0
  226. package/dist/tools/celldata/trace-feeders.js +44 -0
  227. package/dist/tools/celldata/write-cells.d.ts +2 -0
  228. package/dist/tools/celldata/write-cells.js +65 -0
  229. package/dist/tools/confirm.d.ts +10 -0
  230. package/dist/tools/confirm.js +64 -0
  231. package/dist/tools/define-tool.d.ts +51 -0
  232. package/dist/tools/define-tool.js +49 -0
  233. package/dist/tools/dimension-management/bulk-upsert-elements.d.ts +2 -0
  234. package/dist/tools/dimension-management/bulk-upsert-elements.js +103 -0
  235. package/dist/tools/dimension-management/create-dimension.d.ts +2 -0
  236. package/dist/tools/dimension-management/create-dimension.js +22 -0
  237. package/dist/tools/dimension-management/create-element-attribute.d.ts +2 -0
  238. package/dist/tools/dimension-management/create-element-attribute.js +26 -0
  239. package/dist/tools/dimension-management/create-element.d.ts +2 -0
  240. package/dist/tools/dimension-management/create-element.js +31 -0
  241. package/dist/tools/dimension-management/create-hierarchy.d.ts +2 -0
  242. package/dist/tools/dimension-management/create-hierarchy.js +22 -0
  243. package/dist/tools/dimension-management/delete-dimension.d.ts +2 -0
  244. package/dist/tools/dimension-management/delete-dimension.js +25 -0
  245. package/dist/tools/dimension-management/delete-element.d.ts +2 -0
  246. package/dist/tools/dimension-management/delete-element.js +26 -0
  247. package/dist/tools/dimension-management/delete-elements.d.ts +2 -0
  248. package/dist/tools/dimension-management/delete-elements.js +44 -0
  249. package/dist/tools/dimension-management/delete-hierarchy.d.ts +2 -0
  250. package/dist/tools/dimension-management/delete-hierarchy.js +35 -0
  251. package/dist/tools/dimension-management/get-element-attribute-values.d.ts +2 -0
  252. package/dist/tools/dimension-management/get-element-attribute-values.js +77 -0
  253. package/dist/tools/dimension-management/list-element-attributes.d.ts +2 -0
  254. package/dist/tools/dimension-management/list-element-attributes.js +31 -0
  255. package/dist/tools/dimension-management/move-element.d.ts +2 -0
  256. package/dist/tools/dimension-management/move-element.js +28 -0
  257. package/dist/tools/dimension-management/update-element-attribute-value.d.ts +2 -0
  258. package/dist/tools/dimension-management/update-element-attribute-value.js +80 -0
  259. package/dist/tools/dimension-management/update-element.d.ts +2 -0
  260. package/dist/tools/dimension-management/update-element.js +35 -0
  261. package/dist/tools/error-format.d.ts +22 -0
  262. package/dist/tools/error-format.js +130 -0
  263. package/dist/tools/fileops/delete-file.d.ts +2 -0
  264. package/dist/tools/fileops/delete-file.js +32 -0
  265. package/dist/tools/fileops/get-file-content.d.ts +2 -0
  266. package/dist/tools/fileops/get-file-content.js +76 -0
  267. package/dist/tools/fileops/list-files.d.ts +2 -0
  268. package/dist/tools/fileops/list-files.js +43 -0
  269. package/dist/tools/fileops/search-files.d.ts +2 -0
  270. package/dist/tools/fileops/search-files.js +76 -0
  271. package/dist/tools/fileops/upload-file.d.ts +2 -0
  272. package/dist/tools/fileops/upload-file.js +69 -0
  273. package/dist/tools/format.d.ts +57 -0
  274. package/dist/tools/format.js +157 -0
  275. package/dist/tools/hierarchy.d.ts +6 -0
  276. package/dist/tools/hierarchy.js +27 -0
  277. package/dist/tools/index.d.ts +4 -0
  278. package/dist/tools/index.js +263 -0
  279. package/dist/tools/local-file.d.ts +16 -0
  280. package/dist/tools/local-file.js +88 -0
  281. package/dist/tools/metadata/get-ancestors.d.ts +2 -0
  282. package/dist/tools/metadata/get-ancestors.js +36 -0
  283. package/dist/tools/metadata/get-descendants.d.ts +2 -0
  284. package/dist/tools/metadata/get-descendants.js +64 -0
  285. package/dist/tools/metadata/get-hierarchy.d.ts +2 -0
  286. package/dist/tools/metadata/get-hierarchy.js +130 -0
  287. package/dist/tools/metadata/list-chores.d.ts +2 -0
  288. package/dist/tools/metadata/list-chores.js +62 -0
  289. package/dist/tools/metadata/list-cubes.d.ts +2 -0
  290. package/dist/tools/metadata/list-cubes.js +128 -0
  291. package/dist/tools/metadata/list-dimensions.d.ts +2 -0
  292. package/dist/tools/metadata/list-dimensions.js +131 -0
  293. package/dist/tools/metadata/list-processes-grouped.d.ts +2 -0
  294. package/dist/tools/metadata/list-processes-grouped.js +96 -0
  295. package/dist/tools/metadata/list-processes.d.ts +2 -0
  296. package/dist/tools/metadata/list-processes.js +108 -0
  297. package/dist/tools/metadata/resolve-default-members.d.ts +2 -0
  298. package/dist/tools/metadata/resolve-default-members.js +46 -0
  299. package/dist/tools/model-building/check-cube-rule.d.ts +2 -0
  300. package/dist/tools/model-building/check-cube-rule.js +51 -0
  301. package/dist/tools/model-building/clear-cube.d.ts +2 -0
  302. package/dist/tools/model-building/clear-cube.js +46 -0
  303. package/dist/tools/model-building/create-cube.d.ts +2 -0
  304. package/dist/tools/model-building/create-cube.js +34 -0
  305. package/dist/tools/model-building/delete-cube.d.ts +2 -0
  306. package/dist/tools/model-building/delete-cube.js +27 -0
  307. package/dist/tools/model-building/get-all-cube-rules.d.ts +2 -0
  308. package/dist/tools/model-building/get-all-cube-rules.js +149 -0
  309. package/dist/tools/model-building/get-cube-rules.d.ts +2 -0
  310. package/dist/tools/model-building/get-cube-rules.js +69 -0
  311. package/dist/tools/model-building/rules-source.d.ts +21 -0
  312. package/dist/tools/model-building/rules-source.js +49 -0
  313. package/dist/tools/model-building/search-rules.d.ts +2 -0
  314. package/dist/tools/model-building/search-rules.js +132 -0
  315. package/dist/tools/model-building/set-cube-rules.d.ts +2 -0
  316. package/dist/tools/model-building/set-cube-rules.js +81 -0
  317. package/dist/tools/model-building/unload-cube.d.ts +2 -0
  318. package/dist/tools/model-building/unload-cube.js +23 -0
  319. package/dist/tools/operations/diagnose-process-error.d.ts +2 -0
  320. package/dist/tools/operations/diagnose-process-error.js +178 -0
  321. package/dist/tools/operations/error-log-helpers.d.ts +25 -0
  322. package/dist/tools/operations/error-log-helpers.js +57 -0
  323. package/dist/tools/operations/get-audit-log.d.ts +2 -0
  324. package/dist/tools/operations/get-audit-log.js +70 -0
  325. package/dist/tools/operations/get-cube-stats.d.ts +2 -0
  326. package/dist/tools/operations/get-cube-stats.js +107 -0
  327. package/dist/tools/operations/get-error-log-content.d.ts +2 -0
  328. package/dist/tools/operations/get-error-log-content.js +164 -0
  329. package/dist/tools/operations/get-jobs.d.ts +3 -0
  330. package/dist/tools/operations/get-jobs.js +51 -0
  331. package/dist/tools/operations/get-message-log.d.ts +2 -0
  332. package/dist/tools/operations/get-message-log.js +63 -0
  333. package/dist/tools/operations/get-server-info.d.ts +2 -0
  334. package/dist/tools/operations/get-server-info.js +180 -0
  335. package/dist/tools/operations/get-server-state.d.ts +2 -0
  336. package/dist/tools/operations/get-server-state.js +129 -0
  337. package/dist/tools/operations/get-sessions.d.ts +2 -0
  338. package/dist/tools/operations/get-sessions.js +76 -0
  339. package/dist/tools/operations/get-threads.d.ts +3 -0
  340. package/dist/tools/operations/get-threads.js +50 -0
  341. package/dist/tools/operations/get-transaction-log.d.ts +2 -0
  342. package/dist/tools/operations/get-transaction-log.js +63 -0
  343. package/dist/tools/operations/list-error-logs.d.ts +8 -0
  344. package/dist/tools/operations/list-error-logs.js +157 -0
  345. package/dist/tools/operations/save-data.d.ts +2 -0
  346. package/dist/tools/operations/save-data.js +50 -0
  347. package/dist/tools/pagination.d.ts +32 -0
  348. package/dist/tools/pagination.js +116 -0
  349. package/dist/tools/scheduling/create-chore.d.ts +2 -0
  350. package/dist/tools/scheduling/create-chore.js +93 -0
  351. package/dist/tools/scheduling/delete-chore.d.ts +2 -0
  352. package/dist/tools/scheduling/delete-chore.js +22 -0
  353. package/dist/tools/scheduling/execute-chore.d.ts +2 -0
  354. package/dist/tools/scheduling/execute-chore.js +52 -0
  355. package/dist/tools/scheduling/toggle-chore.d.ts +2 -0
  356. package/dist/tools/scheduling/toggle-chore.js +22 -0
  357. package/dist/tools/scheduling/update-chore.d.ts +2 -0
  358. package/dist/tools/scheduling/update-chore.js +71 -0
  359. package/dist/tools/schemas/common.d.ts +10 -0
  360. package/dist/tools/schemas/common.js +23 -0
  361. package/dist/tools/schemas/items-analysis.d.ts +394 -0
  362. package/dist/tools/schemas/items-analysis.js +419 -0
  363. package/dist/tools/schemas/items-cells.d.ts +70 -0
  364. package/dist/tools/schemas/items-cells.js +65 -0
  365. package/dist/tools/schemas/items-common.d.ts +18 -0
  366. package/dist/tools/schemas/items-common.js +39 -0
  367. package/dist/tools/schemas/items-fileops.d.ts +11 -0
  368. package/dist/tools/schemas/items-fileops.js +13 -0
  369. package/dist/tools/schemas/items-metadata.d.ts +262 -0
  370. package/dist/tools/schemas/items-metadata.js +184 -0
  371. package/dist/tools/schemas/items-monitoring.d.ts +79 -0
  372. package/dist/tools/schemas/items-monitoring.js +78 -0
  373. package/dist/tools/schemas/items-processes.d.ts +279 -0
  374. package/dist/tools/schemas/items-processes.js +235 -0
  375. package/dist/tools/schemas/items-scheduling.d.ts +25 -0
  376. package/dist/tools/schemas/items-scheduling.js +26 -0
  377. package/dist/tools/schemas/items-security.d.ts +19 -0
  378. package/dist/tools/schemas/items-security.js +12 -0
  379. package/dist/tools/schemas/items-subsets.d.ts +2 -0
  380. package/dist/tools/schemas/items-subsets.js +4 -0
  381. package/dist/tools/schemas/items-views.d.ts +38 -0
  382. package/dist/tools/schemas/items-views.js +26 -0
  383. package/dist/tools/schemas/items.d.ts +12 -0
  384. package/dist/tools/schemas/items.js +23 -0
  385. package/dist/tools/schemas/markdown-capable.d.ts +21 -0
  386. package/dist/tools/schemas/markdown-capable.js +58 -0
  387. package/dist/tools/schemas/output-schema.d.ts +24 -0
  388. package/dist/tools/schemas/output-schema.js +25 -0
  389. package/dist/tools/security/assign-client-group.d.ts +2 -0
  390. package/dist/tools/security/assign-client-group.js +20 -0
  391. package/dist/tools/security/create-client.d.ts +2 -0
  392. package/dist/tools/security/create-client.js +28 -0
  393. package/dist/tools/security/delete-client.d.ts +2 -0
  394. package/dist/tools/security/delete-client.js +22 -0
  395. package/dist/tools/security/get-client.d.ts +2 -0
  396. package/dist/tools/security/get-client.js +20 -0
  397. package/dist/tools/security/list-clients.d.ts +2 -0
  398. package/dist/tools/security/list-clients.js +86 -0
  399. package/dist/tools/security/list-groups.d.ts +2 -0
  400. package/dist/tools/security/list-groups.js +43 -0
  401. package/dist/tools/security/remove-client-group.d.ts +2 -0
  402. package/dist/tools/security/remove-client-group.js +27 -0
  403. package/dist/tools/security/update-client.d.ts +2 -0
  404. package/dist/tools/security/update-client.js +22 -0
  405. package/dist/tools/subsets/create-subset.d.ts +2 -0
  406. package/dist/tools/subsets/create-subset.js +44 -0
  407. package/dist/tools/subsets/delete-subset.d.ts +2 -0
  408. package/dist/tools/subsets/delete-subset.js +26 -0
  409. package/dist/tools/subsets/get-subset.d.ts +2 -0
  410. package/dist/tools/subsets/get-subset.js +29 -0
  411. package/dist/tools/subsets/list-subsets.d.ts +2 -0
  412. package/dist/tools/subsets/list-subsets.js +36 -0
  413. package/dist/tools/subsets/update-subset.d.ts +2 -0
  414. package/dist/tools/subsets/update-subset.js +33 -0
  415. package/dist/tools/ti-development/check-process-code.d.ts +2 -0
  416. package/dist/tools/ti-development/check-process-code.js +96 -0
  417. package/dist/tools/ti-development/compile-process.d.ts +2 -0
  418. package/dist/tools/ti-development/compile-process.js +32 -0
  419. package/dist/tools/ti-development/copy-process.d.ts +2 -0
  420. package/dist/tools/ti-development/copy-process.js +32 -0
  421. package/dist/tools/ti-development/delete-process.d.ts +2 -0
  422. package/dist/tools/ti-development/delete-process.js +26 -0
  423. package/dist/tools/ti-development/diff-process-with-file.d.ts +2 -0
  424. package/dist/tools/ti-development/diff-process-with-file.js +208 -0
  425. package/dist/tools/ti-development/diff-processes.d.ts +2 -0
  426. package/dist/tools/ti-development/diff-processes.js +312 -0
  427. package/dist/tools/ti-development/execute-process.d.ts +8 -0
  428. package/dist/tools/ti-development/execute-process.js +109 -0
  429. package/dist/tools/ti-development/export-process-to-git.d.ts +2 -0
  430. package/dist/tools/ti-development/export-process-to-git.js +113 -0
  431. package/dist/tools/ti-development/export-process-to-pro.d.ts +2 -0
  432. package/dist/tools/ti-development/export-process-to-pro.js +117 -0
  433. package/dist/tools/ti-development/get-all-processes-code.d.ts +2 -0
  434. package/dist/tools/ti-development/get-all-processes-code.js +131 -0
  435. package/dist/tools/ti-development/get-process-code.d.ts +2 -0
  436. package/dist/tools/ti-development/get-process-code.js +100 -0
  437. package/dist/tools/ti-development/get-process-datasource.d.ts +2 -0
  438. package/dist/tools/ti-development/get-process-datasource.js +20 -0
  439. package/dist/tools/ti-development/get-process-parameters.d.ts +2 -0
  440. package/dist/tools/ti-development/get-process-parameters.js +25 -0
  441. package/dist/tools/ti-development/get-process-variables.d.ts +2 -0
  442. package/dist/tools/ti-development/get-process-variables.js +38 -0
  443. package/dist/tools/ti-development/get-process.d.ts +2 -0
  444. package/dist/tools/ti-development/get-process.js +163 -0
  445. package/dist/tools/ti-development/import-pro-file.d.ts +2 -0
  446. package/dist/tools/ti-development/import-pro-file.js +153 -0
  447. package/dist/tools/ti-development/import-process-from-git.d.ts +2 -0
  448. package/dist/tools/ti-development/import-process-from-git.js +198 -0
  449. package/dist/tools/ti-development/install-pro-bundle.d.ts +2 -0
  450. package/dist/tools/ti-development/install-pro-bundle.js +288 -0
  451. package/dist/tools/ti-development/preflight.d.ts +39 -0
  452. package/dist/tools/ti-development/preflight.js +56 -0
  453. package/dist/tools/ti-development/process-backup.d.ts +29 -0
  454. package/dist/tools/ti-development/process-backup.js +118 -0
  455. package/dist/tools/ti-development/search-code.d.ts +2 -0
  456. package/dist/tools/ti-development/search-code.js +208 -0
  457. package/dist/tools/ti-development/upsert-process.d.ts +2 -0
  458. package/dist/tools/ti-development/upsert-process.js +167 -0
  459. package/dist/tools/ti-development/validate-process-refs.d.ts +2 -0
  460. package/dist/tools/ti-development/validate-process-refs.js +73 -0
  461. package/dist/tools/views/create-mdx-view.d.ts +2 -0
  462. package/dist/tools/views/create-mdx-view.js +21 -0
  463. package/dist/tools/views/create-native-view.d.ts +2 -0
  464. package/dist/tools/views/create-native-view.js +81 -0
  465. package/dist/tools/views/delete-view.d.ts +2 -0
  466. package/dist/tools/views/delete-view.js +23 -0
  467. package/dist/tools/views/list-views.d.ts +2 -0
  468. package/dist/tools/views/list-views.js +32 -0
  469. package/dist/tools/with-annotations.d.ts +6 -0
  470. package/dist/tools/with-annotations.js +339 -0
  471. package/dist/types.d.ts +409 -0
  472. package/dist/types.js +91 -0
  473. package/dist/version.d.ts +4 -0
  474. package/dist/version.js +18 -0
  475. package/package.json +107 -0
@@ -0,0 +1,278 @@
1
+ /**
2
+ * Per-process complexity metrics derived from TI source + variables.
3
+ *
4
+ * Metrics are designed to surface real maintainability pain (deep branching,
5
+ * uneven distribution across tabs, missing comments) — not vanity counts like
6
+ * raw variable totals.
7
+ */
8
+ import { parseTiCode } from "../callgraph/tiParser.js";
9
+ import { isCommentedOutCode } from "./comment-classifier.js";
10
+ const DEFAULT_WEIGHTS = {
11
+ loopBase: 2,
12
+ nestMult: 3,
13
+ ifBase: 1,
14
+ hotPenalty: 2,
15
+ commentDiscountMax: 0,
16
+ };
17
+ /**
18
+ * Merge caller overrides onto defaults, ignoring undefined values so an
19
+ * explicitly-undefined field (e.g. from an omitted Zod key) never clobbers a
20
+ * default with undefined.
21
+ */
22
+ function resolveWeights(weights) {
23
+ const w = { ...DEFAULT_WEIGHTS };
24
+ if (weights) {
25
+ for (const k of Object.keys(DEFAULT_WEIGHTS)) {
26
+ const v = weights[k];
27
+ if (typeof v === "number")
28
+ w[k] = v;
29
+ }
30
+ }
31
+ return w;
32
+ }
33
+ /**
34
+ * Functions whose execution inside a loop is a recognised performance hot path
35
+ * in TI (cell writes, file I/O, nested process calls). Case-insensitive match.
36
+ */
37
+ const HOT_OPS = new Set([
38
+ "cellputn",
39
+ "cellputs",
40
+ "asciioutput",
41
+ "textoutput",
42
+ "executeprocess",
43
+ "runprocess",
44
+ "odbcoutput",
45
+ ]);
46
+ /**
47
+ * Count AND/OR connectors (`&`, `%`) in a TI condition, ignoring any that sit
48
+ * inside single-quoted string literals. Complexity = 1 + connector count, so a
49
+ * lone comparison scores 1 and each extra clause adds 1.
50
+ */
51
+ function conditionComplexity(condition) {
52
+ let connectors = 0;
53
+ let inString = false;
54
+ for (let i = 0; i < condition.length; i++) {
55
+ const c = condition[i];
56
+ if (c === "'") {
57
+ // Doubled '' is an escaped quote inside a string — skip the pair.
58
+ if (inString && condition[i + 1] === "'") {
59
+ i++;
60
+ continue;
61
+ }
62
+ inString = !inString;
63
+ continue;
64
+ }
65
+ if (inString)
66
+ continue;
67
+ if (c === "&" || c === "%")
68
+ connectors++;
69
+ }
70
+ return 1 + connectors;
71
+ }
72
+ const TABS = ["prolog", "metadata", "data", "epilog"];
73
+ // Bedrock-generated TI processes pack many statements onto one line (e.g.
74
+ // `IF(x);y=1;ENDIF;`). The parser is line-oriented for some block keywords,
75
+ // so we normalize by inserting a newline after every top-level `;` (outside
76
+ // of strings and `#` line-comments) before parsing. Raw LOC counts use the
77
+ // original source via classifyLines.
78
+ function splitMultiStatementLines(src) {
79
+ let out = "";
80
+ let inString = false;
81
+ let inLineComment = false;
82
+ for (let i = 0; i < src.length; i++) {
83
+ const c = src[i];
84
+ if (inLineComment) {
85
+ out += c;
86
+ if (c === "\n")
87
+ inLineComment = false;
88
+ continue;
89
+ }
90
+ if (inString) {
91
+ out += c;
92
+ if (c === "'") {
93
+ if (src[i + 1] === "'") {
94
+ out += "'";
95
+ i++;
96
+ }
97
+ else {
98
+ inString = false;
99
+ }
100
+ }
101
+ continue;
102
+ }
103
+ if (c === "'") {
104
+ inString = true;
105
+ out += c;
106
+ continue;
107
+ }
108
+ if (c === "#") {
109
+ inLineComment = true;
110
+ out += c;
111
+ continue;
112
+ }
113
+ if (c === ";") {
114
+ out += ";";
115
+ const next = src[i + 1];
116
+ if (next !== undefined && next !== "\n" && next !== "\r") {
117
+ out += "\n";
118
+ }
119
+ continue;
120
+ }
121
+ out += c;
122
+ }
123
+ return out;
124
+ }
125
+ function classifyLines(src) {
126
+ let loc = 0;
127
+ let commentLines = 0;
128
+ let deadCodeLines = 0;
129
+ let blankLines = 0;
130
+ for (const raw of src.split(/\r?\n/)) {
131
+ const t = raw.trim();
132
+ if (t === "")
133
+ blankLines++;
134
+ else if (t.startsWith("#")) {
135
+ if (isCommentedOutCode(t))
136
+ deadCodeLines++;
137
+ else
138
+ commentLines++;
139
+ }
140
+ else
141
+ loc++;
142
+ }
143
+ return { loc, commentLines, deadCodeLines, blankLines };
144
+ }
145
+ function walk(stmts, depth, acc) {
146
+ for (const s of stmts) {
147
+ if (s.type === "if") {
148
+ const ifBlk = s;
149
+ acc.branches += 1 + ifBlk.elseIfClauses.length;
150
+ const nextDepth = depth + 1;
151
+ if (nextDepth > acc.maxNesting)
152
+ acc.maxNesting = nextDepth;
153
+ walk(ifBlk.thenBody, nextDepth, acc);
154
+ for (const c of ifBlk.elseIfClauses)
155
+ walk(c.body, nextDepth, acc);
156
+ walk(ifBlk.elseBody, nextDepth, acc);
157
+ }
158
+ else if (s.type === "while") {
159
+ const whBlk = s;
160
+ acc.branches += 1;
161
+ const nextDepth = depth + 1;
162
+ if (nextDepth > acc.maxNesting)
163
+ acc.maxNesting = nextDepth;
164
+ walk(whBlk.body, nextDepth, acc);
165
+ }
166
+ }
167
+ }
168
+ /**
169
+ * v2 cost accumulator. Tracks loop and if nesting separately as it descends:
170
+ * loop cost grows geometrically with enclosing loops, if cost grows with
171
+ * condition complexity and if-depth, hot ops are penalised by loop depth.
172
+ */
173
+ function walkCost(stmts, loopDepth, ifDepth, w, acc) {
174
+ for (const s of stmts) {
175
+ if (s.type === "if") {
176
+ const ifBlk = s;
177
+ acc.ifCost +=
178
+ w.ifBase * conditionComplexity(ifBlk.condition) * (1 + ifDepth);
179
+ for (const c of ifBlk.elseIfClauses) {
180
+ acc.ifCost +=
181
+ w.ifBase * conditionComplexity(c.condition) * (1 + ifDepth);
182
+ }
183
+ walkCost(ifBlk.thenBody, loopDepth, ifDepth + 1, w, acc);
184
+ for (const c of ifBlk.elseIfClauses)
185
+ walkCost(c.body, loopDepth, ifDepth + 1, w, acc);
186
+ walkCost(ifBlk.elseBody, loopDepth, ifDepth + 1, w, acc);
187
+ }
188
+ else if (s.type === "while") {
189
+ const whBlk = s;
190
+ acc.loopCost += w.loopBase * Math.pow(w.nestMult, loopDepth);
191
+ walkCost(whBlk.body, loopDepth + 1, ifDepth, w, acc);
192
+ }
193
+ else if (s.type === "functionCall") {
194
+ const fn = s;
195
+ if (loopDepth > 0 && HOT_OPS.has(fn.name.toLowerCase())) {
196
+ acc.hotInLoop += w.hotPenalty * loopDepth;
197
+ }
198
+ }
199
+ }
200
+ }
201
+ export function computeTabMetrics(src, weights) {
202
+ const w = resolveWeights(weights);
203
+ const counts = classifyLines(src);
204
+ const parseRes = parseTiCode(splitMultiStatementLines(src));
205
+ const acc = { branches: 0, maxNesting: 0 };
206
+ const cost = { loopCost: 0, ifCost: 0, hotInLoop: 0 };
207
+ let parseError = false;
208
+ if (parseRes.ok) {
209
+ walk(parseRes.ast, 0, acc);
210
+ walkCost(parseRes.ast, 0, 0, w, cost);
211
+ }
212
+ else {
213
+ parseError = true;
214
+ }
215
+ return {
216
+ loc: counts.loc,
217
+ commentLines: counts.commentLines,
218
+ deadCodeLines: counts.deadCodeLines,
219
+ blankLines: counts.blankLines,
220
+ branches: acc.branches,
221
+ maxNesting: acc.maxNesting,
222
+ loopCost: cost.loopCost,
223
+ ifCost: cost.ifCost,
224
+ hotInLoop: cost.hotInLoop,
225
+ parseError,
226
+ };
227
+ }
228
+ export function computeProcessMetrics(name, code, weights) {
229
+ const w = resolveWeights(weights);
230
+ const tabs = {};
231
+ for (const t of TABS)
232
+ tabs[t] = computeTabMetrics(code[t] ?? "", w);
233
+ let loc = 0;
234
+ let commentLines = 0;
235
+ let deadCodeLines = 0;
236
+ let branches = 0;
237
+ let maxNesting = 0;
238
+ let loopCost = 0;
239
+ let ifCost = 0;
240
+ let hotInLoop = 0;
241
+ for (const t of TABS) {
242
+ loc += tabs[t].loc;
243
+ commentLines += tabs[t].commentLines;
244
+ deadCodeLines += tabs[t].deadCodeLines;
245
+ branches += tabs[t].branches;
246
+ if (tabs[t].maxNesting > maxNesting)
247
+ maxNesting = tabs[t].maxNesting;
248
+ loopCost += tabs[t].loopCost;
249
+ ifCost += tabs[t].ifCost;
250
+ hotInLoop += tabs[t].hotInLoop;
251
+ }
252
+ const score = loc + 2 * branches + 3 * maxNesting;
253
+ const denom = loc + commentLines + deadCodeLines;
254
+ const commentRatio = denom === 0 ? 0 : commentLines / denom;
255
+ const deadCodeRatio = denom === 0 ? 0 : deadCodeLines / denom;
256
+ const rawV2 = loc + ifCost + loopCost + hotInLoop;
257
+ const discount = Math.min(Math.max(w.commentDiscountMax, 0), 1) * commentRatio;
258
+ const scoreV2 = rawV2 * (1 - discount);
259
+ return {
260
+ name,
261
+ tabs,
262
+ totals: {
263
+ loc,
264
+ commentLines,
265
+ deadCodeLines,
266
+ branches,
267
+ maxNesting,
268
+ score,
269
+ loopCost,
270
+ ifCost,
271
+ hotInLoop,
272
+ scoreV2,
273
+ commentRatio,
274
+ deadCodeRatio,
275
+ },
276
+ };
277
+ }
278
+ //# sourceMappingURL=process-metrics.js.map
@@ -0,0 +1,31 @@
1
+ export interface RulesMetrics {
2
+ cube: string;
3
+ /** Non-blank, non-comment lines in the rules section. */
4
+ rulesLoc: number;
5
+ /** Non-blank, non-comment lines in the feeders section. */
6
+ feedersLoc: number;
7
+ /** Rule-area lines (start with `[`) in the rules section. */
8
+ ruleCount: number;
9
+ /** Rule-area lines (start with `[`) in the feeders section. */
10
+ feederCount: number;
11
+ /** `#` lines that are real comments (prose), not disabled code. */
12
+ commentLines: number;
13
+ /** `#` lines that look like commented-out TM1 code (disabled statements). */
14
+ deadCodeLines: number;
15
+ /** commentLines / max(rulesLoc + feedersLoc + commentLines + deadCodeLines, 1). 0..1. */
16
+ commentRatio: number;
17
+ /** deadCodeLines / max(rulesLoc + feedersLoc + commentLines + deadCodeLines, 1). 0..1. */
18
+ deadCodeRatio: number;
19
+ /** `skipcheck;` directive present in the rules section. */
20
+ hasSkipcheck: boolean;
21
+ /** `feedstrings;` directive present in the rules section. */
22
+ hasFeedstrings: boolean;
23
+ /** Total DB(...) calls across all rule/feeder lines (string-literal aware). */
24
+ dbCallCount: number;
25
+ /** Distinct target cubes from DB('CubeName', ...) calls (string literals only). */
26
+ coupledCubes: string[];
27
+ /** Heuristic: rulesLoc + 2*ruleCount + 3*dbCallCount + 5*coupledCubes.length. */
28
+ score: number;
29
+ }
30
+ export declare function computeRulesMetrics(cube: string, rulesText: string): RulesMetrics;
31
+ //# sourceMappingURL=rules-metrics.d.ts.map
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Per-cube rules complexity metrics (regex/line-based MVP).
3
+ *
4
+ * Reuses parseRules (line classification + section tracking) and extractDbCalls
5
+ * (string/comment-aware DB() extraction). A future AST upgrade can replace the
6
+ * rule-line heuristic without changing this file's contract.
7
+ */
8
+ import { parseRules } from "../callgraph/rulesParser.js";
9
+ import { extractDbCalls } from "../callgraph/rulesLinter.js";
10
+ import { isCommentedOutCode } from "./comment-classifier.js";
11
+ const RULE_LINE_RE = /^\[/;
12
+ function stripQuotes(s) {
13
+ // Strip matching pair only — leave mismatched quotes alone so we don't
14
+ // mangle an already-broken extracted argument (`'Foo"` stays `'Foo"`).
15
+ return s.replace(/^(['"])(.*)\1$/, "$2");
16
+ }
17
+ export function computeRulesMetrics(cube, rulesText) {
18
+ if (!rulesText || rulesText.trim() === "") {
19
+ return {
20
+ cube,
21
+ rulesLoc: 0,
22
+ feedersLoc: 0,
23
+ ruleCount: 0,
24
+ feederCount: 0,
25
+ commentLines: 0,
26
+ deadCodeLines: 0,
27
+ commentRatio: 0,
28
+ deadCodeRatio: 0,
29
+ hasSkipcheck: false,
30
+ hasFeedstrings: false,
31
+ dbCallCount: 0,
32
+ coupledCubes: [],
33
+ score: 0,
34
+ };
35
+ }
36
+ const ast = parseRules(rulesText);
37
+ let rulesLoc = 0;
38
+ let feedersLoc = 0;
39
+ let ruleCount = 0;
40
+ let feederCount = 0;
41
+ let commentLines = 0;
42
+ let deadCodeLines = 0;
43
+ let dbCallCount = 0;
44
+ const coupled = new Set();
45
+ for (const line of ast.lines) {
46
+ if (line.isBlank)
47
+ continue;
48
+ if (line.isComment) {
49
+ if (isCommentedOutCode(line.trimmed))
50
+ deadCodeLines++;
51
+ else
52
+ commentLines++;
53
+ continue;
54
+ }
55
+ // Section markers (`feeders;`) are dividers, not code — skip from LOC.
56
+ if (line.isFeedersMarker)
57
+ continue;
58
+ if (line.section === "rules") {
59
+ rulesLoc++;
60
+ if (RULE_LINE_RE.test(line.trimmed))
61
+ ruleCount++;
62
+ }
63
+ else {
64
+ feedersLoc++;
65
+ if (RULE_LINE_RE.test(line.trimmed))
66
+ feederCount++;
67
+ }
68
+ for (const call of extractDbCalls(line.trimmed)) {
69
+ dbCallCount++;
70
+ if (call.cubeName) {
71
+ const c = stripQuotes(call.cubeName);
72
+ if (c !== "")
73
+ coupled.add(c);
74
+ }
75
+ }
76
+ }
77
+ const denom = rulesLoc + feedersLoc + commentLines + deadCodeLines;
78
+ const commentRatio = denom === 0 ? 0 : commentLines / denom;
79
+ const deadCodeRatio = denom === 0 ? 0 : deadCodeLines / denom;
80
+ const coupledCubes = [...coupled].sort();
81
+ const score = rulesLoc + 2 * ruleCount + 3 * dbCallCount + 5 * coupledCubes.length;
82
+ return {
83
+ cube,
84
+ rulesLoc,
85
+ feedersLoc,
86
+ ruleCount,
87
+ feederCount,
88
+ commentLines,
89
+ deadCodeLines,
90
+ commentRatio,
91
+ deadCodeRatio,
92
+ hasSkipcheck: ast.hasSkipcheck,
93
+ hasFeedstrings: ast.hasFeedstrings,
94
+ dbCallCount,
95
+ coupledCubes,
96
+ score,
97
+ };
98
+ }
99
+ //# sourceMappingURL=rules-metrics.js.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Map over `items` running at most `limit` async calls in flight at once.
3
+ *
4
+ * Semantics mirror `Promise.allSettled` — the returned array is index-aligned
5
+ * with `items`, never rejects, and preserves per-item fulfilled/rejected status.
6
+ * The bound matters when fanning out one request per cube/process against TM1:
7
+ * an unbounded `Promise.allSettled` over a large model can flood the server's
8
+ * worker pool, whereas this keeps pressure constant.
9
+ */
10
+ export declare function mapSettledWithConcurrency<T, R>(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise<R>): Promise<PromiseSettledResult<R>[]>;
11
+ //# sourceMappingURL=concurrency.d.ts.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Map over `items` running at most `limit` async calls in flight at once.
3
+ *
4
+ * Semantics mirror `Promise.allSettled` — the returned array is index-aligned
5
+ * with `items`, never rejects, and preserves per-item fulfilled/rejected status.
6
+ * The bound matters when fanning out one request per cube/process against TM1:
7
+ * an unbounded `Promise.allSettled` over a large model can flood the server's
8
+ * worker pool, whereas this keeps pressure constant.
9
+ */
10
+ export async function mapSettledWithConcurrency(items, limit, fn) {
11
+ const results = new Array(items.length);
12
+ let next = 0;
13
+ const width = Math.max(1, Math.min(limit, items.length));
14
+ const workers = Array.from({ length: width }, async () => {
15
+ for (let i = next++; i < items.length; i = next++) {
16
+ try {
17
+ results[i] = { status: "fulfilled", value: await fn(items[i], i) };
18
+ }
19
+ catch (reason) {
20
+ results[i] = { status: "rejected", reason };
21
+ }
22
+ }
23
+ });
24
+ await Promise.all(workers);
25
+ return results;
26
+ }
27
+ //# sourceMappingURL=concurrency.js.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Shared predicate for TM1 control objects.
3
+ *
4
+ * IBM Planning Analytics names every server-internal object with a `}` prefix
5
+ * (e.g., `}ClientProperties`, `}tp_*`). All audit/listing tools filter these
6
+ * out by default, so the rule lives here instead of being re-implemented
7
+ * per tool.
8
+ */
9
+ export declare const isControlName: (name: string) => boolean;
10
+ //# sourceMappingURL=control-name.d.ts.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Shared predicate for TM1 control objects.
3
+ *
4
+ * IBM Planning Analytics names every server-internal object with a `}` prefix
5
+ * (e.g., `}ClientProperties`, `}tp_*`). All audit/listing tools filter these
6
+ * out by default, so the rule lives here instead of being re-implemented
7
+ * per tool.
8
+ */
9
+ export const isControlName = (name) => name.startsWith("}");
10
+ //# sourceMappingURL=control-name.js.map
@@ -0,0 +1,3 @@
1
+ import { TM1Error } from "../types.js";
2
+ export declare function dimensionCountMismatch(cubeName: string, dimensions: readonly string[], elements: readonly string[]): TM1Error;
3
+ //# sourceMappingURL=coordinate-error.d.ts.map
@@ -0,0 +1,29 @@
1
+ // One error for "this coordinate has the wrong number of elements", shared by
2
+ // every tool that addresses a cell positionally (get_cell_value, write_cells,
3
+ // check_writable_coords).
4
+ //
5
+ // The bare count ("4 given, 5 expected") was the least useful part of the old
6
+ // messages: the caller already knows it passed four. What it lacks is WHICH
7
+ // dimension it forgot — typically one it does not think of as part of the cube,
8
+ // such as a `Sandboxes` or `Version` dimension. So the message spells out the
9
+ // cube's dimension order, names the uncovered positions, and `details` pairs
10
+ // every dimension with the element that landed on it.
11
+ import { TM1Error, TM1ErrorCode } from "../types.js";
12
+ export function dimensionCountMismatch(cubeName, dimensions, elements) {
13
+ const missing = dimensions.slice(elements.length);
14
+ const extra = elements.slice(dimensions.length);
15
+ const gap = missing.length > 0
16
+ ? ` No element for ${missing.length === 1 ? "dimension" : "dimensions"} (by position): ${missing.join(", ")}.`
17
+ : ` ${extra.length} element(s) too many: ${extra.join(", ")}.`;
18
+ return new TM1Error({
19
+ code: TM1ErrorCode.VALIDATION_ERROR,
20
+ message: `Cube '${cubeName}' has ${dimensions.length} dimensions but ${elements.length} element(s) were given.` +
21
+ gap,
22
+ hint: `Pass exactly one element per dimension, in this order: ${dimensions.join(", ")}. A forgotten dimension anywhere in the list shifts every later element onto the wrong one — check the pairing in details.`,
23
+ details: JSON.stringify(dimensions.map((dimension, i) => ({
24
+ dimension,
25
+ element: elements[i] ?? null,
26
+ }))),
27
+ });
28
+ }
29
+ //# sourceMappingURL=coordinate-error.js.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Whether exporting a datasource password to a file is worth offering at all,
3
+ * which turns on what the REST API actually hands out. Measured 2026-08-17
4
+ * against 11.8.02900.8 and a v12 database:
5
+ *
6
+ * - v11 returns a ciphertext bound to one *run* of one server. Within a running
7
+ * instance it is stable — the same cleartext yields the same value across
8
+ * processes — but it is useless on another instance, and equally useless on
9
+ * the same instance after a service restart: the same password produced three
10
+ * different values across two restarts, and a value carried across one aborts
11
+ * the process at connect time with "Unable to open data source". Nothing
12
+ * fixes that from our side, because the durable form (slot 565 of TM1's own
13
+ * Datadir .pro, a longer encoding that is not even deterministic within a run)
14
+ * is never exposed over REST.
15
+ * - v12 returns the plain password, which has no such lifetime.
16
+ *
17
+ * So a v11 export can only carry a credential through a window in which
18
+ * tm1_copy_process would have worked anyway, and fails silently outside it —
19
+ * the file still looks complete. Export therefore refuses on v11 and points at
20
+ * tm1_copy_process (to clone now) or dataSourcePassword (to deploy later).
21
+ */
22
+ export declare function supportsCredentialExport(version: 11 | 12): boolean;
23
+ //# sourceMappingURL=credential-format.d.ts.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Whether exporting a datasource password to a file is worth offering at all,
3
+ * which turns on what the REST API actually hands out. Measured 2026-08-17
4
+ * against 11.8.02900.8 and a v12 database:
5
+ *
6
+ * - v11 returns a ciphertext bound to one *run* of one server. Within a running
7
+ * instance it is stable — the same cleartext yields the same value across
8
+ * processes — but it is useless on another instance, and equally useless on
9
+ * the same instance after a service restart: the same password produced three
10
+ * different values across two restarts, and a value carried across one aborts
11
+ * the process at connect time with "Unable to open data source". Nothing
12
+ * fixes that from our side, because the durable form (slot 565 of TM1's own
13
+ * Datadir .pro, a longer encoding that is not even deterministic within a run)
14
+ * is never exposed over REST.
15
+ * - v12 returns the plain password, which has no such lifetime.
16
+ *
17
+ * So a v11 export can only carry a credential through a window in which
18
+ * tm1_copy_process would have worked anyway, and fails silently outside it —
19
+ * the file still looks complete. Export therefore refuses on v11 and points at
20
+ * tm1_copy_process (to clone now) or dataSourcePassword (to deploy later).
21
+ */
22
+ export function supportsCredentialExport(version) {
23
+ return version === 12;
24
+ }
25
+ //# sourceMappingURL=credential-format.js.map
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Shared `}StatsByCube` fetcher.
3
+ *
4
+ * Reads one cube's perf metrics into a flat `{ measureName: value }` map
5
+ * plus a typed projection over well-known measures. Used by both
6
+ * `tm1_get_cube_stats` (read-tool) and `tm1_audit_feeders` (runtime mode).
7
+ *
8
+ * The MDX targets `}StatsByCube` (TM1 v11.8 layout verified live):
9
+ * cube dim → `}PerfCubes`
10
+ * measure dim → `}StatsStatsByCube`
11
+ * time dim → `}TimeIntervals` sliced on `LATEST` for the current snapshot
12
+ * `TM1FILTERBYLEVEL` keeps only leaf measures.
13
+ *
14
+ * Not every server has those cubes. TM1 v12 / Planning Analytics Engine
15
+ * (measured on 12.5.9) ships control cubes for security and element
16
+ * attributes only — zero `}Stats*` — and a v11 non-admin can be refused read
17
+ * access to them. Both surfaced as raw OData text, which reads like the
18
+ * user's model is broken. `fetchCubeStats` classifies those two cases into a
19
+ * `CubeStatsUnavailableError` here, once, so every caller degrades the same
20
+ * way instead of re-deriving it at the tool layer.
21
+ *
22
+ * The classification is STRUCTURAL — it never reads the error sentence.
23
+ * Measured, same question asked three ways:
24
+ * v11 11.8 (en) : '}StatsByCube' can not be found in collection of type 'Cube'
25
+ * v12 12.5.9 : There is no cube named "}StatsByCube".
26
+ * v11 11.8 (de) : Syntaxfehler bei oder in der Nähe von: '[…]', Zeichenposition 67
27
+ * The prose varies by version AND by server locale, so a matcher built on it
28
+ * is correct only on the machine it was written against and fails silently
29
+ * everywhere else — in the direction of showing the user a raw OData error.
30
+ * Instead: the denial is recognised by its untranslated identifier
31
+ * (`ObjectSecurityNoReadRights`, an error code), and absence is answered by
32
+ * asking the server directly whether the cube exists.
33
+ */
34
+ import type { TM1Client } from "../../tm1-client.js";
35
+ /** Server-side `}StatsByCube` measure labels mapped to stable typed fields. */
36
+ export declare const KNOWN_METRICS: Record<string, string>;
37
+ export interface CubeStatsItem {
38
+ cubeName: string;
39
+ raw: Record<string, number | null>;
40
+ error?: string;
41
+ feederEfficiency?: number;
42
+ [k: string]: unknown;
43
+ }
44
+ /**
45
+ * Why cube statistics could not be read — a distinction worth keeping honest:
46
+ *
47
+ * - `absent` — this server has no `}StatsByCube`. Nothing the caller can do;
48
+ * no account has these numbers here.
49
+ * - `denied` — the cube exists, this TM1 user may not read it. A different
50
+ * person, or the same person with control-object read rights, would get
51
+ * the statistics. Telling them "your server does not have this" would be
52
+ * a lie.
53
+ */
54
+ export type StatsUnavailableReason = "absent" | "denied";
55
+ /**
56
+ * Thrown by `fetchCubeStats` when `}StatsByCube` cannot be read for a reason
57
+ * that is a property of the *server or the account*, not of the cube being
58
+ * asked about. Callers should surface `message` verbatim and branch on
59
+ * `reason`; anything else that fails still propagates unchanged.
60
+ */
61
+ export declare class CubeStatsUnavailableError extends Error {
62
+ readonly reason: StatsUnavailableReason;
63
+ constructor(reason: StatsUnavailableReason, message: string);
64
+ }
65
+ /** The cube the MDX reads. Probed by name when the query fails. */
66
+ export declare const STATS_CUBE = "}StatsByCube";
67
+ /**
68
+ * Map a `}StatsByCube` MDX failure onto an unavailability verdict, or `null`
69
+ * when the failure is about something else (a nonexistent target cube, a
70
+ * syntax error, a timeout, a 500) and must propagate untouched.
71
+ *
72
+ * Structural, in two steps, neither of which reads a sentence:
73
+ *
74
+ * 1. Denial by identifier. TM1 refuses a control-object read with HTTP 400
75
+ * carrying `ObjectSecurityNoReadRights` (not 403), which `classifyHttpError`
76
+ * already turns into `PERMISSION_DENIED`. Checked first, because "you may
77
+ * not read it" must never be reported as "this server does not have it".
78
+ * 2. Existence, asked of the server: `GET /api/v1/Cubes('}StatsByCube')`.
79
+ * 404 → the cube is genuinely not there → `absent`. 200 → the cube is
80
+ * there and the MDX failed for some other reason entirely → `null`, and
81
+ * the original error propagates. One cheap request, only on the failure
82
+ * path, answering the actual question instead of inferring it.
83
+ *
84
+ * The probe's own failure never masks the real error: if the probe cannot
85
+ * answer, the original error wins.
86
+ *
87
+ * `version` feeds the wording only; nothing branches on it.
88
+ */
89
+ export declare function classifyCubeStatsFailure(tm1Client: TM1Client, err: unknown): Promise<CubeStatsUnavailableError | null>;
90
+ export declare function fetchCubeStats(tm1Client: TM1Client, cubeName: string): Promise<CubeStatsItem>;
91
+ /**
92
+ * Fed-to-populated ratio: `fedCells / populatedNumeric` — the community-
93
+ * standard }StatsByCube overfeeding indicator (tm1forum t=13110, Cubewise).
94
+ * Rule of thumb: ≥ 50× suspicious, ≥ 100× definite overfeeding. Returns
95
+ * `null` when either input is missing or `populatedNumeric` is zero — a
96
+ * cube fed purely cross-cube can legitimately hold no input data, so a
97
+ * missing denominator is "insufficient signal", not overfeeding.
98
+ */
99
+ export declare function computeFedToPopulatedRatio(stats: CubeStatsItem): number | null;
100
+ /**
101
+ * Feeder-memory ratio: `memoryFeeders / memoryInput` — secondary overfeeding
102
+ * signal (feeder flags dwarfing the data they feed from). No community
103
+ * threshold established; reported as context only, never flagged.
104
+ */
105
+ export declare function computeFeederMemoryRatio(stats: CubeStatsItem): number | null;
106
+ //# sourceMappingURL=fetcher.d.ts.map