@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,32 @@
|
|
|
1
|
+
import type { TM1Client } from "../../tm1-client.js";
|
|
2
|
+
import { type ReferenceIndex } from "./referenceIndex.js";
|
|
3
|
+
/**
|
|
4
|
+
* Wire the callgraph reference-index cache to tm1Events "mutation" notifications:
|
|
5
|
+
* any successful mutating HTTP call clears the cache so the next callgraph read
|
|
6
|
+
* rebuilds from fresh server state. The HTTP layer stays decoupled — it only
|
|
7
|
+
* emits the event; it holds no direct import of callgraph internals.
|
|
8
|
+
*
|
|
9
|
+
* Idempotent: safe to call once per TM1Client construction (or repeatedly)
|
|
10
|
+
* without stacking duplicate listeners on the process-global emitter.
|
|
11
|
+
*/
|
|
12
|
+
export declare function registerCallgraphCacheInvalidation(): void;
|
|
13
|
+
export interface BuildIndexOpts {
|
|
14
|
+
includeControl?: boolean;
|
|
15
|
+
/** Force a fresh fetch and ignore cache. */
|
|
16
|
+
bypassCache?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function invalidateCallgraphCache(): {
|
|
19
|
+
cleared: number;
|
|
20
|
+
};
|
|
21
|
+
export declare function getCallgraphCacheStats(): Array<{
|
|
22
|
+
key: string;
|
|
23
|
+
ageMs: number;
|
|
24
|
+
ttlRemainingMs: number;
|
|
25
|
+
buildMs: number;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Build a full ReferenceIndex from a connected TM1 server.
|
|
29
|
+
* TTL-cached (60 s) per `includeControl` flag. Concurrent calls share one inflight promise.
|
|
30
|
+
*/
|
|
31
|
+
export declare function buildIndexFromTM1(tm1Client: TM1Client, opts?: BuildIndexOpts): Promise<ReferenceIndex>;
|
|
32
|
+
//# sourceMappingURL=tm1-adapter.d.ts.map
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { buildReferenceIndex, } from "./referenceIndex.js";
|
|
2
|
+
import { tm1Events } from "../tm1-events.js";
|
|
3
|
+
import { rethrowIfSystemic } from "../../tm1-client/services/fallback.js";
|
|
4
|
+
// Cache-invalidation listener. Wired EXPLICITLY via
|
|
5
|
+
// registerCallgraphCacheInvalidation() at client construction — no import-time
|
|
6
|
+
// side-effect. Keeping this a named, stable function reference lets the wiring
|
|
7
|
+
// be idempotent (the registrar checks for it before re-adding).
|
|
8
|
+
// Data-plane paths that can never change the reference graph. The index is
|
|
9
|
+
// built from process definitions, chore definitions and cube rules; none of
|
|
10
|
+
// these endpoints touches any of that.
|
|
11
|
+
//
|
|
12
|
+
// This matters more than it looks: `ExecuteMDX` is a POST, so the HTTP layer
|
|
13
|
+
// classifies every ordinary MDX *read* as a mutation. Before this filter a
|
|
14
|
+
// single tm1_execute_mdx call threw away the whole callgraph index and forced
|
|
15
|
+
// a full rebuild on the next analysis call.
|
|
16
|
+
//
|
|
17
|
+
// Deliberately an allowlist of known-inert paths, not a denylist of
|
|
18
|
+
// code-relevant ones: anything unrecognised keeps invalidating, so a new
|
|
19
|
+
// mutating endpoint is stale-safe by default.
|
|
20
|
+
const INERT_PATHS = [/\/ExecuteMDX/i, /\/Cellsets/i, /tm1\.Update/i];
|
|
21
|
+
function affectsReferenceGraph(path) {
|
|
22
|
+
return !INERT_PATHS.some((re) => re.test(path));
|
|
23
|
+
}
|
|
24
|
+
const invalidateOnMutation = (e) => {
|
|
25
|
+
if (!affectsReferenceGraph(e.path))
|
|
26
|
+
return;
|
|
27
|
+
invalidateCallgraphCache();
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Wire the callgraph reference-index cache to tm1Events "mutation" notifications:
|
|
31
|
+
* any successful mutating HTTP call clears the cache so the next callgraph read
|
|
32
|
+
* rebuilds from fresh server state. The HTTP layer stays decoupled — it only
|
|
33
|
+
* emits the event; it holds no direct import of callgraph internals.
|
|
34
|
+
*
|
|
35
|
+
* Idempotent: safe to call once per TM1Client construction (or repeatedly)
|
|
36
|
+
* without stacking duplicate listeners on the process-global emitter.
|
|
37
|
+
*/
|
|
38
|
+
export function registerCallgraphCacheInvalidation() {
|
|
39
|
+
if (tm1Events.listeners("mutation").includes(invalidateOnMutation))
|
|
40
|
+
return;
|
|
41
|
+
tm1Events.on("mutation", invalidateOnMutation);
|
|
42
|
+
}
|
|
43
|
+
const CACHE_TTL_MS = 60_000;
|
|
44
|
+
const cache = new Map();
|
|
45
|
+
const inflight = new Map();
|
|
46
|
+
// Monotonic counter bumped on every invalidation. Clearing `cache` alone is not
|
|
47
|
+
// enough: a build that was already in flight when the mutation landed would
|
|
48
|
+
// finish afterwards and write its PRE-mutation snapshot back with a FRESH
|
|
49
|
+
// timestamp, republishing stale data for a full TTL. The build captures the
|
|
50
|
+
// generation it started in and refuses to publish if that generation is gone.
|
|
51
|
+
//
|
|
52
|
+
// The in-flight caller still receives the index it asked for — it requested a
|
|
53
|
+
// read that started before the mutation, so that result is merely old, not
|
|
54
|
+
// wrong. What must not happen is that snapshot becoming the answer for everyone
|
|
55
|
+
// else for the next 60 seconds.
|
|
56
|
+
let generation = 0;
|
|
57
|
+
export function invalidateCallgraphCache() {
|
|
58
|
+
const n = cache.size;
|
|
59
|
+
cache.clear();
|
|
60
|
+
generation++;
|
|
61
|
+
return { cleared: n };
|
|
62
|
+
}
|
|
63
|
+
export function getCallgraphCacheStats() {
|
|
64
|
+
const now = Date.now();
|
|
65
|
+
return Array.from(cache.entries()).map(([key, e]) => ({
|
|
66
|
+
key,
|
|
67
|
+
ageMs: now - e.ts,
|
|
68
|
+
ttlRemainingMs: Math.max(0, CACHE_TTL_MS - (now - e.ts)),
|
|
69
|
+
buildMs: e.buildMs,
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Build a full ReferenceIndex from a connected TM1 server.
|
|
74
|
+
* TTL-cached (60 s) per `includeControl` flag. Concurrent calls share one inflight promise.
|
|
75
|
+
*/
|
|
76
|
+
export async function buildIndexFromTM1(tm1Client, opts = {}) {
|
|
77
|
+
const includeControl = opts.includeControl ?? false;
|
|
78
|
+
const key = `inc=${includeControl}`;
|
|
79
|
+
if (!opts.bypassCache) {
|
|
80
|
+
const hit = cache.get(key);
|
|
81
|
+
if (hit && Date.now() - hit.ts < CACHE_TTL_MS)
|
|
82
|
+
return hit.index;
|
|
83
|
+
const pending = inflight.get(key);
|
|
84
|
+
if (pending)
|
|
85
|
+
return pending;
|
|
86
|
+
}
|
|
87
|
+
const promise = (async () => {
|
|
88
|
+
const start = Date.now();
|
|
89
|
+
const startGeneration = generation;
|
|
90
|
+
const idx = await buildIndexInternal(tm1Client, includeControl);
|
|
91
|
+
// Only publish if no invalidation happened while we were building.
|
|
92
|
+
if (generation === startGeneration) {
|
|
93
|
+
cache.set(key, {
|
|
94
|
+
index: idx,
|
|
95
|
+
ts: Date.now(),
|
|
96
|
+
buildMs: Date.now() - start,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return idx;
|
|
100
|
+
})();
|
|
101
|
+
inflight.set(key, promise);
|
|
102
|
+
try {
|
|
103
|
+
return await promise;
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
inflight.delete(key);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
async function buildIndexInternal(tm1Client, includeControl) {
|
|
110
|
+
const fetchProcesses = async () => {
|
|
111
|
+
const all = await tm1Client.processes.fetchForCallgraph(includeControl);
|
|
112
|
+
return all.map((p) => ({
|
|
113
|
+
name: p.name,
|
|
114
|
+
prolog: p.prolog,
|
|
115
|
+
metadata: p.metadata,
|
|
116
|
+
data: p.data,
|
|
117
|
+
epilog: p.epilog,
|
|
118
|
+
parameters: p.parameters,
|
|
119
|
+
parameterDefaults: p.parameterDefaults,
|
|
120
|
+
}));
|
|
121
|
+
};
|
|
122
|
+
const fetchCubesWithRules = async () => {
|
|
123
|
+
const all = await tm1Client.cubes.getAllRules(includeControl);
|
|
124
|
+
return all.map((c) => ({ cubeName: c.cubeName, rulesText: c.rulesText }));
|
|
125
|
+
};
|
|
126
|
+
const fetchChores = async () => {
|
|
127
|
+
try {
|
|
128
|
+
const chs = await tm1Client.chores.list();
|
|
129
|
+
return chs
|
|
130
|
+
.filter((c) => includeControl || !c.name.startsWith("}"))
|
|
131
|
+
.map((c) => {
|
|
132
|
+
const tasks = c.processes.map((t, i) => ({
|
|
133
|
+
step: i,
|
|
134
|
+
processName: t.name,
|
|
135
|
+
params: Object.entries(t.parameters).map(([name, val]) => ({
|
|
136
|
+
name,
|
|
137
|
+
value: String(val),
|
|
138
|
+
type: typeof val === "number" ? "numeric" : "string",
|
|
139
|
+
})),
|
|
140
|
+
}));
|
|
141
|
+
return { name: c.name, tasks };
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
catch (e) {
|
|
145
|
+
// Don't let an auth/connection/lock failure masquerade as "no chores" —
|
|
146
|
+
// that silently drops chore→process edges from the callgraph and the
|
|
147
|
+
// result looks complete. Real outages must propagate so the index is
|
|
148
|
+
// not built (and cached) from partial data.
|
|
149
|
+
rethrowIfSystemic(e);
|
|
150
|
+
return [];
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
return buildReferenceIndex({
|
|
154
|
+
fetchProcesses,
|
|
155
|
+
fetchCubesWithRules,
|
|
156
|
+
fetchChores,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=tm1-adapter.js.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** Ergebnis des Parsers */
|
|
2
|
+
export type TiParseResult = {
|
|
3
|
+
ok: true;
|
|
4
|
+
ast: TiAst;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
error: TiParseError;
|
|
8
|
+
};
|
|
9
|
+
export interface TiParseError {
|
|
10
|
+
line: number;
|
|
11
|
+
message: string;
|
|
12
|
+
}
|
|
13
|
+
/** AST = Array von Statements */
|
|
14
|
+
export type TiAst = TiStatement[];
|
|
15
|
+
export type TiStatement = TiAssignment | TiIfBlock | TiWhileBlock | TiFunctionCall;
|
|
16
|
+
export interface TiAssignment {
|
|
17
|
+
type: "assignment";
|
|
18
|
+
variable: string;
|
|
19
|
+
expression: string;
|
|
20
|
+
/** true if the expression contains CellGetN/CellGetS */
|
|
21
|
+
isExternal: boolean;
|
|
22
|
+
/** Falls isExternal: Funktionsname und Parameter */
|
|
23
|
+
cellGetInfo?: {
|
|
24
|
+
fn: "CellGetN" | "CellGetS";
|
|
25
|
+
params: string[];
|
|
26
|
+
} | undefined;
|
|
27
|
+
line: number;
|
|
28
|
+
}
|
|
29
|
+
export interface TiIfBlock {
|
|
30
|
+
type: "if";
|
|
31
|
+
condition: string;
|
|
32
|
+
thenBody: TiStatement[];
|
|
33
|
+
elseIfClauses: Array<{
|
|
34
|
+
condition: string;
|
|
35
|
+
body: TiStatement[];
|
|
36
|
+
line: number;
|
|
37
|
+
}>;
|
|
38
|
+
elseBody: TiStatement[];
|
|
39
|
+
line: number;
|
|
40
|
+
}
|
|
41
|
+
export interface TiWhileBlock {
|
|
42
|
+
type: "while";
|
|
43
|
+
condition: string;
|
|
44
|
+
body: TiStatement[];
|
|
45
|
+
line: number;
|
|
46
|
+
}
|
|
47
|
+
export interface TiFunctionCall {
|
|
48
|
+
type: "functionCall";
|
|
49
|
+
name: string;
|
|
50
|
+
args: string[];
|
|
51
|
+
line: number;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-process variable environment.
|
|
3
|
+
*
|
|
4
|
+
* Classifies each assignment `var = expression;` as
|
|
5
|
+
* - literal (string literal or numeric literal)
|
|
6
|
+
* - param (reference to a process parameter, directly or via another local variable that is a param)
|
|
7
|
+
* - datasource (reference to a DataSource variable whose value comes from the source data at runtime)
|
|
8
|
+
* - dynamic (everything else — CellGet, concatenation, function calls, IF, loops)
|
|
9
|
+
*
|
|
10
|
+
* Multi-assignment (a variable is assigned different values) → dynamic,
|
|
11
|
+
* because the value is no longer unambiguous at any given call site.
|
|
12
|
+
*/
|
|
13
|
+
export type TiVarType = "Numeric" | "String";
|
|
14
|
+
export type VarBinding = {
|
|
15
|
+
kind: "literal";
|
|
16
|
+
value: string;
|
|
17
|
+
} | {
|
|
18
|
+
kind: "param";
|
|
19
|
+
paramName: string;
|
|
20
|
+
paramType?: TiVarType | undefined;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "datasource";
|
|
23
|
+
varName: string;
|
|
24
|
+
varType: TiVarType;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "dynamic";
|
|
27
|
+
};
|
|
28
|
+
export interface ProcessEnv {
|
|
29
|
+
/** Parameter names of this process (lowercase). */
|
|
30
|
+
paramsLc: Set<string>;
|
|
31
|
+
/** Original-cased param names (for display). Map from lowercase → original. */
|
|
32
|
+
paramOriginal: Map<string, string>;
|
|
33
|
+
/** Parameter types (lowercase name → type). */
|
|
34
|
+
paramTypes: Map<string, TiVarType>;
|
|
35
|
+
/** DataSource variable names (lowercase → type + original casing). */
|
|
36
|
+
datasourceVars: Map<string, {
|
|
37
|
+
name: string;
|
|
38
|
+
type: TiVarType;
|
|
39
|
+
}>;
|
|
40
|
+
/** Local variable bindings (varname lowercase → resolved binding). */
|
|
41
|
+
vars: Map<string, VarBinding>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Classify a single right-hand-side expression (no surrounding whitespace).
|
|
45
|
+
* Only handles simple cases:
|
|
46
|
+
* 'literal', 42, varName (→ lookup), paramName (→ param-ref), dsVarName (→ datasource-ref).
|
|
47
|
+
* Constant string-concatenation (all operands resolve to literals) folds to a literal.
|
|
48
|
+
* Everything else (function calls, concatenation with any non-literal operand, arithmetic, IF, brackets) → dynamic.
|
|
49
|
+
*/
|
|
50
|
+
export declare function resolveExpression(expr: string, env: ProcessEnv): VarBinding;
|
|
51
|
+
export interface BuildEnvOptions {
|
|
52
|
+
/** 0-basierte, exklusive Zeilen-Obergrenze — Env wird nur aus Zeilen `< stopAtLine` gebaut. */
|
|
53
|
+
stopAtLine?: number;
|
|
54
|
+
/** Typ-Informationen pro Parameter (Key: lowercase Name). */
|
|
55
|
+
paramTypes?: Map<string, TiVarType>;
|
|
56
|
+
/** DataSource-Variablen-Definitionen (kommen aus dem Process-Objekt). */
|
|
57
|
+
datasourceVars?: Array<{
|
|
58
|
+
name: string;
|
|
59
|
+
type: TiVarType;
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* true: Mehrfach-Zuweisungen überschreiben (letzte Zuweisung gewinnt) — für Hover/Resolver-View,
|
|
63
|
+
* wo der User den aktuellen Stand an einer bestimmten Zeile sehen will.
|
|
64
|
+
* false (Default): Mehrfach-Zuweisungen mit unterschiedlichen Bindungen werden zu `dynamic` demoted —
|
|
65
|
+
* konservative Variante für Cross-Process-Referenztracking.
|
|
66
|
+
*/
|
|
67
|
+
lastAssignmentWins?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* true: Flow-sensitive Auswertung (IF/ELSEIF/ELSE-Blöcke strukturell behandeln; siehe `flowSensitiveEnv.ts`).
|
|
70
|
+
* Nur sinnvoll in Kombination mit `lastAssignmentWins:true`. Bei Parse-Fehlern wird transparent
|
|
71
|
+
* auf den flow-insensitiven Pfad zurückgefallen.
|
|
72
|
+
*/
|
|
73
|
+
flowSensitive?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Build a process env from TI text and the process's parameter names.
|
|
77
|
+
* Processes assignments top-down; multi-assignments are demoted to dynamic.
|
|
78
|
+
*
|
|
79
|
+
* Overloads:
|
|
80
|
+
* buildProcessEnv(text, paramNames)
|
|
81
|
+
* buildProcessEnv(text, paramNames, stopAtLine) — legacy positional
|
|
82
|
+
* buildProcessEnv(text, paramNames, options)
|
|
83
|
+
*/
|
|
84
|
+
export declare function buildProcessEnv(text: string, paramNames: string[], stopAtLineOrOptions?: number | BuildEnvOptions): ProcessEnv;
|
|
85
|
+
export declare function bindingsEqual(a: VarBinding, b: VarBinding): boolean;
|
|
86
|
+
//# sourceMappingURL=variableEnv.d.ts.map
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-process variable environment.
|
|
3
|
+
*
|
|
4
|
+
* Classifies each assignment `var = expression;` as
|
|
5
|
+
* - literal (string literal or numeric literal)
|
|
6
|
+
* - param (reference to a process parameter, directly or via another local variable that is a param)
|
|
7
|
+
* - datasource (reference to a DataSource variable whose value comes from the source data at runtime)
|
|
8
|
+
* - dynamic (everything else — CellGet, concatenation, function calls, IF, loops)
|
|
9
|
+
*
|
|
10
|
+
* Multi-assignment (a variable is assigned different values) → dynamic,
|
|
11
|
+
* because the value is no longer unambiguous at any given call site.
|
|
12
|
+
*/
|
|
13
|
+
const STRING_LITERAL_RE = /^'([^']*)'$/;
|
|
14
|
+
const NUMERIC_LITERAL_RE = /^-?\d+(?:\.\d+)?$/;
|
|
15
|
+
const IDENTIFIER_RE = /^[A-Za-z_]\w*$/;
|
|
16
|
+
function neutralizeLine(line) {
|
|
17
|
+
return line
|
|
18
|
+
.replace(/'[^']*'/g, (s) => " ".repeat(s.length))
|
|
19
|
+
.replace(/#.*$/, "");
|
|
20
|
+
}
|
|
21
|
+
const SECTION_MARKER_RE = /^57[2345],\d*$/;
|
|
22
|
+
/**
|
|
23
|
+
* Split an expression on top-level '|' (TI string-concat), ignoring '|' inside
|
|
24
|
+
* 'string literals' or (parens). A single-element result means no top-level '|'
|
|
25
|
+
* was found (not a concatenation).
|
|
26
|
+
*/
|
|
27
|
+
function splitTopLevelConcat(expr) {
|
|
28
|
+
const parts = [];
|
|
29
|
+
let cur = "";
|
|
30
|
+
let inStr = false;
|
|
31
|
+
let depth = 0;
|
|
32
|
+
for (const ch of expr) {
|
|
33
|
+
if (ch === "'") {
|
|
34
|
+
inStr = !inStr;
|
|
35
|
+
cur += ch;
|
|
36
|
+
}
|
|
37
|
+
else if (!inStr && ch === "(") {
|
|
38
|
+
depth++;
|
|
39
|
+
cur += ch;
|
|
40
|
+
}
|
|
41
|
+
else if (!inStr && ch === ")") {
|
|
42
|
+
depth--;
|
|
43
|
+
cur += ch;
|
|
44
|
+
}
|
|
45
|
+
else if (!inStr && depth === 0 && ch === "|") {
|
|
46
|
+
parts.push(cur);
|
|
47
|
+
cur = "";
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
cur += ch;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
parts.push(cur);
|
|
54
|
+
return parts;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Classify a single right-hand-side expression (no surrounding whitespace).
|
|
58
|
+
* Only handles simple cases:
|
|
59
|
+
* 'literal', 42, varName (→ lookup), paramName (→ param-ref), dsVarName (→ datasource-ref).
|
|
60
|
+
* Constant string-concatenation (all operands resolve to literals) folds to a literal.
|
|
61
|
+
* Everything else (function calls, concatenation with any non-literal operand, arithmetic, IF, brackets) → dynamic.
|
|
62
|
+
*/
|
|
63
|
+
export function resolveExpression(expr, env) {
|
|
64
|
+
const e = expr.trim().replace(/;+$/, "").trim();
|
|
65
|
+
// String literal
|
|
66
|
+
const strM = STRING_LITERAL_RE.exec(e);
|
|
67
|
+
if (strM) {
|
|
68
|
+
return { kind: "literal", value: strM[1] };
|
|
69
|
+
}
|
|
70
|
+
// Numeric literal
|
|
71
|
+
if (NUMERIC_LITERAL_RE.test(e)) {
|
|
72
|
+
return { kind: "literal", value: e };
|
|
73
|
+
}
|
|
74
|
+
// Bare identifier — could be param, a DataSource var, or a previously-assigned local var
|
|
75
|
+
if (IDENTIFIER_RE.test(e)) {
|
|
76
|
+
const lc = e.toLowerCase();
|
|
77
|
+
if (env.paramsLc.has(lc)) {
|
|
78
|
+
return {
|
|
79
|
+
kind: "param",
|
|
80
|
+
paramName: env.paramOriginal.get(lc) ?? e,
|
|
81
|
+
paramType: env.paramTypes.get(lc),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const ds = env.datasourceVars.get(lc);
|
|
85
|
+
if (ds) {
|
|
86
|
+
return { kind: "datasource", varName: ds.name, varType: ds.type };
|
|
87
|
+
}
|
|
88
|
+
const bound = env.vars.get(lc);
|
|
89
|
+
if (bound) {
|
|
90
|
+
return bound;
|
|
91
|
+
}
|
|
92
|
+
// Unknown identifier — treat as dynamic (could be a global, a later-assigned var, etc.)
|
|
93
|
+
return { kind: "dynamic" };
|
|
94
|
+
}
|
|
95
|
+
// Constant string-concatenation: fold if every operand resolves to a literal.
|
|
96
|
+
const parts = splitTopLevelConcat(e);
|
|
97
|
+
if (parts.length >= 2) {
|
|
98
|
+
const values = [];
|
|
99
|
+
for (const part of parts) {
|
|
100
|
+
const resolved = resolveExpression(part, env);
|
|
101
|
+
if (resolved.kind !== "literal") {
|
|
102
|
+
return { kind: "dynamic" };
|
|
103
|
+
}
|
|
104
|
+
values.push(resolved.value);
|
|
105
|
+
}
|
|
106
|
+
return { kind: "literal", value: values.join("") };
|
|
107
|
+
}
|
|
108
|
+
return { kind: "dynamic" };
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Build a process env from TI text and the process's parameter names.
|
|
112
|
+
* Processes assignments top-down; multi-assignments are demoted to dynamic.
|
|
113
|
+
*
|
|
114
|
+
* Overloads:
|
|
115
|
+
* buildProcessEnv(text, paramNames)
|
|
116
|
+
* buildProcessEnv(text, paramNames, stopAtLine) — legacy positional
|
|
117
|
+
* buildProcessEnv(text, paramNames, options)
|
|
118
|
+
*/
|
|
119
|
+
export function buildProcessEnv(text, paramNames, stopAtLineOrOptions) {
|
|
120
|
+
const opts = typeof stopAtLineOrOptions === "number"
|
|
121
|
+
? { stopAtLine: stopAtLineOrOptions }
|
|
122
|
+
: (stopAtLineOrOptions ?? {});
|
|
123
|
+
const paramsLc = new Set(paramNames.map((p) => p.toLowerCase()));
|
|
124
|
+
const paramOriginal = new Map(paramNames.map((p) => [p.toLowerCase(), p]));
|
|
125
|
+
const paramTypes = opts.paramTypes ?? new Map();
|
|
126
|
+
const datasourceVars = new Map();
|
|
127
|
+
for (const dv of opts.datasourceVars ?? []) {
|
|
128
|
+
datasourceVars.set(dv.name.toLowerCase(), { name: dv.name, type: dv.type });
|
|
129
|
+
}
|
|
130
|
+
const env = {
|
|
131
|
+
paramsLc,
|
|
132
|
+
paramOriginal,
|
|
133
|
+
paramTypes,
|
|
134
|
+
datasourceVars,
|
|
135
|
+
vars: new Map(),
|
|
136
|
+
};
|
|
137
|
+
const assignedOnce = new Map();
|
|
138
|
+
const seen = new Set();
|
|
139
|
+
const assignRe = /^\s*([A-Za-z_]\w*)\s*=\s*(.+?)\s*;?\s*(?:#.*)?$/;
|
|
140
|
+
const lines = text.split("\n");
|
|
141
|
+
const limit = opts.stopAtLine !== undefined
|
|
142
|
+
? Math.min(opts.stopAtLine, lines.length)
|
|
143
|
+
: lines.length;
|
|
144
|
+
for (let i = 0; i < limit; i++) {
|
|
145
|
+
const raw = lines[i];
|
|
146
|
+
const line = raw.replace(/\r$/, "");
|
|
147
|
+
if (SECTION_MARKER_RE.test(line.trim()) || line.trim() === "") {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
// Skip comment-only lines
|
|
151
|
+
if (neutralizeLine(line).trim() === "") {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
// Skip if line does not look like a pure assignment (contains `==` or similar comparisons in condition context)
|
|
155
|
+
const m = assignRe.exec(line);
|
|
156
|
+
if (!m) {
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
const varName = m[1];
|
|
160
|
+
const rhs = m[2];
|
|
161
|
+
// Exclude cases where rhs starts with `=` (meaning `==` comparison) — already filtered by regex `=\s*(.+)` non-greedy
|
|
162
|
+
// but `a == b` would match with varName='a' and rhs='= b'. Guard:
|
|
163
|
+
if (rhs.startsWith("=")) {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
const lc = varName.toLowerCase();
|
|
167
|
+
// Never shadow a param name as a local var — a param reference of itself stays a param
|
|
168
|
+
if (paramsLc.has(lc)) {
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
// DataSource-Vars bleiben als solche erhalten — lokale Zuweisung mit demselben Namen wäre unüblich,
|
|
172
|
+
// wir ignorieren sie um die „Herkunft aus der DataSource" sichtbar zu halten.
|
|
173
|
+
if (datasourceVars.has(lc)) {
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
const binding = resolveExpression(rhs, env);
|
|
177
|
+
if (opts.lastAssignmentWins) {
|
|
178
|
+
// Jüngste Zuweisung überschreibt — passt zur Sicht „Wert direkt vor Zeile N".
|
|
179
|
+
assignedOnce.set(lc, binding);
|
|
180
|
+
env.vars.set(lc, binding);
|
|
181
|
+
}
|
|
182
|
+
else if (seen.has(lc)) {
|
|
183
|
+
const prev = assignedOnce.get(lc);
|
|
184
|
+
if (prev && !bindingsEqual(prev, binding)) {
|
|
185
|
+
// Konservativ: Multi-Assign mit unterschiedlichen Bindungen → dynamic.
|
|
186
|
+
assignedOnce.set(lc, { kind: "dynamic" });
|
|
187
|
+
env.vars.set(lc, { kind: "dynamic" });
|
|
188
|
+
}
|
|
189
|
+
// else: identische Bindung, Zustand bleibt
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
seen.add(lc);
|
|
193
|
+
assignedOnce.set(lc, binding);
|
|
194
|
+
env.vars.set(lc, binding);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return env;
|
|
198
|
+
}
|
|
199
|
+
export function bindingsEqual(a, b) {
|
|
200
|
+
if (a.kind !== b.kind) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
if (a.kind === "literal" && b.kind === "literal") {
|
|
204
|
+
return a.value === b.value;
|
|
205
|
+
}
|
|
206
|
+
if (a.kind === "param" && b.kind === "param") {
|
|
207
|
+
return a.paramName.toLowerCase() === b.paramName.toLowerCase();
|
|
208
|
+
}
|
|
209
|
+
if (a.kind === "datasource" && b.kind === "datasource") {
|
|
210
|
+
return a.varName.toLowerCase() === b.varName.toLowerCase();
|
|
211
|
+
}
|
|
212
|
+
return a.kind === "dynamic";
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=variableEnv.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const SANDBOX_DIMENSION = "Sandboxes";
|
|
2
|
+
export declare const BASE_SANDBOX = "Base";
|
|
3
|
+
export interface ResolvedAddress {
|
|
4
|
+
/** The cube's dimensions, in cube order. */
|
|
5
|
+
dimensions: string[];
|
|
6
|
+
/** Maps a caller's elements (in the caller's dimension order) to cube order. */
|
|
7
|
+
toCubeOrder: (elements: readonly string[]) => string[];
|
|
8
|
+
/** Set when `Sandboxes` was left out and bound to `Base`. */
|
|
9
|
+
sandboxDefaulted?: typeof BASE_SANDBOX;
|
|
10
|
+
}
|
|
11
|
+
export declare function resolveCellAddress(cubeName: string, cubeDimensions: readonly string[], given: readonly string[]): ResolvedAddress;
|
|
12
|
+
//# sourceMappingURL=cell-address.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Resolve a caller's named-dimension cell address against the cube's real
|
|
2
|
+
// dimension list, before anything is written. Shared by tm1_write_cells and
|
|
3
|
+
// tm1_check_writable_coords so the pre-write check and the write agree on
|
|
4
|
+
// which cell a coordinate means.
|
|
5
|
+
//
|
|
6
|
+
// Why: the write path builds an MDX tuple over the dimensions the caller
|
|
7
|
+
// names, and TM1 fills every dimension left out with its default member —
|
|
8
|
+
// without an error. Verified on 11.8.03500: a write that left out a measure
|
|
9
|
+
// dimension landed on its first element and overwrote a value there.
|
|
10
|
+
//
|
|
11
|
+
// The one dimension that may be left out is the `Sandboxes` dimension that
|
|
12
|
+
// `EnableSandboxDimension=true` adds to every cube: callers rarely think of it
|
|
13
|
+
// as part of the cube. It is bound to `Base` explicitly rather than left to
|
|
14
|
+
// TM1's default member, because the default is only known to be `Base` while
|
|
15
|
+
// `Base` is the dimension's sole member — a sandbox with
|
|
16
|
+
// IncludeInSandboxDimension=true adds another. This server never sends
|
|
17
|
+
// `!sandbox=`, so `Base` is also what every read through it sees. A cube with
|
|
18
|
+
// a regular dimension that happens to be named Sandboxes but has no `Base`
|
|
19
|
+
// fails loudly with TM1's "member not found", never silently.
|
|
20
|
+
import { TM1Error, TM1ErrorCode } from "../types.js";
|
|
21
|
+
export const SANDBOX_DIMENSION = "Sandboxes";
|
|
22
|
+
export const BASE_SANDBOX = "Base";
|
|
23
|
+
export function resolveCellAddress(cubeName, cubeDimensions, given) {
|
|
24
|
+
const byLower = new Map(cubeDimensions.map((d, i) => [d.toLowerCase(), i]));
|
|
25
|
+
const positions = [];
|
|
26
|
+
const unknown = [];
|
|
27
|
+
const duplicate = [];
|
|
28
|
+
const seen = new Set();
|
|
29
|
+
for (const name of given) {
|
|
30
|
+
const pos = byLower.get(name.toLowerCase());
|
|
31
|
+
if (pos === undefined)
|
|
32
|
+
unknown.push(name);
|
|
33
|
+
else if (seen.has(pos))
|
|
34
|
+
duplicate.push(name);
|
|
35
|
+
else
|
|
36
|
+
seen.add(pos);
|
|
37
|
+
positions.push(pos ?? -1);
|
|
38
|
+
}
|
|
39
|
+
const missing = cubeDimensions.filter((_, i) => !seen.has(i));
|
|
40
|
+
const sandboxPos = cubeDimensions.findIndex((d) => d.toLowerCase() === SANDBOX_DIMENSION.toLowerCase());
|
|
41
|
+
const onlySandboxMissing = missing.length === 1 && sandboxPos >= 0 && !seen.has(sandboxPos);
|
|
42
|
+
const problems = [];
|
|
43
|
+
if (unknown.length > 0)
|
|
44
|
+
problems.push(`not in the cube: ${unknown.join(", ")}`);
|
|
45
|
+
if (duplicate.length > 0)
|
|
46
|
+
problems.push(`listed twice: ${duplicate.join(", ")}`);
|
|
47
|
+
if (missing.length > 0 && !onlySandboxMissing)
|
|
48
|
+
problems.push(`missing: ${missing.filter((d) => d !== cubeDimensions[sandboxPos]).join(", ")}`);
|
|
49
|
+
if (problems.length > 0) {
|
|
50
|
+
throw new TM1Error({
|
|
51
|
+
code: TM1ErrorCode.VALIDATION_ERROR,
|
|
52
|
+
message: `Dimensions do not match cube '${cubeName}' — ${problems.join("; ")}. Nothing was written.`,
|
|
53
|
+
hint: `Name every dimension of the cube (any order): ${cubeDimensions.join(", ")}. A dimension left out is not ignored — TM1 writes into its default member.${sandboxPos >= 0 ? ` Only ${SANDBOX_DIMENSION} may be left out; it is then bound to ${BASE_SANDBOX}.` : ""}`,
|
|
54
|
+
details: JSON.stringify({ cubeDimensions, given }),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
dimensions: [...cubeDimensions],
|
|
59
|
+
toCubeOrder: (elements) => {
|
|
60
|
+
const out = new Array(cubeDimensions.length);
|
|
61
|
+
elements.forEach((e, i) => {
|
|
62
|
+
out[positions[i]] = e;
|
|
63
|
+
});
|
|
64
|
+
if (onlySandboxMissing)
|
|
65
|
+
out[sandboxPos] = BASE_SANDBOX;
|
|
66
|
+
return out;
|
|
67
|
+
},
|
|
68
|
+
...(onlySandboxMissing ? { sandboxDefaulted: BASE_SANDBOX } : {}),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=cell-address.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ProcessCodeInput, TiTab } from "./process-metrics.js";
|
|
2
|
+
export type Severity = "error" | "warn" | "info";
|
|
3
|
+
export interface Finding {
|
|
4
|
+
process: string;
|
|
5
|
+
tab: TiTab;
|
|
6
|
+
line: number;
|
|
7
|
+
rule: string;
|
|
8
|
+
severity: Severity;
|
|
9
|
+
snippet: string;
|
|
10
|
+
hint: string;
|
|
11
|
+
}
|
|
12
|
+
export interface LintOptions {
|
|
13
|
+
/** Element-arg count at/above which CellGetN/S is flagged as perf-risky. */
|
|
14
|
+
cellGetDimThreshold?: number | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Additional variable names (case-insensitive) to exclude from dead-assignment
|
|
17
|
+
* detection — pass process parameters and datasource column variable names here.
|
|
18
|
+
*/
|
|
19
|
+
excludeVarsFromDeadCheck?: string[] | undefined;
|
|
20
|
+
}
|
|
21
|
+
export declare function lintProcess(process: string, code: ProcessCodeInput, opts?: LintOptions): Finding[];
|
|
22
|
+
//# sourceMappingURL=antipatterns.d.ts.map
|