@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,202 @@
1
+ import { extractDbCalls } from "../callgraph/rulesLinter.js";
2
+ /**
3
+ * Pull every concrete element name out of a bracket list into a flat set.
4
+ * Positional, qualified, and set-form entries all contribute their element
5
+ * value(s). Dimension qualifiers are NOT bagged — only the element side.
6
+ */
7
+ export function collectElementBag(list) {
8
+ const out = new Set();
9
+ for (const e of list.entries) {
10
+ pushElems(e, out);
11
+ }
12
+ return out;
13
+ }
14
+ function pushElems(e, out) {
15
+ if (e.elem !== undefined)
16
+ out.add(e.elem);
17
+ if (e.elems !== undefined) {
18
+ for (const v of e.elems)
19
+ out.add(v);
20
+ }
21
+ }
22
+ /**
23
+ * S3 · Wildcard / unscoped bracket — bracket has no concrete element
24
+ * constraints. Either an empty bracket or every entry lacks both `elem` and
25
+ * `elems`. Such feeders fire across every dim member.
26
+ */
27
+ export function detectWildcardBracket(list) {
28
+ if (list.entries.length === 0)
29
+ return true;
30
+ return list.entries.every((e) => e.elem === undefined && e.elems === undefined);
31
+ }
32
+ /**
33
+ * S1 · Feeder broader than rule — feeder LHS pins a small fraction of the
34
+ * cube's dimensions. Ratio-based to scale across cube widths: an absolute
35
+ * "2 dims unpinned" threshold flooded findings on 13-dim cubes where
36
+ * positional feeders idiomatically pin 7–8 dims (live test 2026-05-19:
37
+ * 114/116 ≈ 98 % noise). The ratio gate restores precision because TM1
38
+ * fills the unpinned dims with default members — only when the feeder
39
+ * leaves most of the cube unconstrained is it genuinely too broad.
40
+ *
41
+ * Flags when `pinned / cubeTotalDims < minPinnedRatio` (default 0.5).
42
+ *
43
+ * Returns false on:
44
+ * - empty bracket (S4 territory)
45
+ * - missing cube dim count (resolver failure → cubeTotalDims ≤ 0)
46
+ * - feeder pinning more entries than cube has dims (malformed; skip)
47
+ */
48
+ export function detectBroaderThanRule(feeder, cubeTotalDims, minPinnedRatio = 0.5) {
49
+ if (feeder.entries.length === 0)
50
+ return false;
51
+ if (cubeTotalDims <= 0)
52
+ return false;
53
+ const pinned = feeder.entries.length;
54
+ if (pinned > cubeTotalDims)
55
+ return false;
56
+ return pinned / cubeTotalDims < minPinnedRatio;
57
+ }
58
+ /**
59
+ * Pair a feeder LHS with the rule LHS that shares the most element-bag
60
+ * elements. Returns the best-match rule (overlap ≥ 1) or null. Ties go to
61
+ * the first match for determinism. Used by S1 so we can compare feeder
62
+ * pinning against the rule it actually feeds rather than against the
63
+ * cube-width ratio fallback.
64
+ */
65
+ export function findMatchingRule(feederLhs, ruleLhsList) {
66
+ if (ruleLhsList.length === 0)
67
+ return null;
68
+ const feederBag = collectElementBag(feederLhs);
69
+ if (feederBag.size === 0)
70
+ return null;
71
+ let best = null;
72
+ let bestOverlap = 0;
73
+ for (const r of ruleLhsList) {
74
+ const rbag = collectElementBag(r);
75
+ let overlap = 0;
76
+ for (const v of rbag)
77
+ if (feederBag.has(v))
78
+ overlap++;
79
+ if (overlap > bestOverlap) {
80
+ bestOverlap = overlap;
81
+ best = r;
82
+ }
83
+ }
84
+ return bestOverlap > 0 ? best : null;
85
+ }
86
+ /**
87
+ * S1 (rule-paired variant) · Feeder broader than its matched rule.
88
+ *
89
+ * Strict comparison: flag iff `feeder.pinned < matchedRule.pinned`. Equal
90
+ * pinning is the idiomatic 1:1 TM1 N: pattern (e.g. `[M:A] => [M:B]`
91
+ * feeding `[M:B] = N: [M:A] - ...;`) and must NOT be flagged — empirical
92
+ * audits showed ~92 % FP rate before pairing was introduced.
93
+ */
94
+ export function detectBroaderThanMatchedRule(feeder, matchedRule) {
95
+ if (feeder.entries.length === 0)
96
+ return false;
97
+ return feeder.entries.length < matchedRule.entries.length;
98
+ }
99
+ /**
100
+ * S2 · Feeder targets consolidated element.
101
+ *
102
+ * For each entry in the feeder LHS, resolve `(dim, hier, elem)` and look up
103
+ * the element type via the cache. Flag on the first consolidated element
104
+ * encountered. Resolution rules:
105
+ * - positional entry at index `i` → `dim = hier = cubeDimNames[i]`
106
+ * - qualified entry `'Dim':'Elem'` → `dim = hier = Dim`
107
+ * - qualified entry `'Dim:Hier':'Elem'` → split on `:` (only for the dim slot)
108
+ * - set entries `'Dim':{'A','B'}` → check each element of the set
109
+ *
110
+ * Returns the matching `{dim, elem}` or `null`. The tool layer turns a
111
+ * non-null result into a finding with severity `hint`.
112
+ */
113
+ export async function detectFeederToConsolidated(feeder, cubeDimNames, cache) {
114
+ if (feeder.entries.length === 0)
115
+ return null;
116
+ if (cubeDimNames.length === 0)
117
+ return null;
118
+ for (let i = 0; i < feeder.entries.length; i++) {
119
+ const e = feeder.entries[i];
120
+ const resolved = resolveDimHier(e, i, cubeDimNames);
121
+ if (!resolved)
122
+ continue;
123
+ const elems = entryElems(e);
124
+ for (const elem of elems) {
125
+ const t = await cache.getType(resolved.dim, resolved.hier, elem);
126
+ if (t === "Consolidated") {
127
+ return { dim: resolved.dim, elem };
128
+ }
129
+ }
130
+ }
131
+ return null;
132
+ }
133
+ function resolveDimHier(e, positionalIndex, cubeDimNames) {
134
+ if (e.dim !== undefined) {
135
+ const colonIdx = e.dim.indexOf(":");
136
+ if (colonIdx >= 0) {
137
+ return {
138
+ dim: e.dim.slice(0, colonIdx),
139
+ hier: e.dim.slice(colonIdx + 1),
140
+ };
141
+ }
142
+ return { dim: e.dim, hier: e.dim };
143
+ }
144
+ const name = cubeDimNames[positionalIndex];
145
+ if (name === undefined)
146
+ return null;
147
+ return { dim: name, hier: name };
148
+ }
149
+ function entryElems(e) {
150
+ if (e.elem !== undefined)
151
+ return [e.elem];
152
+ if (e.elems !== undefined)
153
+ return e.elems;
154
+ return [];
155
+ }
156
+ /**
157
+ * S4 · `DB()` feeder without skipcheck on target. Cross-cube feeders fan out
158
+ * through the target cube's consolidations; without `skipcheck;` on the
159
+ * target's rules the engine evaluates every cell. Walk every `DB(...)` call
160
+ * on the feeder line, ask the lookup whether the target cube has skipcheck.
161
+ *
162
+ * Returns the first target-cube name that lacks skipcheck, or `null` on:
163
+ * - no `DB()` call on the line
164
+ * - dynamic cube name (not a string literal — can't resolve statically)
165
+ * - lookup returns `null` (target outside scan scope — be conservative)
166
+ * - lookup returns `true` (skipcheck present)
167
+ */
168
+ export function detectDbFeederWithoutSkipcheck(line, hasSkipcheck) {
169
+ const calls = extractDbCalls(line);
170
+ for (const call of calls) {
171
+ if (call.cubeName === null)
172
+ continue;
173
+ const verdict = hasSkipcheck(call.cubeName);
174
+ if (verdict === false)
175
+ return call.cubeName;
176
+ }
177
+ return null;
178
+ }
179
+ /**
180
+ * S5 · Orphan feeder — the feeder LHS shares no element name with any rule
181
+ * LHS in the cube. Pure overhead: it flags cells that no rule populates.
182
+ * Element comparison is bag-equality on the element-side only (dim
183
+ * qualifiers ignored), so positional and qualified syntax intermix.
184
+ */
185
+ export function detectOrphanFeeder(feeder, ruleLhsList) {
186
+ if (feeder.entries.length === 0)
187
+ return false;
188
+ if (ruleLhsList.length === 0)
189
+ return false;
190
+ const feederElems = collectElementBag(feeder);
191
+ if (feederElems.size === 0)
192
+ return false;
193
+ for (const rule of ruleLhsList) {
194
+ const ruleElems = collectElementBag(rule);
195
+ for (const e of feederElems) {
196
+ if (ruleElems.has(e))
197
+ return false;
198
+ }
199
+ }
200
+ return true;
201
+ }
202
+ //# sourceMappingURL=static-heuristics.js.map
@@ -0,0 +1,67 @@
1
+ import type { DataSource, ProcessParameter, ProcessVariable } from "../types.js";
2
+ /**
3
+ * tm1-git two-file representation of a TI process.
4
+ *
5
+ * `{name}.json` holds the structure (parameters, variables, datasource,
6
+ * hasSecurityAccess). `{name}.ti` holds the code as TM1's native `Code`
7
+ * representation — `#region <Tab>` / `#endregion` blocks (CRLF, empty tabs
8
+ * omitted), byte-identical to `GET /Processes('x')/Code/$value`. The `.ti`
9
+ * blob is produced by the server, not built here; this module only parses it
10
+ * back (for import preflight). The `.json` is built by serializeProcessToGit.
11
+ *
12
+ * Credentials: the ODBC `password` is never written to the .json. A committed
13
+ * password would be a leaked secret; on import it is re-supplied out of band
14
+ * (see `dataSourcePassword` on the import tool).
15
+ */
16
+ export interface GitProcessInput {
17
+ name: string;
18
+ parameters: ProcessParameter[];
19
+ variables: ProcessVariable[];
20
+ /**
21
+ * Raw `VariablesUIData` — one entry per datasource column, ignored ones
22
+ * included. Written to the .json as-is because a column set to "Ignore"
23
+ * appears nowhere in `variables`; leaving it out makes the export lose the
24
+ * setting on every re-import.
25
+ */
26
+ variablesUIData?: string[];
27
+ dataSource: DataSource;
28
+ hasSecurityAccess: boolean;
29
+ }
30
+ export interface GitProcessJson {
31
+ json: string;
32
+ /** True when an ODBC password was present and stripped from the JSON. */
33
+ credentialsOmitted: boolean;
34
+ }
35
+ export interface ParsedGitProcess {
36
+ name: string;
37
+ prolog: string;
38
+ metadata: string;
39
+ data: string;
40
+ epilog: string;
41
+ parameters: ProcessParameter[];
42
+ variables: ProcessVariable[];
43
+ variablesUIData?: string[];
44
+ dataSource: DataSource;
45
+ hasSecurityAccess?: boolean;
46
+ }
47
+ /**
48
+ * Build only the `{name}.json` (structure). Field order mirrors TM1's OData
49
+ * Process entity (Name, HasSecurityAccess, DataSource, then Parameters/
50
+ * Variables); parameter objects follow OData order (Name, Prompt, Value, Type).
51
+ * Order is cosmetic — parseProcessFromGit reads by key.
52
+ */
53
+ export declare function serializeProcessToGit(input: GitProcessInput, opts?: {
54
+ includePassword?: boolean;
55
+ }): GitProcessJson;
56
+ /**
57
+ * Blob content the tab parser does not place — text outside every top-level
58
+ * `#region <Tab>` block, and a tab whose region appears more than once (the
59
+ * parser keeps the last copy). tm1_import_process_from_git deploys the RAW
60
+ * blob and lets TM1 split it, so its preflight can only vouch for the blob
61
+ * when this list is empty: otherwise the checked tabs and the installed code
62
+ * differ. Assumes a blob parseProcessFromGit already accepted.
63
+ */
64
+ export declare function unplacedBlobContent(ti: string): string[];
65
+ /** Parse a `{name}.json` + `{name}.ti` pair back into deployable process parts. */
66
+ export declare function parseProcessFromGit(jsonContent: string, tiContent: string): ParsedGitProcess;
67
+ //# sourceMappingURL=git-process.d.ts.map
@@ -0,0 +1,243 @@
1
+ import { z } from "zod";
2
+ import { parameterSchema, variableSchema, dataSourceSchema, } from "./process-parts-schema.js";
3
+ /**
4
+ * Build only the `{name}.json` (structure). Field order mirrors TM1's OData
5
+ * Process entity (Name, HasSecurityAccess, DataSource, then Parameters/
6
+ * Variables); parameter objects follow OData order (Name, Prompt, Value, Type).
7
+ * Order is cosmetic — parseProcessFromGit reads by key.
8
+ */
9
+ export function serializeProcessToGit(input, opts) {
10
+ const { password, ...dataSourceNoPwd } = input.dataSource;
11
+ const keepPassword = opts?.includePassword === true && Boolean(password);
12
+ const credentialsOmitted = !keepPassword && password !== undefined && password !== "";
13
+ const json = JSON.stringify({
14
+ name: input.name,
15
+ hasSecurityAccess: input.hasSecurityAccess,
16
+ dataSource: keepPassword
17
+ ? { ...dataSourceNoPwd, password }
18
+ : dataSourceNoPwd,
19
+ parameters: input.parameters.map((p) => ({
20
+ name: p.name,
21
+ ...(p.prompt !== undefined ? { prompt: p.prompt } : {}),
22
+ value: p.defaultValue,
23
+ type: p.type,
24
+ })),
25
+ variables: input.variables,
26
+ ...(input.variablesUIData !== undefined &&
27
+ input.variablesUIData.length > 0
28
+ ? { variablesUIData: input.variablesUIData }
29
+ : {}),
30
+ }, null, 2) + "\n";
31
+ return { json, credentialsOmitted };
32
+ }
33
+ const TAB_NAMES = new Set([
34
+ "prolog",
35
+ "metadata",
36
+ "data",
37
+ "epilog",
38
+ ]);
39
+ /** Build a descriptive error naming the structural problem (same "reject, don't guess" shape
40
+ * as the pre-existing zero-region error below). */
41
+ function regionBlobError(problem) {
42
+ return new Error(`TI file has a malformed #region/#endregion code blob: ${problem} ` +
43
+ "Refusing to parse a structurally invalid blob (this would otherwise silently drop or " +
44
+ "misattribute code). Re-export from the server, or fix the marker manually.");
45
+ }
46
+ /** Scan every `#region`/`#endregion` marker line, in document order, top-level AND nested. */
47
+ function extractRegionMarkers(ti) {
48
+ const markerRe = /^[ \t]*#(region|endregion)\b[ \t]*(\S*)[^\r\n]*\r?\n?/gim;
49
+ const markers = [];
50
+ let mm;
51
+ while ((mm = markerRe.exec(ti)) !== null) {
52
+ markers.push({
53
+ kind: mm[1].toLowerCase(),
54
+ name: mm[2],
55
+ start: mm.index,
56
+ contentStart: mm.index + mm[0].length,
57
+ });
58
+ }
59
+ return markers;
60
+ }
61
+ /**
62
+ * Parse a native `#region <Tab>` / `#endregion` code blob into the four tabs.
63
+ * Case-insensitive on keyword and tab name; a tab whose region is absent
64
+ * defaults to "". Throws if the blob has no region markers at all (rejects the
65
+ * pre-1.x `### TM1-TI-TAB:` layout — no longer supported).
66
+ *
67
+ * Depth-aware: TM1 users can write their OWN `#region <label>` / `#endregion`
68
+ * FOLDING COMMENTS inside a tab's TI code (PAW/Arc supports this), and the
69
+ * server stores them nested inside the tab's region — that is legitimate code
70
+ * content, not a structural marker. A `#region`/`#endregion` pair encountered
71
+ * while already inside a tab is therefore just a depth increment/decrement;
72
+ * its lines stay part of the tab's code, preserved verbatim. Only the
73
+ * top-level (depth 0→1) `#region` opens a tab, and only the marker that
74
+ * brings depth back to 0 closes it.
75
+ *
76
+ * Still throws on genuine structural corruption:
77
+ * - an unclosed tab (depth never returns to 0 by EOF — a missing/typo'd
78
+ * #endregion, which would otherwise let the next tab's content get
79
+ * silently absorbed into the previous tab)
80
+ * - a stray #endregion at the top level (depth would go negative)
81
+ * - a top-level `#region` whose name isn't a recognized TI tab
82
+ * (Prolog/Metadata/Data/Epilog) — genuinely malformed, not a user fold
83
+ */
84
+ function parseCodeBlob(ti) {
85
+ const out = {
86
+ prolog: "",
87
+ metadata: "",
88
+ data: "",
89
+ epilog: "",
90
+ };
91
+ const markers = extractRegionMarkers(ti);
92
+ if (markers.length === 0) {
93
+ throw new Error("TI file has no #region markers (expected `#region Prolog` … `#endregion`). " +
94
+ "Pre-1.x `### TM1-TI-TAB:` files are no longer supported — re-export from the server.");
95
+ }
96
+ let depth = 0;
97
+ let currentTab = null;
98
+ let contentStart = 0;
99
+ let found = 0;
100
+ for (const marker of markers) {
101
+ if (marker.kind === "region") {
102
+ if (depth === 0) {
103
+ // Top-level #region: must be a known tab delimiter, not a user fold.
104
+ const tabName = marker.name.toLowerCase();
105
+ if (!TAB_NAMES.has(tabName)) {
106
+ throw regionBlobError(`found "#region ${marker.name}" at the top level, which is not a recognized TI tab ` +
107
+ "(expected Prolog/Metadata/Data/Epilog).");
108
+ }
109
+ currentTab = tabName;
110
+ contentStart = marker.contentStart;
111
+ }
112
+ // depth > 0: a nested user #region fold — part of the tab's code content.
113
+ depth++;
114
+ }
115
+ else {
116
+ depth--;
117
+ if (depth < 0) {
118
+ throw regionBlobError(`found a stray #endregion with no matching #region near offset ${marker.start}.`);
119
+ }
120
+ if (depth === 0) {
121
+ // Back to top level: this #endregion closes the current tab. Strip
122
+ // the single newline the server places before #endregion; nested
123
+ // #region/#endregion lines (user folds) stay in the sliced content.
124
+ out[currentTab] = ti
125
+ .slice(contentStart, marker.start)
126
+ .replace(/\r?\n$/, "");
127
+ found++;
128
+ currentTab = null;
129
+ }
130
+ }
131
+ }
132
+ if (depth !== 0) {
133
+ throw regionBlobError(`"#region ${currentTab ?? "?"}" is missing its matching #endregion — the blob is truncated ` +
134
+ "or a closing #endregion is missing.");
135
+ }
136
+ // Structurally unreachable given the checks above, but keep the original
137
+ // invariant explicit rather than silently returning a default-filled `out`.
138
+ if (found === 0) {
139
+ throw regionBlobError("no valid #region <Tab> … #endregion pair was found.");
140
+ }
141
+ return out;
142
+ }
143
+ /**
144
+ * Blob content the tab parser does not place — text outside every top-level
145
+ * `#region <Tab>` block, and a tab whose region appears more than once (the
146
+ * parser keeps the last copy). tm1_import_process_from_git deploys the RAW
147
+ * blob and lets TM1 split it, so its preflight can only vouch for the blob
148
+ * when this list is empty: otherwise the checked tabs and the installed code
149
+ * differ. Assumes a blob parseProcessFromGit already accepted.
150
+ */
151
+ export function unplacedBlobContent(ti) {
152
+ const problems = [];
153
+ const seen = new Set();
154
+ let depth = 0;
155
+ let outsideFrom = 0;
156
+ const outside = (from, to) => {
157
+ const text = ti.slice(from, to).trim();
158
+ if (text !== "")
159
+ problems.push(`text outside any tab region: "${text.split(/\r?\n/)[0].slice(0, 60)}"`);
160
+ };
161
+ for (const m of extractRegionMarkers(ti)) {
162
+ if (m.kind === "region") {
163
+ if (depth === 0) {
164
+ outside(outsideFrom, m.start);
165
+ const tab = m.name.toLowerCase();
166
+ if (seen.has(tab))
167
+ problems.push(`#region ${m.name} appears twice`);
168
+ seen.add(tab);
169
+ }
170
+ depth++;
171
+ }
172
+ else {
173
+ depth--;
174
+ if (depth === 0)
175
+ outsideFrom = m.contentStart;
176
+ }
177
+ }
178
+ outside(outsideFrom, ti.length);
179
+ return problems;
180
+ }
181
+ /** Parse a `{name}.json` + `{name}.ti` pair back into deployable process parts. */
182
+ export function parseProcessFromGit(jsonContent, tiContent) {
183
+ let meta;
184
+ try {
185
+ meta = JSON.parse(jsonContent);
186
+ }
187
+ catch {
188
+ throw new Error("Process JSON is not valid JSON");
189
+ }
190
+ const name = typeof meta.name === "string" ? meta.name : "";
191
+ const hasSecurityAccess = typeof meta.hasSecurityAccess === "boolean"
192
+ ? meta.hasSecurityAccess
193
+ : undefined;
194
+ // Git .json uses the OData-native param field name `value`; the internal
195
+ // schema uses `defaultValue`. Normalize value→defaultValue before validation,
196
+ // keeping back-compat with legacy files that wrote `defaultValue`.
197
+ const rawParams = Array.isArray(meta.parameters)
198
+ ? meta.parameters.map((p) => {
199
+ if (p &&
200
+ typeof p === "object" &&
201
+ "value" in p &&
202
+ !("defaultValue" in p)) {
203
+ const { value, ...rest } = p;
204
+ return { ...rest, defaultValue: value };
205
+ }
206
+ return p;
207
+ })
208
+ : (meta.parameters ?? []);
209
+ const paramsResult = z.array(parameterSchema).safeParse(rawParams);
210
+ if (!paramsResult.success) {
211
+ throw new Error(`Process JSON has invalid 'parameters': ${paramsResult.error.issues[0]?.message ?? "shape mismatch"}`);
212
+ }
213
+ const parameters = paramsResult.data;
214
+ const varsResult = z.array(variableSchema).safeParse(meta.variables ?? []);
215
+ if (!varsResult.success) {
216
+ throw new Error(`Process JSON has invalid 'variables': ${varsResult.error.issues[0]?.message ?? "shape mismatch"}`);
217
+ }
218
+ const variables = varsResult.data;
219
+ const uiResult = z.array(z.string()).safeParse(meta.variablesUIData ?? []);
220
+ if (!uiResult.success) {
221
+ throw new Error(`Process JSON has invalid 'variablesUIData': ${uiResult.error.issues[0]?.message ?? "expected an array of strings"}`);
222
+ }
223
+ const variablesUIData = uiResult.data;
224
+ const dsResult = dataSourceSchema.safeParse(meta.dataSource ?? { type: "None" });
225
+ if (!dsResult.success) {
226
+ throw new Error(`Process JSON has invalid 'dataSource': ${dsResult.error.issues[0]?.message ?? "shape mismatch"}`);
227
+ }
228
+ const dataSource = dsResult.data;
229
+ const tabs = parseCodeBlob(tiContent);
230
+ return {
231
+ name,
232
+ ...(hasSecurityAccess !== undefined ? { hasSecurityAccess } : {}),
233
+ prolog: tabs.prolog,
234
+ metadata: tabs.metadata,
235
+ data: tabs.data,
236
+ epilog: tabs.epilog,
237
+ parameters,
238
+ variables,
239
+ ...(variablesUIData.length > 0 ? { variablesUIData } : {}),
240
+ dataSource,
241
+ };
242
+ }
243
+ //# sourceMappingURL=git-process.js.map
@@ -0,0 +1,10 @@
1
+ export declare const SECRET_NAME_RE: RegExp;
2
+ export declare const MASK = "***";
3
+ export declare function isSecretName(name: string): boolean;
4
+ export declare const CONN_CREDENTIAL_RE: RegExp;
5
+ export declare function maskSecretValues(text: string): string;
6
+ export declare function resolveMaskSecrets(requested: boolean | undefined): boolean;
7
+ export declare function maskCodeLine(line: string): string;
8
+ export declare function maskCode(code: string): string;
9
+ export declare function maskSecretsDeep(value: unknown): unknown;
10
+ //# sourceMappingURL=mask-secrets.d.ts.map
@@ -0,0 +1,99 @@
1
+ // Credential redaction helpers shared by call-graph analysis and code search.
2
+ //
3
+ // Param-name regex: matches typical credential identifiers (case-insensitive).
4
+ // Kept conservative — false positives turn legitimate parameter values into
5
+ // "***" in audit reports, so we err on the side of obvious credential names.
6
+ export const SECRET_NAME_RE = /pass(?:wd|word)?|pwd|secret|token|api[_-]?key|^key$|credential|auth/i;
7
+ export const MASK = "***";
8
+ export function isSecretName(name) {
9
+ return SECRET_NAME_RE.test(name);
10
+ }
11
+ // Credential pair inside a connection string: `PWD=secret;`, `UID=admin;`.
12
+ //
13
+ // The value alternation is grammar-aware, and that is the whole point. ODBC
14
+ // lets a value be brace-quoted precisely so it may contain the delimiter:
15
+ // `PWD={abc;def};`. A plain `[^;]+` stops at the first inner `;`, masks `{abc`
16
+ // and leaves `def};` sitting in the output as cleartext — a partial leak that
17
+ // looks masked. Brace form is therefore matched FIRST and consumed whole.
18
+ //
19
+ // Both branches are single linear quantifiers over a negated class, so there is
20
+ // no nested backtracking to exploit.
21
+ export const CONN_CREDENTIAL_RE = /\b(pwd|password|uid|user\s*id)(\s*=\s*)(\{[^}]*\}|[^;'"\r\n]*)/gi;
22
+ // Value-oriented sanitizer for arbitrary free text — error messages, server
23
+ // responses, log lines. Distinct from maskSecretsDeep, which is KEY-oriented
24
+ // and therefore blind to a credential embedded in a string: pino's redact
25
+ // config masks `{password: "x"}` but never
26
+ // `err.message = "ODBC failed: PWD=hunter2"`.
27
+ //
28
+ // Deliberately narrow: only credential pairs with an explicit key. Guessing at
29
+ // bare tokens would mangle legitimate error text and train readers to ignore
30
+ // the mask.
31
+ export function maskSecretValues(text) {
32
+ if (!text)
33
+ return text;
34
+ return text
35
+ .replace(CONN_CREDENTIAL_RE, (_m, key, eq) => `${key}${eq}${MASK}`)
36
+ .replace(/\b(pass(?:wd|word)?|secret|token|api[_-]?key|credential)(\s*[:=]\s*)("[^"]*"|'[^']*'|[^\s,;)}\]]+)/gi, (_m, key, sep) => `${key}${sep}${MASK}`);
37
+ }
38
+ // Whether a caller may switch credential masking OFF.
39
+ //
40
+ // `maskSecrets: false` is a MODEL-controlled opt-out of a security control —
41
+ // the LLM can ask for raw credentials and, before this gate, got them. Now the
42
+ // operator has to allow it out-of-band. Default is deny, so the tool parameter
43
+ // degrades to "mask anyway" rather than failing the call: an audit that asked
44
+ // for unmasked output still gets its report, just redacted.
45
+ export function resolveMaskSecrets(requested) {
46
+ if (requested !== false)
47
+ return true;
48
+ return process.env.TM1_ALLOW_UNMASKED_SECRETS !== "true";
49
+ }
50
+ // Mask the 3rd argument of ODBCOpen(dsn, user, password) and the 3rd+ args of
51
+ // ExecuteCommand variants where the password tends to live. Also mask any
52
+ // quoted literal that follows a credential keyword.
53
+ export function maskCodeLine(line) {
54
+ let out = line;
55
+ // ODBCOpen('dsn','user','password') → mask 3rd arg
56
+ out = out.replace(/\b(ODBCOpen\s*\(\s*(?:'[^']*'|"[^"]*"|[^,]*)\s*,\s*(?:'[^']*'|"[^"]*"|[^,]*)\s*,\s*)(?:'[^']*'|"[^"]*")/gi, (_m, prefix) => `${prefix}'${MASK}'`);
57
+ // <credentialKeyword> = 'value' → mask the literal
58
+ // Matches: pPwd = 'foo' | sPassword := "bar" | gToken<-'baz'
59
+ out = out.replace(/(\b(?:[a-z_][a-z0-9_]*)?(?:pass(?:wd|word)?|pwd|secret|token|api[_-]?key|credential)[a-z0-9_]*\s*(?:=|:=|<-)\s*)(?:'[^']*'|"[^"]*")/gi, (_m, prefix) => `${prefix}'${MASK}'`);
60
+ // Connection-string credential pairs embedded INSIDE a string literal, e.g.
61
+ // 'Driver={SQL Server};Server=srv;UID=admin;PWD=hunter2;'
62
+ // These slip past the arg-position and keyword-before-'=' passes because the
63
+ // credential lives inside another literal (ODBCOpen 1st arg, or a conn string
64
+ // assigned to a non-credential-named var). Mask just the VALUE, keep the key.
65
+ // Value = bare token up to the next ';', quote, or line terminator (unquoted
66
+ // conn-string syntax); the [^;'"\r\n]+ capture is a single linear quantifier
67
+ // — no nested backtracking. Excluding \r\n keeps a trailing CR (CRLF line
68
+ // ending) out of the match so masking a conn-string line never converts
69
+ // CRLF→LF on the CRLF-sensitive .ti export.
70
+ out = out.replace(CONN_CREDENTIAL_RE, (_m, key, eq) => `${key}${eq}${MASK}`);
71
+ return out;
72
+ }
73
+ // Mask credential literals across a whole (possibly multi-line) code blob by
74
+ // applying maskCodeLine to each line. Splits on "\n" only so CRLF/CR endings
75
+ // are preserved byte-for-byte (the trailing "\r" rides along on each line and
76
+ // is untouched by maskCodeLine).
77
+ export function maskCode(code) {
78
+ return code.split("\n").map(maskCodeLine).join("\n");
79
+ }
80
+ // Deep-mask an arbitrary JSON-ish value: any object entry whose KEY name looks
81
+ // like a credential (isSecretName) has its value replaced with MASK; primitives
82
+ // stay as-is and nested objects/arrays are walked recursively. Used to sanitize
83
+ // raw config dumps (e.g. the full TM1 /Configuration object surfaced under
84
+ // `_raw`) before they leave the server, so a password sitting under
85
+ // Access.LDAP.Password or Access.Authentication.* never leaks unmasked.
86
+ export function maskSecretsDeep(value) {
87
+ if (Array.isArray(value)) {
88
+ return value.map((v) => maskSecretsDeep(v));
89
+ }
90
+ if (value !== null && typeof value === "object") {
91
+ const out = {};
92
+ for (const [k, v] of Object.entries(value)) {
93
+ out[k] = isSecretName(k) ? MASK : maskSecretsDeep(v);
94
+ }
95
+ return out;
96
+ }
97
+ return value;
98
+ }
99
+ //# sourceMappingURL=mask-secrets.js.map
@@ -0,0 +1,3 @@
1
+ /** Escape `]` → `]]` in an MDX bracketed-identifier name component. */
2
+ export declare function escapeMdxName(s: string): string;
3
+ //# sourceMappingURL=mdx.d.ts.map
@@ -0,0 +1,13 @@
1
+ // MDX identifier helpers.
2
+ //
3
+ // A bracketed MDX identifier (`[Dimension].[Element]`) is terminated by the
4
+ // first unescaped `]`. A name that itself contains `]` (e.g. `Q4]Adj`) must
5
+ // therefore double it (`]` → `]]`), otherwise the identifier is closed early
6
+ // and the query silently addresses the wrong member (MDX injection /
7
+ // mis-addressed cell). Every name that goes into a bracketed identifier —
8
+ // dimension, hierarchy, element, cube — must be escaped exactly once.
9
+ /** Escape `]` → `]]` in an MDX bracketed-identifier name component. */
10
+ export function escapeMdxName(s) {
11
+ return s.replace(/]/g, "]]");
12
+ }
13
+ //# sourceMappingURL=mdx.js.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `$filter` expression selecting elements that may violate a naming rule.
3
+ *
4
+ * Mirrors the element branch of `checkName`: empty/whitespace-only, leading or
5
+ * trailing whitespace, TM1-Server-reserved characters, the `}` control prefix,
6
+ * a leading `+`/`-`, and — on v12 only — an embedded TAB.
7
+ */
8
+ export declare function elementViolationFilter(): string;
9
+ /**
10
+ * The same predicate in TypeScript, for testing soundness against `checkName`
11
+ * without a server. Kept beside the builder so the two cannot drift: a rule
12
+ * added to one and forgotten in the other fails the unit test.
13
+ */
14
+ export declare function matchesElementViolationFilter(name: string): boolean;
15
+ //# sourceMappingURL=odata-filter.d.ts.map