@eagleoutice/flowr 2.1.1 → 2.1.2

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.
Files changed (125) hide show
  1. package/README.md +2 -1
  2. package/cli/repl/commands/repl-parse.js +7 -16
  3. package/cli/repl/commands/repl-query.js +72 -3
  4. package/core/print/parse-printer.js +1 -22
  5. package/core/steps/pipeline/default-pipelines.d.ts +64 -0
  6. package/core/steps/pipeline/default-pipelines.js +2 -1
  7. package/dataflow/cluster.d.ts +20 -0
  8. package/dataflow/cluster.js +46 -0
  9. package/dataflow/graph/edge.d.ts +2 -3
  10. package/dataflow/graph/graph.d.ts +1 -1
  11. package/documentation/data/server/doc-data-server-messages.d.ts +1 -1
  12. package/documentation/data/server/doc-data-server-messages.js +10 -4
  13. package/documentation/doc-util/doc-code.d.ts +1 -0
  14. package/documentation/doc-util/doc-code.js +9 -0
  15. package/documentation/doc-util/doc-dfg.d.ts +1 -0
  16. package/documentation/doc-util/doc-dfg.js +5 -4
  17. package/documentation/doc-util/doc-normalized-ast.js +2 -2
  18. package/documentation/doc-util/doc-query.js +5 -7
  19. package/documentation/doc-util/doc-server-message.js +3 -5
  20. package/documentation/doc-util/doc-types.js +19 -11
  21. package/documentation/print-dataflow-graph-wiki.js +10 -1
  22. package/documentation/print-interface-wiki.js +1 -1
  23. package/documentation/print-normalized-ast-wiki.js +2 -2
  24. package/documentation/print-query-wiki.js +164 -37
  25. package/package.json +1 -1
  26. package/queries/{call-context-query → catalog/call-context-query}/call-context-query-executor.d.ts +4 -3
  27. package/queries/{call-context-query → catalog/call-context-query}/call-context-query-executor.js +22 -16
  28. package/queries/{call-context-query → catalog/call-context-query}/call-context-query-format.d.ts +6 -2
  29. package/queries/catalog/cluster-query/cluster-query-executor.d.ts +3 -0
  30. package/queries/catalog/cluster-query/cluster-query-executor.js +19 -0
  31. package/queries/catalog/cluster-query/cluster-query-format.d.ts +12 -0
  32. package/queries/catalog/cluster-query/cluster-query-format.js +3 -0
  33. package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +3 -0
  34. package/queries/catalog/dataflow-query/dataflow-query-executor.js +17 -0
  35. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +12 -0
  36. package/queries/catalog/dataflow-query/dataflow-query-format.js +3 -0
  37. package/queries/catalog/id-map-query/id-map-query-executor.d.ts +3 -0
  38. package/queries/catalog/id-map-query/id-map-query-executor.js +17 -0
  39. package/queries/catalog/id-map-query/id-map-query-format.d.ts +8 -0
  40. package/{r-bridge/lang-4.x/ast/parser/xml/normalizer-data.js → queries/catalog/id-map-query/id-map-query-format.js} +1 -1
  41. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +3 -0
  42. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +17 -0
  43. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +11 -0
  44. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +3 -0
  45. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +4 -0
  46. package/queries/catalog/static-slice-query/static-slice-query-executor.js +40 -0
  47. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +24 -0
  48. package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -0
  49. package/queries/query-schema.d.ts +5 -0
  50. package/queries/query-schema.js +22 -3
  51. package/queries/query.d.ts +19 -4
  52. package/queries/query.js +12 -2
  53. package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +37 -13
  54. package/r-bridge/lang-4.x/ast/parser/json/format.js +59 -6
  55. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +0 -3
  56. package/r-bridge/lang-4.x/ast/parser/json/parser.js +2 -40
  57. package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then-else.d.ts +15 -0
  58. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/control/normalize-if-then-else.js +5 -8
  59. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/control/normalize-if-then.d.ts +7 -7
  60. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/control/normalize-if-then.js +11 -12
  61. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/expression/normalize-expression.d.ts +3 -3
  62. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/expression/normalize-expression.js +4 -7
  63. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-argument.d.ts +2 -2
  64. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-argument.js +3 -3
  65. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-call.d.ts +3 -3
  66. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-call.js +6 -9
  67. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-definition.d.ts +3 -3
  68. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-definition.js +1 -3
  69. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-parameter.d.ts +2 -2
  70. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-parameter.js +6 -5
  71. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-break.d.ts +2 -2
  72. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-for.d.ts +2 -2
  73. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-for.js +5 -6
  74. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-next.d.ts +2 -2
  75. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-repeat.d.ts +2 -2
  76. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.d.ts +4 -0
  77. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-while.js +4 -4
  78. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/normalize-access.d.ts +3 -3
  79. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/normalize-access.js +1 -2
  80. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/operators/normalize-binary.d.ts +2 -2
  81. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/operators/normalize-binary.js +2 -2
  82. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/operators/normalize-unary.d.ts +2 -2
  83. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-comment.d.ts +3 -3
  84. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-comment.js +1 -1
  85. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-line-directive.d.ts +3 -3
  86. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-line-directive.js +1 -1
  87. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-delimiter.d.ts +3 -0
  88. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.d.ts +10 -0
  89. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-root.d.ts +2 -2
  90. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-root.js +3 -4
  91. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-single-node.d.ts +2 -2
  92. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-single-node.js +2 -2
  93. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-number.d.ts +3 -3
  94. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-number.js +1 -1
  95. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-string.d.ts +3 -3
  96. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-string.js +1 -1
  97. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-symbol.d.ts +3 -3
  98. package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-symbol.js +1 -3
  99. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +41 -0
  100. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +85 -0
  101. package/r-bridge/lang-4.x/ast/parser/{xml → main}/normalizer-data.d.ts +10 -4
  102. package/r-bridge/lang-4.x/ast/parser/main/normalizer-data.js +14 -0
  103. package/slicing/criterion/parse.d.ts +1 -1
  104. package/statistics/summarizer/post-process/clusterer.d.ts +1 -1
  105. package/util/ansi.js +9 -2
  106. package/util/time.d.ts +4 -0
  107. package/util/time.js +8 -0
  108. package/util/version.js +1 -1
  109. package/documentation/doc-util/doc-ms.d.ts +0 -1
  110. package/documentation/doc-util/doc-ms.js +0 -8
  111. package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +0 -39
  112. package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +0 -38
  113. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/normalize-if-then-else.d.ts +0 -15
  114. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-while.d.ts +0 -4
  115. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-delimiter.d.ts +0 -3
  116. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-expressions.d.ts +0 -10
  117. package/r-bridge/lang-4.x/ast/parser/xml/normalize-meta.d.ts +0 -47
  118. package/r-bridge/lang-4.x/ast/parser/xml/normalize-meta.js +0 -110
  119. /package/queries/{call-context-query → catalog/call-context-query}/call-context-query-format.js +0 -0
  120. /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-break.js +0 -0
  121. /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-next.js +0 -0
  122. /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-repeat.js +0 -0
  123. /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/operators/normalize-unary.js +0 -0
  124. /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-delimiter.js +0 -0
  125. /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-expressions.js +0 -0
@@ -37,14 +37,19 @@ function dropGenericsFromType(type) {
37
37
  return type;
38
38
  }
39
39
  function removeCommentSymbols(comment) {
40
- return comment.replace(/^\/\*\*?/, '').replace(/\*\/$/, '').replace(/^\s*\*/, '').trim();
40
+ return comment
41
+ // remove '/** \n * \n */...
42
+ .replace(/^\/\*\*?/gm, '').replace(/^\s*\*\s*/gm, '').replace(/\*\/$/gm, '').replace(/^\s*\*/gm, '')
43
+ /* replace {@key foo|bar} with `bar` and {@key foo} with `foo` */
44
+ .replace(/\{@[a-zA-Z]+ ([^}]+\|)?(?<name>[^}]+)}/gm, '<code>$<name></code>')
45
+ .trim();
41
46
  }
42
47
  function getTextualComments(node) {
43
48
  const comments = typescript_1.default.getJSDocCommentsAndTags(node);
44
49
  const out = [];
45
50
  for (const { comment } of comments) {
46
51
  if (typeof comment === 'string') {
47
- out.push(comment);
52
+ out.push(removeCommentSymbols(comment));
48
53
  }
49
54
  else if (comment !== undefined) {
50
55
  for (const c of comment) {
@@ -62,6 +67,7 @@ function getType(node, typeChecker) {
62
67
  const tryDirect = typeChecker.getTypeAtLocation(node);
63
68
  return tryDirect ? typeChecker.typeToString(tryDirect) : 'unknown';
64
69
  }
70
+ const defaultSkip = ['Pick', 'Partial', 'Required', 'Readonly', 'Omit', 'DeepPartial', 'DeepReadonly', 'DeepWritable', 'StrictOmit'];
65
71
  function followTypeReference(type, sourceFile) {
66
72
  const node = type.typeName;
67
73
  if (typescript_1.default.isQualifiedName(node)) {
@@ -69,10 +75,11 @@ function followTypeReference(type, sourceFile) {
69
75
  }
70
76
  const args = type.typeArguments?.map(arg => arg.getText(sourceFile)) ?? [];
71
77
  const nodeLexeme = node.getText(sourceFile) ?? '';
72
- if (['Pick', 'Partial', 'Required', 'Readonly', 'Omit'].map(s => nodeLexeme.startsWith(s))) {
73
- return args;
78
+ const baseLexeme = type.getText(sourceFile) ?? '';
79
+ if (defaultSkip.map(s => nodeLexeme.startsWith(s))) {
80
+ return [baseLexeme, ...args];
74
81
  }
75
- return [nodeLexeme, ...args];
82
+ return [nodeLexeme, baseLexeme, ...args];
76
83
  }
77
84
  function collectHierarchyInformation(sourceFiles, options) {
78
85
  const hierarchyList = [];
@@ -112,7 +119,7 @@ function collectHierarchyInformation(sourceFiles, options) {
112
119
  .map(dropGenericsFromType);
113
120
  }
114
121
  else if (typescript_1.default.isTypeReferenceNode(node.type)) {
115
- baseTypes = [...followTypeReference(node.type, sourceFile)];
122
+ baseTypes = [...followTypeReference(node.type, sourceFile)].map(dropGenericsFromType);
116
123
  }
117
124
  const generics = node.typeParameters?.map(param => param.getText(sourceFile) ?? '') ?? [];
118
125
  hierarchyList.push({
@@ -129,7 +136,7 @@ function collectHierarchyInformation(sourceFiles, options) {
129
136
  else if (typescript_1.default.isEnumDeclaration(node)) {
130
137
  const enumName = node.name?.getText(sourceFile) ?? '';
131
138
  hierarchyList.push({
132
- name: enumName,
139
+ name: dropGenericsFromType(enumName),
133
140
  node,
134
141
  kind: 'enum',
135
142
  extends: [],
@@ -178,9 +185,10 @@ function generateMermaidClassDiagram(hierarchyList, rootName, options, visited =
178
185
  }
179
186
  }
180
187
  collect.nodeLines.push(`click ${node.name} href "${getTypePathLink(node)}" "${(0, mermaid_1.escapeMarkdown)(node.comments?.join('; ').replace(/\n/g, ' ') ?? '')}"`);
188
+ const inline = [...options.inlineTypes ?? [], ...defaultSkip];
181
189
  if (node.extends.length > 0) {
182
190
  for (const baseType of node.extends) {
183
- if (options.inlineTypes?.includes(baseType)) {
191
+ if (inline.includes(baseType)) {
184
192
  const info = hierarchyList.find(h => h.name === baseType);
185
193
  for (const property of info?.properties ?? []) {
186
194
  if (!writtenProperties.has(property)) {
@@ -191,10 +199,10 @@ function generateMermaidClassDiagram(hierarchyList, rootName, options, visited =
191
199
  }
192
200
  else {
193
201
  if (node.kind === 'type' || hierarchyList.find(h => h.name === baseType)?.kind === 'type') {
194
- collect.edgeLines.push(`${baseType} .. ${node.name}`);
202
+ collect.edgeLines.push(`${dropGenericsFromType(baseType)} .. ${node.name}`);
195
203
  }
196
204
  else {
197
- collect.edgeLines.push(`${baseType} <|-- ${node.name}`);
205
+ collect.edgeLines.push(`${dropGenericsFromType(baseType)} <|-- ${node.name}`);
198
206
  }
199
207
  const { nodeLines, edgeLines } = generateMermaidClassDiagram(hierarchyList, baseType, options, visited);
200
208
  collect.nodeLines.push(...nodeLines);
@@ -243,7 +251,7 @@ function implSnippet(node, program, nesting = 0) {
243
251
  const bold = node.kind === 'interface' || node.kind === 'enum' ? '**' : '';
244
252
  const sep = node.comments ? ' \n' : '\n';
245
253
  let text = node.comments?.join('\n') ?? '';
246
- const code = node.node.getText(program.getSourceFile(node.node.getSourceFile().fileName));
254
+ const code = node.node.getFullText(program.getSourceFile(node.node.getSourceFile().fileName));
247
255
  text += `\n<details><summary style="color:gray">Defined at <a href="${getTypePathLink(node)}">${getTypePathLink(node, '.')}</a></summary>\n\n${(0, doc_code_1.codeBlock)('ts', code)}\n\n</details>\n`;
248
256
  return `${indent} * ${bold}[${node.name}](${getTypePathLink(node)})${bold} ${sep}${indent} ${text.replaceAll('\t', ' ').split(/\n/g).join(`\n${indent} `)}`;
249
257
  }
@@ -615,6 +615,13 @@ What to do if you encounter this vertex?
615
615
 
616
616
  This depends on your analysis. To handle many real-world sources correctly you are probably fine with just ignoring it.
617
617
  Yet, you may choose to follow these references for other queries. For now, _flowR's_ support for non-standard evaluation is limited.
618
+
619
+ Besides the obvious quotation there are other cases in which _flowR_ may choose to create a ${linkEdgeName(edge_1.EdgeType.NonStandardEvaluation)} edge, there are
620
+ some that may appear to be counter-intuitive. For example, a for-loop body, as in the following example.
621
+
622
+ ${(0, doc_structure_1.details)('Example: For-Loop Body', await (0, doc_dfg_1.printDfGraphForCode)(shell, 'for(i in v) b', { mark: new Set([2, '4->2']) }))}
623
+ ${(0, doc_structure_1.details)('Example: While-Loop Body', await (0, doc_dfg_1.printDfGraphForCode)(shell, 'while(TRUE) b', { mark: new Set([1, '3->1']) }))}
624
+
618
625
  `
619
626
  })}
620
627
  `,
@@ -674,7 +681,9 @@ Additionally, you may be interested in the set of [Unknown Side Effects](#unknow
674
681
  > [!TIP]
675
682
  > If you want to investigate the dataflow graph,
676
683
  > you can either use the [Visual Studio Code extension](${doc_files_1.FlowrGithubBaseRef}/vscode-flowr) or the ${(0, doc_cli_option_1.getReplCommand)('dataflow*')}
677
- > command in the REPL (see the [Interface wiki page](${doc_files_1.FlowrWikiBaseRef}/Interface) for more information).
684
+ > command in the REPL (see the [Interface wiki page](${doc_files_1.FlowrWikiBaseRef}/Interface) for more information). When using _flowR_ as a library, you may use the functions in ${(0, doc_files_1.getFilePathMd)('../util/mermaid/dfg.ts')}.
685
+ >
686
+ > If you receive a dataflow graph in its serialized form (e.g., by talking to a [_flowR_ server](${doc_files_1.FlowrWikiBaseRef}/Interface)), you can use \`${graph_1.DataflowGraph.name}::${graph_1.DataflowGraph.fromJson.name}\` to retrieve the graph from the JSON representation.
678
687
 
679
688
  ${await (0, doc_dfg_1.printDfGraphForCode)(shell, 'x <- 3\ny <- x + 1\ny')}
680
689
 
@@ -19,7 +19,7 @@ const flowr_main_options_1 = require("../cli/flowr-main-options");
19
19
  const doc_issue_1 = require("./doc-util/doc-issue");
20
20
  const pipeline_executor_1 = require("../core/pipeline-executor");
21
21
  async function explainServer(shell) {
22
- (0, doc_data_server_messages_1.documentAllMessages)();
22
+ (0, doc_data_server_messages_1.documentAllServerMessages)();
23
23
  return `
24
24
  As explained in the [Overview](${doc_files_1.FlowrWikiBaseRef}/Overview), you can simply run the [TCP](https://de.wikipedia.org/wiki/Transmission_Control_Protocol)&nbsp;server by adding the ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'server', true)} flag (and, due to the interactive mode, exit with the conventional <kbd>CTRL</kbd>+<kbd>C</kbd>).
25
25
  Currently, every connection is handled by the same underlying \`${shell_1.RShell.name}\` - so the server is not designed to handle many clients at a time.
@@ -11,8 +11,8 @@ const doc_normalized_ast_1 = require("./doc-util/doc-normalized-ast");
11
11
  const doc_types_1 = require("./doc-util/doc-types");
12
12
  const path_1 = __importDefault(require("path"));
13
13
  const doc_files_1 = require("./doc-util/doc-files");
14
- const doc_ms_1 = require("./doc-util/doc-ms");
15
14
  const doc_cli_option_1 = require("./doc-util/doc-cli-option");
15
+ const time_1 = require("../util/time");
16
16
  async function getText(shell) {
17
17
  const rversion = (await shell.usedRVersion())?.format() ?? 'unknown';
18
18
  const now = performance.now();
@@ -67,7 +67,7 @@ Grayed-out parts are used for structuring the AST, grouping together related nod
67
67
 
68
68
  ${(0, doc_code_1.codeBlock)('mermaid', types.text)}
69
69
 
70
- _The generation of the class diagram required ${(0, doc_ms_1.printAsMs)(elapsed)}._
70
+ _The generation of the class diagram required ${(0, time_1.printAsMs)(elapsed)}._
71
71
  </details>
72
72
 
73
73
  Node types are controlled by the \`${'RType'}\` enum (see ${(0, doc_files_1.getFilePathMd)('../r-bridge/lang-4.x/ast/model/type.ts')}),
@@ -6,36 +6,41 @@ const log_1 = require("../../test/functionality/_helper/log");
6
6
  const query_1 = require("../queries/query");
7
7
  const doc_files_1 = require("./doc-util/doc-files");
8
8
  const doc_query_1 = require("./doc-util/doc-query");
9
- const call_context_query_format_1 = require("../queries/call-context-query/call-context-query-format");
9
+ const call_context_query_format_1 = require("../queries/catalog/call-context-query/call-context-query-format");
10
10
  const schema_1 = require("../util/schema");
11
11
  const query_schema_1 = require("../queries/query-schema");
12
12
  const ansi_1 = require("../util/ansi");
13
- const call_context_query_executor_1 = require("../queries/call-context-query/call-context-query-executor");
13
+ const call_context_query_executor_1 = require("../queries/catalog/call-context-query/call-context-query-executor");
14
14
  const compound_query_1 = require("../queries/virtual-query/compound-query");
15
15
  const doc_auto_gen_1 = require("./doc-util/doc-auto-gen");
16
16
  const example_query_code_1 = require("./data/query/example-query-code");
17
17
  const doc_structure_1 = require("./doc-util/doc-structure");
18
18
  const doc_code_1 = require("./doc-util/doc-code");
19
+ const dataflow_query_executor_1 = require("../queries/catalog/dataflow-query/dataflow-query-executor");
20
+ const id_map_query_executor_1 = require("../queries/catalog/id-map-query/id-map-query-executor");
21
+ const normalized_ast_query_executor_1 = require("../queries/catalog/normalized-ast-query/normalized-ast-query-executor");
22
+ const cluster_query_executor_1 = require("../queries/catalog/cluster-query/cluster-query-executor");
23
+ const static_slice_query_executor_1 = require("../queries/catalog/static-slice-query/static-slice-query-executor");
19
24
  (0, doc_query_1.registerQueryDocumentation)('call-context', {
20
25
  name: 'Call-Context Query',
21
26
  type: 'active',
22
27
  shortDescription: 'Finds all calls in a set of files that matches specified criteria.',
23
28
  functionName: call_context_query_executor_1.executeCallContextQueries.name,
24
- functionFile: '../queries/call-context-query/call-context-query-executor.ts',
29
+ functionFile: '../queries/catalog/call-context-query/call-context-query-executor.ts',
25
30
  buildExplanation: async (shell) => {
26
31
  return `
27
- Call context queries may be used to identify calls to specific functions that match criteria of your interest.
32
+ Call context queries can be used to identify calls to specific functions that match criteria of your interest.
28
33
  For now, we support two criteria:
29
34
 
30
- 1. **Function Name** (\`callName\`): The function name is specified by a regular expression. This allows you to find all calls to functions that match a specific pattern.
35
+ 1. **Function Name** (\`callName\`): The function name is specified by a regular expression. This allows you to find all calls to functions that match a specific pattern. Please note, that if you do not use Regex-Anchors, the query will match any function name that contains the given pattern (you can set the \`callNameExact\` property to \`true\` to automatically add the \`^...$\` anchors).
31
36
  2. **Call Targets** (\`callTargets\`): This specifies to what the function call targets. For example, you may want to find all calls to a function that is not defined locally.
32
37
 
33
- Besides this we provide the following ways to automatically categorize and link identified invocations:
38
+ Besides this, we provide the following ways to automatically categorize and link identified invocations:
34
39
 
35
40
  1. **Kind** (\`kind\`): This is a general category that can be used to group calls together. For example, you may want to link all calls to \`plot\` to \`visualize\`.
36
41
  2. **Subkind** (\`subkind\`): This is used to uniquely identify the respective call type when grouping the output. For example, you may want to link all calls to \`ggplot\` to \`plot\`.
37
42
  3. **Linked Calls** (\`linkTo\`): This links the current call to the last call of the given kind. This way, you can link a call like \`points\` to the latest graphics plot etc.
38
- For now, we _only_offer support for linking to the last call_ as the current flow dependency over-approximation is not stable.
43
+ For now, we _only_ offer support for linking to the last call, as the current flow dependency over-approximation is not stable.
39
44
  4. **Aliases** (\`includeAliases\`): Consider a case like \`f <- function_of_interest\`, do you want calls to \`f\` to be included in the results? There is probably no need to combine this with a global call target!
40
45
 
41
46
  Re-using the example code from above, the following query attaches all calls to \`mean\` to the kind \`visualize\` and the subkind \`text\`,
@@ -78,6 +83,89 @@ my_test_function()
78
83
  `;
79
84
  }
80
85
  });
86
+ (0, doc_query_1.registerQueryDocumentation)('dataflow', {
87
+ name: 'Dataflow Query',
88
+ type: 'active',
89
+ shortDescription: 'Returns the dataflow graph of the given code.',
90
+ functionName: dataflow_query_executor_1.executeDataflowQuery.name,
91
+ functionFile: '../queries/catalog/dataflow-query/dataflow-query-executor.ts',
92
+ buildExplanation: async (shell) => {
93
+ const exampleCode = 'x + 1';
94
+ return `
95
+ Maybe you want to handle only the result of the query execution, or you just need the [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph) again.
96
+ This query type does exactly that!
97
+
98
+ Using the example code \`${exampleCode}\`, the following query returns the dataflow graph of the code:
99
+ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
100
+ type: 'dataflow'
101
+ }], { showCode: true })}
102
+ `;
103
+ }
104
+ });
105
+ (0, doc_query_1.registerQueryDocumentation)('normalized-ast', {
106
+ name: 'Normalized AST Query',
107
+ type: 'active',
108
+ shortDescription: 'Returns the normalized AST of the given code.',
109
+ functionName: normalized_ast_query_executor_1.executeNormalizedAstQuery.name,
110
+ functionFile: '../queries/catalog/normalized-ast-query/normalized-ast-query-executor.ts',
111
+ buildExplanation: async (shell) => {
112
+ const exampleCode = 'x + 1';
113
+ return `
114
+ Maybe you want to handle only the result of the query execution, or you just need the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized%20AST) again.
115
+ This query type does exactly that!
116
+
117
+ Using the example code \`${exampleCode}\`, the following query returns the normalized AST of the code:
118
+ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
119
+ type: 'normalized-ast'
120
+ }], { showCode: true })}
121
+ `;
122
+ }
123
+ });
124
+ (0, doc_query_1.registerQueryDocumentation)('dataflow-cluster', {
125
+ name: 'Dataflow Cluster Query',
126
+ type: 'active',
127
+ shortDescription: 'Calculates and returns all the clusters present in the dataflow graph.',
128
+ functionName: cluster_query_executor_1.executeDataflowClusterQuery.name,
129
+ functionFile: '../queries/catalog/cluster-query/cluster-query-executor.ts',
130
+ buildExplanation: async (shell) => {
131
+ const exampleA = 'x <- 1; x';
132
+ const exampleB = 'x <- 1; y';
133
+ return `
134
+ This query automatically calculates clusters in flowR's dataflow graph
135
+ and returns a list of all clusters found.
136
+ Clusters are to be interpreted as literal clusters on the graph traversing
137
+ edges in both directions. From this perspective,
138
+ the code \`${exampleA}\` has one cluster (given that all code is related),
139
+ while the code \`${exampleB}\` has two clusters (given that the \`y\` has no relation to the previous definition).
140
+
141
+ ${(0, doc_structure_1.details)('Example <code>' + exampleA + '</code>', await (0, doc_query_1.showQuery)(shell, exampleA, [{ type: 'dataflow-cluster' }], { showCode: false }))}
142
+ ${(0, doc_structure_1.details)('Example <code>' + exampleB + '</code>', await (0, doc_query_1.showQuery)(shell, exampleB, [{ type: 'dataflow-cluster' }], { showCode: false }))}
143
+
144
+ Using the example code from above, the following query returns all clusters:
145
+ ${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [{
146
+ type: 'dataflow-cluster'
147
+ }], { showCode: false })}
148
+ `;
149
+ }
150
+ });
151
+ (0, doc_query_1.registerQueryDocumentation)('id-map', {
152
+ name: 'Id-Map Query',
153
+ type: 'active',
154
+ shortDescription: 'Returns the id-map of the normalized AST of the given code.',
155
+ functionName: id_map_query_executor_1.executeIdMapQuery.name,
156
+ functionFile: '../queries/catalog/id-map-query/id-map-query-executor.ts',
157
+ buildExplanation: async (shell) => {
158
+ const exampleCode = 'x + 1';
159
+ return `
160
+ This query provides access to all nodes in the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized%20AST) as a mapping from their id to the node itself.
161
+
162
+ Using the example code \`${exampleCode}\`, the following query returns all nodes from the code:
163
+ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
164
+ type: 'id-map'
165
+ }], { showCode: true })}
166
+ `;
167
+ }
168
+ });
81
169
  (0, doc_query_1.registerQueryDocumentation)('compound', {
82
170
  name: 'Compound Query',
83
171
  type: 'virtual',
@@ -113,7 +201,7 @@ ${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode,
113
201
  ], { showCode: false, collapseResult: true })}
114
202
 
115
203
  However, compound queries become more useful whenever common arguments can not be expressed as a union in one of their properties.
116
- Additionally, you can still overwrite default arguments.
204
+ Additionally, you can still overwrite default arguments.
117
205
  In the following, we (by default) want all calls to not resolve to a local definition, except for those to \`print\` for which we explicitly
118
206
  want to resolve to a local definition:
119
207
 
@@ -127,8 +215,45 @@ ${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode,
127
215
  ]
128
216
  }], { showCode: false })}
129
217
 
130
- Now, the results no longer contain calls to \`plot\` that are not defined locally.
218
+ Now, the results no longer contain calls to \`plot\` that are not defined locally.
219
+
220
+ `;
221
+ }
222
+ });
223
+ (0, doc_query_1.registerQueryDocumentation)('static-slice', {
224
+ name: 'Static Slice Query',
225
+ type: 'active',
226
+ shortDescription: 'Slice the dataflow graph reducing the code to just the parts relevant for the given criteria.',
227
+ functionName: static_slice_query_executor_1.executeStaticSliceClusterQuery.name,
228
+ functionFile: '../queries/catalog/static-slice-query/static-slice-query-executor.ts',
229
+ buildExplanation: async (shell) => {
230
+ const exampleCode = 'x <- 1\ny <- 2\nx';
231
+ return `
232
+ To slice, _flowR_ needs one thing from you: a variable or a list of variables (function calls are supported to, referring to the anonymous
233
+ return of the call) that you want to slice the dataflow graph for.
234
+ Given this, the slice is essentially the subpart of the program that may influence the value of the variables you are interested in.
235
+ To specify a variable of interest, you have to present flowR with a [slicing criterion](${doc_files_1.FlowrWikiBaseRef}/Terminology#slicing-criterion) (or, respectively, an array of them).
236
+
237
+ To exemplify the capabilities, consider the following code:
238
+ ${(0, doc_code_1.codeBlock)('r', exampleCode)}
239
+ If you are interested in the parts required for the use of \`x\` in the last line, you can use the following query:
240
+
241
+ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
242
+ type: 'static-slice',
243
+ criteria: ['3@x']
244
+ }], { showCode: false })}
245
+
246
+ In general you may be uninterested in seeing the reconstructed version and want to save some computation time, for this,
247
+ you can use the \`noReconstruction\` flag.
131
248
 
249
+ ${(0, doc_structure_1.details)('No Reconstruction Example', await (0, doc_query_1.showQuery)(shell, exampleCode, [{
250
+ type: 'static-slice',
251
+ criteria: ['3@x'],
252
+ noReconstruction: true
253
+ }], { showCode: false }))}
254
+
255
+ You can disable [magic comments](${doc_files_1.FlowrWikiBaseRef}/Interface#slice-magic-comments) using the \`noMagicComments\` flag.
256
+ This query replaces the old [\`request-slice\`](${doc_files_1.FlowrWikiBaseRef}/Interface#message-request-slice) message.
132
257
  `;
133
258
  }
134
259
  });
@@ -139,6 +264,36 @@ async function getText(shell) {
139
264
  This page briefly summarizes flowR's query API, represented by the ${query_1.executeQueries.name} function in ${(0, doc_files_1.getFilePathMd)('../queries/query.ts')}.
140
265
  Please see the [Interface](${doc_files_1.FlowrWikiBaseRef}/Interface) wiki page for more information on how to access this API.
141
266
 
267
+ ## The Query Format
268
+
269
+ Queries are JSON arrays of query objects, each of which uses a \`type\` property to specify the query type.
270
+ In general, we separate two types of queries:
271
+
272
+ 1. **Active Queries**: Are exactly what you would expect from a query (e.g., the [Call-Context Query](#call-context-query)). They fetch information from the dataflow graph.
273
+ 2. **Virtual Queries**: Are used to structure your queries (e.g., the [Compound Query](#compound-query)).
274
+
275
+ We separate these from a concept perspective.
276
+ For now, we support the following **active** queries (which we will refer to simply as a \`query\`):
277
+
278
+ ${(0, doc_query_1.tocForQueryType)('active')}
279
+
280
+ Similarly, we support the following **virtual** queries:
281
+
282
+ ${(0, doc_query_1.tocForQueryType)('virtual')}
283
+
284
+ <details>
285
+
286
+
287
+ <summary>Detailed Query Format (Automatically Generated)</summary>
288
+
289
+ Although it is probably better to consult the detailed explanations below, if you want to have a look at the scehma, here is its description:
290
+
291
+ ${(0, schema_1.describeSchema)(query_schema_1.QueriesSchema, ansi_1.markdownFormatter)}
292
+
293
+ </details>
294
+
295
+ ### Why Queries?
296
+
142
297
  First, consider that you have a file like the following (of course, this is just a simple and artificial example):
143
298
 
144
299
  \`\`\`r
@@ -168,34 +323,6 @@ Just as an example, the following [Call-Context Query](#call-context-query) find
168
323
 
169
324
  ${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [{ type: 'call-context', callName: '^read_csv$', callTargets: call_context_query_format_1.CallTargets.OnlyGlobal, kind: 'input', subkind: 'csv-file' }], { showCode: false })}
170
325
 
171
- ## The Query Format
172
-
173
- Queries are JSON arrays of query objects, each of which uses a \`type\` property to specify the query type.
174
- In general, we separate two types of queries:
175
-
176
- 1. **Active Queries**: Are exactly what you would expect from a query (e.g., the [Call-Context Query](#call-context-query)). They fetch information from the dataflow graph.
177
- 2. **Virtual Queries**: Are used to structure your queries (e.g., the [Compound Query](#compound-query)).
178
-
179
- We separate these from a concept perspective.
180
- For now, we support the following **active** queries (which we will refer to simply as a \`query\`):
181
-
182
- ${(0, doc_query_1.tocForQueryType)('active')}
183
-
184
- Similarly, we support the following **virtual** queries:
185
-
186
- ${(0, doc_query_1.tocForQueryType)('virtual')}
187
-
188
- <details>
189
-
190
-
191
- <summary>Detailed Query Format (Automatically Generated)</summary>
192
-
193
- Although it is probably better to consult the detailed explanations below, if you want to have a look at the scehma, here is its description:
194
-
195
- ${(0, schema_1.describeSchema)(query_schema_1.QueriesSchema, ansi_1.markdownFormatter)}
196
-
197
- </details>
198
-
199
326
  ${await (0, doc_query_1.explainQueries)(shell, 'active')}
200
327
 
201
328
  ${await (0, doc_query_1.explainQueries)(shell, 'virtual')}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eagleoutice/flowr",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "repository": {
@@ -1,11 +1,12 @@
1
1
  import type { CallContextQuery, CallContextQueryResult } from './call-context-query-format';
2
- import type { BasicQueryData } from '../query';
2
+ import type { BasicQueryData } from '../../query';
3
3
  /**
4
4
  * Multi-stage call context query resolve.
5
5
  *
6
6
  * 1. Resolve all calls in the DF graph that match the respective {@link DefaultCallContextQueryFormat#callName} regex.
7
- * 2. Identify their respective call targets, if {@link DefaultCallContextQueryFormat#callTargets} is set to be non-any.
7
+ * 2. If there is an alias attached, consider all call traces.
8
+ * 3. Identify their respective call targets, if {@link DefaultCallContextQueryFormat#callTargets} is set to be non-any.
8
9
  * This happens during the main resolution!
9
- * 3. Attach `linkTo` calls to the respective calls.
10
+ * 4. Attach `linkTo` calls to the respective calls.
10
11
  */
11
12
  export declare function executeCallContextQueries({ graph, ast }: BasicQueryData, queries: readonly CallContextQuery[]): CallContextQueryResult;
@@ -2,17 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeCallContextQueries = executeCallContextQueries;
4
4
  const call_context_query_format_1 = require("./call-context-query-format");
5
- const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
6
- const vertex_1 = require("../../dataflow/graph/vertex");
7
- const assert_1 = require("../../util/assert");
8
- const edge_1 = require("../../dataflow/graph/edge");
9
- const resolve_by_name_1 = require("../../dataflow/environments/resolve-by-name");
10
- const built_in_1 = require("../../dataflow/environments/built-in");
11
- const cfg_1 = require("../../util/cfg/cfg");
12
- const two_layer_collector_1 = require("../two-layer-collector");
13
- const objects_1 = require("../../util/objects");
14
- const visitor_1 = require("../../util/cfg/visitor");
15
- const identifier_1 = require("../../dataflow/environments/identifier");
5
+ const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
6
+ const vertex_1 = require("../../../dataflow/graph/vertex");
7
+ const assert_1 = require("../../../util/assert");
8
+ const edge_1 = require("../../../dataflow/graph/edge");
9
+ const resolve_by_name_1 = require("../../../dataflow/environments/resolve-by-name");
10
+ const built_in_1 = require("../../../dataflow/environments/built-in");
11
+ const cfg_1 = require("../../../util/cfg/cfg");
12
+ const two_layer_collector_1 = require("../../two-layer-collector");
13
+ const objects_1 = require("../../../util/objects");
14
+ const visitor_1 = require("../../../util/cfg/visitor");
15
+ const identifier_1 = require("../../../dataflow/environments/identifier");
16
16
  function satisfiesCallTargets(id, graph, callTarget) {
17
17
  const callVertex = graph.get(id);
18
18
  if (callVertex === undefined || callVertex[0].tag !== vertex_1.VertexType.FunctionCall) {
@@ -35,7 +35,7 @@ function satisfiesCallTargets(id, graph, callTarget) {
35
35
  * including any potential built-in mapping.
36
36
  */
37
37
  const reResolved = (0, resolve_by_name_1.resolveByName)(info.name, info.environment, identifier_1.ReferenceType.Unknown);
38
- if (reResolved && reResolved.some(t => t.definedAt === built_in_1.BuiltIn)) {
38
+ if (reResolved?.some(t => t.definedAt === built_in_1.BuiltIn)) {
39
39
  builtIn = true;
40
40
  }
41
41
  }
@@ -92,6 +92,9 @@ function makeReport(collector) {
92
92
  function isSubCallQuery(query) {
93
93
  return 'linkTo' in query;
94
94
  }
95
+ function exactCallNameRegex(name) {
96
+ return new RegExp(`^${name}$`);
97
+ }
95
98
  function promoteQueryCallNames(queries) {
96
99
  let requiresCfg = false;
97
100
  const promotedQueries = queries.map(q => {
@@ -99,7 +102,8 @@ function promoteQueryCallNames(queries) {
99
102
  requiresCfg = true;
100
103
  return {
101
104
  ...q,
102
- callName: new RegExp(q.callName),
105
+ callName: q.callNameExact ? exactCallNameRegex(q.callName)
106
+ : new RegExp(q.callName),
103
107
  linkTo: {
104
108
  ...q.linkTo,
105
109
  /* we have to add another promotion layer whenever we add something without this call name */
@@ -110,7 +114,8 @@ function promoteQueryCallNames(queries) {
110
114
  else {
111
115
  return {
112
116
  ...q,
113
- callName: new RegExp(q.callName)
117
+ callName: q.callNameExact ? exactCallNameRegex(q.callName)
118
+ : new RegExp(q.callName)
114
119
  };
115
120
  }
116
121
  });
@@ -186,9 +191,10 @@ function retrieveAllCallAliases(nodeId, graph) {
186
191
  * Multi-stage call context query resolve.
187
192
  *
188
193
  * 1. Resolve all calls in the DF graph that match the respective {@link DefaultCallContextQueryFormat#callName} regex.
189
- * 2. Identify their respective call targets, if {@link DefaultCallContextQueryFormat#callTargets} is set to be non-any.
194
+ * 2. If there is an alias attached, consider all call traces.
195
+ * 3. Identify their respective call targets, if {@link DefaultCallContextQueryFormat#callTargets} is set to be non-any.
190
196
  * This happens during the main resolution!
191
- * 3. Attach `linkTo` calls to the respective calls.
197
+ * 4. Attach `linkTo` calls to the respective calls.
192
198
  */
193
199
  function executeCallContextQueries({ graph, ast }, queries) {
194
200
  /* omit performance page load */
@@ -1,5 +1,5 @@
1
- import type { BaseQueryFormat, BaseQueryResult } from '../base-query-format';
2
- import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
1
+ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
2
+ import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
3
3
  export declare enum CallTargets {
4
4
  /** call targets a function that is not defined locally (e.g., the call targets a library function) */
5
5
  OnlyGlobal = "global",
@@ -16,6 +16,10 @@ export interface DefaultCallContextQueryFormat<CallName extends RegExp | string>
16
16
  readonly type: 'call-context';
17
17
  /** Regex regarding the function name, please note that strings will be interpreted as regular expressions too! */
18
18
  readonly callName: CallName;
19
+ /**
20
+ * Should we automatically add the `^` and `$` anchors to the regex to make it an exact match?
21
+ */
22
+ readonly callNameExact?: boolean;
19
23
  /** kind may be a step or anything that you attach to the call, this can be used to group calls together (e.g., linking `ggplot` to `visualize`). Defaults to `.` */
20
24
  readonly kind?: string;
21
25
  /** subkinds are used to uniquely identify the respective call type when grouping the output (e.g., the normalized name, linking `ggplot` to `plot`). Defaults to `.` */
@@ -0,0 +1,3 @@
1
+ import type { BasicQueryData } from '../../query';
2
+ import type { DataflowClusterQuery, DataflowClusterQueryResult } from './cluster-query-format';
3
+ export declare function executeDataflowClusterQuery({ graph }: BasicQueryData, queries: readonly DataflowClusterQuery[]): DataflowClusterQueryResult;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeDataflowClusterQuery = executeDataflowClusterQuery;
4
+ const log_1 = require("../../../util/log");
5
+ const cluster_1 = require("../../../dataflow/cluster");
6
+ function executeDataflowClusterQuery({ graph }, queries) {
7
+ if (queries.length !== 1) {
8
+ log_1.log.warn('The dataflow cluster query expects only up to one query, but got', queries.length);
9
+ }
10
+ const start = Date.now();
11
+ const clusters = (0, cluster_1.findAllClusters)(graph);
12
+ return {
13
+ '.meta': {
14
+ timing: Date.now() - start
15
+ },
16
+ clusters
17
+ };
18
+ }
19
+ //# sourceMappingURL=cluster-query-executor.js.map
@@ -0,0 +1,12 @@
1
+ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
2
+ import type { DataflowGraphClusters } from '../../../dataflow/cluster';
3
+ /**
4
+ * Calculates and returns all clusters encountered in the dataflow graph.
5
+ */
6
+ export interface DataflowClusterQuery extends BaseQueryFormat {
7
+ readonly type: 'dataflow-cluster';
8
+ }
9
+ export interface DataflowClusterQueryResult extends BaseQueryResult {
10
+ /** All clusters found in the respective dataflow */
11
+ readonly clusters: DataflowGraphClusters;
12
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=cluster-query-format.js.map
@@ -0,0 +1,3 @@
1
+ import type { BasicQueryData } from '../../query';
2
+ import type { DataflowQuery, DataflowQueryResult } from './dataflow-query-format';
3
+ export declare function executeDataflowQuery({ graph }: BasicQueryData, queries: readonly DataflowQuery[]): DataflowQueryResult;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeDataflowQuery = executeDataflowQuery;
4
+ const log_1 = require("../../../util/log");
5
+ function executeDataflowQuery({ graph }, queries) {
6
+ if (queries.length !== 1) {
7
+ log_1.log.warn('Dataflow query expects only up to one query, but got', queries.length);
8
+ }
9
+ return {
10
+ '.meta': {
11
+ /* there is no sense in measuring a get */
12
+ timing: 0
13
+ },
14
+ graph
15
+ };
16
+ }
17
+ //# sourceMappingURL=dataflow-query-executor.js.map
@@ -0,0 +1,12 @@
1
+ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
2
+ import type { DataflowGraph } from '../../../dataflow/graph/graph';
3
+ /**
4
+ * Simple re-returns the dataflow graph of the analysis.
5
+ */
6
+ export interface DataflowQuery extends BaseQueryFormat {
7
+ readonly type: 'dataflow';
8
+ }
9
+ export interface DataflowQueryResult extends BaseQueryResult {
10
+ /** Please be aware that this is the graph in its JSON representation, use {@link DataflowGraph#fromJson} if the result is serialized */
11
+ readonly graph: DataflowGraph;
12
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=dataflow-query-format.js.map
@@ -0,0 +1,3 @@
1
+ import type { BasicQueryData } from '../../query';
2
+ import type { IdMapQuery, IdMapQueryResult } from './id-map-query-format';
3
+ export declare function executeIdMapQuery({ ast }: BasicQueryData, queries: readonly IdMapQuery[]): IdMapQueryResult;