@eagleoutice/flowr 2.12.3 → 2.13.1
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/README.md +42 -95
- package/abstract-interpretation/data-frame/dataframe-domain.d.ts +3 -3
- package/abstract-interpretation/data-frame/dataframe-domain.js +14 -6
- package/abstract-interpretation/data-frame/semantics.js +12 -16
- package/abstract-interpretation/domains/abstract-domain.d.ts +46 -44
- package/abstract-interpretation/domains/abstract-domain.js +146 -6
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +16 -25
- package/abstract-interpretation/domains/bounded-set-domain.js +22 -69
- package/abstract-interpretation/domains/interval-domain.d.ts +27 -36
- package/abstract-interpretation/domains/interval-domain.js +111 -146
- package/abstract-interpretation/domains/lattice.d.ts +3 -3
- package/abstract-interpretation/domains/multi-value-state-domain.js +3 -3
- package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -19
- package/abstract-interpretation/domains/partial-product-domain.js +21 -54
- package/abstract-interpretation/domains/positive-interval-domain.d.ts +8 -12
- package/abstract-interpretation/domains/positive-interval-domain.js +21 -50
- package/abstract-interpretation/domains/product-domain.d.ts +1 -1
- package/abstract-interpretation/domains/product-domain.js +4 -4
- package/abstract-interpretation/domains/set-range-domain.d.ts +60 -56
- package/abstract-interpretation/domains/set-range-domain.js +141 -200
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +17 -23
- package/abstract-interpretation/domains/set-upper-bound-domain.js +59 -103
- package/abstract-interpretation/domains/singleton-domain.d.ts +15 -18
- package/abstract-interpretation/domains/singleton-domain.js +33 -72
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +12 -16
- package/abstract-interpretation/domains/state-abstract-domain.js +36 -126
- package/abstract-interpretation/domains/state-domain-like.d.ts +2 -2
- package/abstract-interpretation/domains/value-abstract-domain.d.ts +120 -0
- package/abstract-interpretation/domains/{satisfiable-domain.js → value-abstract-domain.js} +14 -2
- package/benchmark/slicer.d.ts +2 -2
- package/benchmark/slicer.js +6 -5
- package/cli/common/options.d.ts +20 -0
- package/cli/common/options.js +4 -0
- package/cli/common/scripts-info.d.ts +20 -0
- package/cli/flowr-main-options.d.ts +4 -0
- package/cli/flowr-main-options.js +5 -0
- package/cli/flowr.d.ts +5 -0
- package/cli/flowr.js +15 -7
- package/cli/repl/commands/repl-commands.d.ts +8 -0
- package/cli/repl/commands/repl-commands.js +16 -3
- package/cli/repl/commands/repl-query.js +50 -20
- package/cli/repl/commands/repl-signature.js +2 -2
- package/cli/repl/core.d.ts +14 -5
- package/cli/repl/core.js +32 -17
- package/cli/repl/parser/slice-query-parser.d.ts +69 -8
- package/cli/repl/parser/slice-query-parser.js +82 -13
- package/cli/repl/path-input.d.ts +6 -0
- package/cli/repl/path-input.js +41 -0
- package/cli/repl/print-version.js +3 -5
- package/cli/slicer-app.d.ts +4 -0
- package/cli/slicer-app.js +4 -2
- package/config.d.ts +56 -6
- package/config.js +134 -12
- package/control-flow/control-flow-graph.d.ts +3 -2
- package/control-flow/control-flow-graph.js +34 -14
- package/control-flow/semantic-cfg-guided-visitor.d.ts +3 -0
- package/control-flow/semantic-cfg-guided-visitor.js +3 -0
- package/core/steps/all/static-slicing/10-reconstruct.d.ts +6 -0
- package/core/steps/all/static-slicing/10-reconstruct.js +3 -1
- package/data/r-base-packages.generated.d.ts +1 -1
- package/data/r-base-packages.generated.js +3 -3
- package/data/sigdb/sigdb.remote.json +53 -53
- package/dataflow/environments/built-in-proc-name.d.ts +2 -0
- package/dataflow/environments/built-in-proc-name.js +2 -0
- package/dataflow/environments/built-in.d.ts +2 -0
- package/dataflow/environments/built-in.js +2 -0
- package/dataflow/environments/default-builtin-config.d.ts +3 -5
- package/dataflow/environments/default-builtin-config.js +2 -2
- package/dataflow/environments/environment.d.ts +9 -0
- package/dataflow/environments/environment.js +28 -7
- package/dataflow/environments/identifier.d.ts +1 -2
- package/dataflow/environments/identifier.js +1 -5
- package/dataflow/extractor.js +1 -2
- package/dataflow/graph/dataflowgraph-builder.js +42 -3
- package/dataflow/graph/df-helper.d.ts +15 -0
- package/dataflow/graph/df-helper.js +20 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +57 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +12 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +233 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -3
- package/documentation/data/faq/faqs.js +12 -1
- package/documentation/doc-readme.js +1 -1
- package/documentation/doc-util/doc-files.d.ts +2 -2
- package/documentation/doc-util/doc-files.js +4 -7
- package/documentation/doc-util/doc-query.d.ts +12 -9
- package/documentation/doc-util/doc-query.js +63 -28
- package/documentation/wiki-absint.js +1 -4
- package/documentation/wiki-analyzer.js +8 -3
- package/documentation/wiki-cfg.js +3 -2
- package/documentation/wiki-dataflow-graph.js +14 -4
- package/documentation/wiki-interface.js +30 -16
- package/documentation/wiki-mk/doc-maker.js +1 -1
- package/documentation/wiki-query.js +190 -30
- package/documentation/wiki-signature-database.d.ts +1 -1
- package/documentation/wiki-signature-database.js +53 -27
- package/linter/linter-output.d.ts +24 -0
- package/linter/linter-output.js +117 -0
- package/linter/linter-rules.d.ts +2 -4
- package/linter/rules/dataframe-access-validation.js +4 -4
- package/linter/rules/deprecated-functions.d.ts +2 -4
- package/linter/rules/deprecated-functions.js +58 -3
- package/linter/rules/undefined-symbol.js +18 -10
- package/linter/rules/unused-definition.js +24 -0
- package/package.json +5 -2
- package/project/context/flowr-analyzer-context.d.ts +61 -1
- package/project/context/flowr-analyzer-context.js +124 -3
- package/project/context/flowr-analyzer-dependencies-context.d.ts +32 -7
- package/project/context/flowr-analyzer-dependencies-context.js +33 -3
- package/project/context/flowr-analyzer-files-context.d.ts +40 -0
- package/project/context/flowr-analyzer-files-context.js +171 -14
- package/project/context/flowr-analyzer-loading-order-context.d.ts +6 -0
- package/project/context/flowr-analyzer-loading-order-context.js +20 -0
- package/project/context/flowr-analyzer-meta-context.d.ts +92 -10
- package/project/context/flowr-analyzer-meta-context.js +64 -23
- package/project/context/flowr-file.d.ts +7 -0
- package/project/context/flowr-file.js +7 -0
- package/project/context/project-kind.d.ts +22 -0
- package/project/context/project-kind.js +27 -0
- package/project/dependency-version-space.d.ts +168 -0
- package/project/dependency-version-space.js +570 -0
- package/project/flowr-analyzer-builder.js +1 -1
- package/project/flowr-analyzer.d.ts +7 -0
- package/project/flowr-analyzer.js +9 -0
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
- package/project/plugins/file-plugins/files/flowr-description-file.js +7 -0
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +5 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +739 -0
- package/project/plugins/file-plugins/files/flowr-rda-file.js +2407 -0
- package/project/plugins/file-plugins/files/flowr-rproject-file.d.ts +31 -0
- package/project/plugins/file-plugins/files/flowr-rproject-file.js +66 -0
- package/project/plugins/file-plugins/files/r-fun-tab.d.ts +828 -0
- package/project/plugins/file-plugins/files/r-fun-tab.js +1039 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +26 -0
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +38 -0
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +17 -0
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +30 -0
- package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.d.ts +22 -0
- package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.js +36 -0
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +3 -4
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +5 -6
- package/project/plugins/flowr-analyzer-plugin.js +5 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +1 -1
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.d.ts +14 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.js +53 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +1 -1
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.d.ts +15 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.js +33 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +18 -13
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.d.ts +13 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.js +32 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +8 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +70 -7
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.d.ts +18 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +62 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +4 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +5 -13
- package/project/plugins/package-version-plugins/package.d.ts +4 -1
- package/project/plugins/package-version-plugins/package.js +8 -5
- package/project/plugins/plugin-registry.d.ts +11 -3
- package/project/plugins/plugin-registry.js +24 -5
- package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.d.ts +51 -0
- package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.js +101 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +10 -5
- package/project/sigdb/build.js +12 -2
- package/project/sigdb/decode.d.ts +7 -0
- package/project/sigdb/decode.js +35 -4
- package/project/sigdb/decompress.d.ts +2 -0
- package/project/sigdb/decompress.js +5 -0
- package/project/sigdb/manifest.d.ts +5 -0
- package/project/sigdb/manifest.js +37 -6
- package/project/sigdb/reader.d.ts +82 -2
- package/project/sigdb/reader.js +226 -14
- package/project/sigdb/schema.d.ts +31 -5
- package/project/sigdb/schema.js +7 -3
- package/project/sigdb/{version.d.ts → sigdb-version.d.ts} +21 -1
- package/project/sigdb/sigdb-version.js +119 -0
- package/queries/catalog/absint-query/absint-query-format.d.ts +2 -0
- package/queries/catalog/absint-query/absint-query-format.js +2 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +30 -3
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -0
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
- package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +6 -0
- package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -0
- package/queries/catalog/call-graph-query/expand-library-internals.d.ts +19 -0
- package/queries/catalog/call-graph-query/expand-library-internals.js +59 -0
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -0
- package/queries/catalog/cluster-query/cluster-query-format.js +1 -0
- package/queries/catalog/config-query/config-query-executor.js +17 -5
- package/queries/catalog/config-query/config-query-format.d.ts +19 -3
- package/queries/catalog/config-query/config-query-format.js +258 -98
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -0
- package/queries/catalog/control-flow-query/control-flow-query-format.js +1 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -7
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +13 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +117 -17
- package/queries/catalog/dice-query/dice-query-executor.js +6 -9
- package/queries/catalog/dice-query/dice-query-format.d.ts +4 -5
- package/queries/catalog/dice-query/dice-query-format.js +10 -6
- package/queries/catalog/does-call-query/does-call-query-executor.js +15 -2
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +8 -0
- package/queries/catalog/does-call-query/does-call-query-format.js +4 -1
- package/queries/catalog/files-query/files-query-format.d.ts +2 -0
- package/queries/catalog/files-query/files-query-format.js +2 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.d.ts +6 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +293 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +121 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +345 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -0
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -0
- package/queries/catalog/id-map-query/id-map-query-format.js +1 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -0
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -0
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -0
- package/queries/catalog/linter-query/linter-query-executor.js +11 -2
- package/queries/catalog/linter-query/linter-query-format.d.ts +9 -4
- package/queries/catalog/linter-query/linter-query-format.js +44 -21
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
- package/queries/catalog/location-map-query/location-map-query-format.js +2 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -0
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
- package/queries/catalog/origin-query/origin-query-format.js +2 -0
- package/queries/catalog/project-query/project-query-executor.d.ts +0 -15
- package/queries/catalog/project-query/project-query-executor.js +19 -62
- package/queries/catalog/project-query/project-query-format.d.ts +7 -18
- package/queries/catalog/project-query/project-query-format.js +3 -18
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
- package/queries/catalog/provenance-query/provenance-query-format.js +2 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -0
- package/queries/catalog/search-query/search-query-format.d.ts +1 -0
- package/queries/catalog/search-query/search-query-format.js +1 -0
- package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -0
- package/queries/catalog/signature-query/signature-query-executor.js +267 -57
- package/queries/catalog/signature-query/signature-query-format.d.ts +37 -6
- package/queries/catalog/signature-query/signature-query-format.js +41 -5
- package/queries/catalog/signature-query/signature-query-render.js +48 -6
- package/queries/catalog/slice-query-options.d.ts +49 -0
- package/queries/catalog/slice-query-options.js +50 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -12
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -15
- package/queries/catalog/static-slice-query/static-slice-query-format.js +9 -10
- package/queries/query-print.js +3 -1
- package/queries/query.d.ts +62 -2
- package/queries/query.js +9 -2
- package/r-bridge/data/data.d.ts +16 -0
- package/r-bridge/data/data.js +20 -0
- package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +19 -16
- package/reconstruct/reconstruct.d.ts +18 -1
- package/reconstruct/reconstruct.js +42 -19
- package/slicing/criterion/parse.d.ts +4 -0
- package/slicing/criterion/parse.js +4 -0
- package/slicing/static/slice-call.js +17 -9
- package/slicing/static/static-slicer.d.ts +1 -1
- package/slicing/static/static-slicer.js +5 -4
- package/util/files.d.ts +19 -1
- package/util/files.js +45 -3
- package/util/glob.d.ts +19 -0
- package/util/glob.js +67 -0
- package/util/log.d.ts +12 -0
- package/util/log.js +17 -1
- package/util/logic.d.ts +6 -0
- package/util/logic.js +31 -1
- package/util/mermaid/dfg.js +17 -12
- package/util/mermaid/mermaid.js +2 -2
- package/util/objects.d.ts +5 -0
- package/util/objects.js +8 -0
- package/util/r-version.d.ts +9 -1
- package/util/r-version.js +27 -2
- package/util/schema.d.ts +18 -0
- package/util/schema.js +102 -4
- package/util/text/ansi.d.ts +4 -0
- package/util/text/ansi.js +27 -3
- package/util/text/strings.d.ts +9 -0
- package/util/text/strings.js +29 -0
- package/util/version.js +79 -6
- package/abstract-interpretation/domains/satisfiable-domain.d.ts +0 -29
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +0 -22
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +0 -52
- package/project/sigdb/version.js +0 -55
|
@@ -4,119 +4,223 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ConfigQueryDefinition = void 0;
|
|
7
|
+
exports.validateConfigUpdate = validateConfigUpdate;
|
|
7
8
|
const config_query_executor_1 = require("./config-query-executor");
|
|
8
9
|
const ansi_1 = require("../../../util/text/ansi");
|
|
9
10
|
const time_1 = require("../../../util/text/time");
|
|
10
11
|
const joi_1 = __importDefault(require("joi"));
|
|
11
12
|
const config_1 = require("../../../config");
|
|
12
13
|
const json_1 = require("../../../util/json");
|
|
14
|
+
const core_1 = require("../../../cli/repl/core");
|
|
13
15
|
const schema_1 = require("../../../util/schema");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
16
|
+
const strings_1 = require("../../../util/text/strings");
|
|
17
|
+
function configReplCompleter(partialLine, startingNewArg, _config) {
|
|
18
|
+
// the config query is a single token
|
|
19
|
+
if (partialLine.length > 1 || (partialLine.length === 1 && startingNewArg)) {
|
|
20
|
+
return { completions: [] };
|
|
21
|
+
}
|
|
22
|
+
const token = partialLine[0] ?? '';
|
|
23
|
+
const update = token.startsWith('+');
|
|
24
|
+
const raw = update ? token.slice(1) : token;
|
|
25
|
+
const sigil = update ? '+' : '';
|
|
26
|
+
// on the empty token also offer `+` (writes a value) before the inspectable keys (which read); label it like the keys
|
|
27
|
+
const lead = token.length === 0 ? ['+'] : [];
|
|
28
|
+
const leadLabels = token.length === 0 ? [['+', (0, core_1.describeCompletion)('+', 'change config values')]] : [];
|
|
29
|
+
// once `+key=` is typed, complete the value (its type), not more keys
|
|
30
|
+
if (update && raw.includes('=')) {
|
|
31
|
+
const eq = raw.indexOf('=');
|
|
32
|
+
const keyPath = raw.slice(0, eq).split('.').filter(p => p.length > 0);
|
|
33
|
+
const valuePart = raw.slice(eq + 1);
|
|
34
|
+
const prefix = `+${raw.slice(0, eq)}=`;
|
|
35
|
+
const { concrete, placeholder } = splitValueHints(configSchemaInfo(keyPath));
|
|
36
|
+
const values = (0, strings_1.matchByPrefixOrSubsequence)(concrete, valuePart);
|
|
37
|
+
return {
|
|
38
|
+
completions: values.map(v => prefix + v),
|
|
39
|
+
labels: new Map(values.map(v => [prefix + v, v])),
|
|
40
|
+
hints: placeholder !== undefined && valuePart.length === 0 ? [prefix + placeholder] : undefined
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// a glob reads several keys, so expand it to the paths it matches (the trailing segment completes as a prefix)
|
|
44
|
+
if (!update && raw.includes('*')) {
|
|
45
|
+
const matches = configGlobMatcher(raw.endsWith('*') ? raw : `${raw}*`);
|
|
46
|
+
const found = sortConfigPaths(configPaths().filter(matches)).map(p => p.join('.'));
|
|
47
|
+
return { completions: found, labels: new Map(found.map(p => [p, (0, core_1.describeCompletion)(p, configSchemaInfo(p.split('.')).type ?? '')])), preFiltered: true };
|
|
48
|
+
}
|
|
49
|
+
const path = raw.split('.').filter(p => p.length > 0);
|
|
50
|
+
const fullPath = path.slice();
|
|
51
|
+
const lastPath = token.endsWith('.') ? '' : path.pop() ?? '';
|
|
52
|
+
/* the schema knows every option, a value only those that are set; `reset` (top level, update only) is not a schema key but a fixed action */
|
|
53
|
+
const options = update && path.length === 0 ? [...configSchemaKeys(path), 'reset'] : configSchemaKeys(path);
|
|
54
|
+
const atLeaf = lastPath.length > 0 && options.includes(lastPath) && configSchemaInfo([...path, lastPath]).type !== 'object';
|
|
55
|
+
if (!atLeaf) {
|
|
56
|
+
const offered = (0, strings_1.matchByPrefixOrSubsequence)(options, lastPath);
|
|
57
|
+
const have = offered.map(k => `${sigil}${[...path, k].join('.')}`);
|
|
58
|
+
if (have.length > 0) {
|
|
59
|
+
// label starts with the full completion (incl. sigil) so readline keeps the sigil on common-prefix insertion
|
|
60
|
+
return { completions: [...lead, ...have], labels: new Map([...leadLabels, ...have.map((c, i) => [c, offered[i] === 'reset' && path.length === 0 ? (0, core_1.describeCompletion)(c, 'discard runtime config updates') : (0, core_1.describeCompletion)(c, configSchemaInfo([...path, offered[i]]).type ?? '')])]) };
|
|
48
61
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const values = configValueHints(configSchemaInfo(fullPath)); // a boolean/enum offers its values, others a `<type>` hint
|
|
52
|
-
if (values.length > 0) {
|
|
53
|
-
return { completions: values.map(v => `${leaf}=${v}`) };
|
|
54
|
-
}
|
|
62
|
+
else if (lastPath.length > 0 && configSchemaKeys(fullPath).length > 0) {
|
|
63
|
+
return { completions: [`${sigil}${fullPath.join('.')}.`] };
|
|
55
64
|
}
|
|
56
|
-
return { completions: [`${leaf}${inspect ? '' : '='}`] };
|
|
57
65
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
const leafInfo = configSchemaInfo(fullPath);
|
|
67
|
+
if (leafInfo.type === undefined) {
|
|
68
|
+
return { completions: [] }; // not a real config key: offer nothing (in particular, never append `=`)
|
|
69
|
+
}
|
|
70
|
+
const leaf = `${sigil}${fullPath.join('.')}`;
|
|
71
|
+
if (update) {
|
|
72
|
+
const { concrete, placeholder } = splitValueHints(leafInfo);
|
|
73
|
+
if (concrete.length > 0) { // a boolean/enum offers its values to Tab
|
|
74
|
+
return { completions: concrete.map(v => `${leaf}=${v}`) };
|
|
66
75
|
}
|
|
67
|
-
|
|
68
|
-
return {
|
|
76
|
+
if (placeholder !== undefined) { // a free type: complete up to `=` and only *show* the `<type>`, never insert it
|
|
77
|
+
return { completions: [`${leaf}=`], hints: [`${leaf}=${placeholder}`] };
|
|
69
78
|
}
|
|
70
79
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
return { completions: [`${leaf}${update ? '=' : ''}`] };
|
|
81
|
+
}
|
|
82
|
+
/** every `.`-separated path the config schema allows, intermediate objects included, for {@link configGlobMatcher} */
|
|
83
|
+
function configPaths() {
|
|
84
|
+
configSchemaDescription ??= config_1.FlowrConfig.Schema.describe();
|
|
85
|
+
return (0, schema_1.descriptionPaths)(configSchemaDescription);
|
|
86
|
+
}
|
|
87
|
+
/** shallower (fewer path segments) first, alphabetical among equally deep paths */
|
|
88
|
+
function sortConfigPaths(paths) {
|
|
89
|
+
return [...paths].sort((a, b) => a.length - b.length || a.join('.').localeCompare(b.join('.')));
|
|
90
|
+
}
|
|
91
|
+
/** matches a config path against a glob, `*` covering one segment and `**` any number (`**.enabled`, `solver.*`) */
|
|
92
|
+
function configGlobMatcher(pattern) {
|
|
93
|
+
const segments = pattern.split('.');
|
|
94
|
+
let regex = '^';
|
|
95
|
+
for (let i = 0; i < segments.length; i++) {
|
|
96
|
+
const last = i === segments.length - 1;
|
|
97
|
+
if (segments[i] === '**') {
|
|
98
|
+
regex += last ? '[^.]+(?:\\.[^.]+)*' : '(?:[^.]+\\.)*';
|
|
77
99
|
}
|
|
78
100
|
else {
|
|
79
|
-
|
|
80
|
-
const value = valueParts[0];
|
|
81
|
-
let current = update;
|
|
82
|
-
for (let i = 0; i < path.length; i++) {
|
|
83
|
-
const key = path[i];
|
|
84
|
-
if (i === path.length - 1) {
|
|
85
|
-
// last part, set the value
|
|
86
|
-
// try to parse as JSON first
|
|
87
|
-
try {
|
|
88
|
-
current[key] = JSON.parse(value);
|
|
89
|
-
}
|
|
90
|
-
catch {
|
|
91
|
-
// fallback to string
|
|
92
|
-
current[key] = value;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
current[key] = {};
|
|
97
|
-
current = current[key];
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return { query: [{ type: 'config', update }]
|
|
101
|
-
};
|
|
101
|
+
regex += segments[i].split('*').map(part => part.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('[^.]*') + (last ? '' : '\\.');
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
const matches = new RegExp(regex + '$');
|
|
105
|
+
return path => matches.test(path.join('.'));
|
|
106
|
+
}
|
|
107
|
+
/** an error message if `path` is not a key of the config schema (naming the first unknown segment and its real siblings), or `undefined` if it is a valid key */
|
|
108
|
+
function unknownConfigKey(path, formatter) {
|
|
109
|
+
configSchemaDescription ??= config_1.FlowrConfig.Schema.describe();
|
|
110
|
+
const unknown = (0, schema_1.firstUnknownSchemaSegment)(configSchemaDescription, path);
|
|
111
|
+
if (unknown === undefined) {
|
|
112
|
+
return undefined; // every segment is a known (or pattern-/free-form-accepted) key
|
|
113
|
+
}
|
|
114
|
+
if (unknown.segment.includes('=')) {
|
|
115
|
+
const full = path.join('.');
|
|
116
|
+
return `To set a value, prefix the key with ${(0, ansi_1.bold)('+', formatter)}: ${(0, ansi_1.bold)('+' + full, formatter)}. Without it ${(0, ansi_1.bold)(full, formatter)} is read as a key to inspect.`;
|
|
117
|
+
}
|
|
118
|
+
const where = unknown.at.length === 0 ? 'the top level' : (0, ansi_1.bold)(unknown.at.join('.'), formatter);
|
|
119
|
+
return `Unknown config key ${(0, ansi_1.bold)(path.join('.'), formatter)}: no ${(0, ansi_1.bold)(unknown.segment, formatter)} at ${where}. Available: ${[...unknown.available].join(', ') || '(none)'}`;
|
|
120
|
+
}
|
|
121
|
+
/** an error message if `value` does not fit the schema type at `path`, or `undefined` if it fits */
|
|
122
|
+
function badConfigValue(path, value, formatter) {
|
|
123
|
+
const info = configSchemaInfo(path);
|
|
124
|
+
const expected = (t) => `${(0, ansi_1.bold)(path.join('.'), formatter)} expects a ${t}, got ${(0, ansi_1.bold)(JSON.stringify(value), formatter)}`;
|
|
125
|
+
if (info.valids && info.valids.length > 0 && !info.valids.includes(value)) {
|
|
126
|
+
return expected(`one of ${info.valids.map(v => JSON.stringify(v)).join(', ')}`);
|
|
127
|
+
}
|
|
128
|
+
if (info.type === 'boolean' && typeof value !== 'boolean') {
|
|
129
|
+
return expected('boolean (true/false)');
|
|
130
|
+
}
|
|
131
|
+
if (info.type === 'number' && typeof value !== 'number') {
|
|
132
|
+
return expected('number');
|
|
133
|
+
}
|
|
134
|
+
if (info.type === 'string' && typeof value !== 'string') {
|
|
135
|
+
return expected('string');
|
|
136
|
+
}
|
|
137
|
+
if (info.type === 'array' && !Array.isArray(value)) {
|
|
138
|
+
return expected('list (e.g. ["a","b"])');
|
|
139
|
+
}
|
|
140
|
+
if (info.type === 'object' && (typeof value !== 'object' || value === null || Array.isArray(value))) {
|
|
141
|
+
return `${(0, ansi_1.bold)(path.join('.'), formatter)} is a config section, not a value to set; set one of its fields instead`;
|
|
142
|
+
}
|
|
143
|
+
return undefined;
|
|
106
144
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const keys = [];
|
|
145
|
+
/** yields each leaf `[path, value]` of a (possibly nested) config update object */
|
|
146
|
+
function* configUpdateLeaves(update, prefix = []) {
|
|
110
147
|
for (const [key, value] of Object.entries(update)) {
|
|
111
|
-
const
|
|
112
|
-
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
113
|
-
|
|
148
|
+
const path = [...prefix, key];
|
|
149
|
+
if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
|
|
150
|
+
yield* configUpdateLeaves(value, path);
|
|
114
151
|
}
|
|
115
152
|
else {
|
|
116
|
-
|
|
153
|
+
yield [path, value];
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* The first schema violation (an unknown key or a wrong-typed value) in a config update, or `undefined` if it is
|
|
159
|
+
* valid. Shared by the repl line parser and the {@link executeConfigQuery|executor}, so a programmatic or JSON-API
|
|
160
|
+
* update is validated exactly like a `:config +key=value` line and never merges junk or a mistyped value.
|
|
161
|
+
*/
|
|
162
|
+
function validateConfigUpdate(update, formatter = ansi_1.voidFormatter) {
|
|
163
|
+
for (const [path, value] of configUpdateLeaves(update)) {
|
|
164
|
+
const err = unknownConfigKey(path, formatter) ?? badConfigValue(path, value, formatter);
|
|
165
|
+
if (err !== undefined) {
|
|
166
|
+
return err;
|
|
117
167
|
}
|
|
118
168
|
}
|
|
119
|
-
return
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
171
|
+
function configQueryLineParser(output, line, _config) {
|
|
172
|
+
const first = line[0] ?? '';
|
|
173
|
+
if (first === '+reset') {
|
|
174
|
+
return { query: [{ type: 'config', reset: true }] };
|
|
175
|
+
}
|
|
176
|
+
if (first.startsWith('+')) {
|
|
177
|
+
const [pathPart, ...valueParts] = first.slice(1).split('=');
|
|
178
|
+
// build the update object
|
|
179
|
+
const path = pathPart.split('.').filter(p => p.length > 0);
|
|
180
|
+
if (path.length === 0 || valueParts.length !== 1) {
|
|
181
|
+
return configError(output, `Invalid config update syntax, must be of the form ${(0, ansi_1.bold)('+path.to.field=value', output.formatter)}`);
|
|
182
|
+
}
|
|
183
|
+
const raw = valueParts[0];
|
|
184
|
+
let value;
|
|
185
|
+
try {
|
|
186
|
+
value = JSON.parse(raw); // numbers, booleans, arrays, ...
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
try {
|
|
190
|
+
value = JSON.parse(raw.replace(/'([^']*)'/g, (_, s) => JSON.stringify(s))); // allow 'single' quotes too
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
value = raw; // fall back to a plain string
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const update = path.reduceRight((acc, key) => ({ [key]: acc }), value);
|
|
197
|
+
const err = validateConfigUpdate(update, output.formatter);
|
|
198
|
+
return err !== undefined ? configError(output, err) : { query: [{ type: 'config', update }] };
|
|
199
|
+
}
|
|
200
|
+
// a plain path inspects that part; an empty suffix dumps the whole config
|
|
201
|
+
const path = first.split('.').filter(p => p.length > 0);
|
|
202
|
+
if (path.length === 0) {
|
|
203
|
+
return { query: [{ type: 'config' }] };
|
|
204
|
+
}
|
|
205
|
+
if (first.includes('*')) {
|
|
206
|
+
// a glob reads several keys at once (inspection only, setting stays a single explicit key)
|
|
207
|
+
const matches = configGlobMatcher(first);
|
|
208
|
+
const found = sortConfigPaths(configPaths().filter(matches));
|
|
209
|
+
return found.length === 0
|
|
210
|
+
? configError(output, `No config key matches ${(0, ansi_1.bold)(first, output.formatter)}`)
|
|
211
|
+
: { query: found.map(p => ({ type: 'config', inspect: p })) };
|
|
212
|
+
}
|
|
213
|
+
const unknown = unknownConfigKey(path, output.formatter);
|
|
214
|
+
return unknown !== undefined ? configError(output, unknown) : { query: [{ type: 'config', inspect: path }] };
|
|
215
|
+
}
|
|
216
|
+
/** report a parse/validation error for the line and produce no query, so nothing runs and the config is not dumped */
|
|
217
|
+
function configError(output, message) {
|
|
218
|
+
output.stdout(message);
|
|
219
|
+
return { query: undefined };
|
|
220
|
+
}
|
|
221
|
+
/** the dotted leaf keys of a (possibly nested) config update object */
|
|
222
|
+
function collectKeysFromUpdate(update) {
|
|
223
|
+
return [...configUpdateLeaves(update)].map(([path]) => path.join('.'));
|
|
120
224
|
}
|
|
121
225
|
function getValueAtPath(obj, path) {
|
|
122
226
|
let current = obj;
|
|
@@ -131,51 +235,106 @@ function getValueAtPath(obj, path) {
|
|
|
131
235
|
return current;
|
|
132
236
|
}
|
|
133
237
|
let configSchemaDescription;
|
|
134
|
-
/** the
|
|
238
|
+
/** the keys the schema offers below a path, including the unset optional ones */
|
|
239
|
+
function configSchemaKeys(path) {
|
|
240
|
+
configSchemaDescription ??= config_1.FlowrConfig.Schema.describe();
|
|
241
|
+
return (0, schema_1.descriptionPathKeys)(configSchemaDescription, path);
|
|
242
|
+
}
|
|
243
|
+
/** the Joi-schema type + description of a config path (from {@link FlowrConfig.Schema}), used to document a key inspection */
|
|
135
244
|
function configSchemaInfo(path) {
|
|
136
245
|
configSchemaDescription ??= config_1.FlowrConfig.Schema.describe();
|
|
137
246
|
return (0, schema_1.descriptionPathInfo)(configSchemaDescription, path);
|
|
138
247
|
}
|
|
139
|
-
/** value completions for a config leaf:
|
|
248
|
+
/** value completions for a config leaf: booleans, an enum's members (offered bare, like `true`/`false`), or a compact `<type>` hint */
|
|
140
249
|
function configValueHints(info) {
|
|
141
250
|
if (info.type === 'boolean') {
|
|
142
251
|
return ['true', 'false'];
|
|
143
252
|
}
|
|
144
253
|
if (info.valids && info.valids.length > 0) {
|
|
145
|
-
|
|
254
|
+
// a string enum completes as its bare member (like a boolean); non-strings keep their JSON form
|
|
255
|
+
return info.valids.map(v => typeof v === 'string' ? v : JSON.stringify(v));
|
|
146
256
|
}
|
|
147
257
|
return info.type ? [`<${info.type}>`] : [];
|
|
148
258
|
}
|
|
259
|
+
/** the leaf's `concrete` completable values (booleans/enum members) vs a `<type>` `placeholder` that is only shown, never inserted */
|
|
260
|
+
function splitValueHints(info) {
|
|
261
|
+
const hints = configValueHints(info);
|
|
262
|
+
return { concrete: hints.filter(v => !v.startsWith('<')), placeholder: hints.find(v => v.startsWith('<')) };
|
|
263
|
+
}
|
|
264
|
+
/** children of an inspected object listed before the rest is summarized */
|
|
265
|
+
const MaxInspectedChildren = 15;
|
|
266
|
+
/** the longest a child's value may get before only its size is shown */
|
|
267
|
+
const MaxInspectedValueWidth = 48;
|
|
268
|
+
/** a nested object is only summarized, inspecting it directly unfolds it */
|
|
269
|
+
function compactValue(value) {
|
|
270
|
+
const json = JSON.stringify(value, json_1.jsonReplacer);
|
|
271
|
+
if (value === null || typeof value !== 'object' || json.length <= MaxInspectedValueWidth) {
|
|
272
|
+
return json;
|
|
273
|
+
}
|
|
274
|
+
const keys = Array.isArray(value) ? value.length : Object.keys(value).length;
|
|
275
|
+
return Array.isArray(value) ? `[${keys} entries]` : `{${keys} keys}`;
|
|
276
|
+
}
|
|
277
|
+
/** an object reads better as its children than as one json blob */
|
|
278
|
+
function inspectedChildren(value, path, formatter) {
|
|
279
|
+
const entries = Object.entries(value);
|
|
280
|
+
const shown = entries.slice(0, MaxInspectedChildren);
|
|
281
|
+
const longest = Math.max(...shown.map(([key]) => key.length));
|
|
282
|
+
const lines = shown.map(([key, child]) => {
|
|
283
|
+
const type = configSchemaInfo([...path, key]).type;
|
|
284
|
+
return ` - ${(key + ':').padEnd(longest + 1)} ${compactValue(child)}`
|
|
285
|
+
+ (type ? ` ${(0, ansi_1.italic)(`(${type})`, formatter)}` : '');
|
|
286
|
+
});
|
|
287
|
+
if (entries.length > shown.length) {
|
|
288
|
+
lines.push(` ${(0, ansi_1.italic)(`... and ${entries.length - shown.length} more, inspect them with ${path.join('.')}.<key>`, formatter)}`);
|
|
289
|
+
}
|
|
290
|
+
return lines;
|
|
291
|
+
}
|
|
149
292
|
exports.ConfigQueryDefinition = {
|
|
293
|
+
title: 'Config Query',
|
|
294
|
+
syntax: '@config [<path> | <glob>] | @config +<path>=<value> | @config +reset',
|
|
150
295
|
executor: config_query_executor_1.executeConfigQuery,
|
|
151
296
|
asciiSummarizer: (formatter, _analyzer, queryResults, result, queries) => {
|
|
152
297
|
const out = queryResults;
|
|
153
298
|
result.push(`Query: ${(0, ansi_1.bold)('config', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
|
|
154
299
|
const configQueries = queries.filter(q => q.type === 'config');
|
|
155
300
|
const inspects = configQueries.filter(q => q.inspect).map(q => q.inspect);
|
|
156
|
-
if (configQueries.some(q => q.
|
|
301
|
+
if (configQueries.some(q => q.reset)) {
|
|
302
|
+
result.push(' ╰ Configuration reset to the analyzer\'s base config');
|
|
303
|
+
}
|
|
304
|
+
else if (configQueries.some(q => q.update)) {
|
|
157
305
|
const updatedKeys = configQueries.flatMap(q => q.update ? collectKeysFromUpdate(q.update) : []);
|
|
158
306
|
result.push(' ╰ Updated configuration:');
|
|
159
307
|
for (const key of updatedKeys) {
|
|
160
308
|
const path = key.split('.');
|
|
161
309
|
const newValue = getValueAtPath(out.config, path);
|
|
162
|
-
result.push(` - ${key}
|
|
310
|
+
result.push(` - ${key}=${JSON.stringify(newValue, json_1.jsonReplacer)}`);
|
|
163
311
|
}
|
|
164
312
|
}
|
|
165
313
|
else if (inspects.length > 0) {
|
|
166
314
|
result.push(' ╰ Config:');
|
|
167
315
|
for (const path of inspects) {
|
|
168
316
|
const info = configSchemaInfo(path);
|
|
169
|
-
const value =
|
|
170
|
-
|
|
317
|
+
const value = getValueAtPath(out.config, [...path]);
|
|
318
|
+
const type = info.type ? ` ${(0, ansi_1.italic)(`(${info.type})`, formatter)}` : '';
|
|
319
|
+
const children = value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
320
|
+
? inspectedChildren(value, path, formatter) : undefined;
|
|
321
|
+
result.push(` - ${path.join('.')}${type}${children ? '' : `: ${JSON.stringify(value, json_1.jsonReplacer)}`}`);
|
|
171
322
|
if (info.description) {
|
|
172
323
|
result.push(` ${(0, ansi_1.italic)(info.description, formatter)}`);
|
|
173
324
|
}
|
|
325
|
+
result.push(...children ?? []);
|
|
174
326
|
}
|
|
175
327
|
}
|
|
176
328
|
else {
|
|
177
329
|
result.push(` ╰ Config:\n${JSON.stringify(out.config, json_1.jsonReplacer, 4)}`);
|
|
178
330
|
}
|
|
331
|
+
if (out.specialization) {
|
|
332
|
+
const keys = collectKeysFromUpdate(out.specialization.overwrite);
|
|
333
|
+
result.push(` ╰ Specialized for project kind ${(0, ansi_1.bold)(out.specialization.kind, formatter)} (overrides ${keys.join(', ') || '(nothing)'})`);
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
result.push(` ╰ ${(0, ansi_1.italic)('No project-kind specialization in effect', formatter)}`);
|
|
337
|
+
}
|
|
179
338
|
return true;
|
|
180
339
|
},
|
|
181
340
|
completer: configReplCompleter,
|
|
@@ -183,7 +342,8 @@ exports.ConfigQueryDefinition = {
|
|
|
183
342
|
schema: joi_1.default.object({
|
|
184
343
|
type: joi_1.default.string().valid('config').required().description('The type of the query.'),
|
|
185
344
|
update: joi_1.default.object().optional().description('An optional partial configuration to update the current configuration with before returning it. Only the provided fields will be updated, all other fields will remain unchanged.'),
|
|
186
|
-
inspect: joi_1.default.array().items(joi_1.default.string()).optional().description('An optional `.`-separated path (as a string array) to read a single configuration value instead of returning the whole configuration.')
|
|
345
|
+
inspect: joi_1.default.array().items(joi_1.default.string()).optional().description('An optional `.`-separated path (as a string array) to read a single configuration value instead of returning the whole configuration.'),
|
|
346
|
+
reset: joi_1.default.boolean().optional().description('If true, discard every prior update and revert to the config the analyzer was created with, before returning it.')
|
|
187
347
|
}).description('The config query retrieves the current configuration of the flowR instance and optionally also updates it.'),
|
|
188
348
|
flattenInvolvedNodes: () => []
|
|
189
349
|
};
|
|
@@ -21,6 +21,7 @@ export interface ControlFlowQueryResult extends BaseQueryResult {
|
|
|
21
21
|
readonly controlFlow: ControlFlowInformation;
|
|
22
22
|
}
|
|
23
23
|
export declare const ControlFlowQueryDefinition: {
|
|
24
|
+
readonly title: "Control-Flow Query";
|
|
24
25
|
readonly executor: typeof executeControlFlowQuery;
|
|
25
26
|
readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, analyzer: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
|
|
26
27
|
readonly schema: Joi.ObjectSchema<any>;
|
|
@@ -11,6 +11,7 @@ const control_flow_graph_1 = require("../../../control-flow/control-flow-graph")
|
|
|
11
11
|
const cfg_1 = require("../../../util/mermaid/cfg");
|
|
12
12
|
const cfg_simplification_1 = require("../../../control-flow/cfg-simplification");
|
|
13
13
|
exports.ControlFlowQueryDefinition = {
|
|
14
|
+
title: 'Control-Flow Query',
|
|
14
15
|
executor: control_flow_query_executor_1.executeControlFlowQuery,
|
|
15
16
|
asciiSummarizer: async (formatter, analyzer, queryResults, result) => {
|
|
16
17
|
const out = queryResults;
|
|
@@ -13,6 +13,7 @@ export interface DataflowLensQueryResult extends BaseQueryResult {
|
|
|
13
13
|
readonly simplifiedGraph: DataflowGraph;
|
|
14
14
|
}
|
|
15
15
|
export declare const DataflowLensQueryDefinition: {
|
|
16
|
+
readonly title: "Dataflow Lens Query";
|
|
16
17
|
readonly executor: typeof executeDataflowLensQuery;
|
|
17
18
|
readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
18
19
|
readonly schema: Joi.ObjectSchema<any>;
|
|
@@ -10,6 +10,7 @@ const time_1 = require("../../../util/text/time");
|
|
|
10
10
|
const joi_1 = __importDefault(require("joi"));
|
|
11
11
|
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
12
12
|
exports.DataflowLensQueryDefinition = {
|
|
13
|
+
title: 'Dataflow Lens Query',
|
|
13
14
|
executor: dataflow_lens_query_executor_1.executeDataflowLensQuery,
|
|
14
15
|
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
15
16
|
const out = queryResults;
|
|
@@ -14,6 +14,7 @@ export interface DataflowQueryResult extends BaseQueryResult {
|
|
|
14
14
|
readonly graph: DataflowGraph;
|
|
15
15
|
}
|
|
16
16
|
export declare const DataflowQueryDefinition: {
|
|
17
|
+
readonly title: "Dataflow Query";
|
|
17
18
|
readonly executor: typeof executeDataflowQuery;
|
|
18
19
|
readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
19
20
|
readonly schema: Joi.ObjectSchema<any>;
|
|
@@ -12,6 +12,7 @@ const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
|
12
12
|
/** Above this many characters, the mermaid.live link is dropped from the REPL output (large graphs produce megabyte-sized base64 urls). */
|
|
13
13
|
const MaxMermaidUrlLength = 8000;
|
|
14
14
|
exports.DataflowQueryDefinition = {
|
|
15
|
+
title: 'Dataflow Query',
|
|
15
16
|
executor: dataflow_query_executor_1.executeDataflowQuery,
|
|
16
17
|
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
17
18
|
const out = queryResults;
|
|
@@ -5,7 +5,7 @@ const query_1 = require("../../query");
|
|
|
5
5
|
const dependencies_query_format_1 = require("./dependencies-query-format");
|
|
6
6
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
7
7
|
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
8
|
-
const
|
|
8
|
+
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
9
9
|
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
10
10
|
const objects_1 = require("../../../util/objects");
|
|
11
11
|
const function_info_1 = require("./function-info/function-info");
|
|
@@ -103,12 +103,7 @@ function getResults(queries, { dataflow, config, normalize }, results, kind, fun
|
|
|
103
103
|
for (const { id, linkedIds } of results) {
|
|
104
104
|
const vertex = dfg.getVertex(id);
|
|
105
105
|
const info = functionMap.get(name);
|
|
106
|
-
|
|
107
|
-
// falling back to the plain called name when the call does not resolve to a loaded package
|
|
108
|
-
const functionName = identifier_1.Identifier.toQualified((0, dfg_get_origin_1.getOriginInDfg)(dfg, id)) ?? vertex.name;
|
|
109
|
-
// a call qualified to (or resolved via a loaded library to) a different package than the
|
|
110
|
-
// function's is not this function - e.g. purrr::map, or a bare map() after library(purrr),
|
|
111
|
-
// is not the maps `map` plot; bare/matching-namespace calls still count.
|
|
106
|
+
const functionName = df_helper_1.Dataflow.qualify(id, dfg, false) ?? vertex.name;
|
|
112
107
|
if (info.package !== undefined) {
|
|
113
108
|
const callNamespace = identifier_1.Identifier.getNamespace(functionName);
|
|
114
109
|
if (callNamespace !== undefined && callNamespace !== info.package) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BaseQueryFormat, BaseQueryResult, BasicQueryData } from '../../base-query-format';
|
|
2
2
|
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
3
|
+
import { type OutputFormatter } from '../../../util/text/ansi';
|
|
3
4
|
import Joi from 'joi';
|
|
4
5
|
import { executeDependenciesQuery } from './dependencies-query-executor';
|
|
5
6
|
import type { FunctionInfo } from './function-info/function-info';
|
|
@@ -55,6 +56,16 @@ export declare const DefaultDependencyCategories: {
|
|
|
55
56
|
readonly queryDisplayName: "Tests";
|
|
56
57
|
readonly functions: FunctionInfo[];
|
|
57
58
|
};
|
|
59
|
+
readonly undeclared: {
|
|
60
|
+
readonly queryDisplayName: "Undeclared Dependencies";
|
|
61
|
+
readonly functions: [];
|
|
62
|
+
readonly additionalAnalysis: (data: BasicQueryData, ignoreDefault: boolean, _functions: FunctionInfo[], _queryResults: CallContextQueryResult, result: DependencyInfo[]) => Promise<void>;
|
|
63
|
+
};
|
|
64
|
+
readonly unused: {
|
|
65
|
+
readonly queryDisplayName: "Unused Dependencies";
|
|
66
|
+
readonly functions: [];
|
|
67
|
+
readonly additionalAnalysis: (data: BasicQueryData, ignoreDefault: boolean, _functions: FunctionInfo[], _queryResults: CallContextQueryResult, result: DependencyInfo[]) => Promise<void>;
|
|
68
|
+
};
|
|
58
69
|
};
|
|
59
70
|
export type DefaultDependencyCategoryName = keyof typeof DefaultDependencyCategories;
|
|
60
71
|
export type DependencyCategoryName = DefaultDependencyCategoryName | string;
|
|
@@ -87,8 +98,9 @@ export interface DependencyInfo extends Record<string, unknown> {
|
|
|
87
98
|
*/
|
|
88
99
|
export declare function getAllCategories(queries: readonly DependenciesQuery[]): Record<DependencyCategoryName, DependencyCategorySettings>;
|
|
89
100
|
export declare const DependenciesQueryDefinition: {
|
|
101
|
+
readonly title: "Dependencies Query";
|
|
90
102
|
readonly executor: typeof executeDependenciesQuery;
|
|
91
|
-
readonly asciiSummarizer: (formatter:
|
|
103
|
+
readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[], queries: readonly import("../../query").Query[]) => true;
|
|
92
104
|
readonly schema: Joi.ObjectSchema<any>;
|
|
93
105
|
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult, query: readonly import("../../query").Query[]) => NodeId[];
|
|
94
106
|
};
|