@eagleoutice/flowr 2.0.25 → 2.1.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/benchmark/slicer.js +2 -1
- package/benchmark/stats/print.js +3 -4
- package/benchmark/stats/size-of.js +9 -7
- package/benchmark/summarizer/first-phase/input.d.ts +0 -1
- package/benchmark/summarizer/first-phase/input.js +2 -3
- package/benchmark/summarizer/first-phase/process.js +7 -7
- package/benchmark/summarizer/second-phase/graph.js +1 -2
- package/benchmark/summarizer/second-phase/process.d.ts +0 -1
- package/benchmark/summarizer/second-phase/process.js +4 -5
- package/benchmark/summarizer/summarizer.js +7 -1
- package/cli/benchmark-app.js +6 -1
- package/cli/common/features.js +2 -3
- package/cli/common/script.js +2 -3
- package/cli/common/scripts-info.d.ts +69 -1
- package/cli/common/scripts-info.js +6 -6
- package/cli/flowr-main-options.d.ts +4 -0
- package/cli/flowr-main-options.js +88 -0
- package/cli/flowr.d.ts +3 -3
- package/cli/flowr.js +22 -31
- package/cli/repl/commands/{cfg.d.ts → repl-cfg.d.ts} +1 -1
- package/cli/repl/commands/{cfg.js → repl-cfg.js} +3 -3
- package/cli/repl/commands/{commands.d.ts → repl-commands.d.ts} +3 -1
- package/cli/repl/commands/{commands.js → repl-commands.js} +56 -35
- package/cli/repl/commands/{dataflow.d.ts → repl-dataflow.d.ts} +1 -1
- package/cli/repl/commands/{dataflow.js → repl-dataflow.js} +2 -2
- package/cli/repl/commands/{execute.d.ts → repl-execute.d.ts} +1 -1
- package/cli/repl/commands/{execute.js → repl-execute.js} +3 -3
- package/cli/repl/commands/repl-lineage.d.ts +15 -0
- package/cli/repl/commands/{lineage.js → repl-lineage.js} +14 -12
- package/cli/repl/commands/{main.js → repl-main.js} +1 -1
- package/cli/repl/commands/{normalize.d.ts → repl-normalize.d.ts} +1 -1
- package/cli/repl/commands/{normalize.js → repl-normalize.js} +3 -3
- package/cli/repl/commands/{parse.d.ts → repl-parse.d.ts} +1 -1
- package/cli/repl/commands/{parse.js → repl-parse.js} +3 -2
- package/cli/repl/commands/repl-query.d.ts +8 -0
- package/cli/repl/commands/repl-query.js +155 -0
- package/cli/repl/commands/repl-quit.d.ts +2 -0
- package/cli/repl/commands/{quit.js → repl-quit.js} +1 -1
- package/cli/repl/commands/{version.d.ts → repl-version.d.ts} +1 -1
- package/cli/repl/commands/{version.js → repl-version.js} +4 -4
- package/cli/repl/core.d.ts +1 -2
- package/cli/repl/core.js +13 -13
- package/cli/repl/execute.d.ts +1 -2
- package/cli/repl/execute.js +2 -3
- package/cli/repl/print-version.js +3 -4
- package/cli/repl/server/connection.d.ts +1 -0
- package/cli/repl/server/connection.js +45 -12
- package/cli/repl/server/messages/{messages.d.ts → all-messages.d.ts} +8 -7
- package/cli/repl/server/messages/{messages.js → all-messages.js} +1 -1
- package/cli/repl/server/messages/{analysis.d.ts → message-analysis.d.ts} +2 -1
- package/cli/repl/server/messages/message-analysis.js +39 -0
- package/cli/repl/server/messages/{error.d.ts → message-error.d.ts} +1 -1
- package/cli/repl/server/messages/{error.js → message-error.js} +1 -1
- package/cli/repl/server/messages/{hello.d.ts → message-hello.d.ts} +4 -3
- package/cli/repl/server/messages/message-hello.js +20 -0
- package/cli/repl/server/messages/{lineage.d.ts → message-lineage.d.ts} +2 -1
- package/cli/repl/server/messages/message-lineage.js +25 -0
- package/cli/repl/server/messages/message-query.d.ts +16 -0
- package/cli/repl/server/messages/message-query.js +26 -0
- package/cli/repl/server/messages/{repl.d.ts → message-repl.d.ts} +3 -1
- package/cli/repl/server/messages/message-repl.js +53 -0
- package/cli/repl/server/messages/{slice.d.ts → message-slice.d.ts} +2 -1
- package/cli/repl/server/messages/{slice.js → message-slice.js} +14 -6
- package/cli/repl/server/net.d.ts +0 -1
- package/cli/repl/server/send.d.ts +1 -1
- package/cli/repl/server/send.js +2 -3
- package/cli/repl/server/server.js +2 -2
- package/cli/repl/server/validate.d.ts +1 -1
- package/cli/repl/server/validate.js +5 -6
- package/cli/run-script.d.ts +8 -0
- package/cli/run-script.js +18 -0
- package/cli/script-core/statistics-core.d.ts +2 -0
- package/cli/script-core/statistics-core.js +100 -0
- package/cli/script-core/statistics-helper-core.d.ts +2 -0
- package/cli/script-core/statistics-helper-core.js +81 -0
- package/cli/script-core/summarizer-core.d.ts +2 -0
- package/cli/script-core/summarizer-core.js +51 -0
- package/cli/statistics-app.js +3 -87
- package/cli/statistics-helper-app.js +3 -77
- package/cli/summarizer-app.js +2 -48
- package/config.d.ts +20 -4
- package/config.js +62 -36
- package/core/pipeline-executor.js +11 -1
- package/core/print/dataflow-printer.js +4 -5
- package/core/print/normalize-printer.js +4 -5
- package/core/print/parse-printer.js +1 -2
- package/core/print/print.js +2 -3
- package/core/print/slice-diff-ansi.js +1 -2
- package/core/steps/pipeline/create-pipeline.js +1 -2
- package/core/steps/pipeline/default-pipelines.d.ts +18 -18
- package/core/steps/pipeline/pipeline.js +1 -2
- package/dataflow/environments/append.js +1 -2
- package/dataflow/environments/built-in-config.d.ts +47 -0
- package/dataflow/environments/built-in-config.js +83 -0
- package/dataflow/environments/built-in.d.ts +49 -6
- package/dataflow/environments/built-in.js +29 -97
- package/dataflow/environments/clone.js +2 -2
- package/dataflow/environments/default-builtin-config.d.ts +5 -0
- package/dataflow/environments/default-builtin-config.js +83 -0
- package/dataflow/environments/define.js +1 -2
- package/dataflow/environments/diff.js +5 -6
- package/dataflow/environments/environment.js +8 -7
- package/dataflow/environments/identifier.d.ts +39 -8
- package/dataflow/environments/identifier.js +33 -0
- package/dataflow/environments/overwrite.d.ts +6 -5
- package/dataflow/environments/overwrite.js +16 -9
- package/dataflow/environments/resolve-by-name.d.ts +3 -1
- package/dataflow/environments/resolve-by-name.js +40 -8
- package/dataflow/environments/scoping.js +2 -3
- package/dataflow/extractor.js +25 -24
- package/dataflow/graph/dataflowgraph-builder.d.ts +139 -0
- package/dataflow/graph/dataflowgraph-builder.js +247 -0
- package/dataflow/graph/diff.js +12 -11
- package/dataflow/graph/edge.d.ts +2 -2
- package/dataflow/graph/edge.js +46 -20
- package/dataflow/graph/graph.d.ts +14 -6
- package/dataflow/graph/graph.js +25 -21
- package/dataflow/graph/quads.js +1 -2
- package/dataflow/graph/resolve-graph.d.ts +7 -0
- package/dataflow/graph/resolve-graph.js +51 -0
- package/dataflow/graph/vertex.d.ts +12 -4
- package/dataflow/graph/vertex.js +19 -11
- package/dataflow/info.d.ts +3 -7
- package/dataflow/info.js +7 -8
- package/dataflow/internal/linker.d.ts +3 -1
- package/dataflow/internal/linker.js +77 -32
- package/dataflow/internal/process/functions/call/argument/make-argument.js +5 -5
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +10 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +27 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +40 -26
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +30 -20
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +10 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +12 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +10 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +7 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +6 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +6 -5
- package/dataflow/internal/process/functions/call/common.js +30 -19
- package/dataflow/internal/process/functions/call/default-call-handling.js +1 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +8 -6
- package/dataflow/internal/process/functions/call/named-call-handling.js +7 -6
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +11 -7
- package/dataflow/internal/process/functions/process-argument.js +10 -8
- package/dataflow/internal/process/functions/process-parameter.js +8 -6
- package/dataflow/internal/process/process-named-call.js +3 -3
- package/dataflow/internal/process/process-symbol.js +5 -4
- package/dataflow/internal/process/process-uninteresting-leaf.js +1 -2
- package/dataflow/internal/process/process-value.js +5 -4
- package/dataflow/processor.js +1 -2
- package/documentation/data/dfg/doc-data-dfg-util.d.ts +20 -0
- package/documentation/data/dfg/doc-data-dfg-util.js +13 -0
- package/documentation/data/query/example-query-code.d.ts +1 -0
- package/documentation/data/query/example-query-code.js +25 -0
- package/documentation/data/server/doc-data-server-messages.d.ts +1 -0
- package/documentation/data/server/doc-data-server-messages.js +508 -0
- package/documentation/doc-util/doc-auto-gen.d.ts +7 -0
- package/documentation/doc-util/doc-auto-gen.js +9 -0
- package/documentation/doc-util/doc-cfg.d.ts +7 -0
- package/documentation/doc-util/doc-cfg.js +18 -0
- package/documentation/doc-util/doc-cli-option.d.ts +8 -0
- package/documentation/doc-util/doc-cli-option.js +36 -0
- package/documentation/doc-util/doc-code.d.ts +1 -0
- package/documentation/doc-util/doc-code.js +7 -0
- package/documentation/doc-util/doc-dfg.d.ts +21 -0
- package/documentation/doc-util/doc-dfg.js +93 -0
- package/documentation/doc-util/doc-docker.d.ts +1 -0
- package/documentation/doc-util/doc-docker.js +5 -0
- package/documentation/doc-util/doc-env.d.ts +2 -0
- package/documentation/doc-util/doc-env.js +20 -0
- package/documentation/doc-util/doc-files.d.ts +6 -0
- package/documentation/doc-util/doc-files.js +25 -0
- package/documentation/doc-util/doc-general.d.ts +2 -0
- package/documentation/doc-util/doc-general.js +16 -0
- package/documentation/doc-util/doc-hover-over.d.ts +1 -0
- package/documentation/doc-util/doc-hover-over.js +7 -0
- package/documentation/doc-util/doc-issue.d.ts +1 -0
- package/documentation/doc-util/doc-issue.js +6 -0
- package/documentation/doc-util/doc-ms.d.ts +1 -0
- package/documentation/doc-util/doc-ms.js +8 -0
- package/documentation/doc-util/doc-normalized-ast.d.ts +11 -0
- package/documentation/doc-util/doc-normalized-ast.js +71 -0
- package/documentation/doc-util/doc-query.d.ts +24 -0
- package/documentation/doc-util/doc-query.js +113 -0
- package/documentation/doc-util/doc-repl.d.ts +13 -0
- package/documentation/doc-util/doc-repl.js +79 -0
- package/documentation/doc-util/doc-server-message.d.ts +37 -0
- package/documentation/doc-util/doc-server-message.js +153 -0
- package/documentation/doc-util/doc-structure.d.ts +12 -0
- package/documentation/doc-util/doc-structure.js +21 -0
- package/documentation/doc-util/doc-types.d.ts +38 -0
- package/documentation/doc-util/doc-types.js +276 -0
- package/{r-bridge/data/print.js → documentation/print-capabilities-markdown.js} +8 -4
- package/documentation/print-dataflow-graph-wiki.d.ts +1 -0
- package/documentation/print-dataflow-graph-wiki.js +849 -0
- package/documentation/print-interface-wiki.d.ts +1 -0
- package/documentation/print-interface-wiki.js +401 -0
- package/documentation/print-normalized-ast-wiki.d.ts +1 -0
- package/documentation/print-normalized-ast-wiki.js +98 -0
- package/documentation/print-query-wiki.d.ts +1 -0
- package/documentation/print-query-wiki.js +215 -0
- package/package.json +29 -33
- package/queries/base-query-format.d.ts +11 -0
- package/{cli/repl/server/messages/hello.js → queries/base-query-format.js} +1 -1
- package/queries/call-context-query/call-context-query-executor.d.ts +11 -0
- package/queries/call-context-query/call-context-query-executor.js +255 -0
- package/queries/call-context-query/call-context-query-format.d.ts +72 -0
- package/queries/call-context-query/call-context-query-format.js +17 -0
- package/queries/query-schema.d.ts +7 -0
- package/queries/query-schema.js +31 -0
- package/queries/query.d.ts +35 -0
- package/queries/query.js +57 -0
- package/queries/two-layer-collector.d.ts +8 -0
- package/queries/two-layer-collector.js +31 -0
- package/queries/virtual-query/compound-query.d.ts +24 -0
- package/queries/virtual-query/compound-query.js +18 -0
- package/queries/virtual-query/virtual-queries.d.ts +15 -0
- package/queries/virtual-query/virtual-queries.js +8 -0
- package/r-bridge/data/data.d.ts +5 -0
- package/r-bridge/data/data.js +6 -0
- package/r-bridge/data/get.js +2 -3
- package/r-bridge/init.js +2 -2
- package/r-bridge/lang-4.x/ast/model/collect.js +1 -2
- package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +10 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/operators.js +27 -26
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +9 -9
- package/r-bridge/lang-4.x/ast/model/processing/fold.js +1 -2
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +26 -3
- package/r-bridge/lang-4.x/ast/model/processing/role.js +1 -2
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.js +23 -23
- package/r-bridge/lang-4.x/ast/model/processing/visitor.js +23 -23
- package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/type.js +221 -12
- package/r-bridge/lang-4.x/ast/parser/json/format.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +6 -5
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/normalize-if-then-else.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/normalize-if-then.js +7 -7
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/normalize-expression.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-argument.js +10 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-call.js +18 -18
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-definition.js +8 -8
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-parameter.js +9 -9
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-break.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-for.js +10 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-next.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-repeat.js +5 -5
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-while.js +7 -7
- package/r-bridge/lang-4.x/ast/parser/xml/internal/normalize-access.js +12 -12
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/normalize-binary.js +14 -14
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/normalize-unary.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/normalize-comment.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/normalize-line-directive.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-delimiter.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-expressions.js +13 -13
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-root.js +6 -6
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-single-node.js +19 -19
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-number.js +5 -5
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-string.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-symbol.js +2 -3
- package/r-bridge/lang-4.x/ast/parser/xml/normalize-meta.js +12 -12
- package/r-bridge/lang-4.x/convert-values.js +7 -7
- package/r-bridge/retriever.js +12 -11
- package/r-bridge/shell.d.ts +0 -1
- package/r-bridge/shell.js +6 -1
- package/reconstruct/auto-select/auto-select-defaults.js +1 -2
- package/reconstruct/auto-select/magic-comments.js +3 -3
- package/reconstruct/reconstruct.js +4 -3
- package/slicing/criterion/collect-all.js +1 -2
- package/slicing/criterion/parse.d.ts +1 -1
- package/slicing/criterion/parse.js +6 -5
- package/slicing/static/fingerprint.js +2 -3
- package/slicing/static/slice-call.js +9 -9
- package/slicing/static/static-slicer.js +5 -4
- package/statistics/features/common-syntax-probability.js +13 -13
- package/statistics/features/feature.d.ts +5 -9
- package/statistics/features/feature.js +2 -2
- package/statistics/features/post-processing.js +2 -3
- package/statistics/features/supported/assignments/assignments.js +3 -2
- package/statistics/features/supported/assignments/post-process.js +1 -2
- package/statistics/features/supported/comments/post-process.js +1 -2
- package/statistics/features/supported/control-flow/control-flow.js +4 -3
- package/statistics/features/supported/control-flow/post-process.js +1 -2
- package/statistics/features/supported/data-access/data-access.d.ts +2 -2
- package/statistics/features/supported/data-access/data-access.js +3 -2
- package/statistics/features/supported/data-access/post-process.js +1 -2
- package/statistics/features/supported/defined-functions/defined-functions.js +9 -7
- package/statistics/features/supported/defined-functions/post-process.d.ts +1 -1
- package/statistics/features/supported/defined-functions/post-process.js +2 -3
- package/statistics/features/supported/expression-list/post-process.js +1 -2
- package/statistics/features/supported/expression-list/{expression-list.js → statistics-expression-list.js} +4 -3
- package/statistics/features/supported/loops/loops.js +8 -7
- package/statistics/features/supported/loops/post-process.js +1 -2
- package/statistics/features/supported/used-functions/post-process.js +2 -3
- package/statistics/features/supported/used-functions/used-functions.d.ts +1 -1
- package/statistics/features/supported/used-functions/used-functions.js +4 -3
- package/statistics/features/supported/used-packages/post-process.js +1 -2
- package/statistics/features/supported/values/post-process.js +1 -2
- package/statistics/features/supported/variables/post-process.js +2 -3
- package/statistics/features/supported/variables/variables.js +2 -1
- package/statistics/meta-statistics.js +1 -2
- package/statistics/output/print-stats.js +4 -5
- package/statistics/output/statistics-file.js +5 -5
- package/statistics/statistics.js +2 -3
- package/statistics/summarizer/auto-detect.js +1 -2
- package/statistics/summarizer/post-process/clusterer.js +1 -2
- package/statistics/summarizer/post-process/file-based-count.js +2 -3
- package/statistics/summarizer/post-process/histogram.js +3 -4
- package/statistics/summarizer/post-process/post-process-output.js +2 -3
- package/statistics/summarizer/second-phase/process.d.ts +2 -0
- package/statistics/summarizer/second-phase/process.js +2 -2
- package/statistics/summarizer/summarizer.js +8 -1
- package/util/ansi.d.ts +1 -0
- package/util/ansi.js +27 -4
- package/util/args.js +2 -3
- package/util/arrays.js +8 -9
- package/util/assert.js +5 -6
- package/util/bimap.d.ts +4 -4
- package/util/cfg/cfg.d.ts +1 -0
- package/util/cfg/cfg.js +8 -5
- package/util/cfg/visitor.d.ts +8 -13
- package/util/cfg/visitor.js +22 -56
- package/util/diff.js +1 -2
- package/util/files.d.ts +0 -1
- package/util/files.js +11 -8
- package/util/json.js +2 -3
- package/util/mermaid/ast.js +7 -7
- package/util/mermaid/cfg.js +2 -3
- package/util/mermaid/dfg.d.ts +12 -4
- package/util/mermaid/dfg.js +28 -16
- package/util/mermaid/mermaid.js +5 -4
- package/util/numbers.js +1 -2
- package/util/objects.d.ts +7 -0
- package/util/objects.js +13 -3
- package/util/os.js +1 -2
- package/util/quads.js +5 -5
- package/util/random.js +2 -2
- package/util/range.js +8 -9
- package/util/schema.d.ts +11 -0
- package/util/schema.js +75 -0
- package/util/set.js +2 -3
- package/util/strings.js +3 -4
- package/util/summarizer.js +4 -4
- package/util/text.d.ts +1 -0
- package/util/text.js +20 -0
- package/util/time.js +1 -2
- package/util/version.js +2 -3
- package/cli/repl/commands/lineage.d.ts +0 -15
- package/cli/repl/commands/quit.d.ts +0 -2
- package/cli/repl/server/messages/analysis.js +0 -21
- package/cli/repl/server/messages/lineage.js +0 -17
- package/cli/repl/server/messages/repl.js +0 -37
- /package/cli/repl/commands/{main.d.ts → repl-main.d.ts} +0 -0
- /package/{r-bridge/data/print.d.ts → documentation/print-capabilities-markdown.d.ts} +0 -0
- /package/statistics/features/supported/expression-list/{expression-list.d.ts → statistics-expression-list.d.ts} +0 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryStarCommand = exports.queryCommand = void 0;
|
|
4
|
+
exports.asciiSummaryOfQueryResult = asciiSummaryOfQueryResult;
|
|
5
|
+
const pipeline_executor_1 = require("../../../core/pipeline-executor");
|
|
6
|
+
const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
|
|
7
|
+
const retriever_1 = require("../../../r-bridge/retriever");
|
|
8
|
+
const args_1 = require("../../../util/args");
|
|
9
|
+
const ansi_1 = require("../../../util/ansi");
|
|
10
|
+
const schema_1 = require("../../../util/schema");
|
|
11
|
+
const query_1 = require("../../../queries/query");
|
|
12
|
+
const json_1 = require("../../../util/json");
|
|
13
|
+
const query_schema_1 = require("../../../queries/query-schema");
|
|
14
|
+
const built_in_1 = require("../../../dataflow/environments/built-in");
|
|
15
|
+
async function getDataflow(shell, remainingLine) {
|
|
16
|
+
return await new pipeline_executor_1.PipelineExecutor(default_pipelines_1.DEFAULT_DATAFLOW_PIPELINE, {
|
|
17
|
+
shell,
|
|
18
|
+
request: (0, retriever_1.requestFromInput)(remainingLine.trim())
|
|
19
|
+
}).allRemainingSteps();
|
|
20
|
+
}
|
|
21
|
+
function printHelp(output) {
|
|
22
|
+
output.stderr(`Format: ${(0, ansi_1.italic)(':query "<query>" <code>', output.formatter)}`);
|
|
23
|
+
output.stdout('The query is an array of query objects to represent multiple queries. Each query object may have the following properties:');
|
|
24
|
+
output.stdout((0, schema_1.describeSchema)(query_schema_1.AnyQuerySchema, output.formatter));
|
|
25
|
+
output.stdout(`\n\nThe example ${(0, ansi_1.italic)(':query "[{\\"type\\": \\"call-context\\", \\"callName\\": \\"mean\\" }]" mean(1:10)', output.formatter)} would return the call context of the mean function.`);
|
|
26
|
+
output.stdout('As a convenience, we interpret any (non-help) string not starting with \'[\' as a regex for the simple call-context query.');
|
|
27
|
+
output.stdout(`Hence, ${(0, ansi_1.italic)(':query "mean" mean(1:10)', output.formatter)} is equivalent to the above example.`);
|
|
28
|
+
}
|
|
29
|
+
async function processQueryArgs(line, shell, output) {
|
|
30
|
+
const args = (0, args_1.splitAtEscapeSensitive)(line);
|
|
31
|
+
const query = args.shift();
|
|
32
|
+
if (!query) {
|
|
33
|
+
output.stderr(`No query provided, use ':query help' to get more information.`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (query === 'help') {
|
|
37
|
+
printHelp(output);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
let parsedQuery = [];
|
|
41
|
+
if (query.startsWith('[')) {
|
|
42
|
+
parsedQuery = JSON.parse(query);
|
|
43
|
+
const validationResult = query_schema_1.QueriesSchema.validate(parsedQuery);
|
|
44
|
+
if (validationResult.error) {
|
|
45
|
+
output.stderr(`Invalid query: ${validationResult.error.message}`);
|
|
46
|
+
printHelp(output);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
parsedQuery = [{ type: 'call-context', callName: query }];
|
|
52
|
+
}
|
|
53
|
+
const processed = await getDataflow(shell, args.join(' '));
|
|
54
|
+
return {
|
|
55
|
+
query: (0, query_1.executeQueries)({ graph: processed.dataflow.graph, ast: processed.normalize }, parsedQuery),
|
|
56
|
+
processed
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function nodeString(id, formatter, processed) {
|
|
60
|
+
if (id === built_in_1.BuiltIn) {
|
|
61
|
+
return (0, ansi_1.italic)('built-in', formatter);
|
|
62
|
+
}
|
|
63
|
+
const node = processed.normalize.idMap.get(id);
|
|
64
|
+
if (node === undefined) {
|
|
65
|
+
return `UNKNOWN: ${id}`;
|
|
66
|
+
}
|
|
67
|
+
return `${(0, ansi_1.italic)('`' + (node.lexeme ?? node.info.fullLexeme ?? 'UNKNOWN') + '`', formatter)} (L.${node.location?.[0]})`;
|
|
68
|
+
}
|
|
69
|
+
function asciiCallContextSubHit(formatter, results, processed) {
|
|
70
|
+
const result = [];
|
|
71
|
+
for (const { id, calls = [], linkedIds = [], aliasRoots = [] } of results) {
|
|
72
|
+
const node = processed.normalize.idMap.get(id);
|
|
73
|
+
if (node === undefined) {
|
|
74
|
+
result.push(` ${(0, ansi_1.bold)('UNKNOWN: ' + JSON.stringify({ calls, linkedIds }))}`);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
let line = nodeString(id, formatter, processed);
|
|
78
|
+
if (calls.length > 0) {
|
|
79
|
+
line += ` with ${calls.length} call${calls.length > 1 ? 's' : ''} (${calls.map(c => nodeString(c, formatter, processed)).join(', ')})`;
|
|
80
|
+
}
|
|
81
|
+
if (linkedIds.length > 0) {
|
|
82
|
+
line += ` with ${linkedIds.length} link${linkedIds.length > 1 ? 's' : ''} (${linkedIds.map(c => nodeString(c, formatter, processed)).join(', ')})`;
|
|
83
|
+
}
|
|
84
|
+
if (aliasRoots.length > 0) {
|
|
85
|
+
line += ` with ${aliasRoots.length} alias root${aliasRoots.length > 1 ? 's' : ''} (${aliasRoots.map(c => nodeString(c, formatter, processed)).join(', ')})`;
|
|
86
|
+
}
|
|
87
|
+
result.push(line);
|
|
88
|
+
}
|
|
89
|
+
return result.join(', ');
|
|
90
|
+
}
|
|
91
|
+
function asciiCallContext(formatter, results, processed) {
|
|
92
|
+
/* traverse over 'kinds' and within them 'subkinds' */
|
|
93
|
+
const result = [];
|
|
94
|
+
for (const [kind, { subkinds }] of Object.entries(results['kinds'])) {
|
|
95
|
+
result.push(` ╰ ${(0, ansi_1.bold)(kind, formatter)}`);
|
|
96
|
+
for (const [subkind, values] of Object.entries(subkinds)) {
|
|
97
|
+
result.push(` ╰ ${(0, ansi_1.bold)(subkind, formatter)}: ${asciiCallContextSubHit(formatter, values, processed)}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return result.join('\n');
|
|
101
|
+
}
|
|
102
|
+
function asciiSummaryOfQueryResult(formatter, totalInMs, results, processed) {
|
|
103
|
+
const result = [];
|
|
104
|
+
for (const [query, queryResults] of Object.entries(results)) {
|
|
105
|
+
if (query === '.meta') {
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (query === 'call-context') {
|
|
109
|
+
const out = queryResults;
|
|
110
|
+
result.push(`Query: ${(0, ansi_1.bold)(query, formatter)} (${out['.meta'].timing.toFixed(0)}ms)`);
|
|
111
|
+
result.push(asciiCallContext(formatter, out, processed));
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
result.push(`Query: ${(0, ansi_1.bold)(query, formatter)}`);
|
|
115
|
+
let timing = -1;
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
117
|
+
for (const [key, value] of Object.entries(queryResults)) {
|
|
118
|
+
if (key === '.meta') {
|
|
119
|
+
timing = value.timing;
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
result.push(` ╰ ${key}: ${JSON.stringify(value)}`);
|
|
123
|
+
}
|
|
124
|
+
result.push(` - Took ${timing.toFixed(0)}ms`);
|
|
125
|
+
}
|
|
126
|
+
result.push((0, ansi_1.italic)(`All queries together required ≈${results['.meta'].timing.toFixed(0)}ms (1ms accuracy, total ${totalInMs.toFixed(0)}ms)`, formatter));
|
|
127
|
+
return formatter.format(result.join('\n'));
|
|
128
|
+
}
|
|
129
|
+
exports.queryCommand = {
|
|
130
|
+
description: `Query the given R code, start with '${retriever_1.fileProtocol}' to indicate a file. The query is to be a valid query in json format (use 'help' to get more information).`,
|
|
131
|
+
usageExample: ':query "<query>" <code>',
|
|
132
|
+
aliases: [],
|
|
133
|
+
script: false,
|
|
134
|
+
fn: async (output, shell, remainingLine) => {
|
|
135
|
+
const totalStart = Date.now();
|
|
136
|
+
const results = await processQueryArgs(remainingLine, shell, output);
|
|
137
|
+
const totalEnd = Date.now();
|
|
138
|
+
if (results) {
|
|
139
|
+
output.stdout(asciiSummaryOfQueryResult(output.formatter, totalEnd - totalStart, results.query, results.processed));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
exports.queryStarCommand = {
|
|
144
|
+
description: 'Similar to query, but returns the output in json format.',
|
|
145
|
+
usageExample: ':query* <query> <code>',
|
|
146
|
+
aliases: [],
|
|
147
|
+
script: false,
|
|
148
|
+
fn: async (output, shell, remainingLine) => {
|
|
149
|
+
const results = await processQueryArgs(remainingLine, shell, output);
|
|
150
|
+
if (results) {
|
|
151
|
+
output.stdout(JSON.stringify(results.query, json_1.jsonReplacer));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
//# sourceMappingURL=repl-query.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.versionCommand =
|
|
3
|
+
exports.versionCommand = void 0;
|
|
4
|
+
exports.retrieveVersionInformation = retrieveVersionInformation;
|
|
5
|
+
exports.printVersionInformation = printVersionInformation;
|
|
4
6
|
const version_1 = require("../../../util/version");
|
|
5
7
|
const assert_1 = require("../../../util/assert");
|
|
6
8
|
const versionRegex = /^\d+\.\d+\.\d+/m;
|
|
@@ -11,13 +13,11 @@ async function retrieveVersionInformation(shell) {
|
|
|
11
13
|
(0, assert_1.guard)(r === 'unknown' || versionRegex.test(r), `R version ${r} does not match the expected format!`);
|
|
12
14
|
return { flowr: flowr, r: r };
|
|
13
15
|
}
|
|
14
|
-
exports.retrieveVersionInformation = retrieveVersionInformation;
|
|
15
16
|
async function printVersionInformation(output, shell) {
|
|
16
17
|
const { flowr, r } = await retrieveVersionInformation(shell);
|
|
17
18
|
output.stdout(`flowR: ${flowr}`);
|
|
18
19
|
output.stdout(`R: ${r}`);
|
|
19
20
|
}
|
|
20
|
-
exports.printVersionInformation = printVersionInformation;
|
|
21
21
|
exports.versionCommand = {
|
|
22
22
|
description: 'Prints the version of flowR as well as the current version of R',
|
|
23
23
|
aliases: [],
|
|
@@ -25,4 +25,4 @@ exports.versionCommand = {
|
|
|
25
25
|
script: false,
|
|
26
26
|
fn: (output, shell) => printVersionInformation(output, shell)
|
|
27
27
|
};
|
|
28
|
-
//# sourceMappingURL=version.js.map
|
|
28
|
+
//# sourceMappingURL=repl-version.js.map
|
package/cli/repl/core.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import * as readline from 'readline';
|
|
3
|
-
import type { ReplOutput } from './commands/main';
|
|
2
|
+
import type { ReplOutput } from './commands/repl-main';
|
|
4
3
|
import { RShell } from '../../r-bridge/shell';
|
|
5
4
|
import type { MergeableRecord } from '../../util/objects';
|
|
6
5
|
/**
|
package/cli/repl/core.js
CHANGED
|
@@ -26,7 +26,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.DEFAULT_REPL_READLINE_CONFIGURATION = void 0;
|
|
30
|
+
exports.replCompleter = replCompleter;
|
|
31
|
+
exports.replProcessAnswer = replProcessAnswer;
|
|
32
|
+
exports.repl = repl;
|
|
33
|
+
exports.loadReplHistory = loadReplHistory;
|
|
30
34
|
/**
|
|
31
35
|
* Basically a helper file to allow the main 'flowr' script (located in the source root) to provide its repl
|
|
32
36
|
*
|
|
@@ -34,21 +38,21 @@ exports.loadReplHistory = exports.repl = exports.replProcessAnswer = exports.DEF
|
|
|
34
38
|
*/
|
|
35
39
|
const prompt_1 = require("./prompt");
|
|
36
40
|
const readline = __importStar(require("readline"));
|
|
37
|
-
const
|
|
41
|
+
const repl_execute_1 = require("./commands/repl-execute");
|
|
38
42
|
const os_1 = __importDefault(require("os"));
|
|
39
43
|
const path_1 = __importDefault(require("path"));
|
|
40
44
|
const fs_1 = __importDefault(require("fs"));
|
|
41
45
|
const args_1 = require("../../util/args");
|
|
42
46
|
const ansi_1 = require("../../util/ansi");
|
|
43
|
-
const
|
|
47
|
+
const repl_commands_1 = require("./commands/repl-commands");
|
|
44
48
|
const scripts_info_1 = require("../common/scripts-info");
|
|
45
49
|
const retriever_1 = require("../../r-bridge/retriever");
|
|
46
|
-
const
|
|
50
|
+
const repl_main_1 = require("./commands/repl-main");
|
|
47
51
|
const shell_1 = require("../../r-bridge/shell");
|
|
48
52
|
let _replCompleterKeywords = undefined;
|
|
49
53
|
function replCompleterKeywords() {
|
|
50
54
|
if (_replCompleterKeywords === undefined) {
|
|
51
|
-
_replCompleterKeywords = Array.from((0,
|
|
55
|
+
_replCompleterKeywords = Array.from((0, repl_commands_1.getCommandNames)(), s => `:${s}`);
|
|
52
56
|
}
|
|
53
57
|
return _replCompleterKeywords;
|
|
54
58
|
}
|
|
@@ -66,7 +70,7 @@ function replCompleter(line) {
|
|
|
66
70
|
if (commandNameColon) {
|
|
67
71
|
const completions = [];
|
|
68
72
|
const commandName = commandNameColon.slice(1);
|
|
69
|
-
if ((0,
|
|
73
|
+
if ((0, repl_commands_1.getCommand)(commandName)?.script === true) {
|
|
70
74
|
// autocomplete script arguments
|
|
71
75
|
const options = scripts_info_1.scripts[commandName].options;
|
|
72
76
|
completions.push(...(0, scripts_info_1.getValidOptionsForCompletion)(options, splitLine).map(o => `${o} `));
|
|
@@ -84,7 +88,6 @@ function replCompleter(line) {
|
|
|
84
88
|
// if no command is already typed, just return all commands that match
|
|
85
89
|
return [replCompleterKeywords().filter(k => k.startsWith(line)).map(k => `${k} `), line];
|
|
86
90
|
}
|
|
87
|
-
exports.replCompleter = replCompleter;
|
|
88
91
|
exports.DEFAULT_REPL_READLINE_CONFIGURATION = {
|
|
89
92
|
input: process.stdin,
|
|
90
93
|
output: process.stdout,
|
|
@@ -97,7 +100,7 @@ exports.DEFAULT_REPL_READLINE_CONFIGURATION = {
|
|
|
97
100
|
async function replProcessStatement(output, statement, shell, allowRSessionAccess) {
|
|
98
101
|
if (statement.startsWith(':')) {
|
|
99
102
|
const command = statement.slice(1).split(' ')[0].toLowerCase();
|
|
100
|
-
const processor = (0,
|
|
103
|
+
const processor = (0, repl_commands_1.getCommand)(command);
|
|
101
104
|
const bold = (s) => output.formatter.format(s, { style: 1 /* FontStyles.Bold */ });
|
|
102
105
|
if (processor) {
|
|
103
106
|
try {
|
|
@@ -112,7 +115,7 @@ async function replProcessStatement(output, statement, shell, allowRSessionAcces
|
|
|
112
115
|
}
|
|
113
116
|
}
|
|
114
117
|
else if (allowRSessionAccess) {
|
|
115
|
-
await (0,
|
|
118
|
+
await (0, repl_execute_1.executeRShellCommand)(output, shell, statement);
|
|
116
119
|
}
|
|
117
120
|
else {
|
|
118
121
|
output.stderr(`${output.formatter.format('You are not allowed to execute arbitrary R code.', { style: 1 /* FontStyles.Bold */, color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground })}\nIf you want to do so, please restart flowR with the ${output.formatter.format('--r-session-access', { style: 1 /* FontStyles.Bold */ })} flag. Please be careful of the security implications of this action.`);
|
|
@@ -132,7 +135,6 @@ async function replProcessAnswer(output, expr, shell, allowRSessionAccess) {
|
|
|
132
135
|
await replProcessStatement(output, statement, shell, allowRSessionAccess);
|
|
133
136
|
}
|
|
134
137
|
}
|
|
135
|
-
exports.replProcessAnswer = replProcessAnswer;
|
|
136
138
|
/**
|
|
137
139
|
* Provides a never-ending repl (read-evaluate-print loop) processor that can be used to interact with a {@link RShell} as well as all flowR scripts.
|
|
138
140
|
*
|
|
@@ -145,7 +147,7 @@ exports.replProcessAnswer = replProcessAnswer;
|
|
|
145
147
|
* For the execution, this function makes use of {@link replProcessAnswer}.
|
|
146
148
|
*
|
|
147
149
|
*/
|
|
148
|
-
async function repl({ shell = new shell_1.RShell({ revive: 2 /* RShellReviveOptions.Always */ }), rl = readline.createInterface(exports.DEFAULT_REPL_READLINE_CONFIGURATION), output =
|
|
150
|
+
async function repl({ shell = new shell_1.RShell({ revive: 2 /* RShellReviveOptions.Always */ }), rl = readline.createInterface(exports.DEFAULT_REPL_READLINE_CONFIGURATION), output = repl_main_1.standardReplOutput, historyFile = defaultHistoryFile, allowRSessionAccess = false }) {
|
|
149
151
|
if (historyFile) {
|
|
150
152
|
rl.on('history', h => fs_1.default.writeFileSync(historyFile, h.join('\n'), { encoding: 'utf-8' }));
|
|
151
153
|
}
|
|
@@ -163,12 +165,10 @@ async function repl({ shell = new shell_1.RShell({ revive: 2 /* RShellReviveOpti
|
|
|
163
165
|
});
|
|
164
166
|
}
|
|
165
167
|
}
|
|
166
|
-
exports.repl = repl;
|
|
167
168
|
function loadReplHistory(historyFile) {
|
|
168
169
|
if (!fs_1.default.existsSync(historyFile)) {
|
|
169
170
|
return undefined;
|
|
170
171
|
}
|
|
171
172
|
return fs_1.default.readFileSync(historyFile, { encoding: 'utf-8' }).split('\n');
|
|
172
173
|
}
|
|
173
|
-
exports.loadReplHistory = loadReplHistory;
|
|
174
174
|
//# sourceMappingURL=core.js.map
|
package/cli/repl/execute.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { Readable, Writable } from 'stream';
|
|
3
2
|
type Stdio = [stdin: Writable | null, stdout: Readable | null, stderr: Readable | null, extra: Writable | Readable | null | undefined, extra: Writable | Readable | null | undefined];
|
|
4
3
|
export type StdioProcessor = (stdio: Stdio) => void;
|
|
@@ -24,5 +23,5 @@ export declare function stdioCaptureProcessor(stdio: Stdio, onStdOutLine: (msg:
|
|
|
24
23
|
* the output of the script, see {@link stdioCaptureProcessor}.
|
|
25
24
|
* @param exitOnError - If set to `true`, the process will exit with the exit code of the script.
|
|
26
25
|
*/
|
|
27
|
-
export declare function waitOnScript(module: string, args: string[], io?: StdioProcessor, exitOnError?: boolean): Promise<void>;
|
|
26
|
+
export declare function waitOnScript(module: string, args: readonly string[], io?: StdioProcessor, exitOnError?: boolean): Promise<void>;
|
|
28
27
|
export {};
|
package/cli/repl/execute.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.stdioCaptureProcessor = stdioCaptureProcessor;
|
|
7
|
+
exports.waitOnScript = waitOnScript;
|
|
7
8
|
const child_process_1 = __importDefault(require("child_process"));
|
|
8
9
|
const readline_1 = __importDefault(require("readline"));
|
|
9
10
|
const assert_1 = require("../../util/assert");
|
|
@@ -29,7 +30,6 @@ function stdioCaptureProcessor(stdio, onStdOutLine, onStdErrLine) {
|
|
|
29
30
|
outRl.on('line', onStdOutLine);
|
|
30
31
|
errRl.on('line', onStdErrLine);
|
|
31
32
|
}
|
|
32
|
-
exports.stdioCaptureProcessor = stdioCaptureProcessor;
|
|
33
33
|
/**
|
|
34
34
|
* Run the given module with the presented arguments, and wait for it to exit.
|
|
35
35
|
*
|
|
@@ -75,5 +75,4 @@ async function waitOnScript(module, args, io, exitOnError = false) {
|
|
|
75
75
|
}
|
|
76
76
|
}));
|
|
77
77
|
}
|
|
78
|
-
exports.waitOnScript = waitOnScript;
|
|
79
78
|
//# sourceMappingURL=execute.js.map
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.printVersionRepl =
|
|
4
|
-
const
|
|
3
|
+
exports.printVersionRepl = printVersionRepl;
|
|
4
|
+
const repl_version_1 = require("./commands/repl-version");
|
|
5
5
|
async function printVersionRepl(shell) {
|
|
6
|
-
const version = await (0,
|
|
6
|
+
const version = await (0, repl_version_1.retrieveVersionInformation)(shell);
|
|
7
7
|
console.log(`flowR repl using flowR ${version.flowr}, R ${version.r}`);
|
|
8
8
|
}
|
|
9
|
-
exports.printVersionRepl = printVersionRepl;
|
|
10
9
|
//# sourceMappingURL=print-version.js.map
|
|
@@ -23,5 +23,6 @@ export declare class FlowRServerConnection {
|
|
|
23
23
|
private handleSliceRequest;
|
|
24
24
|
private handleRepl;
|
|
25
25
|
private handleLineageRequest;
|
|
26
|
+
private handleQueryRequest;
|
|
26
27
|
}
|
|
27
28
|
export declare function sanitizeAnalysisResults(results: Partial<PipelineOutput<typeof DEFAULT_SLICING_PIPELINE>>): DeepPartial<PipelineOutput<typeof DEFAULT_SLICING_PIPELINE>>;
|
|
@@ -26,13 +26,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.FlowRServerConnection = void 0;
|
|
30
|
+
exports.sanitizeAnalysisResults = sanitizeAnalysisResults;
|
|
30
31
|
const send_1 = require("./send");
|
|
31
32
|
const validate_1 = require("./validate");
|
|
32
|
-
const
|
|
33
|
-
const
|
|
33
|
+
const message_analysis_1 = require("./messages/message-analysis");
|
|
34
|
+
const message_slice_1 = require("./messages/message-slice");
|
|
34
35
|
const server_1 = require("./server");
|
|
35
|
-
const
|
|
36
|
+
const message_repl_1 = require("./messages/message-repl");
|
|
36
37
|
const core_1 = require("../core");
|
|
37
38
|
const pipeline_executor_1 = require("../../../core/pipeline-executor");
|
|
38
39
|
const cfg_1 = require("../../../util/cfg/cfg");
|
|
@@ -47,10 +48,12 @@ const graph_1 = require("../../../dataflow/graph/graph");
|
|
|
47
48
|
const tmp = __importStar(require("tmp"));
|
|
48
49
|
const fs_1 = __importDefault(require("fs"));
|
|
49
50
|
const magic_comments_1 = require("../../../reconstruct/auto-select/magic-comments");
|
|
50
|
-
const
|
|
51
|
-
const
|
|
51
|
+
const message_lineage_1 = require("./messages/message-lineage");
|
|
52
|
+
const repl_lineage_1 = require("../commands/repl-lineage");
|
|
52
53
|
const assert_1 = require("../../../util/assert");
|
|
53
54
|
const auto_select_defaults_1 = require("../../../reconstruct/auto-select/auto-select-defaults");
|
|
55
|
+
const message_query_1 = require("./messages/message-query");
|
|
56
|
+
const query_1 = require("../../../queries/query");
|
|
54
57
|
/**
|
|
55
58
|
* Each connection handles a single client, answering to its requests.
|
|
56
59
|
* There is no need to construct this class manually, {@link FlowRServer} will do it for you.
|
|
@@ -103,6 +106,9 @@ class FlowRServerConnection {
|
|
|
103
106
|
case 'request-lineage':
|
|
104
107
|
this.handleLineageRequest(request.message);
|
|
105
108
|
break;
|
|
109
|
+
case 'request-query':
|
|
110
|
+
this.handleQueryRequest(request.message);
|
|
111
|
+
break;
|
|
106
112
|
default:
|
|
107
113
|
(0, send_1.sendMessage)(this.socket, {
|
|
108
114
|
id: request.message.id,
|
|
@@ -114,7 +120,7 @@ class FlowRServerConnection {
|
|
|
114
120
|
}
|
|
115
121
|
}
|
|
116
122
|
async handleFileAnalysisRequest(base) {
|
|
117
|
-
const requestResult = (0, validate_1.validateMessage)(base,
|
|
123
|
+
const requestResult = (0, validate_1.validateMessage)(base, message_analysis_1.requestAnalysisMessage);
|
|
118
124
|
if (requestResult.type === 'error') {
|
|
119
125
|
(0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
|
|
120
126
|
return;
|
|
@@ -202,7 +208,7 @@ class FlowRServerConnection {
|
|
|
202
208
|
return slicer;
|
|
203
209
|
}
|
|
204
210
|
handleSliceRequest(base) {
|
|
205
|
-
const requestResult = (0, validate_1.validateMessage)(base,
|
|
211
|
+
const requestResult = (0, validate_1.validateMessage)(base, message_slice_1.requestSliceMessage);
|
|
206
212
|
if (requestResult.type === 'error') {
|
|
207
213
|
(0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
|
|
208
214
|
return;
|
|
@@ -241,7 +247,7 @@ class FlowRServerConnection {
|
|
|
241
247
|
});
|
|
242
248
|
}
|
|
243
249
|
handleRepl(base) {
|
|
244
|
-
const requestResult = (0, validate_1.validateMessage)(base,
|
|
250
|
+
const requestResult = (0, validate_1.validateMessage)(base, message_repl_1.requestExecuteReplExpressionMessage);
|
|
245
251
|
if (requestResult.type === 'error') {
|
|
246
252
|
(0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
|
|
247
253
|
return;
|
|
@@ -267,7 +273,7 @@ class FlowRServerConnection {
|
|
|
267
273
|
});
|
|
268
274
|
}
|
|
269
275
|
handleLineageRequest(base) {
|
|
270
|
-
const requestResult = (0, validate_1.validateMessage)(base,
|
|
276
|
+
const requestResult = (0, validate_1.validateMessage)(base, message_lineage_1.requestLineageMessage);
|
|
271
277
|
if (requestResult.type === 'error') {
|
|
272
278
|
(0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
|
|
273
279
|
return;
|
|
@@ -287,13 +293,41 @@ class FlowRServerConnection {
|
|
|
287
293
|
const { dataflow: dfg, normalize: ast } = fileInformation.pipeline.getResults(true);
|
|
288
294
|
(0, assert_1.guard)(dfg !== undefined, `Dataflow graph must be present (request: ${request.filetoken})`);
|
|
289
295
|
(0, assert_1.guard)(ast !== undefined, `AST must be present (request: ${request.filetoken})`);
|
|
290
|
-
const lineageIds = (0,
|
|
296
|
+
const lineageIds = (0, repl_lineage_1.getLineage)(request.criterion, dfg.graph, ast.idMap);
|
|
291
297
|
(0, send_1.sendMessage)(this.socket, {
|
|
292
298
|
type: 'response-lineage',
|
|
293
299
|
id: request.id,
|
|
294
300
|
lineage: [...lineageIds]
|
|
295
301
|
});
|
|
296
302
|
}
|
|
303
|
+
handleQueryRequest(base) {
|
|
304
|
+
const requestResult = (0, validate_1.validateMessage)(base, message_query_1.requestQueryMessage);
|
|
305
|
+
if (requestResult.type === 'error') {
|
|
306
|
+
(0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
const request = requestResult.message;
|
|
310
|
+
this.logger.info(`[${this.name}] Received query request for query ${JSON.stringify(request.query)}`);
|
|
311
|
+
const fileInformation = this.fileMap.get(request.filetoken);
|
|
312
|
+
if (!fileInformation) {
|
|
313
|
+
(0, send_1.sendMessage)(this.socket, {
|
|
314
|
+
id: request.id,
|
|
315
|
+
type: 'error',
|
|
316
|
+
fatal: false,
|
|
317
|
+
reason: `The file token ${request.filetoken} has never been analyzed.`
|
|
318
|
+
});
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const { dataflow: dfg, normalize: ast } = fileInformation.pipeline.getResults(true);
|
|
322
|
+
(0, assert_1.guard)(dfg !== undefined, `Dataflow graph must be present (request: ${request.filetoken})`);
|
|
323
|
+
(0, assert_1.guard)(ast !== undefined, `AST must be present (request: ${request.filetoken})`);
|
|
324
|
+
const results = (0, query_1.executeQueries)({ graph: dfg.graph, ast }, request.query);
|
|
325
|
+
(0, send_1.sendMessage)(this.socket, {
|
|
326
|
+
type: 'response-query',
|
|
327
|
+
id: request.id,
|
|
328
|
+
results
|
|
329
|
+
});
|
|
330
|
+
}
|
|
297
331
|
}
|
|
298
332
|
exports.FlowRServerConnection = FlowRServerConnection;
|
|
299
333
|
function sanitizeAnalysisResults(results) {
|
|
@@ -310,5 +344,4 @@ function sanitizeAnalysisResults(results) {
|
|
|
310
344
|
}
|
|
311
345
|
};
|
|
312
346
|
}
|
|
313
|
-
exports.sanitizeAnalysisResults = sanitizeAnalysisResults;
|
|
314
347
|
//# sourceMappingURL=connection.js.map
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import * as Joi from 'joi';
|
|
7
|
-
import type { FlowrHelloResponseMessage } from './hello';
|
|
8
|
-
import type { FileAnalysisRequestMessage, FileAnalysisResponseMessageJson } from './analysis';
|
|
9
|
-
import type { ExecuteEndMessage, ExecuteIntermediateResponseMessage, ExecuteRequestMessage } from './repl';
|
|
10
|
-
import type { SliceRequestMessage, SliceResponseMessage } from './slice';
|
|
11
|
-
import type { FlowrErrorMessage } from './error';
|
|
12
|
-
import type { LineageRequestMessage, LineageResponseMessage } from './lineage';
|
|
7
|
+
import type { FlowrHelloResponseMessage } from './message-hello';
|
|
8
|
+
import type { FileAnalysisRequestMessage, FileAnalysisResponseMessageJson } from './message-analysis';
|
|
9
|
+
import type { ExecuteEndMessage, ExecuteIntermediateResponseMessage, ExecuteRequestMessage } from './message-repl';
|
|
10
|
+
import type { SliceRequestMessage, SliceResponseMessage } from './message-slice';
|
|
11
|
+
import type { FlowrErrorMessage } from './message-error';
|
|
12
|
+
import type { LineageRequestMessage, LineageResponseMessage } from './message-lineage';
|
|
13
|
+
import type { QueryRequestMessage, QueryResponseMessage } from './message-query';
|
|
13
14
|
/**
|
|
14
15
|
* If you send a message it must *not* contain a newline but the message must be terminated by a newline.
|
|
15
16
|
*/
|
|
@@ -33,4 +34,4 @@ export declare const baseMessage: MessageDefinition<IdMessageBase>;
|
|
|
33
34
|
/**
|
|
34
35
|
* This is the main message type that should be used to represent a message in *flowR*
|
|
35
36
|
*/
|
|
36
|
-
export type FlowrMessage = FlowrHelloResponseMessage | FileAnalysisRequestMessage | FileAnalysisResponseMessageJson | ExecuteRequestMessage | ExecuteIntermediateResponseMessage | ExecuteEndMessage | SliceRequestMessage | SliceResponseMessage | LineageRequestMessage | LineageResponseMessage | FlowrErrorMessage;
|
|
37
|
+
export type FlowrMessage = FlowrHelloResponseMessage | FileAnalysisRequestMessage | FileAnalysisResponseMessageJson | ExecuteRequestMessage | ExecuteIntermediateResponseMessage | ExecuteEndMessage | SliceRequestMessage | SliceResponseMessage | LineageRequestMessage | LineageResponseMessage | QueryRequestMessage | QueryResponseMessage | FlowrErrorMessage;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IdMessageBase, MessageDefinition } from './messages';
|
|
1
|
+
import type { IdMessageBase, MessageDefinition } from './all-messages';
|
|
2
2
|
import type { ControlFlowInformation } from '../../../../util/cfg/cfg';
|
|
3
3
|
import type { DEFAULT_DATAFLOW_PIPELINE, DEFAULT_SLICING_PIPELINE } from '../../../../core/steps/pipeline/default-pipelines';
|
|
4
4
|
import type { PipelineOutput } from '../../../../core/steps/pipeline/pipeline';
|
|
@@ -76,3 +76,4 @@ export interface FileAnalysisResponseMessageNQuads extends IdMessageBase {
|
|
|
76
76
|
*/
|
|
77
77
|
cfg?: string;
|
|
78
78
|
}
|
|
79
|
+
export declare const analysisResponseMessage: MessageDefinition<FileAnalysisResponseMessageJson | FileAnalysisResponseMessageNQuads>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.analysisResponseMessage = exports.requestAnalysisMessage = void 0;
|
|
7
|
+
const joi_1 = __importDefault(require("joi"));
|
|
8
|
+
exports.requestAnalysisMessage = {
|
|
9
|
+
type: 'request-file-analysis',
|
|
10
|
+
schema: joi_1.default.object({
|
|
11
|
+
type: joi_1.default.string().valid('request-file-analysis').required().description('The type of the message.'),
|
|
12
|
+
id: joi_1.default.string().optional().description('You may pass an id to link requests with responses (they get the same id).'),
|
|
13
|
+
filetoken: joi_1.default.string().optional().description('A unique token to identify the file for subsequent requests. Only use this if you plan to send more queries!'),
|
|
14
|
+
filename: joi_1.default.string().optional().description('A human-readable name of the file, only for debugging purposes.'),
|
|
15
|
+
content: joi_1.default.string().optional().description('The content of the file or an R expression (either give this or the filepath).'),
|
|
16
|
+
filepath: joi_1.default.alternatives(joi_1.default.string(), joi_1.default.array().items(joi_1.default.string())).optional().description('The path to the file(s) on the local machine (either give this or the content).'),
|
|
17
|
+
cfg: joi_1.default.boolean().optional().description('If you want to extract the control flow information of the file.'),
|
|
18
|
+
format: joi_1.default.string().valid('json', 'n-quads').optional().description('The format of the results, if missing we assume json.')
|
|
19
|
+
}).xor('content', 'filepath')
|
|
20
|
+
};
|
|
21
|
+
const jsonSchema = joi_1.default.object({
|
|
22
|
+
type: joi_1.default.string().valid('response-file-analysis').required().description('The type of the message.'),
|
|
23
|
+
id: joi_1.default.string().optional().description('The id of the message, if you passed one in the request.'),
|
|
24
|
+
format: joi_1.default.string().valid('json').required().description('The format of the results in json format.'),
|
|
25
|
+
results: joi_1.default.object().required().description('The results of the analysis (one field per step).'),
|
|
26
|
+
cfg: joi_1.default.object().optional().description('The control flow information of the file, only present if requested.')
|
|
27
|
+
}).description('The response in JSON format.');
|
|
28
|
+
const nquadsSchema = joi_1.default.object({
|
|
29
|
+
type: joi_1.default.string().valid('response-file-analysis').required().description('The type of the message.'),
|
|
30
|
+
id: joi_1.default.string().optional().description('The id of the message, if you passed one in the request.'),
|
|
31
|
+
format: joi_1.default.string().valid('n-quads').required().description('The format of the results in n-quads format.'),
|
|
32
|
+
results: joi_1.default.object().required().description('The results of the analysis (one field per step). Quads are presented as string.'),
|
|
33
|
+
cfg: joi_1.default.string().optional().description('The control flow information of the file, only present if requested.')
|
|
34
|
+
}).description('The response as n-quads.');
|
|
35
|
+
exports.analysisResponseMessage = {
|
|
36
|
+
type: 'response-file-analysis',
|
|
37
|
+
schema: joi_1.default.alternatives(jsonSchema, nquadsSchema).required().description('The response to a file analysis request (based on the `format` field).')
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=message-analysis.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { VersionInformation } from '../../commands/version';
|
|
2
|
-
import type { IdMessageBase } from './messages';
|
|
1
|
+
import type { VersionInformation } from '../../commands/repl-version';
|
|
2
|
+
import type { IdMessageBase, MessageDefinition } from './all-messages';
|
|
3
3
|
/**
|
|
4
|
-
* The hello message is automatically
|
|
4
|
+
* The hello message is automatically sent by the sever upon connection.
|
|
5
5
|
*/
|
|
6
6
|
export interface FlowrHelloResponseMessage extends IdMessageBase {
|
|
7
7
|
type: 'hello';
|
|
@@ -18,3 +18,4 @@ export interface FlowrHelloResponseMessage extends IdMessageBase {
|
|
|
18
18
|
*/
|
|
19
19
|
versions: VersionInformation;
|
|
20
20
|
}
|
|
21
|
+
export declare const helloMessageDefinition: MessageDefinition<FlowrHelloResponseMessage>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.helloMessageDefinition = void 0;
|
|
7
|
+
const joi_1 = __importDefault(require("joi"));
|
|
8
|
+
exports.helloMessageDefinition = {
|
|
9
|
+
type: 'hello',
|
|
10
|
+
schema: joi_1.default.object({
|
|
11
|
+
type: joi_1.default.string().required().valid('hello').description('The type of the hello message.'),
|
|
12
|
+
id: joi_1.default.any().forbidden().description('The id of the message is always undefined (as it is the initial message and not requested).'),
|
|
13
|
+
clientName: joi_1.default.string().required().description('A unique name that is assigned to each client. It has no semantic meaning and is only used/useful for debugging.'),
|
|
14
|
+
versions: joi_1.default.object({
|
|
15
|
+
flowr: joi_1.default.string().required().description('The version of the flowr server running in semver format.'),
|
|
16
|
+
r: joi_1.default.string().required().description('The version of the underlying R shell running in semver format.')
|
|
17
|
+
}).required()
|
|
18
|
+
}).required()
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=message-hello.js.map
|