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,257 @@
1
+ "use strict";
2
+ /**
3
+ * Exception Classes Tests
4
+ * Comprehensive test suite for TM1 exception classes
5
+ * Target: Improve coverage from 0% to 100% for TM1RestException and TM1TimeoutException
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ const TM1Exception_1 = require("../exceptions/TM1Exception");
9
+ const TM1RestException_1 = require("../exceptions/TM1RestException");
10
+ const TM1TimeoutException_1 = require("../exceptions/TM1TimeoutException");
11
+ describe('TM1 Exception Classes', () => {
12
+ describe('TM1RestException', () => {
13
+ test('should create TM1RestException with message only', () => {
14
+ const message = 'REST API error occurred';
15
+ const exception = new TM1RestException_1.TM1RestException(message);
16
+ expect(exception).toBeInstanceOf(Error);
17
+ expect(exception).toBeInstanceOf(TM1Exception_1.TM1Exception);
18
+ expect(exception).toBeInstanceOf(TM1RestException_1.TM1RestException);
19
+ expect(exception.message).toBe(message);
20
+ expect(exception.name).toBe('TM1RestException');
21
+ expect(exception.status).toBeUndefined();
22
+ expect(exception.response).toBeUndefined();
23
+ });
24
+ test('should create TM1RestException with message and status', () => {
25
+ const message = 'Unauthorized access';
26
+ const status = 401;
27
+ const exception = new TM1RestException_1.TM1RestException(message, status);
28
+ expect(exception.message).toBe(message);
29
+ expect(exception.name).toBe('TM1RestException');
30
+ expect(exception.status).toBe(status);
31
+ expect(exception.response).toBeUndefined();
32
+ });
33
+ test('should create TM1RestException with message, status, and response', () => {
34
+ const message = 'Bad Request';
35
+ const status = 400;
36
+ const response = {
37
+ error: 'Invalid parameter',
38
+ details: 'Parameter X is required'
39
+ };
40
+ const exception = new TM1RestException_1.TM1RestException(message, status, response);
41
+ expect(exception.message).toBe(message);
42
+ expect(exception.name).toBe('TM1RestException');
43
+ expect(exception.status).toBe(status);
44
+ expect(exception.response).toEqual(response);
45
+ });
46
+ test('should handle status 0 (network error)', () => {
47
+ const message = 'Network connection failed';
48
+ const status = 0;
49
+ const exception = new TM1RestException_1.TM1RestException(message, status);
50
+ expect(exception.status).toBe(0);
51
+ expect(exception.message).toBe(message);
52
+ });
53
+ test('should handle various HTTP status codes', () => {
54
+ const statusCodes = [200, 404, 500, 502, 503];
55
+ statusCodes.forEach(status => {
56
+ const exception = new TM1RestException_1.TM1RestException(`HTTP ${status} error`, status);
57
+ expect(exception.status).toBe(status);
58
+ expect(exception.name).toBe('TM1RestException');
59
+ });
60
+ });
61
+ test('should handle complex response objects', () => {
62
+ const complexResponse = {
63
+ error: {
64
+ code: 'INVALID_OPERATION',
65
+ message: 'Operation not supported',
66
+ details: {
67
+ operation: 'deleteElement',
68
+ reason: 'Element is in use'
69
+ }
70
+ },
71
+ timestamp: '2025-01-15T10:30:00Z',
72
+ requestId: 'req-12345'
73
+ };
74
+ const exception = new TM1RestException_1.TM1RestException('Complex error', 422, complexResponse);
75
+ expect(exception.response).toEqual(complexResponse);
76
+ expect(exception.response.error.code).toBe('INVALID_OPERATION');
77
+ });
78
+ test('should be throwable and catchable', () => {
79
+ const message = 'Test exception';
80
+ const status = 500;
81
+ expect(() => {
82
+ throw new TM1RestException_1.TM1RestException(message, status);
83
+ }).toThrow(TM1RestException_1.TM1RestException);
84
+ try {
85
+ throw new TM1RestException_1.TM1RestException(message, status);
86
+ }
87
+ catch (error) {
88
+ expect(error).toBeInstanceOf(TM1RestException_1.TM1RestException);
89
+ expect(error.status).toBe(status);
90
+ }
91
+ });
92
+ test('should inherit Error properties correctly', () => {
93
+ const exception = new TM1RestException_1.TM1RestException('Test error', 500);
94
+ expect(exception.stack).toBeDefined();
95
+ expect(exception.toString()).toContain('TM1RestException');
96
+ expect(exception.toString()).toContain('Test error');
97
+ });
98
+ });
99
+ describe('TM1TimeoutException', () => {
100
+ test('should create TM1TimeoutException with message only', () => {
101
+ const message = 'Operation timed out';
102
+ const exception = new TM1TimeoutException_1.TM1TimeoutException(message);
103
+ expect(exception).toBeInstanceOf(Error);
104
+ expect(exception).toBeInstanceOf(TM1Exception_1.TM1Exception);
105
+ expect(exception).toBeInstanceOf(TM1TimeoutException_1.TM1TimeoutException);
106
+ expect(exception.message).toBe(message);
107
+ expect(exception.name).toBe('TM1TimeoutException');
108
+ expect(exception.timeout).toBe(0); // Default timeout value
109
+ });
110
+ test('should create TM1TimeoutException with message and timeout', () => {
111
+ const message = 'Request timed out after 30 seconds';
112
+ const timeout = 30000; // 30 seconds in ms
113
+ const exception = new TM1TimeoutException_1.TM1TimeoutException(message, timeout);
114
+ expect(exception.message).toBe(message);
115
+ expect(exception.name).toBe('TM1TimeoutException');
116
+ expect(exception.timeout).toBe(timeout);
117
+ });
118
+ test('should handle zero timeout value', () => {
119
+ const message = 'Immediate timeout';
120
+ const timeout = 0;
121
+ const exception = new TM1TimeoutException_1.TM1TimeoutException(message, timeout);
122
+ expect(exception.timeout).toBe(0);
123
+ expect(exception.message).toBe(message);
124
+ });
125
+ test('should handle large timeout values', () => {
126
+ const message = 'Long operation timeout';
127
+ const timeout = 3600000; // 1 hour in ms
128
+ const exception = new TM1TimeoutException_1.TM1TimeoutException(message, timeout);
129
+ expect(exception.timeout).toBe(timeout);
130
+ expect(exception.message).toBe(message);
131
+ });
132
+ test('should handle negative timeout values', () => {
133
+ const message = 'Invalid timeout';
134
+ const timeout = -1000;
135
+ const exception = new TM1TimeoutException_1.TM1TimeoutException(message, timeout);
136
+ expect(exception.timeout).toBe(timeout); // Should accept negative values
137
+ expect(exception.message).toBe(message);
138
+ });
139
+ test('should default to 0 when no timeout provided', () => {
140
+ const exception = new TM1TimeoutException_1.TM1TimeoutException('Default timeout test');
141
+ expect(exception.timeout).toBe(0);
142
+ });
143
+ test('should be throwable and catchable', () => {
144
+ const message = 'Timeout test';
145
+ const timeout = 5000;
146
+ expect(() => {
147
+ throw new TM1TimeoutException_1.TM1TimeoutException(message, timeout);
148
+ }).toThrow(TM1TimeoutException_1.TM1TimeoutException);
149
+ try {
150
+ throw new TM1TimeoutException_1.TM1TimeoutException(message, timeout);
151
+ }
152
+ catch (error) {
153
+ expect(error).toBeInstanceOf(TM1TimeoutException_1.TM1TimeoutException);
154
+ expect(error.timeout).toBe(timeout);
155
+ }
156
+ });
157
+ test('should inherit Error properties correctly', () => {
158
+ const exception = new TM1TimeoutException_1.TM1TimeoutException('Test timeout', 1000);
159
+ expect(exception.stack).toBeDefined();
160
+ expect(exception.toString()).toContain('TM1TimeoutException');
161
+ expect(exception.toString()).toContain('Test timeout');
162
+ });
163
+ test('should handle various timeout scenarios', () => {
164
+ const scenarios = [
165
+ { message: 'Connection timeout', timeout: 5000 },
166
+ { message: 'Read timeout', timeout: 30000 },
167
+ { message: 'Write timeout', timeout: 15000 },
168
+ { message: 'Process timeout', timeout: 300000 }
169
+ ];
170
+ scenarios.forEach(({ message, timeout }) => {
171
+ const exception = new TM1TimeoutException_1.TM1TimeoutException(message, timeout);
172
+ expect(exception.timeout).toBe(timeout);
173
+ expect(exception.message).toBe(message);
174
+ expect(exception.name).toBe('TM1TimeoutException');
175
+ });
176
+ });
177
+ });
178
+ describe('Exception Inheritance and Polymorphism', () => {
179
+ test('should properly inherit from TM1Exception', () => {
180
+ const restException = new TM1RestException_1.TM1RestException('REST error', 500);
181
+ const timeoutException = new TM1TimeoutException_1.TM1TimeoutException('Timeout error', 5000);
182
+ expect(restException).toBeInstanceOf(TM1Exception_1.TM1Exception);
183
+ expect(timeoutException).toBeInstanceOf(TM1Exception_1.TM1Exception);
184
+ });
185
+ test('should properly inherit from Error', () => {
186
+ const restException = new TM1RestException_1.TM1RestException('REST error', 500);
187
+ const timeoutException = new TM1TimeoutException_1.TM1TimeoutException('Timeout error', 5000);
188
+ expect(restException).toBeInstanceOf(Error);
189
+ expect(timeoutException).toBeInstanceOf(Error);
190
+ });
191
+ test('should be distinguishable in catch blocks', () => {
192
+ const testCatch = (exception) => {
193
+ if (exception instanceof TM1RestException_1.TM1RestException) {
194
+ return 'REST';
195
+ }
196
+ else if (exception instanceof TM1TimeoutException_1.TM1TimeoutException) {
197
+ return 'TIMEOUT';
198
+ }
199
+ else if (exception instanceof TM1Exception_1.TM1Exception) {
200
+ return 'TM1';
201
+ }
202
+ else {
203
+ return 'OTHER';
204
+ }
205
+ };
206
+ expect(testCatch(new TM1RestException_1.TM1RestException('test', 500))).toBe('REST');
207
+ expect(testCatch(new TM1TimeoutException_1.TM1TimeoutException('test', 1000))).toBe('TIMEOUT');
208
+ });
209
+ test('should maintain proper prototype chain', () => {
210
+ const restException = new TM1RestException_1.TM1RestException('test', 500);
211
+ const timeoutException = new TM1TimeoutException_1.TM1TimeoutException('test', 1000);
212
+ expect(Object.getPrototypeOf(restException)).toBe(TM1RestException_1.TM1RestException.prototype);
213
+ expect(Object.getPrototypeOf(timeoutException)).toBe(TM1TimeoutException_1.TM1TimeoutException.prototype);
214
+ });
215
+ });
216
+ describe('Real-world Usage Scenarios', () => {
217
+ test('should handle typical REST API error scenarios', () => {
218
+ // 404 Not Found
219
+ const notFound = new TM1RestException_1.TM1RestException('Cube not found', 404, {
220
+ error: 'CUBE_NOT_FOUND',
221
+ cubeName: 'Sales'
222
+ });
223
+ expect(notFound.status).toBe(404);
224
+ expect(notFound.response.cubeName).toBe('Sales');
225
+ // 401 Unauthorized
226
+ const unauthorized = new TM1RestException_1.TM1RestException('Authentication failed', 401);
227
+ expect(unauthorized.status).toBe(401);
228
+ // 500 Internal Server Error
229
+ const serverError = new TM1RestException_1.TM1RestException('Internal server error', 500, {
230
+ error: 'INTERNAL_ERROR',
231
+ details: 'Database connection failed'
232
+ });
233
+ expect(serverError.status).toBe(500);
234
+ expect(serverError.response.details).toBe('Database connection failed');
235
+ });
236
+ test('should handle typical timeout scenarios', () => {
237
+ // Connection timeout
238
+ const connectionTimeout = new TM1TimeoutException_1.TM1TimeoutException('Connection timeout after 30 seconds', 30000);
239
+ expect(connectionTimeout.timeout).toBe(30000);
240
+ // Process execution timeout
241
+ const processTimeout = new TM1TimeoutException_1.TM1TimeoutException('Process execution exceeded maximum time', 600000 // 10 minutes
242
+ );
243
+ expect(processTimeout.timeout).toBe(600000);
244
+ // Query timeout
245
+ const queryTimeout = new TM1TimeoutException_1.TM1TimeoutException('MDX query timeout', 120000 // 2 minutes
246
+ );
247
+ expect(queryTimeout.timeout).toBe(120000);
248
+ });
249
+ test('should support error chaining and context', () => {
250
+ const originalError = new Error('Network failure');
251
+ const restException = new TM1RestException_1.TM1RestException('Failed to connect to TM1 server', 0, { originalError, timestamp: Date.now() });
252
+ expect(restException.response.originalError).toBe(originalError);
253
+ expect(restException.response.timestamp).toBeDefined();
254
+ });
255
+ });
256
+ });
257
+ //# sourceMappingURL=exceptions.test.js.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * HierarchyService Tests for tm1npm
3
+ * Comprehensive tests for TM1 Hierarchy operations with proper mocking
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=hierarchyService.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hierarchyService.test.d.ts","sourceRoot":"","sources":["../../src/tests/hierarchyService.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,294 @@
1
+ "use strict";
2
+ /**
3
+ * HierarchyService Tests for tm1npm
4
+ * Comprehensive tests for TM1 Hierarchy operations with proper mocking
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const HierarchyService_1 = require("../services/HierarchyService");
8
+ const Hierarchy_1 = require("../objects/Hierarchy");
9
+ const TM1Exception_1 = require("../exceptions/TM1Exception");
10
+ // Helper function to create mock AxiosResponse
11
+ const createMockResponse = (data, status = 200) => ({
12
+ data,
13
+ status,
14
+ statusText: status === 200 ? 'OK' : status === 201 ? 'Created' : status === 204 ? 'No Content' : 'Error',
15
+ headers: {},
16
+ config: {}
17
+ });
18
+ describe('HierarchyService Tests', () => {
19
+ let hierarchyService;
20
+ let mockRestService;
21
+ beforeEach(() => {
22
+ // Create comprehensive mock for RestService
23
+ mockRestService = {
24
+ get: jest.fn(),
25
+ post: jest.fn(),
26
+ patch: jest.fn(),
27
+ delete: jest.fn(),
28
+ put: jest.fn(),
29
+ config: {},
30
+ rest: {},
31
+ buildBaseUrl: jest.fn(),
32
+ extractErrorMessage: jest.fn()
33
+ };
34
+ hierarchyService = new HierarchyService_1.HierarchyService(mockRestService);
35
+ });
36
+ describe('Hierarchy Retrieval Operations', () => {
37
+ test('should get all hierarchy names for dimension', async () => {
38
+ mockRestService.get.mockResolvedValue(createMockResponse({
39
+ value: [
40
+ { Name: 'Hierarchy1' },
41
+ { Name: 'Hierarchy2' }
42
+ ]
43
+ }));
44
+ const hierarchyNames = await hierarchyService.getAllNames('TestDimension');
45
+ expect(Array.isArray(hierarchyNames)).toBe(true);
46
+ expect(hierarchyNames).toEqual(['Hierarchy1', 'Hierarchy2']);
47
+ console.log('✅ Hierarchy names retrieved successfully');
48
+ });
49
+ test('should get all hierarchies with full details', async () => {
50
+ mockRestService.get.mockResolvedValue(createMockResponse({
51
+ value: [
52
+ {
53
+ Name: 'MainHierarchy',
54
+ UniqueName: '[TestDimension].[MainHierarchy]',
55
+ Visible: true,
56
+ Elements: []
57
+ },
58
+ {
59
+ Name: 'AlternateHierarchy',
60
+ UniqueName: '[TestDimension].[AlternateHierarchy]',
61
+ Visible: false,
62
+ Elements: []
63
+ }
64
+ ]
65
+ }));
66
+ const hierarchies = await hierarchyService.getAll('TestDimension');
67
+ expect(Array.isArray(hierarchies)).toBe(true);
68
+ expect(hierarchies.length).toBe(2);
69
+ expect(hierarchies[0].name).toBe('MainHierarchy');
70
+ expect(hierarchies[1].name).toBe('AlternateHierarchy');
71
+ console.log('✅ All hierarchies retrieved successfully');
72
+ });
73
+ test('should get specific hierarchy by name', async () => {
74
+ mockRestService.get.mockResolvedValue(createMockResponse({
75
+ Name: 'SpecificHierarchy',
76
+ UniqueName: '[TestDimension].[SpecificHierarchy]',
77
+ Visible: true,
78
+ Elements: []
79
+ }));
80
+ const hierarchy = await hierarchyService.get('TestDimension', 'SpecificHierarchy');
81
+ expect(hierarchy).toBeDefined();
82
+ expect(hierarchy.name).toBe('SpecificHierarchy');
83
+ console.log('✅ Specific hierarchy retrieved successfully');
84
+ });
85
+ test('should check if hierarchy exists', async () => {
86
+ // Test existing hierarchy
87
+ mockRestService.get.mockResolvedValue(createMockResponse({
88
+ Name: 'ExistingHierarchy'
89
+ }));
90
+ const exists = await hierarchyService.exists('TestDimension', 'ExistingHierarchy');
91
+ expect(exists).toBe(true);
92
+ console.log('✅ Hierarchy existence check working correctly');
93
+ });
94
+ test('should check if hierarchy does not exist', async () => {
95
+ // Test non-existing hierarchy
96
+ const mockError = new TM1Exception_1.TM1RestException('Hierarchy not found', 404, { status: 404 });
97
+ mockRestService.get.mockRejectedValue(mockError);
98
+ const notExists = await hierarchyService.exists('TestDimension', 'NonExistent');
99
+ expect(notExists).toBe(false);
100
+ console.log('✅ Hierarchy non-existence check working correctly');
101
+ });
102
+ });
103
+ describe('Hierarchy CRUD Operations', () => {
104
+ test('should create new hierarchy', async () => {
105
+ const mockHierarchy = new Hierarchy_1.Hierarchy('NewHierarchy', 'TestDimension');
106
+ // Mock exists() to return false (hierarchy doesn't exist yet)
107
+ const mockError = new TM1Exception_1.TM1RestException('Hierarchy not found', 404, { status: 404 });
108
+ mockRestService.get.mockRejectedValueOnce(mockError); // for exists() check
109
+ // Mock create
110
+ mockRestService.post.mockResolvedValue(createMockResponse({
111
+ Name: 'NewHierarchy'
112
+ }, 201));
113
+ const result = await hierarchyService.create(mockHierarchy);
114
+ expect(result.status).toBe(201);
115
+ expect(mockRestService.post).toHaveBeenCalled();
116
+ console.log('✅ Hierarchy creation successful');
117
+ });
118
+ test('should update existing hierarchy', async () => {
119
+ const mockHierarchy = new Hierarchy_1.Hierarchy('UpdatedHierarchy', 'TestDimension');
120
+ // Mock the various calls that update() makes internally
121
+ mockRestService.get.mockResolvedValue(createMockResponse({ value: [] })); // removeAllElements
122
+ mockRestService.get.mockResolvedValue(createMockResponse({ value: [] })); // removeAllEdges
123
+ mockRestService.get.mockResolvedValue(createMockResponse({ value: [] })); // getElementAttributes
124
+ await hierarchyService.update(mockHierarchy);
125
+ expect(mockRestService.get).toHaveBeenCalled();
126
+ console.log('✅ Hierarchy update successful');
127
+ });
128
+ test('should delete hierarchy', async () => {
129
+ mockRestService.delete.mockResolvedValue(createMockResponse({}, 204));
130
+ const result = await hierarchyService.delete('TestDimension', 'HierarchyToDelete');
131
+ expect(result.status).toBe(204);
132
+ console.log('✅ Hierarchy deletion successful');
133
+ });
134
+ });
135
+ describe('Hierarchy Element Attribute Operations', () => {
136
+ test('should get element attributes', async () => {
137
+ mockRestService.get.mockResolvedValue(createMockResponse({
138
+ value: [
139
+ {
140
+ Name: 'Description',
141
+ Type: 'String',
142
+ '@odata.type': '#ibm.tm1.api.v1.ElementAttribute'
143
+ },
144
+ {
145
+ Name: 'Code',
146
+ Type: 'Alias',
147
+ '@odata.type': '#ibm.tm1.api.v1.ElementAttribute'
148
+ }
149
+ ]
150
+ }));
151
+ const attributes = await hierarchyService.getElementAttributes('TestDimension', 'TestHierarchy');
152
+ expect(Array.isArray(attributes)).toBe(true);
153
+ expect(attributes.length).toBe(2);
154
+ expect(attributes[0].name).toBe('Description');
155
+ console.log('✅ Element attributes retrieved successfully');
156
+ });
157
+ test('should check if element attribute exists', async () => {
158
+ // Test existing attribute
159
+ mockRestService.get.mockResolvedValue(createMockResponse({
160
+ Name: 'ExistingAttribute'
161
+ }));
162
+ const exists = await hierarchyService.elementAttributeExists('TestDimension', 'TestHierarchy', 'ExistingAttribute');
163
+ expect(exists).toBe(true);
164
+ console.log('✅ Element attribute existence check working');
165
+ });
166
+ test('should check if element attribute does not exist', async () => {
167
+ const mockError = new TM1Exception_1.TM1RestException('Attribute not found', 404, { status: 404 });
168
+ mockRestService.get.mockRejectedValue(mockError);
169
+ const notExists = await hierarchyService.elementAttributeExists('TestDimension', 'TestHierarchy', 'NonExistentAttribute');
170
+ expect(notExists).toBe(false);
171
+ console.log('✅ Element attribute non-existence check working');
172
+ });
173
+ test('should delete element attribute', async () => {
174
+ mockRestService.delete.mockResolvedValue(createMockResponse({}, 204));
175
+ const result = await hierarchyService.deleteElementAttribute('TestDimension', 'TestHierarchy', 'AttributeToDelete');
176
+ expect(result.status).toBe(204);
177
+ console.log('✅ Element attribute deletion successful');
178
+ });
179
+ });
180
+ describe('Hierarchy Error Handling', () => {
181
+ test('should handle invalid hierarchy names gracefully', async () => {
182
+ mockRestService.get.mockRejectedValue({
183
+ response: { status: 400, statusText: 'Bad Request' }
184
+ });
185
+ await expect(hierarchyService.get('TestDimension', ''))
186
+ .rejects.toMatchObject({
187
+ response: { status: 400 }
188
+ });
189
+ console.log('✅ Invalid hierarchy name handling working');
190
+ });
191
+ test('should handle network errors gracefully', async () => {
192
+ mockRestService.get.mockRejectedValue({
193
+ code: 'ECONNREFUSED'
194
+ });
195
+ await expect(hierarchyService.getAllNames('TestDimension'))
196
+ .rejects.toMatchObject({
197
+ code: 'ECONNREFUSED'
198
+ });
199
+ console.log('✅ Network error handling working');
200
+ });
201
+ test('should handle authentication errors', async () => {
202
+ mockRestService.get.mockRejectedValue({
203
+ response: { status: 401, statusText: 'Unauthorized' }
204
+ });
205
+ await expect(hierarchyService.get('TestDimension', 'TestHierarchy'))
206
+ .rejects.toMatchObject({
207
+ response: { status: 401 }
208
+ });
209
+ console.log('✅ Authentication error handling working');
210
+ });
211
+ });
212
+ describe('Hierarchy Service Edge Cases', () => {
213
+ test('should handle empty hierarchy lists', async () => {
214
+ mockRestService.get.mockResolvedValue(createMockResponse({
215
+ value: []
216
+ }));
217
+ const hierarchies = await hierarchyService.getAll('EmptyDimension');
218
+ expect(Array.isArray(hierarchies)).toBe(true);
219
+ expect(hierarchies.length).toBe(0);
220
+ console.log('✅ Empty hierarchy list handling working');
221
+ });
222
+ test('should handle concurrent operations efficiently', async () => {
223
+ mockRestService.get.mockResolvedValue(createMockResponse({
224
+ value: [{ Name: 'TestHierarchy' }]
225
+ }));
226
+ const operations = Array(5).fill(null).map(() => hierarchyService.getAllNames('TestDimension'));
227
+ const results = await Promise.allSettled(operations);
228
+ const successful = results.filter(r => r.status === 'fulfilled');
229
+ expect(successful.length).toBe(5);
230
+ console.log('✅ Concurrent operations handling working');
231
+ });
232
+ test('should handle large hierarchy data efficiently', async () => {
233
+ const largeHierarchyData = Array(1000).fill(null).map((_, i) => ({
234
+ Name: `Hierarchy${i}`,
235
+ Visible: true,
236
+ Elements: []
237
+ }));
238
+ mockRestService.get.mockResolvedValue(createMockResponse({
239
+ value: largeHierarchyData
240
+ }));
241
+ const startTime = Date.now();
242
+ const hierarchies = await hierarchyService.getAll('LargeDimension');
243
+ const endTime = Date.now();
244
+ expect(hierarchies.length).toBe(1000);
245
+ expect(endTime - startTime).toBeLessThan(1000); // Should be fast with mocking
246
+ console.log('✅ Large hierarchy data processing efficient');
247
+ });
248
+ });
249
+ describe('Hierarchy Service Integration', () => {
250
+ test('should maintain data consistency across operations', async () => {
251
+ const hierarchyList = [
252
+ { Name: 'Hierarchy1' },
253
+ { Name: 'Hierarchy2' }
254
+ ];
255
+ mockRestService.get.mockResolvedValue(createMockResponse({
256
+ value: hierarchyList
257
+ }));
258
+ const names1 = await hierarchyService.getAllNames('TestDimension');
259
+ const names2 = await hierarchyService.getAllNames('TestDimension');
260
+ expect(names1).toEqual(names2);
261
+ expect(names1).toEqual(['Hierarchy1', 'Hierarchy2']);
262
+ console.log('✅ Data consistency maintained');
263
+ });
264
+ test('should handle hierarchy lifecycle operations', async () => {
265
+ const testHierarchy = new Hierarchy_1.Hierarchy('LifecycleHierarchy', 'TestDimension');
266
+ // Mock exists() to return false for create
267
+ const mockError = new TM1Exception_1.TM1RestException('Hierarchy not found', 404, { status: 404 });
268
+ mockRestService.get.mockRejectedValueOnce(mockError); // for exists() in create()
269
+ // Mock create
270
+ mockRestService.post.mockResolvedValue(createMockResponse({}, 201));
271
+ // Mock get for exists() check after creation (should return true)
272
+ mockRestService.get.mockResolvedValueOnce(createMockResponse({
273
+ Name: 'LifecycleHierarchy'
274
+ }));
275
+ // Mock update dependencies
276
+ mockRestService.get.mockResolvedValue(createMockResponse({ value: [] })); // for removeAllElements
277
+ mockRestService.get.mockResolvedValue(createMockResponse({ value: [] })); // for removeAllEdges
278
+ mockRestService.get.mockResolvedValue(createMockResponse({ value: [] })); // for getElementAttributes
279
+ // Mock delete
280
+ mockRestService.delete.mockResolvedValue(createMockResponse({}, 204));
281
+ // Test lifecycle operations
282
+ const createResult = await hierarchyService.create(testHierarchy);
283
+ expect(createResult.status).toBe(201);
284
+ const exists = await hierarchyService.exists('TestDimension', 'LifecycleHierarchy');
285
+ expect(exists).toBe(true);
286
+ await hierarchyService.update(testHierarchy);
287
+ // update returns void, so just ensure it doesn't throw
288
+ const deleteResult = await hierarchyService.delete('TestDimension', 'LifecycleHierarchy');
289
+ expect(deleteResult.status).toBe(204);
290
+ console.log('✅ Hierarchy lifecycle operations working');
291
+ });
292
+ });
293
+ });
294
+ //# sourceMappingURL=hierarchyService.test.js.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Main Index Export Tests
3
+ * Comprehensive test suite for main module exports
4
+ * Target: Improve coverage from 0% to 50%+ for src/index.ts
5
+ */
6
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/tests/index.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}