@eagleoutice/flowr 2.5.0 → 2.6.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.
Files changed (223) hide show
  1. package/README.md +57 -42
  2. package/cli/flowr.js +3 -29
  3. package/cli/repl/commands/repl-cfg.d.ts +5 -5
  4. package/cli/repl/commands/repl-cfg.js +21 -22
  5. package/cli/repl/commands/repl-commands.d.ts +3 -3
  6. package/cli/repl/commands/repl-commands.js +2 -0
  7. package/cli/repl/commands/repl-dataflow.d.ts +5 -5
  8. package/cli/repl/commands/repl-dataflow.js +27 -30
  9. package/cli/repl/commands/repl-execute.js +1 -0
  10. package/cli/repl/commands/repl-lineage.js +1 -0
  11. package/cli/repl/commands/repl-main.d.ts +34 -3
  12. package/cli/repl/commands/repl-normalize.d.ts +3 -3
  13. package/cli/repl/commands/repl-normalize.js +15 -19
  14. package/cli/repl/commands/repl-parse.d.ts +2 -2
  15. package/cli/repl/commands/repl-parse.js +13 -8
  16. package/cli/repl/commands/repl-query.d.ts +3 -3
  17. package/cli/repl/commands/repl-query.js +29 -19
  18. package/cli/repl/commands/repl-quit.js +1 -0
  19. package/cli/repl/commands/repl-version.js +1 -0
  20. package/cli/repl/core.d.ts +4 -1
  21. package/cli/repl/core.js +21 -1
  22. package/cli/repl/server/connection.d.ts +7 -3
  23. package/cli/repl/server/connection.js +40 -48
  24. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  25. package/cli/slicer-app.js +1 -1
  26. package/config.d.ts +1 -1
  27. package/config.js +4 -1
  28. package/control-flow/extract-cfg.d.ts +1 -1
  29. package/control-flow/extract-cfg.js +1 -1
  30. package/core/pipeline-executor.d.ts +5 -0
  31. package/core/pipeline-executor.js +5 -0
  32. package/core/steps/pipeline/create-pipeline.js +1 -1
  33. package/core/steps/pipeline/default-pipelines.d.ts +42 -42
  34. package/core/steps/pipeline/default-pipelines.js +4 -1
  35. package/dataflow/graph/dataflowgraph-builder.d.ts +11 -12
  36. package/dataflow/graph/dataflowgraph-builder.js +6 -6
  37. package/documentation/doc-util/doc-query.d.ts +3 -6
  38. package/documentation/doc-util/doc-query.js +5 -17
  39. package/documentation/doc-util/doc-search.js +7 -10
  40. package/documentation/doc-util/doc-structure.d.ts +4 -0
  41. package/documentation/doc-util/doc-structure.js +28 -0
  42. package/documentation/doc-util/doc-types.d.ts +5 -1
  43. package/documentation/doc-util/doc-types.js +29 -3
  44. package/documentation/print-analyzer-wiki.d.ts +1 -0
  45. package/documentation/print-analyzer-wiki.js +137 -0
  46. package/documentation/print-core-wiki.d.ts +2 -1
  47. package/documentation/print-core-wiki.js +58 -4
  48. package/documentation/print-dataflow-graph-wiki.js +15 -22
  49. package/documentation/print-interface-wiki.js +18 -1
  50. package/documentation/print-linter-wiki.js +5 -1
  51. package/documentation/print-normalized-ast-wiki.js +6 -8
  52. package/engines.d.ts +9 -0
  53. package/engines.js +38 -0
  54. package/linter/linter-executor.d.ts +2 -8
  55. package/linter/linter-executor.js +9 -4
  56. package/linter/linter-format.d.ts +8 -9
  57. package/linter/linter-rules.d.ts +57 -15
  58. package/linter/linter-rules.js +2 -0
  59. package/linter/rules/absolute-path.d.ts +1 -0
  60. package/linter/rules/dataframe-access-validation.d.ts +4 -3
  61. package/linter/rules/dataframe-access-validation.js +7 -4
  62. package/linter/rules/dead-code.d.ts +2 -1
  63. package/linter/rules/deprecated-functions.d.ts +15 -28
  64. package/linter/rules/deprecated-functions.js +5 -43
  65. package/linter/rules/file-path-validity.d.ts +2 -1
  66. package/linter/rules/file-path-validity.js +1 -1
  67. package/linter/rules/function-finder-util.d.ts +51 -0
  68. package/linter/rules/function-finder-util.js +77 -0
  69. package/linter/rules/naming-convention.d.ts +2 -1
  70. package/linter/rules/network-functions.d.ts +40 -0
  71. package/linter/rules/network-functions.js +24 -0
  72. package/linter/rules/seeded-randomness.d.ts +2 -1
  73. package/linter/rules/unused-definition.d.ts +2 -1
  74. package/linter/rules/useless-loop.d.ts +3 -2
  75. package/linter/rules/useless-loop.js +4 -6
  76. package/package.json +2 -1
  77. package/project/cache/flowr-analyzer-cache.d.ts +93 -0
  78. package/project/cache/flowr-analyzer-cache.js +156 -0
  79. package/project/cache/flowr-cache.d.ts +28 -0
  80. package/project/cache/flowr-cache.js +49 -0
  81. package/project/context/abstract-flowr-analyzer-context.d.ts +35 -0
  82. package/project/context/abstract-flowr-analyzer-context.js +46 -0
  83. package/project/context/flowr-analyzer-context.d.ts +48 -0
  84. package/project/context/flowr-analyzer-context.js +47 -0
  85. package/project/context/flowr-analyzer-dependencies-context.d.ts +38 -0
  86. package/project/context/flowr-analyzer-dependencies-context.js +39 -0
  87. package/project/context/flowr-analyzer-files-context.d.ts +86 -0
  88. package/project/context/flowr-analyzer-files-context.js +130 -0
  89. package/project/context/flowr-analyzer-loading-order-context.d.ts +76 -0
  90. package/project/context/flowr-analyzer-loading-order-context.js +90 -0
  91. package/project/context/flowr-file.d.ts +89 -0
  92. package/project/context/flowr-file.js +78 -0
  93. package/project/flowr-analyzer-builder.d.ts +106 -0
  94. package/project/flowr-analyzer-builder.js +197 -0
  95. package/project/flowr-analyzer.d.ts +125 -0
  96. package/project/flowr-analyzer.js +81 -0
  97. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +17 -0
  98. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +28 -0
  99. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +21 -0
  100. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +34 -0
  101. package/project/plugins/file-plugins/flowr-description-file.d.ts +24 -0
  102. package/project/plugins/file-plugins/flowr-description-file.js +38 -0
  103. package/project/plugins/flowr-analyzer-plugin.d.ts +90 -0
  104. package/project/plugins/flowr-analyzer-plugin.js +82 -0
  105. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +14 -0
  106. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +56 -0
  107. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.d.ts +13 -0
  108. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +33 -0
  109. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +14 -0
  110. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +41 -0
  111. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
  112. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +29 -0
  113. package/project/plugins/package-version-plugins/package.d.ts +15 -0
  114. package/project/plugins/package-version-plugins/package.js +56 -0
  115. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +15 -0
  116. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +44 -0
  117. package/queries/base-query-format.d.ts +2 -8
  118. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
  119. package/queries/catalog/call-context-query/call-context-query-executor.js +20 -13
  120. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -3
  121. package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
  122. package/queries/catalog/cluster-query/cluster-query-executor.d.ts +1 -1
  123. package/queries/catalog/cluster-query/cluster-query-executor.js +2 -2
  124. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -54
  125. package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
  126. package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
  127. package/queries/catalog/config-query/config-query-executor.js +5 -5
  128. package/queries/catalog/config-query/config-query-format.d.ts +1 -1
  129. package/queries/catalog/config-query/config-query-format.js +1 -1
  130. package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
  131. package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -3
  132. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -54
  133. package/queries/catalog/control-flow-query/control-flow-query-format.js +2 -2
  134. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.d.ts +1 -1
  135. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -2
  136. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -54
  137. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -1
  138. package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +1 -1
  139. package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
  140. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -54
  141. package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -1
  142. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -1
  143. package/queries/catalog/dependencies-query/dependencies-query-executor.js +19 -12
  144. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +7 -56
  145. package/queries/catalog/dependencies-query/dependencies-query-format.js +7 -4
  146. package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +1 -1
  147. package/queries/catalog/df-shape-query/df-shape-query-executor.js +4 -4
  148. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +1 -54
  149. package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
  150. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
  151. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
  152. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -54
  153. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -1
  154. package/queries/catalog/id-map-query/id-map-query-executor.d.ts +1 -1
  155. package/queries/catalog/id-map-query/id-map-query-executor.js +2 -2
  156. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -54
  157. package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
  158. package/queries/catalog/lineage-query/lineage-query-executor.d.ts +1 -1
  159. package/queries/catalog/lineage-query/lineage-query-executor.js +2 -2
  160. package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -54
  161. package/queries/catalog/lineage-query/lineage-query-format.js +1 -1
  162. package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
  163. package/queries/catalog/linter-query/linter-query-executor.js +2 -3
  164. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -54
  165. package/queries/catalog/linter-query/linter-query-format.js +1 -1
  166. package/queries/catalog/location-map-query/location-map-query-executor.d.ts +1 -1
  167. package/queries/catalog/location-map-query/location-map-query-executor.js +3 -2
  168. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  169. package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
  170. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +1 -1
  171. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -2
  172. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -54
  173. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -1
  174. package/queries/catalog/origin-query/origin-query-executor.d.ts +2 -2
  175. package/queries/catalog/origin-query/origin-query-executor.js +3 -3
  176. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -54
  177. package/queries/catalog/origin-query/origin-query-format.js +1 -1
  178. package/queries/catalog/project-query/project-query-executor.d.ts +1 -1
  179. package/queries/catalog/project-query/project-query-executor.js +2 -2
  180. package/queries/catalog/project-query/project-query-format.d.ts +1 -54
  181. package/queries/catalog/project-query/project-query-format.js +1 -1
  182. package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
  183. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -2
  184. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -54
  185. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
  186. package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
  187. package/queries/catalog/search-query/search-query-executor.js +3 -3
  188. package/queries/catalog/search-query/search-query-format.d.ts +1 -54
  189. package/queries/catalog/search-query/search-query-format.js +1 -1
  190. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
  191. package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -3
  192. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -54
  193. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -1
  194. package/queries/query-print.d.ts +4 -4
  195. package/queries/query-print.js +12 -12
  196. package/queries/query.d.ts +29 -885
  197. package/queries/query.js +1 -1
  198. package/r-bridge/retriever.d.ts +6 -5
  199. package/r-bridge/retriever.js +9 -5
  200. package/search/flowr-search-executor.d.ts +3 -5
  201. package/search/flowr-search-executor.js +6 -4
  202. package/search/flowr-search-filters.d.ts +12 -6
  203. package/search/flowr-search-filters.js +1 -1
  204. package/search/flowr-search.d.ts +5 -16
  205. package/search/flowr-search.js +14 -5
  206. package/search/search-executor/search-enrichers.d.ts +37 -36
  207. package/search/search-executor/search-enrichers.js +4 -4
  208. package/search/search-executor/search-generators.d.ts +12 -12
  209. package/search/search-executor/search-generators.js +27 -19
  210. package/search/search-executor/search-mappers.d.ts +5 -5
  211. package/search/search-executor/search-transformer.d.ts +17 -17
  212. package/search/search-executor/search-transformer.js +14 -7
  213. package/util/collections/arrays.d.ts +1 -0
  214. package/util/collections/arrays.js +15 -0
  215. package/util/collections/objectmap.d.ts +17 -0
  216. package/util/collections/objectmap.js +28 -0
  217. package/util/containers.d.ts +0 -1
  218. package/util/containers.js +0 -1
  219. package/util/files.d.ts +17 -0
  220. package/util/files.js +65 -0
  221. package/util/formats/adapter.d.ts +4 -2
  222. package/util/formats/adapter.js +11 -4
  223. package/util/version.js +1 -1
@@ -1,6 +1,7 @@
1
1
  import type { OutputFormatter } from '../../../util/text/ansi';
2
2
  import type { KnownParser } from '../../../r-bridge/parser';
3
3
  import type { FlowrConfigOptions } from '../../../config';
4
+ import type { FlowrAnalysisProvider } from '../../../project/flowr-analyzer';
4
5
  /**
5
6
  * Defines the main interface for output of the repl.
6
7
  * This allows us to redirect it (e.g., in the case of a server connection or tests).
@@ -20,20 +21,29 @@ export interface ReplOutput {
20
21
  */
21
22
  export declare const standardReplOutput: ReplOutput;
22
23
  /**
23
- * Information passed to each repl command function
24
+ * Information passed to each {@link ReplCommand#fn}.
24
25
  */
25
26
  export interface ReplCommandInformation {
26
27
  output: ReplOutput;
28
+ allowRSessionAccess: boolean;
27
29
  parser: KnownParser;
28
30
  remainingLine: string;
29
- allowRSessionAccess: boolean;
30
31
  config: FlowrConfigOptions;
31
32
  }
33
+ /**
34
+ * Information passed to each {@link ReplCodeCommand#fn}.
35
+ * The {@link analyzer} has the {@link RParseRequest}.
36
+ */
37
+ export interface ReplCodeCommandInformation {
38
+ output: ReplOutput;
39
+ analyzer: FlowrAnalysisProvider;
40
+ remainingArgs: string[];
41
+ }
32
42
  /**
33
43
  * Content of a single command in the repl.
34
44
  * The command may execute an external script or simply call *flowR* functions.
35
45
  */
36
- export interface ReplCommand {
46
+ export interface ReplBaseCommand {
37
47
  /** Aliases of the command (without the leading colon), every alias must be unique (this is checked at runtime) */
38
48
  aliases: string[];
39
49
  /** A human-readable description of what the command does */
@@ -42,9 +52,30 @@ export interface ReplCommand {
42
52
  script: boolean;
43
53
  /** Example of how to use the command, for example `:slicer --help` */
44
54
  usageExample: string;
55
+ }
56
+ export interface ReplCommand extends ReplBaseCommand {
57
+ usesAnalyzer: false;
45
58
  /**
46
59
  * Function to execute when the command is invoked, it must not write to the command line but instead use the output handler.
47
60
  * Furthermore, it has to obey the formatter defined in the {@link ReplOutput}.
48
61
  */
49
62
  fn: (info: ReplCommandInformation) => Promise<void> | void;
50
63
  }
64
+ /**
65
+ * Repl command that uses the {@link FlowrAnalyzer}
66
+ */
67
+ export interface ReplCodeCommand extends ReplBaseCommand {
68
+ usesAnalyzer: true;
69
+ /**
70
+ * Function to execute when the command is invoked, it must not write to the command line but instead use the output handler.
71
+ * Furthermore, it has to obey the formatter defined in the {@link ReplOutput}.
72
+ */
73
+ fn: (info: ReplCodeCommandInformation) => Promise<void> | void;
74
+ /**
75
+ * Argument parser function which handles the input given after the repl command
76
+ */
77
+ argsParser: (remainingLine: string) => {
78
+ input: string;
79
+ remaining: string[];
80
+ };
81
+ }
@@ -1,3 +1,3 @@
1
- import type { ReplCommand } from './repl-main';
2
- export declare const normalizeCommand: ReplCommand;
3
- export declare const normalizeStarCommand: ReplCommand;
1
+ import type { ReplCodeCommand } from './repl-main';
2
+ export declare const normalizeCommand: ReplCodeCommand;
3
+ export declare const normalizeStarCommand: ReplCodeCommand;
@@ -34,51 +34,47 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.normalizeStarCommand = exports.normalizeCommand = void 0;
37
- const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
38
37
  const retriever_1 = require("../../../r-bridge/retriever");
39
38
  const ast_1 = require("../../../util/mermaid/ast");
40
39
  const ansi_1 = require("../../../util/text/ansi");
41
- async function normalize(parser, remainingLine, config) {
42
- return await (0, default_pipelines_1.createNormalizePipeline)(parser, {
43
- request: (0, retriever_1.requestFromInput)(remainingLine.trim())
44
- }, config).allRemainingSteps();
45
- }
46
- function handleString(code) {
47
- return code.startsWith('"') ? JSON.parse(code) : code;
48
- }
49
- function formatInfo(out, type, timing) {
50
- return out.formatter.format(`Copied ${type} to clipboard (normalize: ${timing}ms).`, { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground, style: 3 /* FontStyles.Italic */ });
40
+ const core_1 = require("../core");
41
+ function formatInfo(out, type, meta) {
42
+ return out.formatter.format(`Copied ${type} to clipboard (normalize: ${meta['.meta'].timing + 'ms'}).`, { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground, style: 3 /* FontStyles.Italic */ });
51
43
  }
52
44
  exports.normalizeCommand = {
53
45
  description: `Get mermaid code for the normalized AST of R code, start with '${retriever_1.fileProtocol}' to indicate a file`,
46
+ usesAnalyzer: true,
54
47
  usageExample: ':normalize',
55
48
  aliases: ['n'],
56
49
  script: false,
57
- fn: async ({ output, parser, remainingLine, config }) => {
58
- const result = await normalize(parser, handleString(remainingLine), config);
59
- const mermaid = (0, ast_1.normalizedAstToMermaid)(result.normalize.ast);
50
+ argsParser: (args) => (0, core_1.handleString)(args),
51
+ fn: async ({ output, analyzer }) => {
52
+ const result = await analyzer.normalize();
53
+ const mermaid = (0, ast_1.normalizedAstToMermaid)(result.ast);
60
54
  output.stdout(mermaid);
61
55
  try {
62
56
  const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
63
57
  clipboard.default.writeSync(mermaid);
64
- output.stdout(formatInfo(output, 'mermaid url', result.normalize['.meta'].timing));
58
+ output.stdout(formatInfo(output, 'mermaid url', result));
65
59
  }
66
60
  catch { /* do nothing this is a service thing */ }
67
61
  }
68
62
  };
69
63
  exports.normalizeStarCommand = {
70
64
  description: 'Returns the URL to mermaid.live',
65
+ usesAnalyzer: true,
71
66
  usageExample: ':normalize*',
72
67
  aliases: ['n*'],
73
68
  script: false,
74
- fn: async ({ output, parser, remainingLine, config }) => {
75
- const result = await normalize(parser, handleString(remainingLine), config);
76
- const mermaid = (0, ast_1.normalizedAstToMermaidUrl)(result.normalize.ast);
69
+ argsParser: (args) => (0, core_1.handleString)(args),
70
+ fn: async ({ output, analyzer }) => {
71
+ const result = await analyzer.normalize();
72
+ const mermaid = (0, ast_1.normalizedAstToMermaidUrl)(result.ast);
77
73
  output.stdout(mermaid);
78
74
  try {
79
75
  const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
80
76
  clipboard.default.writeSync(mermaid);
81
- output.stdout(formatInfo(output, 'mermaid url', result.normalize['.meta'].timing));
77
+ output.stdout(formatInfo(output, 'mermaid url', result));
82
78
  }
83
79
  catch { /* do nothing this is a service thing */ }
84
80
  }
@@ -1,2 +1,2 @@
1
- import type { ReplCommand } from './repl-main';
2
- export declare const parseCommand: ReplCommand;
1
+ import type { ReplCodeCommand } from './repl-main';
2
+ export declare const parseCommand: ReplCodeCommand;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseCommand = void 0;
4
4
  const format_1 = require("../../../r-bridge/lang-4.x/ast/parser/json/format");
5
5
  const normalize_meta_1 = require("../../../r-bridge/lang-4.x/ast/parser/main/normalize-meta");
6
- const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
7
6
  const retriever_1 = require("../../../r-bridge/retriever");
8
7
  function toDepthMap(entry) {
9
8
  const visit = [{ depth: 0, node: entry }];
@@ -127,20 +126,26 @@ function depthListToTextTree(list, f) {
127
126
  }
128
127
  exports.parseCommand = {
129
128
  description: `Prints ASCII Art of the parsed, unmodified AST, start with '${retriever_1.fileProtocol}' to indicate a file`,
129
+ usesAnalyzer: true,
130
130
  usageExample: ':parse',
131
131
  aliases: ['p'],
132
132
  script: false,
133
- fn: async ({ output, parser, remainingLine, config }) => {
134
- const result = await (0, default_pipelines_1.createParsePipeline)(parser, {
135
- request: (0, retriever_1.requestFromInput)((0, retriever_1.removeRQuotes)(remainingLine.trim()))
136
- }, config).allRemainingSteps();
137
- if (parser.name === 'r-shell') {
138
- const object = (0, format_1.convertPreparedParsedData)((0, format_1.prepareParsedData)(result.parse.parsed));
133
+ argsParser: (line) => {
134
+ return {
135
+ // Threat the whole input line as R code
136
+ input: (0, retriever_1.removeRQuotes)(line.trim()),
137
+ remaining: []
138
+ };
139
+ },
140
+ fn: async ({ output, analyzer }) => {
141
+ const result = await analyzer.parse();
142
+ if (analyzer.parserName() === 'r-shell') {
143
+ const object = (0, format_1.convertPreparedParsedData)((0, format_1.prepareParsedData)(result.parsed));
139
144
  output.stdout(depthListToTextTree(toDepthMap(object), output.formatter));
140
145
  }
141
146
  else {
142
147
  // print the tree-sitter ast
143
- output.stdout(depthListToTextTree(treeSitterToDepthList(result.parse.parsed.rootNode), output.formatter));
148
+ output.stdout(depthListToTextTree(treeSitterToDepthList(result.parsed.rootNode), output.formatter));
144
149
  }
145
150
  }
146
151
  };
@@ -1,3 +1,3 @@
1
- import type { ReplCommand } from './repl-main';
2
- export declare const queryCommand: ReplCommand;
3
- export declare const queryStarCommand: ReplCommand;
1
+ import type { ReplCodeCommand } from './repl-main';
2
+ export declare const queryCommand: ReplCodeCommand;
3
+ export declare const queryStarCommand: ReplCodeCommand;
@@ -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
- const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
5
4
  const retriever_1 = require("../../../r-bridge/retriever");
6
5
  const args_1 = require("../../../util/text/args");
7
6
  const ansi_1 = require("../../../util/text/ansi");
@@ -9,11 +8,6 @@ const schema_1 = require("../../../util/schema");
9
8
  const query_1 = require("../../../queries/query");
10
9
  const json_1 = require("../../../util/json");
11
10
  const query_print_1 = require("../../../queries/query-print");
12
- async function getDataflow(config, parser, remainingLine) {
13
- return await (0, default_pipelines_1.createDataflowPipeline)(parser, {
14
- request: (0, retriever_1.requestFromInput)(remainingLine.trim())
15
- }, config).allRemainingSteps();
16
- }
17
11
  function printHelp(output) {
18
12
  output.stderr(`Format: ${(0, ansi_1.italic)(':query "<query>" <code>', output.formatter)}`);
19
13
  output.stdout('The query is an array of query objects to represent multiple queries. Each query object may have the following properties:');
@@ -24,9 +18,8 @@ function printHelp(output) {
24
18
  output.stdout('Similarly, \'@<type>\' is interpreted as a query of the given type.');
25
19
  output.stdout(`With this, ${(0, ansi_1.italic)(':query @config', output.formatter)} prints the result of the config query.`);
26
20
  }
27
- async function processQueryArgs(line, parser, output, config) {
28
- const args = (0, args_1.splitAtEscapeSensitive)(line);
29
- const query = args.shift();
21
+ async function processQueryArgs(output, analyzer, remainingArgs) {
22
+ const query = remainingArgs.shift();
30
23
  if (!query) {
31
24
  output.stderr('No query provided, use \':query help\' to get more information.');
32
25
  return;
@@ -35,12 +28,12 @@ async function processQueryArgs(line, parser, output, config) {
35
28
  printHelp(output);
36
29
  return;
37
30
  }
38
- let parsedQuery = [];
31
+ let parsedQuery;
39
32
  if (query.startsWith('@')) {
40
33
  const queryName = query.slice(1);
41
34
  const queryObj = query_1.SupportedQueries[queryName];
42
35
  if (queryObj?.fromLine) {
43
- const q = queryObj.fromLine(args, config);
36
+ const q = queryObj.fromLine(remainingArgs, analyzer.flowrConfig);
44
37
  parsedQuery = q ? (Array.isArray(q) ? q : [q]) : [];
45
38
  }
46
39
  else {
@@ -65,34 +58,51 @@ async function processQueryArgs(line, parser, output, config) {
65
58
  else {
66
59
  parsedQuery = [{ type: 'call-context', callName: query }];
67
60
  }
68
- const processed = await getDataflow(config, parser, args.join(' '));
69
61
  return {
62
+ query: await (0, query_1.executeQueries)({
63
+ analyzer,
64
+ }, parsedQuery),
70
65
  parsedQuery,
71
- query: await Promise.resolve((0, query_1.executeQueries)({ dataflow: processed.dataflow, ast: processed.normalize, config }, parsedQuery)),
72
- processed
66
+ analyzer
67
+ };
68
+ }
69
+ /**
70
+ * Function for splitting the input line.
71
+ * The first token is the query command.
72
+ * The rest of the line is treated as input code.
73
+ */
74
+ function parseArgs(line) {
75
+ const args = (0, args_1.splitAtEscapeSensitive)(line);
76
+ return {
77
+ input: args.join(' ').trim(),
78
+ remaining: args
73
79
  };
74
80
  }
75
81
  exports.queryCommand = {
76
82
  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).`,
83
+ usesAnalyzer: true,
77
84
  usageExample: ':query "<query>" <code>',
78
85
  aliases: [],
79
86
  script: false,
80
- fn: async ({ output, parser, remainingLine, config }) => {
87
+ argsParser: parseArgs,
88
+ fn: async ({ output, analyzer, remainingArgs }) => {
81
89
  const totalStart = Date.now();
82
- const results = await processQueryArgs(remainingLine, parser, output, config);
90
+ const results = await processQueryArgs(output, analyzer, remainingArgs);
83
91
  const totalEnd = Date.now();
84
92
  if (results) {
85
- output.stdout((0, query_print_1.asciiSummaryOfQueryResult)(ansi_1.ansiFormatter, totalEnd - totalStart, results.query, results.processed, results.parsedQuery));
93
+ output.stdout(await (0, query_print_1.asciiSummaryOfQueryResult)(ansi_1.ansiFormatter, totalEnd - totalStart, results.query, results.analyzer, results.parsedQuery));
86
94
  }
87
95
  }
88
96
  };
89
97
  exports.queryStarCommand = {
90
98
  description: 'Similar to query, but returns the output in json format.',
99
+ usesAnalyzer: true,
91
100
  usageExample: ':query* <query> <code>',
92
101
  aliases: [],
93
102
  script: false,
94
- fn: async ({ output, parser, remainingLine, config }) => {
95
- const results = await processQueryArgs(remainingLine, parser, output, config);
103
+ argsParser: parseArgs,
104
+ fn: async ({ output, analyzer, remainingArgs }) => {
105
+ const results = await processQueryArgs(output, analyzer, remainingArgs);
96
106
  if (results) {
97
107
  output.stdout(JSON.stringify(results.query, json_1.jsonReplacer));
98
108
  }
@@ -4,6 +4,7 @@ exports.quitCommand = void 0;
4
4
  const log_1 = require("../../../util/log");
5
5
  exports.quitCommand = {
6
6
  description: 'End the repl',
7
+ usesAnalyzer: false,
7
8
  aliases: ['q', 'exit'],
8
9
  usageExample: ':quit',
9
10
  script: false,
@@ -21,6 +21,7 @@ async function printVersionInformation(output, parser) {
21
21
  }
22
22
  exports.versionCommand = {
23
23
  description: 'Prints the version of flowR as well as the current version of R',
24
+ usesAnalyzer: false,
24
25
  aliases: [],
25
26
  usageExample: ':version',
26
27
  script: false,
@@ -8,6 +8,10 @@ import type { FlowrConfigOptions } from '../../config';
8
8
  */
9
9
  export declare function replCompleter(line: string, config: FlowrConfigOptions): [string[], string];
10
10
  export declare function makeDefaultReplReadline(config: FlowrConfigOptions): readline.ReadLineOptions;
11
+ export declare function handleString(code: string): {
12
+ input: string;
13
+ remaining: never[];
14
+ };
11
15
  /**
12
16
  * This function interprets the given `expr` as a REPL command (see {@link repl} for more on the semantics).
13
17
  *
@@ -27,7 +31,6 @@ export interface FlowrReplOptions extends MergeableRecord {
27
31
  /**
28
32
  * A potentially customized readline interface to be used for the repl to *read* from the user, we write the output with the {@link ReplOutput | `output` } interface.
29
33
  * If you want to provide a custom one but use the same `completer`, refer to {@link replCompleter}.
30
- * For the default arguments, see {@link DEFAULT_REPL_READLINE_CONFIGURATION}.
31
34
  */
32
35
  readonly rl?: readline.Interface;
33
36
  /** Defines two methods that every function in the repl uses to output its data. */
package/cli/repl/core.js CHANGED
@@ -38,6 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.replCompleter = replCompleter;
40
40
  exports.makeDefaultReplReadline = makeDefaultReplReadline;
41
+ exports.handleString = handleString;
41
42
  exports.replProcessAnswer = replProcessAnswer;
42
43
  exports.repl = repl;
43
44
  exports.loadReplHistory = loadReplHistory;
@@ -61,6 +62,7 @@ const shell_1 = require("../../r-bridge/shell");
61
62
  const log_1 = require("../../util/log");
62
63
  const config_1 = require("../../config");
63
64
  const query_1 = require("../../queries/query");
65
+ const flowr_analyzer_builder_1 = require("../../project/flowr-analyzer-builder");
64
66
  let _replCompleterKeywords = undefined;
65
67
  function replCompleterKeywords() {
66
68
  if (_replCompleterKeywords === undefined) {
@@ -129,6 +131,12 @@ function makeDefaultReplReadline(config) {
129
131
  completer: (c) => replCompleter(c, config)
130
132
  };
131
133
  }
134
+ function handleString(code) {
135
+ return {
136
+ input: code.startsWith('"') ? JSON.parse(code) : code,
137
+ remaining: []
138
+ };
139
+ }
132
140
  async function replProcessStatement(output, statement, parser, allowRSessionAccess, config) {
133
141
  if (statement.startsWith(':')) {
134
142
  const command = statement.slice(1).split(' ')[0].toLowerCase();
@@ -136,7 +144,19 @@ async function replProcessStatement(output, statement, parser, allowRSessionAcce
136
144
  const bold = (s) => output.formatter.format(s, { style: 1 /* FontStyles.Bold */ });
137
145
  if (processor) {
138
146
  try {
139
- await processor.fn({ output, parser, remainingLine: statement.slice(command.length + 2).trim(), allowRSessionAccess, config });
147
+ const remainingLine = statement.slice(command.length + 2).trim();
148
+ if (processor.usesAnalyzer) {
149
+ const args = processor.argsParser(remainingLine);
150
+ const request = (0, retriever_1.requestFromInput)(args.input);
151
+ const analyzer = await new flowr_analyzer_builder_1.FlowrAnalyzerBuilder(request)
152
+ .setConfig(config)
153
+ .setParser(parser)
154
+ .build();
155
+ await processor.fn({ output, analyzer, remainingArgs: args.remaining });
156
+ }
157
+ else {
158
+ await processor.fn({ output, parser, remainingLine, allowRSessionAccess, config });
159
+ }
140
160
  }
141
161
  catch (e) {
142
162
  output.stdout(`${bold(`Failed to execute command ${command}`)}: ${e?.message}. Using the ${bold('--verbose')} flag on startup may provide additional information.\n`);
@@ -1,9 +1,13 @@
1
1
  import type { Socket } from './net';
2
+ import type { TREE_SITTER_DATAFLOW_PIPELINE } from '../../../core/steps/pipeline/default-pipelines';
2
3
  import { DEFAULT_SLICING_PIPELINE } from '../../../core/steps/pipeline/default-pipelines';
3
4
  import type { PipelineOutput } from '../../../core/steps/pipeline/pipeline';
4
5
  import type { DeepPartial } from 'ts-essentials';
5
- import type { KnownParser } from '../../../r-bridge/parser';
6
+ import type { KnownParser, ParseStepOutput } from '../../../r-bridge/parser';
6
7
  import type { FlowrConfigOptions } from '../../../config';
8
+ import type { NormalizedAst } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
9
+ import type { DataflowInformation } from '../../../dataflow/info';
10
+ import type { Tree } from 'web-tree-sitter';
7
11
  /**
8
12
  * Each connection handles a single client, answering to its requests.
9
13
  * There is no need to construct this class manually, {@link FlowRServer} will do it for you.
@@ -21,10 +25,10 @@ export declare class FlowRServerConnection {
21
25
  private handleData;
22
26
  private handleFileAnalysisRequest;
23
27
  private sendFileAnalysisResponse;
24
- private createPipelineExecutorForRequest;
28
+ private createAnalyzerForRequest;
25
29
  private handleSliceRequest;
26
30
  private handleRepl;
27
31
  private handleLineageRequest;
28
32
  private handleQueryRequest;
29
33
  }
30
- export declare function sanitizeAnalysisResults(results: Partial<PipelineOutput<typeof DEFAULT_SLICING_PIPELINE>>): DeepPartial<PipelineOutput<typeof DEFAULT_SLICING_PIPELINE>>;
34
+ export declare function sanitizeAnalysisResults(parse: ParseStepOutput<string | Tree>, normalize: NormalizedAst, dataflow: DataflowInformation): DeepPartial<PipelineOutput<typeof DEFAULT_SLICING_PIPELINE | typeof TREE_SITTER_DATAFLOW_PIPELINE>>;
@@ -48,20 +48,20 @@ const core_1 = require("../core");
48
48
  const extract_cfg_1 = require("../../../control-flow/extract-cfg");
49
49
  const quads_1 = require("../../../util/quads");
50
50
  const print_1 = require("../../../core/print/print");
51
+ const _00_parse_1 = require("../../../core/steps/all/core/00-parse");
52
+ const _10_normalize_1 = require("../../../core/steps/all/core/10-normalize");
53
+ const _20_dataflow_1 = require("../../../core/steps/all/core/20-dataflow");
51
54
  const ansi_1 = require("../../../util/text/ansi");
52
55
  const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
53
56
  const graph_1 = require("../../../dataflow/graph/graph");
54
57
  const tmp = __importStar(require("tmp"));
55
58
  const fs_1 = __importDefault(require("fs"));
56
- const magic_comments_1 = require("../../../reconstruct/auto-select/magic-comments");
57
59
  const message_lineage_1 = require("./messages/message-lineage");
58
60
  const repl_lineage_1 = require("../commands/repl-lineage");
59
- const assert_1 = require("../../../util/assert");
60
- const auto_select_defaults_1 = require("../../../reconstruct/auto-select/auto-select-defaults");
61
61
  const message_query_1 = require("./messages/message-query");
62
- const query_1 = require("../../../queries/query");
63
62
  const compact_1 = require("./compact");
64
63
  const _00_slice_1 = require("../../../core/steps/all/static-slicing/00-slice");
64
+ const flowr_analyzer_builder_1 = require("../../../project/flowr-analyzer-builder");
65
65
  /**
66
66
  * Each connection handles a single client, answering to its requests.
67
67
  * There is no need to construct this class manually, {@link FlowRServer} will do it for you.
@@ -117,7 +117,7 @@ class FlowRServerConnection {
117
117
  this.handleRepl(request.message);
118
118
  break;
119
119
  case 'request-lineage':
120
- this.handleLineageRequest(request.message);
120
+ void this.handleLineageRequest(request.message);
121
121
  break;
122
122
  case 'request-query':
123
123
  this.handleQueryRequest(request.message);
@@ -146,9 +146,11 @@ class FlowRServerConnection {
146
146
  this.fileMap.delete(message.filetoken);
147
147
  }
148
148
  const tempFile = tmp.fileSync({ postfix: '.R' });
149
- const slicer = this.createPipelineExecutorForRequest(message, tempFile.name);
150
- await slicer.allRemainingSteps(false).then(async (results) => await this.sendFileAnalysisResponse(slicer, results, message))
151
- .catch(e => {
149
+ const analyzer = await this.createAnalyzerForRequest(message, tempFile.name);
150
+ try {
151
+ await this.sendFileAnalysisResponse(analyzer, message);
152
+ }
153
+ catch (e) {
152
154
  this.logger.error(`[${this.name}] Error while analyzing file ${message.filename ?? 'unknown file'}: ${String(e)}`);
153
155
  (0, send_1.sendMessage)(this.socket, {
154
156
  id: message.id,
@@ -156,22 +158,17 @@ class FlowRServerConnection {
156
158
  fatal: false,
157
159
  reason: `Error while analyzing file ${message.filename ?? 'unknown file'}: ${String(e)}`
158
160
  });
159
- });
161
+ }
160
162
  // this is an interestingly named function that means "I am a callback that removes a file" - so this deletes the file
161
163
  tempFile.removeCallback();
162
164
  }
163
- async sendFileAnalysisResponse(slicer, results, message) {
165
+ async sendFileAnalysisResponse(analyzer, message) {
164
166
  let cfg = undefined;
165
167
  if (message.cfg) {
166
- cfg = (0, extract_cfg_1.extractCfg)(results.normalize, this.config, results.dataflow?.graph);
168
+ cfg = await analyzer.controlflow();
167
169
  }
168
170
  const config = () => ({ context: message.filename ?? 'unknown', getId: (0, quads_1.defaultQuadIdGenerator)() });
169
- const sanitizedResults = sanitizeAnalysisResults(results);
170
- const pipeline = slicer.getPipeline();
171
- const parseStep = pipeline.steps.get('parse');
172
- const normalizedStep = pipeline.steps.get('normalize');
173
- const dataflowStep = pipeline.steps.get('dataflow');
174
- (0, assert_1.guard)(parseStep !== undefined && normalizedStep !== undefined && dataflowStep !== undefined, 'All steps must be present');
171
+ const sanitizedResults = sanitizeAnalysisResults(await analyzer.parse(), await analyzer.normalize(), await analyzer.dataflow());
175
172
  if (message.format === 'n-quads') {
176
173
  (0, send_1.sendMessage)(this.socket, {
177
174
  type: 'response-file-analysis',
@@ -179,9 +176,9 @@ class FlowRServerConnection {
179
176
  id: message.id,
180
177
  cfg: cfg ? (0, extract_cfg_1.cfg2quads)(cfg, config()) : undefined,
181
178
  results: {
182
- parse: await (0, print_1.printStepResult)(parseStep, sanitizedResults.parse, 5 /* StepOutputFormat.RdfQuads */, config()),
183
- normalize: await (0, print_1.printStepResult)(normalizedStep, sanitizedResults.normalize, 5 /* StepOutputFormat.RdfQuads */, config()),
184
- dataflow: await (0, print_1.printStepResult)(dataflowStep, sanitizedResults.dataflow, 5 /* StepOutputFormat.RdfQuads */, config())
179
+ parse: await (0, print_1.printStepResult)(_00_parse_1.PARSE_WITH_R_SHELL_STEP, await analyzer.parse(), 5 /* StepOutputFormat.RdfQuads */, config()),
180
+ normalize: await (0, print_1.printStepResult)(_10_normalize_1.NORMALIZE, await analyzer.normalize(), 5 /* StepOutputFormat.RdfQuads */, config()),
181
+ dataflow: await (0, print_1.printStepResult)(_20_dataflow_1.STATIC_DATAFLOW, await analyzer.dataflow(), 5 /* StepOutputFormat.RdfQuads */, config())
185
182
  }
186
183
  });
187
184
  }
@@ -204,7 +201,7 @@ class FlowRServerConnection {
204
201
  });
205
202
  }
206
203
  }
207
- createPipelineExecutorForRequest(message, tempFile) {
204
+ async createAnalyzerForRequest(message, tempFile) {
208
205
  let request;
209
206
  if (message.content !== undefined) {
210
207
  // we store the code in a temporary file in case it's too big for the shell to handle
@@ -222,18 +219,18 @@ class FlowRServerConnection {
222
219
  else {
223
220
  throw new Error('Either content or filepath must be defined.');
224
221
  }
225
- const slicer = (0, default_pipelines_1.createSlicePipeline)(this.parser, {
226
- request,
227
- criterion: [] // currently unknown
228
- }, this.config);
222
+ const analyzer = await new flowr_analyzer_builder_1.FlowrAnalyzerBuilder(request)
223
+ .setConfig(this.config)
224
+ .setParser(this.parser)
225
+ .build();
229
226
  if (message.filetoken) {
230
227
  this.logger.info(`Storing file token ${message.filetoken}`);
231
228
  this.fileMap.set(message.filetoken, {
232
229
  filename: message.filename,
233
- pipeline: slicer
230
+ analyzer: analyzer
234
231
  });
235
232
  }
236
- return slicer;
233
+ return analyzer;
237
234
  }
238
235
  handleSliceRequest(base) {
239
236
  const requestResult = (0, validate_1.validateMessage)(base, message_slice_1.requestSliceMessage);
@@ -253,16 +250,16 @@ class FlowRServerConnection {
253
250
  });
254
251
  return;
255
252
  }
256
- fileInformation.pipeline.updateRequest({
257
- criterion: request.criterion,
258
- direction: request.direction,
259
- autoSelectIf: request.noMagicComments ? auto_select_defaults_1.doNotAutoSelect : (0, magic_comments_1.makeMagicCommentHandler)(auto_select_defaults_1.doNotAutoSelect)
260
- });
261
- void fileInformation.pipeline.allRemainingSteps(true).then(results => {
253
+ void fileInformation.analyzer.query([{
254
+ type: 'static-slice',
255
+ criteria: request.criterion,
256
+ noMagicComments: request.noMagicComments,
257
+ direction: request.direction
258
+ }]).then(result => {
262
259
  (0, send_1.sendMessage)(this.socket, {
263
260
  type: 'response-slice',
264
261
  id: request.id,
265
- results: Object.fromEntries(Object.entries(results)
262
+ results: Object.fromEntries(Object.entries(result)
266
263
  .filter(([k,]) => default_pipelines_1.DEFAULT_SLICING_PIPELINE.steps.get(k)?.executed === 1 /* PipelineStepStage.OncePerRequest */))
267
264
  });
268
265
  }).catch(e => {
@@ -301,7 +298,7 @@ class FlowRServerConnection {
301
298
  });
302
299
  });
303
300
  }
304
- handleLineageRequest(base) {
301
+ async handleLineageRequest(base) {
305
302
  const requestResult = (0, validate_1.validateMessage)(base, message_lineage_1.requestLineageMessage);
306
303
  if (requestResult.type === 'error') {
307
304
  (0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
@@ -319,10 +316,8 @@ class FlowRServerConnection {
319
316
  });
320
317
  return;
321
318
  }
322
- const { dataflow: dfg, normalize: ast } = fileInformation.pipeline.getResults(true);
323
- (0, assert_1.guard)(dfg !== undefined, `Dataflow graph must be present (request: ${request.filetoken})`);
324
- (0, assert_1.guard)(ast !== undefined, `AST must be present (request: ${request.filetoken})`);
325
- const lineageIds = (0, repl_lineage_1.getLineage)(request.criterion, dfg.graph, ast.idMap);
319
+ const analyzer = fileInformation.analyzer;
320
+ const lineageIds = (0, repl_lineage_1.getLineage)(request.criterion, (await analyzer.dataflow()).graph, (await analyzer.normalize()).idMap);
326
321
  (0, send_1.sendMessage)(this.socket, {
327
322
  type: 'response-lineage',
328
323
  id: request.id,
@@ -347,10 +342,7 @@ class FlowRServerConnection {
347
342
  });
348
343
  return;
349
344
  }
350
- const { dataflow: dfg, normalize: ast } = fileInformation.pipeline.getResults(true);
351
- (0, assert_1.guard)(dfg !== undefined, `Dataflow graph must be present (request: ${request.filetoken})`);
352
- (0, assert_1.guard)(ast !== undefined, `AST must be present (request: ${request.filetoken})`);
353
- void Promise.resolve((0, query_1.executeQueries)({ dataflow: dfg, ast, config: this.config }, request.query)).then(results => {
345
+ void Promise.resolve(fileInformation.analyzer.query(request.query)).then(results => {
354
346
  (0, send_1.sendMessage)(this.socket, {
355
347
  type: 'response-query',
356
348
  id: request.id,
@@ -368,17 +360,17 @@ class FlowRServerConnection {
368
360
  }
369
361
  }
370
362
  exports.FlowRServerConnection = FlowRServerConnection;
371
- function sanitizeAnalysisResults(results) {
363
+ function sanitizeAnalysisResults(parse, normalize, dataflow) {
372
364
  return {
373
- ...results,
365
+ parse: parse,
374
366
  normalize: {
375
- ...results.normalize,
367
+ ...normalize,
376
368
  idMap: undefined
377
369
  },
378
370
  dataflow: {
379
- ...results.dataflow,
371
+ ...dataflow,
380
372
  // we want to keep the DataflowGraph type information, but not the idMap
381
- graph: new graph_1.DataflowGraph(undefined).mergeWith(results.dataflow?.graph)
373
+ graph: new graph_1.DataflowGraph(undefined).mergeWith(dataflow?.graph)
382
374
  }
383
375
  };
384
376
  }
@@ -17,7 +17,7 @@ export interface SliceRequestMessage extends IdMessageBase {
17
17
  /** The direction to slice in. Defaults to backward slicing if unset. */
18
18
  direction?: SliceDirection;
19
19
  /**
20
- * Should the magic comments (force-including lines within the slice) be ignord?
20
+ * Should the magic comments (force-including lines within the slice) be ignored?
21
21
  */
22
22
  noMagicComments?: boolean;
23
23
  }