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,409 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TM1ProjectDeployment = exports.TM1Project = exports.TM1ProjectTask = void 0;
4
+ const TM1Object_1 = require("./TM1Object");
5
+ function cleanNullTerms(d) {
6
+ const clean = {};
7
+ for (const [k, v] of Object.entries(d)) {
8
+ if (typeof v === 'object' && v !== null && !Array.isArray(v)) {
9
+ const nested = cleanNullTerms(v);
10
+ if (Object.keys(nested).length > 0) {
11
+ clean[k] = nested;
12
+ }
13
+ }
14
+ else if (Array.isArray(v) && v.length === 0) {
15
+ continue;
16
+ }
17
+ else if (v !== null && v !== undefined) {
18
+ clean[k] = v;
19
+ }
20
+ }
21
+ return clean;
22
+ }
23
+ class TM1ProjectTask {
24
+ constructor(taskName, chore, process, parameters, dependencies, precondition) {
25
+ /**
26
+ * Defines an action that executes a Process or a Chore with certain parameters.
27
+ *
28
+ * A Task MUST either have a Process or a Chore property.
29
+ * The property specifies the reference of the Process or Chore to be executed.
30
+ * The Process or Chore MUST be visible.
31
+ *
32
+ * A Task MAY have a Parameters property.
33
+ * The property specifies the parameters to be passed to the Process.
34
+ * This property MUST NOT be specified if the task is to execute a Chore.
35
+ *
36
+ * A Task MAY have a Dependencies property.
37
+ * The property specifies an array of URIs of tasks or objects,
38
+ * which will be executed or loaded, respectively, before executing the current task.
39
+ * E.g.: ["Cubes('Cube_A')", "Dimensions('Dimension_C')"]
40
+ *
41
+ * A Task MAY have a Precondition property.
42
+ * The server only executes a Task when either the precondition is not specified, or it is evaluated to TRUE.
43
+ *
44
+ * The server only executes a Task one time during a deployment.
45
+ */
46
+ if (!chore && !process) {
47
+ throw new Error("TM1ProjectTask must either have a 'Process' or a 'Chore' property");
48
+ }
49
+ if (chore && process) {
50
+ throw new Error("TM1ProjectTask must not have a 'Chore' and 'Process' property");
51
+ }
52
+ if (chore && parameters) {
53
+ throw new Error("TM1ProjectTask must not have a 'Chore' and 'Parameters' property");
54
+ }
55
+ this.taskName = taskName;
56
+ this.chore = chore;
57
+ this.process = process;
58
+ this.parameters = parameters;
59
+ this.dependencies = dependencies;
60
+ this.precondition = precondition;
61
+ }
62
+ constructBody() {
63
+ const body = {};
64
+ if (this.chore) {
65
+ if (!this.chore.startsWith("Chores('")) {
66
+ body["Chore"] = `Chores('${this.chore}')`;
67
+ }
68
+ else {
69
+ body["Chore"] = this.chore;
70
+ }
71
+ }
72
+ else if (this.process) {
73
+ if (!this.process.startsWith("Processes('")) {
74
+ body["Process"] = `Processes('${this.process}')`;
75
+ }
76
+ else {
77
+ body["Process"] = this.process;
78
+ }
79
+ body["Parameters"] = this.parameters;
80
+ }
81
+ if (this.dependencies) {
82
+ body["Dependencies"] = this.dependencies;
83
+ }
84
+ return body;
85
+ }
86
+ static fromDict(taskName, task) {
87
+ return new TM1ProjectTask(taskName, task.Chore, task.Process, task.Parameters, task.Dependencies, task.Precondition);
88
+ }
89
+ }
90
+ exports.TM1ProjectTask = TM1ProjectTask;
91
+ class TM1Project extends TM1Object_1.TM1Object {
92
+ constructor(version = 1.0, name, settings, tasks, objects, ignore, files, deployment, prePush, postPush, prePull, postPull) {
93
+ /**
94
+ *
95
+ * Args:
96
+ * version (int): _description_
97
+ * settings (dict, optional): _description_. Defaults to None.
98
+ * tasks (dict, optional): _description_. Defaults to None.
99
+ * objects (dict, optional): _description_. Defaults to None.
100
+ * ignore (list, optional): _description_. Defaults to None.
101
+ * files (list, optional): _description_. Defaults to None.
102
+ * deployment (dict, optional): _description_. Defaults to None.
103
+ * pre_push (list, optional): _description_. Defaults to None.
104
+ * post_push (list, optional): _description_. Defaults to None.
105
+ * pre_pull (list, optional): _description_. Defaults to None.
106
+ * post_pull (list, optional): _description_. Defaults to None.
107
+ */
108
+ super();
109
+ this._version = version;
110
+ this._name = name || '';
111
+ this._settings = settings;
112
+ this._tasks = tasks;
113
+ this._objects = objects;
114
+ this._ignore = ignore;
115
+ this._files = files;
116
+ this._deployment = deployment;
117
+ this._prePush = prePush;
118
+ this._postPush = postPush;
119
+ this._prePull = prePull;
120
+ this._postPull = postPull;
121
+ }
122
+ addTask(projectTask) {
123
+ if (!this._tasks) {
124
+ this._tasks = {};
125
+ }
126
+ if (projectTask.taskName in this._tasks) {
127
+ throw new Error(`Task with name '${projectTask.taskName}' already exists in TM1 project. Task name must be unique`);
128
+ }
129
+ this._tasks[projectTask.taskName] = projectTask;
130
+ }
131
+ removeTask(taskName) {
132
+ if (this._tasks && taskName in this._tasks) {
133
+ delete this._tasks[taskName];
134
+ }
135
+ }
136
+ includeAllAttributeDimensions(tm1) {
137
+ /**
138
+ * Add an ignore-exception for each attribute dimension
139
+ */
140
+ const attributeDimensions = tm1.dimensions.getAllNames()
141
+ .filter((dimension) => dimension.toLowerCase().startsWith("}elementattributes_"));
142
+ this.addIgnoreExceptions("Dimensions", attributeDimensions);
143
+ }
144
+ addIgnoreExceptions(objectClass, objectNames) {
145
+ /**
146
+ * Specify exceptions to ignore policy.
147
+ * Wildcards (`*`) can not be used in the `object_name`
148
+ *
149
+ * Args:
150
+ * object_class: class of the object e.g., "Dimensions"
151
+ * object_names: names of the objects e.g., ["Product", "Customer", "Region"]
152
+ *
153
+ * Example of the ignore property in the tm1project:
154
+ * Exclude all Dimensions that start with 'Dim', except for dimension 'DimB', 'DimA'
155
+ *
156
+ * "Ignore":
157
+ * [
158
+ * "Dimensions('Dim*')",
159
+ * "!Dimensions('DimA')",
160
+ * "!Dimensions('DimB')"
161
+ * ]
162
+ */
163
+ for (const objectName of objectNames) {
164
+ if (objectName.includes("*")) {
165
+ throw new Error("'*' character must not be used in object_name");
166
+ }
167
+ let ignoreEntry = "!" + objectClass;
168
+ if (objectName) {
169
+ ignoreEntry += `('${objectName}')`;
170
+ }
171
+ if (!this.ignore) {
172
+ this.ignore = [];
173
+ }
174
+ if (!this.ignore.includes(ignoreEntry)) {
175
+ this.ignore.push(ignoreEntry);
176
+ }
177
+ }
178
+ }
179
+ addIgnore(objectClass, objectName) {
180
+ /**
181
+ * Ignore is an optional property in the tm1project
182
+ * It specifies the objects to be excluded from the source, if the object is newly created.
183
+ *
184
+ * Args:
185
+ * object_class: class of the object e.g., "Dimensions"
186
+ * object_name: name of the object e.g., "Product"
187
+ *
188
+ * For the `object_type` pass value like `Dimensions` or `Cubes/Views`
189
+ *
190
+ * Wildcards (`*`) can be used in the `object_name`, if the object is not a control object.
191
+ *
192
+ * Example of the `ignore` property in the tm1project:
193
+ * Exclude all the new Cubes and Views in the source, except Cube_A;
194
+ * include control Process }Drill_Drill_A;
195
+ * and exclude all the new Dimensions which has a name starting with 'Dim'
196
+ *
197
+ * "Ignore":
198
+ * [
199
+ * "Cubes/Views",
200
+ * "!Cubes('Cube_A')",
201
+ * "!Processes('}Drill_Drill_A')",
202
+ * "Dimensions('Dim*')"
203
+ * ]
204
+ */
205
+ if (objectName.startsWith("}") && objectName.includes("*")) {
206
+ throw new Error("'*' character must not be used in object_name for control objects");
207
+ }
208
+ if (!this.ignore) {
209
+ this.ignore = [];
210
+ }
211
+ let ignoreEntry = objectClass;
212
+ if (objectName) {
213
+ ignoreEntry += `('${objectName}')`;
214
+ }
215
+ if (!this.ignore.includes(ignoreEntry)) {
216
+ this.ignore.push(ignoreEntry);
217
+ }
218
+ }
219
+ removeIgnore(ignoreEntry) {
220
+ if (this.ignore && this.ignore.includes(ignoreEntry)) {
221
+ const index = this.ignore.indexOf(ignoreEntry);
222
+ this.ignore.splice(index, 1);
223
+ }
224
+ }
225
+ addDeployment(deployment) {
226
+ /**
227
+ * "Deployment is an OPTIONAL property. Each of its property defines a named deployment and its specific properties.
228
+ * All the tm1project properties can be redefined for a deployment, except Version.
229
+ * Those properties override the tm1project properties for the specific deployment.
230
+ *
231
+ * Current deployment is set by action GitInit."
232
+ */
233
+ if (!this._deployment) {
234
+ this._deployment = {};
235
+ }
236
+ if (deployment.deploymentName in this._deployment) {
237
+ throw new Error(`Deployment with name '${deployment.deploymentName}' already exists in TM1 project. Deployment name must be unique`);
238
+ }
239
+ this._deployment[deployment.deploymentName] = deployment;
240
+ }
241
+ removeDeployment(deploymentName) {
242
+ if (this._deployment && deploymentName in this._deployment) {
243
+ delete this._deployment[deploymentName];
244
+ }
245
+ }
246
+ static fromJSON(tm1projectAsJson) {
247
+ /**
248
+ * :param tm1project_as_json: response of /!tm1project
249
+ * :return: an instance of this class
250
+ */
251
+ const tm1projectAsDict = JSON.parse(tm1projectAsJson);
252
+ return TM1Project.fromDict(tm1projectAsDict);
253
+ }
254
+ static fromDict(tm1projectAsDict) {
255
+ /**
256
+ * :param tm1project_as_dict: Dictionary, tm1project as dictionary
257
+ * :return: an instance of this class
258
+ */
259
+ return new TM1Project(tm1projectAsDict['Version'], tm1projectAsDict.Name, tm1projectAsDict.Settings, tm1projectAsDict.Tasks ? Object.fromEntries(Object.entries(tm1projectAsDict.Tasks).map(([taskName, task]) => [
260
+ taskName,
261
+ TM1ProjectTask.fromDict(taskName, task)
262
+ ])) : undefined, tm1projectAsDict.Objects, tm1projectAsDict.Ignore, tm1projectAsDict.Files, tm1projectAsDict.Deployment ? Object.fromEntries(Object.entries(tm1projectAsDict.Deployment).map(([deploymentName, deployment]) => [
263
+ deploymentName,
264
+ TM1ProjectDeployment.fromDeploymentDict(deploymentName, deployment)
265
+ ])) : undefined, tm1projectAsDict.PrePush, tm1projectAsDict.PostPush, tm1projectAsDict.PrePull, tm1projectAsDict.PostPull);
266
+ }
267
+ // construct self.body (json) from the class-attributes
268
+ constructBody() {
269
+ const body = {
270
+ 'Version': this._version,
271
+ 'Name': this._name,
272
+ 'Settings': this._settings,
273
+ 'Tasks': this._tasks ? Object.fromEntries(Object.entries(this._tasks).map(([name, task]) => [name, task.constructBody()])) : undefined,
274
+ 'Objects': this._objects,
275
+ 'Ignore': this._ignore,
276
+ 'Files': this._files,
277
+ 'Deployment': this._deployment ? Object.fromEntries(Object.entries(this._deployment).map(([name, deployment]) => [
278
+ name,
279
+ deployment.constructBody()
280
+ ])) : undefined,
281
+ 'PrePush': this._prePush,
282
+ 'PostPush': this._postPush,
283
+ 'PrePull': this._prePull,
284
+ 'PostPull': this._postPull
285
+ };
286
+ return cleanNullTerms(body);
287
+ }
288
+ get bodyAsDict() {
289
+ return this.constructBody();
290
+ }
291
+ get body() {
292
+ return JSON.stringify(this.bodyAsDict);
293
+ }
294
+ get version() {
295
+ return this._version;
296
+ }
297
+ set version(value) {
298
+ this._version = value;
299
+ }
300
+ get name() {
301
+ return this._name;
302
+ }
303
+ set name(value) {
304
+ this._name = value;
305
+ }
306
+ get settings() {
307
+ return this._settings;
308
+ }
309
+ set settings(value) {
310
+ this._settings = value;
311
+ }
312
+ get tasks() {
313
+ return this._tasks;
314
+ }
315
+ set tasks(value) {
316
+ this._tasks = value;
317
+ }
318
+ get objects() {
319
+ return this._objects;
320
+ }
321
+ set objects(value) {
322
+ this._objects = value;
323
+ }
324
+ get ignore() {
325
+ return this._ignore;
326
+ }
327
+ set ignore(value) {
328
+ this._ignore = value;
329
+ }
330
+ get deployment() {
331
+ return this._deployment;
332
+ }
333
+ set deployment(value) {
334
+ this._deployment = value;
335
+ }
336
+ get prePush() {
337
+ return this._prePush;
338
+ }
339
+ set prePush(value) {
340
+ this._prePush = value;
341
+ }
342
+ get postPush() {
343
+ return this._postPush;
344
+ }
345
+ set postPush(value) {
346
+ this._postPush = value;
347
+ }
348
+ get prePull() {
349
+ return this._prePull;
350
+ }
351
+ set prePull(value) {
352
+ this._prePull = value;
353
+ }
354
+ get postPull() {
355
+ return this._postPull;
356
+ }
357
+ set postPull(value) {
358
+ this._postPull = value;
359
+ }
360
+ }
361
+ exports.TM1Project = TM1Project;
362
+ class TM1ProjectDeployment extends TM1Project {
363
+ constructor(deploymentName, settings, tasks, objects, ignore, files, prePush, postPush, prePull, postPull) {
364
+ super(undefined, // version is not used in deployment
365
+ deploymentName, settings, tasks, objects, ignore, files, undefined, // no nested deployments
366
+ prePush, postPush, prePull, postPull);
367
+ this.deploymentName = deploymentName;
368
+ }
369
+ static fromDeploymentDict(deploymentName, deployment) {
370
+ /**
371
+ * :param deployment_as_dict: Dictionary, deployment as dictionary
372
+ * :return: an instance of this class
373
+ */
374
+ return new TM1ProjectDeployment(deploymentName, deployment.Settings, deployment.Tasks ? Object.fromEntries(Object.entries(deployment.Tasks).map(([taskName, task]) => [
375
+ taskName,
376
+ TM1ProjectTask.fromDict(taskName, task)
377
+ ])) : undefined, deployment.Objects, deployment.Ignore, deployment.Files, deployment.PrePush, deployment.PostPush, deployment.PrePull, deployment.PostPull);
378
+ }
379
+ // Override the base class fromDict to maintain signature compatibility
380
+ static fromDict(tm1projectAsDict) {
381
+ // Use the base class implementation and then create deployment from it
382
+ const baseProject = super.fromDict(tm1projectAsDict);
383
+ return new TM1ProjectDeployment(baseProject.name || 'Deployment', baseProject.settings, baseProject.tasks, baseProject.objects, baseProject.ignore, tm1projectAsDict.Files, // Use from original dict since base class doesn't have files
384
+ baseProject.prePush, baseProject.postPush, baseProject.prePull, baseProject.postPull);
385
+ }
386
+ get bodyAsDict() {
387
+ return this.constructBody();
388
+ }
389
+ get body() {
390
+ return JSON.stringify(this.bodyAsDict);
391
+ }
392
+ // construct self.body (json) from the class-attributes
393
+ constructBody() {
394
+ const bodyAsDict = {
395
+ 'Settings': this.settings,
396
+ 'Tasks': this.tasks ? Object.fromEntries(Object.entries(this.tasks).map(([name, task]) => [name, task.constructBody()])) : undefined,
397
+ 'Objects': this.objects,
398
+ 'Ignore': this.ignore,
399
+ 'Files': this._files,
400
+ 'PrePush': this.prePush,
401
+ 'PostPush': this.postPush,
402
+ 'PrePull': this.prePull,
403
+ 'PostPull': this.postPull
404
+ };
405
+ return cleanNullTerms(bodyAsDict);
406
+ }
407
+ }
408
+ exports.TM1ProjectDeployment = TM1ProjectDeployment;
409
+ //# sourceMappingURL=TM1Project.js.map
@@ -0,0 +1,42 @@
1
+ import { TM1Object } from './TM1Object';
2
+ export declare enum UserType {
3
+ User = 0,
4
+ SecurityAdmin = 1,
5
+ DataAdmin = 2,
6
+ Admin = 3,
7
+ OperationsAdmin = 4
8
+ }
9
+ export declare class User extends TM1Object {
10
+ /** Abstraction of a TM1 User
11
+ *
12
+ */
13
+ private _name;
14
+ private _groups;
15
+ private _friendlyName?;
16
+ private _password?;
17
+ private _enabled?;
18
+ private _userType;
19
+ constructor(name: string, groups: Iterable<string>, friendlyName?: string, password?: string, userType?: UserType | string, enabled?: boolean);
20
+ get name(): string;
21
+ set name(value: string);
22
+ get userType(): UserType;
23
+ set userType(value: UserType | string);
24
+ get friendlyName(): string | undefined;
25
+ set friendlyName(value: string | undefined);
26
+ get password(): string | undefined;
27
+ set password(value: string | undefined);
28
+ get isAdmin(): boolean;
29
+ get isDataAdmin(): boolean;
30
+ get isSecurityAdmin(): boolean;
31
+ get isOpsAdmin(): boolean;
32
+ get groups(): string[];
33
+ get enabled(): boolean | undefined;
34
+ set enabled(value: boolean | undefined);
35
+ addGroup(groupName: string): void;
36
+ removeGroup(groupName: string): void;
37
+ static fromJSON(userAsJson: string): User;
38
+ static fromDict(userAsDict: any): User;
39
+ get body(): string;
40
+ constructBody(): string;
41
+ }
42
+ //# sourceMappingURL=User.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../../src/objects/User.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,oBAAY,QAAQ;IAChB,IAAI,IAAI;IACR,aAAa,IAAI;IACjB,SAAS,IAAI;IACb,KAAK,IAAI;IACT,eAAe,IAAI;CACtB;AAED,qBAAa,IAAK,SAAQ,SAAS;IAC/B;;OAEG;IAEH,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,CAAU;IAC3B,OAAO,CAAC,SAAS,CAA2B;gBAGxC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EACxB,YAAY,CAAC,EAAE,MAAM,EACrB,QAAQ,CAAC,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,EAC5B,OAAO,CAAC,EAAE,OAAO;IA8BrB,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,IAAI,CAAC,KAAK,EAAE,MAAM,EAE5B;IAED,IAAW,QAAQ,IAAI,QAAQ,CAE9B;IAED,IAAW,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,EAqB3C;IAED,IAAW,YAAY,IAAI,MAAM,GAAG,SAAS,CAE5C;IAED,IAAW,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAEhD;IAED,IAAW,QAAQ,IAAI,MAAM,GAAG,SAAS,CAExC;IAED,IAAW,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAE5C;IAED,IAAW,OAAO,IAAI,OAAO,CAE5B;IAED,IAAW,WAAW,IAAI,OAAO,CAEhC;IAED,IAAW,eAAe,IAAI,OAAO,CAEpC;IAED,IAAW,UAAU,IAAI,OAAO,CAE/B;IAED,IAAW,MAAM,IAAI,MAAM,EAAE,CAE5B;IAED,IAAW,OAAO,IAAI,OAAO,GAAG,SAAS,CAExC;IAED,IAAW,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,EAE5C;IAEM,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAIjC,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;WAI7B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;WAUlC,QAAQ,CAAC,UAAU,EAAE,GAAG,GAAG,IAAI;IAgB7C,IAAW,IAAI,IAAI,MAAM,CAExB;IAEM,aAAa,IAAI,MAAM;CAqBjC"}
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.User = exports.UserType = void 0;
4
+ const TM1Object_1 = require("./TM1Object");
5
+ const Utils_1 = require("../utils/Utils");
6
+ var UserType;
7
+ (function (UserType) {
8
+ UserType[UserType["User"] = 0] = "User";
9
+ UserType[UserType["SecurityAdmin"] = 1] = "SecurityAdmin";
10
+ UserType[UserType["DataAdmin"] = 2] = "DataAdmin";
11
+ UserType[UserType["Admin"] = 3] = "Admin";
12
+ UserType[UserType["OperationsAdmin"] = 4] = "OperationsAdmin";
13
+ })(UserType || (exports.UserType = UserType = {}));
14
+ class User extends TM1Object_1.TM1Object {
15
+ constructor(name, groups, friendlyName, password, userType, enabled) {
16
+ super();
17
+ this._userType = UserType.User;
18
+ this._name = name;
19
+ this._groups = new Utils_1.CaseAndSpaceInsensitiveSet();
20
+ for (const group of groups) {
21
+ this._groups.add(group);
22
+ }
23
+ this._friendlyName = friendlyName;
24
+ this._password = password;
25
+ this._enabled = enabled;
26
+ // determine user_type
27
+ if (userType === undefined) {
28
+ if (this._groups.has(UserType.Admin.toString())) {
29
+ this.userType = UserType.Admin;
30
+ }
31
+ else if (this._groups.has(UserType.SecurityAdmin.toString())) {
32
+ this.userType = UserType.SecurityAdmin;
33
+ }
34
+ else if (this._groups.has(UserType.DataAdmin.toString())) {
35
+ this.userType = UserType.DataAdmin;
36
+ }
37
+ else if (this._groups.has(UserType.OperationsAdmin.toString())) {
38
+ this.userType = UserType.OperationsAdmin;
39
+ }
40
+ else {
41
+ this.userType = UserType.User;
42
+ }
43
+ }
44
+ else {
45
+ this.userType = userType;
46
+ }
47
+ }
48
+ get name() {
49
+ return this._name;
50
+ }
51
+ set name(value) {
52
+ this._name = value;
53
+ }
54
+ get userType() {
55
+ return this._userType;
56
+ }
57
+ set userType(value) {
58
+ if (typeof value === 'string') {
59
+ // Parse string to UserType enum
60
+ const lowerValue = value.replace(/\s+/g, '').toLowerCase();
61
+ for (const [key, enumValue] of Object.entries(UserType)) {
62
+ if (key.toLowerCase() === lowerValue) {
63
+ this._userType = enumValue;
64
+ break;
65
+ }
66
+ }
67
+ if (this._userType === undefined) {
68
+ throw new Error(`Invalid element type=${value}`);
69
+ }
70
+ }
71
+ else {
72
+ this._userType = value;
73
+ }
74
+ // update groups as well, since TM1 doesn't react to change in user_type property
75
+ if (this._userType !== UserType.User) {
76
+ this.addGroup(this._userType.toString());
77
+ }
78
+ }
79
+ get friendlyName() {
80
+ return this._friendlyName;
81
+ }
82
+ set friendlyName(value) {
83
+ this._friendlyName = value;
84
+ }
85
+ get password() {
86
+ return this._password;
87
+ }
88
+ set password(value) {
89
+ this._password = value;
90
+ }
91
+ get isAdmin() {
92
+ return this._groups.has("ADMIN");
93
+ }
94
+ get isDataAdmin() {
95
+ return this._groups.has("Admin") || this._groups.has("DataAdmin");
96
+ }
97
+ get isSecurityAdmin() {
98
+ return this._groups.has("Admin") || this._groups.has("SecurityAdmin");
99
+ }
100
+ get isOpsAdmin() {
101
+ return this._groups.has("Admin") || this._groups.has("OperationsAdmin");
102
+ }
103
+ get groups() {
104
+ return Array.from(this._groups);
105
+ }
106
+ get enabled() {
107
+ return this._enabled;
108
+ }
109
+ set enabled(value) {
110
+ this._enabled = value;
111
+ }
112
+ addGroup(groupName) {
113
+ this._groups.add(groupName);
114
+ }
115
+ removeGroup(groupName) {
116
+ this._groups.delete(groupName);
117
+ }
118
+ static fromJSON(userAsJson) {
119
+ /** Alternative constructor
120
+ *
121
+ * :param user_as_json: user as JSON string
122
+ * :return: user, an instance of this class
123
+ */
124
+ const userAsDict = JSON.parse(userAsJson);
125
+ return User.fromDict(userAsDict);
126
+ }
127
+ static fromDict(userAsDict) {
128
+ /** Alternative constructor
129
+ *
130
+ * :param user_as_dict: user as dict
131
+ * :return: user, an instance of this class
132
+ */
133
+ return new User(userAsDict.Name, userAsDict.Groups.map((group) => group.Name), userAsDict.FriendlyName, undefined, // password not included in dict
134
+ userAsDict.Type, userAsDict.Enabled);
135
+ }
136
+ get body() {
137
+ return this.constructBody();
138
+ }
139
+ constructBody() {
140
+ /**
141
+ * construct body (json) from the class attributes
142
+ * :return: String, TM1 JSON representation of a user
143
+ */
144
+ const bodyAsDict = {};
145
+ bodyAsDict.Name = this.name;
146
+ bodyAsDict.FriendlyName = this.friendlyName || this.name;
147
+ bodyAsDict.Enabled = this._enabled;
148
+ bodyAsDict.Type = this._userType.toString();
149
+ if (this.password) {
150
+ bodyAsDict.Password = this._password;
151
+ }
152
+ bodyAsDict['Groups@odata.bind'] = this.groups.map(group => (0, Utils_1.formatUrl)("Groups('{}')", group));
153
+ return JSON.stringify(bodyAsDict);
154
+ }
155
+ }
156
+ exports.User = User;
157
+ //# sourceMappingURL=User.js.map
@@ -0,0 +1,19 @@
1
+ import { TM1Object } from './TM1Object';
2
+ export declare abstract class View extends TM1Object {
3
+ /** Abstraction of TM1 View
4
+ * serves as a parentclass for .Objects.MDXView and .Objects.NativeView
5
+ *
6
+ */
7
+ protected _cube: string;
8
+ protected _name: string;
9
+ constructor(cube: string, name: string);
10
+ abstract get body(): string;
11
+ get cube(): string;
12
+ get name(): string;
13
+ set cube(value: string);
14
+ set name(value: string);
15
+ get mdx(): string;
16
+ }
17
+ export { MDXView } from './MDXView';
18
+ export { NativeView } from './NativeView';
19
+ //# sourceMappingURL=View.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"View.d.ts","sourceRoot":"","sources":["../../src/objects/View.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,8BAAsB,IAAK,SAAQ,SAAS;IACxC;;;OAGG;IAEH,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAMtC,aAAoB,IAAI,IAAI,MAAM,CAAC;IAEnC,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,IAAI,CAAC,KAAK,EAAE,MAAM,EAE5B;IAED,IAAW,IAAI,CAAC,KAAK,EAAE,MAAM,EAE5B;IAED,IAAW,GAAG,IAAI,MAAM,CAEvB;CACJ;AAGD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NativeView = exports.MDXView = exports.View = void 0;
4
+ const TM1Object_1 = require("./TM1Object");
5
+ class View extends TM1Object_1.TM1Object {
6
+ constructor(cube, name) {
7
+ super();
8
+ this._cube = cube;
9
+ this._name = name;
10
+ }
11
+ get cube() {
12
+ return this._cube;
13
+ }
14
+ get name() {
15
+ return this._name;
16
+ }
17
+ set cube(value) {
18
+ this._cube = value;
19
+ }
20
+ set name(value) {
21
+ this._name = value;
22
+ }
23
+ get mdx() {
24
+ throw new Error("NotImplementedError");
25
+ }
26
+ }
27
+ exports.View = View;
28
+ // Re-export the concrete classes
29
+ var MDXView_1 = require("./MDXView");
30
+ Object.defineProperty(exports, "MDXView", { enumerable: true, get: function () { return MDXView_1.MDXView; } });
31
+ var NativeView_1 = require("./NativeView");
32
+ Object.defineProperty(exports, "NativeView", { enumerable: true, get: function () { return NativeView_1.NativeView; } });
33
+ //# sourceMappingURL=View.js.map