@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,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { actionResponse } from "../format.js";
|
|
3
|
+
import { CONFIRM_SCHEMA, requireConfirm } from "../confirm.js";
|
|
4
|
+
import { DESTRUCTIVE } from "../annotations.js";
|
|
5
|
+
import { MutationResultSchema } from "../schemas/items.js";
|
|
6
|
+
import { defineTool } from "../define-tool.js";
|
|
7
|
+
export const registerClearCube = defineTool({
|
|
8
|
+
name: "tm1_clear_cube",
|
|
9
|
+
description: [
|
|
10
|
+
"Clear a subset of cells from a cube. For each dimension, pass either specific element names or an empty array to select all elements (wildcard).",
|
|
11
|
+
"The dimensions array must match the cube's dimension order. Consolidated elements expand to their leaves. Prefer TI for reproducible loads — this is for ad-hoc resets.",
|
|
12
|
+
"Irreversible: cleared cells return zero/empty on next read. Safety: pass confirm=<cube name verbatim>. Mismatched confirm rejects the call.",
|
|
13
|
+
"Before: tm1_sample_cells to confirm the slice you intend to wipe.",
|
|
14
|
+
],
|
|
15
|
+
annotations: DESTRUCTIVE,
|
|
16
|
+
output: MutationResultSchema,
|
|
17
|
+
input: {
|
|
18
|
+
cubeName: z.string().describe("Cube to clear"),
|
|
19
|
+
dimensions: z.array(z.string()).describe("Cube's dimensions in order"),
|
|
20
|
+
tuples: z
|
|
21
|
+
.array(z.array(z.string()))
|
|
22
|
+
.describe("Per-dimension element lists (same length as dimensions). Empty array = all elements on that dimension."),
|
|
23
|
+
...CONFIRM_SCHEMA,
|
|
24
|
+
},
|
|
25
|
+
handler: async ({ cubeName, dimensions, tuples, confirm }, tm1Client) => {
|
|
26
|
+
requireConfirm(confirm, cubeName, "cube");
|
|
27
|
+
if (dimensions.length !== tuples.length) {
|
|
28
|
+
return {
|
|
29
|
+
isError: true,
|
|
30
|
+
content: [
|
|
31
|
+
{
|
|
32
|
+
type: "text",
|
|
33
|
+
text: `dimensions (${dimensions.length}) and tuples (${tuples.length}) must have the same length.`,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
await tm1Client.cubes.clear(cubeName, dimensions, tuples);
|
|
39
|
+
const summary = dimensions
|
|
40
|
+
// dimensions.length === tuples.length is guarded above
|
|
41
|
+
.map((d, i) => `${d}=${tuples[i].length === 0 ? "*" : tuples[i].join("|")}`)
|
|
42
|
+
.join(", ");
|
|
43
|
+
return actionResponse({ success: true, cubeName, summary });
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=clear-cube.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { actionResponse } from "../format.js";
|
|
3
|
+
import { MutationResultSchema } from "../schemas/items.js";
|
|
4
|
+
import { WRITE } from "../annotations.js";
|
|
5
|
+
import { defineTool } from "../define-tool.js";
|
|
6
|
+
export const registerCreateCube = defineTool({
|
|
7
|
+
name: "tm1_create_cube",
|
|
8
|
+
description: [
|
|
9
|
+
"Create a new TM1 cube with the specified dimensions.",
|
|
10
|
+
"The dimension order matters for performance: put dimensions used most often in WHERE clauses first.",
|
|
11
|
+
"All referenced dimensions must exist before calling this tool.",
|
|
12
|
+
"Fails if a cube with the same name already exists — no idempotent variant; delete first with tm1_delete_cube if you intend to replace.",
|
|
13
|
+
"After: tm1_set_cube_rules for calculations, tm1_create_mdx_view for default slices.",
|
|
14
|
+
],
|
|
15
|
+
annotations: WRITE,
|
|
16
|
+
output: MutationResultSchema,
|
|
17
|
+
input: {
|
|
18
|
+
cubeName: z.string().describe("Cube name"),
|
|
19
|
+
dimensions: z
|
|
20
|
+
.array(z.string())
|
|
21
|
+
.min(2)
|
|
22
|
+
.describe("Ordered list of dimension names. Order affects query performance."),
|
|
23
|
+
},
|
|
24
|
+
handler: async ({ cubeName, dimensions }, tm1Client) => {
|
|
25
|
+
await tm1Client.cubes.create(cubeName, dimensions);
|
|
26
|
+
return actionResponse({
|
|
27
|
+
success: true,
|
|
28
|
+
cubeName,
|
|
29
|
+
dimensionCount: dimensions.length,
|
|
30
|
+
dimensions,
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=create-cube.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineTool } from "../define-tool.js";
|
|
3
|
+
import { DESTRUCTIVE } from "../annotations.js";
|
|
4
|
+
import { MutationResultSchema } from "../schemas/items.js";
|
|
5
|
+
import { actionResponse } from "../format.js";
|
|
6
|
+
import { CONFIRM_SCHEMA, requireConfirm } from "../confirm.js";
|
|
7
|
+
import { withToolHint } from "../error-format.js";
|
|
8
|
+
export const registerDeleteCube = defineTool({
|
|
9
|
+
name: "tm1_delete_cube",
|
|
10
|
+
description: [
|
|
11
|
+
"Delete a TM1 cube and all its data. This action is irreversible.",
|
|
12
|
+
"Safety: pass confirm=<cube name verbatim>. Mismatched confirm rejects the call.",
|
|
13
|
+
"Before: tm1_analyze_object_usage to find rules or processes referencing the cube; tm1_get_cube_stats to size the data loss.",
|
|
14
|
+
],
|
|
15
|
+
annotations: DESTRUCTIVE,
|
|
16
|
+
output: MutationResultSchema,
|
|
17
|
+
input: {
|
|
18
|
+
cubeName: z.string().describe("Cube name (case-sensitive)"),
|
|
19
|
+
...CONFIRM_SCHEMA,
|
|
20
|
+
},
|
|
21
|
+
handler: async ({ cubeName, confirm }, tm1Client) => {
|
|
22
|
+
requireConfirm(confirm, cubeName, "cube");
|
|
23
|
+
await withToolHint(tm1Client.cubes.delete(cubeName), "Cube delete failed. Common causes: cube still referenced by TI processes / chores / rules (run tm1_analyze_object_usage to inspect), insufficient permissions, or cube does not exist (tm1_list_cubes to verify name + casing).");
|
|
24
|
+
return actionResponse({ success: true, cubeName });
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=delete-cube.js.map
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CubeRulesSchema } from "../schemas/items.js";
|
|
3
|
+
import { READ_ONLY } from "../annotations.js";
|
|
4
|
+
import { defineTool } from "../define-tool.js";
|
|
5
|
+
// Default cap for full-rules responses. Whole-model rule dumps flood the
|
|
6
|
+
// context window; 50 cubes is plenty for a first look, and the response
|
|
7
|
+
// reports truncated=true so agents know to raise limit (or pass 0 for all).
|
|
8
|
+
const DEFAULT_LIMIT = 50;
|
|
9
|
+
// Best-effort summary parser. TM1 rule grammar is loose; the goal is a useful
|
|
10
|
+
// approximation, not perfect parse. Strips block (/* */) and line (#) comments
|
|
11
|
+
// before counting, splits on the FEEDERS; section boundary, and extracts cube
|
|
12
|
+
// references from DB('Cube', ...) calls.
|
|
13
|
+
function summarize(rulesText) {
|
|
14
|
+
const lines = rulesText.split(/\r?\n/);
|
|
15
|
+
let commentLineCount = 0;
|
|
16
|
+
let feederBoundary = -1;
|
|
17
|
+
for (let i = 0; i < lines.length; i++) {
|
|
18
|
+
const trimmed = lines[i].trim();
|
|
19
|
+
if (trimmed.startsWith("#"))
|
|
20
|
+
commentLineCount++;
|
|
21
|
+
if (feederBoundary < 0 && /^FEEDERS\s*;/i.test(trimmed))
|
|
22
|
+
feederBoundary = i;
|
|
23
|
+
}
|
|
24
|
+
const stripBlock = (s) => s.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
25
|
+
const stripLine = (s) => s.replace(/^[ \t]*#.*$/gm, "");
|
|
26
|
+
const rulesPart = feederBoundary >= 0 ? lines.slice(0, feederBoundary).join("\n") : rulesText;
|
|
27
|
+
const feedersPart = feederBoundary >= 0 ? lines.slice(feederBoundary + 1).join("\n") : "";
|
|
28
|
+
const cleanRules = stripLine(stripBlock(rulesPart));
|
|
29
|
+
const cleanFeeders = stripLine(stripBlock(feedersPart));
|
|
30
|
+
const ruleCount = (cleanRules.match(/;/g) ?? []).length;
|
|
31
|
+
const feederCount = (cleanFeeders.match(/=>/g) ?? []).length;
|
|
32
|
+
const cubeRefs = new Set();
|
|
33
|
+
for (const m of stripBlock(rulesText).matchAll(/\bDB\s*\(\s*['"]([^'"]+)['"]/gi)) {
|
|
34
|
+
cubeRefs.add(m[1]);
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
lineCount: lines.length,
|
|
38
|
+
ruleCount,
|
|
39
|
+
feederCount,
|
|
40
|
+
commentLineCount,
|
|
41
|
+
referencedCubes: [...cubeRefs].sort(),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export const registerGetAllCubeRules = defineTool({
|
|
45
|
+
name: "tm1_get_all_cube_rules",
|
|
46
|
+
description: [
|
|
47
|
+
"Bulk-load rules text for every cube in one call.",
|
|
48
|
+
"Cubes without rules are returned with empty rulesText.",
|
|
49
|
+
"Control cubes (names starting with '}') excluded by default.",
|
|
50
|
+
"Full-rules responses are capped at 50 cubes by default (ordered by name; truncated=true when capped — raise limit or pass limit=0 for all).",
|
|
51
|
+
"Use summary=true to replace rulesText with aggregate metrics (lineCount, ruleCount, feederCount, commentLineCount, referencedCubes) — typical 50–100x payload shrink for rules surveys; summary mode surveys ALL cubes by default.",
|
|
52
|
+
],
|
|
53
|
+
annotations: READ_ONLY,
|
|
54
|
+
output: {
|
|
55
|
+
count: z
|
|
56
|
+
.number()
|
|
57
|
+
.int()
|
|
58
|
+
.describe("Total cubes matched before limit (lower bound if countIsExact=false)"),
|
|
59
|
+
countIsExact: z
|
|
60
|
+
.boolean()
|
|
61
|
+
.describe("False when count is only a lower bound"),
|
|
62
|
+
returned: z.number().int().describe("Cubes in this response after limit"),
|
|
63
|
+
truncated: z.boolean().describe("True when limit dropped cubes"),
|
|
64
|
+
cubes: z.array(CubeRulesSchema).describe("Per-cube rule bundles"),
|
|
65
|
+
},
|
|
66
|
+
input: {
|
|
67
|
+
includeControl: z
|
|
68
|
+
.boolean()
|
|
69
|
+
.optional()
|
|
70
|
+
.default(false)
|
|
71
|
+
.describe("Include TM1 control cubes whose names start with '}' (default: false)"),
|
|
72
|
+
onlyWithRules: z
|
|
73
|
+
.boolean()
|
|
74
|
+
.optional()
|
|
75
|
+
.default(false)
|
|
76
|
+
.describe("Return only cubes that have non-empty rules text (default: false)"),
|
|
77
|
+
summary: z
|
|
78
|
+
.boolean()
|
|
79
|
+
.optional()
|
|
80
|
+
.default(false)
|
|
81
|
+
.describe("Drop rulesText, return aggregate metrics per cube instead (default: false)"),
|
|
82
|
+
limit: z
|
|
83
|
+
.number()
|
|
84
|
+
.int()
|
|
85
|
+
.min(0)
|
|
86
|
+
.max(500)
|
|
87
|
+
.optional()
|
|
88
|
+
.describe("Max cubes returned (default 50, max 500, 0 = all). Summary mode defaults to 0 (full survey)."),
|
|
89
|
+
},
|
|
90
|
+
handler: async ({ includeControl, onlyWithRules, summary, limit }, tm1Client) => {
|
|
91
|
+
// Full-rules mode default-caps at DEFAULT_LIMIT; summary mode defaults
|
|
92
|
+
// to the whole model (metrics are cheap and a partial survey would be
|
|
93
|
+
// misleading). Explicit limit wins in both modes; 0 = no cap.
|
|
94
|
+
const cap = limit ?? (summary ? 0 : DEFAULT_LIMIT);
|
|
95
|
+
let sliced;
|
|
96
|
+
let count;
|
|
97
|
+
let countIsExact;
|
|
98
|
+
let truncated;
|
|
99
|
+
if (cap > 0 && !onlyWithRules) {
|
|
100
|
+
// Server-side cap: $top=cap+1 sentinel detects truncation even if the
|
|
101
|
+
// server omits @odata.count; $orderby=Name keeps the cut stable.
|
|
102
|
+
const { items, total } = await tm1Client.cubes.getAllRules(includeControl, cap + 1);
|
|
103
|
+
truncated = items.length > cap;
|
|
104
|
+
sliced = truncated ? items.slice(0, cap) : items;
|
|
105
|
+
// Truncated without @odata.count only proves "more than cap" — then
|
|
106
|
+
// count is a lower bound, flagged via countIsExact.
|
|
107
|
+
countIsExact = !truncated || total !== undefined;
|
|
108
|
+
count = total ?? items.length;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
// onlyWithRules can't be expressed server-side (whitespace-only rules
|
|
112
|
+
// must not count), so that path fetches all and caps client-side —
|
|
113
|
+
// count/truncated then reflect the post-filter set, like before.
|
|
114
|
+
let all = await tm1Client.cubes.getAllRules(includeControl);
|
|
115
|
+
if (onlyWithRules)
|
|
116
|
+
all = all.filter((c) => c.rulesText.trim().length > 0);
|
|
117
|
+
count = all.length;
|
|
118
|
+
countIsExact = true;
|
|
119
|
+
truncated = cap > 0 && all.length > cap;
|
|
120
|
+
if (truncated) {
|
|
121
|
+
// Match the server-capped path's deterministic name-ordered cut.
|
|
122
|
+
all = [...all].sort((a, b) => a.cubeName.localeCompare(b.cubeName));
|
|
123
|
+
}
|
|
124
|
+
sliced = truncated ? all.slice(0, cap) : all;
|
|
125
|
+
}
|
|
126
|
+
const cubes = summary
|
|
127
|
+
? sliced.map((c) => ({
|
|
128
|
+
cubeName: c.cubeName,
|
|
129
|
+
skipCheck: c.skipCheck,
|
|
130
|
+
...summarize(c.rulesText),
|
|
131
|
+
}))
|
|
132
|
+
: sliced;
|
|
133
|
+
return {
|
|
134
|
+
content: [
|
|
135
|
+
{
|
|
136
|
+
type: "text",
|
|
137
|
+
text: JSON.stringify({
|
|
138
|
+
count,
|
|
139
|
+
countIsExact,
|
|
140
|
+
returned: cubes.length,
|
|
141
|
+
truncated,
|
|
142
|
+
cubes,
|
|
143
|
+
}),
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
};
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
//# sourceMappingURL=get-all-cube-rules.js.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CubeRulesSchema } from "../schemas/items.js";
|
|
3
|
+
import { READ_ONLY } from "../annotations.js";
|
|
4
|
+
import { defineTool } from "../define-tool.js";
|
|
5
|
+
import { TM1Error, TM1ErrorCode } from "../../types.js";
|
|
6
|
+
import { outlineRules, sliceLines, splitLines, } from "../../lib/rules-outline.js";
|
|
7
|
+
export const registerGetCubeRules = defineTool({
|
|
8
|
+
name: "tm1_get_cube_rules",
|
|
9
|
+
description: [
|
|
10
|
+
"Get the current rules text for a TM1 cube. Returns empty string if no rules are defined.",
|
|
11
|
+
"Large rule files: outline=true lists the section markers (SKIPCHECK, FEEDERS, comment headers) with line numbers and lineCount; then lineRange=[from, to] reads just that slice.",
|
|
12
|
+
],
|
|
13
|
+
annotations: READ_ONLY,
|
|
14
|
+
output: CubeRulesSchema,
|
|
15
|
+
input: {
|
|
16
|
+
cubeName: z.string().describe("Cube name (case-sensitive)"),
|
|
17
|
+
outline: z
|
|
18
|
+
.boolean()
|
|
19
|
+
.optional()
|
|
20
|
+
.default(false)
|
|
21
|
+
.describe("Return section markers with 1-based line numbers and lineCount instead of the text."),
|
|
22
|
+
lineRange: z
|
|
23
|
+
.array(z.number().int().positive())
|
|
24
|
+
.length(2)
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("[from, to], 1-based inclusive: return only these lines, verbatim (clamped to the text)."),
|
|
27
|
+
},
|
|
28
|
+
handler: async ({ cubeName, outline, lineRange }, tm1Client) => {
|
|
29
|
+
if (outline && lineRange !== undefined) {
|
|
30
|
+
throw new TM1Error({
|
|
31
|
+
code: TM1ErrorCode.VALIDATION_ERROR,
|
|
32
|
+
message: "outline and lineRange are mutually exclusive — pass one.",
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const [from, to] = lineRange ?? [];
|
|
36
|
+
if (from !== undefined && to !== undefined && from > to) {
|
|
37
|
+
throw new TM1Error({
|
|
38
|
+
code: TM1ErrorCode.VALIDATION_ERROR,
|
|
39
|
+
message: `lineRange [${from}, ${to}] is inverted — from must be ≤ to.`,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const rules = await tm1Client.cubes.getRules(cubeName);
|
|
43
|
+
const text = rules.rulesText ?? "";
|
|
44
|
+
let output = { ...rules };
|
|
45
|
+
if (outline) {
|
|
46
|
+
const { outline: entries, truncated } = outlineRules(text);
|
|
47
|
+
const { rulesText: _omit, ...rest } = rules;
|
|
48
|
+
output = {
|
|
49
|
+
...rest,
|
|
50
|
+
lineCount: text === "" ? 0 : splitLines(text).length,
|
|
51
|
+
outline: entries,
|
|
52
|
+
...(truncated ? { outlineTruncated: true } : {}),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
else if (from !== undefined && to !== undefined) {
|
|
56
|
+
const slice = sliceLines(text, from, to);
|
|
57
|
+
output = {
|
|
58
|
+
...rules,
|
|
59
|
+
rulesText: slice.text,
|
|
60
|
+
lineCount: splitLines(text).length,
|
|
61
|
+
lineRange: [slice.from, slice.to],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
content: [{ type: "text", text: JSON.stringify(output) }],
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=get-cube-rules.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { TM1Client } from "../../tm1-client.js";
|
|
3
|
+
import { type RulesEdit } from "../../lib/rules-patch.js";
|
|
4
|
+
export declare const RULES_SOURCE_SCHEMA: {
|
|
5
|
+
rules: z.ZodOptional<z.ZodString>;
|
|
6
|
+
edits: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
7
|
+
find: z.ZodString;
|
|
8
|
+
replace: z.ZodString;
|
|
9
|
+
}, z.core.$strip>>>;
|
|
10
|
+
filePath: z.ZodOptional<z.ZodString>;
|
|
11
|
+
};
|
|
12
|
+
export interface RulesSource {
|
|
13
|
+
rules?: string | undefined;
|
|
14
|
+
edits?: RulesEdit[] | undefined;
|
|
15
|
+
filePath?: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
export declare function resolveRulesText(tm1Client: TM1Client, cubeName: string, { rules, edits, filePath }: RulesSource): Promise<{
|
|
18
|
+
text: string;
|
|
19
|
+
mode: "full" | "patch" | "file";
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=rules-source.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// The three ways a caller hands over rule text — full `rules`, an `edits`
|
|
2
|
+
// patch against the stored text, or a host `filePath` — resolved to the one
|
|
3
|
+
// full text TM1 will see. Shared by tm1_set_cube_rules (what gets written)
|
|
4
|
+
// and tm1_check_cube_rule (what gets validated), so a patch can be checked
|
|
5
|
+
// exactly as it will be installed without the caller rebuilding the file.
|
|
6
|
+
import { promises as fs } from "node:fs";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { applyRulesPatch } from "../../lib/rules-patch.js";
|
|
9
|
+
import { TM1Error, TM1ErrorCode } from "../../types.js";
|
|
10
|
+
import { resolveLocalPath } from "../local-file.js";
|
|
11
|
+
export const RULES_SOURCE_SCHEMA = {
|
|
12
|
+
rules: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("Full rules text. Put SKIPCHECK; first and a FEEDERS; section after the rule statements — SKIPCHECK is a line in this text, there is no separate switch for it."),
|
|
16
|
+
edits: z
|
|
17
|
+
.array(z.object({ find: z.string(), replace: z.string() }))
|
|
18
|
+
.min(1)
|
|
19
|
+
.optional()
|
|
20
|
+
.describe("Patch: applied in order to the current rules; each find must occur exactly once (quote a get_cube_rules lineRange slice verbatim). Line endings are normalized."),
|
|
21
|
+
filePath: z
|
|
22
|
+
.string()
|
|
23
|
+
.optional()
|
|
24
|
+
.describe("Absolute host path of a full rules file. Disabled unless TM1_LOCAL_FILE_ROOT is set; must resolve within it."),
|
|
25
|
+
};
|
|
26
|
+
export async function resolveRulesText(tm1Client, cubeName, { rules, edits, filePath }) {
|
|
27
|
+
const sources = [rules, edits, filePath].filter((s) => s !== undefined);
|
|
28
|
+
if (sources.length !== 1) {
|
|
29
|
+
throw new TM1Error({
|
|
30
|
+
code: TM1ErrorCode.VALIDATION_ERROR,
|
|
31
|
+
message: `Pass exactly one of rules, edits or filePath (got ${sources.length}).`,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (edits !== undefined) {
|
|
35
|
+
const current = await tm1Client.cubes.getRules(cubeName);
|
|
36
|
+
return {
|
|
37
|
+
text: applyRulesPatch(current.rulesText ?? "", edits),
|
|
38
|
+
mode: "patch",
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (filePath !== undefined) {
|
|
42
|
+
return {
|
|
43
|
+
text: await fs.readFile(resolveLocalPath(filePath), "utf8"),
|
|
44
|
+
mode: "file",
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return { text: rules, mode: "full" };
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=rules-source.js.map
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compileUserRegex } from "../../lib/safe-regex.js";
|
|
3
|
+
import { FORMAT_SCHEMA, wrappedPageResponse, columnsOf } from "../format.js";
|
|
4
|
+
import { PAGINATION_SCHEMA, paginate } from "../pagination.js";
|
|
5
|
+
import { READ_ONLY } from "../annotations.js";
|
|
6
|
+
import { SearchRulesResultSchema } from "../schemas/items.js";
|
|
7
|
+
import { defineTool } from "../define-tool.js";
|
|
8
|
+
export const registerSearchRules = defineTool({
|
|
9
|
+
name: "tm1_search_rules",
|
|
10
|
+
description: [
|
|
11
|
+
"Regex search across cube rules text.",
|
|
12
|
+
"Returns matches with cube name and line number.",
|
|
13
|
+
"Use tm1_get_cube_rules on a hit to inspect the full rules.",
|
|
14
|
+
"Analogue of tm1_search_code for TI processes.",
|
|
15
|
+
],
|
|
16
|
+
annotations: READ_ONLY,
|
|
17
|
+
output: SearchRulesResultSchema,
|
|
18
|
+
input: {
|
|
19
|
+
pattern: z
|
|
20
|
+
.string()
|
|
21
|
+
.describe("Regex pattern (JavaScript flavor). Anchors and groups supported."),
|
|
22
|
+
cubes: z
|
|
23
|
+
.array(z.string())
|
|
24
|
+
.optional()
|
|
25
|
+
.describe("Limit search to these cube names (case-sensitive). Default: all cubes."),
|
|
26
|
+
caseSensitive: z
|
|
27
|
+
.boolean()
|
|
28
|
+
.optional()
|
|
29
|
+
.default(false)
|
|
30
|
+
.describe("Case-sensitive match (default false)"),
|
|
31
|
+
includeControl: z
|
|
32
|
+
.boolean()
|
|
33
|
+
.optional()
|
|
34
|
+
.default(false)
|
|
35
|
+
.describe("Include control cubes ('}'-prefixed). Default false."),
|
|
36
|
+
includeFeeders: z
|
|
37
|
+
.boolean()
|
|
38
|
+
.optional()
|
|
39
|
+
.default(true)
|
|
40
|
+
.describe("Include lines after the FEEDERS marker. Set false to restrict to rule lines only."),
|
|
41
|
+
context: z
|
|
42
|
+
.number()
|
|
43
|
+
.int()
|
|
44
|
+
.min(0)
|
|
45
|
+
.max(10)
|
|
46
|
+
.optional()
|
|
47
|
+
.default(0)
|
|
48
|
+
.describe("Lines of surrounding context above and below each match (default 0). Max 10."),
|
|
49
|
+
maxMatchesPerCube: z
|
|
50
|
+
.number()
|
|
51
|
+
.int()
|
|
52
|
+
.positive()
|
|
53
|
+
.optional()
|
|
54
|
+
.default(50)
|
|
55
|
+
.describe("Cap matches per cube (default 50)"),
|
|
56
|
+
maxTotalMatches: z
|
|
57
|
+
.number()
|
|
58
|
+
.int()
|
|
59
|
+
.positive()
|
|
60
|
+
.optional()
|
|
61
|
+
.default(500)
|
|
62
|
+
.describe("Hard cap on total matches (default 500)"),
|
|
63
|
+
...PAGINATION_SCHEMA,
|
|
64
|
+
...FORMAT_SCHEMA,
|
|
65
|
+
},
|
|
66
|
+
handler: async ({ pattern, cubes: cubeFilter, caseSensitive, includeControl, includeFeeders, context: ctxLines, maxMatchesPerCube, maxTotalMatches, limit, offset, fetchAll, format, }, tm1Client) => {
|
|
67
|
+
const flags = caseSensitive ? "g" : "gi";
|
|
68
|
+
const regex = compileUserRegex(pattern, flags);
|
|
69
|
+
const allRules = await tm1Client.cubes.getAllRules(includeControl);
|
|
70
|
+
const cubeSet = cubeFilter && cubeFilter.length > 0 ? new Set(cubeFilter) : null;
|
|
71
|
+
const FEEDERS_RE = /^\s*FEEDERS\s*;?\s*$/i;
|
|
72
|
+
const matches = [];
|
|
73
|
+
let truncated = false;
|
|
74
|
+
let cubesScanned = 0;
|
|
75
|
+
outer: for (const cubeRules of allRules) {
|
|
76
|
+
if (cubeSet && !cubeSet.has(cubeRules.cubeName))
|
|
77
|
+
continue;
|
|
78
|
+
if (!cubeRules.rulesText)
|
|
79
|
+
continue;
|
|
80
|
+
cubesScanned++;
|
|
81
|
+
const lines = cubeRules.rulesText.split(/\r?\n/);
|
|
82
|
+
let inFeeders = false;
|
|
83
|
+
let perCube = 0;
|
|
84
|
+
for (let i = 0; i < lines.length; i++) {
|
|
85
|
+
const raw = lines[i];
|
|
86
|
+
if (FEEDERS_RE.test(raw))
|
|
87
|
+
inFeeders = true;
|
|
88
|
+
if (inFeeders && !includeFeeders)
|
|
89
|
+
continue;
|
|
90
|
+
regex.lastIndex = 0;
|
|
91
|
+
if (!regex.test(raw))
|
|
92
|
+
continue;
|
|
93
|
+
const ctx = [];
|
|
94
|
+
if (ctxLines > 0) {
|
|
95
|
+
for (let c = Math.max(0, i - ctxLines); c <= Math.min(lines.length - 1, i + ctxLines); c++) {
|
|
96
|
+
if (c !== i)
|
|
97
|
+
ctx.push(lines[c].trim().slice(0, 200));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
matches.push({
|
|
101
|
+
cube: cubeRules.cubeName,
|
|
102
|
+
line: i + 1,
|
|
103
|
+
text: raw.trim().slice(0, 240),
|
|
104
|
+
context: ctx,
|
|
105
|
+
});
|
|
106
|
+
perCube++;
|
|
107
|
+
if (matches.length >= maxTotalMatches) {
|
|
108
|
+
truncated = true;
|
|
109
|
+
break outer;
|
|
110
|
+
}
|
|
111
|
+
if (perCube >= maxMatchesPerCube)
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const page = paginate(matches, limit, offset, fetchAll);
|
|
116
|
+
const wrapper = {
|
|
117
|
+
pattern,
|
|
118
|
+
caseSensitive,
|
|
119
|
+
cubesScanned,
|
|
120
|
+
matchCount: matches.length,
|
|
121
|
+
truncated,
|
|
122
|
+
includeFeeders,
|
|
123
|
+
...page,
|
|
124
|
+
};
|
|
125
|
+
const columns = columnsOf(["cube", "line", "text"]);
|
|
126
|
+
return wrappedPageResponse(wrapper, page, format, {
|
|
127
|
+
title: `Rules search: ${pattern}`,
|
|
128
|
+
columns,
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
//# sourceMappingURL=search-rules.js.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { invalidateCallgraphCache } from "../../lib/callgraph/tm1-adapter.js";
|
|
3
|
+
import { TM1ErrorCode } from "../../types.js";
|
|
4
|
+
import { withToolHint } from "../error-format.js";
|
|
5
|
+
import { actionResponse } from "../format.js";
|
|
6
|
+
import { CONFIRM_SCHEMA, requireConfirm } from "../confirm.js";
|
|
7
|
+
import { IDEMPOTENT_DESTRUCTIVE } from "../annotations.js";
|
|
8
|
+
import { MutationResultSchema } from "../schemas/items.js";
|
|
9
|
+
import { defineTool } from "../define-tool.js";
|
|
10
|
+
import { RULES_SOURCE_SCHEMA, resolveRulesText } from "./rules-source.js";
|
|
11
|
+
export const registerSetCubeRules = defineTool({
|
|
12
|
+
name: "tm1_set_cube_rules",
|
|
13
|
+
description: [
|
|
14
|
+
"Create or replace the rules for a TM1 cube.",
|
|
15
|
+
"SKIPCHECK; belongs at the top and FEEDERS; before all feeder definitions — SKIPCHECK is what makes feeders take effect, so rules with feeders need it.",
|
|
16
|
+
"Pass exactly one source: rules (the full text — replaces everything), edits (find/replace patch against the current text; each find must match exactly once, else nothing is written), or filePath (full text from a host file under TM1_LOCAL_FILE_ROOT).",
|
|
17
|
+
"The full resulting text is syntax-checked before anything is written (preflight). After: tm1_get_cube_rules to read back; the callgraph cache is dropped automatically.",
|
|
18
|
+
],
|
|
19
|
+
annotations: IDEMPOTENT_DESTRUCTIVE,
|
|
20
|
+
output: MutationResultSchema,
|
|
21
|
+
input: {
|
|
22
|
+
cubeName: z.string().describe("Cube name (case-sensitive)"),
|
|
23
|
+
...RULES_SOURCE_SCHEMA,
|
|
24
|
+
...CONFIRM_SCHEMA,
|
|
25
|
+
preflight: z
|
|
26
|
+
.boolean()
|
|
27
|
+
.optional()
|
|
28
|
+
.default(true)
|
|
29
|
+
.describe("Before writing, syntax-check the full text as it will be installed (tm1.CheckRules) and abort on any error. Default true."),
|
|
30
|
+
},
|
|
31
|
+
handler: async ({ cubeName, rules, edits, filePath, confirm, preflight }, tm1Client) => {
|
|
32
|
+
// Replaces the cube's ENTIRE rule file; the previous text is not
|
|
33
|
+
// recoverable through this API. Guards against accidental invocation —
|
|
34
|
+
// not a security control.
|
|
35
|
+
requireConfirm(confirm, cubeName, "cube");
|
|
36
|
+
const { text, mode } = await resolveRulesText(tm1Client, cubeName, {
|
|
37
|
+
rules,
|
|
38
|
+
edits,
|
|
39
|
+
filePath,
|
|
40
|
+
});
|
|
41
|
+
// TM1 11.8 stores rule text with syntax errors without complaint (verified
|
|
42
|
+
// live: `['X'] = N: ['A'] * 2 +;` saved and read back). The cube then
|
|
43
|
+
// computes nothing for those cells until someone notices. CheckRules is
|
|
44
|
+
// the only gate, so it runs here rather than being left to the caller.
|
|
45
|
+
if (preflight) {
|
|
46
|
+
const errors = await tm1Client.cubes.checkRule(cubeName, text);
|
|
47
|
+
if (errors.length > 0) {
|
|
48
|
+
return {
|
|
49
|
+
content: [
|
|
50
|
+
{
|
|
51
|
+
type: "text",
|
|
52
|
+
text: JSON.stringify({
|
|
53
|
+
stage: "preflight",
|
|
54
|
+
check: "syntax",
|
|
55
|
+
cubeName,
|
|
56
|
+
code: TM1ErrorCode.VALIDATION_ERROR,
|
|
57
|
+
message: `Preflight rule check failed: ${errors.length} error(s). Nothing was written.`,
|
|
58
|
+
hint: "Fix the lines in errors[] (lineNumber is in the full resulting text, after edits are applied). preflight:false skips the check; TM1 would store the broken text.",
|
|
59
|
+
errors,
|
|
60
|
+
}),
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
isError: true,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
await withToolHint(tm1Client.cubes.updateRules(cubeName, text), `Inspect details for the offending line.`);
|
|
68
|
+
const lineCount = text.split("\n").length;
|
|
69
|
+
// Rule changes shift call edges (DB(), feeders) — drop callgraph TTL early.
|
|
70
|
+
const { cleared: callgraphEntriesCleared } = invalidateCallgraphCache();
|
|
71
|
+
return actionResponse({
|
|
72
|
+
success: true,
|
|
73
|
+
cubeName,
|
|
74
|
+
mode,
|
|
75
|
+
lineCount,
|
|
76
|
+
...(edits !== undefined ? { editsApplied: edits.length } : {}),
|
|
77
|
+
callgraphEntriesCleared,
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=set-cube-rules.js.map
|