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.
- package/.env.example +16 -0
- package/.eslintrc.js +28 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +36 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/.github/ISSUE_TEMPLATE/question.md +24 -0
- package/.github/workflows/publish-npm.yml +53 -0
- package/.github/workflows/test-on-tag.yml +172 -0
- package/DEVELOPMENT_GUIDE.md +587 -0
- package/LICENSE +21 -0
- package/README.md +580 -0
- package/jest.ci.config.js +83 -0
- package/jest.config.js +68 -0
- package/lib/exceptions/TM1Exception.d.ts +17 -0
- package/lib/exceptions/TM1Exception.d.ts.map +1 -0
- package/lib/exceptions/TM1Exception.js +36 -0
- package/lib/exceptions/TM1RestException.d.ts +10 -0
- package/lib/exceptions/TM1RestException.d.ts.map +1 -0
- package/lib/exceptions/TM1RestException.js +17 -0
- package/lib/exceptions/TM1TimeoutException.d.ts +9 -0
- package/lib/exceptions/TM1TimeoutException.d.ts.map +1 -0
- package/lib/exceptions/TM1TimeoutException.js +16 -0
- package/lib/index.d.ts +41 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +132 -0
- package/lib/objects/Annotation.d.ts +36 -0
- package/lib/objects/Annotation.d.ts.map +1 -0
- package/lib/objects/Annotation.js +134 -0
- package/lib/objects/Application.d.ts +67 -0
- package/lib/objects/Application.d.ts.map +1 -0
- package/lib/objects/Application.js +125 -0
- package/lib/objects/Axis.d.ts +36 -0
- package/lib/objects/Axis.d.ts.map +1 -0
- package/lib/objects/Axis.js +103 -0
- package/lib/objects/Chore.d.ts +43 -0
- package/lib/objects/Chore.d.ts.map +1 -0
- package/lib/objects/Chore.js +129 -0
- package/lib/objects/ChoreFrequency.d.ts +23 -0
- package/lib/objects/ChoreFrequency.d.ts.map +1 -0
- package/lib/objects/ChoreFrequency.js +61 -0
- package/lib/objects/ChoreStartTime.d.ts +15 -0
- package/lib/objects/ChoreStartTime.d.ts.map +1 -0
- package/lib/objects/ChoreStartTime.js +85 -0
- package/lib/objects/ChoreTask.d.ts +28 -0
- package/lib/objects/ChoreTask.d.ts.map +1 -0
- package/lib/objects/ChoreTask.js +66 -0
- package/lib/objects/Cube.d.ts +26 -0
- package/lib/objects/Cube.d.ts.map +1 -0
- package/lib/objects/Cube.js +109 -0
- package/lib/objects/Dimension.d.ts +26 -0
- package/lib/objects/Dimension.d.ts.map +1 -0
- package/lib/objects/Dimension.js +86 -0
- package/lib/objects/Element.d.ts +35 -0
- package/lib/objects/Element.d.ts.map +1 -0
- package/lib/objects/Element.js +115 -0
- package/lib/objects/ElementAttribute.d.ts +28 -0
- package/lib/objects/ElementAttribute.d.ts.map +1 -0
- package/lib/objects/ElementAttribute.js +97 -0
- package/lib/objects/Git.d.ts +21 -0
- package/lib/objects/Git.d.ts.map +1 -0
- package/lib/objects/Git.js +49 -0
- package/lib/objects/GitCommit.d.ts +12 -0
- package/lib/objects/GitCommit.d.ts.map +1 -0
- package/lib/objects/GitCommit.js +26 -0
- package/lib/objects/GitPlan.d.ts +35 -0
- package/lib/objects/GitPlan.d.ts.map +1 -0
- package/lib/objects/GitPlan.js +78 -0
- package/lib/objects/GitRemote.d.ts +12 -0
- package/lib/objects/GitRemote.d.ts.map +1 -0
- package/lib/objects/GitRemote.js +26 -0
- package/lib/objects/Hierarchy.d.ts +47 -0
- package/lib/objects/Hierarchy.d.ts.map +1 -0
- package/lib/objects/Hierarchy.js +165 -0
- package/lib/objects/MDXView.d.ts +19 -0
- package/lib/objects/MDXView.d.ts.map +1 -0
- package/lib/objects/MDXView.js +67 -0
- package/lib/objects/NativeView.d.ts +39 -0
- package/lib/objects/NativeView.d.ts.map +1 -0
- package/lib/objects/NativeView.js +209 -0
- package/lib/objects/Process.d.ts +70 -0
- package/lib/objects/Process.d.ts.map +1 -0
- package/lib/objects/Process.js +210 -0
- package/lib/objects/ProcessDebugBreakpoint.d.ts +60 -0
- package/lib/objects/ProcessDebugBreakpoint.d.ts.map +1 -0
- package/lib/objects/ProcessDebugBreakpoint.js +168 -0
- package/lib/objects/ProcessParameter.d.ts +23 -0
- package/lib/objects/ProcessParameter.d.ts.map +1 -0
- package/lib/objects/ProcessParameter.js +55 -0
- package/lib/objects/ProcessVariable.d.ts +26 -0
- package/lib/objects/ProcessVariable.d.ts.map +1 -0
- package/lib/objects/ProcessVariable.js +63 -0
- package/lib/objects/Rules.d.ts +30 -0
- package/lib/objects/Rules.d.ts.map +1 -0
- package/lib/objects/Rules.js +103 -0
- package/lib/objects/Sandbox.d.ts +21 -0
- package/lib/objects/Sandbox.d.ts.map +1 -0
- package/lib/objects/Sandbox.js +64 -0
- package/lib/objects/Server.d.ts +27 -0
- package/lib/objects/Server.d.ts.map +1 -0
- package/lib/objects/Server.js +26 -0
- package/lib/objects/Subset.d.ts +44 -0
- package/lib/objects/Subset.d.ts.map +1 -0
- package/lib/objects/Subset.js +222 -0
- package/lib/objects/TM1Object.d.ts +8 -0
- package/lib/objects/TM1Object.d.ts.map +1 -0
- package/lib/objects/TM1Object.js +17 -0
- package/lib/objects/TM1Project.d.ts +74 -0
- package/lib/objects/TM1Project.d.ts.map +1 -0
- package/lib/objects/TM1Project.js +409 -0
- package/lib/objects/User.d.ts +42 -0
- package/lib/objects/User.d.ts.map +1 -0
- package/lib/objects/User.js +157 -0
- package/lib/objects/View.d.ts +19 -0
- package/lib/objects/View.d.ts.map +1 -0
- package/lib/objects/View.js +33 -0
- package/lib/objects/index.d.ts +30 -0
- package/lib/objects/index.d.ts.map +1 -0
- package/lib/objects/index.js +68 -0
- package/lib/services/AnnotationService.d.ts +17 -0
- package/lib/services/AnnotationService.d.ts.map +1 -0
- package/lib/services/AnnotationService.js +91 -0
- package/lib/services/ApplicationService.d.ts +21 -0
- package/lib/services/ApplicationService.d.ts.map +1 -0
- package/lib/services/ApplicationService.js +227 -0
- package/lib/services/AuditLogService.d.ts +15 -0
- package/lib/services/AuditLogService.d.ts.map +1 -0
- package/lib/services/AuditLogService.js +153 -0
- package/lib/services/CellService.d.ts +191 -0
- package/lib/services/CellService.d.ts.map +1 -0
- package/lib/services/CellService.js +597 -0
- package/lib/services/ChoreService.d.ts +24 -0
- package/lib/services/ChoreService.d.ts.map +1 -0
- package/lib/services/ChoreService.js +219 -0
- package/lib/services/ConfigurationService.d.ts +18 -0
- package/lib/services/ConfigurationService.d.ts.map +1 -0
- package/lib/services/ConfigurationService.js +60 -0
- package/lib/services/CubeService.d.ts +43 -0
- package/lib/services/CubeService.d.ts.map +1 -0
- package/lib/services/CubeService.js +296 -0
- package/lib/services/DimensionService.d.ts +21 -0
- package/lib/services/DimensionService.d.ts.map +1 -0
- package/lib/services/DimensionService.js +146 -0
- package/lib/services/ElementService.d.ts +132 -0
- package/lib/services/ElementService.d.ts.map +1 -0
- package/lib/services/ElementService.js +579 -0
- package/lib/services/FileService.d.ts +14 -0
- package/lib/services/FileService.d.ts.map +1 -0
- package/lib/services/FileService.js +65 -0
- package/lib/services/GitService.d.ts +23 -0
- package/lib/services/GitService.d.ts.map +1 -0
- package/lib/services/GitService.js +225 -0
- package/lib/services/HierarchyService.d.ts +32 -0
- package/lib/services/HierarchyService.d.ts.map +1 -0
- package/lib/services/HierarchyService.js +235 -0
- package/lib/services/JobService.d.ts +13 -0
- package/lib/services/JobService.d.ts.map +1 -0
- package/lib/services/JobService.js +83 -0
- package/lib/services/LoggerService.d.ts +16 -0
- package/lib/services/LoggerService.d.ts.map +1 -0
- package/lib/services/LoggerService.js +101 -0
- package/lib/services/ManageService.d.ts +47 -0
- package/lib/services/ManageService.d.ts.map +1 -0
- package/lib/services/ManageService.js +221 -0
- package/lib/services/MessageLogService.d.ts +13 -0
- package/lib/services/MessageLogService.d.ts.map +1 -0
- package/lib/services/MessageLogService.js +175 -0
- package/lib/services/MonitoringService.d.ts +29 -0
- package/lib/services/MonitoringService.d.ts.map +1 -0
- package/lib/services/MonitoringService.js +86 -0
- package/lib/services/ObjectService.d.ts +8 -0
- package/lib/services/ObjectService.d.ts.map +1 -0
- package/lib/services/ObjectService.js +20 -0
- package/lib/services/PowerBiService.d.ts +13 -0
- package/lib/services/PowerBiService.d.ts.map +1 -0
- package/lib/services/PowerBiService.js +52 -0
- package/lib/services/ProcessService.d.ts +57 -0
- package/lib/services/ProcessService.d.ts.map +1 -0
- package/lib/services/ProcessService.js +499 -0
- package/lib/services/RestService.d.ts +68 -0
- package/lib/services/RestService.d.ts.map +1 -0
- package/lib/services/RestService.js +166 -0
- package/lib/services/SandboxService.d.ts +28 -0
- package/lib/services/SandboxService.d.ts.map +1 -0
- package/lib/services/SandboxService.js +197 -0
- package/lib/services/SecurityService.d.ts +33 -0
- package/lib/services/SecurityService.d.ts.map +1 -0
- package/lib/services/SecurityService.js +249 -0
- package/lib/services/ServerService.d.ts +55 -0
- package/lib/services/ServerService.d.ts.map +1 -0
- package/lib/services/ServerService.js +247 -0
- package/lib/services/SessionService.d.ts +15 -0
- package/lib/services/SessionService.d.ts.map +1 -0
- package/lib/services/SessionService.js +68 -0
- package/lib/services/SubsetService.d.ts +13 -0
- package/lib/services/SubsetService.d.ts.map +1 -0
- package/lib/services/SubsetService.js +46 -0
- package/lib/services/TM1Service.d.ts +39 -0
- package/lib/services/TM1Service.d.ts.map +1 -0
- package/lib/services/TM1Service.js +94 -0
- package/lib/services/ThreadService.d.ts +15 -0
- package/lib/services/ThreadService.d.ts.map +1 -0
- package/lib/services/ThreadService.js +104 -0
- package/lib/services/TransactionLogService.d.ts +11 -0
- package/lib/services/TransactionLogService.d.ts.map +1 -0
- package/lib/services/TransactionLogService.js +124 -0
- package/lib/services/UserService.d.ts +14 -0
- package/lib/services/UserService.d.ts.map +1 -0
- package/lib/services/UserService.js +103 -0
- package/lib/services/ViewService.d.ts +30 -0
- package/lib/services/ViewService.d.ts.map +1 -0
- package/lib/services/ViewService.js +331 -0
- package/lib/services/index.d.ts +26 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +56 -0
- package/lib/tests/100PercentParityCheck.test.d.ts +6 -0
- package/lib/tests/100PercentParityCheck.test.d.ts.map +1 -0
- package/lib/tests/100PercentParityCheck.test.js +143 -0
- package/lib/tests/basic.test.d.ts +6 -0
- package/lib/tests/basic.test.d.ts.map +1 -0
- package/lib/tests/basic.test.js +52 -0
- package/lib/tests/cellService.test.d.ts +6 -0
- package/lib/tests/cellService.test.d.ts.map +1 -0
- package/lib/tests/cellService.test.js +311 -0
- package/lib/tests/ciSetup.d.ts +6 -0
- package/lib/tests/ciSetup.d.ts.map +1 -0
- package/lib/tests/ciSetup.js +23 -0
- package/lib/tests/comprehensive.service.test.d.ts +6 -0
- package/lib/tests/comprehensive.service.test.d.ts.map +1 -0
- package/lib/tests/comprehensive.service.test.js +507 -0
- package/lib/tests/connection.test.d.ts +6 -0
- package/lib/tests/connection.test.d.ts.map +1 -0
- package/lib/tests/connection.test.js +89 -0
- package/lib/tests/cubeService.test.d.ts +6 -0
- package/lib/tests/cubeService.test.d.ts.map +1 -0
- package/lib/tests/cubeService.test.js +368 -0
- package/lib/tests/dimensionService.comprehensive.test.d.ts +7 -0
- package/lib/tests/dimensionService.comprehensive.test.d.ts.map +1 -0
- package/lib/tests/dimensionService.comprehensive.test.js +614 -0
- package/lib/tests/dimensionService.test.d.ts +6 -0
- package/lib/tests/dimensionService.test.d.ts.map +1 -0
- package/lib/tests/dimensionService.test.js +293 -0
- package/lib/tests/edgeCases.test.d.ts +6 -0
- package/lib/tests/edgeCases.test.d.ts.map +1 -0
- package/lib/tests/edgeCases.test.js +301 -0
- package/lib/tests/elementService.comprehensive.test.d.ts +7 -0
- package/lib/tests/elementService.comprehensive.test.d.ts.map +1 -0
- package/lib/tests/elementService.comprehensive.test.js +846 -0
- package/lib/tests/elementService.test.d.ts +6 -0
- package/lib/tests/elementService.test.d.ts.map +1 -0
- package/lib/tests/elementService.test.js +350 -0
- package/lib/tests/enhancedCellService.test.d.ts +2 -0
- package/lib/tests/enhancedCellService.test.d.ts.map +1 -0
- package/lib/tests/enhancedCellService.test.js +152 -0
- package/lib/tests/enhancedCubeService.test.d.ts +2 -0
- package/lib/tests/enhancedCubeService.test.d.ts.map +1 -0
- package/lib/tests/enhancedCubeService.test.js +246 -0
- package/lib/tests/enhancedElementService.test.d.ts +2 -0
- package/lib/tests/enhancedElementService.test.d.ts.map +1 -0
- package/lib/tests/enhancedElementService.test.js +199 -0
- package/lib/tests/enhancedViewService.test.d.ts +2 -0
- package/lib/tests/enhancedViewService.test.d.ts.map +1 -0
- package/lib/tests/enhancedViewService.test.js +260 -0
- package/lib/tests/errorHandling.test.d.ts +6 -0
- package/lib/tests/errorHandling.test.d.ts.map +1 -0
- package/lib/tests/errorHandling.test.js +227 -0
- package/lib/tests/exceptions.test.d.ts +7 -0
- package/lib/tests/exceptions.test.d.ts.map +1 -0
- package/lib/tests/exceptions.test.js +257 -0
- package/lib/tests/hierarchyService.test.d.ts +6 -0
- package/lib/tests/hierarchyService.test.d.ts.map +1 -0
- package/lib/tests/hierarchyService.test.js +294 -0
- package/lib/tests/index.test.d.ts +6 -0
- package/lib/tests/index.test.d.ts.map +1 -0
- package/lib/tests/index.test.js +346 -0
- package/lib/tests/integration.test.d.ts +6 -0
- package/lib/tests/integration.test.d.ts.map +1 -0
- package/lib/tests/integration.test.js +302 -0
- package/lib/tests/integrationTests.test.d.ts +2 -0
- package/lib/tests/integrationTests.test.d.ts.map +1 -0
- package/lib/tests/integrationTests.test.js +252 -0
- package/lib/tests/mdx.advanced.test.d.ts +6 -0
- package/lib/tests/mdx.advanced.test.d.ts.map +1 -0
- package/lib/tests/mdx.advanced.test.js +437 -0
- package/lib/tests/objects.improved.test.d.ts +7 -0
- package/lib/tests/objects.improved.test.d.ts.map +1 -0
- package/lib/tests/objects.improved.test.js +302 -0
- package/lib/tests/performance.test.d.ts +6 -0
- package/lib/tests/performance.test.d.ts.map +1 -0
- package/lib/tests/performance.test.js +264 -0
- package/lib/tests/processService.comprehensive.test.d.ts +7 -0
- package/lib/tests/processService.comprehensive.test.d.ts.map +1 -0
- package/lib/tests/processService.comprehensive.test.js +656 -0
- package/lib/tests/processService.test.d.ts +6 -0
- package/lib/tests/processService.test.d.ts.map +1 -0
- package/lib/tests/processService.test.js +322 -0
- package/lib/tests/restService.test.d.ts +6 -0
- package/lib/tests/restService.test.d.ts.map +1 -0
- package/lib/tests/restService.test.js +177 -0
- package/lib/tests/security.advanced.test.d.ts +6 -0
- package/lib/tests/security.advanced.test.d.ts.map +1 -0
- package/lib/tests/security.advanced.test.js +407 -0
- package/lib/tests/security.test.d.ts +6 -0
- package/lib/tests/security.test.d.ts.map +1 -0
- package/lib/tests/security.test.js +204 -0
- package/lib/tests/securityService.comprehensive.test.d.ts +7 -0
- package/lib/tests/securityService.comprehensive.test.d.ts.map +1 -0
- package/lib/tests/securityService.comprehensive.test.js +457 -0
- package/lib/tests/setup.d.ts +4 -0
- package/lib/tests/setup.d.ts.map +1 -0
- package/lib/tests/setup.js +40 -0
- package/lib/tests/simpleCoverage.test.d.ts +6 -0
- package/lib/tests/simpleCoverage.test.d.ts.map +1 -0
- package/lib/tests/simpleCoverage.test.js +236 -0
- package/lib/tests/stress.performance.test.d.ts +6 -0
- package/lib/tests/stress.performance.test.d.ts.map +1 -0
- package/lib/tests/stress.performance.test.js +423 -0
- package/lib/tests/subsetService.test.d.ts +6 -0
- package/lib/tests/subsetService.test.d.ts.map +1 -0
- package/lib/tests/subsetService.test.js +271 -0
- package/lib/tests/testConfig.d.ts +18 -0
- package/lib/tests/testConfig.d.ts.map +1 -0
- package/lib/tests/testConfig.js +38 -0
- package/lib/tests/testUtils.d.ts +9 -0
- package/lib/tests/testUtils.d.ts.map +1 -0
- package/lib/tests/testUtils.js +100 -0
- package/lib/tests/tm1Service.test.d.ts +7 -0
- package/lib/tests/tm1Service.test.d.ts.map +1 -0
- package/lib/tests/tm1Service.test.js +290 -0
- package/lib/tests/viewService.test.d.ts +6 -0
- package/lib/tests/viewService.test.d.ts.map +1 -0
- package/lib/tests/viewService.test.js +240 -0
- package/lib/utils/Utils.d.ts +90 -0
- package/lib/utils/Utils.d.ts.map +1 -0
- package/lib/utils/Utils.js +379 -0
- package/package.json +81 -0
- package/run-all-tests.js +296 -0
- package/src/exceptions/TM1Exception.ts +38 -0
- package/src/exceptions/TM1RestException.ts +17 -0
- package/src/exceptions/TM1TimeoutException.ts +15 -0
- package/src/index.ts +94 -0
- package/src/objects/Annotation.ts +194 -0
- package/src/objects/Application.ts +146 -0
- package/src/objects/Axis.ts +149 -0
- package/src/objects/Chore.ts +174 -0
- package/src/objects/ChoreFrequency.ts +83 -0
- package/src/objects/ChoreStartTime.ts +111 -0
- package/src/objects/ChoreTask.ts +92 -0
- package/src/objects/Cube.ts +125 -0
- package/src/objects/Dimension.ts +107 -0
- package/src/objects/Element.ts +153 -0
- package/src/objects/ElementAttribute.ts +115 -0
- package/src/objects/Git.ts +86 -0
- package/src/objects/GitCommit.ts +31 -0
- package/src/objects/GitPlan.ts +121 -0
- package/src/objects/GitRemote.ts +31 -0
- package/src/objects/Hierarchy.ts +229 -0
- package/src/objects/MDXView.ts +91 -0
- package/src/objects/NativeView.ts +268 -0
- package/src/objects/Process.ts +320 -0
- package/src/objects/ProcessDebugBreakpoint.ts +239 -0
- package/src/objects/ProcessParameter.ts +76 -0
- package/src/objects/ProcessVariable.ts +89 -0
- package/src/objects/Rules.ts +117 -0
- package/src/objects/Sandbox.ts +90 -0
- package/src/objects/Server.ts +45 -0
- package/src/objects/Subset.ts +323 -0
- package/src/objects/TM1Object.ts +17 -0
- package/src/objects/TM1Project.ts +587 -0
- package/src/objects/User.ts +198 -0
- package/src/objects/View.ts +43 -0
- package/src/objects/index.ts +36 -0
- package/src/services/AnnotationService.ts +107 -0
- package/src/services/ApplicationService.ts +279 -0
- package/src/services/AuditLogService.ts +172 -0
- package/src/services/CellService.ts +814 -0
- package/src/services/ChoreService.ts +219 -0
- package/src/services/ConfigurationService.ts +69 -0
- package/src/services/CubeService.ts +338 -0
- package/src/services/DimensionService.ts +168 -0
- package/src/services/ElementService.ts +966 -0
- package/src/services/FileService.ts +67 -0
- package/src/services/GitService.ts +324 -0
- package/src/services/HierarchyService.ts +284 -0
- package/src/services/JobService.ts +59 -0
- package/src/services/LoggerService.ts +118 -0
- package/src/services/ManageService.ts +322 -0
- package/src/services/MessageLogService.ts +211 -0
- package/src/services/MonitoringService.ts +105 -0
- package/src/services/ObjectService.ts +21 -0
- package/src/services/PowerBiService.ts +85 -0
- package/src/services/ProcessService.ts +589 -0
- package/src/services/RestService.ts +224 -0
- package/src/services/SandboxService.ts +217 -0
- package/src/services/SecurityService.ts +284 -0
- package/src/services/ServerService.ts +313 -0
- package/src/services/SessionService.ts +81 -0
- package/src/services/SubsetService.ts +52 -0
- package/src/services/TM1Service.ts +133 -0
- package/src/services/ThreadService.ts +83 -0
- package/src/services/TransactionLogService.ts +148 -0
- package/src/services/UserService.ts +77 -0
- package/src/services/ViewService.ts +398 -0
- package/src/services/index.ts +28 -0
- package/src/tests/100PercentParityCheck.test.ts +166 -0
- package/src/tests/basic.test.ts +59 -0
- package/src/tests/cellService.test.ts +405 -0
- package/src/tests/ciSetup.ts +26 -0
- package/src/tests/comprehensive.service.test.ts +653 -0
- package/src/tests/config.ini.template +23 -0
- package/src/tests/connection.test.ts +90 -0
- package/src/tests/cubeService.test.ts +458 -0
- package/src/tests/dimensionService.comprehensive.test.ts +786 -0
- package/src/tests/dimensionService.test.ts +373 -0
- package/src/tests/edgeCases.test.ts +358 -0
- package/src/tests/elementService.comprehensive.test.ts +1190 -0
- package/src/tests/elementService.test.ts +472 -0
- package/src/tests/enhancedCellService.test.ts +237 -0
- package/src/tests/enhancedCubeService.test.ts +384 -0
- package/src/tests/enhancedElementService.test.ts +301 -0
- package/src/tests/enhancedViewService.test.ts +373 -0
- package/src/tests/errorHandling.test.ts +264 -0
- package/src/tests/exceptions.test.ts +313 -0
- package/src/tests/hierarchyService.test.ts +386 -0
- package/src/tests/index.test.ts +376 -0
- package/src/tests/integration.test.ts +333 -0
- package/src/tests/integrationTests.test.ts +302 -0
- package/src/tests/mdx.advanced.test.ts +513 -0
- package/src/tests/objects.improved.test.ts +385 -0
- package/src/tests/performance.test.ts +314 -0
- package/src/tests/processService.comprehensive.test.ts +933 -0
- package/src/tests/processService.test.ts +409 -0
- package/src/tests/restService.test.ts +218 -0
- package/src/tests/security.advanced.test.ts +464 -0
- package/src/tests/security.test.ts +233 -0
- package/src/tests/securityService.comprehensive.test.ts +582 -0
- package/src/tests/setup.ts +42 -0
- package/src/tests/simpleCoverage.test.ts +287 -0
- package/src/tests/stress.performance.test.ts +531 -0
- package/src/tests/subsetService.test.ts +350 -0
- package/src/tests/testConfig.ts +53 -0
- package/src/tests/testUtils.ts +94 -0
- package/src/tests/tm1Service.test.ts +361 -0
- package/src/tests/viewService.test.ts +324 -0
- package/src/utils/Utils.ts +395 -0
- package/tests/README.md +57 -0
- package/tests/connection/test-connection.ts +86 -0
- package/tests/edge-cases/edge-cases-test.ts +244 -0
- package/tests/integration/working-test.ts +193 -0
- package/tests/performance/performance-test.ts +133 -0
- package/tests/run-all-tests.sh +106 -0
- package/tests/security/security-test.ts +103 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { TM1Object } from './TM1Object';
|
|
2
|
+
import { CaseAndSpaceInsensitiveSet, formatUrl } from '../utils/Utils';
|
|
3
|
+
|
|
4
|
+
export enum UserType {
|
|
5
|
+
User = 0,
|
|
6
|
+
SecurityAdmin = 1,
|
|
7
|
+
DataAdmin = 2,
|
|
8
|
+
Admin = 3,
|
|
9
|
+
OperationsAdmin = 4
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class User extends TM1Object {
|
|
13
|
+
/** Abstraction of a TM1 User
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
private _name: string;
|
|
18
|
+
private _groups: CaseAndSpaceInsensitiveSet;
|
|
19
|
+
private _friendlyName?: string;
|
|
20
|
+
private _password?: string;
|
|
21
|
+
private _enabled?: boolean;
|
|
22
|
+
private _userType: UserType = UserType.User;
|
|
23
|
+
|
|
24
|
+
constructor(
|
|
25
|
+
name: string,
|
|
26
|
+
groups: Iterable<string>,
|
|
27
|
+
friendlyName?: string,
|
|
28
|
+
password?: string,
|
|
29
|
+
userType?: UserType | string,
|
|
30
|
+
enabled?: boolean
|
|
31
|
+
) {
|
|
32
|
+
super();
|
|
33
|
+
this._name = name;
|
|
34
|
+
this._groups = new CaseAndSpaceInsensitiveSet();
|
|
35
|
+
for (const group of groups) {
|
|
36
|
+
this._groups.add(group);
|
|
37
|
+
}
|
|
38
|
+
this._friendlyName = friendlyName;
|
|
39
|
+
this._password = password;
|
|
40
|
+
this._enabled = enabled;
|
|
41
|
+
|
|
42
|
+
// determine user_type
|
|
43
|
+
if (userType === undefined) {
|
|
44
|
+
if (this._groups.has(UserType.Admin.toString())) {
|
|
45
|
+
this.userType = UserType.Admin;
|
|
46
|
+
} else if (this._groups.has(UserType.SecurityAdmin.toString())) {
|
|
47
|
+
this.userType = UserType.SecurityAdmin;
|
|
48
|
+
} else if (this._groups.has(UserType.DataAdmin.toString())) {
|
|
49
|
+
this.userType = UserType.DataAdmin;
|
|
50
|
+
} else if (this._groups.has(UserType.OperationsAdmin.toString())) {
|
|
51
|
+
this.userType = UserType.OperationsAdmin;
|
|
52
|
+
} else {
|
|
53
|
+
this.userType = UserType.User;
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
this.userType = userType;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public get name(): string {
|
|
61
|
+
return this._name;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public set name(value: string) {
|
|
65
|
+
this._name = value;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public get userType(): UserType {
|
|
69
|
+
return this._userType;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public set userType(value: UserType | string) {
|
|
73
|
+
if (typeof value === 'string') {
|
|
74
|
+
// Parse string to UserType enum
|
|
75
|
+
const lowerValue = value.replace(/\s+/g, '').toLowerCase();
|
|
76
|
+
for (const [key, enumValue] of Object.entries(UserType)) {
|
|
77
|
+
if (key.toLowerCase() === lowerValue) {
|
|
78
|
+
this._userType = enumValue as UserType;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (this._userType === undefined) {
|
|
83
|
+
throw new Error(`Invalid element type=${value}`);
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
this._userType = value;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// update groups as well, since TM1 doesn't react to change in user_type property
|
|
90
|
+
if (this._userType !== UserType.User) {
|
|
91
|
+
this.addGroup(this._userType.toString());
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
public get friendlyName(): string | undefined {
|
|
96
|
+
return this._friendlyName;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public set friendlyName(value: string | undefined) {
|
|
100
|
+
this._friendlyName = value;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public get password(): string | undefined {
|
|
104
|
+
return this._password;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
public set password(value: string | undefined) {
|
|
108
|
+
this._password = value;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
public get isAdmin(): boolean {
|
|
112
|
+
return this._groups.has("ADMIN");
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
public get isDataAdmin(): boolean {
|
|
116
|
+
return this._groups.has("Admin") || this._groups.has("DataAdmin");
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
public get isSecurityAdmin(): boolean {
|
|
120
|
+
return this._groups.has("Admin") || this._groups.has("SecurityAdmin");
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
public get isOpsAdmin(): boolean {
|
|
124
|
+
return this._groups.has("Admin") || this._groups.has("OperationsAdmin");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
public get groups(): string[] {
|
|
128
|
+
return Array.from(this._groups);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
public get enabled(): boolean | undefined {
|
|
132
|
+
return this._enabled;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
public set enabled(value: boolean | undefined) {
|
|
136
|
+
this._enabled = value;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
public addGroup(groupName: string): void {
|
|
140
|
+
this._groups.add(groupName);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
public removeGroup(groupName: string): void {
|
|
144
|
+
this._groups.delete(groupName);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
public static fromJSON(userAsJson: string): User {
|
|
148
|
+
/** Alternative constructor
|
|
149
|
+
*
|
|
150
|
+
* :param user_as_json: user as JSON string
|
|
151
|
+
* :return: user, an instance of this class
|
|
152
|
+
*/
|
|
153
|
+
const userAsDict = JSON.parse(userAsJson);
|
|
154
|
+
return User.fromDict(userAsDict);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
public static fromDict(userAsDict: any): User {
|
|
158
|
+
/** Alternative constructor
|
|
159
|
+
*
|
|
160
|
+
* :param user_as_dict: user as dict
|
|
161
|
+
* :return: user, an instance of this class
|
|
162
|
+
*/
|
|
163
|
+
return new User(
|
|
164
|
+
userAsDict.Name,
|
|
165
|
+
userAsDict.Groups.map((group: any) => group.Name),
|
|
166
|
+
userAsDict.FriendlyName,
|
|
167
|
+
undefined, // password not included in dict
|
|
168
|
+
userAsDict.Type,
|
|
169
|
+
userAsDict.Enabled
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
public get body(): string {
|
|
174
|
+
return this.constructBody();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
public constructBody(): string {
|
|
178
|
+
/**
|
|
179
|
+
* construct body (json) from the class attributes
|
|
180
|
+
* :return: String, TM1 JSON representation of a user
|
|
181
|
+
*/
|
|
182
|
+
const bodyAsDict: any = {};
|
|
183
|
+
bodyAsDict.Name = this.name;
|
|
184
|
+
bodyAsDict.FriendlyName = this.friendlyName || this.name;
|
|
185
|
+
bodyAsDict.Enabled = this._enabled;
|
|
186
|
+
bodyAsDict.Type = this._userType.toString();
|
|
187
|
+
|
|
188
|
+
if (this.password) {
|
|
189
|
+
bodyAsDict.Password = this._password;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
bodyAsDict['Groups@odata.bind'] = this.groups.map(group =>
|
|
193
|
+
formatUrl("Groups('{}')", group)
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
return JSON.stringify(bodyAsDict);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TM1Object } from './TM1Object';
|
|
2
|
+
|
|
3
|
+
export abstract class View extends TM1Object {
|
|
4
|
+
/** Abstraction of TM1 View
|
|
5
|
+
* serves as a parentclass for .Objects.MDXView and .Objects.NativeView
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
protected _cube: string;
|
|
10
|
+
protected _name: string;
|
|
11
|
+
|
|
12
|
+
constructor(cube: string, name: string) {
|
|
13
|
+
super();
|
|
14
|
+
this._cube = cube;
|
|
15
|
+
this._name = name;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public abstract get body(): string;
|
|
19
|
+
|
|
20
|
+
public get cube(): string {
|
|
21
|
+
return this._cube;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public get name(): string {
|
|
25
|
+
return this._name;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public set cube(value: string) {
|
|
29
|
+
this._cube = value;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public set name(value: string) {
|
|
33
|
+
this._name = value;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public get mdx(): string {
|
|
37
|
+
throw new Error("NotImplementedError");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Re-export the concrete classes
|
|
42
|
+
export { MDXView } from './MDXView';
|
|
43
|
+
export { NativeView } from './NativeView';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Export all object implementations
|
|
2
|
+
export { TM1Object } from './TM1Object';
|
|
3
|
+
export { Dimension } from './Dimension';
|
|
4
|
+
export { Hierarchy } from './Hierarchy';
|
|
5
|
+
export { Element } from './Element';
|
|
6
|
+
export { ElementAttribute } from './ElementAttribute';
|
|
7
|
+
export { Cube } from './Cube';
|
|
8
|
+
export { Process } from './Process';
|
|
9
|
+
export { ProcessParameter } from './ProcessParameter';
|
|
10
|
+
export { ProcessVariable } from './ProcessVariable';
|
|
11
|
+
export { User } from './User';
|
|
12
|
+
export { Subset } from './Subset';
|
|
13
|
+
export { MDXView } from './MDXView';
|
|
14
|
+
export { NativeView } from './NativeView';
|
|
15
|
+
export { View } from './View';
|
|
16
|
+
export { ViewAxisSelection, ViewTitleSelection } from './Axis';
|
|
17
|
+
export { Chore } from './Chore';
|
|
18
|
+
export { ChoreTask } from './ChoreTask';
|
|
19
|
+
export { ChoreStartTime } from './ChoreStartTime';
|
|
20
|
+
export { Annotation } from './Annotation';
|
|
21
|
+
export { Rules } from './Rules';
|
|
22
|
+
export { Server } from './Server';
|
|
23
|
+
|
|
24
|
+
// Git objects
|
|
25
|
+
export { Git } from './Git';
|
|
26
|
+
export { GitCommit } from './GitCommit';
|
|
27
|
+
export { GitRemote } from './GitRemote';
|
|
28
|
+
export { GitPlan } from './GitPlan';
|
|
29
|
+
|
|
30
|
+
// Process debug
|
|
31
|
+
export { ProcessDebugBreakpoint } from './ProcessDebugBreakpoint';
|
|
32
|
+
|
|
33
|
+
// Re-export enum types
|
|
34
|
+
export { ElementType } from './Element';
|
|
35
|
+
export { UserType } from './User';
|
|
36
|
+
export { BreakPointType, HitMode } from './ProcessDebugBreakpoint';
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { RestService } from './RestService';
|
|
3
|
+
import { ObjectService } from './ObjectService';
|
|
4
|
+
import { Annotation } from '../objects/Annotation';
|
|
5
|
+
import { formatUrl, CaseAndSpaceInsensitiveDict } from '../utils/Utils';
|
|
6
|
+
|
|
7
|
+
export class AnnotationService extends ObjectService {
|
|
8
|
+
/** Service to handle Object Updates for TM1 CellAnnotations
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
constructor(rest: RestService) {
|
|
13
|
+
super(rest);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public async getAll(cubeName: string): Promise<Annotation[]> {
|
|
17
|
+
/** get all annotations from given cube as a List.
|
|
18
|
+
*
|
|
19
|
+
* :param cube_name:
|
|
20
|
+
*/
|
|
21
|
+
const url = formatUrl("/Cubes('{}')/Annotations?$expand=DimensionalContext($select=Name)", cubeName);
|
|
22
|
+
const response = await this.rest.get(url);
|
|
23
|
+
|
|
24
|
+
const annotationsAsDict = response.data.value;
|
|
25
|
+
const annotations = annotationsAsDict.map((element: any) =>
|
|
26
|
+
Annotation.fromJSON(JSON.stringify(element)));
|
|
27
|
+
return annotations;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public async create(annotation: Annotation): Promise<AxiosResponse> {
|
|
31
|
+
/** create an Annotation
|
|
32
|
+
*
|
|
33
|
+
* :param annotation: instance of .Annotation
|
|
34
|
+
*/
|
|
35
|
+
const url = "/Annotations";
|
|
36
|
+
|
|
37
|
+
// Import here to avoid circular dependency
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
39
|
+
const { CubeService } = require('./CubeService');
|
|
40
|
+
const cubeService = new CubeService(this.rest);
|
|
41
|
+
const cubeDimensions = await cubeService.getDimensionNames(
|
|
42
|
+
annotation.objectName,
|
|
43
|
+
true // skip_sandbox_dimension
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const response = await this.rest.post(url,
|
|
47
|
+
JSON.stringify(annotation.constructBodyForPost(cubeDimensions)));
|
|
48
|
+
return response;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public async createMany(annotations: Iterable<Annotation>): Promise<AxiosResponse> {
|
|
52
|
+
/** create an Annotation
|
|
53
|
+
*
|
|
54
|
+
* :param annotations: instances of .Annotation
|
|
55
|
+
*/
|
|
56
|
+
const payload: any[] = [];
|
|
57
|
+
const cubeDimensions = new CaseAndSpaceInsensitiveDict<string[]>();
|
|
58
|
+
|
|
59
|
+
for (const annotation of annotations) {
|
|
60
|
+
let dimensionNames = cubeDimensions.get(annotation.objectName);
|
|
61
|
+
if (!dimensionNames) {
|
|
62
|
+
// Import here to avoid circular dependency
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
64
|
+
const { CubeService } = require('./CubeService');
|
|
65
|
+
const cubeService = new CubeService(this.rest);
|
|
66
|
+
dimensionNames = await cubeService.getDimensionNames(
|
|
67
|
+
annotation.objectName,
|
|
68
|
+
true // skip_sandbox_dimension
|
|
69
|
+
);
|
|
70
|
+
cubeDimensions.set(annotation.objectName, dimensionNames || []);
|
|
71
|
+
}
|
|
72
|
+
payload.push(annotation.constructBodyForPost(dimensionNames || []));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const response = await this.rest.post("/Annotations", JSON.stringify(payload));
|
|
76
|
+
return response;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public async get(annotationId: string): Promise<Annotation> {
|
|
80
|
+
/** get an annotation from any cube through its unique id
|
|
81
|
+
*
|
|
82
|
+
* :param annotation_id: String, the id of the annotation
|
|
83
|
+
*/
|
|
84
|
+
const request = formatUrl("/Annotations('{}')?$expand=DimensionalContext($select=Name)", annotationId);
|
|
85
|
+
const response = await this.rest.get(request);
|
|
86
|
+
return Annotation.fromJSON(JSON.stringify(response.data));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public async update(annotation: Annotation): Promise<AxiosResponse> {
|
|
90
|
+
/** update Annotation.
|
|
91
|
+
* updateable attributes: commentValue
|
|
92
|
+
*
|
|
93
|
+
* :param annotation: instance of .Annotation
|
|
94
|
+
*/
|
|
95
|
+
const url = formatUrl("/Annotations('{}')", annotation.id || '');
|
|
96
|
+
return await this.rest.patch(url, annotation.body);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public async delete(annotationId: string): Promise<AxiosResponse> {
|
|
100
|
+
/** delete Annotation
|
|
101
|
+
*
|
|
102
|
+
* :param annotation_id: string, the id of the annotation
|
|
103
|
+
*/
|
|
104
|
+
const url = formatUrl("/Annotations('{}')", annotationId);
|
|
105
|
+
return await this.rest.delete(url);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { RestService } from './RestService';
|
|
3
|
+
import { ObjectService } from './ObjectService';
|
|
4
|
+
import {
|
|
5
|
+
DocumentApplication,
|
|
6
|
+
ApplicationTypes,
|
|
7
|
+
CubeApplication,
|
|
8
|
+
ChoreApplication,
|
|
9
|
+
FolderApplication,
|
|
10
|
+
LinkApplication,
|
|
11
|
+
ProcessApplication,
|
|
12
|
+
DimensionApplication,
|
|
13
|
+
SubsetApplication,
|
|
14
|
+
ViewApplication,
|
|
15
|
+
Application
|
|
16
|
+
} from '../objects/Application';
|
|
17
|
+
import { formatUrl, verifyVersion } from '../utils/Utils';
|
|
18
|
+
|
|
19
|
+
export class ApplicationService extends ObjectService {
|
|
20
|
+
/** Service to Read and Write TM1 Applications
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
constructor(tm1Rest: RestService) {
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* :param tm1_rest:
|
|
27
|
+
*/
|
|
28
|
+
super(tm1Rest);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public async getAllPublicRootNames(): Promise<string[]> {
|
|
32
|
+
const url = "/Contents('Applications')/Contents";
|
|
33
|
+
const response = await this.rest.get(url);
|
|
34
|
+
const applications = response.data.value.map((application: any) => application.Name);
|
|
35
|
+
return applications;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public async getAllPrivateRootNames(): Promise<string[]> {
|
|
39
|
+
const url = "/Contents('Applications')/PrivateContents";
|
|
40
|
+
const response = await this.rest.get(url);
|
|
41
|
+
const applications = response.data.value.map((application: any) => application.Name);
|
|
42
|
+
return applications;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public async getNames(path: string, isPrivate: boolean = false): Promise<string[]> {
|
|
46
|
+
/** Retrieve Planning Analytics Application names in given path
|
|
47
|
+
*
|
|
48
|
+
* :param path: path with forward slashes
|
|
49
|
+
* :param private: boolean
|
|
50
|
+
* :return: list of application names
|
|
51
|
+
*/
|
|
52
|
+
const contents = isPrivate ? 'PrivateContents' : 'Contents';
|
|
53
|
+
let mid = "";
|
|
54
|
+
if (path.trim() !== '') {
|
|
55
|
+
mid = path.split('/').map(element =>
|
|
56
|
+
formatUrl("/Contents('{}')", element)).join('');
|
|
57
|
+
}
|
|
58
|
+
const baseUrl = "/api/v1/Contents('Applications')" + mid + "/" + contents;
|
|
59
|
+
|
|
60
|
+
const response = await this.rest.get(baseUrl);
|
|
61
|
+
const applications = response.data.value.map((application: any) => application.Name);
|
|
62
|
+
|
|
63
|
+
return applications;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public async get(
|
|
67
|
+
path: string,
|
|
68
|
+
applicationType: string | ApplicationTypes,
|
|
69
|
+
name: string,
|
|
70
|
+
isPrivate: boolean = false
|
|
71
|
+
): Promise<Application> {
|
|
72
|
+
/** Retrieve Planning Analytics Application
|
|
73
|
+
*
|
|
74
|
+
* :param path: path with forward slashes
|
|
75
|
+
* :param application_type: str or ApplicationType from Enum
|
|
76
|
+
* :param name:
|
|
77
|
+
* :param private:
|
|
78
|
+
* :return:
|
|
79
|
+
*/
|
|
80
|
+
// Parse application type if string
|
|
81
|
+
let appType: ApplicationTypes;
|
|
82
|
+
if (typeof applicationType === 'string') {
|
|
83
|
+
appType = ApplicationTypes[applicationType as keyof typeof ApplicationTypes];
|
|
84
|
+
if (appType === undefined) {
|
|
85
|
+
throw new Error(`Invalid application type: ${applicationType}`);
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
appType = applicationType;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// documents require special treatment
|
|
92
|
+
if (appType === ApplicationTypes.DOCUMENT) {
|
|
93
|
+
return await this.getDocument(path, name, isPrivate);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (appType !== ApplicationTypes.FOLDER && !verifyVersion('12', this.version)) {
|
|
97
|
+
name += this.getApplicationTypeSuffix(appType);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const contents = isPrivate ? 'PrivateContents' : 'Contents';
|
|
101
|
+
let mid = "";
|
|
102
|
+
if (path.trim() !== '') {
|
|
103
|
+
mid = path.split('/').map(element =>
|
|
104
|
+
formatUrl("/Contents('{}')", element)).join('');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const baseUrl = formatUrl(
|
|
108
|
+
"/Contents('Applications')" + mid + "/" + contents + "('{}')",
|
|
109
|
+
name);
|
|
110
|
+
|
|
111
|
+
if (appType === ApplicationTypes.CUBE) {
|
|
112
|
+
const response = await this.rest.get(baseUrl + "?$expand=Cube($select=Name)");
|
|
113
|
+
return new CubeApplication(name, path);
|
|
114
|
+
|
|
115
|
+
} else if (appType === ApplicationTypes.CHORE) {
|
|
116
|
+
const response = await this.rest.get(baseUrl + "?$expand=Chore($select=Name)");
|
|
117
|
+
return new ChoreApplication(name, path);
|
|
118
|
+
|
|
119
|
+
} else if (appType === ApplicationTypes.DIMENSION) {
|
|
120
|
+
const response = await this.rest.get(baseUrl + "?$expand=Dimension($select=Name)");
|
|
121
|
+
return new DimensionApplication(name, path);
|
|
122
|
+
|
|
123
|
+
} else if (appType === ApplicationTypes.FOLDER) {
|
|
124
|
+
const response = await this.rest.get(baseUrl);
|
|
125
|
+
return new FolderApplication(name, path);
|
|
126
|
+
|
|
127
|
+
} else if (appType === ApplicationTypes.LINK) {
|
|
128
|
+
const response = await this.rest.get(baseUrl);
|
|
129
|
+
return new LinkApplication(name, path);
|
|
130
|
+
|
|
131
|
+
} else if (appType === ApplicationTypes.PROCESS) {
|
|
132
|
+
const response = await this.rest.get(baseUrl + "?$expand=Process($select=Name)");
|
|
133
|
+
return new ProcessApplication(name, path);
|
|
134
|
+
|
|
135
|
+
} else if (appType === ApplicationTypes.SUBSET) {
|
|
136
|
+
const response = await this.rest.get(baseUrl + "?$expand=Subset($select=Name;$expand=Hierarchy($select=Name;$expand=Dimension($select=Name)))");
|
|
137
|
+
const subset = response.data.Subset;
|
|
138
|
+
return new SubsetApplication(name, path);
|
|
139
|
+
|
|
140
|
+
} else if (appType === ApplicationTypes.VIEW) {
|
|
141
|
+
const response = await this.rest.get(baseUrl + "?$expand=View($select=Name;$expand=Cube($select=Name))");
|
|
142
|
+
const view = response.data.View;
|
|
143
|
+
return new ViewApplication(name, path);
|
|
144
|
+
|
|
145
|
+
} else {
|
|
146
|
+
throw new Error(`Unsupported application type: ${appType}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
public async getDocument(path: string, name: string, isPrivate: boolean = false): Promise<DocumentApplication> {
|
|
151
|
+
/** Get Document Application
|
|
152
|
+
*
|
|
153
|
+
* :param path: path with forward slashes
|
|
154
|
+
* :param name: name of the document
|
|
155
|
+
* :param private: boolean
|
|
156
|
+
* :return: DocumentApplication instance
|
|
157
|
+
*/
|
|
158
|
+
const contents = isPrivate ? 'PrivateContents' : 'Contents';
|
|
159
|
+
let mid = "";
|
|
160
|
+
if (path.trim() !== '') {
|
|
161
|
+
mid = path.split('/').map(element =>
|
|
162
|
+
formatUrl("/Contents('{}')", element)).join('');
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const baseUrl = formatUrl(
|
|
166
|
+
"/Contents('Applications')" + mid + "/" + contents + "('{}')",
|
|
167
|
+
name);
|
|
168
|
+
|
|
169
|
+
const response = await this.rest.get(baseUrl);
|
|
170
|
+
return new DocumentApplication(name, path);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
public async create(application: Application, isPrivate: boolean = false): Promise<AxiosResponse> {
|
|
174
|
+
/** Create Planning Analytics Application
|
|
175
|
+
*
|
|
176
|
+
* :param application: instance of Application
|
|
177
|
+
* :param private: boolean
|
|
178
|
+
* :return: response
|
|
179
|
+
*/
|
|
180
|
+
const contents = isPrivate ? 'PrivateContents' : 'Contents';
|
|
181
|
+
let mid = "";
|
|
182
|
+
if (application.path.trim() !== '') {
|
|
183
|
+
mid = application.path.split('/').map(element =>
|
|
184
|
+
formatUrl("/Contents('{}')", element)).join('');
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const url = "/Contents('Applications')" + mid + "/" + contents;
|
|
188
|
+
return await this.rest.post(url, application.body);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
public async update(application: Application, isPrivate: boolean = false): Promise<AxiosResponse> {
|
|
192
|
+
/** Update Planning Analytics Application
|
|
193
|
+
*
|
|
194
|
+
* :param application: instance of Application
|
|
195
|
+
* :param private: boolean
|
|
196
|
+
* :return: response
|
|
197
|
+
*/
|
|
198
|
+
const contents = isPrivate ? 'PrivateContents' : 'Contents';
|
|
199
|
+
let mid = "";
|
|
200
|
+
if (application.path.trim() !== '') {
|
|
201
|
+
mid = application.path.split('/').map(element =>
|
|
202
|
+
formatUrl("/Contents('{}')", element)).join('');
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const url = formatUrl(
|
|
206
|
+
"/Contents('Applications')" + mid + "/" + contents + "('{}')",
|
|
207
|
+
application.name);
|
|
208
|
+
return await this.rest.patch(url, application.body);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
public async delete(path: string, applicationType: ApplicationTypes, name: string, isPrivate: boolean = false): Promise<AxiosResponse> {
|
|
212
|
+
/** Delete Planning Analytics Application
|
|
213
|
+
*
|
|
214
|
+
* :param path: path with forward slashes
|
|
215
|
+
* :param application_type: ApplicationType from Enum
|
|
216
|
+
* :param name: name of the application
|
|
217
|
+
* :param private: boolean
|
|
218
|
+
* :return: response
|
|
219
|
+
*/
|
|
220
|
+
if (applicationType !== ApplicationTypes.FOLDER && !verifyVersion('12', this.version)) {
|
|
221
|
+
name += this.getApplicationTypeSuffix(applicationType);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const contents = isPrivate ? 'PrivateContents' : 'Contents';
|
|
225
|
+
let mid = "";
|
|
226
|
+
if (path.trim() !== '') {
|
|
227
|
+
mid = path.split('/').map(element =>
|
|
228
|
+
formatUrl("/Contents('{}')", element)).join('');
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const url = formatUrl(
|
|
232
|
+
"/Contents('Applications')" + mid + "/" + contents + "('{}')",
|
|
233
|
+
name);
|
|
234
|
+
return await this.rest.delete(url);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
public async exists(path: string, applicationType: ApplicationTypes, name: string, isPrivate: boolean = false): Promise<boolean> {
|
|
238
|
+
/** Check if Planning Analytics Application exists
|
|
239
|
+
*
|
|
240
|
+
* :param path: path with forward slashes
|
|
241
|
+
* :param application_type: ApplicationType from Enum
|
|
242
|
+
* :param name: name of the application
|
|
243
|
+
* :param private: boolean
|
|
244
|
+
* :return: boolean
|
|
245
|
+
*/
|
|
246
|
+
try {
|
|
247
|
+
await this.get(path, applicationType, name, isPrivate);
|
|
248
|
+
return true;
|
|
249
|
+
} catch {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
private getApplicationTypeSuffix(applicationType: ApplicationTypes): string {
|
|
255
|
+
switch (applicationType) {
|
|
256
|
+
case ApplicationTypes.CUBE:
|
|
257
|
+
return '.cube';
|
|
258
|
+
case ApplicationTypes.CHORE:
|
|
259
|
+
return '.chore';
|
|
260
|
+
case ApplicationTypes.DIMENSION:
|
|
261
|
+
return '.dimension';
|
|
262
|
+
case ApplicationTypes.PROCESS:
|
|
263
|
+
return '.process';
|
|
264
|
+
case ApplicationTypes.SUBSET:
|
|
265
|
+
return '.subset';
|
|
266
|
+
case ApplicationTypes.VIEW:
|
|
267
|
+
return '.view';
|
|
268
|
+
case ApplicationTypes.LINK:
|
|
269
|
+
return '.url';
|
|
270
|
+
default:
|
|
271
|
+
return '';
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
private get version(): string {
|
|
276
|
+
// This would need to be implemented to get TM1 server version
|
|
277
|
+
return '12.0.0'; // Default to v12 for now
|
|
278
|
+
}
|
|
279
|
+
}
|