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,146 @@
1
+ import { TM1Object } from './TM1Object';
2
+
3
+ export enum ApplicationTypes {
4
+ CUBE = 'tm1.cube',
5
+ DIMENSION = 'tm1.dimension',
6
+ PROCESS = 'tm1.process',
7
+ CHORE = 'tm1.chore',
8
+ VIEW = 'tm1.view',
9
+ SUBSET = 'tm1.subset',
10
+ DOCUMENT = 'tm1.document',
11
+ FOLDER = 'tm1.folder',
12
+ LINK = 'tm1.link'
13
+ }
14
+
15
+ // Compatibility aliases
16
+ export const ApplicationTypeAliases = {
17
+ Cube: ApplicationTypes.CUBE,
18
+ Dimension: ApplicationTypes.DIMENSION,
19
+ Process: ApplicationTypes.PROCESS,
20
+ Chore: ApplicationTypes.CHORE,
21
+ View: ApplicationTypes.VIEW,
22
+ Subset: ApplicationTypes.SUBSET,
23
+ Document: ApplicationTypes.DOCUMENT,
24
+ Folder: ApplicationTypes.FOLDER,
25
+ Link: ApplicationTypes.LINK
26
+ };
27
+
28
+ export class Application extends TM1Object {
29
+ private _name: string;
30
+ private _path: string;
31
+ private _documented: boolean;
32
+ private _type: string;
33
+
34
+ constructor(
35
+ name: string,
36
+ path: string = '',
37
+ documented: boolean = false,
38
+ type: string = 'Application'
39
+ ) {
40
+ super();
41
+ this._name = name;
42
+ this._path = path;
43
+ this._documented = documented;
44
+ this._type = type;
45
+ }
46
+
47
+ public get name(): string {
48
+ return this._name;
49
+ }
50
+
51
+ public set name(name: string) {
52
+ this._name = name;
53
+ }
54
+
55
+ public get path(): string {
56
+ return this._path;
57
+ }
58
+
59
+ public set path(path: string) {
60
+ this._path = path;
61
+ }
62
+
63
+ public get documented(): boolean {
64
+ return this._documented;
65
+ }
66
+
67
+ public set documented(documented: boolean) {
68
+ this._documented = documented;
69
+ }
70
+
71
+ public get type(): string {
72
+ return this._type;
73
+ }
74
+
75
+ public get body(): string {
76
+ return JSON.stringify({
77
+ Name: this._name,
78
+ Path: this._path,
79
+ Documented: this._documented,
80
+ Type: this._type
81
+ });
82
+ }
83
+
84
+ public static fromDict(applicationAsDict: any): Application {
85
+ return new Application(
86
+ applicationAsDict.Name,
87
+ applicationAsDict.Path || '',
88
+ applicationAsDict.Documented || false,
89
+ applicationAsDict.Type || 'Application'
90
+ );
91
+ }
92
+ }
93
+
94
+ export class CubeApplication extends Application {
95
+ constructor(name: string, path: string = '') {
96
+ super(name, path, false, ApplicationTypes.CUBE);
97
+ }
98
+ }
99
+
100
+ export class DimensionApplication extends Application {
101
+ constructor(name: string, path: string = '') {
102
+ super(name, path, false, ApplicationTypes.DIMENSION);
103
+ }
104
+ }
105
+
106
+ export class ProcessApplication extends Application {
107
+ constructor(name: string, path: string = '') {
108
+ super(name, path, false, ApplicationTypes.PROCESS);
109
+ }
110
+ }
111
+
112
+ export class ChoreApplication extends Application {
113
+ constructor(name: string, path: string = '') {
114
+ super(name, path, false, ApplicationTypes.CHORE);
115
+ }
116
+ }
117
+
118
+ export class ViewApplication extends Application {
119
+ constructor(name: string, path: string = '') {
120
+ super(name, path, false, ApplicationTypes.VIEW);
121
+ }
122
+ }
123
+
124
+ export class SubsetApplication extends Application {
125
+ constructor(name: string, path: string = '') {
126
+ super(name, path, false, ApplicationTypes.SUBSET);
127
+ }
128
+ }
129
+
130
+ export class DocumentApplication extends Application {
131
+ constructor(name: string, path: string = '') {
132
+ super(name, path, true, ApplicationTypes.DOCUMENT);
133
+ }
134
+ }
135
+
136
+ export class FolderApplication extends Application {
137
+ constructor(name: string, path: string = '') {
138
+ super(name, path, false, ApplicationTypes.FOLDER);
139
+ }
140
+ }
141
+
142
+ export class LinkApplication extends Application {
143
+ constructor(name: string, path: string = '') {
144
+ super(name, path, false, ApplicationTypes.LINK);
145
+ }
146
+ }
@@ -0,0 +1,149 @@
1
+ import { TM1Object } from './TM1Object';
2
+ import { Subset, AnonymousSubset } from './Subset';
3
+ import { formatUrl } from '../utils/Utils';
4
+
5
+ export class ViewAxisSelection extends TM1Object {
6
+ /** Describes what is selected in a dimension on an axis. Can be a Registered Subset or an Anonymous Subset
7
+ */
8
+
9
+ private _subset: Subset | AnonymousSubset;
10
+ private _dimensionName: string;
11
+ private _hierarchyName: string;
12
+
13
+ constructor(dimensionName: string, subset: Subset | AnonymousSubset) {
14
+ /**
15
+ * :Parameters:
16
+ * `dimension_name` : String
17
+ * `subset` : Subset or AnonymousSubset
18
+ */
19
+ super();
20
+ this._subset = subset;
21
+ this._dimensionName = dimensionName;
22
+ this._hierarchyName = dimensionName;
23
+ }
24
+
25
+ public get subset(): Subset | AnonymousSubset {
26
+ return this._subset;
27
+ }
28
+
29
+ public get dimensionName(): string {
30
+ return this._dimensionName;
31
+ }
32
+
33
+ public get hierarchyName(): string {
34
+ return this._hierarchyName;
35
+ }
36
+
37
+ public get body(): string {
38
+ return JSON.stringify(this.constructBody());
39
+ }
40
+
41
+ public get bodyAsDict(): Record<string, any> {
42
+ return this.constructBody();
43
+ }
44
+
45
+ public static fromDict(data: Record<string, any>): ViewAxisSelection {
46
+ // Basic implementation - would need actual data structure
47
+ return new ViewAxisSelection('', new AnonymousSubset('', ''));
48
+ }
49
+
50
+ private constructBody(): Record<string, any> {
51
+ /** construct the ODATA conform JSON represenation for the ViewAxisSelection entity.
52
+ *
53
+ * :return: dictionary
54
+ */
55
+ const bodyAsDict: Record<string, any> = {};
56
+
57
+ if (this._subset instanceof AnonymousSubset) {
58
+ bodyAsDict['Subset'] = JSON.parse(this._subset.body);
59
+ } else if (this._subset instanceof Subset) {
60
+ const subsetPath = formatUrl(
61
+ "Dimensions('{}')/Hierarchies('{}')/Subsets('{}')",
62
+ this._dimensionName,
63
+ this._hierarchyName,
64
+ this._subset.name
65
+ );
66
+ bodyAsDict['Subset@odata.bind'] = subsetPath;
67
+ }
68
+
69
+ return bodyAsDict;
70
+ }
71
+ }
72
+
73
+
74
+ export class ViewTitleSelection {
75
+ /** Describes what is selected in a dimension on the view title.
76
+ * Can be a Registered Subset or an Anonymous Subset
77
+ */
78
+
79
+ private _dimensionName: string;
80
+ private _hierarchyName: string;
81
+ private _subset: AnonymousSubset | Subset;
82
+ private _selected: string;
83
+
84
+ constructor(dimensionName: string, subset: AnonymousSubset | Subset, selected: string) {
85
+ this._dimensionName = dimensionName;
86
+ this._hierarchyName = dimensionName;
87
+ this._subset = subset;
88
+ this._selected = selected;
89
+ }
90
+
91
+ public get subset(): Subset | AnonymousSubset {
92
+ return this._subset;
93
+ }
94
+
95
+ public get dimensionName(): string {
96
+ return this._dimensionName;
97
+ }
98
+
99
+ public get hierarchyName(): string {
100
+ return this._hierarchyName;
101
+ }
102
+
103
+ public get selected(): string {
104
+ return this._selected;
105
+ }
106
+
107
+ public get body(): string {
108
+ return JSON.stringify(this.constructBody());
109
+ }
110
+
111
+ public get bodyAsDict(): Record<string, any> {
112
+ return this.constructBody();
113
+ }
114
+
115
+ public static fromDict(data: Record<string, any>): ViewTitleSelection {
116
+ // Basic implementation - would need actual data structure
117
+ return new ViewTitleSelection('', new AnonymousSubset('', ''), '');
118
+ }
119
+
120
+ private constructBody(): Record<string, any> {
121
+ /** construct the ODATA conform JSON represenation for the ViewTitleSelection entity.
122
+ *
123
+ * :return: string, the valid JSON
124
+ */
125
+ const bodyAsDict: Record<string, any> = {};
126
+
127
+ if (this._subset instanceof AnonymousSubset) {
128
+ bodyAsDict['Subset'] = JSON.parse(this._subset.body);
129
+ } else if (this._subset instanceof Subset) {
130
+ const subsetPath = formatUrl(
131
+ "Dimensions('{}')/Hierarchies('{}')/Subsets('{}')",
132
+ this._dimensionName,
133
+ this._hierarchyName,
134
+ this._subset.name
135
+ );
136
+ bodyAsDict['Subset@odata.bind'] = subsetPath;
137
+ }
138
+
139
+ const elementPath = formatUrl(
140
+ "Dimensions('{}')/Hierarchies('{}')/Elements('{}')",
141
+ this._dimensionName,
142
+ this._hierarchyName,
143
+ this._selected
144
+ );
145
+ bodyAsDict['Selected@odata.bind'] = elementPath;
146
+
147
+ return bodyAsDict;
148
+ }
149
+ }
@@ -0,0 +1,174 @@
1
+ import { TM1Object } from './TM1Object';
2
+ import { ChoreFrequency } from './ChoreFrequency';
3
+ import { ChoreStartTime } from './ChoreStartTime';
4
+ import { ChoreTask } from './ChoreTask';
5
+
6
+ export class Chore extends TM1Object {
7
+ /** Abstraction of TM1 Chore
8
+ *
9
+ */
10
+ public static readonly SINGLE_COMMIT = 'SingleCommit';
11
+ public static readonly MULTIPLE_COMMIT = 'MultipleCommit';
12
+
13
+ private _name: string;
14
+ private _startTime: ChoreStartTime;
15
+ private _dstSensitivity: boolean;
16
+ private _active: boolean;
17
+ private _executionMode: string;
18
+ private _frequency: ChoreFrequency;
19
+ private _tasks: ChoreTask[];
20
+
21
+ constructor(
22
+ name: string,
23
+ startTime: ChoreStartTime,
24
+ dstSensitivity: boolean,
25
+ active: boolean,
26
+ executionMode: string,
27
+ frequency: ChoreFrequency,
28
+ tasks: Iterable<ChoreTask>
29
+ ) {
30
+ super();
31
+ this._name = name;
32
+ this._startTime = startTime;
33
+ this._dstSensitivity = dstSensitivity;
34
+ this._active = active;
35
+ this._executionMode = executionMode;
36
+ this._frequency = frequency;
37
+ this._tasks = Array.from(tasks);
38
+ }
39
+
40
+ public static fromJSON(choreAsJson: string): Chore {
41
+ /** Alternative constructor
42
+ *
43
+ * :param chore_as_json: string, JSON. Response of /Chores('x')/Tasks?$expand=*
44
+ * :return: Chore, an instance of this class
45
+ */
46
+ const choreAsDict = JSON.parse(choreAsJson);
47
+ return Chore.fromDict(choreAsDict);
48
+ }
49
+
50
+ public static fromDict(choreAsDict: any): Chore {
51
+ /** Alternative constructor
52
+ *
53
+ * :param chore_as_dict: Chore as dict
54
+ * :return: Chore, an instance of this class
55
+ */
56
+ return new Chore(
57
+ choreAsDict.Name,
58
+ ChoreStartTime.fromString(choreAsDict.StartTime),
59
+ choreAsDict.DSTSensitive,
60
+ choreAsDict.Active,
61
+ choreAsDict.ExecutionMode,
62
+ ChoreFrequency.fromString(choreAsDict.Frequency),
63
+ choreAsDict.Tasks.map((task: any, step: number) =>
64
+ ChoreTask.fromDict(task, step))
65
+ );
66
+ }
67
+
68
+ public get name(): string {
69
+ return this._name;
70
+ }
71
+
72
+ public set name(name: string) {
73
+ this._name = name;
74
+ }
75
+
76
+ public get startTime(): ChoreStartTime {
77
+ return this._startTime;
78
+ }
79
+
80
+ public set startTime(startTime: ChoreStartTime) {
81
+ this._startTime = startTime;
82
+ }
83
+
84
+ public get dstSensitivity(): boolean {
85
+ return this._dstSensitivity;
86
+ }
87
+
88
+ public set dstSensitivity(dstSensitivity: boolean) {
89
+ this._dstSensitivity = dstSensitivity;
90
+ }
91
+
92
+ public get active(): boolean {
93
+ return this._active;
94
+ }
95
+
96
+ public get executionMode(): string {
97
+ return this._executionMode;
98
+ }
99
+
100
+ public set executionMode(executionMode: string) {
101
+ this._executionMode = executionMode;
102
+ }
103
+
104
+ public get frequency(): ChoreFrequency {
105
+ return this._frequency;
106
+ }
107
+
108
+ public set frequency(frequency: ChoreFrequency) {
109
+ this._frequency = frequency;
110
+ }
111
+
112
+ public get tasks(): ChoreTask[] {
113
+ return this._tasks;
114
+ }
115
+
116
+ public set tasks(tasks: ChoreTask[]) {
117
+ this._tasks = tasks;
118
+ }
119
+
120
+ public addTask(task: ChoreTask): void {
121
+ this._tasks.push(task);
122
+ }
123
+
124
+ public removeTask(step: number): ChoreTask | undefined {
125
+ if (step >= 0 && step < this._tasks.length) {
126
+ return this._tasks.splice(step, 1)[0];
127
+ }
128
+ return undefined;
129
+ }
130
+
131
+ public get body(): string {
132
+ return JSON.stringify(this.constructBody());
133
+ }
134
+
135
+ public get bodyAsDict(): any {
136
+ return this.constructBody();
137
+ }
138
+
139
+ private constructBody(): any {
140
+ const body: any = {};
141
+ body.Name = this._name;
142
+ body.StartTime = this._startTime.toString();
143
+ body.DSTSensitive = this._dstSensitivity;
144
+ body.Active = this._active;
145
+ body.ExecutionMode = this._executionMode;
146
+ body.Frequency = this._frequency.toString();
147
+ body.Tasks = this._tasks.map(task => task.bodyAsDict);
148
+ return body;
149
+ }
150
+
151
+ public reschedule(frequency: ChoreFrequency, startTime?: ChoreStartTime): void {
152
+ /** Reschedule the chore
153
+ *
154
+ * :param frequency: new ChoreFrequency
155
+ * :param start_time: new ChoreStartTime (optional)
156
+ */
157
+ this._frequency = frequency;
158
+ if (startTime) {
159
+ this._startTime = startTime;
160
+ }
161
+ }
162
+
163
+ public activate(): void {
164
+ /** Activate the chore
165
+ */
166
+ this._active = true;
167
+ }
168
+
169
+ public deactivate(): void {
170
+ /** Deactivate the chore
171
+ */
172
+ this._active = false;
173
+ }
174
+ }
@@ -0,0 +1,83 @@
1
+ import { TM1Object } from './TM1Object';
2
+
3
+ export class ChoreFrequency extends TM1Object {
4
+ /** Utility class to handle time representation fore Chore Frequency
5
+ */
6
+
7
+ private _days: string;
8
+ private _hours: string;
9
+ private _minutes: string;
10
+ private _seconds: string;
11
+
12
+ constructor(days: string | number, hours: string | number, minutes: string | number, seconds: string | number) {
13
+ super();
14
+ this._days = String(days).padStart(2, '0');
15
+ this._hours = String(hours).padStart(2, '0');
16
+ this._minutes = String(minutes).padStart(2, '0');
17
+ this._seconds = String(seconds).padStart(2, '0');
18
+ }
19
+
20
+ public get days(): string {
21
+ return this._days;
22
+ }
23
+
24
+ public get hours(): string {
25
+ return this._hours;
26
+ }
27
+
28
+ public get minutes(): string {
29
+ return this._minutes;
30
+ }
31
+
32
+ public get seconds(): string {
33
+ return this._seconds;
34
+ }
35
+
36
+ public set days(value: string | number) {
37
+ this._days = String(value).padStart(2, '0');
38
+ }
39
+
40
+ public set hours(value: string | number) {
41
+ this._hours = String(value).padStart(2, '0');
42
+ }
43
+
44
+ public set minutes(value: string | number) {
45
+ this._minutes = String(value).padStart(2, '0');
46
+ }
47
+
48
+ public set seconds(value: string | number) {
49
+ this._seconds = String(value).padStart(2, '0');
50
+ }
51
+
52
+ public static fromString(frequencyString: string): ChoreFrequency {
53
+ const posDt = frequencyString.indexOf('DT', 1);
54
+ const posH = frequencyString.indexOf('H', posDt);
55
+ const posM = frequencyString.indexOf('M', posH);
56
+ const posS = frequencyString.length - 1;
57
+
58
+ return new ChoreFrequency(
59
+ frequencyString.substring(1, posDt),
60
+ frequencyString.substring(posDt + 2, posH),
61
+ frequencyString.substring(posH + 1, posM),
62
+ frequencyString.substring(posM + 1, posS)
63
+ );
64
+ }
65
+
66
+ public get frequencyString(): string {
67
+ return `P${this._days}DT${this._hours}H${this._minutes}M${this._seconds}S`;
68
+ }
69
+
70
+ public get body(): string {
71
+ return JSON.stringify({
72
+ Days: this._days,
73
+ Hours: this._hours,
74
+ Minutes: this._minutes,
75
+ Seconds: this._seconds,
76
+ FrequencyString: this.frequencyString
77
+ });
78
+ }
79
+
80
+ public toString(): string {
81
+ return this.frequencyString;
82
+ }
83
+ }
@@ -0,0 +1,111 @@
1
+ export class ChoreStartTime {
2
+ /** Utility class to handle time representation for Chore Start Time
3
+ */
4
+
5
+ private _datetime: Date;
6
+ public tz?: string;
7
+
8
+ constructor(year: number, month: number, day: number, hour: number, minute: number, second: number, tz?: string) {
9
+ /**
10
+ * :param year: year
11
+ * :param month: month
12
+ * :param day: day
13
+ * :param hour: hour or None
14
+ * :param minute: minute or None
15
+ * :param second: second or None
16
+ */
17
+ this._datetime = new Date(year, month - 1, day, hour, minute, second); // month is 0-indexed in JS
18
+ this.tz = tz;
19
+ }
20
+
21
+ public static fromString(startTimeString: string): ChoreStartTime {
22
+ // extract optional tz info (e.g., +01:00) from string end
23
+ let tz: string | undefined;
24
+ if (startTimeString.includes('+')) {
25
+ // case "2020-11-05T08:00:01+01:00",
26
+ tz = "+" + startTimeString.split('+')[1];
27
+ } else if (startTimeString.split('-').length === 4) {
28
+ // case: "2020-11-05T08:00:01-01:00",
29
+ const parts = startTimeString.split('-');
30
+ tz = "-" + parts[parts.length - 1];
31
+ } else {
32
+ tz = undefined;
33
+ }
34
+
35
+ // f to handle strange timestamp 2016-09-25T20:25Z instead of common 2016-09-25T20:25:00Z
36
+ // second is defaulted to 0 if not specified in the chore schedule
37
+ const f = (x: string | undefined): number => x ? parseInt(x) : 0;
38
+
39
+ return new ChoreStartTime(
40
+ f(startTimeString.substring(0, 4)),
41
+ f(startTimeString.substring(5, 7)),
42
+ f(startTimeString.substring(8, 10)),
43
+ f(startTimeString.substring(11, 13)),
44
+ f(startTimeString.substring(14, 16)),
45
+ startTimeString[16] !== ":" ? 0 : f(startTimeString.substring(17, 19)),
46
+ tz
47
+ );
48
+ }
49
+
50
+ public get startTimeString(): string {
51
+ // produce timestamp 2016-09-25T20:25:00Z instead of common 2016-09-25T20:25Z where no seconds are specified
52
+ const year = this._datetime.getFullYear().toString().padStart(4, '0');
53
+ const month = (this._datetime.getMonth() + 1).toString().padStart(2, '0');
54
+ const day = this._datetime.getDate().toString().padStart(2, '0');
55
+ const hour = this._datetime.getHours().toString().padStart(2, '0');
56
+ const minute = this._datetime.getMinutes().toString().padStart(2, '0');
57
+ const second = this._datetime.getSeconds().toString().padStart(2, '0');
58
+
59
+ let startTime = `${year}-${month}-${day}T${hour}:${minute}:${second}`;
60
+
61
+ if (this.tz) {
62
+ startTime += this.tz;
63
+ } else {
64
+ startTime += "Z";
65
+ }
66
+
67
+ return startTime;
68
+ }
69
+
70
+ public get datetime(): Date {
71
+ return this._datetime;
72
+ }
73
+
74
+ public toString(): string {
75
+ return this.startTimeString;
76
+ }
77
+
78
+ public setTime(
79
+ year?: number,
80
+ month?: number,
81
+ day?: number,
82
+ hour?: number,
83
+ minute?: number,
84
+ second?: number
85
+ ): void {
86
+ const _year = year !== undefined ? year : this._datetime.getFullYear();
87
+ const _month = month !== undefined ? month - 1 : this._datetime.getMonth(); // month is 0-indexed
88
+ const _day = day !== undefined ? day : this._datetime.getDate();
89
+ const _hour = hour !== undefined ? hour : this._datetime.getHours();
90
+ const _minute = minute !== undefined ? minute : this._datetime.getMinutes();
91
+ const _second = second !== undefined ? second : this._datetime.getSeconds();
92
+
93
+ this._datetime = new Date(_year, _month, _day, _hour, _minute, _second);
94
+ }
95
+
96
+ public add(days: number = 0, hours: number = 0, minutes: number = 0, seconds: number = 0): void {
97
+ const totalMs = days * 24 * 60 * 60 * 1000 +
98
+ hours * 60 * 60 * 1000 +
99
+ minutes * 60 * 1000 +
100
+ seconds * 1000;
101
+ this._datetime = new Date(this._datetime.getTime() + totalMs);
102
+ }
103
+
104
+ public subtract(days: number = 0, hours: number = 0, minutes: number = 0, seconds: number = 0): void {
105
+ const totalMs = days * 24 * 60 * 60 * 1000 +
106
+ hours * 60 * 60 * 1000 +
107
+ minutes * 60 * 1000 +
108
+ seconds * 1000;
109
+ this._datetime = new Date(this._datetime.getTime() - totalMs);
110
+ }
111
+ }