@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,118 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { TM1Error, TM1ErrorCode } from "../../types.js";
|
|
5
|
+
import { serializeProcessToGit } from "../../lib/git-process.js";
|
|
6
|
+
// Automatic backup of an installed process before a tool overwrites it.
|
|
7
|
+
//
|
|
8
|
+
// Replacing a process is not undoable through the REST API, and until this
|
|
9
|
+
// existed the rollback copy depended on the caller remembering to export
|
|
10
|
+
// first. The backup is the tm1-git pair tm1_export_process_to_git produces,
|
|
11
|
+
// so tm1_import_process_from_git is the restore path.
|
|
12
|
+
//
|
|
13
|
+
// The directory is chosen by the server, never by the caller, so it is not
|
|
14
|
+
// confined to TM1_LOCAL_FILE_ROOT and is on by default:
|
|
15
|
+
// TM1_PROCESS_BACKUP_DIR unset → ~/.tm1-mcp-server/backups
|
|
16
|
+
// TM1_PROCESS_BACKUP_DIR=off → no backup
|
|
17
|
+
// Under it: <connection>/<process>/<timestamp>.json + .ti.
|
|
18
|
+
//
|
|
19
|
+
// The code is written UNMASKED. A masked backup restores a process that
|
|
20
|
+
// carries placeholder literals, looks deployed, and fails at runtime. The ODBC
|
|
21
|
+
// datasource password is never written (serializeProcessToGit strips it).
|
|
22
|
+
const DIR_ENV = "TM1_PROCESS_BACKUP_DIR";
|
|
23
|
+
/** Read an installed process as the tm1-git pair. Code is returned as stored. */
|
|
24
|
+
export async function readProcessAsGit(tm1Client, processName, opts) {
|
|
25
|
+
const includePassword = opts?.includePassword === true;
|
|
26
|
+
const [ti, parameters, layout, dataSource, deployMeta] = await Promise.all([
|
|
27
|
+
tm1Client.processes.getCodeBlob(processName),
|
|
28
|
+
tm1Client.processes.getParameters(processName),
|
|
29
|
+
tm1Client.processes.getVariableLayout(processName),
|
|
30
|
+
tm1Client.processes.getDataSource(processName, {
|
|
31
|
+
includeSecrets: includePassword,
|
|
32
|
+
}),
|
|
33
|
+
tm1Client.processes.getDeployMeta(processName),
|
|
34
|
+
]);
|
|
35
|
+
const { json, credentialsOmitted } = serializeProcessToGit({
|
|
36
|
+
name: processName,
|
|
37
|
+
parameters,
|
|
38
|
+
variables: layout.variables,
|
|
39
|
+
...(layout.variablesUIData !== undefined
|
|
40
|
+
? { variablesUIData: layout.variablesUIData }
|
|
41
|
+
: {}),
|
|
42
|
+
dataSource,
|
|
43
|
+
hasSecurityAccess: deployMeta.hasSecurityAccess,
|
|
44
|
+
}, { includePassword });
|
|
45
|
+
return {
|
|
46
|
+
json,
|
|
47
|
+
ti,
|
|
48
|
+
credentialsOmitted,
|
|
49
|
+
parameterCount: parameters.length,
|
|
50
|
+
variableCount: layout.variables.length,
|
|
51
|
+
dataSourceType: dataSource.type,
|
|
52
|
+
hasSecurityAccess: deployMeta.hasSecurityAccess,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** The backup root, or null when backups are switched off. */
|
|
56
|
+
export function backupRoot() {
|
|
57
|
+
const raw = process.env[DIR_ENV]?.trim();
|
|
58
|
+
if (raw?.toLowerCase() === "off")
|
|
59
|
+
return null;
|
|
60
|
+
return raw
|
|
61
|
+
? path.resolve(raw)
|
|
62
|
+
: path.join(os.homedir(), ".tm1-mcp-server", "backups");
|
|
63
|
+
}
|
|
64
|
+
// Windows rejects < > : " / \ | ? * and control characters, and trailing dots
|
|
65
|
+
// or spaces. The real name is inside the .json, so the mapping need not be
|
|
66
|
+
// reversible.
|
|
67
|
+
export function safeFileName(name) {
|
|
68
|
+
const cleaned = name
|
|
69
|
+
// eslint-disable-next-line no-control-regex
|
|
70
|
+
.replace(/[<>:"/\\|?*\u0000-\u001f]/g, "_")
|
|
71
|
+
.replace(/[. ]+$/, "_");
|
|
72
|
+
return cleaned === "" || cleaned === "." || cleaned === ".." ? "_" : cleaned;
|
|
73
|
+
}
|
|
74
|
+
function timestamp(now) {
|
|
75
|
+
// 2026-09-25T14:03:07.123Z → 20260925T140307123Z
|
|
76
|
+
return now.toISOString().replace(/[-:.]/g, "");
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Write the installed state of `processName` to the backup directory and
|
|
80
|
+
* return the two paths, or null when backups are off. Throws a TM1Error when
|
|
81
|
+
* the backup cannot be written: callers run this before their first write, so
|
|
82
|
+
* a failed backup means nothing is overwritten.
|
|
83
|
+
*/
|
|
84
|
+
export async function backupProcess(tm1Client, processName, now = new Date()) {
|
|
85
|
+
const root = backupRoot();
|
|
86
|
+
if (root === null)
|
|
87
|
+
return null;
|
|
88
|
+
try {
|
|
89
|
+
const pair = await readProcessAsGit(tm1Client, processName);
|
|
90
|
+
const dir = path.join(root, safeFileName(tm1Client.connectionId), safeFileName(processName));
|
|
91
|
+
await fs.mkdir(dir, { recursive: true });
|
|
92
|
+
const base = path.join(dir, timestamp(now));
|
|
93
|
+
const backup = { json: `${base}.json`, ti: `${base}.ti` };
|
|
94
|
+
// wx: never replace an earlier backup, even on a same-millisecond retry.
|
|
95
|
+
await fs.writeFile(backup.json, pair.json, {
|
|
96
|
+
encoding: "utf8",
|
|
97
|
+
flag: "wx",
|
|
98
|
+
mode: 0o600,
|
|
99
|
+
});
|
|
100
|
+
await fs.writeFile(backup.ti, pair.ti, {
|
|
101
|
+
encoding: "utf8",
|
|
102
|
+
flag: "wx",
|
|
103
|
+
mode: 0o600,
|
|
104
|
+
});
|
|
105
|
+
return backup;
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
const reason = err instanceof TM1Error
|
|
109
|
+
? `${err.code}: ${err.message}`
|
|
110
|
+
: err.message;
|
|
111
|
+
throw new TM1Error({
|
|
112
|
+
code: err instanceof TM1Error ? err.code : TM1ErrorCode.VALIDATION_ERROR,
|
|
113
|
+
message: `Backup of process '${processName}' failed before overwriting it: ${reason}. Nothing was written.`,
|
|
114
|
+
hint: `Fix the cause (${DIR_ENV} must name a writable directory), or set ${DIR_ENV}=off to overwrite without a backup.`,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=process-backup.js.map
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compileUserRegex } from "../../lib/safe-regex.js";
|
|
3
|
+
import { maskCodeLine, resolveMaskSecrets } from "../../lib/mask-secrets.js";
|
|
4
|
+
import { FORMAT_SCHEMA, wrappedPageResponse, columnsOf } from "../format.js";
|
|
5
|
+
import { PAGINATION_SCHEMA, paginate } from "../pagination.js";
|
|
6
|
+
import { READ_ONLY } from "../annotations.js";
|
|
7
|
+
import { SearchCodeResultSchema } from "../schemas/items.js";
|
|
8
|
+
import { defineTool } from "../define-tool.js";
|
|
9
|
+
const ALL_TABS = ["prolog", "metadata", "data", "epilog"];
|
|
10
|
+
const COMMENT_RE = /^\s*(?:#|\/\/)/;
|
|
11
|
+
export const registerSearchCode = defineTool({
|
|
12
|
+
name: "tm1_search_code",
|
|
13
|
+
description: [
|
|
14
|
+
"Regex search across all TI process code (Prolog/Metadata/Data/Epilog).",
|
|
15
|
+
"Returns matches paginated (default 50/page) with process name, tab, line number, and trimmed line text.",
|
|
16
|
+
"Wrapper over tm1_get_all_processes_code that avoids dumping ~MB of code through the channel.",
|
|
17
|
+
"Use tm1_get_process_code on a hit to inspect the surrounding context.",
|
|
18
|
+
"Set groupBy='process' (or 'tab') for a sorted count aggregation instead of individual match lines.",
|
|
19
|
+
],
|
|
20
|
+
annotations: READ_ONLY,
|
|
21
|
+
output: SearchCodeResultSchema,
|
|
22
|
+
input: {
|
|
23
|
+
pattern: z
|
|
24
|
+
.string()
|
|
25
|
+
.min(1)
|
|
26
|
+
.max(2000)
|
|
27
|
+
.describe("Regex pattern (JavaScript flavor). Anchors and groups supported."),
|
|
28
|
+
tabs: z
|
|
29
|
+
.array(z.enum(["prolog", "metadata", "data", "epilog"]))
|
|
30
|
+
.optional()
|
|
31
|
+
.describe("Tabs to search (default: all four)"),
|
|
32
|
+
caseSensitive: z
|
|
33
|
+
.boolean()
|
|
34
|
+
.optional()
|
|
35
|
+
.default(false)
|
|
36
|
+
.describe("Case-sensitive match (default false)"),
|
|
37
|
+
includeControl: z
|
|
38
|
+
.boolean()
|
|
39
|
+
.optional()
|
|
40
|
+
.default(false)
|
|
41
|
+
.describe("Include TM1 control processes ('}'-prefixed). Default false."),
|
|
42
|
+
maxMatchesPerProcess: z
|
|
43
|
+
.number()
|
|
44
|
+
.int()
|
|
45
|
+
.positive()
|
|
46
|
+
.optional()
|
|
47
|
+
.default(20)
|
|
48
|
+
.describe("Cap matches per process to avoid runaway output (default 20)"),
|
|
49
|
+
maxTotalMatches: z
|
|
50
|
+
.number()
|
|
51
|
+
.int()
|
|
52
|
+
.positive()
|
|
53
|
+
.optional()
|
|
54
|
+
.default(500)
|
|
55
|
+
.describe("Hard cap on total matches across all processes (default 500)"),
|
|
56
|
+
maskSecrets: z
|
|
57
|
+
.boolean()
|
|
58
|
+
.optional()
|
|
59
|
+
.default(true)
|
|
60
|
+
.describe("Redact credential literals in match text. Masks the password arg of ODBCOpen() and quoted values assigned to credential-named identifiers (pPwd, sToken, …). Default: true. Set false only when explicitly auditing credentials."),
|
|
61
|
+
excludeCommented: z
|
|
62
|
+
.boolean()
|
|
63
|
+
.optional()
|
|
64
|
+
.default(false)
|
|
65
|
+
.describe("Skip lines beginning with '#' or '//' (TI comment markers). Default: false."),
|
|
66
|
+
deduplicateByLine: z
|
|
67
|
+
.boolean()
|
|
68
|
+
.optional()
|
|
69
|
+
.default(false)
|
|
70
|
+
.describe("Collapse matches with identical (tab, line-text) across processes into one result. " +
|
|
71
|
+
"The first-seen process is kept; others go into alsoFoundIn[]. " +
|
|
72
|
+
"Drastically reduces output on servers with many process variants. Default: false."),
|
|
73
|
+
groupBy: z
|
|
74
|
+
.enum(["process", "tab"])
|
|
75
|
+
.optional()
|
|
76
|
+
.describe("Aggregate mode. Instead of individual match lines, return counts grouped by process or tab, " +
|
|
77
|
+
"sorted by matchCount desc. Answers 'which process has the most X calls' in a tiny payload " +
|
|
78
|
+
"instead of dumping every matching line. Counts are complete: maxMatchesPerProcess/maxTotalMatches " +
|
|
79
|
+
"and maskSecrets do not apply in this mode."),
|
|
80
|
+
...PAGINATION_SCHEMA,
|
|
81
|
+
...FORMAT_SCHEMA,
|
|
82
|
+
},
|
|
83
|
+
handler: async ({ pattern, tabs, caseSensitive, includeControl, maxMatchesPerProcess, maxTotalMatches, maskSecrets, excludeCommented, deduplicateByLine, groupBy, limit, offset, fetchAll, format, }, tm1Client) => {
|
|
84
|
+
const flags = caseSensitive ? "g" : "gi";
|
|
85
|
+
const regex = compileUserRegex(pattern, flags);
|
|
86
|
+
const searchTabs = tabs && tabs.length > 0 ? tabs : ALL_TABS;
|
|
87
|
+
const all = await tm1Client.processes.getAllCode(includeControl);
|
|
88
|
+
if (groupBy) {
|
|
89
|
+
// Aggregate mode: count every matching line, grouped by process or tab.
|
|
90
|
+
// No per-process / total caps here so the counts are complete — the
|
|
91
|
+
// payload is bounded by the number of groups, not the match count.
|
|
92
|
+
const counts = new Map();
|
|
93
|
+
let totalMatches = 0;
|
|
94
|
+
for (const proc of all) {
|
|
95
|
+
for (const tab of searchTabs) {
|
|
96
|
+
const code = proc[tab] ?? "";
|
|
97
|
+
if (!code)
|
|
98
|
+
continue;
|
|
99
|
+
const lines = code.split(/\r?\n/);
|
|
100
|
+
for (let i = 0; i < lines.length; i++) {
|
|
101
|
+
regex.lastIndex = 0;
|
|
102
|
+
const raw = lines[i];
|
|
103
|
+
if (excludeCommented && COMMENT_RE.test(raw))
|
|
104
|
+
continue;
|
|
105
|
+
if (regex.test(raw)) {
|
|
106
|
+
const key = groupBy === "process" ? proc.name : tab;
|
|
107
|
+
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
108
|
+
totalMatches++;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const groups = [...counts.entries()]
|
|
114
|
+
.map(([key, matchCount]) => ({ [groupBy]: key, matchCount }))
|
|
115
|
+
.sort((a, b) => b.matchCount - a.matchCount);
|
|
116
|
+
const groupPage = paginate(groups, limit, offset, fetchAll);
|
|
117
|
+
const groupWrapper = {
|
|
118
|
+
pattern,
|
|
119
|
+
caseSensitive,
|
|
120
|
+
tabsSearched: searchTabs,
|
|
121
|
+
processesScanned: all.length,
|
|
122
|
+
groupBy,
|
|
123
|
+
groupCount: groups.length,
|
|
124
|
+
matchCount: totalMatches,
|
|
125
|
+
...groupPage,
|
|
126
|
+
};
|
|
127
|
+
const groupColumns = columnsOf([
|
|
128
|
+
{ header: groupBy, get: (g) => g[groupBy] },
|
|
129
|
+
"matchCount",
|
|
130
|
+
]);
|
|
131
|
+
return wrappedPageResponse(groupWrapper, groupPage, format, {
|
|
132
|
+
title: `Search: ${pattern} (grouped by ${groupBy})`,
|
|
133
|
+
columns: groupColumns,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
const matches = [];
|
|
137
|
+
let truncated = false;
|
|
138
|
+
outer: for (const proc of all) {
|
|
139
|
+
let perProcess = 0;
|
|
140
|
+
for (const tab of searchTabs) {
|
|
141
|
+
const code = proc[tab] ?? "";
|
|
142
|
+
if (!code)
|
|
143
|
+
continue;
|
|
144
|
+
const lines = code.split(/\r?\n/);
|
|
145
|
+
for (let i = 0; i < lines.length; i++) {
|
|
146
|
+
regex.lastIndex = 0;
|
|
147
|
+
const raw = lines[i];
|
|
148
|
+
if (excludeCommented && COMMENT_RE.test(raw))
|
|
149
|
+
continue;
|
|
150
|
+
if (regex.test(raw)) {
|
|
151
|
+
const text = (resolveMaskSecrets(maskSecrets) ? maskCodeLine(raw) : raw)
|
|
152
|
+
.trim()
|
|
153
|
+
.slice(0, 240);
|
|
154
|
+
matches.push({ process: proc.name, tab, line: i + 1, text });
|
|
155
|
+
perProcess++;
|
|
156
|
+
if (matches.length >= maxTotalMatches) {
|
|
157
|
+
truncated = true;
|
|
158
|
+
break outer;
|
|
159
|
+
}
|
|
160
|
+
if (perProcess >= maxMatchesPerProcess)
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (perProcess >= maxMatchesPerProcess)
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
let deduplicated = false;
|
|
169
|
+
let rawMatchCount;
|
|
170
|
+
if (deduplicateByLine && matches.length > 0) {
|
|
171
|
+
rawMatchCount = matches.length;
|
|
172
|
+
const seen = new Map();
|
|
173
|
+
for (const m of matches) {
|
|
174
|
+
const key = `${m.tab}\x00${m.text}`;
|
|
175
|
+
const existing = seen.get(key);
|
|
176
|
+
if (existing) {
|
|
177
|
+
(existing.alsoFoundIn ??= []).push(m.process);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
seen.set(key, { ...m });
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
matches.length = 0;
|
|
184
|
+
for (const m of seen.values())
|
|
185
|
+
matches.push(m);
|
|
186
|
+
deduplicated = true;
|
|
187
|
+
}
|
|
188
|
+
const page = paginate(matches, limit, offset, fetchAll);
|
|
189
|
+
const wrapper = {
|
|
190
|
+
pattern,
|
|
191
|
+
caseSensitive,
|
|
192
|
+
tabsSearched: searchTabs,
|
|
193
|
+
processesScanned: all.length,
|
|
194
|
+
matchCount: matches.length,
|
|
195
|
+
...(deduplicated && { rawMatchCount, deduplicated }),
|
|
196
|
+
truncated,
|
|
197
|
+
maskSecrets,
|
|
198
|
+
excludeCommented,
|
|
199
|
+
...page,
|
|
200
|
+
};
|
|
201
|
+
const columns = columnsOf(["process", "tab", "line", "text"]);
|
|
202
|
+
return wrappedPageResponse(wrapper, page, format, {
|
|
203
|
+
title: `Search: ${pattern}`,
|
|
204
|
+
columns,
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
//# sourceMappingURL=search-code.js.map
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TM1Error, TM1ErrorCode } from "../../types.js";
|
|
3
|
+
import { invalidateCallgraphCache } from "../../lib/callgraph/tm1-adapter.js";
|
|
4
|
+
import { dataSourceSchema as sharedDataSourceSchema } from "../../lib/process-parts-schema.js";
|
|
5
|
+
import { IDEMPOTENT_DESTRUCTIVE } from "../annotations.js";
|
|
6
|
+
import { UpsertProcessResultSchema } from "../schemas/items.js";
|
|
7
|
+
import { defineTool } from "../define-tool.js";
|
|
8
|
+
import { OVERWRITE_CONFIRM_SCHEMA, requireOverwriteConfirm, } from "../confirm.js";
|
|
9
|
+
import { preflightResult, runPreflight } from "./preflight.js";
|
|
10
|
+
import { backupProcess } from "./process-backup.js";
|
|
11
|
+
// The same data source shape the git round-trip and check_process_code use.
|
|
12
|
+
// This tool used to carry its own copy, which had drifted: it was missing
|
|
13
|
+
// `query`, so an ODBC source could be created here but its SQL could not —
|
|
14
|
+
// while tm1_get_process_datasource reads it back.
|
|
15
|
+
// Strict, so a misspelled field is rejected instead of silently dropped.
|
|
16
|
+
const dataSourceSchema = sharedDataSourceSchema.strict();
|
|
17
|
+
const parameterSchema = z.object({
|
|
18
|
+
name: z.string(),
|
|
19
|
+
type: z.enum(["String", "Numeric"]),
|
|
20
|
+
defaultValue: z.union([z.string(), z.number()]),
|
|
21
|
+
prompt: z.string().optional(),
|
|
22
|
+
});
|
|
23
|
+
const variableSchema = z.object({
|
|
24
|
+
name: z.string(),
|
|
25
|
+
type: z.enum(["String", "Numeric"]),
|
|
26
|
+
position: z.number().int().positive(),
|
|
27
|
+
startByte: z.number().int().optional(),
|
|
28
|
+
endByte: z.number().int().optional(),
|
|
29
|
+
});
|
|
30
|
+
export const registerUpsertProcess = defineTool({
|
|
31
|
+
name: "tm1_upsert_process",
|
|
32
|
+
description: "Atomic-style create-or-update for a TI process. Bundles createProcess (if missing) + updateProcessCode + updateProcessParameters + updateProcessVariables + updateProcessDataSource into a single MCP call. NOTE: TM1 itself does not support a real transaction — on partial failure, the steps that already succeeded are not rolled back. The tool reports which step failed.",
|
|
33
|
+
annotations: IDEMPOTENT_DESTRUCTIVE,
|
|
34
|
+
output: UpsertProcessResultSchema,
|
|
35
|
+
input: {
|
|
36
|
+
processName: z.string(),
|
|
37
|
+
prolog: z.string().optional(),
|
|
38
|
+
metadata: z.string().optional(),
|
|
39
|
+
data: z.string().optional(),
|
|
40
|
+
epilog: z.string().optional(),
|
|
41
|
+
parameters: z.array(parameterSchema).optional(),
|
|
42
|
+
variables: z.array(variableSchema).optional(),
|
|
43
|
+
dataSource: dataSourceSchema.optional(),
|
|
44
|
+
hasSecurityAccess: z
|
|
45
|
+
.boolean()
|
|
46
|
+
.optional()
|
|
47
|
+
.describe("When set, applies the process's HasSecurityAccess flag via a dedicated PATCH after the other steps."),
|
|
48
|
+
mode: z.enum(["create", "update", "upsert"]).optional().default("upsert"),
|
|
49
|
+
...OVERWRITE_CONFIRM_SCHEMA,
|
|
50
|
+
preflight: z
|
|
51
|
+
.boolean()
|
|
52
|
+
.optional()
|
|
53
|
+
.default(true)
|
|
54
|
+
.describe("Before writing, run the syntax check AND the reference check on the process as it will be after this call (omitted tabs, parameters and variables keep their installed values). Abort on either. Default true. false skips both."),
|
|
55
|
+
autoCompile: z
|
|
56
|
+
.boolean()
|
|
57
|
+
.optional()
|
|
58
|
+
.default(false)
|
|
59
|
+
.describe("After deploy, run tm1.Compile and include the result in the response (compile: {ok, errorCount, errors}). Off by default — compile holds a brief lock on the process and serializes badly under bulk-deploy."),
|
|
60
|
+
},
|
|
61
|
+
handler: async ({ processName, prolog, metadata, data, epilog, parameters, variables, dataSource, hasSecurityAccess, mode, preflight, autoCompile, confirm, }, tm1Client) => {
|
|
62
|
+
const trail = [];
|
|
63
|
+
const exists = await tm1Client.processes.exists(processName);
|
|
64
|
+
if (mode === "create" && exists) {
|
|
65
|
+
throw new TM1Error({
|
|
66
|
+
code: TM1ErrorCode.CONFLICT,
|
|
67
|
+
message: `Process '${processName}' already exists; mode=create`,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (mode === "update" && !exists) {
|
|
71
|
+
throw new TM1Error({
|
|
72
|
+
code: TM1ErrorCode.NOT_FOUND,
|
|
73
|
+
message: `Process '${processName}' does not exist; mode=update`,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
// Replacing an installed process is not undoable through the API.
|
|
77
|
+
if (exists)
|
|
78
|
+
requireOverwriteConfirm(confirm, processName, "process");
|
|
79
|
+
if (preflight) {
|
|
80
|
+
// Check the process as it will stand after this call, not the fields
|
|
81
|
+
// the caller happened to send: an omitted tab keeps its installed code.
|
|
82
|
+
const current = exists
|
|
83
|
+
? await tm1Client.processes.getCode(processName)
|
|
84
|
+
: { prolog: "", metadata: "", data: "", epilog: "" };
|
|
85
|
+
const failure = await runPreflight(tm1Client, {
|
|
86
|
+
name: processName,
|
|
87
|
+
prolog: prolog ?? current.prolog,
|
|
88
|
+
metadata: metadata ?? current.metadata,
|
|
89
|
+
data: data ?? current.data,
|
|
90
|
+
epilog: epilog ?? current.epilog,
|
|
91
|
+
parameters: parameters ??
|
|
92
|
+
(exists ? await tm1Client.processes.getParameters(processName) : []),
|
|
93
|
+
variables: variables !== undefined && variables.length > 0
|
|
94
|
+
? variables
|
|
95
|
+
: exists
|
|
96
|
+
? await tm1Client.processes.getVariables(processName)
|
|
97
|
+
: [],
|
|
98
|
+
...(dataSource !== undefined ? { dataSource } : {}),
|
|
99
|
+
});
|
|
100
|
+
if (failure)
|
|
101
|
+
return preflightResult(failure);
|
|
102
|
+
}
|
|
103
|
+
// Last step before the first write: a failed backup throws, nothing is written.
|
|
104
|
+
const backup = exists ? await backupProcess(tm1Client, processName) : null;
|
|
105
|
+
if (!exists) {
|
|
106
|
+
await tm1Client.processes.create(processName);
|
|
107
|
+
trail.push("createProcess");
|
|
108
|
+
}
|
|
109
|
+
if (prolog !== undefined ||
|
|
110
|
+
metadata !== undefined ||
|
|
111
|
+
data !== undefined ||
|
|
112
|
+
epilog !== undefined) {
|
|
113
|
+
await tm1Client.processes.updateCode(processName, {
|
|
114
|
+
...(prolog !== undefined ? { prolog } : {}),
|
|
115
|
+
...(metadata !== undefined ? { metadata } : {}),
|
|
116
|
+
...(data !== undefined ? { data } : {}),
|
|
117
|
+
...(epilog !== undefined ? { epilog } : {}),
|
|
118
|
+
});
|
|
119
|
+
trail.push("updateProcessCode");
|
|
120
|
+
}
|
|
121
|
+
if (parameters !== undefined) {
|
|
122
|
+
await tm1Client.processes.updateParameters(processName, parameters);
|
|
123
|
+
trail.push("updateProcessParameters");
|
|
124
|
+
}
|
|
125
|
+
if (variables !== undefined && variables.length > 0) {
|
|
126
|
+
await tm1Client.processes.updateVariables(processName, variables);
|
|
127
|
+
trail.push("updateProcessVariables");
|
|
128
|
+
}
|
|
129
|
+
if (dataSource !== undefined) {
|
|
130
|
+
await tm1Client.processes.updateDataSource(processName, dataSource);
|
|
131
|
+
trail.push("updateProcessDataSource");
|
|
132
|
+
}
|
|
133
|
+
if (hasSecurityAccess !== undefined) {
|
|
134
|
+
await tm1Client.processes.updateSecurityAccess(processName, hasSecurityAccess);
|
|
135
|
+
trail.push("updateSecurityAccess");
|
|
136
|
+
}
|
|
137
|
+
// Process body/parameters/datasource may have changed call sites — drop the
|
|
138
|
+
// 60s callgraph TTL so the next analysis sees fresh references instead of stale graph.
|
|
139
|
+
const { cleared: callgraphEntriesCleared } = invalidateCallgraphCache();
|
|
140
|
+
let compile;
|
|
141
|
+
if (autoCompile) {
|
|
142
|
+
const result = await tm1Client.processes.compile(processName);
|
|
143
|
+
compile = {
|
|
144
|
+
ok: result.success,
|
|
145
|
+
errorCount: result.errors.length,
|
|
146
|
+
errors: result.errors,
|
|
147
|
+
};
|
|
148
|
+
trail.push("compileProcess");
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
content: [
|
|
152
|
+
{
|
|
153
|
+
type: "text",
|
|
154
|
+
text: JSON.stringify({
|
|
155
|
+
processName,
|
|
156
|
+
action: exists ? "updated" : "created",
|
|
157
|
+
appliedSteps: trail,
|
|
158
|
+
callgraphEntriesCleared,
|
|
159
|
+
...(backup ? { backup } : {}),
|
|
160
|
+
...(compile !== undefined ? { compile } : {}),
|
|
161
|
+
}, null, 2),
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
};
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
//# sourceMappingURL=upsert-process.js.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import { resolveLocalPath } from "../local-file.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { TM1Error, TM1ErrorCode } from "../../types.js";
|
|
5
|
+
import { parseProFile } from "../../lib/pro-parser.js";
|
|
6
|
+
import { checkProcessRefs } from "../../lib/process-refs.js";
|
|
7
|
+
import { READ_ONLY } from "../annotations.js";
|
|
8
|
+
import { ValidateProcessRefsResultSchema } from "../schemas/items.js";
|
|
9
|
+
import { defineTool } from "../define-tool.js";
|
|
10
|
+
export const registerValidateProcessRefs = defineTool({
|
|
11
|
+
name: "tm1_validate_process_refs",
|
|
12
|
+
description: [
|
|
13
|
+
"Scan a TI process (live, by name, or from .pro) for cube/dimension references in well-known TI functions (CellGetN/S, CellPutN/S, ViewCreate, DimensionElementInsertDirect, AttrPutS, etc.) and verify each name resolves on the server. TM1 lets syntactically valid code reference non-existent objects — this catches the gap between compile and runtime.",
|
|
14
|
+
"Element literals in cell functions (CellGetN/S, CellPutN/S, CellIncrementN, …) are looked up in the dimension at their position, with TM1's own resolution (case/space-insensitive, aliases, 'Hierarchy:Element'); a missing one is an issue of kind 'element'. TI does not abort on a missing element — the write is just skipped — so this is the only place it shows before a run. Elements passed as variables are not checked.",
|
|
15
|
+
"Existence probes (DimensionExists, CubeExists, DimIx, …) and names the code itself creates (CubeCreate/DimensionCreate/DimensionElementInsert…) are not flagged.",
|
|
16
|
+
"partial=true means some names are passed as parameters or computed values and could not be checked (see unresolvableArgs). The install tools run this same check in their preflight.",
|
|
17
|
+
],
|
|
18
|
+
annotations: READ_ONLY,
|
|
19
|
+
output: ValidateProcessRefsResultSchema,
|
|
20
|
+
input: {
|
|
21
|
+
processName: z
|
|
22
|
+
.string()
|
|
23
|
+
.optional()
|
|
24
|
+
.describe("Validate an installed process by name"),
|
|
25
|
+
filePath: z
|
|
26
|
+
.string()
|
|
27
|
+
.optional()
|
|
28
|
+
.describe("Validate a .pro file (absolute host path). Disabled unless TM1_LOCAL_FILE_ROOT is set; the path must resolve within that directory. Otherwise pass 'content' inline."),
|
|
29
|
+
content: z.string().optional().describe("Validate raw .pro content"),
|
|
30
|
+
includeControl: z
|
|
31
|
+
.boolean()
|
|
32
|
+
.optional()
|
|
33
|
+
.default(true)
|
|
34
|
+
.describe("Include control objects ('}'-prefixed) as valid targets. Default true."),
|
|
35
|
+
},
|
|
36
|
+
handler: async ({ processName, filePath, content, includeControl }, tm1Client) => {
|
|
37
|
+
if (!processName && !filePath && !content) {
|
|
38
|
+
throw new TM1Error({
|
|
39
|
+
code: TM1ErrorCode.VALIDATION_ERROR,
|
|
40
|
+
message: "Provide processName, filePath, or content",
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
let code;
|
|
44
|
+
let resolvedName = processName ?? "";
|
|
45
|
+
if (processName) {
|
|
46
|
+
code = await tm1Client.processes.getCode(processName);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
let body = content ?? "";
|
|
50
|
+
if (!body && filePath) {
|
|
51
|
+
body = await fs.readFile(resolveLocalPath(filePath), "utf8");
|
|
52
|
+
}
|
|
53
|
+
const parsed = parseProFile(body);
|
|
54
|
+
code = {
|
|
55
|
+
prolog: parsed.prolog,
|
|
56
|
+
metadata: parsed.metadata,
|
|
57
|
+
data: parsed.data,
|
|
58
|
+
epilog: parsed.epilog,
|
|
59
|
+
};
|
|
60
|
+
resolvedName = parsed.name ?? "(from-file)";
|
|
61
|
+
}
|
|
62
|
+
const report = await checkProcessRefs(tm1Client, code, { includeControl });
|
|
63
|
+
return {
|
|
64
|
+
content: [
|
|
65
|
+
{
|
|
66
|
+
type: "text",
|
|
67
|
+
text: JSON.stringify({ processName: resolvedName, ...report }, null, 2),
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=validate-process-refs.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
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 registerCreateMdxView = defineTool({
|
|
7
|
+
name: "tm1_create_mdx_view",
|
|
8
|
+
description: "Create a public MDX-based view on a cube. The view persists server-side and can be used as a TI process datasource (TM1CubeView) or executed via tm1_get_view.",
|
|
9
|
+
annotations: WRITE,
|
|
10
|
+
output: MutationResultSchema,
|
|
11
|
+
input: {
|
|
12
|
+
cubeName: z.string().describe("Cube the view belongs to"),
|
|
13
|
+
viewName: z.string().describe("New view name"),
|
|
14
|
+
mdx: z.string().describe("MDX SELECT query defining the view"),
|
|
15
|
+
},
|
|
16
|
+
handler: async ({ cubeName, viewName, mdx }, tm1Client) => {
|
|
17
|
+
await tm1Client.views.createMdx(cubeName, viewName, mdx);
|
|
18
|
+
return actionResponse({ success: true, cubeName, viewName });
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=create-mdx-view.js.map
|