@ffschrattenecker/tm1-mcp-server 6.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/CHANGELOG.md +1211 -0
- package/LICENSE +21 -0
- package/NOTICE +34 -0
- package/README.md +276 -0
- package/dist/config.d.ts +35 -0
- package/dist/config.js +238 -0
- package/dist/http-transport.d.ts +8 -0
- package/dist/http-transport.js +132 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +164 -0
- package/dist/lib/callgraph/callGraph.d.ts +124 -0
- package/dist/lib/callgraph/callGraph.js +334 -0
- package/dist/lib/callgraph/choreGraph.d.ts +23 -0
- package/dist/lib/callgraph/choreGraph.js +102 -0
- package/dist/lib/callgraph/dataFlow.d.ts +74 -0
- package/dist/lib/callgraph/dataFlow.js +271 -0
- package/dist/lib/callgraph/datasourceMembership.d.ts +31 -0
- package/dist/lib/callgraph/datasourceMembership.js +142 -0
- package/dist/lib/callgraph/lintTypes.d.ts +28 -0
- package/dist/lib/callgraph/lintTypes.js +2 -0
- package/dist/lib/callgraph/mdxMembers.d.ts +29 -0
- package/dist/lib/callgraph/mdxMembers.js +97 -0
- package/dist/lib/callgraph/referenceIndex.d.ts +179 -0
- package/dist/lib/callgraph/referenceIndex.js +584 -0
- package/dist/lib/callgraph/rulesLinter.d.ts +55 -0
- package/dist/lib/callgraph/rulesLinter.js +776 -0
- package/dist/lib/callgraph/rulesParser.d.ts +26 -0
- package/dist/lib/callgraph/rulesParser.js +71 -0
- package/dist/lib/callgraph/subsetUsage.d.ts +16 -0
- package/dist/lib/callgraph/subsetUsage.js +134 -0
- package/dist/lib/callgraph/tiParser.d.ts +21 -0
- package/dist/lib/callgraph/tiParser.js +672 -0
- package/dist/lib/callgraph/tiSignatures.d.ts +32 -0
- package/dist/lib/callgraph/tiSignatures.js +6185 -0
- package/dist/lib/callgraph/tm1-adapter.d.ts +32 -0
- package/dist/lib/callgraph/tm1-adapter.js +159 -0
- package/dist/lib/callgraph/types.d.ts +53 -0
- package/dist/lib/callgraph/types.js +2 -0
- package/dist/lib/callgraph/variableEnv.d.ts +86 -0
- package/dist/lib/callgraph/variableEnv.js +214 -0
- package/dist/lib/cell-address.d.ts +12 -0
- package/dist/lib/cell-address.js +71 -0
- package/dist/lib/complexity/antipatterns.d.ts +22 -0
- package/dist/lib/complexity/antipatterns.js +302 -0
- package/dist/lib/complexity/comment-classifier.d.ts +24 -0
- package/dist/lib/complexity/comment-classifier.js +43 -0
- package/dist/lib/complexity/cross-process.d.ts +78 -0
- package/dist/lib/complexity/cross-process.js +114 -0
- package/dist/lib/complexity/process-metrics.d.ts +78 -0
- package/dist/lib/complexity/process-metrics.js +278 -0
- package/dist/lib/complexity/rules-metrics.d.ts +31 -0
- package/dist/lib/complexity/rules-metrics.js +99 -0
- package/dist/lib/concurrency.d.ts +11 -0
- package/dist/lib/concurrency.js +27 -0
- package/dist/lib/control-name.d.ts +10 -0
- package/dist/lib/control-name.js +10 -0
- package/dist/lib/coordinate-error.d.ts +3 -0
- package/dist/lib/coordinate-error.js +29 -0
- package/dist/lib/credential-format.d.ts +23 -0
- package/dist/lib/credential-format.js +25 -0
- package/dist/lib/cube-stats/fetcher.d.ts +106 -0
- package/dist/lib/cube-stats/fetcher.js +194 -0
- package/dist/lib/feeders/brackets.d.ts +47 -0
- package/dist/lib/feeders/brackets.js +195 -0
- package/dist/lib/feeders/element-type-cache.d.ts +42 -0
- package/dist/lib/feeders/element-type-cache.js +86 -0
- package/dist/lib/feeders/static-heuristics.d.ts +101 -0
- package/dist/lib/feeders/static-heuristics.js +202 -0
- package/dist/lib/git-process.d.ts +67 -0
- package/dist/lib/git-process.js +243 -0
- package/dist/lib/mask-secrets.d.ts +10 -0
- package/dist/lib/mask-secrets.js +99 -0
- package/dist/lib/mdx.d.ts +3 -0
- package/dist/lib/mdx.js +13 -0
- package/dist/lib/naming/odata-filter.d.ts +15 -0
- package/dist/lib/naming/odata-filter.js +81 -0
- package/dist/lib/naming/rules.d.ts +34 -0
- package/dist/lib/naming/rules.js +215 -0
- package/dist/lib/pro-parser.d.ts +19 -0
- package/dist/lib/pro-parser.js +260 -0
- package/dist/lib/pro-serializer.d.ts +19 -0
- package/dist/lib/pro-serializer.js +170 -0
- package/dist/lib/process-parts-schema.d.ts +45 -0
- package/dist/lib/process-parts-schema.js +46 -0
- package/dist/lib/process-refs.d.ts +88 -0
- package/dist/lib/process-refs.js +441 -0
- package/dist/lib/rules-outline.d.ts +29 -0
- package/dist/lib/rules-outline.js +68 -0
- package/dist/lib/rules-patch.d.ts +6 -0
- package/dist/lib/rules-patch.js +59 -0
- package/dist/lib/safe-regex.d.ts +15 -0
- package/dist/lib/safe-regex.js +37 -0
- package/dist/lib/sample-cells.d.ts +48 -0
- package/dist/lib/sample-cells.js +146 -0
- package/dist/lib/slim-json-schema.d.ts +20 -0
- package/dist/lib/slim-json-schema.js +68 -0
- package/dist/lib/strip-comments.d.ts +23 -0
- package/dist/lib/strip-comments.js +61 -0
- package/dist/lib/tm1-events.d.ts +16 -0
- package/dist/lib/tm1-events.js +29 -0
- package/dist/lib/v12-compat/deprecated-ti.d.ts +17 -0
- package/dist/lib/v12-compat/deprecated-ti.js +257 -0
- package/dist/lib/v12-compat/scanner.d.ts +10 -0
- package/dist/lib/v12-compat/scanner.js +43 -0
- package/dist/lib/variables-ui-data.d.ts +26 -0
- package/dist/lib/variables-ui-data.js +77 -0
- package/dist/load-env.d.ts +2 -0
- package/dist/load-env.js +29 -0
- package/dist/logger.d.ts +4 -0
- package/dist/logger.js +60 -0
- package/dist/prompts/index.d.ts +3 -0
- package/dist/prompts/index.js +141 -0
- package/dist/resources/index.d.ts +5 -0
- package/dist/resources/index.js +237 -0
- package/dist/resources/list-handler.d.ts +40 -0
- package/dist/resources/list-handler.js +86 -0
- package/dist/resources/subscriptions.d.ts +19 -0
- package/dist/resources/subscriptions.js +80 -0
- package/dist/schemas/cells.d.ts +17 -0
- package/dist/schemas/cells.js +13 -0
- package/dist/schemas/common.d.ts +16 -0
- package/dist/schemas/common.js +14 -0
- package/dist/schemas/index.d.ts +10 -0
- package/dist/schemas/index.js +23 -0
- package/dist/schemas/metadata.d.ts +70 -0
- package/dist/schemas/metadata.js +47 -0
- package/dist/schemas/monitoring.d.ts +95 -0
- package/dist/schemas/monitoring.js +69 -0
- package/dist/schemas/processes.d.ts +74 -0
- package/dist/schemas/processes.js +66 -0
- package/dist/schemas/scheduling.d.ts +13 -0
- package/dist/schemas/scheduling.js +13 -0
- package/dist/schemas/security.d.ts +19 -0
- package/dist/schemas/security.js +16 -0
- package/dist/schemas/subsets.d.ts +12 -0
- package/dist/schemas/subsets.js +12 -0
- package/dist/schemas/views.d.ts +9 -0
- package/dist/schemas/views.js +9 -0
- package/dist/session-manager.d.ts +79 -0
- package/dist/session-manager.js +281 -0
- package/dist/tm1-client/connection/profile.d.ts +13 -0
- package/dist/tm1-client/connection/profile.js +99 -0
- package/dist/tm1-client/dispatcher.d.ts +5 -0
- package/dist/tm1-client/dispatcher.js +31 -0
- package/dist/tm1-client/http.d.ts +81 -0
- package/dist/tm1-client/http.js +547 -0
- package/dist/tm1-client/services/batch-service.d.ts +123 -0
- package/dist/tm1-client/services/batch-service.js +455 -0
- package/dist/tm1-client/services/cell-service.d.ts +71 -0
- package/dist/tm1-client/services/cell-service.js +333 -0
- package/dist/tm1-client/services/cellset-transform.d.ts +26 -0
- package/dist/tm1-client/services/cellset-transform.js +80 -0
- package/dist/tm1-client/services/chore-service.d.ts +68 -0
- package/dist/tm1-client/services/chore-service.js +179 -0
- package/dist/tm1-client/services/chore-status.d.ts +11 -0
- package/dist/tm1-client/services/chore-status.js +127 -0
- package/dist/tm1-client/services/cube-service.d.ts +134 -0
- package/dist/tm1-client/services/cube-service.js +294 -0
- package/dist/tm1-client/services/dimension-service.d.ts +118 -0
- package/dist/tm1-client/services/dimension-service.js +249 -0
- package/dist/tm1-client/services/element-service.d.ts +245 -0
- package/dist/tm1-client/services/element-service.js +809 -0
- package/dist/tm1-client/services/fallback.d.ts +44 -0
- package/dist/tm1-client/services/fallback.js +72 -0
- package/dist/tm1-client/services/file-service.d.ts +53 -0
- package/dist/tm1-client/services/file-service.js +218 -0
- package/dist/tm1-client/services/hierarchy-service.d.ts +129 -0
- package/dist/tm1-client/services/hierarchy-service.js +332 -0
- package/dist/tm1-client/services/monitoring-service.d.ts +34 -0
- package/dist/tm1-client/services/monitoring-service.js +123 -0
- package/dist/tm1-client/services/odata-page.d.ts +71 -0
- package/dist/tm1-client/services/odata-page.js +87 -0
- package/dist/tm1-client/services/process-service.d.ts +278 -0
- package/dist/tm1-client/services/process-service.js +874 -0
- package/dist/tm1-client/services/process-status.d.ts +21 -0
- package/dist/tm1-client/services/process-status.js +89 -0
- package/dist/tm1-client/services/security-service.d.ts +50 -0
- package/dist/tm1-client/services/security-service.js +93 -0
- package/dist/tm1-client/services/server-service.d.ts +116 -0
- package/dist/tm1-client/services/server-service.js +504 -0
- package/dist/tm1-client/services/subset-service.d.ts +37 -0
- package/dist/tm1-client/services/subset-service.js +122 -0
- package/dist/tm1-client/services/view-service.d.ts +46 -0
- package/dist/tm1-client/services/view-service.js +287 -0
- package/dist/tm1-client.d.ts +56 -0
- package/dist/tm1-client.js +126 -0
- package/dist/tools/analysis/analyze-callgraph.d.ts +28 -0
- package/dist/tools/analysis/analyze-callgraph.js +350 -0
- package/dist/tools/analysis/analyze-chore-graph.d.ts +2 -0
- package/dist/tools/analysis/analyze-chore-graph.js +148 -0
- package/dist/tools/analysis/analyze-object-usage.d.ts +2 -0
- package/dist/tools/analysis/analyze-object-usage.js +143 -0
- package/dist/tools/analysis/audit-complexity.d.ts +2 -0
- package/dist/tools/analysis/audit-complexity.js +255 -0
- package/dist/tools/analysis/audit-feeders.d.ts +2 -0
- package/dist/tools/analysis/audit-feeders.js +417 -0
- package/dist/tools/analysis/audit-naming.d.ts +2 -0
- package/dist/tools/analysis/audit-naming.js +379 -0
- package/dist/tools/analysis/check-v12-readiness.d.ts +2 -0
- package/dist/tools/analysis/check-v12-readiness.js +136 -0
- package/dist/tools/analysis/find-orphan-dimensions.d.ts +2 -0
- package/dist/tools/analysis/find-orphan-dimensions.js +55 -0
- package/dist/tools/analysis/invalidate-callgraph-cache.d.ts +2 -0
- package/dist/tools/analysis/invalidate-callgraph-cache.js +40 -0
- package/dist/tools/analysis/trace-data-flow.d.ts +2 -0
- package/dist/tools/analysis/trace-data-flow.js +138 -0
- package/dist/tools/annotations.d.ts +12 -0
- package/dist/tools/annotations.js +61 -0
- package/dist/tools/celldata/check-feeders.d.ts +2 -0
- package/dist/tools/celldata/check-feeders.js +48 -0
- package/dist/tools/celldata/check-writable-coords.d.ts +2 -0
- package/dist/tools/celldata/check-writable-coords.js +126 -0
- package/dist/tools/celldata/execute-mdx.d.ts +17 -0
- package/dist/tools/celldata/execute-mdx.js +126 -0
- package/dist/tools/celldata/get-cell-value.d.ts +2 -0
- package/dist/tools/celldata/get-cell-value.js +30 -0
- package/dist/tools/celldata/get-view-definition.d.ts +2 -0
- package/dist/tools/celldata/get-view-definition.js +29 -0
- package/dist/tools/celldata/get-view.d.ts +2 -0
- package/dist/tools/celldata/get-view.js +55 -0
- package/dist/tools/celldata/sample-cells.d.ts +2 -0
- package/dist/tools/celldata/sample-cells.js +101 -0
- package/dist/tools/celldata/trace-cell-calculation.d.ts +2 -0
- package/dist/tools/celldata/trace-cell-calculation.js +53 -0
- package/dist/tools/celldata/trace-feeders.d.ts +2 -0
- package/dist/tools/celldata/trace-feeders.js +44 -0
- package/dist/tools/celldata/write-cells.d.ts +2 -0
- package/dist/tools/celldata/write-cells.js +65 -0
- package/dist/tools/confirm.d.ts +10 -0
- package/dist/tools/confirm.js +64 -0
- package/dist/tools/define-tool.d.ts +51 -0
- package/dist/tools/define-tool.js +49 -0
- package/dist/tools/dimension-management/bulk-upsert-elements.d.ts +2 -0
- package/dist/tools/dimension-management/bulk-upsert-elements.js +103 -0
- package/dist/tools/dimension-management/create-dimension.d.ts +2 -0
- package/dist/tools/dimension-management/create-dimension.js +22 -0
- package/dist/tools/dimension-management/create-element-attribute.d.ts +2 -0
- package/dist/tools/dimension-management/create-element-attribute.js +26 -0
- package/dist/tools/dimension-management/create-element.d.ts +2 -0
- package/dist/tools/dimension-management/create-element.js +31 -0
- package/dist/tools/dimension-management/create-hierarchy.d.ts +2 -0
- package/dist/tools/dimension-management/create-hierarchy.js +22 -0
- package/dist/tools/dimension-management/delete-dimension.d.ts +2 -0
- package/dist/tools/dimension-management/delete-dimension.js +25 -0
- package/dist/tools/dimension-management/delete-element.d.ts +2 -0
- package/dist/tools/dimension-management/delete-element.js +26 -0
- package/dist/tools/dimension-management/delete-elements.d.ts +2 -0
- package/dist/tools/dimension-management/delete-elements.js +44 -0
- package/dist/tools/dimension-management/delete-hierarchy.d.ts +2 -0
- package/dist/tools/dimension-management/delete-hierarchy.js +35 -0
- package/dist/tools/dimension-management/get-element-attribute-values.d.ts +2 -0
- package/dist/tools/dimension-management/get-element-attribute-values.js +77 -0
- package/dist/tools/dimension-management/list-element-attributes.d.ts +2 -0
- package/dist/tools/dimension-management/list-element-attributes.js +31 -0
- package/dist/tools/dimension-management/move-element.d.ts +2 -0
- package/dist/tools/dimension-management/move-element.js +28 -0
- package/dist/tools/dimension-management/update-element-attribute-value.d.ts +2 -0
- package/dist/tools/dimension-management/update-element-attribute-value.js +80 -0
- package/dist/tools/dimension-management/update-element.d.ts +2 -0
- package/dist/tools/dimension-management/update-element.js +35 -0
- package/dist/tools/error-format.d.ts +22 -0
- package/dist/tools/error-format.js +130 -0
- package/dist/tools/fileops/delete-file.d.ts +2 -0
- package/dist/tools/fileops/delete-file.js +32 -0
- package/dist/tools/fileops/get-file-content.d.ts +2 -0
- package/dist/tools/fileops/get-file-content.js +76 -0
- package/dist/tools/fileops/list-files.d.ts +2 -0
- package/dist/tools/fileops/list-files.js +43 -0
- package/dist/tools/fileops/search-files.d.ts +2 -0
- package/dist/tools/fileops/search-files.js +76 -0
- package/dist/tools/fileops/upload-file.d.ts +2 -0
- package/dist/tools/fileops/upload-file.js +69 -0
- package/dist/tools/format.d.ts +57 -0
- package/dist/tools/format.js +157 -0
- package/dist/tools/hierarchy.d.ts +6 -0
- package/dist/tools/hierarchy.js +27 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.js +263 -0
- package/dist/tools/local-file.d.ts +16 -0
- package/dist/tools/local-file.js +88 -0
- package/dist/tools/metadata/get-ancestors.d.ts +2 -0
- package/dist/tools/metadata/get-ancestors.js +36 -0
- package/dist/tools/metadata/get-descendants.d.ts +2 -0
- package/dist/tools/metadata/get-descendants.js +64 -0
- package/dist/tools/metadata/get-hierarchy.d.ts +2 -0
- package/dist/tools/metadata/get-hierarchy.js +130 -0
- package/dist/tools/metadata/list-chores.d.ts +2 -0
- package/dist/tools/metadata/list-chores.js +62 -0
- package/dist/tools/metadata/list-cubes.d.ts +2 -0
- package/dist/tools/metadata/list-cubes.js +128 -0
- package/dist/tools/metadata/list-dimensions.d.ts +2 -0
- package/dist/tools/metadata/list-dimensions.js +131 -0
- package/dist/tools/metadata/list-processes-grouped.d.ts +2 -0
- package/dist/tools/metadata/list-processes-grouped.js +96 -0
- package/dist/tools/metadata/list-processes.d.ts +2 -0
- package/dist/tools/metadata/list-processes.js +108 -0
- package/dist/tools/metadata/resolve-default-members.d.ts +2 -0
- package/dist/tools/metadata/resolve-default-members.js +46 -0
- package/dist/tools/model-building/check-cube-rule.d.ts +2 -0
- package/dist/tools/model-building/check-cube-rule.js +51 -0
- package/dist/tools/model-building/clear-cube.d.ts +2 -0
- package/dist/tools/model-building/clear-cube.js +46 -0
- package/dist/tools/model-building/create-cube.d.ts +2 -0
- package/dist/tools/model-building/create-cube.js +34 -0
- package/dist/tools/model-building/delete-cube.d.ts +2 -0
- package/dist/tools/model-building/delete-cube.js +27 -0
- package/dist/tools/model-building/get-all-cube-rules.d.ts +2 -0
- package/dist/tools/model-building/get-all-cube-rules.js +149 -0
- package/dist/tools/model-building/get-cube-rules.d.ts +2 -0
- package/dist/tools/model-building/get-cube-rules.js +69 -0
- package/dist/tools/model-building/rules-source.d.ts +21 -0
- package/dist/tools/model-building/rules-source.js +49 -0
- package/dist/tools/model-building/search-rules.d.ts +2 -0
- package/dist/tools/model-building/search-rules.js +132 -0
- package/dist/tools/model-building/set-cube-rules.d.ts +2 -0
- package/dist/tools/model-building/set-cube-rules.js +81 -0
- package/dist/tools/model-building/unload-cube.d.ts +2 -0
- package/dist/tools/model-building/unload-cube.js +23 -0
- package/dist/tools/operations/diagnose-process-error.d.ts +2 -0
- package/dist/tools/operations/diagnose-process-error.js +178 -0
- package/dist/tools/operations/error-log-helpers.d.ts +25 -0
- package/dist/tools/operations/error-log-helpers.js +57 -0
- package/dist/tools/operations/get-audit-log.d.ts +2 -0
- package/dist/tools/operations/get-audit-log.js +70 -0
- package/dist/tools/operations/get-cube-stats.d.ts +2 -0
- package/dist/tools/operations/get-cube-stats.js +107 -0
- package/dist/tools/operations/get-error-log-content.d.ts +2 -0
- package/dist/tools/operations/get-error-log-content.js +164 -0
- package/dist/tools/operations/get-jobs.d.ts +3 -0
- package/dist/tools/operations/get-jobs.js +51 -0
- package/dist/tools/operations/get-message-log.d.ts +2 -0
- package/dist/tools/operations/get-message-log.js +63 -0
- package/dist/tools/operations/get-server-info.d.ts +2 -0
- package/dist/tools/operations/get-server-info.js +180 -0
- package/dist/tools/operations/get-server-state.d.ts +2 -0
- package/dist/tools/operations/get-server-state.js +129 -0
- package/dist/tools/operations/get-sessions.d.ts +2 -0
- package/dist/tools/operations/get-sessions.js +76 -0
- package/dist/tools/operations/get-threads.d.ts +3 -0
- package/dist/tools/operations/get-threads.js +50 -0
- package/dist/tools/operations/get-transaction-log.d.ts +2 -0
- package/dist/tools/operations/get-transaction-log.js +63 -0
- package/dist/tools/operations/list-error-logs.d.ts +8 -0
- package/dist/tools/operations/list-error-logs.js +157 -0
- package/dist/tools/operations/save-data.d.ts +2 -0
- package/dist/tools/operations/save-data.js +50 -0
- package/dist/tools/pagination.d.ts +32 -0
- package/dist/tools/pagination.js +116 -0
- package/dist/tools/scheduling/create-chore.d.ts +2 -0
- package/dist/tools/scheduling/create-chore.js +93 -0
- package/dist/tools/scheduling/delete-chore.d.ts +2 -0
- package/dist/tools/scheduling/delete-chore.js +22 -0
- package/dist/tools/scheduling/execute-chore.d.ts +2 -0
- package/dist/tools/scheduling/execute-chore.js +52 -0
- package/dist/tools/scheduling/toggle-chore.d.ts +2 -0
- package/dist/tools/scheduling/toggle-chore.js +22 -0
- package/dist/tools/scheduling/update-chore.d.ts +2 -0
- package/dist/tools/scheduling/update-chore.js +71 -0
- package/dist/tools/schemas/common.d.ts +10 -0
- package/dist/tools/schemas/common.js +23 -0
- package/dist/tools/schemas/items-analysis.d.ts +394 -0
- package/dist/tools/schemas/items-analysis.js +419 -0
- package/dist/tools/schemas/items-cells.d.ts +70 -0
- package/dist/tools/schemas/items-cells.js +65 -0
- package/dist/tools/schemas/items-common.d.ts +18 -0
- package/dist/tools/schemas/items-common.js +39 -0
- package/dist/tools/schemas/items-fileops.d.ts +11 -0
- package/dist/tools/schemas/items-fileops.js +13 -0
- package/dist/tools/schemas/items-metadata.d.ts +262 -0
- package/dist/tools/schemas/items-metadata.js +184 -0
- package/dist/tools/schemas/items-monitoring.d.ts +79 -0
- package/dist/tools/schemas/items-monitoring.js +78 -0
- package/dist/tools/schemas/items-processes.d.ts +279 -0
- package/dist/tools/schemas/items-processes.js +235 -0
- package/dist/tools/schemas/items-scheduling.d.ts +25 -0
- package/dist/tools/schemas/items-scheduling.js +26 -0
- package/dist/tools/schemas/items-security.d.ts +19 -0
- package/dist/tools/schemas/items-security.js +12 -0
- package/dist/tools/schemas/items-subsets.d.ts +2 -0
- package/dist/tools/schemas/items-subsets.js +4 -0
- package/dist/tools/schemas/items-views.d.ts +38 -0
- package/dist/tools/schemas/items-views.js +26 -0
- package/dist/tools/schemas/items.d.ts +12 -0
- package/dist/tools/schemas/items.js +23 -0
- package/dist/tools/schemas/markdown-capable.d.ts +21 -0
- package/dist/tools/schemas/markdown-capable.js +58 -0
- package/dist/tools/schemas/output-schema.d.ts +24 -0
- package/dist/tools/schemas/output-schema.js +25 -0
- package/dist/tools/security/assign-client-group.d.ts +2 -0
- package/dist/tools/security/assign-client-group.js +20 -0
- package/dist/tools/security/create-client.d.ts +2 -0
- package/dist/tools/security/create-client.js +28 -0
- package/dist/tools/security/delete-client.d.ts +2 -0
- package/dist/tools/security/delete-client.js +22 -0
- package/dist/tools/security/get-client.d.ts +2 -0
- package/dist/tools/security/get-client.js +20 -0
- package/dist/tools/security/list-clients.d.ts +2 -0
- package/dist/tools/security/list-clients.js +86 -0
- package/dist/tools/security/list-groups.d.ts +2 -0
- package/dist/tools/security/list-groups.js +43 -0
- package/dist/tools/security/remove-client-group.d.ts +2 -0
- package/dist/tools/security/remove-client-group.js +27 -0
- package/dist/tools/security/update-client.d.ts +2 -0
- package/dist/tools/security/update-client.js +22 -0
- package/dist/tools/subsets/create-subset.d.ts +2 -0
- package/dist/tools/subsets/create-subset.js +44 -0
- package/dist/tools/subsets/delete-subset.d.ts +2 -0
- package/dist/tools/subsets/delete-subset.js +26 -0
- package/dist/tools/subsets/get-subset.d.ts +2 -0
- package/dist/tools/subsets/get-subset.js +29 -0
- package/dist/tools/subsets/list-subsets.d.ts +2 -0
- package/dist/tools/subsets/list-subsets.js +36 -0
- package/dist/tools/subsets/update-subset.d.ts +2 -0
- package/dist/tools/subsets/update-subset.js +33 -0
- package/dist/tools/ti-development/check-process-code.d.ts +2 -0
- package/dist/tools/ti-development/check-process-code.js +96 -0
- package/dist/tools/ti-development/compile-process.d.ts +2 -0
- package/dist/tools/ti-development/compile-process.js +32 -0
- package/dist/tools/ti-development/copy-process.d.ts +2 -0
- package/dist/tools/ti-development/copy-process.js +32 -0
- package/dist/tools/ti-development/delete-process.d.ts +2 -0
- package/dist/tools/ti-development/delete-process.js +26 -0
- package/dist/tools/ti-development/diff-process-with-file.d.ts +2 -0
- package/dist/tools/ti-development/diff-process-with-file.js +208 -0
- package/dist/tools/ti-development/diff-processes.d.ts +2 -0
- package/dist/tools/ti-development/diff-processes.js +312 -0
- package/dist/tools/ti-development/execute-process.d.ts +8 -0
- package/dist/tools/ti-development/execute-process.js +109 -0
- package/dist/tools/ti-development/export-process-to-git.d.ts +2 -0
- package/dist/tools/ti-development/export-process-to-git.js +113 -0
- package/dist/tools/ti-development/export-process-to-pro.d.ts +2 -0
- package/dist/tools/ti-development/export-process-to-pro.js +117 -0
- package/dist/tools/ti-development/get-all-processes-code.d.ts +2 -0
- package/dist/tools/ti-development/get-all-processes-code.js +131 -0
- package/dist/tools/ti-development/get-process-code.d.ts +2 -0
- package/dist/tools/ti-development/get-process-code.js +100 -0
- package/dist/tools/ti-development/get-process-datasource.d.ts +2 -0
- package/dist/tools/ti-development/get-process-datasource.js +20 -0
- package/dist/tools/ti-development/get-process-parameters.d.ts +2 -0
- package/dist/tools/ti-development/get-process-parameters.js +25 -0
- package/dist/tools/ti-development/get-process-variables.d.ts +2 -0
- package/dist/tools/ti-development/get-process-variables.js +38 -0
- package/dist/tools/ti-development/get-process.d.ts +2 -0
- package/dist/tools/ti-development/get-process.js +163 -0
- package/dist/tools/ti-development/import-pro-file.d.ts +2 -0
- package/dist/tools/ti-development/import-pro-file.js +153 -0
- package/dist/tools/ti-development/import-process-from-git.d.ts +2 -0
- package/dist/tools/ti-development/import-process-from-git.js +198 -0
- package/dist/tools/ti-development/install-pro-bundle.d.ts +2 -0
- package/dist/tools/ti-development/install-pro-bundle.js +288 -0
- package/dist/tools/ti-development/preflight.d.ts +39 -0
- package/dist/tools/ti-development/preflight.js +56 -0
- package/dist/tools/ti-development/process-backup.d.ts +29 -0
- package/dist/tools/ti-development/process-backup.js +118 -0
- package/dist/tools/ti-development/search-code.d.ts +2 -0
- package/dist/tools/ti-development/search-code.js +208 -0
- package/dist/tools/ti-development/upsert-process.d.ts +2 -0
- package/dist/tools/ti-development/upsert-process.js +167 -0
- package/dist/tools/ti-development/validate-process-refs.d.ts +2 -0
- package/dist/tools/ti-development/validate-process-refs.js +73 -0
- package/dist/tools/views/create-mdx-view.d.ts +2 -0
- package/dist/tools/views/create-mdx-view.js +21 -0
- package/dist/tools/views/create-native-view.d.ts +2 -0
- package/dist/tools/views/create-native-view.js +81 -0
- package/dist/tools/views/delete-view.d.ts +2 -0
- package/dist/tools/views/delete-view.js +23 -0
- package/dist/tools/views/list-views.d.ts +2 -0
- package/dist/tools/views/list-views.js +32 -0
- package/dist/tools/with-annotations.d.ts +6 -0
- package/dist/tools/with-annotations.js +339 -0
- package/dist/types.d.ts +409 -0
- package/dist/types.js +91 -0
- package/dist/version.d.ts +4 -0
- package/dist/version.js +18 -0
- package/package.json +107 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Guard for blanket fallback catch blocks. Rethrows systemic transport/auth
|
|
3
|
+
* errors and any non-TM1Error (programming errors, unexpected throws); returns
|
|
4
|
+
* for expected, handleable codes (NOT_FOUND / PERMISSION_DENIED / TM1_ERROR /
|
|
5
|
+
* UNSUPPORTED_OPERATION / CONFLICT / VALIDATION_ERROR) so the existing
|
|
6
|
+
* fallback or skip behavior is preserved.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* try { ...primary... }
|
|
10
|
+
* catch (e) { rethrowIfSystemic(e); ...fallback... }
|
|
11
|
+
*/
|
|
12
|
+
export declare function rethrowIfSystemic(e: unknown): void;
|
|
13
|
+
/**
|
|
14
|
+
* Stricter variant for transaction-log windowing/probe paths: rethrows
|
|
15
|
+
* everything `rethrowIfSystemic` does AND `PERMISSION_DENIED`. Here a permission
|
|
16
|
+
* denial (e.g. cube-level security on a filtered query) must surface — swallowing
|
|
17
|
+
* it would return an empty window that reads as "no transactions in range",
|
|
18
|
+
* hiding the fact the caller simply cannot see the data. Use this instead of
|
|
19
|
+
* `rethrowIfSystemic` wherever an empty result is otherwise indistinguishable
|
|
20
|
+
* from "access denied".
|
|
21
|
+
*/
|
|
22
|
+
export declare function rethrowIfSystemicOrDenied(e: unknown): void;
|
|
23
|
+
/**
|
|
24
|
+
* True when TM1 refused the SHAPE of the query rather than the request itself.
|
|
25
|
+
*
|
|
26
|
+
* This is a different axis from `rethrowIfSystemic*`, not a competing
|
|
27
|
+
* classification: those two answer "may this error be swallowed at all?", this
|
|
28
|
+
* one answers "is re-asking the same resource with a different OData query
|
|
29
|
+
* even capable of helping?". Use it AFTER the systemic guard, never instead of
|
|
30
|
+
* it.
|
|
31
|
+
*
|
|
32
|
+
* Only two answers qualify. TM1 rejects a `$select`/`$expand` it cannot parse
|
|
33
|
+
* or does not implement with 400 (its catch-all for a malformed query option)
|
|
34
|
+
* or 501; both land as `TM1_ERROR` because `classifyHttpError` only special-
|
|
35
|
+
* cases 401/403/404/409. `UNSUPPORTED_OPERATION` is the same verdict raised by
|
|
36
|
+
* our own version gates.
|
|
37
|
+
*
|
|
38
|
+
* Everything else is deliberately excluded. A 404 says the collection is not
|
|
39
|
+
* there — no rewording of the query brings it back. A 500 is a server fault or
|
|
40
|
+
* a transient, and retrying it three more times with broader queries just
|
|
41
|
+
* multiplies the outage (see P7: four sequential full scans at ~30 s each).
|
|
42
|
+
*/
|
|
43
|
+
export declare function isUnsupportedQueryShape(e: unknown): boolean;
|
|
44
|
+
//# sourceMappingURL=fallback.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { TM1Error, TM1ErrorCode } from "../../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Transport/auth failures that must NEVER be swallowed by a fallback or
|
|
4
|
+
* "feature not present" catch block. If one of these surfaces, the caller's
|
|
5
|
+
* fallback path (e.g. v12 Files → v11 Blobs, $select downgrade, skip private
|
|
6
|
+
* scope) would mask a real outage — returning empty/partial data as if the
|
|
7
|
+
* server simply lacked the feature.
|
|
8
|
+
*/
|
|
9
|
+
const SYSTEMIC_CODES = new Set([
|
|
10
|
+
TM1ErrorCode.AUTH_FAILED,
|
|
11
|
+
TM1ErrorCode.CONNECTION_FAILED,
|
|
12
|
+
TM1ErrorCode.LOCK_TIMEOUT,
|
|
13
|
+
]);
|
|
14
|
+
/**
|
|
15
|
+
* Guard for blanket fallback catch blocks. Rethrows systemic transport/auth
|
|
16
|
+
* errors and any non-TM1Error (programming errors, unexpected throws); returns
|
|
17
|
+
* for expected, handleable codes (NOT_FOUND / PERMISSION_DENIED / TM1_ERROR /
|
|
18
|
+
* UNSUPPORTED_OPERATION / CONFLICT / VALIDATION_ERROR) so the existing
|
|
19
|
+
* fallback or skip behavior is preserved.
|
|
20
|
+
*
|
|
21
|
+
* Usage:
|
|
22
|
+
* try { ...primary... }
|
|
23
|
+
* catch (e) { rethrowIfSystemic(e); ...fallback... }
|
|
24
|
+
*/
|
|
25
|
+
export function rethrowIfSystemic(e) {
|
|
26
|
+
if (e instanceof TM1Error && !SYSTEMIC_CODES.has(e.code))
|
|
27
|
+
return;
|
|
28
|
+
throw e;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Stricter variant for transaction-log windowing/probe paths: rethrows
|
|
32
|
+
* everything `rethrowIfSystemic` does AND `PERMISSION_DENIED`. Here a permission
|
|
33
|
+
* denial (e.g. cube-level security on a filtered query) must surface — swallowing
|
|
34
|
+
* it would return an empty window that reads as "no transactions in range",
|
|
35
|
+
* hiding the fact the caller simply cannot see the data. Use this instead of
|
|
36
|
+
* `rethrowIfSystemic` wherever an empty result is otherwise indistinguishable
|
|
37
|
+
* from "access denied".
|
|
38
|
+
*/
|
|
39
|
+
export function rethrowIfSystemicOrDenied(e) {
|
|
40
|
+
if (e instanceof TM1Error && e.code === TM1ErrorCode.PERMISSION_DENIED)
|
|
41
|
+
throw e;
|
|
42
|
+
rethrowIfSystemic(e);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* True when TM1 refused the SHAPE of the query rather than the request itself.
|
|
46
|
+
*
|
|
47
|
+
* This is a different axis from `rethrowIfSystemic*`, not a competing
|
|
48
|
+
* classification: those two answer "may this error be swallowed at all?", this
|
|
49
|
+
* one answers "is re-asking the same resource with a different OData query
|
|
50
|
+
* even capable of helping?". Use it AFTER the systemic guard, never instead of
|
|
51
|
+
* it.
|
|
52
|
+
*
|
|
53
|
+
* Only two answers qualify. TM1 rejects a `$select`/`$expand` it cannot parse
|
|
54
|
+
* or does not implement with 400 (its catch-all for a malformed query option)
|
|
55
|
+
* or 501; both land as `TM1_ERROR` because `classifyHttpError` only special-
|
|
56
|
+
* cases 401/403/404/409. `UNSUPPORTED_OPERATION` is the same verdict raised by
|
|
57
|
+
* our own version gates.
|
|
58
|
+
*
|
|
59
|
+
* Everything else is deliberately excluded. A 404 says the collection is not
|
|
60
|
+
* there — no rewording of the query brings it back. A 500 is a server fault or
|
|
61
|
+
* a transient, and retrying it three more times with broader queries just
|
|
62
|
+
* multiplies the outage (see P7: four sequential full scans at ~30 s each).
|
|
63
|
+
*/
|
|
64
|
+
export function isUnsupportedQueryShape(e) {
|
|
65
|
+
if (!(e instanceof TM1Error))
|
|
66
|
+
return false;
|
|
67
|
+
if (e.code === TM1ErrorCode.UNSUPPORTED_OPERATION)
|
|
68
|
+
return true;
|
|
69
|
+
return (e.code === TM1ErrorCode.TM1_ERROR &&
|
|
70
|
+
(e.httpStatus === 400 || e.httpStatus === 501));
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=fallback.js.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { TM1HttpClient } from "../http.js";
|
|
2
|
+
export declare class FileService {
|
|
3
|
+
private readonly http;
|
|
4
|
+
constructor(http: TM1HttpClient);
|
|
5
|
+
/**
|
|
6
|
+
* List files in TM1 server's blob/file storage.
|
|
7
|
+
* v12: GET /api/v1/Contents('Files')[/Contents('subdir')...]/Contents?$select=Name
|
|
8
|
+
* v11: same with 'Blobs' instead of 'Files'.
|
|
9
|
+
* Tries v12 'Files' first, falls back to v11 'Blobs'.
|
|
10
|
+
*/
|
|
11
|
+
list(path?: string): Promise<string[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Get the content of a file from TM1 server's blob/file storage.
|
|
14
|
+
* Returns raw text (CSV/TXT/etc).
|
|
15
|
+
* Tries v12 'Files' first, falls back to v11 'Blobs'.
|
|
16
|
+
*/
|
|
17
|
+
getContent(fileName: string): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Check whether a file exists. Tries v12 'Files' first, falls back to 'Blobs'.
|
|
20
|
+
* Implemented as a cheap GET on the entity ($select=Name) — TM1 REST does
|
|
21
|
+
* not expose HEAD on these. 404 → false; other errors propagate.
|
|
22
|
+
*/
|
|
23
|
+
exists(fileName: string): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Upload (create-or-update) a file. Two-step v11 protocol:
|
|
26
|
+
* 1. POST entity into the parent Contents collection (only if missing)
|
|
27
|
+
* 2. PUT raw bytes to the entity's /Content
|
|
28
|
+
* Tries 'Files' (v12) first, falls back to 'Blobs' (v11).
|
|
29
|
+
*
|
|
30
|
+
* Subfolders only supported on TM1 v12. Caller must ensure parent folders
|
|
31
|
+
* exist (folder-create not yet exposed).
|
|
32
|
+
*/
|
|
33
|
+
upload(fileName: string, content: Uint8Array): Promise<{
|
|
34
|
+
created: boolean;
|
|
35
|
+
root: "Files" | "Blobs";
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* Delete a file from blob/file storage. Tries 'Files' first, then 'Blobs'.
|
|
39
|
+
*/
|
|
40
|
+
delete(fileName: string): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Search file names in a folder using OData $filter.
|
|
43
|
+
* - startswith: case-insensitive prefix match
|
|
44
|
+
* - contains: list of case-insensitive substring matches, joined by `operator`
|
|
45
|
+
*/
|
|
46
|
+
search(opts: {
|
|
47
|
+
startswith?: string | undefined;
|
|
48
|
+
contains?: string[] | undefined;
|
|
49
|
+
operator?: "and" | "or" | undefined;
|
|
50
|
+
path?: string | undefined;
|
|
51
|
+
}): Promise<string[]>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=file-service.d.ts.map
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { TM1Error, TM1ErrorCode } from "../../types.js";
|
|
2
|
+
import { rethrowIfSystemic } from "./fallback.js";
|
|
3
|
+
// OData entity-key encoder: double single quotes per OData literal rules, then
|
|
4
|
+
// percent-encode. Without the doubling a name containing ' breaks the key and
|
|
5
|
+
// makes the object unreachable.
|
|
6
|
+
const enc = (s) => encodeURIComponent(String(s).replace(/'/g, "''"));
|
|
7
|
+
// Split a user-supplied file path into segments, rejecting "." / ".." so a
|
|
8
|
+
// crafted name cannot traverse outside the Contents root.
|
|
9
|
+
function splitPath(raw) {
|
|
10
|
+
const parts = raw.split("/").filter(Boolean);
|
|
11
|
+
if (parts.some((p) => p === "." || p === "..")) {
|
|
12
|
+
throw new TM1Error({
|
|
13
|
+
code: TM1ErrorCode.VALIDATION_ERROR,
|
|
14
|
+
message: `Invalid path "${raw}": "." and ".." segments are not allowed`,
|
|
15
|
+
endpoint: raw,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return parts;
|
|
19
|
+
}
|
|
20
|
+
export class FileService {
|
|
21
|
+
http;
|
|
22
|
+
constructor(http) {
|
|
23
|
+
this.http = http;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* List files in TM1 server's blob/file storage.
|
|
27
|
+
* v12: GET /api/v1/Contents('Files')[/Contents('subdir')...]/Contents?$select=Name
|
|
28
|
+
* v11: same with 'Blobs' instead of 'Files'.
|
|
29
|
+
* Tries v12 'Files' first, falls back to v11 'Blobs'.
|
|
30
|
+
*/
|
|
31
|
+
async list(path) {
|
|
32
|
+
const segments = path ? splitPath(path) : [];
|
|
33
|
+
const buildUrl = (root) => {
|
|
34
|
+
let url = `/api/v1/Contents('${enc(root)}')`;
|
|
35
|
+
for (const seg of segments) {
|
|
36
|
+
url += `/Contents('${enc(seg)}')`;
|
|
37
|
+
}
|
|
38
|
+
url += "/Contents?$select=Name";
|
|
39
|
+
return url;
|
|
40
|
+
};
|
|
41
|
+
try {
|
|
42
|
+
const r = await this.http.request("GET", buildUrl("Files"));
|
|
43
|
+
return r.value.map((f) => f.Name);
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
rethrowIfSystemic(e);
|
|
47
|
+
const r = await this.http.request("GET", buildUrl("Blobs"));
|
|
48
|
+
return r.value.map((f) => f.Name);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get the content of a file from TM1 server's blob/file storage.
|
|
53
|
+
* Returns raw text (CSV/TXT/etc).
|
|
54
|
+
* Tries v12 'Files' first, falls back to v11 'Blobs'.
|
|
55
|
+
*/
|
|
56
|
+
async getContent(fileName) {
|
|
57
|
+
const parts = splitPath(fileName);
|
|
58
|
+
const buildUrl = (root) => {
|
|
59
|
+
let url = `/api/v1/Contents('${enc(root)}')`;
|
|
60
|
+
for (const p of parts) {
|
|
61
|
+
url += `/Contents('${enc(p)}')`;
|
|
62
|
+
}
|
|
63
|
+
url += "/Content";
|
|
64
|
+
return url;
|
|
65
|
+
};
|
|
66
|
+
try {
|
|
67
|
+
return await this.http.requestRaw("GET", buildUrl("Files"));
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
rethrowIfSystemic(e);
|
|
71
|
+
return await this.http.requestRaw("GET", buildUrl("Blobs"));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Check whether a file exists. Tries v12 'Files' first, falls back to 'Blobs'.
|
|
76
|
+
* Implemented as a cheap GET on the entity ($select=Name) — TM1 REST does
|
|
77
|
+
* not expose HEAD on these. 404 → false; other errors propagate.
|
|
78
|
+
*/
|
|
79
|
+
async exists(fileName) {
|
|
80
|
+
const parts = splitPath(fileName);
|
|
81
|
+
if (parts.length === 0)
|
|
82
|
+
return false;
|
|
83
|
+
const buildUrl = (root) => {
|
|
84
|
+
const segs = parts
|
|
85
|
+
.slice(0, -1)
|
|
86
|
+
.map((s) => `/Contents('${enc(s)}')`)
|
|
87
|
+
.join("");
|
|
88
|
+
// parts.length > 0 is guarded above
|
|
89
|
+
const last = parts[parts.length - 1];
|
|
90
|
+
return `/api/v1/Contents('${enc(root)}')${segs}/Contents('${enc(last)}')?$select=Name`;
|
|
91
|
+
};
|
|
92
|
+
const probe = async (url) => {
|
|
93
|
+
try {
|
|
94
|
+
await this.http.request("GET", url);
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
const code = e.code;
|
|
99
|
+
if (code === "NOT_FOUND")
|
|
100
|
+
return false;
|
|
101
|
+
throw e;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
if (await probe(buildUrl("Files")))
|
|
105
|
+
return true;
|
|
106
|
+
return probe(buildUrl("Blobs"));
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Upload (create-or-update) a file. Two-step v11 protocol:
|
|
110
|
+
* 1. POST entity into the parent Contents collection (only if missing)
|
|
111
|
+
* 2. PUT raw bytes to the entity's /Content
|
|
112
|
+
* Tries 'Files' (v12) first, falls back to 'Blobs' (v11).
|
|
113
|
+
*
|
|
114
|
+
* Subfolders only supported on TM1 v12. Caller must ensure parent folders
|
|
115
|
+
* exist (folder-create not yet exposed).
|
|
116
|
+
*/
|
|
117
|
+
async upload(fileName, content) {
|
|
118
|
+
const parts = splitPath(fileName);
|
|
119
|
+
if (parts.length === 0) {
|
|
120
|
+
throw new TM1Error({
|
|
121
|
+
code: TM1ErrorCode.VALIDATION_ERROR,
|
|
122
|
+
message: "upload: empty file name",
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
// parts.length > 0 is guarded above
|
|
126
|
+
const leaf = parts[parts.length - 1];
|
|
127
|
+
const parentSegs = parts
|
|
128
|
+
.slice(0, -1)
|
|
129
|
+
.map((s) => `/Contents('${enc(s)}')`)
|
|
130
|
+
.join("");
|
|
131
|
+
const tryRoot = async (root) => {
|
|
132
|
+
const parentUrl = `/api/v1/Contents('${enc(root)}')${parentSegs}/Contents`;
|
|
133
|
+
const contentUrl = `/api/v1/Contents('${enc(root)}')${parentSegs}/Contents('${enc(leaf)}')/Content`;
|
|
134
|
+
const existed = await this.exists(fileName).catch(() => false);
|
|
135
|
+
if (!existed) {
|
|
136
|
+
await this.http.request("POST", parentUrl, {
|
|
137
|
+
"@odata.type": "#ibm.tm1.api.v1.Document",
|
|
138
|
+
ID: leaf,
|
|
139
|
+
Name: leaf,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
await this.http.requestBinary("PUT", contentUrl, content);
|
|
143
|
+
return { created: !existed, root };
|
|
144
|
+
};
|
|
145
|
+
try {
|
|
146
|
+
return await tryRoot("Files");
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
const code = e.code;
|
|
150
|
+
if (code !== "NOT_FOUND")
|
|
151
|
+
throw e;
|
|
152
|
+
return await tryRoot("Blobs");
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Delete a file from blob/file storage. Tries 'Files' first, then 'Blobs'.
|
|
157
|
+
*/
|
|
158
|
+
async delete(fileName) {
|
|
159
|
+
const parts = splitPath(fileName);
|
|
160
|
+
if (parts.length === 0) {
|
|
161
|
+
throw new TM1Error({
|
|
162
|
+
code: TM1ErrorCode.VALIDATION_ERROR,
|
|
163
|
+
message: "delete: empty file name",
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
const buildUrl = (root) => {
|
|
167
|
+
const segs = parts.map((s) => `/Contents('${enc(s)}')`).join("");
|
|
168
|
+
return `/api/v1/Contents('${enc(root)}')${segs}`;
|
|
169
|
+
};
|
|
170
|
+
try {
|
|
171
|
+
await this.http.request("DELETE", buildUrl("Files"));
|
|
172
|
+
}
|
|
173
|
+
catch (e) {
|
|
174
|
+
const code = e.code;
|
|
175
|
+
if (code !== "NOT_FOUND")
|
|
176
|
+
throw e;
|
|
177
|
+
await this.http.request("DELETE", buildUrl("Blobs"));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Search file names in a folder using OData $filter.
|
|
182
|
+
* - startswith: case-insensitive prefix match
|
|
183
|
+
* - contains: list of case-insensitive substring matches, joined by `operator`
|
|
184
|
+
*/
|
|
185
|
+
async search(opts) {
|
|
186
|
+
const operator = opts.operator ?? "and";
|
|
187
|
+
const segments = opts.path ? splitPath(opts.path) : [];
|
|
188
|
+
const escape = (s) => s.replace(/'/g, "''");
|
|
189
|
+
const filters = [];
|
|
190
|
+
if (opts.startswith) {
|
|
191
|
+
filters.push(`startswith(tolower(Name),tolower('${escape(opts.startswith)}'))`);
|
|
192
|
+
}
|
|
193
|
+
if (opts.contains && opts.contains.length > 0) {
|
|
194
|
+
const subs = opts.contains.map((s) => `contains(tolower(Name),tolower('${escape(s)}'))`);
|
|
195
|
+
filters.push(`(${subs.join(` ${operator} `)})`);
|
|
196
|
+
}
|
|
197
|
+
const filter = filters.length > 0
|
|
198
|
+
? `&$filter=${encodeURIComponent(filters.join(" and "))}`
|
|
199
|
+
: "";
|
|
200
|
+
const buildUrl = (root) => {
|
|
201
|
+
let url = `/api/v1/Contents('${enc(root)}')`;
|
|
202
|
+
for (const seg of segments)
|
|
203
|
+
url += `/Contents('${enc(seg)}')`;
|
|
204
|
+
url += `/Contents?$select=Name${filter}`;
|
|
205
|
+
return url;
|
|
206
|
+
};
|
|
207
|
+
try {
|
|
208
|
+
const r = await this.http.request("GET", buildUrl("Files"));
|
|
209
|
+
return r.value.map((f) => f.Name);
|
|
210
|
+
}
|
|
211
|
+
catch (e) {
|
|
212
|
+
rethrowIfSystemic(e);
|
|
213
|
+
const r = await this.http.request("GET", buildUrl("Blobs"));
|
|
214
|
+
return r.value.map((f) => f.Name);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=file-service.js.map
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { Hierarchy, HierarchyElement } from "../../types.js";
|
|
2
|
+
import type { TM1HttpClient } from "../http.js";
|
|
3
|
+
/**
|
|
4
|
+
* A hierarchy plus the size of the element set the request selected, so
|
|
5
|
+
* callers can page without guessing. `totalElements` counts elements that
|
|
6
|
+
* survived *every* filter — the server-side `$filter` ones via
|
|
7
|
+
* `Elements@odata.count`, the client-side ones (elementType, nameRegex) by
|
|
8
|
+
* counting what is left after filtering. It is therefore always exact, and
|
|
9
|
+
* always ≥ `elements.length`.
|
|
10
|
+
*/
|
|
11
|
+
export type HierarchyPage = Hierarchy & {
|
|
12
|
+
totalElements: number;
|
|
13
|
+
};
|
|
14
|
+
/** Element filters shared by {@link HierarchyService.get} and {@link HierarchyService.getCounts}. */
|
|
15
|
+
export interface ElementFilterOpts {
|
|
16
|
+
level?: number;
|
|
17
|
+
levelMax?: number;
|
|
18
|
+
elementType?: "Numeric" | "String" | "Consolidated" | "All";
|
|
19
|
+
nameContains?: string;
|
|
20
|
+
nameStartsWith?: string;
|
|
21
|
+
nameRegex?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Element totals of a (filtered) hierarchy, without the elements. */
|
|
24
|
+
export interface HierarchyCounts {
|
|
25
|
+
total: number;
|
|
26
|
+
byType: {
|
|
27
|
+
Numeric: number;
|
|
28
|
+
String: number;
|
|
29
|
+
Consolidated: number;
|
|
30
|
+
};
|
|
31
|
+
/** Level → element count. Keys are the level as a string ("0" = leaves). */
|
|
32
|
+
byLevel: Record<string, number>;
|
|
33
|
+
maxLevel: number;
|
|
34
|
+
}
|
|
35
|
+
export declare class HierarchyService {
|
|
36
|
+
private readonly http;
|
|
37
|
+
constructor(http: TM1HttpClient);
|
|
38
|
+
/**
|
|
39
|
+
* Get a specific hierarchy with its elements, including parent/child
|
|
40
|
+
* relationships. TM1 11.8 does not expose `Children` on Element, only
|
|
41
|
+
* `Parents` — children are derived client-side. Filtered-out parents are
|
|
42
|
+
* removed from the surviving elements' parents/children arrays to avoid
|
|
43
|
+
* dangling references.
|
|
44
|
+
*
|
|
45
|
+
* GET /api/v1/Dimensions('{d}')/Hierarchies('{h}')?$expand=Elements(...)
|
|
46
|
+
*
|
|
47
|
+
* Paging: when no client-side post-filter is needed, `topN`/`skip` are
|
|
48
|
+
* pushed into the nested Elements expand together with `$orderby=Name` and
|
|
49
|
+
* `$count=true`. On a live 211k-element dimension that is 48 KB/page against
|
|
50
|
+
* 67 MB for the unbounded fetch. `$orderby` is not optional — without it
|
|
51
|
+
* `$skip` walks TM1's internal index order, which shifts on every element
|
|
52
|
+
* create/delete and would duplicate or drop elements between pages.
|
|
53
|
+
*/
|
|
54
|
+
get(dimensionName: string, hierarchyName: string, opts?: ElementFilterOpts & {
|
|
55
|
+
topN?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Elements to skip before `topN`. Applied server-side when possible and
|
|
58
|
+
* after client-side filtering otherwise, so the caller sees the same
|
|
59
|
+
* pagination semantics either way.
|
|
60
|
+
*/
|
|
61
|
+
skip?: number;
|
|
62
|
+
}): Promise<HierarchyPage>;
|
|
63
|
+
/**
|
|
64
|
+
* Element totals by type and level for a (filtered) hierarchy — no element
|
|
65
|
+
* rows. Reads the Elements collection with `$select=Type,Level` (plus Name
|
|
66
|
+
* only when a regex has to run client-side), so a count over a 200k-element
|
|
67
|
+
* dimension costs a few MB of wire traffic and a few hundred bytes of reply,
|
|
68
|
+
* where probing with growing `topN` returned the elements themselves.
|
|
69
|
+
*
|
|
70
|
+
* GET /api/v1/Dimensions('{d}')/Hierarchies('{h}')/Elements?$select=Type,Level
|
|
71
|
+
*/
|
|
72
|
+
getCounts(dimensionName: string, hierarchyName: string, opts?: ElementFilterOpts): Promise<HierarchyCounts>;
|
|
73
|
+
/**
|
|
74
|
+
* Element name + type for a whole hierarchy — nothing else.
|
|
75
|
+
*
|
|
76
|
+
* `get()` is the wrong tool for a type lookup: it expands `Parents` and
|
|
77
|
+
* `Edges` on every element to build the tree and weight the children. This
|
|
78
|
+
* reads the Elements collection directly with `$select=Name,Type` — no
|
|
79
|
+
* expand at all — which is the minimum payload for name → type resolution.
|
|
80
|
+
*
|
|
81
|
+
* GET /api/v1/Dimensions('{d}')/Hierarchies('{h}')/Elements?$select=Name,Type
|
|
82
|
+
*/
|
|
83
|
+
getElementTypes(dimensionName: string, hierarchyName: string): Promise<Array<{
|
|
84
|
+
name: string;
|
|
85
|
+
type: HierarchyElement["type"];
|
|
86
|
+
}>>;
|
|
87
|
+
/**
|
|
88
|
+
* Resolve descendants of a consolidation element via client-side BFS over
|
|
89
|
+
* the full hierarchy. Returns a flat list with depth from the start element.
|
|
90
|
+
* Reuses get() — REST traffic identical, but the LLM-facing payload is a
|
|
91
|
+
* focused subtree, not the whole dimension.
|
|
92
|
+
*/
|
|
93
|
+
getDescendants(dimensionName: string, hierarchyName: string, element: string, opts?: {
|
|
94
|
+
depth?: number;
|
|
95
|
+
leavesOnly?: boolean;
|
|
96
|
+
}): Promise<{
|
|
97
|
+
element: string;
|
|
98
|
+
descendants: Array<{
|
|
99
|
+
name: string;
|
|
100
|
+
type: HierarchyElement["type"];
|
|
101
|
+
level: number;
|
|
102
|
+
depth: number;
|
|
103
|
+
}>;
|
|
104
|
+
}>;
|
|
105
|
+
/**
|
|
106
|
+
* Resolve ancestors of an element via parent-walk. Handles multi-parent
|
|
107
|
+
* hierarchies — returns the unique flat ancestor set AND every distinct
|
|
108
|
+
* root-to-element path so consumers can see consolidation alternatives.
|
|
109
|
+
*/
|
|
110
|
+
getAncestors(dimensionName: string, hierarchyName: string, element: string): Promise<{
|
|
111
|
+
element: string;
|
|
112
|
+
ancestors: Array<{
|
|
113
|
+
name: string;
|
|
114
|
+
level: number;
|
|
115
|
+
}>;
|
|
116
|
+
paths: string[][];
|
|
117
|
+
}>;
|
|
118
|
+
/**
|
|
119
|
+
* Create a new hierarchy inside an existing dimension.
|
|
120
|
+
* POST /api/v1/Dimensions('{d}')/Hierarchies
|
|
121
|
+
*/
|
|
122
|
+
create(dimensionName: string, hierarchyName: string): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Delete a hierarchy from a dimension.
|
|
125
|
+
* DELETE /api/v1/Dimensions('{d}')/Hierarchies('{h}')
|
|
126
|
+
*/
|
|
127
|
+
delete(dimensionName: string, hierarchyName: string): Promise<void>;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=hierarchy-service.d.ts.map
|