@eagleoutice/flowr 2.1.1 → 2.1.3
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 +2 -1
- package/cli/repl/commands/repl-parse.js +7 -16
- package/cli/repl/commands/repl-query.d.ts +0 -5
- package/cli/repl/commands/repl-query.js +2 -73
- package/core/print/parse-printer.js +1 -22
- package/core/steps/pipeline/default-pipelines.d.ts +64 -0
- package/core/steps/pipeline/default-pipelines.js +2 -1
- package/dataflow/cluster.d.ts +20 -0
- package/dataflow/cluster.js +46 -0
- package/dataflow/graph/edge.d.ts +2 -3
- package/dataflow/graph/graph.d.ts +1 -1
- package/documentation/data/server/doc-data-server-messages.d.ts +1 -1
- package/documentation/data/server/doc-data-server-messages.js +16 -5
- package/documentation/doc-util/doc-code.d.ts +1 -0
- package/documentation/doc-util/doc-code.js +9 -0
- package/documentation/doc-util/doc-dfg.d.ts +1 -0
- package/documentation/doc-util/doc-dfg.js +5 -4
- package/documentation/doc-util/doc-normalized-ast.js +2 -2
- package/documentation/doc-util/doc-query.d.ts +5 -1
- package/documentation/doc-util/doc-query.js +154 -9
- package/documentation/doc-util/doc-server-message.js +3 -5
- package/documentation/doc-util/doc-types.js +19 -11
- package/documentation/print-dataflow-graph-wiki.js +10 -1
- package/documentation/print-interface-wiki.js +1 -1
- package/documentation/print-normalized-ast-wiki.js +2 -2
- package/documentation/print-query-wiki.js +196 -37
- package/package.json +3 -2
- package/queries/{call-context-query → catalog/call-context-query}/call-context-query-executor.d.ts +4 -3
- package/queries/{call-context-query → catalog/call-context-query}/call-context-query-executor.js +22 -16
- package/queries/{call-context-query → catalog/call-context-query}/call-context-query-format.d.ts +6 -2
- package/queries/catalog/cluster-query/cluster-query-executor.d.ts +3 -0
- package/queries/catalog/cluster-query/cluster-query-executor.js +19 -0
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +12 -0
- package/queries/catalog/cluster-query/cluster-query-format.js +3 -0
- package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +3 -0
- package/queries/catalog/dataflow-query/dataflow-query-executor.js +17 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +12 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.js +3 -0
- package/queries/catalog/id-map-query/id-map-query-executor.d.ts +3 -0
- package/queries/catalog/id-map-query/id-map-query-executor.js +17 -0
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +8 -0
- package/{r-bridge/lang-4.x/ast/parser/xml/normalizer-data.js → queries/catalog/id-map-query/id-map-query-format.js} +1 -1
- package/queries/catalog/lineage-query/lineage-query-executor.d.ts +3 -0
- package/queries/catalog/lineage-query/lineage-query-executor.js +22 -0
- package/queries/catalog/lineage-query/lineage-query-format.d.ts +14 -0
- package/queries/catalog/lineage-query/lineage-query-format.js +3 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +3 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +17 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +11 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +3 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +4 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +40 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +24 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -0
- package/queries/query-schema.d.ts +6 -0
- package/queries/query-schema.js +26 -3
- package/queries/query.d.ts +22 -4
- package/queries/query.js +14 -2
- package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +37 -13
- package/r-bridge/lang-4.x/ast/parser/json/format.js +59 -6
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +0 -3
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +2 -40
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then-else.d.ts +15 -0
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/control/normalize-if-then-else.js +5 -8
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/control/normalize-if-then.d.ts +7 -7
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/control/normalize-if-then.js +11 -12
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/expression/normalize-expression.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/expression/normalize-expression.js +4 -7
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-argument.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-argument.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-call.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-call.js +6 -9
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-definition.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-definition.js +1 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-parameter.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-parameter.js +6 -5
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-break.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-for.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-for.js +5 -6
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-next.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-repeat.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-while.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/normalize-access.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/normalize-access.js +1 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/operators/normalize-binary.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/operators/normalize-binary.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/operators/normalize-unary.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-comment.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-comment.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-line-directive.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-line-directive.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-delimiter.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.d.ts +10 -0
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-root.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-root.js +3 -4
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-single-node.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-single-node.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-number.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-number.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-string.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-string.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-symbol.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-symbol.js +1 -3
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +41 -0
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +85 -0
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/normalizer-data.d.ts +10 -4
- package/r-bridge/lang-4.x/ast/parser/main/normalizer-data.js +14 -0
- package/slicing/criterion/parse.d.ts +1 -1
- package/statistics/summarizer/post-process/clusterer.d.ts +1 -1
- package/util/ansi.js +9 -2
- package/util/time.d.ts +4 -0
- package/util/time.js +8 -0
- package/util/version.js +1 -1
- package/documentation/doc-util/doc-ms.d.ts +0 -1
- package/documentation/doc-util/doc-ms.js +0 -8
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +0 -39
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +0 -38
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/normalize-if-then-else.d.ts +0 -15
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-while.d.ts +0 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-delimiter.d.ts +0 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-expressions.d.ts +0 -10
- package/r-bridge/lang-4.x/ast/parser/xml/normalize-meta.d.ts +0 -47
- package/r-bridge/lang-4.x/ast/parser/xml/normalize-meta.js +0 -110
- /package/queries/{call-context-query → catalog/call-context-query}/call-context-query-format.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-break.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-next.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-repeat.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/operators/normalize-unary.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-delimiter.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-expressions.js +0 -0
package/README.md
CHANGED
|
@@ -24,7 +24,8 @@ You can enter `:help` to gain more information on its capabilities.
|
|
|
24
24
|
|
|
25
25
|
## 📜 More Information
|
|
26
26
|
|
|
27
|
-
For more details on how to use _flowR_ please refer to the
|
|
27
|
+
For more details on how to use _flowR_ please refer to the [wiki pages](https://github.com/flowr-analysis/flowr/wiki),
|
|
28
|
+
as well as the deployed [code documentation](https://flowr-analysis.github.io/flowr/doc/).
|
|
28
29
|
|
|
29
30
|
## 🚀 Contributing
|
|
30
31
|
|
|
@@ -3,22 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseCommand = void 0;
|
|
4
4
|
const pipeline_executor_1 = require("../../../core/pipeline-executor");
|
|
5
5
|
const format_1 = require("../../../r-bridge/lang-4.x/ast/parser/json/format");
|
|
6
|
-
const
|
|
7
|
-
const input_format_1 = require("../../../r-bridge/lang-4.x/ast/parser/xml/input-format");
|
|
8
|
-
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
9
|
-
const normalize_meta_1 = require("../../../r-bridge/lang-4.x/ast/parser/xml/normalize-meta");
|
|
6
|
+
const normalize_meta_1 = require("../../../r-bridge/lang-4.x/ast/parser/main/normalize-meta");
|
|
10
7
|
const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
|
|
11
8
|
const retriever_1 = require("../../../r-bridge/retriever");
|
|
12
|
-
function toDepthMap(
|
|
13
|
-
const
|
|
14
|
-
const visit = [{ depth: 0, node: root }];
|
|
9
|
+
function toDepthMap(entry) {
|
|
10
|
+
const visit = [{ depth: 0, node: entry }];
|
|
15
11
|
const result = [];
|
|
16
12
|
while (visit.length > 0) {
|
|
17
13
|
const current = visit.pop();
|
|
18
14
|
if (current === undefined) {
|
|
19
15
|
continue;
|
|
20
16
|
}
|
|
21
|
-
const children = current.node
|
|
17
|
+
const children = current.node.children;
|
|
22
18
|
result.push({ ...current, leaf: children.length === 0 });
|
|
23
19
|
children.reverse();
|
|
24
20
|
const nextDepth = current.depth + 1;
|
|
@@ -75,13 +71,8 @@ function depthListToTextTree(list, f) {
|
|
|
75
71
|
deadDepths.delete(depth);
|
|
76
72
|
result += initialIndentation(i, depth, deadDepths, nextDepth, list, f);
|
|
77
73
|
result += f.reset();
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
const locationRaw = raw[input_format_1.attributesKey];
|
|
81
|
-
let location = '';
|
|
82
|
-
if (locationRaw !== undefined) {
|
|
83
|
-
location = retrieveLocationString(locationRaw);
|
|
84
|
-
}
|
|
74
|
+
const content = node.text;
|
|
75
|
+
const location = retrieveLocationString(node);
|
|
85
76
|
const type = (0, normalize_meta_1.getTokenType)(node);
|
|
86
77
|
if (leaf) {
|
|
87
78
|
const suffix = `${f.format(content ? JSON.stringify(content) : '', { style: 1 /* FontStyles.Bold */ })}${f.format(location, { style: 3 /* FontStyles.Italic */ })}`;
|
|
@@ -104,7 +95,7 @@ exports.parseCommand = {
|
|
|
104
95
|
shell,
|
|
105
96
|
request: (0, retriever_1.requestFromInput)((0, retriever_1.removeRQuotes)(remainingLine.trim()))
|
|
106
97
|
}).allRemainingSteps();
|
|
107
|
-
const object = (0,
|
|
98
|
+
const object = (0, format_1.convertPreparedParsedData)((0, format_1.prepareParsedData)(result.parse));
|
|
108
99
|
output.stdout(depthListToTextTree(toDepthMap(object), output.formatter));
|
|
109
100
|
}
|
|
110
101
|
};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { DEFAULT_DATAFLOW_PIPELINE } from '../../../core/steps/pipeline/default-pipelines';
|
|
2
1
|
import type { ReplCommand } from './repl-main';
|
|
3
|
-
import type { OutputFormatter } from '../../../util/ansi';
|
|
4
|
-
import type { QueryResults, SupportedQueryTypes } from '../../../queries/query';
|
|
5
|
-
import type { PipelineOutput } from '../../../core/steps/pipeline/pipeline';
|
|
6
|
-
export declare function asciiSummaryOfQueryResult(formatter: OutputFormatter, totalInMs: number, results: QueryResults<SupportedQueryTypes>, processed: PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>): string;
|
|
7
2
|
export declare const queryCommand: ReplCommand;
|
|
8
3
|
export declare const queryStarCommand: ReplCommand;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.queryStarCommand = exports.queryCommand = void 0;
|
|
4
|
-
exports.asciiSummaryOfQueryResult = asciiSummaryOfQueryResult;
|
|
5
4
|
const pipeline_executor_1 = require("../../../core/pipeline-executor");
|
|
6
5
|
const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
|
|
7
6
|
const retriever_1 = require("../../../r-bridge/retriever");
|
|
@@ -11,7 +10,6 @@ const schema_1 = require("../../../util/schema");
|
|
|
11
10
|
const query_1 = require("../../../queries/query");
|
|
12
11
|
const json_1 = require("../../../util/json");
|
|
13
12
|
const query_schema_1 = require("../../../queries/query-schema");
|
|
14
|
-
const built_in_1 = require("../../../dataflow/environments/built-in");
|
|
15
13
|
async function getDataflow(shell, remainingLine) {
|
|
16
14
|
return await new pipeline_executor_1.PipelineExecutor(default_pipelines_1.DEFAULT_DATAFLOW_PIPELINE, {
|
|
17
15
|
shell,
|
|
@@ -56,76 +54,6 @@ async function processQueryArgs(line, shell, output) {
|
|
|
56
54
|
processed
|
|
57
55
|
};
|
|
58
56
|
}
|
|
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
57
|
exports.queryCommand = {
|
|
130
58
|
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
59
|
usageExample: ':query "<query>" <code>',
|
|
@@ -136,7 +64,8 @@ exports.queryCommand = {
|
|
|
136
64
|
const results = await processQueryArgs(remainingLine, shell, output);
|
|
137
65
|
const totalEnd = Date.now();
|
|
138
66
|
if (results) {
|
|
139
|
-
output.stdout(
|
|
67
|
+
output.stdout(JSON.stringify(results));
|
|
68
|
+
output.stdout('Total time: ' + (totalEnd - totalStart) + 'ms');
|
|
140
69
|
}
|
|
141
70
|
}
|
|
142
71
|
};
|
|
@@ -2,29 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseToQuads = parseToQuads;
|
|
4
4
|
const quads_1 = require("../../util/quads");
|
|
5
|
-
const parser_1 = require("../../r-bridge/lang-4.x/ast/parser/json/parser");
|
|
6
5
|
const format_1 = require("../../r-bridge/lang-4.x/ast/parser/json/format");
|
|
7
|
-
const input_format_1 = require("../../r-bridge/lang-4.x/ast/parser/xml/input-format");
|
|
8
|
-
function filterObject(obj, keys) {
|
|
9
|
-
if (typeof obj !== 'object') {
|
|
10
|
-
return obj;
|
|
11
|
-
}
|
|
12
|
-
else if (Array.isArray(obj)) {
|
|
13
|
-
return obj.map(e => filterObject(e, keys));
|
|
14
|
-
}
|
|
15
|
-
if (Object.keys(obj).some(k => keys.has(k))) {
|
|
16
|
-
return Object.fromEntries(Object.entries(obj)
|
|
17
|
-
.filter(([k]) => keys.has(k))
|
|
18
|
-
.map(([k, v]) => [k, filterObject(v, keys)]));
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
return Object.fromEntries(Object.entries(obj)
|
|
22
|
-
.map(([k, v]) => [k, filterObject(v, keys)]));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
6
|
function parseToQuads(code, config) {
|
|
26
|
-
|
|
27
|
-
// recursively filter so that if the object contains one of the keys 'a', 'b' or 'c', all other keys are ignored
|
|
28
|
-
return (0, quads_1.serialize2quads)(filterObject(obj, new Set([input_format_1.attributesKey, input_format_1.childrenKey, input_format_1.contentKey])), config);
|
|
7
|
+
return (0, quads_1.serialize2quads)((0, format_1.convertPreparedParsedData)((0, format_1.prepareParsedData)(code)), config);
|
|
29
8
|
}
|
|
30
9
|
//# sourceMappingURL=parse-printer.js.map
|
|
@@ -154,6 +154,70 @@ export declare const DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipeline"
|
|
|
154
154
|
readonly dependencies: readonly ["slice"];
|
|
155
155
|
readonly requiredInput: import("../all/static-slicing/10-reconstruct").ReconstructRequiredInput;
|
|
156
156
|
}>;
|
|
157
|
+
export declare const DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./pipeline").Pipeline<{
|
|
158
|
+
readonly name: "parse";
|
|
159
|
+
readonly humanReadableName: "parse with R shell";
|
|
160
|
+
readonly description: "Parse the given R code into an AST";
|
|
161
|
+
readonly processor: (_results: unknown, input: Partial<import("../all/core/00-parse").ParseRequiredInput>) => Promise<string>;
|
|
162
|
+
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerFile;
|
|
163
|
+
readonly printer: {
|
|
164
|
+
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
165
|
+
readonly 2: (text: string) => string;
|
|
166
|
+
readonly 5: typeof import("../../print/parse-printer").parseToQuads;
|
|
167
|
+
};
|
|
168
|
+
readonly dependencies: readonly [];
|
|
169
|
+
readonly requiredInput: import("../all/core/00-parse").ParseRequiredInput;
|
|
170
|
+
} | {
|
|
171
|
+
readonly name: "normalize";
|
|
172
|
+
readonly humanReadableName: "normalize";
|
|
173
|
+
readonly description: "Normalize the AST to flowR's AST";
|
|
174
|
+
readonly processor: (results: {
|
|
175
|
+
parse?: string;
|
|
176
|
+
}, input: Partial<import("../all/core/10-normalize").NormalizeRequiredInput>) => import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../r-bridge/lang-4.x/ast/model/model").RNode<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
|
|
177
|
+
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerFile;
|
|
178
|
+
readonly printer: {
|
|
179
|
+
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
180
|
+
readonly 2: typeof import("../../print/normalize-printer").normalizedAstToJson;
|
|
181
|
+
readonly 5: typeof import("../../print/normalize-printer").normalizedAstToQuads;
|
|
182
|
+
readonly 3: typeof import("../../print/normalize-printer").printNormalizedAstToMermaid;
|
|
183
|
+
readonly 4: typeof import("../../print/normalize-printer").printNormalizedAstToMermaidUrl;
|
|
184
|
+
};
|
|
185
|
+
readonly dependencies: readonly ["parse"];
|
|
186
|
+
readonly requiredInput: import("../all/core/10-normalize").NormalizeRequiredInput;
|
|
187
|
+
} | {
|
|
188
|
+
readonly humanReadableName: "dataflow";
|
|
189
|
+
readonly processor: (results: {
|
|
190
|
+
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
191
|
+
}, input: {
|
|
192
|
+
request?: import("../../../r-bridge/retriever").RParseRequests;
|
|
193
|
+
}) => import("../../../dataflow/info").DataflowInformation;
|
|
194
|
+
readonly requiredInput: {};
|
|
195
|
+
readonly name: "dataflow";
|
|
196
|
+
readonly description: "Construct the dataflow graph";
|
|
197
|
+
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerFile;
|
|
198
|
+
readonly printer: {
|
|
199
|
+
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
200
|
+
readonly 2: typeof import("../../print/dataflow-printer").dataflowGraphToJson;
|
|
201
|
+
readonly 5: typeof import("../../print/dataflow-printer").dataflowGraphToQuads;
|
|
202
|
+
readonly 3: typeof import("../../print/dataflow-printer").dataflowGraphToMermaid;
|
|
203
|
+
readonly 4: typeof import("../../print/dataflow-printer").dataflowGraphToMermaidUrl;
|
|
204
|
+
};
|
|
205
|
+
readonly dependencies: readonly ["normalize"];
|
|
206
|
+
} | {
|
|
207
|
+
readonly name: "slice";
|
|
208
|
+
readonly humanReadableName: "static slice";
|
|
209
|
+
readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
|
|
210
|
+
readonly processor: (results: {
|
|
211
|
+
dataflow?: import("../../../dataflow/info").DataflowInformation;
|
|
212
|
+
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
213
|
+
}, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
|
|
214
|
+
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
|
|
215
|
+
readonly printer: {
|
|
216
|
+
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
217
|
+
};
|
|
218
|
+
readonly dependencies: readonly ["dataflow"];
|
|
219
|
+
readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
|
|
220
|
+
}>;
|
|
157
221
|
export declare const DEFAULT_DATAFLOW_PIPELINE: import("./pipeline").Pipeline<{
|
|
158
222
|
readonly name: "parse";
|
|
159
223
|
readonly humanReadableName: "parse with R shell";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_PARSE_PIPELINE = exports.DEFAULT_NORMALIZE_PIPELINE = exports.DEFAULT_DATAFLOW_PIPELINE = exports.DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE = exports.DEFAULT_SLICING_PIPELINE = void 0;
|
|
3
|
+
exports.DEFAULT_PARSE_PIPELINE = exports.DEFAULT_NORMALIZE_PIPELINE = exports.DEFAULT_DATAFLOW_PIPELINE = exports.DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE = exports.DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE = exports.DEFAULT_SLICING_PIPELINE = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Contains the default pipeline for working with flowr
|
|
6
6
|
*/
|
|
@@ -12,6 +12,7 @@ const _00_slice_1 = require("../all/static-slicing/00-slice");
|
|
|
12
12
|
const _10_reconstruct_1 = require("../all/static-slicing/10-reconstruct");
|
|
13
13
|
exports.DEFAULT_SLICING_PIPELINE = (0, pipeline_1.createPipeline)(_00_parse_1.PARSE_WITH_R_SHELL_STEP, _10_normalize_1.NORMALIZE, _20_dataflow_1.STATIC_DATAFLOW, _00_slice_1.STATIC_SLICE, _10_reconstruct_1.NAIVE_RECONSTRUCT);
|
|
14
14
|
exports.DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE = exports.DEFAULT_SLICING_PIPELINE;
|
|
15
|
+
exports.DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE = (0, pipeline_1.createPipeline)(_00_parse_1.PARSE_WITH_R_SHELL_STEP, _10_normalize_1.NORMALIZE, _20_dataflow_1.STATIC_DATAFLOW, _00_slice_1.STATIC_SLICE);
|
|
15
16
|
exports.DEFAULT_DATAFLOW_PIPELINE = (0, pipeline_1.createPipeline)(_00_parse_1.PARSE_WITH_R_SHELL_STEP, _10_normalize_1.NORMALIZE, _20_dataflow_1.STATIC_DATAFLOW);
|
|
16
17
|
exports.DEFAULT_NORMALIZE_PIPELINE = (0, pipeline_1.createPipeline)(_00_parse_1.PARSE_WITH_R_SHELL_STEP, _10_normalize_1.NORMALIZE);
|
|
17
18
|
exports.DEFAULT_PARSE_PIPELINE = (0, pipeline_1.createPipeline)(_00_parse_1.PARSE_WITH_R_SHELL_STEP);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DataflowGraph } from './graph/graph';
|
|
2
|
+
import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
3
|
+
export type DataflowGraphClusters = DataflowGraphCluster[];
|
|
4
|
+
export interface DataflowGraphCluster {
|
|
5
|
+
/**
|
|
6
|
+
* The node which started the cluster,
|
|
7
|
+
* as this is theoretically picked random, there are just two guarantees you can rely on:
|
|
8
|
+
*
|
|
9
|
+
* 1. The node is part of the `members` as well
|
|
10
|
+
* 2. At one point during the clustering, the node wsa considered as a starting point
|
|
11
|
+
*
|
|
12
|
+
* In general, this is more of a debugging aid/representative of the cluster.
|
|
13
|
+
*/
|
|
14
|
+
readonly startNode: NodeId;
|
|
15
|
+
/** All nodes that are part of this cluster */
|
|
16
|
+
readonly members: readonly NodeId[];
|
|
17
|
+
/** If the cluster contains unknown side effects */
|
|
18
|
+
readonly hasUnknownSideEffects: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function findAllClusters(graph: DataflowGraph): DataflowGraphClusters;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findAllClusters = findAllClusters;
|
|
4
|
+
const edge_1 = require("./graph/edge");
|
|
5
|
+
const vertex_1 = require("./graph/vertex");
|
|
6
|
+
const assert_1 = require("../util/assert");
|
|
7
|
+
function findAllClusters(graph) {
|
|
8
|
+
const clusters = [];
|
|
9
|
+
// we reverse the vertices since dependencies usually point "backwards" from later nodes
|
|
10
|
+
const notReached = new Set([...graph.vertices(true)].map(([id]) => id).reverse());
|
|
11
|
+
while (notReached.size > 0) {
|
|
12
|
+
const [startNode] = notReached;
|
|
13
|
+
notReached.delete(startNode);
|
|
14
|
+
clusters.push({
|
|
15
|
+
startNode: startNode,
|
|
16
|
+
members: [...makeCluster(graph, startNode, notReached)],
|
|
17
|
+
hasUnknownSideEffects: graph.unknownSideEffects.has(startNode)
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return clusters;
|
|
21
|
+
}
|
|
22
|
+
function makeCluster(graph, from, notReached) {
|
|
23
|
+
const info = graph.getVertex(from);
|
|
24
|
+
(0, assert_1.guard)(info !== undefined, () => `Vertex ${from} not found in graph`);
|
|
25
|
+
const nodes = new Set([from]);
|
|
26
|
+
// cluster function def exit points
|
|
27
|
+
if (info.tag === vertex_1.VertexType.FunctionDefinition) {
|
|
28
|
+
for (const sub of info.exitPoints) {
|
|
29
|
+
if (notReached.delete(sub)) {
|
|
30
|
+
makeCluster(graph, sub, notReached).forEach(n => nodes.add(n));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// cluster adjacent edges
|
|
35
|
+
for (const [dest, { types }] of [...graph.outgoingEdges(from) ?? [], ...graph.ingoingEdges(from) ?? []]) {
|
|
36
|
+
// don't cluster for function content if it isn't returned
|
|
37
|
+
if ((0, edge_1.edgeDoesNotIncludeType)(types, edge_1.EdgeType.Returns) && info.onlyBuiltin && info.name == '{') {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (notReached.delete(dest)) {
|
|
41
|
+
makeCluster(graph, dest, notReached).forEach(n => nodes.add(n));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return nodes;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=cluster.js.map
|
package/dataflow/graph/edge.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* An edge consist of
|
|
3
|
-
*
|
|
4
|
-
* - a type (if it is read or used in the context), and
|
|
2
|
+
* An edge consist of only of the type (source and target are encoded with the Dataflow Graph).
|
|
3
|
+
* Multiple edges are encoded by joining the respective type bits.
|
|
5
4
|
*/
|
|
6
5
|
export interface DataflowGraphEdge {
|
|
7
6
|
types: EdgeTypeBits;
|
|
@@ -59,7 +59,7 @@ export interface DataflowGraphJson {
|
|
|
59
59
|
export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = DataflowGraphVertexInfo, Edge extends DataflowGraphEdge = DataflowGraphEdge> {
|
|
60
60
|
private static DEFAULT_ENVIRONMENT;
|
|
61
61
|
private _idMap;
|
|
62
|
-
private _unknownSideEffects;
|
|
62
|
+
private readonly _unknownSideEffects;
|
|
63
63
|
constructor(idMap: AstIdMap | undefined);
|
|
64
64
|
/** Contains the vertices of the root level graph (i.e., included those vertices from the complete graph, that are nested within function definitions) */
|
|
65
65
|
protected rootVertices: Set<NodeId>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function documentAllServerMessages(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.documentAllServerMessages = documentAllServerMessages;
|
|
4
4
|
const doc_server_message_1 = require("../../doc-util/doc-server-message");
|
|
5
5
|
const message_hello_1 = require("../../../cli/repl/server/messages/message-hello");
|
|
6
6
|
const shell_1 = require("../../../r-bridge/shell");
|
|
@@ -16,9 +16,10 @@ const message_slice_1 = require("../../../cli/repl/server/messages/message-slice
|
|
|
16
16
|
const message_repl_1 = require("../../../cli/repl/server/messages/message-repl");
|
|
17
17
|
const message_query_1 = require("../../../cli/repl/server/messages/message-query");
|
|
18
18
|
const example_query_code_1 = require("../query/example-query-code");
|
|
19
|
-
const call_context_query_format_1 = require("../../../queries/call-context-query/call-context-query-format");
|
|
19
|
+
const call_context_query_format_1 = require("../../../queries/catalog/call-context-query/call-context-query-format");
|
|
20
20
|
const message_lineage_1 = require("../../../cli/repl/server/messages/message-lineage");
|
|
21
|
-
|
|
21
|
+
const doc_structure_1 = require("../../doc-util/doc-structure");
|
|
22
|
+
function documentAllServerMessages() {
|
|
22
23
|
(0, doc_server_message_1.documentServerMessage)({
|
|
23
24
|
title: 'Hello',
|
|
24
25
|
type: 'response',
|
|
@@ -217,9 +218,14 @@ While the context is derived from the \`filename\`, we currently offer no way to
|
|
|
217
218
|
end
|
|
218
219
|
deactivate Server
|
|
219
220
|
`,
|
|
220
|
-
shortDescription:
|
|
221
|
+
shortDescription: `([DEPRECATED](${doc_files_1.FlowrWikiBaseRef}/Query%20API)) The server slices a file based on the given criteria.`,
|
|
221
222
|
text: async (shell) => {
|
|
222
223
|
return `
|
|
224
|
+
${(0, doc_structure_1.block)({
|
|
225
|
+
type: 'WARNING',
|
|
226
|
+
content: `We deprecated the slice request in favor of the \`static-slice\` [Query](${doc_files_1.FlowrWikiBaseRef}/Query%20API).`
|
|
227
|
+
})}
|
|
228
|
+
|
|
223
229
|
To slice, you have to send a file analysis request first. The \`filetoken\` you assign is of use here as you can re-use it to repeatedly slice the same file.
|
|
224
230
|
Besides that, you only need to add an array of slicing criteria, using one of the formats described on the [terminology wiki page](${doc_files_1.FlowrWikiBaseRef}/Terminology#slicing-criterion)
|
|
225
231
|
(however, instead of using \`;\`, you can simply pass separate array elements).
|
|
@@ -461,10 +467,15 @@ See [above](#message-request-file-analysis) for the general structure of the res
|
|
|
461
467
|
end
|
|
462
468
|
deactivate Server
|
|
463
469
|
`,
|
|
464
|
-
shortDescription: 'Obtain the lineage of a given slicing criterion.',
|
|
470
|
+
shortDescription: '([DEPRECATED](${FlowrWikiBaseRef}/Query%20API)) Obtain the lineage of a given slicing criterion.',
|
|
465
471
|
text: async (shell) => {
|
|
466
472
|
return `
|
|
467
473
|
|
|
474
|
+
${(0, doc_structure_1.block)({
|
|
475
|
+
type: 'WARNING',
|
|
476
|
+
content: `We deprecated the lineage request in favor of the \`lineage\` [Query](${doc_files_1.FlowrWikiBaseRef}/Query%20API).`
|
|
477
|
+
})}
|
|
478
|
+
|
|
468
479
|
In order to retrieve the lineage of an object, you have to send a file analysis request first. The \`filetoken\` you assign is of use here as you can re-use it to repeatedly retrieve the lineage of the same file.
|
|
469
480
|
Besides that, you will need to add a [criterion](${doc_files_1.FlowrWikiBaseRef}/Terminology#slicing-criterion) that specifies the object whose lineage you're interested in.
|
|
470
481
|
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.codeBlock = codeBlock;
|
|
4
|
+
exports.jsonWithLimit = jsonWithLimit;
|
|
5
|
+
const json_1 = require("../../util/json");
|
|
4
6
|
function codeBlock(language, code) {
|
|
5
7
|
return `\n\`\`\`${language}\n${code?.trim() ?? ''}\n\`\`\`\n`;
|
|
6
8
|
}
|
|
9
|
+
function jsonWithLimit(object, maxLength = 5_000, tooLongText = '_As the code is pretty long, we inhibit pretty printing and syntax highlighting (JSON):_') {
|
|
10
|
+
const prettyPrinted = JSON.stringify(object, json_1.jsonReplacer, 2);
|
|
11
|
+
return `
|
|
12
|
+
${prettyPrinted.length > maxLength ? tooLongText : ''}
|
|
13
|
+
${codeBlock(prettyPrinted.length > maxLength ? 'text' : 'json', prettyPrinted.length > 5_000 ? JSON.stringify(object, json_1.jsonReplacer) : prettyPrinted)}
|
|
14
|
+
`;
|
|
15
|
+
}
|
|
7
16
|
//# sourceMappingURL=doc-code.js.map
|
|
@@ -10,6 +10,7 @@ export interface PrintDataflowGraphOptions {
|
|
|
10
10
|
readonly codeOpen?: boolean;
|
|
11
11
|
readonly exposeResult?: boolean;
|
|
12
12
|
readonly switchCodeAndGraph?: boolean;
|
|
13
|
+
readonly hideEnvInMermaid?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export declare function printDfGraphForCode(shell: RShell, code: string, options: PrintDataflowGraphOptions & {
|
|
15
16
|
exposeResult: true;
|
|
@@ -11,8 +11,8 @@ const decorate_1 = require("../../r-bridge/lang-4.x/ast/model/processing/decorat
|
|
|
11
11
|
const resolve_graph_1 = require("../../dataflow/graph/resolve-graph");
|
|
12
12
|
const diff_1 = require("../../dataflow/graph/diff");
|
|
13
13
|
const assert_1 = require("../../util/assert");
|
|
14
|
-
const doc_ms_1 = require("./doc-ms");
|
|
15
14
|
const json_1 = require("../../util/json");
|
|
15
|
+
const time_1 = require("../../util/time");
|
|
16
16
|
function printDfGraph(graph, mark) {
|
|
17
17
|
return `
|
|
18
18
|
\`\`\`mermaid
|
|
@@ -24,7 +24,7 @@ ${(0, dfg_1.graphToMermaid)({
|
|
|
24
24
|
\`\`\`
|
|
25
25
|
`;
|
|
26
26
|
}
|
|
27
|
-
async function printDfGraphForCode(shell, code, { mark, showCode = true, codeOpen = false, exposeResult, switchCodeAndGraph = false } = {}) {
|
|
27
|
+
async function printDfGraphForCode(shell, code, { mark, showCode = true, codeOpen = false, exposeResult, switchCodeAndGraph = false, hideEnvInMermaid = false } = {}) {
|
|
28
28
|
const now = performance.now();
|
|
29
29
|
const result = await new pipeline_executor_1.PipelineExecutor(default_pipelines_1.DEFAULT_DATAFLOW_PIPELINE, {
|
|
30
30
|
shell,
|
|
@@ -34,7 +34,7 @@ async function printDfGraphForCode(shell, code, { mark, showCode = true, codeOpe
|
|
|
34
34
|
if (switchCodeAndGraph) {
|
|
35
35
|
(0, assert_1.guard)(showCode, 'can not switch code and graph if code is not shown');
|
|
36
36
|
}
|
|
37
|
-
const metaInfo = `The analysis required _${(0,
|
|
37
|
+
const metaInfo = `The analysis required _${(0, time_1.printAsMs)(duration)}_ (incl. parse and normalize) within the generation environment.`;
|
|
38
38
|
const dfGraph = printDfGraph(result.dataflow.graph, mark);
|
|
39
39
|
let resultText = '\n\n';
|
|
40
40
|
if (showCode) {
|
|
@@ -59,7 +59,8 @@ ${switchCodeAndGraph ? dfGraph : codeText}
|
|
|
59
59
|
\`\`\`
|
|
60
60
|
${(0, dfg_1.graphToMermaid)({
|
|
61
61
|
graph: result.dataflow.graph,
|
|
62
|
-
prefix: 'flowchart LR'
|
|
62
|
+
prefix: 'flowchart LR',
|
|
63
|
+
includeEnvironments: !hideEnvInMermaid
|
|
63
64
|
}).string}
|
|
64
65
|
\`\`\`
|
|
65
66
|
|
|
@@ -10,8 +10,8 @@ const decorate_1 = require("../../r-bridge/lang-4.x/ast/model/processing/decorat
|
|
|
10
10
|
const resolve_graph_1 = require("../../dataflow/graph/resolve-graph");
|
|
11
11
|
const diff_1 = require("../../dataflow/graph/diff");
|
|
12
12
|
const assert_1 = require("../../util/assert");
|
|
13
|
-
const doc_ms_1 = require("./doc-ms");
|
|
14
13
|
const ast_1 = require("../../util/mermaid/ast");
|
|
14
|
+
const time_1 = require("../../util/time");
|
|
15
15
|
function printNormalizedAst(ast, prefix = 'flowchart TD\n') {
|
|
16
16
|
return `
|
|
17
17
|
\`\`\`mermaid
|
|
@@ -26,7 +26,7 @@ async function printNormalizedAstForCode(shell, code, { showCode = true, prefix
|
|
|
26
26
|
request: (0, retriever_1.requestFromInput)(code)
|
|
27
27
|
}).allRemainingSteps();
|
|
28
28
|
const duration = performance.now() - now;
|
|
29
|
-
const metaInfo = `The analysis required _${(0,
|
|
29
|
+
const metaInfo = `The analysis required _${(0, time_1.printAsMs)(duration)}_ (including parsing) within the generation environment.`;
|
|
30
30
|
return '\n\n' + printNormalizedAst(result.normalize.ast, prefix) + (showCode ? `
|
|
31
31
|
<details>
|
|
32
32
|
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { RShell } from '../../r-bridge/shell';
|
|
2
|
-
import type { Queries, SupportedQueryTypes } from '../../queries/query';
|
|
2
|
+
import type { Queries, QueryResults, SupportedQueryTypes } from '../../queries/query';
|
|
3
|
+
import { DEFAULT_DATAFLOW_PIPELINE } from '../../core/steps/pipeline/default-pipelines';
|
|
4
|
+
import { type OutputFormatter } from '../../util/ansi';
|
|
3
5
|
import type { SupportedVirtualQueryTypes } from '../../queries/virtual-query/virtual-queries';
|
|
4
6
|
import type { VirtualCompoundConstraint } from '../../queries/virtual-query/compound-query';
|
|
7
|
+
import type { PipelineOutput } from '../../core/steps/pipeline/pipeline';
|
|
5
8
|
export interface ShowQueryOptions {
|
|
6
9
|
readonly showCode?: boolean;
|
|
7
10
|
readonly collapseResult?: boolean;
|
|
8
11
|
}
|
|
12
|
+
export declare function asciiSummaryOfQueryResult(formatter: OutputFormatter, totalInMs: number, results: QueryResults<SupportedQueryTypes>, processed: PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>): string;
|
|
9
13
|
export declare function showQuery<Base extends SupportedQueryTypes, VirtualArguments extends VirtualCompoundConstraint<Base> = VirtualCompoundConstraint<Base>>(shell: RShell, code: string, queries: Queries<Base, VirtualArguments>, { showCode, collapseResult }?: ShowQueryOptions): Promise<string>;
|
|
10
14
|
export interface QueryDocumentation {
|
|
11
15
|
readonly name: string;
|