@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,81 @@
1
+ // Server-side prefilter for the element naming audit.
2
+ //
3
+ // Auditing element names used to mean downloading them all: 15.2 MB for a
4
+ // single 171k-element dimension, 66 MB across a real model, and — worse — a
5
+ // cap (`maxElementsPerDim`) beyond which the audit silently checked only a
6
+ // prefix of the dimension.
7
+ //
8
+ // Every element rule in ./rules.ts is character-based, and TM1 implements the
9
+ // OData string functions those rules need (`startswith`, `endswith`,
10
+ // `contains`, `indexof`, `trim`, `length` — all verified live against 11.8).
11
+ // So the server can do the narrowing: ask it for the names that MIGHT violate
12
+ // a rule, and check only those.
13
+ //
14
+ // The contract this file must honour is SOUNDNESS, not exactness:
15
+ //
16
+ // checkName(name) is non-empty ⟹ the filter matches name
17
+ //
18
+ // A filter that also matches innocent names costs a few extra rows and nothing
19
+ // else, because `checkName` still decides. A filter that misses a violator
20
+ // turns the audit into a lie. `matchesElementViolationFilter` mirrors the
21
+ // emitted expression in TypeScript so the property can be tested directly;
22
+ // tests/unit/naming-odata-filter.test.ts asserts it over every rule class,
23
+ // and the live suite asserts that TM1 agrees.
24
+ import { SERVER_RESERVED_CHARS } from "./rules.js";
25
+ /** OData string literal: single quotes double. */
26
+ function lit(value) {
27
+ return `'${value.replace(/'/g, "''")}'`;
28
+ }
29
+ /**
30
+ * `$filter` expression selecting elements that may violate a naming rule.
31
+ *
32
+ * Mirrors the element branch of `checkName`: empty/whitespace-only, leading or
33
+ * trailing whitespace, TM1-Server-reserved characters, the `}` control prefix,
34
+ * a leading `+`/`-`, and — on v12 only — an embedded TAB.
35
+ */
36
+ export function elementViolationFilter() {
37
+ const clauses = [
38
+ // checkEmpty: name.trim() is empty. Covers "" and whitespace-only in one.
39
+ "length(trim(Name)) eq 0",
40
+ // checkLeadingTrailingWhitespace: name !== name.trim(). Expressed with
41
+ // trim() rather than a list of space characters, so every whitespace
42
+ // codepoint is covered instead of the handful someone remembered.
43
+ "trim(Name) ne Name",
44
+ // checkLeadingControlPrefix
45
+ `startswith(Name,${lit("}")})`,
46
+ // checkElementLeadingArithmetic
47
+ `startswith(Name,${lit("+")})`,
48
+ `startswith(Name,${lit("-")})`,
49
+ // checkServerReservedChars — elements are in scope for these too.
50
+ ...[...SERVER_RESERVED_CHARS].map((ch) => `contains(Name,${lit(ch)})`),
51
+ ];
52
+ // checkElementContainsTab applies on every version. The TAB goes in as a REAL
53
+ // tab character: every caller passes this string through
54
+ // encodeURIComponent(), which turns it into %09 on the wire. Writing "%09"
55
+ // here instead produced %2509 — the server then searched for the three
56
+ // characters "%09" and never matched, so the clause silently found nothing.
57
+ clauses.push("indexof(Name,'\t') ge 0");
58
+ return clauses.join(" or ");
59
+ }
60
+ /**
61
+ * The same predicate in TypeScript, for testing soundness against `checkName`
62
+ * without a server. Kept beside the builder so the two cannot drift: a rule
63
+ * added to one and forgotten in the other fails the unit test.
64
+ */
65
+ export function matchesElementViolationFilter(name) {
66
+ if (name.trim().length === 0)
67
+ return true;
68
+ if (name !== name.trim())
69
+ return true;
70
+ if (name.startsWith("}"))
71
+ return true;
72
+ if (name.startsWith("+") || name.startsWith("-"))
73
+ return true;
74
+ for (const ch of SERVER_RESERVED_CHARS)
75
+ if (name.includes(ch))
76
+ return true;
77
+ if (name.includes("\t"))
78
+ return true;
79
+ return false;
80
+ }
81
+ //# sourceMappingURL=odata-filter.js.map
@@ -0,0 +1,34 @@
1
+ /**
2
+ * TM1 / Planning Analytics object naming rules.
3
+ *
4
+ * Sources:
5
+ * - IBM PA 2.0: https://www.ibm.com/docs/en/planning-analytics/2.0.0?topic=development-tm1-object-naming-conventions
6
+ * - IBM PA 3.1: https://www.ibm.com/docs/en/planning-analytics/3.1.0?topic=references-naming-conventions
7
+ *
8
+ * Pass/fail semantics: every rule in this file is a HARD violation. Soft
9
+ * "avoid" recommendations from the IBM docs are intentionally not modelled.
10
+ */
11
+ export type ObjectKind = "cube" | "dimension" | "hierarchy" | "subset" | "view" | "process" | "chore" | "element" | "attribute" | "processVariable";
12
+ export type TM1MajorVersion = 11 | 12;
13
+ export interface Violation {
14
+ rule: string;
15
+ message: string;
16
+ /** Offending character (literal) when the rule is character-based. */
17
+ char?: string;
18
+ /** Zero-based position of the offending character. */
19
+ position?: number;
20
+ }
21
+ /**
22
+ * Characters explicitly reserved by the TM1 Server for Cube, Dimension,
23
+ * Subset, View, Process, and Chore names. Source: IBM PA naming docs,
24
+ * "Reserved characters per component" → "TM1 Server reserves these characters".
25
+ */
26
+ export declare const SERVER_RESERVED_CHARS: ReadonlySet<string>;
27
+ /**
28
+ * Validate a single TM1 object name. Returns all hard violations.
29
+ * Order: empty → length → whitespace → reserved-char → control-prefix → element-specific.
30
+ */
31
+ export declare function checkName(name: string, kind: ObjectKind): Violation[];
32
+ /** Parse "11.8.x" / "12.0.x" → 11 or 12. Falls back to 11. */
33
+ export declare function parseMajorVersion(productVersion: string): TM1MajorVersion;
34
+ //# sourceMappingURL=rules.d.ts.map
@@ -0,0 +1,215 @@
1
+ /**
2
+ * TM1 / Planning Analytics object naming rules.
3
+ *
4
+ * Sources:
5
+ * - IBM PA 2.0: https://www.ibm.com/docs/en/planning-analytics/2.0.0?topic=development-tm1-object-naming-conventions
6
+ * - IBM PA 3.1: https://www.ibm.com/docs/en/planning-analytics/3.1.0?topic=references-naming-conventions
7
+ *
8
+ * Pass/fail semantics: every rule in this file is a HARD violation. Soft
9
+ * "avoid" recommendations from the IBM docs are intentionally not modelled.
10
+ */
11
+ /**
12
+ * Characters explicitly reserved by the TM1 Server for Cube, Dimension,
13
+ * Subset, View, Process, and Chore names. Source: IBM PA naming docs,
14
+ * "Reserved characters per component" → "TM1 Server reserves these characters".
15
+ */
16
+ export const SERVER_RESERVED_CHARS = new Set([
17
+ "\\",
18
+ "/",
19
+ ":",
20
+ "*",
21
+ "?",
22
+ '"',
23
+ "<",
24
+ ">",
25
+ "|",
26
+ "'",
27
+ ";",
28
+ ",",
29
+ ]);
30
+ /**
31
+ * Allowed pattern for TI process variable identifiers (must start with letter).
32
+ * Backtick is included because TI tolerates it in data-source column references
33
+ * (e.g., `\`col_name\``-style identifiers exported from SQL/ODBC sources).
34
+ */
35
+ const PROCESS_VAR_ALLOWED = /^[A-Za-z][A-Za-z0-9.$%_`]*$/;
36
+ /** Conservative TM1 name length cap (cube/dim/process historically 256). */
37
+ const MAX_NAME_LENGTH = 256;
38
+ const SERVER_RESERVED_KINDS = new Set([
39
+ "cube",
40
+ "dimension",
41
+ "hierarchy",
42
+ "subset",
43
+ "view",
44
+ "process",
45
+ "chore",
46
+ ]);
47
+ function checkServerReservedChars(name) {
48
+ for (let i = 0; i < name.length; i++) {
49
+ const ch = name[i];
50
+ if (SERVER_RESERVED_CHARS.has(ch)) {
51
+ return {
52
+ rule: "server_reserved_char",
53
+ message: `Contains TM1-Server-reserved character '${ch}' at position ${i}. Reserved set: \\ / : * ? " < > | ' ; ,`,
54
+ char: ch,
55
+ position: i,
56
+ };
57
+ }
58
+ }
59
+ return null;
60
+ }
61
+ function checkLeadingControlPrefix(name) {
62
+ if (name.startsWith("}")) {
63
+ return {
64
+ rule: "leading_control_prefix",
65
+ message: "Starts with '}' — reserved prefix for TM1 control objects. User objects with this prefix are hidden when Display Control Objects is off.",
66
+ char: "}",
67
+ position: 0,
68
+ };
69
+ }
70
+ return null;
71
+ }
72
+ function checkEmpty(name) {
73
+ if (name.length === 0 || name.trim().length === 0) {
74
+ return {
75
+ rule: "empty",
76
+ message: "Name is empty or whitespace-only.",
77
+ };
78
+ }
79
+ return null;
80
+ }
81
+ function checkLength(name) {
82
+ if (name.length > MAX_NAME_LENGTH) {
83
+ return {
84
+ rule: "length_exceeds",
85
+ message: `Name length ${name.length} exceeds the conservative TM1 cap of ${MAX_NAME_LENGTH} characters.`,
86
+ };
87
+ }
88
+ return null;
89
+ }
90
+ function checkLeadingTrailingWhitespace(name) {
91
+ if (name.length === 0)
92
+ return null;
93
+ if (name !== name.trim()) {
94
+ return {
95
+ rule: "leading_trailing_whitespace",
96
+ message: "Has leading or trailing whitespace.",
97
+ };
98
+ }
99
+ return null;
100
+ }
101
+ function checkElementLeadingArithmetic(name) {
102
+ const first = name[0];
103
+ if (first === "+" || first === "-") {
104
+ return {
105
+ rule: "element_leading_arithmetic",
106
+ message: `Element name starts with '${first}' — breaks MDX active-form sets and rule references.`,
107
+ char: first,
108
+ position: 0,
109
+ };
110
+ }
111
+ return null;
112
+ }
113
+ // TAB is a hygiene problem on every version, not a v12 one. Measured on 11.8
114
+ // and 12.5 alike: the element is created, the name round-trips verbatim, no
115
+ // alias attribute appears, and MDX addresses it exactly like a plain element.
116
+ // So the rule no longer keys off the server version — it flags a character
117
+ // that is invisible in every UI, ambiguous against surrounding whitespace, and
118
+ // splits the name in TI and CSV round trips. Planning Analytics 3.1 is also
119
+ // reported to reserve TAB as the name/alias separator; that is a documented
120
+ // claim, not something either reachable server demonstrates.
121
+ function checkElementContainsTab(name) {
122
+ const idx = name.indexOf("\t");
123
+ if (idx >= 0) {
124
+ return {
125
+ rule: "element_contains_tab",
126
+ message: "Element name contains TAB — invisible in UIs, ambiguous against other whitespace, and a field separator in TI and CSV round trips. Planning Analytics 3.1 additionally reserves it as the name/alias separator.",
127
+ char: "\t",
128
+ position: idx,
129
+ };
130
+ }
131
+ return null;
132
+ }
133
+ function checkProcessVariable(name) {
134
+ if (name.length === 0) {
135
+ return { rule: "empty", message: "Process variable name is empty." };
136
+ }
137
+ if (PROCESS_VAR_ALLOWED.test(name))
138
+ return null;
139
+ const first = name[0];
140
+ if (!/[A-Za-z]/.test(first)) {
141
+ return {
142
+ rule: "process_var_leading_non_letter",
143
+ message: `Process variable '${name}' must start with a letter (got '${first}').`,
144
+ char: first,
145
+ position: 0,
146
+ };
147
+ }
148
+ for (let i = 0; i < name.length; i++) {
149
+ const ch = name[i];
150
+ if (!/[A-Za-z0-9.$%_`]/.test(ch)) {
151
+ return {
152
+ rule: "process_var_invalid_char",
153
+ message: `Process variable contains disallowed character '${ch}' at position ${i}. Allowed: letters, digits, . $ % _ \``,
154
+ char: ch,
155
+ position: i,
156
+ };
157
+ }
158
+ }
159
+ return null;
160
+ }
161
+ /**
162
+ * Validate a single TM1 object name. Returns all hard violations.
163
+ * Order: empty → length → whitespace → reserved-char → control-prefix → element-specific.
164
+ */
165
+ export function checkName(name, kind) {
166
+ if (kind === "processVariable") {
167
+ const v = checkProcessVariable(name);
168
+ return v ? [v] : [];
169
+ }
170
+ const violations = [];
171
+ const empty = checkEmpty(name);
172
+ if (empty) {
173
+ violations.push(empty);
174
+ return violations;
175
+ }
176
+ // Elements/attributes have no IBM-defined hard length limit; the 256-char
177
+ // cap is only documented for cube/dim/view/subset/process/chore names.
178
+ // TM1 v11 servers accept element names well beyond 256 chars via REST.
179
+ if (kind !== "element" && kind !== "attribute") {
180
+ const length = checkLength(name);
181
+ if (length)
182
+ violations.push(length);
183
+ }
184
+ const whitespace = checkLeadingTrailingWhitespace(name);
185
+ if (whitespace)
186
+ violations.push(whitespace);
187
+ if (SERVER_RESERVED_KINDS.has(kind) ||
188
+ kind === "element" ||
189
+ kind === "attribute") {
190
+ const reserved = checkServerReservedChars(name);
191
+ if (reserved)
192
+ violations.push(reserved);
193
+ }
194
+ const controlPrefix = checkLeadingControlPrefix(name);
195
+ if (controlPrefix)
196
+ violations.push(controlPrefix);
197
+ if (kind === "element" || kind === "attribute") {
198
+ const arithmetic = checkElementLeadingArithmetic(name);
199
+ if (arithmetic)
200
+ violations.push(arithmetic);
201
+ const tab = checkElementContainsTab(name);
202
+ if (tab)
203
+ violations.push(tab);
204
+ }
205
+ return violations;
206
+ }
207
+ /** Parse "11.8.x" / "12.0.x" → 11 or 12. Falls back to 11. */
208
+ export function parseMajorVersion(productVersion) {
209
+ const match = productVersion.match(/^(\d+)/);
210
+ if (!match)
211
+ return 11;
212
+ const major = Number(match[1]);
213
+ return major >= 12 ? 12 : 11;
214
+ }
215
+ //# sourceMappingURL=rules.js.map
@@ -0,0 +1,19 @@
1
+ import type { DataSource, ProcessParameter, ProcessVariable } from "../types.js";
2
+ export interface ParsedPro {
3
+ name: string | null;
4
+ prolog: string;
5
+ metadata: string;
6
+ data: string;
7
+ epilog: string;
8
+ parameters: ProcessParameter[];
9
+ variables: ProcessVariable[];
10
+ /**
11
+ * Raw line block 582: one entry per datasource COLUMN, ignored ones included.
12
+ * Empty when the file carries none. See src/lib/variables-ui-data.ts — the
13
+ * ignore flag exists nowhere else, so dropping this block loses it.
14
+ */
15
+ variablesUIData: string[];
16
+ dataSource: DataSource;
17
+ }
18
+ export declare function parseProFile(content: string): ParsedPro;
19
+ //# sourceMappingURL=pro-parser.d.ts.map
@@ -0,0 +1,260 @@
1
+ const SECTION_RE = /^(572|573|574|575),(\d*)$/;
2
+ // Header codes whose value is a counted block ("560,3" + 3 lines), not a scalar.
3
+ // 566 is the ODBC query — TM1 writes "566,0" for every non-ODBC datasource.
4
+ const BLOCK_CODES = new Set([
5
+ "560",
6
+ "561",
7
+ "566",
8
+ "577",
9
+ "578",
10
+ "579",
11
+ "580",
12
+ "581",
13
+ "582",
14
+ "590",
15
+ "637",
16
+ ]);
17
+ function stripQuotes(s) {
18
+ if (s.length >= 2 && s.startsWith('"') && s.endsWith('"')) {
19
+ return s.slice(1, -1).replace(/""/g, '"');
20
+ }
21
+ return s;
22
+ }
23
+ function lineValue(line) {
24
+ const idx = line.indexOf(",");
25
+ return idx === -1 ? "" : line.slice(idx + 1);
26
+ }
27
+ function parseProcessName(lines) {
28
+ for (const line of lines) {
29
+ const m = line.match(/^602,"(.+)"$/);
30
+ if (m)
31
+ return m[1] ?? null;
32
+ if (/^572,/.test(line))
33
+ break;
34
+ }
35
+ return null;
36
+ }
37
+ // Read everything before the first code section into scalars ("585,\"DSN\"") and
38
+ // counted blocks ("566,3" + 3 lines). Consuming blocks by their count matters:
39
+ // an ODBC query line such as `FROM dbo."570,Sales"` must not be read as a header.
40
+ function parseHeaderFields(lines) {
41
+ const scalars = new Map();
42
+ const rawScalars = new Map();
43
+ const blocks = new Map();
44
+ const sectionIdx = lines.findIndex((l) => SECTION_RE.test(l));
45
+ const pre = sectionIdx === -1 ? lines : lines.slice(0, sectionIdx);
46
+ let i = 0;
47
+ while (i < pre.length) {
48
+ const line = pre[i];
49
+ const block = line.match(/^(\d{3}),(\d+)$/);
50
+ if (block && BLOCK_CODES.has(block[1])) {
51
+ const count = parseInt(block[2], 10);
52
+ blocks.set(block[1], pre.slice(i + 1, i + 1 + count));
53
+ i += 1 + count;
54
+ continue;
55
+ }
56
+ const m = line.match(/^(\d{3}),/);
57
+ // First occurrence wins, mirroring the old first-match lookup.
58
+ if (m && !scalars.has(m[1])) {
59
+ scalars.set(m[1], stripQuotes(lineValue(line)));
60
+ rawScalars.set(m[1], lineValue(line));
61
+ }
62
+ i++;
63
+ }
64
+ return { scalars, rawScalars, blocks };
65
+ }
66
+ function parseSections(lines) {
67
+ const map = {
68
+ "572": [],
69
+ "573": [],
70
+ "574": [],
71
+ "575": [],
72
+ };
73
+ let i = 0;
74
+ while (i < lines.length) {
75
+ const m = lines[i].match(SECTION_RE);
76
+ if (!m) {
77
+ i++;
78
+ continue;
79
+ }
80
+ const code = m[1];
81
+ const rawCount = m[2];
82
+ i++;
83
+ if (rawCount !== "") {
84
+ // TM1 writes an explicit line count ("572,138"). Trust it, so code lines
85
+ // that look like a header (e.g. a literal "930,0") stay in the section.
86
+ const count = parseInt(rawCount, 10);
87
+ for (let taken = 0; taken < count && i < lines.length; taken++, i++) {
88
+ map[code].push(lines[i]);
89
+ }
90
+ continue;
91
+ }
92
+ // Countless header (older files written by this serializer): read until the
93
+ // next numeric header line.
94
+ while (i < lines.length && !/^\d{3},/.test(lines[i])) {
95
+ map[code].push(lines[i]);
96
+ i++;
97
+ }
98
+ }
99
+ return {
100
+ prolog: map["572"].join("\n").trimEnd(),
101
+ metadata: map["573"].join("\n").trimEnd(),
102
+ data: map["574"].join("\n").trimEnd(),
103
+ epilog: map["575"].join("\n").trimEnd(),
104
+ };
105
+ }
106
+ function parseParameters(blocks) {
107
+ const names = (blocks.get("560") ?? []).map((l) => l.trim());
108
+ const types = (blocks.get("561") ?? []).map((l) => parseInt(l.trim(), 10) || 1);
109
+ const defaults = {};
110
+ const prompts = {};
111
+ for (const [code, target] of [
112
+ ["590", defaults],
113
+ ["637", prompts],
114
+ ]) {
115
+ for (const line of blocks.get(code) ?? []) {
116
+ const ci = line.indexOf(",");
117
+ if (ci === -1)
118
+ continue;
119
+ target[line.slice(0, ci)] = stripQuotes(line.slice(ci + 1));
120
+ }
121
+ }
122
+ return names.map((name, idx) => {
123
+ const proType = types[idx] ?? 1;
124
+ const restType = proType === 2 ? "String" : "Numeric";
125
+ const rawValue = defaults[name] ?? "";
126
+ const defaultValue = restType === "Numeric" ? Number(rawValue || "0") || 0 : rawValue;
127
+ return {
128
+ name,
129
+ type: restType,
130
+ defaultValue,
131
+ prompt: prompts[name] ?? "",
132
+ };
133
+ });
134
+ }
135
+ function parseVariables(blocks) {
136
+ const names = (blocks.get("577") ?? []).map((l) => l.trim());
137
+ const types = (blocks.get("578") ?? []).map((l) => parseInt(l.trim(), 10) || 2);
138
+ const positions = (blocks.get("579") ?? []).map((l) => parseInt(l.trim(), 10) || 1);
139
+ const startBytes = (blocks.get("580") ?? []).map((l) => parseInt(l.trim(), 10) || 0);
140
+ const endBytes = (blocks.get("581") ?? []).map((l) => parseInt(l.trim(), 10) || 0);
141
+ return names.map((name, idx) => {
142
+ const proType = types[idx] ?? 2;
143
+ const restType = proType === 1 ? "Numeric" : "String";
144
+ const variable = {
145
+ name,
146
+ type: restType,
147
+ position: positions[idx] ?? idx + 1,
148
+ };
149
+ // Byte offsets only mean something for fixed-width sources; TM1 writes 0
150
+ // for every other kind, and carrying those zeros around adds nothing.
151
+ if (startBytes[idx])
152
+ variable.startByte = startBytes[idx];
153
+ if (endBytes[idx])
154
+ variable.endByte = endBytes[idx];
155
+ return variable;
156
+ });
157
+ }
158
+ function parseDataSource(fields) {
159
+ const { scalars, rawScalars, blocks } = fields;
160
+ const get = (code) => scalars.get(code) ?? "";
161
+ const proType = (get("562") || "NULL").toUpperCase();
162
+ const TYPE_MAP = {
163
+ NULL: "None",
164
+ VIEW: "TM1CubeView",
165
+ SUBSET: "TM1DimensionSubset",
166
+ CHARACTERDELIMITED: "ASCII",
167
+ // A fixed-width ASCII source carries its own type name.
168
+ POSITIONDELIMITED: "ASCII",
169
+ ODBC: "ODBC",
170
+ };
171
+ const restType = TYPE_MAP[proType] ?? "None";
172
+ if (restType === "None")
173
+ return { type: "None" };
174
+ // 586 = DataSourceNameForServer, 585 = DataSourceNameForClient (verified
175
+ // against .pro files TM1 wrote itself; 585 is empty when no client name is
176
+ // set). Files written by this serializer before that was known carry only
177
+ // 585 — recognisable by the missing 586 — and put the server name there.
178
+ const tm1Layout = scalars.has("586");
179
+ const server = tm1Layout ? get("586") : get("585");
180
+ const client = tm1Layout ? get("585") : get("585");
181
+ // TM1 writes view and subset names unquoted, so a name may legitimately start
182
+ // and end with a quote; only our own older files need unquoting here.
183
+ const rawName = (code) => {
184
+ const value = tm1Layout ? rawScalars.get(code) : scalars.get(code);
185
+ return value ?? "";
186
+ };
187
+ if (restType === "TM1CubeView") {
188
+ return {
189
+ type: restType,
190
+ dataSourceNameForServer: server,
191
+ dataSourceNameForClient: client,
192
+ view: rawName("570"),
193
+ };
194
+ }
195
+ if (restType === "TM1DimensionSubset") {
196
+ return {
197
+ type: restType,
198
+ dataSourceNameForServer: server,
199
+ dataSourceNameForClient: client,
200
+ // 571 holds the subset; 570 is the fallback for our own older files.
201
+ subset: rawName("571") || rawName("570"),
202
+ };
203
+ }
204
+ const ds = {
205
+ type: restType,
206
+ dataSourceNameForServer: server,
207
+ dataSourceNameForClient: client,
208
+ };
209
+ if (restType === "ASCII") {
210
+ ds.asciiDelimiterType =
211
+ proType === "POSITIONDELIMITED" ? "FixedWidth" : "Character";
212
+ ds.asciiDelimiterChar = scalars.get("567") ?? ",";
213
+ ds.asciiQuoteCharacter = scalars.get("568") ?? '"';
214
+ ds.asciiDecimalSeparator = scalars.get("588") ?? ".";
215
+ ds.asciiThousandSeparator = scalars.get("589") ?? ",";
216
+ const headerVal = scalars.get("569");
217
+ if (headerVal !== undefined)
218
+ ds.asciiHeaderRecords = parseInt(headerVal, 10) || 0;
219
+ }
220
+ if (restType === "ODBC") {
221
+ const user = get("564");
222
+ if (user)
223
+ ds.userName = user;
224
+ const query = (blocks.get("566") ?? []).join("\n");
225
+ if (query.length > 0)
226
+ ds.query = query;
227
+ // 565 is the password slot. Files TM1 wrote hold its own encoding of the
228
+ // credential, which is not what the REST API accepts, so only values this
229
+ // serializer wrote (an exported REST password) are worth carrying — those
230
+ // are recognisable by the file being in our layout rather than TM1's, i.e.
231
+ // no 601 version header.
232
+ const password = get("565");
233
+ if (password && !scalars.has("601"))
234
+ ds.password = password;
235
+ // 559 — ODBC unicode interface. TM1 writes it for every process, so an
236
+ // absent line means an older/hand-written file, not "unicode off".
237
+ const unicode = get("559");
238
+ if (unicode === "1" || unicode === "0")
239
+ ds.usesUnicode = unicode === "1";
240
+ }
241
+ return ds;
242
+ }
243
+ export function parseProFile(content) {
244
+ const lines = content
245
+ // TM1 writes .pro files with a UTF-8 BOM.
246
+ .replace(/^\uFEFF/, "")
247
+ .split("\n")
248
+ .map((l) => l.replace(/\r$/, ""));
249
+ const fields = parseHeaderFields(lines);
250
+ const sections = parseSections(lines);
251
+ return {
252
+ name: parseProcessName(lines),
253
+ ...sections,
254
+ parameters: parseParameters(fields.blocks),
255
+ variables: parseVariables(fields.blocks),
256
+ variablesUIData: fields.blocks.get("582") ?? [],
257
+ dataSource: parseDataSource(fields),
258
+ };
259
+ }
260
+ //# sourceMappingURL=pro-parser.js.map
@@ -0,0 +1,19 @@
1
+ import type { DataSource, ProcessParameter, ProcessVariable } from "../types.js";
2
+ export interface ProcessSerializeInput {
3
+ name: string;
4
+ prolog?: string;
5
+ metadata?: string;
6
+ data?: string;
7
+ epilog?: string;
8
+ parameters?: ProcessParameter[];
9
+ variables?: ProcessVariable[];
10
+ /**
11
+ * Raw `VariablesUIData` / line block 582 — one entry per datasource column,
12
+ * ignored ones included. Omit it and the ignored columns are gone: they have
13
+ * no representation in the variables list.
14
+ */
15
+ variablesUIData?: string[];
16
+ dataSource?: DataSource;
17
+ }
18
+ export declare function serializeToPro(input: ProcessSerializeInput): string;
19
+ //# sourceMappingURL=pro-serializer.d.ts.map