@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,672 @@
1
+ /**
2
+ * Parses TI (TurboIntegrator) source code into an AST.
3
+ *
4
+ * Handles:
5
+ * - Assignments: `variable = expression;`
6
+ * - IF/ELSEIF/ELSE/ENDIF blocks (nested)
7
+ * - WHILE/END loops (nested)
8
+ * - Function calls as statements: `FunctionName(args...);`
9
+ * - CellGetN/CellGetS detection in assignment expressions
10
+ * - Comment lines (starting with #) and blank lines are skipped
11
+ */
12
+ export function parseTiCode(code) {
13
+ const rawLines = code.split("\n");
14
+ const lines = joinContinuationLines(rawLines);
15
+ try {
16
+ const { statements } = parseBlock(lines, 0, null);
17
+ return { ok: true, ast: statements };
18
+ }
19
+ catch (e) {
20
+ if (e instanceof ParseError) {
21
+ return { ok: false, error: { line: e.line, message: e.message } };
22
+ }
23
+ throw e;
24
+ }
25
+ }
26
+ /**
27
+ * Joins continuation lines into single logical lines to handle multi-line statements.
28
+ * A line is a continuation when prior lines have left parentheses open (depth > 0).
29
+ * Preserves the total line count so error line numbers remain accurate:
30
+ * the joined content is placed on the FIRST line; continuation lines become empty.
31
+ */
32
+ export function joinContinuationLines(lines) {
33
+ const result = [...lines];
34
+ let depth = 0;
35
+ let inStr = false; // string-literal state carried across lines (TM1 allows multi-line strings)
36
+ let pendingIdx = -1;
37
+ let pendingContent = "";
38
+ for (let i = 0; i < lines.length; i++) {
39
+ const raw = lines[i];
40
+ const trimmed = raw.trim();
41
+ // While inside an unterminated string literal, absorb every line as part
42
+ // of the same statement. `#` and blank lines are NOT comments here.
43
+ // Join with a single space to keep downstream regexes (which use `.`) happy.
44
+ if (inStr) {
45
+ if (pendingIdx === -1) {
46
+ pendingIdx = i;
47
+ pendingContent = raw;
48
+ }
49
+ else {
50
+ pendingContent += " " + raw.replace(/\r$/, "");
51
+ result[i] = "";
52
+ }
53
+ for (const ch of raw) {
54
+ if (ch === "'") {
55
+ inStr = !inStr;
56
+ }
57
+ else if (!inStr && ch === "(") {
58
+ depth++;
59
+ }
60
+ else if (!inStr && ch === ")") {
61
+ depth = Math.max(0, depth - 1);
62
+ }
63
+ }
64
+ if (!inStr && depth === 0) {
65
+ result[pendingIdx] = pendingContent;
66
+ pendingIdx = -1;
67
+ pendingContent = "";
68
+ }
69
+ continue;
70
+ }
71
+ if (trimmed === "" || trimmed.startsWith("#")) {
72
+ if (pendingIdx !== -1) {
73
+ result[i] = ""; // absorb blank/comment into the pending multi-line statement
74
+ }
75
+ continue;
76
+ }
77
+ if (pendingIdx === -1) {
78
+ pendingIdx = i;
79
+ pendingContent = trimmed;
80
+ }
81
+ else {
82
+ pendingContent += " " + trimmed;
83
+ result[i] = "";
84
+ }
85
+ // Count net paren change + detect unterminated string (carries to next line).
86
+ for (const ch of trimmed) {
87
+ if (ch === "'") {
88
+ inStr = !inStr;
89
+ }
90
+ else if (!inStr && ch === "(") {
91
+ depth++;
92
+ }
93
+ else if (!inStr && ch === ")") {
94
+ depth = Math.max(0, depth - 1);
95
+ }
96
+ }
97
+ // Detect trailing operator that requires a RHS on the next line.
98
+ // Ignores comparison/logical operators that could end a sub-expression
99
+ // (==, <>, <=, >=, !=) and lone `<` / `>`.
100
+ const noComment = trimmed.replace(/#.*$/, "").trim();
101
+ const endsWithContinuingOp =
102
+ // bare `=` (not `==`, not `<=`, not `>=`, not `<>`, not `!=`)
103
+ /(?:^|[^=<>!])=\s*$/.test(noComment) ||
104
+ // string-concat / arithmetic / logical with no RHS yet
105
+ /[|+*/&,]\s*$/.test(noComment);
106
+ if (!inStr && depth === 0 && !endsWithContinuingOp) {
107
+ result[pendingIdx] = pendingContent;
108
+ pendingIdx = -1;
109
+ pendingContent = "";
110
+ }
111
+ }
112
+ if (pendingIdx !== -1) {
113
+ result[pendingIdx] = pendingContent;
114
+ }
115
+ return result;
116
+ }
117
+ class ParseError extends Error {
118
+ line;
119
+ constructor(line, message) {
120
+ super(message);
121
+ this.line = line;
122
+ }
123
+ }
124
+ /**
125
+ * Parse a block of lines starting at `startIndex`.
126
+ * `terminators` indicates what keyword ends this block:
127
+ * - null: top-level (no terminator expected)
128
+ * - 'endif': inside an IF block
129
+ * - 'end': inside a WHILE block
130
+ */
131
+ function parseBlock(lines, startIndex, terminator) {
132
+ const statements = [];
133
+ let i = startIndex;
134
+ while (i < lines.length) {
135
+ const rawLine = lines[i];
136
+ const trimmed = rawLine.trim();
137
+ // Skip blank lines and comments
138
+ if (trimmed === "" || trimmed.startsWith("#")) {
139
+ i++;
140
+ continue;
141
+ }
142
+ const upper = trimmed.toUpperCase();
143
+ const lineNum = i + 1; // 1-based line numbers
144
+ // Check for double semicolon (two semicolons on one line is always an error)
145
+ if (trimmed.includes(";;")) {
146
+ throw new ParseError(lineNum, `Double semicolon in line ${lineNum}: each statement needs exactly one semicolon`);
147
+ }
148
+ // Check for block terminators
149
+ // Return nextIndex = i (do NOT consume the terminator line)
150
+ // so the caller (parseIfBlock / parseWhileBlock) can handle it.
151
+ if (upper === "ENDIF;" || upper === "ENDIF") {
152
+ if (terminator === "endif") {
153
+ return { statements, nextIndex: i };
154
+ }
155
+ throw new ParseError(lineNum, `Unexpected ENDIF without matching IF in line ${lineNum}`);
156
+ }
157
+ if (upper === "END;" || upper === "END") {
158
+ if (terminator === "end") {
159
+ return { statements, nextIndex: i };
160
+ }
161
+ throw new ParseError(lineNum, `Unexpected END without matching WHILE in line ${lineNum}`);
162
+ }
163
+ // ELSEIF / ELSE are handled by the IF parser, not here
164
+ if (upper.startsWith("ELSEIF") || upper === "ELSE;" || upper === "ELSE") {
165
+ if (terminator === "endif") {
166
+ // Return to the IF parser to handle ELSEIF/ELSE
167
+ return { statements, nextIndex: i };
168
+ }
169
+ throw new ParseError(lineNum, `Unexpected ${upper.startsWith("ELSEIF") ? "ELSEIF" : "ELSE"} without matching IF in line ${lineNum}`);
170
+ }
171
+ // Single-line IF/ENDIF: `IF(cond); stmt1; stmt2; ENDIF;`
172
+ if (upper.startsWith("IF") &&
173
+ /^IF\s*\(/i.test(trimmed) &&
174
+ hasTrailingEndif(trimmed)) {
175
+ const inlineIf = tryParseSingleLineIf(trimmed, lineNum);
176
+ if (inlineIf) {
177
+ statements.push(inlineIf);
178
+ i++;
179
+ continue;
180
+ }
181
+ }
182
+ // IF block
183
+ if (upper.startsWith("IF") && /^IF\s*\(/i.test(trimmed)) {
184
+ const result = parseIfBlock(lines, i);
185
+ statements.push(result.ifBlock);
186
+ i = result.nextIndex;
187
+ continue;
188
+ }
189
+ // WHILE block
190
+ if (upper.startsWith("WHILE") && /^WHILE\s*\(/i.test(trimmed)) {
191
+ const result = parseWhileBlock(lines, i);
192
+ statements.push(result.whileBlock);
193
+ i = result.nextIndex;
194
+ continue;
195
+ }
196
+ // Assignment: variable = expression;
197
+ // Check for empty right-hand side: y =; or y = ;
198
+ if (/^[A-Za-z_]\w*\s*=\s*;$/.test(trimmed)) {
199
+ const varName = (trimmed.split(/\s*=/)[0] ?? "").trim();
200
+ throw new ParseError(lineNum, `Empty assignment in line ${lineNum}: "${varName}" has no value (e.g. ${varName} = 1; or ${varName} = 'text';)`);
201
+ }
202
+ // First check if line looks like an assignment but is missing semicolon
203
+ if (/^[A-Za-z_]\w*\s*=\s*.+$/.test(trimmed) && !trimmed.endsWith(";")) {
204
+ const upperFirst = (trimmed.split(/[\s=(]/)[0] ?? "").toUpperCase();
205
+ if (!["IF", "ELSEIF", "ELSE", "ENDIF", "WHILE", "END"].includes(upperFirst)) {
206
+ throw new ParseError(lineNum, `Missing semicolon at end of line ${lineNum}`);
207
+ }
208
+ }
209
+ const assignment = tryParseAssignment(trimmed, lineNum);
210
+ if (assignment) {
211
+ statements.push(assignment);
212
+ i++;
213
+ continue;
214
+ }
215
+ // Function call: FunctionName(args...);
216
+ // Check for missing semicolon on function calls
217
+ if (/^[A-Za-z_]\w*\s*\(/.test(trimmed) && !trimmed.endsWith(";")) {
218
+ const upperFirst = (trimmed.split(/[\s(]/)[0] ?? "").toUpperCase();
219
+ if (!["IF", "ELSEIF", "WHILE"].includes(upperFirst)) {
220
+ throw new ParseError(lineNum, `Missing semicolon at end of line ${lineNum}`);
221
+ }
222
+ }
223
+ const funcCall = tryParseFunctionCall(trimmed, lineNum);
224
+ if (funcCall) {
225
+ statements.push(funcCall);
226
+ i++;
227
+ continue;
228
+ }
229
+ // Bare keyword (no parentheses): ItemSkip; ItemReject; ProcessQuit; etc.
230
+ // Check for missing semicolon on bare keywords
231
+ const cleanedForBareCheck = trimmed.endsWith(";")
232
+ ? trimmed.slice(0, -1).trim()
233
+ : trimmed.trim();
234
+ if (BARE_KEYWORDS.has(cleanedForBareCheck.toLowerCase()) &&
235
+ !trimmed.endsWith(";")) {
236
+ throw new ParseError(lineNum, `Missing semicolon at end of line ${lineNum}`);
237
+ }
238
+ const bareKeyword = tryParseBareKeyword(trimmed, lineNum);
239
+ if (bareKeyword) {
240
+ statements.push(bareKeyword);
241
+ i++;
242
+ continue;
243
+ }
244
+ // Unknown line — not valid TI syntax
245
+ throw new ParseError(lineNum, `Unknown statement in line ${lineNum}: "${trimmed.length > 60 ? trimmed.slice(0, 60) + "…" : trimmed}" — expected an assignment (var = expr;), a function call (Fn(...);), or a keyword`);
246
+ }
247
+ // If we expected a terminator but reached end of file
248
+ if (terminator === "endif") {
249
+ throw new ParseError(lines.length, `Missing ENDIF — IF block was not closed`);
250
+ }
251
+ if (terminator === "end") {
252
+ throw new ParseError(lines.length, `Missing END — WHILE block was not closed`);
253
+ }
254
+ return { statements, nextIndex: i };
255
+ }
256
+ function parseIfBlock(lines, startIndex) {
257
+ const trimmed = lines[startIndex].trim();
258
+ const lineNum = startIndex + 1;
259
+ const condition = extractCondition(trimmed, "IF");
260
+ // Parse THEN body
261
+ const thenResult = parseBlock(lines, startIndex + 1, "endif");
262
+ const thenBody = thenResult.statements;
263
+ let i = thenResult.nextIndex;
264
+ const elseIfClauses = [];
265
+ let elseBody = [];
266
+ // Handle ELSEIF and ELSE clauses
267
+ while (i < lines.length) {
268
+ const currentTrimmed = lines[i].trim();
269
+ const currentUpper = currentTrimmed.toUpperCase();
270
+ if (currentUpper === "ENDIF;" || currentUpper === "ENDIF") {
271
+ // End of IF block
272
+ return {
273
+ ifBlock: {
274
+ type: "if",
275
+ condition,
276
+ thenBody,
277
+ elseIfClauses,
278
+ elseBody,
279
+ line: lineNum,
280
+ },
281
+ nextIndex: i + 1,
282
+ };
283
+ }
284
+ if (currentUpper.startsWith("ELSEIF") &&
285
+ /^ELSEIF\s*\(/i.test(currentTrimmed)) {
286
+ const elseIfCondition = extractCondition(currentTrimmed, "ELSEIF");
287
+ const elseIfLine = i + 1;
288
+ const elseIfResult = parseBlock(lines, i + 1, "endif");
289
+ elseIfClauses.push({
290
+ condition: elseIfCondition,
291
+ body: elseIfResult.statements,
292
+ line: elseIfLine,
293
+ });
294
+ i = elseIfResult.nextIndex;
295
+ continue;
296
+ }
297
+ if (currentUpper === "ELSE;" || currentUpper === "ELSE") {
298
+ const elseResult = parseBlock(lines, i + 1, "endif");
299
+ elseBody = elseResult.statements;
300
+ i = elseResult.nextIndex;
301
+ continue;
302
+ }
303
+ // Should not reach here
304
+ break;
305
+ }
306
+ // If we get here, ENDIF was not found
307
+ throw new ParseError(lines.length, `Missing ENDIF — IF block was not closed`);
308
+ }
309
+ function parseWhileBlock(lines, startIndex) {
310
+ const trimmed = lines[startIndex].trim();
311
+ const lineNum = startIndex + 1;
312
+ const condition = extractCondition(trimmed, "WHILE");
313
+ const bodyResult = parseBlock(lines, startIndex + 1, "end");
314
+ return {
315
+ whileBlock: {
316
+ type: "while",
317
+ condition,
318
+ body: bodyResult.statements,
319
+ line: lineNum,
320
+ },
321
+ nextIndex: bodyResult.nextIndex + 1, // skip past the END line
322
+ };
323
+ }
324
+ /**
325
+ * Extract the condition from an IF/ELSEIF/WHILE line.
326
+ * E.g. "IF(x > 0);" => "x > 0"
327
+ */
328
+ function extractCondition(line, keyword) {
329
+ // Remove the keyword prefix (case-insensitive)
330
+ const afterKeyword = line.substring(keyword.length).trim();
331
+ // Find matching parentheses
332
+ if (!afterKeyword.startsWith("(")) {
333
+ // Fallback: return everything after keyword, stripped of trailing semicolons
334
+ return afterKeyword.replace(/;$/, "").trim();
335
+ }
336
+ let depth = 0;
337
+ let endIdx = -1;
338
+ for (let j = 0; j < afterKeyword.length; j++) {
339
+ if (afterKeyword[j] === "(")
340
+ depth++;
341
+ if (afterKeyword[j] === ")") {
342
+ depth--;
343
+ if (depth === 0) {
344
+ endIdx = j;
345
+ break;
346
+ }
347
+ }
348
+ }
349
+ if (endIdx === -1) {
350
+ return afterKeyword.replace(/;$/, "").trim();
351
+ }
352
+ // Return content inside the outermost parentheses
353
+ return afterKeyword.substring(1, endIdx).trim();
354
+ }
355
+ /**
356
+ * Try to parse a line as an assignment: `variable = expression;`
357
+ */
358
+ function tryParseAssignment(line, lineNum) {
359
+ // Match: identifier = expression;
360
+ // The variable name can contain letters, digits, underscores
361
+ // We need to be careful not to match == (comparison)
362
+ const match = line.match(/^([A-Za-z_]\w*)\s*=\s*(.+?)\s*;?\s*$/);
363
+ if (!match)
364
+ return null;
365
+ const variable = match[1];
366
+ const expression = match[2].trim();
367
+ // Don't match lines that look like comparisons (==) or keywords
368
+ const upperVar = variable.toUpperCase();
369
+ if (["IF", "ELSEIF", "ELSE", "ENDIF", "WHILE", "END"].includes(upperVar)) {
370
+ return null;
371
+ }
372
+ const cellGetInfo = detectCellGet(expression);
373
+ return {
374
+ type: "assignment",
375
+ variable,
376
+ expression,
377
+ isExternal: cellGetInfo !== undefined,
378
+ cellGetInfo,
379
+ line: lineNum,
380
+ };
381
+ }
382
+ /**
383
+ * Detect CellGetN or CellGetS in an expression and extract params.
384
+ */
385
+ function detectCellGet(expression) {
386
+ const match = expression.match(/\b(CellGetN|CellGetS)\s*\(([^)]*)\)/i);
387
+ if (!match)
388
+ return undefined;
389
+ const normalizedFn = match[1]
390
+ .toUpperCase()
391
+ .includes("GETN")
392
+ ? "CellGetN"
393
+ : "CellGetS";
394
+ const paramsStr = match[2].trim();
395
+ const params = paramsStr ? splitParams(paramsStr) : [];
396
+ return { fn: normalizedFn, params };
397
+ }
398
+ /**
399
+ * Split function parameters, respecting nested parentheses and string literals.
400
+ */
401
+ function splitParams(paramsStr) {
402
+ const params = [];
403
+ let current = "";
404
+ let depth = 0;
405
+ let inString = false;
406
+ let stringChar = "";
407
+ for (let i = 0; i < paramsStr.length; i++) {
408
+ const ch = paramsStr[i];
409
+ if (inString) {
410
+ current += ch;
411
+ if (ch === stringChar) {
412
+ inString = false;
413
+ }
414
+ continue;
415
+ }
416
+ if (ch === "'" || ch === '"') {
417
+ inString = true;
418
+ stringChar = ch;
419
+ current += ch;
420
+ continue;
421
+ }
422
+ if (ch === "(") {
423
+ depth++;
424
+ current += ch;
425
+ continue;
426
+ }
427
+ if (ch === ")") {
428
+ depth--;
429
+ current += ch;
430
+ continue;
431
+ }
432
+ if (ch === "," && depth === 0) {
433
+ params.push(current.trim());
434
+ current = "";
435
+ continue;
436
+ }
437
+ current += ch;
438
+ }
439
+ if (current.trim()) {
440
+ params.push(current.trim());
441
+ }
442
+ return params;
443
+ }
444
+ /**
445
+ * Try to parse a line as a function call statement: `FunctionName(args...);`
446
+ */
447
+ function tryParseFunctionCall(line, lineNum) {
448
+ // Match function name at start
449
+ const nameMatch = line.match(/^([A-Za-z_]\w*)\s*\(/);
450
+ if (!nameMatch)
451
+ return null;
452
+ const name = nameMatch[1];
453
+ // Don't match IF/WHILE/ELSEIF as function calls
454
+ const upperName = name.toUpperCase();
455
+ if (["IF", "ELSEIF", "WHILE"].includes(upperName)) {
456
+ return null;
457
+ }
458
+ // Find matching closing paren (handles nested parens)
459
+ const argsStart = nameMatch[0].length;
460
+ let depth = 1;
461
+ let argsEnd = -1;
462
+ for (let j = argsStart; j < line.length; j++) {
463
+ if (line[j] === "(")
464
+ depth++;
465
+ if (line[j] === ")") {
466
+ depth--;
467
+ if (depth === 0) {
468
+ argsEnd = j;
469
+ break;
470
+ }
471
+ }
472
+ }
473
+ if (argsEnd === -1)
474
+ return null;
475
+ // Check that after the closing paren there's only optional semicolon and whitespace
476
+ const remainder = line.substring(argsEnd + 1).trim();
477
+ if (remainder !== "" && remainder !== ";")
478
+ return null;
479
+ const argsStr = line.substring(argsStart, argsEnd).trim();
480
+ const args = argsStr ? splitParams(argsStr) : [];
481
+ return {
482
+ type: "functionCall",
483
+ name,
484
+ args,
485
+ line: lineNum,
486
+ };
487
+ }
488
+ function hasTrailingEndif(line) {
489
+ const upper = line.toUpperCase();
490
+ let inStr = false;
491
+ for (let k = 0; k <= upper.length - 5; k++) {
492
+ const ch = line[k] ?? "";
493
+ if (ch === "'") {
494
+ inStr = !inStr;
495
+ continue;
496
+ }
497
+ if (inStr) {
498
+ continue;
499
+ }
500
+ if (upper.slice(k, k + 5) === "ENDIF") {
501
+ const prev = k > 0 ? (line[k - 1] ?? "") : "";
502
+ const next = k + 5 < line.length ? (line[k + 5] ?? "") : "";
503
+ if (/\w/.test(prev) || /\w/.test(next)) {
504
+ continue;
505
+ }
506
+ return true;
507
+ }
508
+ }
509
+ return false;
510
+ }
511
+ function splitStatementsAtDepthZero(text) {
512
+ const out = [];
513
+ let current = "";
514
+ let depth = 0;
515
+ let inStr = false;
516
+ for (let k = 0; k < text.length; k++) {
517
+ const ch = text[k];
518
+ if (ch === "'") {
519
+ inStr = !inStr;
520
+ current += ch;
521
+ continue;
522
+ }
523
+ if (!inStr) {
524
+ if (ch === "(") {
525
+ depth++;
526
+ }
527
+ else if (ch === ")") {
528
+ depth--;
529
+ }
530
+ else if (ch === ";" && depth === 0) {
531
+ if (current.trim()) {
532
+ out.push(current.trim());
533
+ }
534
+ current = "";
535
+ continue;
536
+ }
537
+ }
538
+ current += ch;
539
+ }
540
+ if (current.trim()) {
541
+ out.push(current.trim());
542
+ }
543
+ return out;
544
+ }
545
+ function parseInlineStatements(stmtTexts, lineNum) {
546
+ const result = [];
547
+ for (const raw of stmtTexts) {
548
+ const s = raw.trim();
549
+ if (!s) {
550
+ continue;
551
+ }
552
+ const upper = s.toUpperCase();
553
+ if (upper === "ELSE" || upper === "ELSE;" || upper.startsWith("ELSEIF")) {
554
+ return null;
555
+ }
556
+ const withSemi = s.endsWith(";") ? s : s + ";";
557
+ const a = tryParseAssignment(withSemi, lineNum);
558
+ if (a) {
559
+ result.push(a);
560
+ continue;
561
+ }
562
+ const fc = tryParseFunctionCall(withSemi, lineNum);
563
+ if (fc) {
564
+ result.push(fc);
565
+ continue;
566
+ }
567
+ const bk = tryParseBareKeyword(withSemi, lineNum);
568
+ if (bk) {
569
+ result.push(bk);
570
+ continue;
571
+ }
572
+ return null;
573
+ }
574
+ return result;
575
+ }
576
+ function tryParseSingleLineIf(line, lineNum) {
577
+ const ifMatch = line.match(/^(IF\s*)\(/i);
578
+ if (!ifMatch) {
579
+ return null;
580
+ }
581
+ const openParen = ifMatch[1].length;
582
+ let depth = 1;
583
+ let inStr = false;
584
+ let condEnd = -1;
585
+ for (let j = openParen + 1; j < line.length; j++) {
586
+ const ch = line[j];
587
+ if (ch === "'") {
588
+ inStr = !inStr;
589
+ continue;
590
+ }
591
+ if (inStr) {
592
+ continue;
593
+ }
594
+ if (ch === "(") {
595
+ depth++;
596
+ }
597
+ else if (ch === ")") {
598
+ depth--;
599
+ if (depth === 0) {
600
+ condEnd = j;
601
+ break;
602
+ }
603
+ }
604
+ }
605
+ if (condEnd === -1) {
606
+ return null;
607
+ }
608
+ const condition = line.substring(openParen + 1, condEnd).trim();
609
+ let rest = line.substring(condEnd + 1).trim();
610
+ if (rest.startsWith(";")) {
611
+ rest = rest.substring(1).trim();
612
+ }
613
+ const upperRest = rest.toUpperCase();
614
+ let endifStart = -1;
615
+ let inStr2 = false;
616
+ for (let k = 0; k <= upperRest.length - 5; k++) {
617
+ const ch = rest[k] ?? "";
618
+ if (ch === "'") {
619
+ inStr2 = !inStr2;
620
+ continue;
621
+ }
622
+ if (inStr2) {
623
+ continue;
624
+ }
625
+ if (upperRest.slice(k, k + 5) === "ENDIF") {
626
+ const prev = k > 0 ? (rest[k - 1] ?? "") : "";
627
+ const next = k + 5 < rest.length ? (rest[k + 5] ?? "") : "";
628
+ if (/\w/.test(prev) || /\w/.test(next)) {
629
+ continue;
630
+ }
631
+ endifStart = k;
632
+ }
633
+ }
634
+ if (endifStart === -1) {
635
+ return null;
636
+ }
637
+ const bodyText = rest.substring(0, endifStart).trim();
638
+ const stmts = splitStatementsAtDepthZero(bodyText);
639
+ const thenBody = parseInlineStatements(stmts, lineNum);
640
+ if (thenBody === null) {
641
+ return null;
642
+ }
643
+ return {
644
+ type: "if",
645
+ condition,
646
+ thenBody,
647
+ elseIfClauses: [],
648
+ elseBody: [],
649
+ line: lineNum,
650
+ };
651
+ }
652
+ /** TI keywords that can appear as bare statements (without parentheses). */
653
+ const BARE_KEYWORDS = new Set([
654
+ "itemskip",
655
+ "itemreject",
656
+ "processquit",
657
+ "processerror",
658
+ "processbreak",
659
+ "processabort",
660
+ ]);
661
+ /**
662
+ * Try to parse a bare keyword like `ItemSkip;` (no parentheses).
663
+ * These are TI process control statements that don't require arguments.
664
+ */
665
+ function tryParseBareKeyword(line, lineNum) {
666
+ const cleaned = line.endsWith(";") ? line.slice(0, -1).trim() : line.trim();
667
+ if (BARE_KEYWORDS.has(cleaned.toLowerCase())) {
668
+ return { type: "functionCall", name: cleaned, args: [], line: lineNum };
669
+ }
670
+ return null;
671
+ }
672
+ //# sourceMappingURL=tiParser.js.map
@@ -0,0 +1,32 @@
1
+ import type { TiSection } from "./lintTypes.js";
2
+ /** Type information for a single function parameter */
3
+ export interface TiParamInfo {
4
+ name: string;
5
+ type: "string" | "numeric" | "any";
6
+ }
7
+ /** Signature of a known TI function */
8
+ export interface TiKnownSignature {
9
+ name: string;
10
+ minParams: number;
11
+ maxParams: number;
12
+ params: TiParamInfo[];
13
+ returnType: "string" | "numeric" | "void";
14
+ /** true if the function is no longer available in TM1 / Planning Analytics v12 (Cloud Native) */
15
+ deprecatedInV12?: boolean;
16
+ /**
17
+ * Performance note: recommendation for which section the function should ideally appear in.
18
+ * Emitted as a `performance-hint` when the function is used outside the recommended section.
19
+ */
20
+ performanceNote?: {
21
+ recommended: TiSection;
22
+ reason: string;
23
+ };
24
+ }
25
+ /**
26
+ * Map of all known TI function signatures.
27
+ * Key is the function name in lowercase for case-insensitive lookup.
28
+ * Extracted from the SIGNATURES map in tm1SignatureHelpProvider.ts,
29
+ * enriched with return types and parameter type information.
30
+ */
31
+ export declare const KNOWN_SIGNATURES: Map<string, TiKnownSignature>;
32
+ //# sourceMappingURL=tiSignatures.d.ts.map