@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,198 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { TM1Error, TM1ErrorCode } from "../../types.js";
|
|
4
|
+
import { resolveLocalPath } from "../local-file.js";
|
|
5
|
+
import { parseProcessFromGit, unplacedBlobContent, } from "../../lib/git-process.js";
|
|
6
|
+
import { withToolHint } from "../error-format.js";
|
|
7
|
+
import { IDEMPOTENT_DESTRUCTIVE } from "../annotations.js";
|
|
8
|
+
import { ImportProcessFromGitResultSchema } from "../schemas/items.js";
|
|
9
|
+
import { defineTool } from "../define-tool.js";
|
|
10
|
+
import { OVERWRITE_CONFIRM_SCHEMA, requireOverwriteConfirm, } from "../confirm.js";
|
|
11
|
+
import { preflightResult, runPreflight } from "./preflight.js";
|
|
12
|
+
import { backupProcess } from "./process-backup.js";
|
|
13
|
+
export const registerImportProcessFromGit = defineTool({
|
|
14
|
+
name: "tm1_import_process_from_git",
|
|
15
|
+
description: [
|
|
16
|
+
"Deploy a TM1 process from the tm1-git two-file layout ('{name}.json' + '{name}.ti'). Provide the pair inline (jsonContent + tiContent) or as host paths (jsonPath + tiPath).",
|
|
17
|
+
"Reverse of tm1_export_process_to_git. Modes: 'create' (fail if exists), 'update' (fail if missing), 'upsert' (default).",
|
|
18
|
+
"If the source datasource is ODBC, pass dataSourcePassword to re-inject the credential that export strips.",
|
|
19
|
+
],
|
|
20
|
+
annotations: IDEMPOTENT_DESTRUCTIVE,
|
|
21
|
+
output: ImportProcessFromGitResultSchema,
|
|
22
|
+
input: {
|
|
23
|
+
jsonContent: z
|
|
24
|
+
.string()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("Raw '{name}.json' body as string (structure)."),
|
|
27
|
+
tiContent: z
|
|
28
|
+
.string()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("Raw '{name}.ti' body as string (procedure tabs)."),
|
|
31
|
+
jsonPath: z
|
|
32
|
+
.string()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe("Absolute host path to the .json file. Disabled unless TM1_LOCAL_FILE_ROOT is set; must resolve within that directory."),
|
|
35
|
+
tiPath: z
|
|
36
|
+
.string()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe("Absolute host path to the .ti file. Disabled unless TM1_LOCAL_FILE_ROOT is set; must resolve within that directory."),
|
|
39
|
+
processName: z
|
|
40
|
+
.string()
|
|
41
|
+
.optional()
|
|
42
|
+
.describe("Override process name. Default: name from the JSON."),
|
|
43
|
+
mode: z
|
|
44
|
+
.enum(["create", "update", "upsert"])
|
|
45
|
+
.optional()
|
|
46
|
+
.default("upsert")
|
|
47
|
+
.describe("Deployment mode (default: upsert)"),
|
|
48
|
+
dataSourcePassword: z
|
|
49
|
+
.string()
|
|
50
|
+
.optional()
|
|
51
|
+
.describe("ODBC password to re-inject, in clear text; the target server encrypts it. Overrides whatever the .json carries. Export omits the password unless includeDataSourcePassword was set, which is possible on v12 only — so on v11 this is the only way to deploy a working ODBC process. Ignored for non-ODBC datasources."),
|
|
52
|
+
...OVERWRITE_CONFIRM_SCHEMA,
|
|
53
|
+
preflight: z
|
|
54
|
+
.boolean()
|
|
55
|
+
.optional()
|
|
56
|
+
.default(true)
|
|
57
|
+
.describe("Run the syntax check (tm1_check_process_code) AND the reference check (tm1_validate_process_refs) on the exact payload before applying; abort on either. Default true. false skips both."),
|
|
58
|
+
},
|
|
59
|
+
handler: async ({ jsonContent, tiContent, jsonPath, tiPath, processName: nameOverride, mode, dataSourcePassword, preflight, confirm, }, tm1Client) => {
|
|
60
|
+
let json = jsonContent ?? "";
|
|
61
|
+
let ti = tiContent ?? "";
|
|
62
|
+
if (!json && jsonPath)
|
|
63
|
+
json = await fs.readFile(resolveLocalPath(jsonPath, "jsonPath"), "utf8");
|
|
64
|
+
if (!ti && tiPath)
|
|
65
|
+
ti = await fs.readFile(resolveLocalPath(tiPath, "tiPath"), "utf8");
|
|
66
|
+
if (!json || !ti) {
|
|
67
|
+
throw new TM1Error({
|
|
68
|
+
code: TM1ErrorCode.VALIDATION_ERROR,
|
|
69
|
+
message: "Provide both the JSON and TI parts (jsonContent+tiContent or jsonPath+tiPath)",
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
let parsed;
|
|
73
|
+
try {
|
|
74
|
+
parsed = parseProcessFromGit(json, ti);
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
throw new TM1Error({
|
|
78
|
+
code: TM1ErrorCode.VALIDATION_ERROR,
|
|
79
|
+
message: err.message,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
const processName = nameOverride ?? parsed.name;
|
|
83
|
+
if (!processName) {
|
|
84
|
+
throw new TM1Error({
|
|
85
|
+
code: TM1ErrorCode.VALIDATION_ERROR,
|
|
86
|
+
message: "Process name not found in JSON ('name') and no name override provided",
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
const dataSource = { ...parsed.dataSource };
|
|
90
|
+
if (dataSource.type === "ODBC" && dataSourcePassword !== undefined) {
|
|
91
|
+
dataSource.password = dataSourcePassword;
|
|
92
|
+
}
|
|
93
|
+
if (preflight) {
|
|
94
|
+
// The raw .ti blob is what deploys (TM1 splits it into tabs), so the
|
|
95
|
+
// parsed tabs are only an exact stand-in for it when every byte of the
|
|
96
|
+
// blob sits inside exactly one tab region. Anything else would be
|
|
97
|
+
// installed without having been checked.
|
|
98
|
+
const unplaced = unplacedBlobContent(ti);
|
|
99
|
+
if (unplaced.length > 0) {
|
|
100
|
+
return preflightResult({
|
|
101
|
+
stage: "preflight",
|
|
102
|
+
check: "syntax",
|
|
103
|
+
processName,
|
|
104
|
+
code: TM1ErrorCode.VALIDATION_ERROR,
|
|
105
|
+
message: `The .ti blob carries content the preflight cannot place in a tab: ${unplaced.join("; ")}.`,
|
|
106
|
+
hint: "Nothing was installed. Keep all code inside one #region Prolog/Metadata/Data/Epilog … #endregion block per tab — re-export with tm1_export_process_to_git if unsure.",
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const failure = await runPreflight(tm1Client, {
|
|
110
|
+
name: processName,
|
|
111
|
+
prolog: parsed.prolog,
|
|
112
|
+
metadata: parsed.metadata,
|
|
113
|
+
data: parsed.data,
|
|
114
|
+
epilog: parsed.epilog,
|
|
115
|
+
parameters: parsed.parameters,
|
|
116
|
+
variables: parsed.variables,
|
|
117
|
+
dataSource,
|
|
118
|
+
});
|
|
119
|
+
if (failure)
|
|
120
|
+
return preflightResult(failure);
|
|
121
|
+
}
|
|
122
|
+
const exists = await tm1Client.processes.exists(processName);
|
|
123
|
+
if (mode === "create" && exists) {
|
|
124
|
+
throw new TM1Error({
|
|
125
|
+
code: TM1ErrorCode.CONFLICT,
|
|
126
|
+
message: `Process '${processName}' already exists; mode=create`,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
if (mode === "update" && !exists) {
|
|
130
|
+
throw new TM1Error({
|
|
131
|
+
code: TM1ErrorCode.NOT_FOUND,
|
|
132
|
+
message: `Process '${processName}' does not exist; mode=update`,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
// Replacing an installed process is not undoable through the API.
|
|
136
|
+
if (exists)
|
|
137
|
+
requireOverwriteConfirm(confirm, processName, "process");
|
|
138
|
+
// Last step before the first write: a failed backup throws, nothing is written.
|
|
139
|
+
const backup = exists ? await backupProcess(tm1Client, processName) : null;
|
|
140
|
+
const action = exists ? "updated" : "created";
|
|
141
|
+
if (!exists) {
|
|
142
|
+
await withToolHint(tm1Client.processes.create(processName), `Process create failed mid-import. Name '${processName}' may already exist (race) or contain invalid characters. tm1_list_processes to verify state before retry.`);
|
|
143
|
+
}
|
|
144
|
+
// Write code via TM1's native Code property: send the raw #region blob
|
|
145
|
+
// (normalized to CRLF, as TM1 emits/expects) and let the server split it
|
|
146
|
+
// into the four tabs. This is a full replace — tabs whose region is
|
|
147
|
+
// absent are cleared, matching the exported .ti exactly.
|
|
148
|
+
// The parsed tabs were preflighted above; unplacedBlobContent() made
|
|
149
|
+
// sure they cover this blob exactly, so what was checked is what deploys.
|
|
150
|
+
await withToolHint(tm1Client.processes.updateCodeBlob(processName, ti.replace(/\r?\n/g, "\r\n")), `Code update failed after process '${processName}' was ${exists ? "located" : "created"}. PARTIAL APPLY: shell exists but tabs are stale/empty. Re-run with mode=update once root cause fixed, or tm1_delete_process to roll back.`);
|
|
151
|
+
// On an update the file replaces the whole definition, as the code tabs
|
|
152
|
+
// already do: an empty parameter list, variable layout or a None
|
|
153
|
+
// datasource is applied, not skipped. Skipping left the newer values in
|
|
154
|
+
// place, so importing an older version (a backup) did not restore it.
|
|
155
|
+
if (exists || parsed.parameters.length > 0) {
|
|
156
|
+
await withToolHint(tm1Client.processes.updateParameters(processName, parsed.parameters), `Parameter update failed for '${processName}'. Code applied but parameters missing. tm1_upsert_process with mode=update + parameters=[...] to recover.`);
|
|
157
|
+
}
|
|
158
|
+
// Ignored columns live only in the UI data, so a .json can carry column
|
|
159
|
+
// layout with an empty variable list — patch on either.
|
|
160
|
+
if (exists ||
|
|
161
|
+
parsed.variables.length > 0 ||
|
|
162
|
+
(parsed.variablesUIData?.length ?? 0) > 0) {
|
|
163
|
+
await withToolHint(tm1Client.processes.updateVariables(processName, parsed.variables, parsed.variablesUIData ??
|
|
164
|
+
(parsed.variables.length === 0 ? [] : undefined)), `Variable update failed for '${processName}'. Code+parameters applied but variables missing. tm1_upsert_process with mode=update + variables=[...] to recover.`);
|
|
165
|
+
}
|
|
166
|
+
if (exists || dataSource.type !== "None") {
|
|
167
|
+
await withToolHint(tm1Client.processes.updateDataSource(processName, dataSource), `Datasource update failed for '${processName}' (type=${dataSource.type}). Code+params+vars applied. For ODBC verify dataSourcePassword/DSN and re-run with mode=update.`);
|
|
168
|
+
}
|
|
169
|
+
if (parsed.hasSecurityAccess !== undefined) {
|
|
170
|
+
await withToolHint(tm1Client.processes.updateSecurityAccess(processName, parsed.hasSecurityAccess), `HasSecurityAccess update failed for '${processName}'. Code+params+vars+datasource applied. Re-run with mode=update once root cause fixed.`);
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
content: [
|
|
174
|
+
{
|
|
175
|
+
type: "text",
|
|
176
|
+
text: JSON.stringify({
|
|
177
|
+
action,
|
|
178
|
+
processName,
|
|
179
|
+
...(backup ? { backup } : {}),
|
|
180
|
+
...(parsed.hasSecurityAccess !== undefined
|
|
181
|
+
? { hasSecurityAccess: parsed.hasSecurityAccess }
|
|
182
|
+
: {}),
|
|
183
|
+
parsed: {
|
|
184
|
+
prologLines: parsed.prolog.split("\n").length,
|
|
185
|
+
metadataLines: parsed.metadata.split("\n").length,
|
|
186
|
+
dataLines: parsed.data.split("\n").length,
|
|
187
|
+
epilogLines: parsed.epilog.split("\n").length,
|
|
188
|
+
parameterCount: parsed.parameters.length,
|
|
189
|
+
variableCount: parsed.variables.length,
|
|
190
|
+
dataSourceType: dataSource.type,
|
|
191
|
+
},
|
|
192
|
+
}, null, 2),
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
};
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
//# sourceMappingURL=import-process-from-git.js.map
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { TM1Error, TM1ErrorCode } from "../../types.js";
|
|
5
|
+
import { compileUserRegex } from "../../lib/safe-regex.js";
|
|
6
|
+
import { parseProFile } from "../../lib/pro-parser.js";
|
|
7
|
+
import { resolveLocalPath } from "../local-file.js";
|
|
8
|
+
import { IDEMPOTENT_DESTRUCTIVE, withVersion } from "../annotations.js";
|
|
9
|
+
import { InstallProBundleResultSchema } from "../schemas/items.js";
|
|
10
|
+
import { defineTool } from "../define-tool.js";
|
|
11
|
+
import { runPreflight } from "./preflight.js";
|
|
12
|
+
import { backupProcess } from "./process-backup.js";
|
|
13
|
+
export const registerInstallProBundle = defineTool({
|
|
14
|
+
name: "tm1_install_pro_bundle",
|
|
15
|
+
description: "Install all .pro files from a directory in one call. Iterates the directory (non-recursive by default), applies tm1_import_pro_file logic per file, and reports per-file outcome. Stops on first failure unless continueOnError=true. Useful for Bedrock or library deployments.",
|
|
16
|
+
annotations: withVersion(IDEMPOTENT_DESTRUCTIVE, "v11"),
|
|
17
|
+
output: InstallProBundleResultSchema,
|
|
18
|
+
input: {
|
|
19
|
+
directory: z
|
|
20
|
+
.string()
|
|
21
|
+
.describe("Absolute host path to directory containing .pro files. Disabled unless TM1_LOCAL_FILE_ROOT is set; the directory must resolve within that root."),
|
|
22
|
+
recursive: z
|
|
23
|
+
.boolean()
|
|
24
|
+
.optional()
|
|
25
|
+
.default(false)
|
|
26
|
+
.describe("Recurse into subdirectories (default false)"),
|
|
27
|
+
pattern: z
|
|
28
|
+
.string()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("Regex (JS) on filename. Default: matches *.pro (case-insensitive)."),
|
|
31
|
+
mode: z
|
|
32
|
+
.enum(["create", "update", "upsert"])
|
|
33
|
+
.optional()
|
|
34
|
+
.default("upsert")
|
|
35
|
+
.describe("Per-file deployment mode (default upsert)"),
|
|
36
|
+
preflight: z
|
|
37
|
+
.boolean()
|
|
38
|
+
.optional()
|
|
39
|
+
.default(true)
|
|
40
|
+
.describe("Per file: the syntax check AND the reference check on the exact payload; a failure marks the file preflight_failed. Default true. false skips both."),
|
|
41
|
+
continueOnError: z
|
|
42
|
+
.boolean()
|
|
43
|
+
.optional()
|
|
44
|
+
.default(false)
|
|
45
|
+
.describe("Continue installing remaining files after a failure. Default false (stop on first error)."),
|
|
46
|
+
confirm: z
|
|
47
|
+
.string()
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("Required when any file would overwrite an installed process: the directory's last path segment, verbatim. dryRun lists the overwrites without needing it. Each replaced process is saved first; its result entry names the backup .json/.ti pair."),
|
|
50
|
+
dryRun: z
|
|
51
|
+
.boolean()
|
|
52
|
+
.optional()
|
|
53
|
+
.default(false)
|
|
54
|
+
.describe("Parse + preflight only — no create/update calls. Default false."),
|
|
55
|
+
},
|
|
56
|
+
handler: async ({ directory, recursive, pattern, mode, preflight, continueOnError, dryRun, confirm, }, tm1Client, extra) => {
|
|
57
|
+
// R2-02: emit MCP progress notifications per-file so clients can show
|
|
58
|
+
// a moving progress bar during multi-file deploys. Only fires when the
|
|
59
|
+
// client opted in by passing _meta.progressToken in the tool call;
|
|
60
|
+
// sendNotification is fire-and-forget so a non-progress-aware client
|
|
61
|
+
// can't break the install loop.
|
|
62
|
+
const progressToken = extra?._meta?.progressToken;
|
|
63
|
+
const sendProgress = (progress, total, message) => {
|
|
64
|
+
if (progressToken === undefined)
|
|
65
|
+
return;
|
|
66
|
+
void extra
|
|
67
|
+
.sendNotification({
|
|
68
|
+
method: "notifications/progress",
|
|
69
|
+
params: { progressToken, progress, total, message },
|
|
70
|
+
})
|
|
71
|
+
.catch(() => undefined);
|
|
72
|
+
};
|
|
73
|
+
const safeDir = resolveLocalPath(directory, "directory");
|
|
74
|
+
const filenameRe = pattern
|
|
75
|
+
? compileUserRegex(pattern, undefined, "pattern")
|
|
76
|
+
: /\.pro$/i;
|
|
77
|
+
async function collect(dir) {
|
|
78
|
+
const out = [];
|
|
79
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
80
|
+
for (const e of entries) {
|
|
81
|
+
const full = path.join(dir, e.name);
|
|
82
|
+
if (e.isDirectory()) {
|
|
83
|
+
if (recursive)
|
|
84
|
+
out.push(...(await collect(full)));
|
|
85
|
+
}
|
|
86
|
+
else if (e.isFile() && filenameRe.test(e.name)) {
|
|
87
|
+
out.push(full);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
const files = (await collect(safeDir)).sort();
|
|
93
|
+
if (files.length === 0) {
|
|
94
|
+
return {
|
|
95
|
+
content: [
|
|
96
|
+
{
|
|
97
|
+
type: "text",
|
|
98
|
+
text: JSON.stringify({ directory, filesFound: 0, results: [] }),
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const installed = await tm1Client.processes.list();
|
|
104
|
+
const installedNames = new Set(installed.map((p) => p.name));
|
|
105
|
+
// Which files would replace an installed process. Worked out before the
|
|
106
|
+
// first write so a missing confirm stops the bundle with nothing
|
|
107
|
+
// installed, and a dryRun can show the list to the user.
|
|
108
|
+
const overwrites = [];
|
|
109
|
+
if (mode !== "create") {
|
|
110
|
+
for (const file of files) {
|
|
111
|
+
try {
|
|
112
|
+
const name = parseProFile(await fs.readFile(file, "utf8")).name;
|
|
113
|
+
if (name && installedNames.has(name))
|
|
114
|
+
overwrites.push(name);
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
/* unreadable or unparseable — reported per file below */
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const bundle = path.basename(safeDir);
|
|
122
|
+
if (!dryRun && overwrites.length > 0 && confirm !== bundle) {
|
|
123
|
+
throw new TM1Error({
|
|
124
|
+
code: TM1ErrorCode.VALIDATION_ERROR,
|
|
125
|
+
message: `${overwrites.length} file(s) would overwrite installed processes (${overwrites.slice(0, 20).join(", ")}${overwrites.length > 20 ? ", …" : ""}). Nothing was installed.`,
|
|
126
|
+
hint: `Show the user the overwrite list (dryRun=true returns it), then re-issue with confirm="${bundle}". mode="create" installs only processes that do not exist yet.`,
|
|
127
|
+
details: JSON.stringify({ overwrites }),
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
const results = [];
|
|
131
|
+
let stopped = false;
|
|
132
|
+
sendProgress(0, files.length, `starting install of ${files.length} files`);
|
|
133
|
+
for (let i = 0; i < files.length; i++) {
|
|
134
|
+
const file = files[i];
|
|
135
|
+
sendProgress(i, files.length, `processing ${path.basename(file)}`);
|
|
136
|
+
if (stopped) {
|
|
137
|
+
results.push({
|
|
138
|
+
file,
|
|
139
|
+
processName: null,
|
|
140
|
+
status: "skipped",
|
|
141
|
+
error: "stopped after earlier failure",
|
|
142
|
+
});
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
const body = await fs.readFile(file, "utf8");
|
|
147
|
+
const parsed = parseProFile(body);
|
|
148
|
+
const processName = parsed.name;
|
|
149
|
+
if (!processName) {
|
|
150
|
+
results.push({
|
|
151
|
+
file,
|
|
152
|
+
processName: null,
|
|
153
|
+
status: "error",
|
|
154
|
+
error: "Process name not found in .pro",
|
|
155
|
+
});
|
|
156
|
+
if (!continueOnError)
|
|
157
|
+
stopped = true;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (preflight) {
|
|
161
|
+
const failure = await runPreflight(tm1Client, {
|
|
162
|
+
name: processName,
|
|
163
|
+
prolog: parsed.prolog,
|
|
164
|
+
metadata: parsed.metadata,
|
|
165
|
+
data: parsed.data,
|
|
166
|
+
epilog: parsed.epilog,
|
|
167
|
+
parameters: parsed.parameters,
|
|
168
|
+
variables: parsed.variables,
|
|
169
|
+
dataSource: parsed.dataSource,
|
|
170
|
+
});
|
|
171
|
+
if (failure) {
|
|
172
|
+
results.push({
|
|
173
|
+
file,
|
|
174
|
+
processName,
|
|
175
|
+
status: "preflight_failed",
|
|
176
|
+
error: failure.message,
|
|
177
|
+
...(failure.errors ? { preflightErrors: failure.errors } : {}),
|
|
178
|
+
...(failure.issues ? { preflightIssues: failure.issues } : {}),
|
|
179
|
+
});
|
|
180
|
+
if (!continueOnError)
|
|
181
|
+
stopped = true;
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
const exists = installedNames.has(processName);
|
|
186
|
+
if (mode === "create" && exists) {
|
|
187
|
+
results.push({
|
|
188
|
+
file,
|
|
189
|
+
processName,
|
|
190
|
+
status: "error",
|
|
191
|
+
error: `Already exists; mode=create`,
|
|
192
|
+
});
|
|
193
|
+
if (!continueOnError)
|
|
194
|
+
stopped = true;
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (mode === "update" && !exists) {
|
|
198
|
+
results.push({
|
|
199
|
+
file,
|
|
200
|
+
processName,
|
|
201
|
+
status: "error",
|
|
202
|
+
error: `Does not exist; mode=update`,
|
|
203
|
+
});
|
|
204
|
+
if (!continueOnError)
|
|
205
|
+
stopped = true;
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
if (dryRun) {
|
|
209
|
+
results.push({
|
|
210
|
+
file,
|
|
211
|
+
processName,
|
|
212
|
+
status: exists ? "updated" : "created",
|
|
213
|
+
});
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
// A failed backup throws into the catch below: this file is not
|
|
217
|
+
// installed, and without continueOnError the run stops.
|
|
218
|
+
const backup = exists
|
|
219
|
+
? await backupProcess(tm1Client, processName)
|
|
220
|
+
: null;
|
|
221
|
+
if (!exists)
|
|
222
|
+
await tm1Client.processes.create(processName);
|
|
223
|
+
await tm1Client.processes.updateCode(processName, {
|
|
224
|
+
prolog: parsed.prolog,
|
|
225
|
+
metadata: parsed.metadata,
|
|
226
|
+
data: parsed.data,
|
|
227
|
+
epilog: parsed.epilog,
|
|
228
|
+
});
|
|
229
|
+
// On an update the file replaces the whole definition (see
|
|
230
|
+
// import-pro-file.ts): empty lists and a None datasource are applied.
|
|
231
|
+
if (exists || parsed.parameters.length > 0) {
|
|
232
|
+
await tm1Client.processes.updateParameters(processName, parsed.parameters);
|
|
233
|
+
}
|
|
234
|
+
if (exists ||
|
|
235
|
+
parsed.variables.length > 0 ||
|
|
236
|
+
parsed.variablesUIData.length > 0) {
|
|
237
|
+
await tm1Client.processes.updateVariables(processName, parsed.variables, parsed.variablesUIData.length > 0 || parsed.variables.length === 0
|
|
238
|
+
? parsed.variablesUIData
|
|
239
|
+
: undefined);
|
|
240
|
+
}
|
|
241
|
+
if (exists || parsed.dataSource.type !== "None") {
|
|
242
|
+
await tm1Client.processes.updateDataSource(processName, parsed.dataSource);
|
|
243
|
+
}
|
|
244
|
+
installedNames.add(processName);
|
|
245
|
+
results.push({
|
|
246
|
+
file,
|
|
247
|
+
processName,
|
|
248
|
+
status: exists ? "updated" : "created",
|
|
249
|
+
...(backup ? { backup } : {}),
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
catch (err) {
|
|
253
|
+
const msg = err instanceof TM1Error
|
|
254
|
+
? `${err.code}: ${err.message}`
|
|
255
|
+
: (err.message ?? String(err));
|
|
256
|
+
results.push({
|
|
257
|
+
file,
|
|
258
|
+
processName: null,
|
|
259
|
+
status: "error",
|
|
260
|
+
error: msg,
|
|
261
|
+
});
|
|
262
|
+
if (!continueOnError)
|
|
263
|
+
stopped = true;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
sendProgress(files.length, files.length, "install complete");
|
|
267
|
+
const summary = {
|
|
268
|
+
directory,
|
|
269
|
+
filesFound: files.length,
|
|
270
|
+
dryRun,
|
|
271
|
+
mode,
|
|
272
|
+
overwrites,
|
|
273
|
+
counts: {
|
|
274
|
+
created: results.filter((r) => r.status === "created").length,
|
|
275
|
+
updated: results.filter((r) => r.status === "updated").length,
|
|
276
|
+
preflight_failed: results.filter((r) => r.status === "preflight_failed")
|
|
277
|
+
.length,
|
|
278
|
+
error: results.filter((r) => r.status === "error").length,
|
|
279
|
+
skipped: results.filter((r) => r.status === "skipped").length,
|
|
280
|
+
},
|
|
281
|
+
results,
|
|
282
|
+
};
|
|
283
|
+
return {
|
|
284
|
+
content: [{ type: "text", text: JSON.stringify(summary) }],
|
|
285
|
+
};
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
//# sourceMappingURL=install-pro-bundle.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { TM1Client } from "../../tm1-client.js";
|
|
2
|
+
import type { DataSource, ProcessParameter, ProcessVariable } from "../../types.js";
|
|
3
|
+
import { TM1ErrorCode } from "../../types.js";
|
|
4
|
+
import { type RefIssue } from "../../lib/process-refs.js";
|
|
5
|
+
export interface PreflightPayload {
|
|
6
|
+
name: string;
|
|
7
|
+
prolog: string;
|
|
8
|
+
metadata: string;
|
|
9
|
+
data: string;
|
|
10
|
+
epilog: string;
|
|
11
|
+
parameters?: ProcessParameter[];
|
|
12
|
+
variables?: ProcessVariable[];
|
|
13
|
+
dataSource?: DataSource;
|
|
14
|
+
}
|
|
15
|
+
export interface PreflightFailure {
|
|
16
|
+
stage: "preflight";
|
|
17
|
+
check: "syntax" | "references";
|
|
18
|
+
processName: string;
|
|
19
|
+
code: typeof TM1ErrorCode.VALIDATION_ERROR;
|
|
20
|
+
message: string;
|
|
21
|
+
hint: string;
|
|
22
|
+
errors?: Array<{
|
|
23
|
+
procedure?: string | undefined;
|
|
24
|
+
lineNumber?: number | undefined;
|
|
25
|
+
message: string;
|
|
26
|
+
}>;
|
|
27
|
+
issues?: RefIssue[];
|
|
28
|
+
}
|
|
29
|
+
/** Undefined when the payload passes both checks. */
|
|
30
|
+
export declare function runPreflight(tm1Client: TM1Client, p: PreflightPayload): Promise<PreflightFailure | undefined>;
|
|
31
|
+
/** The isError tool result for a failed preflight. */
|
|
32
|
+
export declare function preflightResult(failure: PreflightFailure): {
|
|
33
|
+
content: {
|
|
34
|
+
type: "text";
|
|
35
|
+
text: string;
|
|
36
|
+
}[];
|
|
37
|
+
isError: true;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=preflight.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { TM1ErrorCode } from "../../types.js";
|
|
2
|
+
import { checkProcessRefs } from "../../lib/process-refs.js";
|
|
3
|
+
const SKIP_NOTE = "Nothing was installed. preflight:false skips BOTH the syntax and the reference check — use it only for a name the code creates at runtime in a way the check cannot see.";
|
|
4
|
+
/** Undefined when the payload passes both checks. */
|
|
5
|
+
export async function runPreflight(tm1Client, p) {
|
|
6
|
+
const check = await tm1Client.processes.check({
|
|
7
|
+
name: p.name,
|
|
8
|
+
prolog: p.prolog,
|
|
9
|
+
metadata: p.metadata,
|
|
10
|
+
data: p.data,
|
|
11
|
+
epilog: p.epilog,
|
|
12
|
+
...(p.parameters !== undefined ? { parameters: p.parameters } : {}),
|
|
13
|
+
...(p.variables !== undefined ? { variables: p.variables } : {}),
|
|
14
|
+
...(p.dataSource !== undefined ? { dataSource: p.dataSource } : {}),
|
|
15
|
+
});
|
|
16
|
+
if (!check.success) {
|
|
17
|
+
return {
|
|
18
|
+
stage: "preflight",
|
|
19
|
+
check: "syntax",
|
|
20
|
+
processName: p.name,
|
|
21
|
+
code: TM1ErrorCode.VALIDATION_ERROR,
|
|
22
|
+
message: `Preflight syntax check failed: ${check.errors.length} error(s).`,
|
|
23
|
+
hint: `Fix the lines in errors[] (procedure + lineNumber). ${SKIP_NOTE}`,
|
|
24
|
+
errors: check.errors,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const refs = await checkProcessRefs(tm1Client, p);
|
|
28
|
+
if (refs.unresolved > 0) {
|
|
29
|
+
const names = [
|
|
30
|
+
...new Set(refs.issues.map((i) => i.kind === "element"
|
|
31
|
+
? `element '${i.name}' in dimension '${i.dimension}'`
|
|
32
|
+
: `${i.kind} '${i.name}'`)),
|
|
33
|
+
];
|
|
34
|
+
return {
|
|
35
|
+
stage: "preflight",
|
|
36
|
+
check: "references",
|
|
37
|
+
processName: p.name,
|
|
38
|
+
code: TM1ErrorCode.VALIDATION_ERROR,
|
|
39
|
+
message: `Preflight reference check failed: ${names.join(", ")} not found on the server.`,
|
|
40
|
+
// Deliberately not "correct the name": a near match (SalesPlan for
|
|
41
|
+
// 'Sales Plan') is a different object, and swapping it in unasked is
|
|
42
|
+
// the silent substitution this check exists to stop.
|
|
43
|
+
hint: `Report each unresolved name to the user before changing anything — a similarly named object is a different object, not a fix. Create the object first if the code needs it. ${SKIP_NOTE}`,
|
|
44
|
+
issues: refs.issues,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
/** The isError tool result for a failed preflight. */
|
|
50
|
+
export function preflightResult(failure) {
|
|
51
|
+
return {
|
|
52
|
+
content: [{ type: "text", text: JSON.stringify(failure) }],
|
|
53
|
+
isError: true,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=preflight.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { TM1Client } from "../../tm1-client.js";
|
|
2
|
+
export interface ProcessBackup {
|
|
3
|
+
json: string;
|
|
4
|
+
ti: string;
|
|
5
|
+
}
|
|
6
|
+
export interface GitPair {
|
|
7
|
+
json: string;
|
|
8
|
+
ti: string;
|
|
9
|
+
credentialsOmitted: boolean;
|
|
10
|
+
parameterCount: number;
|
|
11
|
+
variableCount: number;
|
|
12
|
+
dataSourceType: string;
|
|
13
|
+
hasSecurityAccess: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Read an installed process as the tm1-git pair. Code is returned as stored. */
|
|
16
|
+
export declare function readProcessAsGit(tm1Client: TM1Client, processName: string, opts?: {
|
|
17
|
+
includePassword?: boolean;
|
|
18
|
+
}): Promise<GitPair>;
|
|
19
|
+
/** The backup root, or null when backups are switched off. */
|
|
20
|
+
export declare function backupRoot(): string | null;
|
|
21
|
+
export declare function safeFileName(name: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Write the installed state of `processName` to the backup directory and
|
|
24
|
+
* return the two paths, or null when backups are off. Throws a TM1Error when
|
|
25
|
+
* the backup cannot be written: callers run this before their first write, so
|
|
26
|
+
* a failed backup means nothing is overwritten.
|
|
27
|
+
*/
|
|
28
|
+
export declare function backupProcess(tm1Client: TM1Client, processName: string, now?: Date): Promise<ProcessBackup | null>;
|
|
29
|
+
//# sourceMappingURL=process-backup.d.ts.map
|