tm1npm 1.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 (451) hide show
  1. package/.env.example +16 -0
  2. package/.eslintrc.js +28 -0
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +36 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  5. package/.github/ISSUE_TEMPLATE/question.md +24 -0
  6. package/.github/workflows/publish-npm.yml +53 -0
  7. package/.github/workflows/test-on-tag.yml +172 -0
  8. package/DEVELOPMENT_GUIDE.md +587 -0
  9. package/LICENSE +21 -0
  10. package/README.md +580 -0
  11. package/jest.ci.config.js +83 -0
  12. package/jest.config.js +68 -0
  13. package/lib/exceptions/TM1Exception.d.ts +17 -0
  14. package/lib/exceptions/TM1Exception.d.ts.map +1 -0
  15. package/lib/exceptions/TM1Exception.js +36 -0
  16. package/lib/exceptions/TM1RestException.d.ts +10 -0
  17. package/lib/exceptions/TM1RestException.d.ts.map +1 -0
  18. package/lib/exceptions/TM1RestException.js +17 -0
  19. package/lib/exceptions/TM1TimeoutException.d.ts +9 -0
  20. package/lib/exceptions/TM1TimeoutException.d.ts.map +1 -0
  21. package/lib/exceptions/TM1TimeoutException.js +16 -0
  22. package/lib/index.d.ts +41 -0
  23. package/lib/index.d.ts.map +1 -0
  24. package/lib/index.js +132 -0
  25. package/lib/objects/Annotation.d.ts +36 -0
  26. package/lib/objects/Annotation.d.ts.map +1 -0
  27. package/lib/objects/Annotation.js +134 -0
  28. package/lib/objects/Application.d.ts +67 -0
  29. package/lib/objects/Application.d.ts.map +1 -0
  30. package/lib/objects/Application.js +125 -0
  31. package/lib/objects/Axis.d.ts +36 -0
  32. package/lib/objects/Axis.d.ts.map +1 -0
  33. package/lib/objects/Axis.js +103 -0
  34. package/lib/objects/Chore.d.ts +43 -0
  35. package/lib/objects/Chore.d.ts.map +1 -0
  36. package/lib/objects/Chore.js +129 -0
  37. package/lib/objects/ChoreFrequency.d.ts +23 -0
  38. package/lib/objects/ChoreFrequency.d.ts.map +1 -0
  39. package/lib/objects/ChoreFrequency.js +61 -0
  40. package/lib/objects/ChoreStartTime.d.ts +15 -0
  41. package/lib/objects/ChoreStartTime.d.ts.map +1 -0
  42. package/lib/objects/ChoreStartTime.js +85 -0
  43. package/lib/objects/ChoreTask.d.ts +28 -0
  44. package/lib/objects/ChoreTask.d.ts.map +1 -0
  45. package/lib/objects/ChoreTask.js +66 -0
  46. package/lib/objects/Cube.d.ts +26 -0
  47. package/lib/objects/Cube.d.ts.map +1 -0
  48. package/lib/objects/Cube.js +109 -0
  49. package/lib/objects/Dimension.d.ts +26 -0
  50. package/lib/objects/Dimension.d.ts.map +1 -0
  51. package/lib/objects/Dimension.js +86 -0
  52. package/lib/objects/Element.d.ts +35 -0
  53. package/lib/objects/Element.d.ts.map +1 -0
  54. package/lib/objects/Element.js +115 -0
  55. package/lib/objects/ElementAttribute.d.ts +28 -0
  56. package/lib/objects/ElementAttribute.d.ts.map +1 -0
  57. package/lib/objects/ElementAttribute.js +97 -0
  58. package/lib/objects/Git.d.ts +21 -0
  59. package/lib/objects/Git.d.ts.map +1 -0
  60. package/lib/objects/Git.js +49 -0
  61. package/lib/objects/GitCommit.d.ts +12 -0
  62. package/lib/objects/GitCommit.d.ts.map +1 -0
  63. package/lib/objects/GitCommit.js +26 -0
  64. package/lib/objects/GitPlan.d.ts +35 -0
  65. package/lib/objects/GitPlan.d.ts.map +1 -0
  66. package/lib/objects/GitPlan.js +78 -0
  67. package/lib/objects/GitRemote.d.ts +12 -0
  68. package/lib/objects/GitRemote.d.ts.map +1 -0
  69. package/lib/objects/GitRemote.js +26 -0
  70. package/lib/objects/Hierarchy.d.ts +47 -0
  71. package/lib/objects/Hierarchy.d.ts.map +1 -0
  72. package/lib/objects/Hierarchy.js +165 -0
  73. package/lib/objects/MDXView.d.ts +19 -0
  74. package/lib/objects/MDXView.d.ts.map +1 -0
  75. package/lib/objects/MDXView.js +67 -0
  76. package/lib/objects/NativeView.d.ts +39 -0
  77. package/lib/objects/NativeView.d.ts.map +1 -0
  78. package/lib/objects/NativeView.js +209 -0
  79. package/lib/objects/Process.d.ts +70 -0
  80. package/lib/objects/Process.d.ts.map +1 -0
  81. package/lib/objects/Process.js +210 -0
  82. package/lib/objects/ProcessDebugBreakpoint.d.ts +60 -0
  83. package/lib/objects/ProcessDebugBreakpoint.d.ts.map +1 -0
  84. package/lib/objects/ProcessDebugBreakpoint.js +168 -0
  85. package/lib/objects/ProcessParameter.d.ts +23 -0
  86. package/lib/objects/ProcessParameter.d.ts.map +1 -0
  87. package/lib/objects/ProcessParameter.js +55 -0
  88. package/lib/objects/ProcessVariable.d.ts +26 -0
  89. package/lib/objects/ProcessVariable.d.ts.map +1 -0
  90. package/lib/objects/ProcessVariable.js +63 -0
  91. package/lib/objects/Rules.d.ts +30 -0
  92. package/lib/objects/Rules.d.ts.map +1 -0
  93. package/lib/objects/Rules.js +103 -0
  94. package/lib/objects/Sandbox.d.ts +21 -0
  95. package/lib/objects/Sandbox.d.ts.map +1 -0
  96. package/lib/objects/Sandbox.js +64 -0
  97. package/lib/objects/Server.d.ts +27 -0
  98. package/lib/objects/Server.d.ts.map +1 -0
  99. package/lib/objects/Server.js +26 -0
  100. package/lib/objects/Subset.d.ts +44 -0
  101. package/lib/objects/Subset.d.ts.map +1 -0
  102. package/lib/objects/Subset.js +222 -0
  103. package/lib/objects/TM1Object.d.ts +8 -0
  104. package/lib/objects/TM1Object.d.ts.map +1 -0
  105. package/lib/objects/TM1Object.js +17 -0
  106. package/lib/objects/TM1Project.d.ts +74 -0
  107. package/lib/objects/TM1Project.d.ts.map +1 -0
  108. package/lib/objects/TM1Project.js +409 -0
  109. package/lib/objects/User.d.ts +42 -0
  110. package/lib/objects/User.d.ts.map +1 -0
  111. package/lib/objects/User.js +157 -0
  112. package/lib/objects/View.d.ts +19 -0
  113. package/lib/objects/View.d.ts.map +1 -0
  114. package/lib/objects/View.js +33 -0
  115. package/lib/objects/index.d.ts +30 -0
  116. package/lib/objects/index.d.ts.map +1 -0
  117. package/lib/objects/index.js +68 -0
  118. package/lib/services/AnnotationService.d.ts +17 -0
  119. package/lib/services/AnnotationService.d.ts.map +1 -0
  120. package/lib/services/AnnotationService.js +91 -0
  121. package/lib/services/ApplicationService.d.ts +21 -0
  122. package/lib/services/ApplicationService.d.ts.map +1 -0
  123. package/lib/services/ApplicationService.js +227 -0
  124. package/lib/services/AuditLogService.d.ts +15 -0
  125. package/lib/services/AuditLogService.d.ts.map +1 -0
  126. package/lib/services/AuditLogService.js +153 -0
  127. package/lib/services/CellService.d.ts +191 -0
  128. package/lib/services/CellService.d.ts.map +1 -0
  129. package/lib/services/CellService.js +597 -0
  130. package/lib/services/ChoreService.d.ts +24 -0
  131. package/lib/services/ChoreService.d.ts.map +1 -0
  132. package/lib/services/ChoreService.js +219 -0
  133. package/lib/services/ConfigurationService.d.ts +18 -0
  134. package/lib/services/ConfigurationService.d.ts.map +1 -0
  135. package/lib/services/ConfigurationService.js +60 -0
  136. package/lib/services/CubeService.d.ts +43 -0
  137. package/lib/services/CubeService.d.ts.map +1 -0
  138. package/lib/services/CubeService.js +296 -0
  139. package/lib/services/DimensionService.d.ts +21 -0
  140. package/lib/services/DimensionService.d.ts.map +1 -0
  141. package/lib/services/DimensionService.js +146 -0
  142. package/lib/services/ElementService.d.ts +132 -0
  143. package/lib/services/ElementService.d.ts.map +1 -0
  144. package/lib/services/ElementService.js +579 -0
  145. package/lib/services/FileService.d.ts +14 -0
  146. package/lib/services/FileService.d.ts.map +1 -0
  147. package/lib/services/FileService.js +65 -0
  148. package/lib/services/GitService.d.ts +23 -0
  149. package/lib/services/GitService.d.ts.map +1 -0
  150. package/lib/services/GitService.js +225 -0
  151. package/lib/services/HierarchyService.d.ts +32 -0
  152. package/lib/services/HierarchyService.d.ts.map +1 -0
  153. package/lib/services/HierarchyService.js +235 -0
  154. package/lib/services/JobService.d.ts +13 -0
  155. package/lib/services/JobService.d.ts.map +1 -0
  156. package/lib/services/JobService.js +83 -0
  157. package/lib/services/LoggerService.d.ts +16 -0
  158. package/lib/services/LoggerService.d.ts.map +1 -0
  159. package/lib/services/LoggerService.js +101 -0
  160. package/lib/services/ManageService.d.ts +47 -0
  161. package/lib/services/ManageService.d.ts.map +1 -0
  162. package/lib/services/ManageService.js +221 -0
  163. package/lib/services/MessageLogService.d.ts +13 -0
  164. package/lib/services/MessageLogService.d.ts.map +1 -0
  165. package/lib/services/MessageLogService.js +175 -0
  166. package/lib/services/MonitoringService.d.ts +29 -0
  167. package/lib/services/MonitoringService.d.ts.map +1 -0
  168. package/lib/services/MonitoringService.js +86 -0
  169. package/lib/services/ObjectService.d.ts +8 -0
  170. package/lib/services/ObjectService.d.ts.map +1 -0
  171. package/lib/services/ObjectService.js +20 -0
  172. package/lib/services/PowerBiService.d.ts +13 -0
  173. package/lib/services/PowerBiService.d.ts.map +1 -0
  174. package/lib/services/PowerBiService.js +52 -0
  175. package/lib/services/ProcessService.d.ts +57 -0
  176. package/lib/services/ProcessService.d.ts.map +1 -0
  177. package/lib/services/ProcessService.js +499 -0
  178. package/lib/services/RestService.d.ts +68 -0
  179. package/lib/services/RestService.d.ts.map +1 -0
  180. package/lib/services/RestService.js +166 -0
  181. package/lib/services/SandboxService.d.ts +28 -0
  182. package/lib/services/SandboxService.d.ts.map +1 -0
  183. package/lib/services/SandboxService.js +197 -0
  184. package/lib/services/SecurityService.d.ts +33 -0
  185. package/lib/services/SecurityService.d.ts.map +1 -0
  186. package/lib/services/SecurityService.js +249 -0
  187. package/lib/services/ServerService.d.ts +55 -0
  188. package/lib/services/ServerService.d.ts.map +1 -0
  189. package/lib/services/ServerService.js +247 -0
  190. package/lib/services/SessionService.d.ts +15 -0
  191. package/lib/services/SessionService.d.ts.map +1 -0
  192. package/lib/services/SessionService.js +68 -0
  193. package/lib/services/SubsetService.d.ts +13 -0
  194. package/lib/services/SubsetService.d.ts.map +1 -0
  195. package/lib/services/SubsetService.js +46 -0
  196. package/lib/services/TM1Service.d.ts +39 -0
  197. package/lib/services/TM1Service.d.ts.map +1 -0
  198. package/lib/services/TM1Service.js +94 -0
  199. package/lib/services/ThreadService.d.ts +15 -0
  200. package/lib/services/ThreadService.d.ts.map +1 -0
  201. package/lib/services/ThreadService.js +104 -0
  202. package/lib/services/TransactionLogService.d.ts +11 -0
  203. package/lib/services/TransactionLogService.d.ts.map +1 -0
  204. package/lib/services/TransactionLogService.js +124 -0
  205. package/lib/services/UserService.d.ts +14 -0
  206. package/lib/services/UserService.d.ts.map +1 -0
  207. package/lib/services/UserService.js +103 -0
  208. package/lib/services/ViewService.d.ts +30 -0
  209. package/lib/services/ViewService.d.ts.map +1 -0
  210. package/lib/services/ViewService.js +331 -0
  211. package/lib/services/index.d.ts +26 -0
  212. package/lib/services/index.d.ts.map +1 -0
  213. package/lib/services/index.js +56 -0
  214. package/lib/tests/100PercentParityCheck.test.d.ts +6 -0
  215. package/lib/tests/100PercentParityCheck.test.d.ts.map +1 -0
  216. package/lib/tests/100PercentParityCheck.test.js +143 -0
  217. package/lib/tests/basic.test.d.ts +6 -0
  218. package/lib/tests/basic.test.d.ts.map +1 -0
  219. package/lib/tests/basic.test.js +52 -0
  220. package/lib/tests/cellService.test.d.ts +6 -0
  221. package/lib/tests/cellService.test.d.ts.map +1 -0
  222. package/lib/tests/cellService.test.js +311 -0
  223. package/lib/tests/ciSetup.d.ts +6 -0
  224. package/lib/tests/ciSetup.d.ts.map +1 -0
  225. package/lib/tests/ciSetup.js +23 -0
  226. package/lib/tests/comprehensive.service.test.d.ts +6 -0
  227. package/lib/tests/comprehensive.service.test.d.ts.map +1 -0
  228. package/lib/tests/comprehensive.service.test.js +507 -0
  229. package/lib/tests/connection.test.d.ts +6 -0
  230. package/lib/tests/connection.test.d.ts.map +1 -0
  231. package/lib/tests/connection.test.js +89 -0
  232. package/lib/tests/cubeService.test.d.ts +6 -0
  233. package/lib/tests/cubeService.test.d.ts.map +1 -0
  234. package/lib/tests/cubeService.test.js +368 -0
  235. package/lib/tests/dimensionService.comprehensive.test.d.ts +7 -0
  236. package/lib/tests/dimensionService.comprehensive.test.d.ts.map +1 -0
  237. package/lib/tests/dimensionService.comprehensive.test.js +614 -0
  238. package/lib/tests/dimensionService.test.d.ts +6 -0
  239. package/lib/tests/dimensionService.test.d.ts.map +1 -0
  240. package/lib/tests/dimensionService.test.js +293 -0
  241. package/lib/tests/edgeCases.test.d.ts +6 -0
  242. package/lib/tests/edgeCases.test.d.ts.map +1 -0
  243. package/lib/tests/edgeCases.test.js +301 -0
  244. package/lib/tests/elementService.comprehensive.test.d.ts +7 -0
  245. package/lib/tests/elementService.comprehensive.test.d.ts.map +1 -0
  246. package/lib/tests/elementService.comprehensive.test.js +846 -0
  247. package/lib/tests/elementService.test.d.ts +6 -0
  248. package/lib/tests/elementService.test.d.ts.map +1 -0
  249. package/lib/tests/elementService.test.js +350 -0
  250. package/lib/tests/enhancedCellService.test.d.ts +2 -0
  251. package/lib/tests/enhancedCellService.test.d.ts.map +1 -0
  252. package/lib/tests/enhancedCellService.test.js +152 -0
  253. package/lib/tests/enhancedCubeService.test.d.ts +2 -0
  254. package/lib/tests/enhancedCubeService.test.d.ts.map +1 -0
  255. package/lib/tests/enhancedCubeService.test.js +246 -0
  256. package/lib/tests/enhancedElementService.test.d.ts +2 -0
  257. package/lib/tests/enhancedElementService.test.d.ts.map +1 -0
  258. package/lib/tests/enhancedElementService.test.js +199 -0
  259. package/lib/tests/enhancedViewService.test.d.ts +2 -0
  260. package/lib/tests/enhancedViewService.test.d.ts.map +1 -0
  261. package/lib/tests/enhancedViewService.test.js +260 -0
  262. package/lib/tests/errorHandling.test.d.ts +6 -0
  263. package/lib/tests/errorHandling.test.d.ts.map +1 -0
  264. package/lib/tests/errorHandling.test.js +227 -0
  265. package/lib/tests/exceptions.test.d.ts +7 -0
  266. package/lib/tests/exceptions.test.d.ts.map +1 -0
  267. package/lib/tests/exceptions.test.js +257 -0
  268. package/lib/tests/hierarchyService.test.d.ts +6 -0
  269. package/lib/tests/hierarchyService.test.d.ts.map +1 -0
  270. package/lib/tests/hierarchyService.test.js +294 -0
  271. package/lib/tests/index.test.d.ts +6 -0
  272. package/lib/tests/index.test.d.ts.map +1 -0
  273. package/lib/tests/index.test.js +346 -0
  274. package/lib/tests/integration.test.d.ts +6 -0
  275. package/lib/tests/integration.test.d.ts.map +1 -0
  276. package/lib/tests/integration.test.js +302 -0
  277. package/lib/tests/integrationTests.test.d.ts +2 -0
  278. package/lib/tests/integrationTests.test.d.ts.map +1 -0
  279. package/lib/tests/integrationTests.test.js +252 -0
  280. package/lib/tests/mdx.advanced.test.d.ts +6 -0
  281. package/lib/tests/mdx.advanced.test.d.ts.map +1 -0
  282. package/lib/tests/mdx.advanced.test.js +437 -0
  283. package/lib/tests/objects.improved.test.d.ts +7 -0
  284. package/lib/tests/objects.improved.test.d.ts.map +1 -0
  285. package/lib/tests/objects.improved.test.js +302 -0
  286. package/lib/tests/performance.test.d.ts +6 -0
  287. package/lib/tests/performance.test.d.ts.map +1 -0
  288. package/lib/tests/performance.test.js +264 -0
  289. package/lib/tests/processService.comprehensive.test.d.ts +7 -0
  290. package/lib/tests/processService.comprehensive.test.d.ts.map +1 -0
  291. package/lib/tests/processService.comprehensive.test.js +656 -0
  292. package/lib/tests/processService.test.d.ts +6 -0
  293. package/lib/tests/processService.test.d.ts.map +1 -0
  294. package/lib/tests/processService.test.js +322 -0
  295. package/lib/tests/restService.test.d.ts +6 -0
  296. package/lib/tests/restService.test.d.ts.map +1 -0
  297. package/lib/tests/restService.test.js +177 -0
  298. package/lib/tests/security.advanced.test.d.ts +6 -0
  299. package/lib/tests/security.advanced.test.d.ts.map +1 -0
  300. package/lib/tests/security.advanced.test.js +407 -0
  301. package/lib/tests/security.test.d.ts +6 -0
  302. package/lib/tests/security.test.d.ts.map +1 -0
  303. package/lib/tests/security.test.js +204 -0
  304. package/lib/tests/securityService.comprehensive.test.d.ts +7 -0
  305. package/lib/tests/securityService.comprehensive.test.d.ts.map +1 -0
  306. package/lib/tests/securityService.comprehensive.test.js +457 -0
  307. package/lib/tests/setup.d.ts +4 -0
  308. package/lib/tests/setup.d.ts.map +1 -0
  309. package/lib/tests/setup.js +40 -0
  310. package/lib/tests/simpleCoverage.test.d.ts +6 -0
  311. package/lib/tests/simpleCoverage.test.d.ts.map +1 -0
  312. package/lib/tests/simpleCoverage.test.js +236 -0
  313. package/lib/tests/stress.performance.test.d.ts +6 -0
  314. package/lib/tests/stress.performance.test.d.ts.map +1 -0
  315. package/lib/tests/stress.performance.test.js +423 -0
  316. package/lib/tests/subsetService.test.d.ts +6 -0
  317. package/lib/tests/subsetService.test.d.ts.map +1 -0
  318. package/lib/tests/subsetService.test.js +271 -0
  319. package/lib/tests/testConfig.d.ts +18 -0
  320. package/lib/tests/testConfig.d.ts.map +1 -0
  321. package/lib/tests/testConfig.js +38 -0
  322. package/lib/tests/testUtils.d.ts +9 -0
  323. package/lib/tests/testUtils.d.ts.map +1 -0
  324. package/lib/tests/testUtils.js +100 -0
  325. package/lib/tests/tm1Service.test.d.ts +7 -0
  326. package/lib/tests/tm1Service.test.d.ts.map +1 -0
  327. package/lib/tests/tm1Service.test.js +290 -0
  328. package/lib/tests/viewService.test.d.ts +6 -0
  329. package/lib/tests/viewService.test.d.ts.map +1 -0
  330. package/lib/tests/viewService.test.js +240 -0
  331. package/lib/utils/Utils.d.ts +90 -0
  332. package/lib/utils/Utils.d.ts.map +1 -0
  333. package/lib/utils/Utils.js +379 -0
  334. package/package.json +81 -0
  335. package/run-all-tests.js +296 -0
  336. package/src/exceptions/TM1Exception.ts +38 -0
  337. package/src/exceptions/TM1RestException.ts +17 -0
  338. package/src/exceptions/TM1TimeoutException.ts +15 -0
  339. package/src/index.ts +94 -0
  340. package/src/objects/Annotation.ts +194 -0
  341. package/src/objects/Application.ts +146 -0
  342. package/src/objects/Axis.ts +149 -0
  343. package/src/objects/Chore.ts +174 -0
  344. package/src/objects/ChoreFrequency.ts +83 -0
  345. package/src/objects/ChoreStartTime.ts +111 -0
  346. package/src/objects/ChoreTask.ts +92 -0
  347. package/src/objects/Cube.ts +125 -0
  348. package/src/objects/Dimension.ts +107 -0
  349. package/src/objects/Element.ts +153 -0
  350. package/src/objects/ElementAttribute.ts +115 -0
  351. package/src/objects/Git.ts +86 -0
  352. package/src/objects/GitCommit.ts +31 -0
  353. package/src/objects/GitPlan.ts +121 -0
  354. package/src/objects/GitRemote.ts +31 -0
  355. package/src/objects/Hierarchy.ts +229 -0
  356. package/src/objects/MDXView.ts +91 -0
  357. package/src/objects/NativeView.ts +268 -0
  358. package/src/objects/Process.ts +320 -0
  359. package/src/objects/ProcessDebugBreakpoint.ts +239 -0
  360. package/src/objects/ProcessParameter.ts +76 -0
  361. package/src/objects/ProcessVariable.ts +89 -0
  362. package/src/objects/Rules.ts +117 -0
  363. package/src/objects/Sandbox.ts +90 -0
  364. package/src/objects/Server.ts +45 -0
  365. package/src/objects/Subset.ts +323 -0
  366. package/src/objects/TM1Object.ts +17 -0
  367. package/src/objects/TM1Project.ts +587 -0
  368. package/src/objects/User.ts +198 -0
  369. package/src/objects/View.ts +43 -0
  370. package/src/objects/index.ts +36 -0
  371. package/src/services/AnnotationService.ts +107 -0
  372. package/src/services/ApplicationService.ts +279 -0
  373. package/src/services/AuditLogService.ts +172 -0
  374. package/src/services/CellService.ts +814 -0
  375. package/src/services/ChoreService.ts +219 -0
  376. package/src/services/ConfigurationService.ts +69 -0
  377. package/src/services/CubeService.ts +338 -0
  378. package/src/services/DimensionService.ts +168 -0
  379. package/src/services/ElementService.ts +966 -0
  380. package/src/services/FileService.ts +67 -0
  381. package/src/services/GitService.ts +324 -0
  382. package/src/services/HierarchyService.ts +284 -0
  383. package/src/services/JobService.ts +59 -0
  384. package/src/services/LoggerService.ts +118 -0
  385. package/src/services/ManageService.ts +322 -0
  386. package/src/services/MessageLogService.ts +211 -0
  387. package/src/services/MonitoringService.ts +105 -0
  388. package/src/services/ObjectService.ts +21 -0
  389. package/src/services/PowerBiService.ts +85 -0
  390. package/src/services/ProcessService.ts +589 -0
  391. package/src/services/RestService.ts +224 -0
  392. package/src/services/SandboxService.ts +217 -0
  393. package/src/services/SecurityService.ts +284 -0
  394. package/src/services/ServerService.ts +313 -0
  395. package/src/services/SessionService.ts +81 -0
  396. package/src/services/SubsetService.ts +52 -0
  397. package/src/services/TM1Service.ts +133 -0
  398. package/src/services/ThreadService.ts +83 -0
  399. package/src/services/TransactionLogService.ts +148 -0
  400. package/src/services/UserService.ts +77 -0
  401. package/src/services/ViewService.ts +398 -0
  402. package/src/services/index.ts +28 -0
  403. package/src/tests/100PercentParityCheck.test.ts +166 -0
  404. package/src/tests/basic.test.ts +59 -0
  405. package/src/tests/cellService.test.ts +405 -0
  406. package/src/tests/ciSetup.ts +26 -0
  407. package/src/tests/comprehensive.service.test.ts +653 -0
  408. package/src/tests/config.ini.template +23 -0
  409. package/src/tests/connection.test.ts +90 -0
  410. package/src/tests/cubeService.test.ts +458 -0
  411. package/src/tests/dimensionService.comprehensive.test.ts +786 -0
  412. package/src/tests/dimensionService.test.ts +373 -0
  413. package/src/tests/edgeCases.test.ts +358 -0
  414. package/src/tests/elementService.comprehensive.test.ts +1190 -0
  415. package/src/tests/elementService.test.ts +472 -0
  416. package/src/tests/enhancedCellService.test.ts +237 -0
  417. package/src/tests/enhancedCubeService.test.ts +384 -0
  418. package/src/tests/enhancedElementService.test.ts +301 -0
  419. package/src/tests/enhancedViewService.test.ts +373 -0
  420. package/src/tests/errorHandling.test.ts +264 -0
  421. package/src/tests/exceptions.test.ts +313 -0
  422. package/src/tests/hierarchyService.test.ts +386 -0
  423. package/src/tests/index.test.ts +376 -0
  424. package/src/tests/integration.test.ts +333 -0
  425. package/src/tests/integrationTests.test.ts +302 -0
  426. package/src/tests/mdx.advanced.test.ts +513 -0
  427. package/src/tests/objects.improved.test.ts +385 -0
  428. package/src/tests/performance.test.ts +314 -0
  429. package/src/tests/processService.comprehensive.test.ts +933 -0
  430. package/src/tests/processService.test.ts +409 -0
  431. package/src/tests/restService.test.ts +218 -0
  432. package/src/tests/security.advanced.test.ts +464 -0
  433. package/src/tests/security.test.ts +233 -0
  434. package/src/tests/securityService.comprehensive.test.ts +582 -0
  435. package/src/tests/setup.ts +42 -0
  436. package/src/tests/simpleCoverage.test.ts +287 -0
  437. package/src/tests/stress.performance.test.ts +531 -0
  438. package/src/tests/subsetService.test.ts +350 -0
  439. package/src/tests/testConfig.ts +53 -0
  440. package/src/tests/testUtils.ts +94 -0
  441. package/src/tests/tm1Service.test.ts +361 -0
  442. package/src/tests/viewService.test.ts +324 -0
  443. package/src/utils/Utils.ts +395 -0
  444. package/tests/README.md +57 -0
  445. package/tests/connection/test-connection.ts +86 -0
  446. package/tests/edge-cases/edge-cases-test.ts +244 -0
  447. package/tests/integration/working-test.ts +193 -0
  448. package/tests/performance/performance-test.ts +133 -0
  449. package/tests/run-all-tests.sh +106 -0
  450. package/tests/security/security-test.ts +103 -0
  451. package/tsconfig.json +20 -0
@@ -0,0 +1,814 @@
1
+ /**
2
+ * CellService implementation for TM1 cube data operations
3
+ * Handles reading, writing, and manipulation of cube cell data
4
+ */
5
+
6
+ import { RestService } from './RestService';
7
+
8
+ export interface CellsetDict {
9
+ [coordinates: string]: any;
10
+ }
11
+
12
+ export interface WriteOptions {
13
+ increment?: boolean;
14
+ sandbox_name?: string;
15
+ use_ti?: boolean;
16
+ use_blob?: boolean;
17
+ precision?: number;
18
+ skip_non_updateable?: boolean;
19
+ measure_dimension_elements?: { [key: string]: any };
20
+ allow_spread?: boolean;
21
+ deactivate_transaction_log?: boolean;
22
+ reactivate_transaction_log?: boolean;
23
+ use_changeset?: boolean;
24
+ }
25
+
26
+ export interface MDXViewOptions {
27
+ private?: boolean;
28
+ use_iterative_json?: boolean;
29
+ use_blob?: boolean;
30
+ element_unique_names?: boolean;
31
+ skip_zeros?: boolean;
32
+ skip_consolidated?: boolean;
33
+ skip_rule_derived?: boolean;
34
+ csv_dialect?: any;
35
+ sandbox_name?: string;
36
+ use_compact_json?: boolean;
37
+ mdx_headers?: boolean;
38
+ }
39
+
40
+ export class CellService {
41
+ private rest: RestService;
42
+
43
+ constructor(rest: RestService) {
44
+ this.rest = rest;
45
+ }
46
+
47
+ /**
48
+ * Read a single cell value from a cube
49
+ */
50
+ public async getValue(cubeName: string, coordinates: string[]): Promise<any> {
51
+ const url = `/Cubes('${cubeName}')/tm1.GetCellValue(coordinates=[${coordinates.map(c => `'${c}'`).join(',')}])`;
52
+ const response = await this.rest.get(url);
53
+ return response.data.value;
54
+ }
55
+
56
+ /**
57
+ * Write a single cell value to a cube
58
+ */
59
+ public async writeValue(cubeName: string, coordinates: string[], value: any): Promise<void> {
60
+ const url = `/Cubes('${cubeName}')/tm1.Update`;
61
+ const body = {
62
+ Cells: [{
63
+ Coordinates: coordinates.map(c => ({ Name: c })),
64
+ Value: value
65
+ }]
66
+ };
67
+ await this.rest.patch(url, body);
68
+ }
69
+
70
+ /**
71
+ * Read multiple cell values from a cube based on coordinate sets
72
+ */
73
+ public async getValues(
74
+ cubeName: string,
75
+ elementSets: string[][],
76
+ dimensions?: string[],
77
+ sandbox_name?: string
78
+ ): Promise<any[]> {
79
+ if (!elementSets || elementSets.length === 0) {
80
+ return [];
81
+ }
82
+
83
+ // Build coordinate tuples for bulk read
84
+ const coordinateTuples = elementSets.map(elements =>
85
+ elements.map(element => `'${element}'`).join(',')
86
+ );
87
+
88
+ let url = `/Cubes('${cubeName}')/tm1.GetCellValues(coordinates=[${coordinateTuples.join('],[')}])`;
89
+
90
+ if (sandbox_name) {
91
+ url += `?$sandbox=${sandbox_name}`;
92
+ }
93
+
94
+ const response = await this.rest.get(url);
95
+ return response.data.value || [];
96
+ }
97
+
98
+ /**
99
+ * Write multiple cell values using dictionary format
100
+ * {coordinate_string: value} format for bulk writes
101
+ */
102
+ public async write(
103
+ cubeName: string,
104
+ cellsetAsDict: CellsetDict,
105
+ dimensions?: string[],
106
+ options: WriteOptions = {}
107
+ ): Promise<void> {
108
+ const cells = Object.entries(cellsetAsDict).map(([coordinates, value]) => {
109
+ const elementArray = coordinates.split(',').map(s => s.trim());
110
+ return {
111
+ Coordinates: elementArray.map(element => ({ Name: element })),
112
+ Value: value
113
+ };
114
+ });
115
+
116
+ let url = `/Cubes('${cubeName}')/tm1.Update`;
117
+
118
+ if (options.sandbox_name) {
119
+ url += `?$sandbox=${options.sandbox_name}`;
120
+ }
121
+
122
+ const body = {
123
+ Cells: cells,
124
+ ...(options.increment && { Increment: true }),
125
+ ...(options.allow_spread && { AllowSpread: true })
126
+ };
127
+
128
+ await this.rest.patch(url, body);
129
+ }
130
+
131
+ /**
132
+ * Execute a view and return the data
133
+ */
134
+ public async executeView(
135
+ cubeName: string,
136
+ viewName: string,
137
+ options: MDXViewOptions = {}
138
+ ): Promise<any> {
139
+ let url = `/Cubes('${cubeName}')/Views('${viewName}')/tm1.Execute`;
140
+
141
+ const params = new URLSearchParams();
142
+ if (options.private !== undefined) params.append('$private', options.private.toString());
143
+ if (options.sandbox_name) params.append('$sandbox', options.sandbox_name);
144
+ if (options.element_unique_names !== undefined) params.append('$element_unique_names', options.element_unique_names.toString());
145
+ if (options.skip_zeros !== undefined) params.append('$skip_zeros', options.skip_zeros.toString());
146
+ if (options.skip_consolidated !== undefined) params.append('$skip_consolidated', options.skip_consolidated.toString());
147
+ if (options.skip_rule_derived !== undefined) params.append('$skip_rule_derived', options.skip_rule_derived.toString());
148
+
149
+ if (params.toString()) {
150
+ url += `?${params.toString()}`;
151
+ }
152
+
153
+ const response = await this.rest.post(url);
154
+ return response.data;
155
+ }
156
+
157
+ /**
158
+ * Execute MDX and return structured data (DataFrame-like)
159
+ */
160
+ public async executeMdxDataFrame(
161
+ mdx: string,
162
+ options: MDXViewOptions = {}
163
+ ): Promise<any> {
164
+ let url = '/ExecuteMDXDataFrameShaped';
165
+
166
+ const params = new URLSearchParams();
167
+ if (options.sandbox_name) params.append('$sandbox', options.sandbox_name);
168
+ if (options.element_unique_names !== undefined) params.append('$element_unique_names', options.element_unique_names.toString());
169
+ if (options.skip_zeros !== undefined) params.append('$skip_zeros', options.skip_zeros.toString());
170
+ if (options.use_compact_json !== undefined) params.append('$use_compact_json', options.use_compact_json.toString());
171
+
172
+ if (params.toString()) {
173
+ url += `?${params.toString()}`;
174
+ }
175
+
176
+ const body = {
177
+ MDX: mdx,
178
+ ...(options.mdx_headers !== undefined && { MDXHeaders: options.mdx_headers })
179
+ };
180
+
181
+ const response = await this.rest.post(url, body);
182
+ return response.data;
183
+ }
184
+
185
+ /**
186
+ * Execute MDX and return CSV data
187
+ */
188
+ public async executeMdxCsv(
189
+ mdx: string,
190
+ options: MDXViewOptions = {}
191
+ ): Promise<string> {
192
+ let url = '/ExecuteMDXCSV';
193
+
194
+ const params = new URLSearchParams();
195
+ if (options.sandbox_name) params.append('$sandbox', options.sandbox_name);
196
+ if (options.element_unique_names !== undefined) params.append('$element_unique_names', options.element_unique_names.toString());
197
+ if (options.skip_zeros !== undefined) params.append('$skip_zeros', options.skip_zeros.toString());
198
+
199
+ if (params.toString()) {
200
+ url += `?${params.toString()}`;
201
+ }
202
+
203
+ const body = { MDX: mdx };
204
+ const response = await this.rest.post(url, body);
205
+ return response.data;
206
+ }
207
+
208
+ /**
209
+ * Execute view and return CSV data
210
+ */
211
+ public async executeViewCsv(
212
+ cubeName: string,
213
+ viewName: string,
214
+ options: MDXViewOptions = {}
215
+ ): Promise<string> {
216
+ let url = `/Cubes('${cubeName}')/Views('${viewName}')/tm1.ExecuteCSV`;
217
+
218
+ const params = new URLSearchParams();
219
+ if (options.private !== undefined) params.append('$private', options.private.toString());
220
+ if (options.sandbox_name) params.append('$sandbox', options.sandbox_name);
221
+ if (options.element_unique_names !== undefined) params.append('$element_unique_names', options.element_unique_names.toString());
222
+ if (options.skip_zeros !== undefined) params.append('$skip_zeros', options.skip_zeros.toString());
223
+
224
+ if (params.toString()) {
225
+ url += `?${params.toString()}`;
226
+ }
227
+
228
+ const response = await this.rest.post(url);
229
+ return response.data;
230
+ }
231
+
232
+ /**
233
+ * Create a cellset for advanced operations
234
+ */
235
+ public async createCellset(mdx: string, sandbox_name?: string): Promise<string> {
236
+ let url = '/Cellsets';
237
+
238
+ if (sandbox_name) {
239
+ url += `?$sandbox=${sandbox_name}`;
240
+ }
241
+
242
+ const body = { MDX: mdx };
243
+ const response = await this.rest.post(url, body);
244
+
245
+ // Extract cellset ID from response location or data
246
+ if (response.headers?.location) {
247
+ const matches = response.headers.location.match(/Cellsets\('([^']+)'\)/);
248
+ return matches ? matches[1] : '';
249
+ }
250
+
251
+ return response.data?.ID || '';
252
+ }
253
+
254
+ /**
255
+ * Delete a cellset
256
+ */
257
+ public async deleteCellset(cellsetId: string, sandbox_name?: string): Promise<void> {
258
+ let url = `/Cellsets('${cellsetId}')`;
259
+
260
+ if (sandbox_name) {
261
+ url += `?$sandbox=${sandbox_name}`;
262
+ }
263
+
264
+ await this.rest.delete(url);
265
+ }
266
+
267
+ /**
268
+ * Extract data from cellset
269
+ */
270
+ public async extractCellset(
271
+ cellsetId: string,
272
+ expand_axes: boolean = true,
273
+ sandbox_name?: string
274
+ ): Promise<any> {
275
+ let url = `/Cellsets('${cellsetId}')`;
276
+
277
+ const params = new URLSearchParams();
278
+ if (expand_axes) params.append('$expand', 'Axes,Cells');
279
+ if (sandbox_name) params.append('$sandbox', sandbox_name);
280
+
281
+ if (params.toString()) {
282
+ url += `?${params.toString()}`;
283
+ }
284
+
285
+ const response = await this.rest.get(url);
286
+ return response.data;
287
+ }
288
+
289
+ /**
290
+ * Clear cube data with MDX filter
291
+ */
292
+ public async clearWithMdx(cubeName: string, mdx: string, sandbox_name?: string): Promise<void> {
293
+ let url = `/Cubes('${cubeName}')/tm1.Clear`;
294
+
295
+ if (sandbox_name) {
296
+ url += `?$sandbox=${sandbox_name}`;
297
+ }
298
+
299
+ const body = { MDX: mdx };
300
+ await this.rest.post(url, body);
301
+ }
302
+
303
+ /**
304
+ * Trace cell calculation (show contributing factors)
305
+ */
306
+ public async traceCellCalculation(
307
+ cubeName: string,
308
+ coordinates: string[],
309
+ sandbox_name?: string
310
+ ): Promise<any> {
311
+ const coordinateString = coordinates.map(c => `'${c}'`).join(',');
312
+ let url = `/Cubes('${cubeName}')/tm1.TraceCellCalculation(coordinates=[${coordinateString}])`;
313
+
314
+ if (sandbox_name) {
315
+ url += `?$sandbox=${sandbox_name}`;
316
+ }
317
+
318
+ const response = await this.rest.get(url);
319
+ return response.data;
320
+ }
321
+
322
+ /**
323
+ * Trace cell feeders (show what feeds into a cell)
324
+ */
325
+ public async traceCellFeeders(
326
+ cubeName: string,
327
+ coordinates: string[],
328
+ sandbox_name?: string
329
+ ): Promise<any> {
330
+ const coordinateString = coordinates.map(c => `'${c}'`).join(',');
331
+ let url = `/Cubes('${cubeName}')/tm1.TraceCellFeeders(coordinates=[${coordinateString}])`;
332
+
333
+ if (sandbox_name) {
334
+ url += `?$sandbox=${sandbox_name}`;
335
+ }
336
+
337
+ const response = await this.rest.get(url);
338
+ return response.data;
339
+ }
340
+
341
+ /**
342
+ * Begin a changeset for grouped write operations
343
+ */
344
+ public async beginChangeset(): Promise<string> {
345
+ const url = '/BeginChangeset';
346
+ const response = await this.rest.post(url);
347
+ return response.data.ID || response.data.id || '';
348
+ }
349
+
350
+ /**
351
+ * End a changeset
352
+ */
353
+ public async endChangeset(changesetId: string): Promise<void> {
354
+ const url = `/EndChangeset('${changesetId}')`;
355
+ await this.rest.post(url);
356
+ }
357
+
358
+ /**
359
+ * Undo a changeset
360
+ */
361
+ public async undoChangeset(changesetId: string): Promise<void> {
362
+ const url = `/UndoChangeset('${changesetId}')`;
363
+ await this.rest.post(url);
364
+ }
365
+
366
+ /**
367
+ * Activate transaction log for a cube
368
+ */
369
+ public async activateTransactionlog(cubeName: string): Promise<void> {
370
+ const url = `/Cubes('${cubeName}')/tm1.ActivateTransactionLog`;
371
+ await this.rest.post(url);
372
+ }
373
+
374
+ /**
375
+ * Deactivate transaction log for a cube
376
+ */
377
+ public async deactivateTransactionlog(cubeName: string): Promise<void> {
378
+ const url = `/Cubes('${cubeName}')/tm1.DeactivateTransactionLog`;
379
+ await this.rest.post(url);
380
+ }
381
+
382
+ /**
383
+ * Write data through DataFrame format
384
+ */
385
+ public async writeDataframe(
386
+ cubeName: string,
387
+ dataFrame: any[][], // Array of arrays representing tabular data
388
+ dimensions: string[],
389
+ options: WriteOptions = {}
390
+ ): Promise<void> {
391
+ const cells = dataFrame.map(row => ({
392
+ Coordinates: row.slice(0, dimensions.length).map(coord => ({ Name: coord })),
393
+ Value: row[dimensions.length] // Last column is the value
394
+ }));
395
+
396
+ let url = `/Cubes('${cubeName}')/tm1.Update`;
397
+
398
+ if (options.sandbox_name) {
399
+ url += `?$sandbox=${options.sandbox_name}`;
400
+ }
401
+
402
+ const body = {
403
+ Cells: cells,
404
+ ...(options.increment && { Increment: true }),
405
+ ...(options.allow_spread && { AllowSpread: true })
406
+ };
407
+
408
+ await this.rest.patch(url, body);
409
+ }
410
+
411
+ /**
412
+ * Write data asynchronously
413
+ */
414
+ public async writeAsync(
415
+ cubeName: string,
416
+ cellsetAsDict: CellsetDict,
417
+ dimensions?: string[],
418
+ options: WriteOptions = {}
419
+ ): Promise<string> {
420
+ const cells = Object.entries(cellsetAsDict).map(([coordinates, value]) => {
421
+ const elementArray = coordinates.split(',').map(s => s.trim());
422
+ return {
423
+ Coordinates: elementArray.map(element => ({ Name: element })),
424
+ Value: value
425
+ };
426
+ });
427
+
428
+ let url = `/Cubes('${cubeName}')/tm1.UpdateAsync`;
429
+
430
+ if (options.sandbox_name) {
431
+ url += `?$sandbox=${options.sandbox_name}`;
432
+ }
433
+
434
+ const body = { Cells: cells };
435
+ const response = await this.rest.patch(url, body);
436
+
437
+ // Return async operation ID
438
+ return response.data.ID || response.headers['async-id'] || '';
439
+ }
440
+
441
+ /**
442
+ * Write through unbound process (TI-based writing)
443
+ */
444
+ public async writeThroughUnboundProcess(
445
+ cubeName: string,
446
+ cellsetAsDict: CellsetDict,
447
+ processName?: string,
448
+ options: WriteOptions = {}
449
+ ): Promise<any> {
450
+ // Create TI statements for bulk writing
451
+ let tiStatements = '';
452
+
453
+ for (const [coordinates, value] of Object.entries(cellsetAsDict)) {
454
+ const coords = coordinates.split(',').map(s => `'${s.trim()}'`).join(',');
455
+ tiStatements += `CubeDataSet('${cubeName}', ${coords}, ${value});\n`;
456
+ }
457
+
458
+ const tempProcessName = processName || `tm1npm_write_${Date.now()}`;
459
+
460
+ // Execute TI code directly
461
+ const url = "/ExecuteProcessWithReturn";
462
+ const body = {
463
+ Name: tempProcessName,
464
+ PrologProcedure: tiStatements,
465
+ ...(options.sandbox_name && { Sandbox: options.sandbox_name })
466
+ };
467
+
468
+ return await this.rest.post(url, body);
469
+ }
470
+
471
+ /**
472
+ * Write through blob upload (for large datasets)
473
+ */
474
+ public async writeThroughBlob(
475
+ cubeName: string,
476
+ csvData: string,
477
+ options: WriteOptions = {}
478
+ ): Promise<any> {
479
+ // First upload CSV data as blob
480
+ const blobUrl = '/Blobs';
481
+ const blobResponse = await this.rest.post(blobUrl, csvData, {
482
+ headers: { 'Content-Type': 'text/csv' }
483
+ });
484
+
485
+ const blobId = blobResponse.data.ID;
486
+
487
+ // Then execute cube load from blob
488
+ let url = `/Cubes('${cubeName}')/tm1.LoadFromBlob`;
489
+
490
+ if (options.sandbox_name) {
491
+ url += `?$sandbox=${options.sandbox_name}`;
492
+ }
493
+
494
+ const body = { BlobId: blobId };
495
+ return await this.rest.post(url, body);
496
+ }
497
+
498
+ /**
499
+ * Execute MDX and return element-value dictionary
500
+ */
501
+ public async executeMdxElementsValueDict(
502
+ mdx: string,
503
+ sandbox_name?: string
504
+ ): Promise<{ [element: string]: any }> {
505
+ let url = '/ExecuteMDXElementsValue';
506
+
507
+ if (sandbox_name) {
508
+ url += `?$sandbox=${sandbox_name}`;
509
+ }
510
+
511
+ const body = { MDX: mdx };
512
+ const response = await this.rest.post(url, body);
513
+
514
+ return response.data || {};
515
+ }
516
+
517
+ /**
518
+ * Clear data based on DataFrame coordinates
519
+ */
520
+ public async clearWithDataframe(
521
+ cubeName: string,
522
+ dataFrame: any[][],
523
+ dimensions: string[],
524
+ sandbox_name?: string
525
+ ): Promise<void> {
526
+ // Build MDX filter from DataFrame coordinates
527
+ const coordinates = dataFrame.map(row =>
528
+ row.slice(0, dimensions.length).map(coord => `'${coord}'`).join(',')
529
+ );
530
+
531
+ const mdxFilter = coordinates.map(coord => `(${coord})`).join(',');
532
+ const mdx = `{${mdxFilter}}`;
533
+
534
+ await this.clearWithMdx(cubeName, mdx, sandbox_name);
535
+ }
536
+
537
+ /**
538
+ * Execute proportional spread
539
+ */
540
+ public async relativeProportionalSpread(
541
+ cubeName: string,
542
+ targetCoordinates: string[],
543
+ value: number,
544
+ options: MDXViewOptions = {}
545
+ ): Promise<void> {
546
+ const coordinateString = targetCoordinates.map(c => `'${c}'`).join(',');
547
+ let url = `/Cubes('${cubeName}')/tm1.ProportionalSpread(coordinates=[${coordinateString}],value=${value})`;
548
+
549
+ if (options.sandbox_name) {
550
+ url += `?$sandbox=${options.sandbox_name}`;
551
+ }
552
+
553
+ await this.rest.post(url);
554
+ }
555
+
556
+ /**
557
+ * Execute clear spread
558
+ */
559
+ public async clearSpread(
560
+ cubeName: string,
561
+ targetCoordinates: string[],
562
+ options: MDXViewOptions = {}
563
+ ): Promise<void> {
564
+ const coordinateString = targetCoordinates.map(c => `'${c}'`).join(',');
565
+ let url = `/Cubes('${cubeName}')/tm1.ClearSpread(coordinates=[${coordinateString}])`;
566
+
567
+ if (options.sandbox_name) {
568
+ url += `?$sandbox=${options.sandbox_name}`;
569
+ }
570
+
571
+ await this.rest.post(url);
572
+ }
573
+
574
+ /**
575
+ * Check cell feeders
576
+ */
577
+ public async checkCellFeeders(
578
+ cubeName: string,
579
+ coordinates: string[],
580
+ sandbox_name?: string
581
+ ): Promise<boolean> {
582
+ const coordinateString = coordinates.map(c => `'${c}'`).join(',');
583
+ let url = `/Cubes('${cubeName}')/tm1.CheckCellFeeders(coordinates=[${coordinateString}])`;
584
+
585
+ if (sandbox_name) {
586
+ url += `?$sandbox=${sandbox_name}`;
587
+ }
588
+
589
+ const response = await this.rest.get(url);
590
+ return response.data.value === true;
591
+ }
592
+ /**
593
+ * Write multiple cell values to a cube (legacy method name for compatibility)
594
+ */
595
+ public async writeValues(cubeName: string, cellset: { [key: string]: any }): Promise<void> {
596
+ const cells = Object.entries(cellset).map(([key, value]) => {
597
+ const coordinates = key.split(':');
598
+ return {
599
+ Coordinates: coordinates.map(c => ({ Name: c })),
600
+ Value: value
601
+ };
602
+ });
603
+
604
+ const url = `/Cubes('${cubeName}')/tm1.Update`;
605
+ const body = { Cells: cells };
606
+ await this.rest.patch(url, body);
607
+ }
608
+
609
+ /**
610
+ * Execute an MDX query
611
+ */
612
+ public async executeMdx(mdx: string): Promise<any> {
613
+ const url = '/ExecuteMDX';
614
+ const body = { MDX: mdx };
615
+ const response = await this.rest.post(url, body);
616
+ return response.data;
617
+ }
618
+
619
+ /**
620
+ * Clear all data in a cube
621
+ */
622
+ public async clearCube(cubeName: string): Promise<void> {
623
+ const url = `/Cubes('${cubeName}')/tm1.Clear`;
624
+ await this.rest.post(url);
625
+ }
626
+
627
+ /**
628
+ * Execute MDX query and return data in DataFrame shape
629
+ */
630
+ public async executeMdxDataFrameShaped(mdx: string): Promise<any> {
631
+ const url = '/ExecuteMDXDataFrameShaped';
632
+ const body = { MDX: mdx };
633
+ const response = await this.rest.post(url, body);
634
+ return response.data;
635
+ }
636
+
637
+ /**
638
+ * Execute view and return data in DataFrame shape
639
+ */
640
+ public async executeViewDataFrameShaped(
641
+ cubeName: string,
642
+ viewName: string,
643
+ isPrivate?: boolean,
644
+ useIterativeJson?: boolean,
645
+ useBlob?: boolean
646
+ ): Promise<any> {
647
+ let url = `/Cubes('${cubeName}')/Views('${viewName}')/tm1.ExecuteDataFrameShaped`;
648
+
649
+ const params = [];
650
+ if (isPrivate !== undefined) params.push(`$private=${isPrivate}`);
651
+ if (useIterativeJson !== undefined) params.push(`$iterativeJson=${useIterativeJson}`);
652
+ if (useBlob !== undefined) params.push(`$blob=${useBlob}`);
653
+
654
+ if (params.length > 0) {
655
+ url += `?${params.join('&')}`;
656
+ }
657
+
658
+ const response = await this.rest.post(url);
659
+ return response.data;
660
+ }
661
+
662
+ // ===== NEW ASYNC FUNCTIONS FOR 100% TM1PY PARITY =====
663
+
664
+ /**
665
+ * Write DataFrame data asynchronously for better performance
666
+ */
667
+ public async writeDataframeAsync(
668
+ cubeName: string,
669
+ dataFrame: any[][],
670
+ dimensions: string[],
671
+ options: WriteOptions = {}
672
+ ): Promise<string> {
673
+ /** Write DataFrame data asynchronously and return execution ID
674
+ *
675
+ * :param cubeName: name of the cube
676
+ * :param dataFrame: 2D array with data to write
677
+ * :param dimensions: array of dimension names
678
+ * :param options: write options including sandbox_name
679
+ * :return: execution ID for tracking async operation
680
+ */
681
+
682
+ // Convert DataFrame to cellset format
683
+ const headers = dataFrame[0];
684
+ const cellsetAsDict: CellsetDict = {};
685
+
686
+ for (let i = 1; i < dataFrame.length; i++) {
687
+ const row = dataFrame[i];
688
+ const coordinates: string[] = [];
689
+ let value: any = null;
690
+
691
+ for (let j = 0; j < dimensions.length; j++) {
692
+ coordinates.push(String(row[j]));
693
+ }
694
+
695
+ // Last column is typically the value
696
+ value = row[row.length - 1];
697
+
698
+ const coordinateKey = coordinates.join(',');
699
+ cellsetAsDict[coordinateKey] = value;
700
+ }
701
+
702
+ // Use async write through process
703
+ const processName = `AsyncWrite_${Date.now()}`;
704
+ const tiCode = `
705
+ # Async DataFrame write
706
+ ${Object.entries(cellsetAsDict).map(([coords, value]) => {
707
+ const coordArray = coords.split(',').map(c => `'${c}'`).join(',');
708
+ return `CellPutN(${value}, '${cubeName}', ${coordArray});`;
709
+ }).join('\n')}
710
+ `;
711
+
712
+ const processBody = {
713
+ Name: processName,
714
+ PrologProcedure: tiCode,
715
+ HasSecurityAccess: false
716
+ };
717
+
718
+ // Create and execute process asynchronously
719
+ await this.rest.post('/Processes', processBody);
720
+
721
+ const executeUrl = `/Processes('${processName}')/tm1.ExecuteProcessAsync`;
722
+ const execResponse = await this.rest.post(executeUrl, {
723
+ sandbox_name: options.sandbox_name
724
+ });
725
+
726
+ // Return execution ID for polling
727
+ return execResponse.data.ID || processName;
728
+ }
729
+
730
+ /**
731
+ * Execute MDX query asynchronously
732
+ */
733
+ public async executeMdxAsync(mdx: string, sandbox_name?: string): Promise<string> {
734
+ /** Execute MDX query asynchronously and return execution ID
735
+ *
736
+ * :param mdx: MDX query to execute
737
+ * :param sandbox_name: optional sandbox name
738
+ * :return: execution ID for tracking async operation
739
+ */
740
+ const url = '/ExecuteMDXAsync';
741
+ const body = {
742
+ MDX: mdx,
743
+ sandbox_name: sandbox_name
744
+ };
745
+
746
+ const response = await this.rest.post(url, body);
747
+ return response.data.ID || response.data.ExecutionId || `async_${Date.now()}`;
748
+ }
749
+
750
+ /**
751
+ * Poll execution status for async operations
752
+ */
753
+ public async pollExecuteWithReturn(executionId: string): Promise<any> {
754
+ /** Poll the status of an async execution and return results when complete
755
+ *
756
+ * :param executionId: ID of the async execution to poll
757
+ * :return: execution results when complete
758
+ */
759
+ const maxPollingAttempts = 100;
760
+ const pollingInterval = 1000; // 1 second
761
+
762
+ for (let attempt = 0; attempt < maxPollingAttempts; attempt++) {
763
+ try {
764
+ // Check if it's a process execution
765
+ const statusUrl = `/Processes('${executionId}')/tm1.ExecutionStatus`;
766
+ const statusResponse = await this.rest.get(statusUrl);
767
+
768
+ const status = statusResponse.data.Status;
769
+
770
+ if (status === 'CompletedSuccessfully') {
771
+ // Get results
772
+ const resultUrl = `/Processes('${executionId}')/tm1.ExecutionResult`;
773
+ const resultResponse = await this.rest.get(resultUrl);
774
+
775
+ // Clean up process
776
+ await this.rest.delete(`/Processes('${executionId}')`);
777
+
778
+ return resultResponse.data;
779
+ } else if (status === 'Failed' || status === 'CompletedWithError') {
780
+ // Get error information
781
+ const errorUrl = `/Processes('${executionId}')/tm1.ExecutionError`;
782
+ const errorResponse = await this.rest.get(errorUrl);
783
+
784
+ // Clean up process
785
+ await this.rest.delete(`/Processes('${executionId}')`);
786
+
787
+ throw new Error(`Async execution failed: ${errorResponse.data.Message || 'Unknown error'}`);
788
+ } else if (status === 'Running' || status === 'Queued') {
789
+ // Still running, wait and poll again
790
+ await new Promise(resolve => setTimeout(resolve, pollingInterval));
791
+ continue;
792
+ }
793
+ } catch (error) {
794
+ // Try alternative polling for MDX executions
795
+ try {
796
+ const mdxStatusUrl = `/MDXExecutions('${executionId}')`;
797
+ const mdxStatusResponse = await this.rest.get(mdxStatusUrl);
798
+
799
+ if (mdxStatusResponse.data.Status === 'Completed') {
800
+ return mdxStatusResponse.data.Result;
801
+ } else if (mdxStatusResponse.data.Status === 'Failed') {
802
+ throw new Error(`MDX execution failed: ${mdxStatusResponse.data.Error || 'Unknown error'}`);
803
+ }
804
+ } catch (mdxError) {
805
+ // If both polling methods fail, wait and try again
806
+ await new Promise(resolve => setTimeout(resolve, pollingInterval));
807
+ continue;
808
+ }
809
+ }
810
+ }
811
+
812
+ throw new Error(`Async execution ${executionId} timed out after ${maxPollingAttempts} polling attempts`);
813
+ }
814
+ }