@eagleoutice/flowr 2.2.13 → 2.2.14

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 (77) hide show
  1. package/README.md +4 -4
  2. package/cli/repl/commands/repl-cfg.d.ts +2 -2
  3. package/cli/repl/commands/repl-cfg.js +4 -4
  4. package/cli/repl/commands/repl-commands.js +2 -2
  5. package/cli/repl/server/connection.js +1 -1
  6. package/cli/script-core/statistics-helper-core.js +1 -1
  7. package/control-flow/extract-cfg.d.ts +2 -2
  8. package/control-flow/extract-cfg.js +10 -10
  9. package/documentation/doc-util/doc-cfg.d.ts +1 -1
  10. package/documentation/doc-util/doc-cfg.js +3 -3
  11. package/documentation/print-cfg-wiki.js +25 -25
  12. package/documentation/print-linter-wiki.d.ts +1 -0
  13. package/documentation/print-linter-wiki.js +76 -0
  14. package/linter/linter-executor.d.ts +9 -0
  15. package/linter/linter-executor.js +26 -0
  16. package/linter/linter-format.d.ts +65 -0
  17. package/linter/linter-format.js +9 -0
  18. package/linter/linter-rules.d.ts +42 -0
  19. package/linter/linter-rules.js +14 -0
  20. package/linter/rules/1-deprecated-functions.d.ts +34 -0
  21. package/linter/rules/1-deprecated-functions.js +54 -0
  22. package/linter/rules/2-file-path-validity.d.ts +48 -0
  23. package/linter/rules/2-file-path-validity.js +93 -0
  24. package/package.json +2 -1
  25. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
  26. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -2
  27. package/queries/catalog/call-context-query/call-context-query-format.js +5 -1
  28. package/queries/catalog/cluster-query/cluster-query-format.d.ts +2 -0
  29. package/queries/catalog/cluster-query/cluster-query-format.js +5 -1
  30. package/queries/catalog/config-query/config-query-format.d.ts +1 -0
  31. package/queries/catalog/config-query/config-query-format.js +2 -1
  32. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -0
  33. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -1
  34. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +2 -0
  35. package/queries/catalog/dataflow-query/dataflow-query-format.js +9 -1
  36. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -0
  37. package/queries/catalog/dependencies-query/dependencies-query-format.js +10 -1
  38. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
  39. package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -1
  40. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -0
  41. package/queries/catalog/id-map-query/id-map-query-format.js +2 -1
  42. package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -0
  43. package/queries/catalog/lineage-query/lineage-query-format.js +5 -1
  44. package/queries/catalog/linter-query/linter-query-executor.d.ts +3 -0
  45. package/queries/catalog/linter-query/linter-query-executor.js +28 -0
  46. package/queries/catalog/linter-query/linter-query-format.d.ts +80 -0
  47. package/queries/catalog/linter-query/linter-query-format.js +43 -0
  48. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -0
  49. package/queries/catalog/location-map-query/location-map-query-format.js +2 -1
  50. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -0
  51. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -1
  52. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
  53. package/queries/catalog/origin-query/origin-query-format.js +5 -1
  54. package/queries/catalog/project-query/project-query-executor.js +1 -1
  55. package/queries/catalog/project-query/project-query-format.d.ts +1 -0
  56. package/queries/catalog/project-query/project-query-format.js +2 -1
  57. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -0
  58. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -1
  59. package/queries/catalog/search-query/search-query-format.d.ts +1 -0
  60. package/queries/catalog/search-query/search-query-format.js +5 -1
  61. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
  62. package/queries/catalog/static-slice-query/static-slice-query-format.js +9 -1
  63. package/queries/query.d.ts +83 -1
  64. package/queries/query.js +2 -0
  65. package/r-bridge/retriever.js +1 -1
  66. package/search/flowr-search-builder.d.ts +31 -2
  67. package/search/flowr-search-builder.js +30 -0
  68. package/search/flowr-search.d.ts +7 -1
  69. package/search/search-executor/search-enrichers.d.ts +73 -0
  70. package/search/search-executor/search-enrichers.js +98 -0
  71. package/search/search-executor/search-generators.d.ts +6 -1
  72. package/search/search-executor/search-generators.js +21 -1
  73. package/search/search-executor/search-mappers.d.ts +19 -0
  74. package/search/search-executor/search-mappers.js +21 -0
  75. package/search/search-executor/search-transformer.d.ts +12 -0
  76. package/search/search-executor/search-transformer.js +11 -1
  77. package/util/version.js +1 -1
@@ -0,0 +1,80 @@
1
+ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
2
+ import Joi from 'joi';
3
+ import { executeLinterQuery } from './linter-query-executor';
4
+ import type { LintingRuleNames } from '../../../linter/linter-rules';
5
+ import type { ConfiguredLintingRule, LintingResults } from '../../../linter/linter-format';
6
+ export interface LinterQuery extends BaseQueryFormat {
7
+ readonly type: 'linter';
8
+ /**
9
+ * The rules to lint for. If unset, all rules will be included.
10
+ * Optionally, a {@link ConfiguredLintingRule} can be provided, which additionally includes custom user-supplied values for the linting rules' configurations.
11
+ */
12
+ readonly rules?: (LintingRuleNames | ConfiguredLintingRule)[];
13
+ }
14
+ export interface LinterQueryResult extends BaseQueryResult {
15
+ /**
16
+ * The results of the linter query, which returns a set of linting results for each rule that was executed.
17
+ */
18
+ readonly results: {
19
+ [L in LintingRuleNames]?: LintingResults<L>;
20
+ };
21
+ }
22
+ export declare const LinterQueryDefinition: {
23
+ readonly executor: typeof executeLinterQuery;
24
+ readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _processed: import("../../../core/steps/pipeline/pipeline").PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
25
+ readonly name: "parse";
26
+ readonly humanReadableName: "parse with R shell";
27
+ readonly description: "Parse the given R code into an AST";
28
+ readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
29
+ readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
30
+ readonly printer: {
31
+ readonly 0: typeof import("../../../core/print/print").internalPrinter;
32
+ readonly 2: {
33
+ (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
34
+ (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
35
+ };
36
+ readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
37
+ };
38
+ readonly dependencies: readonly [];
39
+ readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
40
+ } | {
41
+ readonly name: "normalize";
42
+ readonly humanReadableName: "normalize";
43
+ readonly description: "Normalize the AST to flowR's AST";
44
+ readonly processor: (results: {
45
+ parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
46
+ }, input: Partial<import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../r-bridge/lang-4.x/ast/model/model").RNode<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
47
+ readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
48
+ readonly printer: {
49
+ readonly 0: typeof import("../../../core/print/print").internalPrinter;
50
+ readonly 2: typeof import("../../../core/print/normalize-printer").normalizedAstToJson;
51
+ readonly 5: typeof import("../../../core/print/normalize-printer").normalizedAstToQuads;
52
+ readonly 3: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaid;
53
+ readonly 4: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaidUrl;
54
+ };
55
+ readonly dependencies: readonly ["parse"];
56
+ readonly requiredInput: import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput;
57
+ } | {
58
+ readonly humanReadableName: "dataflow";
59
+ readonly processor: (results: {
60
+ normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
61
+ }, input: {
62
+ request?: import("../../../r-bridge/retriever").RParseRequests;
63
+ parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
64
+ }) => import("../../../dataflow/info").DataflowInformation;
65
+ readonly requiredInput: {};
66
+ readonly name: "dataflow";
67
+ readonly description: "Construct the dataflow graph";
68
+ readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
69
+ readonly printer: {
70
+ readonly 0: typeof import("../../../core/print/print").internalPrinter;
71
+ readonly 2: typeof import("../../../core/print/dataflow-printer").dataflowGraphToJson;
72
+ readonly 5: typeof import("../../../core/print/dataflow-printer").dataflowGraphToQuads;
73
+ readonly 3: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaid;
74
+ readonly 4: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaidUrl;
75
+ };
76
+ readonly dependencies: readonly ["normalize"];
77
+ }>>, queryResults: BaseQueryResult, result: string[]) => true;
78
+ readonly schema: Joi.ObjectSchema<any>;
79
+ readonly flattenInvolvedNodes: () => never[];
80
+ };
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LinterQueryDefinition = void 0;
7
+ const joi_1 = __importDefault(require("joi"));
8
+ const linter_query_executor_1 = require("./linter-query-executor");
9
+ const linter_rules_1 = require("../../../linter/linter-rules");
10
+ const linter_format_1 = require("../../../linter/linter-format");
11
+ const ansi_1 = require("../../../util/text/ansi");
12
+ const time_1 = require("../../../util/text/time");
13
+ exports.LinterQueryDefinition = {
14
+ executor: linter_query_executor_1.executeLinterQuery,
15
+ asciiSummarizer: (formatter, _processed, queryResults, result) => {
16
+ const out = queryResults;
17
+ result.push(`Query: ${(0, ansi_1.bold)('linter', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
18
+ for (const [ruleName, results] of Object.entries(out.results)) {
19
+ const rule = linter_rules_1.LintingRules[ruleName];
20
+ result.push(` ╰ ${ruleName}:`);
21
+ for (const certainty of [linter_format_1.LintingCertainty.Definitely, linter_format_1.LintingCertainty.Maybe]) {
22
+ const certaintyResults = results.results.filter(r => r.certainty === certainty);
23
+ if (certaintyResults.length) {
24
+ result.push(` ╰ ${certainty}:`);
25
+ for (const res of certaintyResults) {
26
+ result.push(` ╰ ${rule.prettyPrint(res)}`);
27
+ }
28
+ }
29
+ }
30
+ result.push(` ╰ Metadata: ${JSON.stringify(results['.meta'])}`);
31
+ }
32
+ return true;
33
+ },
34
+ schema: joi_1.default.object({
35
+ type: joi_1.default.string().valid('linter').required().description('The type of the query.'),
36
+ rules: joi_1.default.array().items(joi_1.default.string().valid(...Object.keys(linter_rules_1.LintingRules)), joi_1.default.object({
37
+ name: joi_1.default.string().valid(...Object.keys(linter_rules_1.LintingRules)).required(),
38
+ config: joi_1.default.object()
39
+ })).description('The rules to lint for. If unset, all rules will be included.')
40
+ }).description('The linter query lints for the given set of rules and returns the result.'),
41
+ flattenInvolvedNodes: () => []
42
+ };
43
+ //# sourceMappingURL=linter-query-format.js.map
@@ -23,4 +23,5 @@ export declare const LocationMapQueryDefinition: {
23
23
  readonly executor: typeof executeLocationMapQuery;
24
24
  readonly asciiSummarizer: (formatter: OutputFormatter, _processed: unknown, queryResults: BaseQueryResult, result: string[]) => boolean;
25
25
  readonly schema: Joi.ObjectSchema<any>;
26
+ readonly flattenInvolvedNodes: () => never[];
26
27
  };
@@ -23,6 +23,7 @@ exports.LocationMapQueryDefinition = {
23
23
  },
24
24
  schema: joi_1.default.object({
25
25
  type: joi_1.default.string().valid('location-map').required().description('The type of the query.'),
26
- }).description('The location map query retrieves the location of every id in the ast.')
26
+ }).description('The location map query retrieves the location of every id in the ast.'),
27
+ flattenInvolvedNodes: () => []
27
28
  };
28
29
  //# sourceMappingURL=location-map-query-format.js.map
@@ -68,4 +68,5 @@ export declare const NormalizedAstQueryDefinition: {
68
68
  readonly dependencies: readonly ["normalize"];
69
69
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
70
70
  readonly schema: Joi.ObjectSchema<any>;
71
+ readonly flattenInvolvedNodes: () => never[];
71
72
  };
@@ -19,6 +19,7 @@ exports.NormalizedAstQueryDefinition = {
19
19
  },
20
20
  schema: joi_1.default.object({
21
21
  type: joi_1.default.string().valid('normalized-ast').required().description('The type of the query.'),
22
- }).description('The normalized AST query simply returns the normalized AST, there is no need to pass it multiple times!')
22
+ }).description('The normalized AST query simply returns the normalized AST, there is no need to pass it multiple times!'),
23
+ flattenInvolvedNodes: () => []
23
24
  };
24
25
  //# sourceMappingURL=normalized-ast-query-format.js.map
@@ -3,6 +3,7 @@ import type { SingleSlicingCriterion } from '../../../slicing/criterion/parse';
3
3
  import Joi from 'joi';
4
4
  import { executeResolveValueQuery } from './origin-query-executor';
5
5
  import type { Origin } from '../../../dataflow/origin/dfg-get-origin';
6
+ import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
6
7
  export interface OriginQuery extends BaseQueryFormat {
7
8
  readonly type: 'origin';
8
9
  /** The slicing criteria to use */
@@ -68,4 +69,5 @@ export declare const OriginQueryDefinition: {
68
69
  readonly dependencies: readonly ["normalize"];
69
70
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
70
71
  readonly schema: Joi.ObjectSchema<any>;
72
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
71
73
  };
@@ -22,6 +22,10 @@ exports.OriginQueryDefinition = {
22
22
  schema: joi_1.default.object({
23
23
  type: joi_1.default.string().valid('origin').required().description('The type of the query.'),
24
24
  criterion: joi_1.default.string().required().description('The slicing criteria to use'),
25
- }).description('The resolve value query used to get definitions of an identifier')
25
+ }).description('The resolve value query used to get definitions of an identifier'),
26
+ flattenInvolvedNodes: (queryResults) => {
27
+ const out = queryResults;
28
+ return Object.entries(out.results).flatMap(([_, obj]) => obj?.map(origin => origin.id) ?? []);
29
+ }
26
30
  };
27
31
  //# sourceMappingURL=origin-query-format.js.map
@@ -4,7 +4,7 @@ exports.executeProjectQuery = executeProjectQuery;
4
4
  const log_1 = require("../../../util/log");
5
5
  function executeProjectQuery({ dataflow }, queries) {
6
6
  if (queries.length !== 1) {
7
- log_1.log.warn('Id-Map query expects only up to one query, but got', queries.length);
7
+ log_1.log.warn('Project query expects only up to one query, but got', queries.length);
8
8
  }
9
9
  return {
10
10
  '.meta': {
@@ -64,4 +64,5 @@ export declare const ProjectQueryDefinition: {
64
64
  readonly dependencies: readonly ["normalize"];
65
65
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
66
66
  readonly schema: Joi.ObjectSchema<any>;
67
+ readonly flattenInvolvedNodes: () => never[];
67
68
  };
@@ -21,6 +21,7 @@ exports.ProjectQueryDefinition = {
21
21
  },
22
22
  schema: joi_1.default.object({
23
23
  type: joi_1.default.string().valid('project').required().description('The type of the query.'),
24
- }).description('The project query provides information on the analyzed project.')
24
+ }).description('The project query provides information on the analyzed project.'),
25
+ flattenInvolvedNodes: () => []
25
26
  };
26
27
  //# sourceMappingURL=project-query-format.js.map
@@ -69,4 +69,5 @@ export declare const ResolveValueQueryDefinition: {
69
69
  readonly dependencies: readonly ["normalize"];
70
70
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
71
71
  readonly schema: Joi.ObjectSchema<any>;
72
+ readonly flattenInvolvedNodes: () => never[];
72
73
  };
@@ -44,6 +44,7 @@ exports.ResolveValueQueryDefinition = {
44
44
  schema: joi_1.default.object({
45
45
  type: joi_1.default.string().valid('resolve-value').required().description('The type of the query.'),
46
46
  criteria: joi_1.default.array().items(joi_1.default.string()).min(1).required().description('The slicing criteria to use.'),
47
- }).description('The resolve value query used to get definitions of an identifier')
47
+ }).description('The resolve value query used to get definitions of an identifier'),
48
+ flattenInvolvedNodes: () => []
48
49
  };
49
50
  //# sourceMappingURL=resolve-value-query-format.js.map
@@ -70,4 +70,5 @@ export declare const SearchQueryDefinition: {
70
70
  readonly dependencies: readonly ["normalize"];
71
71
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
72
72
  readonly schema: Joi.ObjectSchema<any>;
73
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
73
74
  };
@@ -24,6 +24,10 @@ exports.SearchQueryDefinition = {
24
24
  schema: joi_1.default.object({
25
25
  type: joi_1.default.string().valid('search').required().description('The type of the query.'),
26
26
  search: joi_1.default.object().required().description('The search query to execute.')
27
- }).description('The search query searches the normalized AST and dataflow graph for nodes that match the given search query.')
27
+ }).description('The search query searches the normalized AST and dataflow graph for nodes that match the given search query.'),
28
+ flattenInvolvedNodes: (queryResults) => {
29
+ const out = queryResults;
30
+ return out.results.flatMap(({ ids }) => ids);
31
+ }
28
32
  };
29
33
  //# sourceMappingURL=search-query-format.js.map
@@ -4,6 +4,7 @@ import type { DEFAULT_DATAFLOW_PIPELINE, DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPEL
4
4
  import type { SlicingCriteria } from '../../../slicing/criterion/parse';
5
5
  import Joi from 'joi';
6
6
  import { executeStaticSliceQuery } from './static-slice-query-executor';
7
+ import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
7
8
  /** Calculates and returns all clusters encountered in the dataflow graph. */
8
9
  export interface StaticSliceQuery extends BaseQueryFormat {
9
10
  readonly type: 'static-slice';
@@ -81,4 +82,5 @@ export declare const StaticSliceQueryDefinition: {
81
82
  readonly dependencies: readonly ["normalize"];
82
83
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
83
84
  readonly schema: Joi.ObjectSchema<any>;
85
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
84
86
  };
@@ -38,6 +38,14 @@ exports.StaticSliceQueryDefinition = {
38
38
  criteria: joi_1.default.array().items(joi_1.default.string()).min(0).required().description('The slicing criteria to use.'),
39
39
  noReconstruction: joi_1.default.boolean().optional().description('Do not reconstruct the slice into readable code.'),
40
40
  noMagicComments: joi_1.default.boolean().optional().description('Should the magic comments (force-including lines within the slice) be ignored?')
41
- }).description('Slice query used to slice the dataflow graph')
41
+ }).description('Slice query used to slice the dataflow graph'),
42
+ flattenInvolvedNodes: (queryResults) => {
43
+ const flattened = [];
44
+ const out = queryResults;
45
+ for (const [_, obj] of Object.entries(out.results)) {
46
+ flattened.push(...obj.slice.result);
47
+ }
48
+ return flattened;
49
+ }
42
50
  };
43
51
  //# sourceMappingURL=static-slice-query-format.js.map
@@ -21,7 +21,9 @@ import type { ResolveValueQuery } from './catalog/resolve-value-query/resolve-va
21
21
  import type { DataflowLensQuery } from './catalog/dataflow-lens-query/dataflow-lens-query-format';
22
22
  import type { ProjectQuery } from './catalog/project-query/project-query-format';
23
23
  import type { OriginQuery } from './catalog/origin-query/origin-query-format';
24
- export type Query = CallContextQuery | ConfigQuery | SearchQuery | DataflowQuery | DataflowLensQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | LineageQuery | DependenciesQuery | LocationMapQuery | HappensBeforeQuery | ResolveValueQuery | ProjectQuery | OriginQuery;
24
+ import type { LinterQuery } from './catalog/linter-query/linter-query-format';
25
+ import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
26
+ export type Query = CallContextQuery | ConfigQuery | SearchQuery | DataflowQuery | DataflowLensQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | LineageQuery | DependenciesQuery | LocationMapQuery | HappensBeforeQuery | ResolveValueQuery | ProjectQuery | OriginQuery | LinterQuery;
25
27
  export type QueryArgumentsWithType<QueryType extends BaseQueryFormat['type']> = Query & {
26
28
  type: QueryType;
27
29
  };
@@ -33,17 +35,24 @@ export interface SupportedQuery<QueryType extends BaseQueryFormat['type']> {
33
35
  executor: QueryExecutor<QueryArgumentsWithType<QueryType>, BaseQueryResult>;
34
36
  asciiSummarizer: (formatter: OutputFormatter, processed: PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>, queryResults: BaseQueryResult, resultStrings: string[]) => boolean;
35
37
  schema: Joi.ObjectSchema;
38
+ /**
39
+ * Flattens the involved query nodes to be added to a flowR search when the {@link fromQuery} function is used based on the given result after this query is executed.
40
+ * If this query does not involve any nodes, an empty array can be returned.
41
+ */
42
+ flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
36
43
  }
37
44
  export declare const SupportedQueries: {
38
45
  readonly 'call-context': {
39
46
  readonly executor: typeof import("./catalog/call-context-query/call-context-query-executor").executeCallContextQueries;
40
47
  readonly asciiSummarizer: (formatter: OutputFormatter, processed: PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>, queryResults: BaseQueryResult, result: string[]) => boolean;
41
48
  readonly schema: Joi.ObjectSchema<any>;
49
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
42
50
  };
43
51
  readonly config: {
44
52
  readonly executor: typeof import("./catalog/config-query/config-query-executor").executeConfigQuery;
45
53
  readonly asciiSummarizer: (formatter: OutputFormatter, _processed: unknown, queryResults: BaseQueryResult, result: string[]) => boolean;
46
54
  readonly schema: Joi.ObjectSchema<any>;
55
+ readonly flattenInvolvedNodes: () => never[];
47
56
  };
48
57
  readonly dataflow: {
49
58
  readonly executor: typeof import("./catalog/dataflow-query/dataflow-query-executor").executeDataflowQuery;
@@ -102,6 +111,7 @@ export declare const SupportedQueries: {
102
111
  readonly dependencies: readonly ["normalize"];
103
112
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
104
113
  readonly schema: Joi.ObjectSchema<any>;
114
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
105
115
  };
106
116
  readonly 'dataflow-lens': {
107
117
  readonly executor: typeof import("./catalog/dataflow-lens-query/dataflow-lens-query-executor").executeDataflowLensQuery;
@@ -160,6 +170,7 @@ export declare const SupportedQueries: {
160
170
  readonly dependencies: readonly ["normalize"];
161
171
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
162
172
  readonly schema: Joi.ObjectSchema<any>;
173
+ readonly flattenInvolvedNodes: () => never[];
163
174
  };
164
175
  readonly 'id-map': {
165
176
  readonly executor: typeof import("./catalog/id-map-query/id-map-query-executor").executeIdMapQuery;
@@ -218,6 +229,7 @@ export declare const SupportedQueries: {
218
229
  readonly dependencies: readonly ["normalize"];
219
230
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
220
231
  readonly schema: Joi.ObjectSchema<any>;
232
+ readonly flattenInvolvedNodes: () => never[];
221
233
  };
222
234
  readonly 'normalized-ast': {
223
235
  readonly executor: typeof import("./catalog/normalized-ast-query/normalized-ast-query-executor").executeNormalizedAstQuery;
@@ -276,6 +288,7 @@ export declare const SupportedQueries: {
276
288
  readonly dependencies: readonly ["normalize"];
277
289
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
278
290
  readonly schema: Joi.ObjectSchema<any>;
291
+ readonly flattenInvolvedNodes: () => never[];
279
292
  };
280
293
  readonly 'dataflow-cluster': {
281
294
  readonly executor: typeof import("./catalog/cluster-query/cluster-query-executor").executeDataflowClusterQuery;
@@ -334,6 +347,7 @@ export declare const SupportedQueries: {
334
347
  readonly dependencies: readonly ["normalize"];
335
348
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
336
349
  readonly schema: Joi.ObjectSchema<any>;
350
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
337
351
  };
338
352
  readonly 'static-slice': {
339
353
  readonly executor: typeof import("./catalog/static-slice-query/static-slice-query-executor").executeStaticSliceQuery;
@@ -392,6 +406,7 @@ export declare const SupportedQueries: {
392
406
  readonly dependencies: readonly ["normalize"];
393
407
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
394
408
  readonly schema: Joi.ObjectSchema<any>;
409
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
395
410
  };
396
411
  readonly lineage: {
397
412
  readonly executor: typeof import("./catalog/lineage-query/lineage-query-executor").executeLineageQuery;
@@ -450,6 +465,7 @@ export declare const SupportedQueries: {
450
465
  readonly dependencies: readonly ["normalize"];
451
466
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
452
467
  readonly schema: Joi.ObjectSchema<any>;
468
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
453
469
  };
454
470
  readonly dependencies: {
455
471
  readonly executor: typeof import("./catalog/dependencies-query/dependencies-query-executor").executeDependenciesQuery;
@@ -508,11 +524,13 @@ export declare const SupportedQueries: {
508
524
  readonly dependencies: readonly ["normalize"];
509
525
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
510
526
  readonly schema: Joi.ObjectSchema<any>;
527
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
511
528
  };
512
529
  readonly 'location-map': {
513
530
  readonly executor: typeof import("./catalog/location-map-query/location-map-query-executor").executeLocationMapQuery;
514
531
  readonly asciiSummarizer: (formatter: OutputFormatter, _processed: unknown, queryResults: BaseQueryResult, result: string[]) => boolean;
515
532
  readonly schema: Joi.ObjectSchema<any>;
533
+ readonly flattenInvolvedNodes: () => never[];
516
534
  };
517
535
  readonly search: {
518
536
  readonly executor: typeof import("./catalog/search-query/search-query-executor").executeSearch;
@@ -571,6 +589,7 @@ export declare const SupportedQueries: {
571
589
  readonly dependencies: readonly ["normalize"];
572
590
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
573
591
  readonly schema: Joi.ObjectSchema<any>;
592
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
574
593
  };
575
594
  readonly 'happens-before': {
576
595
  readonly executor: typeof import("./catalog/happens-before-query/happens-before-query-executor").executeHappensBefore;
@@ -629,6 +648,7 @@ export declare const SupportedQueries: {
629
648
  readonly dependencies: readonly ["normalize"];
630
649
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
631
650
  readonly schema: Joi.ObjectSchema<any>;
651
+ readonly flattenInvolvedNodes: () => never[];
632
652
  };
633
653
  readonly 'resolve-value': {
634
654
  readonly executor: typeof import("./catalog/resolve-value-query/resolve-value-query-executor").executeResolveValueQuery;
@@ -687,6 +707,7 @@ export declare const SupportedQueries: {
687
707
  readonly dependencies: readonly ["normalize"];
688
708
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
689
709
  readonly schema: Joi.ObjectSchema<any>;
710
+ readonly flattenInvolvedNodes: () => never[];
690
711
  };
691
712
  readonly project: {
692
713
  readonly executor: typeof import("./catalog/project-query/project-query-executor").executeProjectQuery;
@@ -745,6 +766,7 @@ export declare const SupportedQueries: {
745
766
  readonly dependencies: readonly ["normalize"];
746
767
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
747
768
  readonly schema: Joi.ObjectSchema<any>;
769
+ readonly flattenInvolvedNodes: () => never[];
748
770
  };
749
771
  readonly origin: {
750
772
  readonly executor: typeof import("./catalog/origin-query/origin-query-executor").executeResolveValueQuery;
@@ -803,6 +825,66 @@ export declare const SupportedQueries: {
803
825
  readonly dependencies: readonly ["normalize"];
804
826
  }>>, queryResults: BaseQueryResult, result: string[]) => true;
805
827
  readonly schema: Joi.ObjectSchema<any>;
828
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
829
+ };
830
+ readonly linter: {
831
+ readonly executor: typeof import("./catalog/linter-query/linter-query-executor").executeLinterQuery;
832
+ readonly asciiSummarizer: (formatter: OutputFormatter, _processed: PipelineOutput<import("../core/steps/pipeline/pipeline").Pipeline<{
833
+ readonly name: "parse";
834
+ readonly humanReadableName: "parse with R shell";
835
+ readonly description: "Parse the given R code into an AST";
836
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
837
+ readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
838
+ readonly printer: {
839
+ readonly 0: typeof import("../core/print/print").internalPrinter;
840
+ readonly 2: {
841
+ (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
842
+ (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
843
+ };
844
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
845
+ };
846
+ readonly dependencies: readonly [];
847
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
848
+ } | {
849
+ readonly name: "normalize";
850
+ readonly humanReadableName: "normalize";
851
+ readonly description: "Normalize the AST to flowR's AST";
852
+ readonly processor: (results: {
853
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
854
+ }, input: Partial<import("../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../r-bridge/lang-4.x/ast/model/model").RNode<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
855
+ readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
856
+ readonly printer: {
857
+ readonly 0: typeof import("../core/print/print").internalPrinter;
858
+ readonly 2: typeof import("../core/print/normalize-printer").normalizedAstToJson;
859
+ readonly 5: typeof import("../core/print/normalize-printer").normalizedAstToQuads;
860
+ readonly 3: typeof import("../core/print/normalize-printer").printNormalizedAstToMermaid;
861
+ readonly 4: typeof import("../core/print/normalize-printer").printNormalizedAstToMermaidUrl;
862
+ };
863
+ readonly dependencies: readonly ["parse"];
864
+ readonly requiredInput: import("../core/steps/all/core/10-normalize").NormalizeRequiredInput;
865
+ } | {
866
+ readonly humanReadableName: "dataflow";
867
+ readonly processor: (results: {
868
+ normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
869
+ }, input: {
870
+ request?: import("../r-bridge/retriever").RParseRequests;
871
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
872
+ }) => import("../dataflow/info").DataflowInformation;
873
+ readonly requiredInput: {};
874
+ readonly name: "dataflow";
875
+ readonly description: "Construct the dataflow graph";
876
+ readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
877
+ readonly printer: {
878
+ readonly 0: typeof import("../core/print/print").internalPrinter;
879
+ readonly 2: typeof import("../core/print/dataflow-printer").dataflowGraphToJson;
880
+ readonly 5: typeof import("../core/print/dataflow-printer").dataflowGraphToQuads;
881
+ readonly 3: typeof import("../core/print/dataflow-printer").dataflowGraphToMermaid;
882
+ readonly 4: typeof import("../core/print/dataflow-printer").dataflowGraphToMermaidUrl;
883
+ };
884
+ readonly dependencies: readonly ["normalize"];
885
+ }>>, queryResults: BaseQueryResult, result: string[]) => true;
886
+ readonly schema: Joi.ObjectSchema<any>;
887
+ readonly flattenInvolvedNodes: () => never[];
806
888
  };
807
889
  };
808
890
  export type SupportedQueryTypes = keyof typeof SupportedQueries;
package/queries/query.js CHANGED
@@ -29,6 +29,7 @@ const resolve_value_query_format_1 = require("./catalog/resolve-value-query/reso
29
29
  const dataflow_lens_query_format_1 = require("./catalog/dataflow-lens-query/dataflow-lens-query-format");
30
30
  const project_query_format_1 = require("./catalog/project-query/project-query-format");
31
31
  const origin_query_format_1 = require("./catalog/origin-query/origin-query-format");
32
+ const linter_query_format_1 = require("./catalog/linter-query/linter-query-format");
32
33
  exports.SupportedQueries = {
33
34
  'call-context': call_context_query_format_1.CallContextQueryDefinition,
34
35
  'config': config_query_format_1.ConfigQueryDefinition,
@@ -46,6 +47,7 @@ exports.SupportedQueries = {
46
47
  'resolve-value': resolve_value_query_format_1.ResolveValueQueryDefinition,
47
48
  'project': project_query_format_1.ProjectQueryDefinition,
48
49
  'origin': origin_query_format_1.OriginQueryDefinition,
50
+ 'linter': linter_query_format_1.LinterQueryDefinition
49
51
  };
50
52
  function executeQueriesOfSameType(data, ...queries) {
51
53
  (0, assert_1.guard)(queries.length > 0, 'At least one query must be provided');
@@ -72,7 +72,7 @@ function requestProviderFromText(text) {
72
72
  if (ignoreCase) {
73
73
  return Object.keys(text).find(p => p.toLowerCase() === path.toLowerCase());
74
74
  }
75
- return text[path] ? path : undefined;
75
+ return text[path] !== undefined ? path : undefined;
76
76
  },
77
77
  createRequest(path) {
78
78
  return {
@@ -1,10 +1,14 @@
1
1
  import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
2
- import type { FlowrSearchElement, FlowrSearchElements, FlowrSearchGetFilter } from './flowr-search';
2
+ import type { FlowrSearchElement, FlowrSearchElementFromQuery, FlowrSearchElements, FlowrSearchGetFilter } from './flowr-search';
3
3
  import type { FlowrFilterExpression } from './flowr-search-filters';
4
4
  import type { FlowrSearchGeneratorNode, GeneratorNames } from './search-executor/search-generators';
5
5
  import type { FlowrSearchTransformerNode, GetOutputOfTransformer, TransformerNames } from './search-executor/search-transformer';
6
6
  import type { SlicingCriteria } from '../slicing/criterion/parse';
7
7
  import type { ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
8
+ import type { Enrichment, EnrichmentArguments } from './search-executor/search-enrichers';
9
+ import type { MapperArguments } from './search-executor/search-mappers';
10
+ import { Mapper } from './search-executor/search-mappers';
11
+ import type { Query } from '../queries/query';
8
12
  type FlowrCriteriaReturn<C extends SlicingCriteria> = FlowrSearchElements<ParentInformation, C extends [] ? never : C extends [infer _] ? [
9
13
  FlowrSearchElement<ParentInformation>
10
14
  ] : FlowrSearchElement<ParentInformation>[]>;
@@ -19,6 +23,12 @@ export declare const FlowrSearchGenerator: {
19
23
  * see {@link FlowrSearchGenerator.criterion} for a serializable alternative (passing the ids with `$id`).
20
24
  */
21
25
  readonly from: (from: FlowrSearchElement<ParentInformation> | FlowrSearchElement<ParentInformation>[]) => FlowrSearchBuilder<"from">;
26
+ /**
27
+ * Initializes a new search query based on the results of the given JSON query or queries.
28
+ * Internally, the {@link SupportedQuery#flattenInvolvedNodes} function is used to flatten the resulting nodes of the query.
29
+ * Please note that, due to the fact that not every query involves dataflow nodes, the search may not contain any elements at all for certain queries.
30
+ */
31
+ readonly fromQuery: (...from: readonly Query[]) => FlowrSearchBuilder<"from-query", [], ParentInformation, FlowrSearchElements<ParentInformation, FlowrSearchElementFromQuery<ParentInformation>[]>>;
22
32
  /**
23
33
  * Returns all elements (nodes/dataflow vertices) from the given data.
24
34
  */
@@ -71,6 +81,12 @@ export declare const Q: {
71
81
  * see {@link FlowrSearchGenerator.criterion} for a serializable alternative (passing the ids with `$id`).
72
82
  */
73
83
  readonly from: (from: FlowrSearchElement<ParentInformation> | FlowrSearchElement<ParentInformation>[]) => FlowrSearchBuilder<"from">;
84
+ /**
85
+ * Initializes a new search query based on the results of the given JSON query or queries.
86
+ * Internally, the {@link SupportedQuery#flattenInvolvedNodes} function is used to flatten the resulting nodes of the query.
87
+ * Please note that, due to the fact that not every query involves dataflow nodes, the search may not contain any elements at all for certain queries.
88
+ */
89
+ readonly fromQuery: (...from: readonly Query[]) => FlowrSearchBuilder<"from-query", [], ParentInformation, FlowrSearchElements<ParentInformation, FlowrSearchElementFromQuery<ParentInformation>[]>>;
74
90
  /**
75
91
  * Returns all elements (nodes/dataflow vertices) from the given data.
76
92
  */
@@ -168,6 +184,19 @@ export declare class FlowrSearchBuilder<Generator extends GeneratorNames, Transf
168
184
  * select returns only the elements at the given indices.
169
185
  */
170
186
  select<Select extends number[]>(...select: Select): FlowrSearchBuilderOut<Generator, Transformers, Info, 'select'>;
187
+ /**
188
+ * Adds the given enrichment to each element of the search.
189
+ * Added enrichments can later be retrieved using the {@link enrichmentContent} function.
190
+ */
191
+ with<ConcreteEnrichment extends Enrichment>(enrichment: ConcreteEnrichment, args?: EnrichmentArguments<ConcreteEnrichment>): FlowrSearchBuilderOut<Generator, Transformers, Info, 'with'>;
192
+ /**
193
+ * Maps the elements of the search to new values using the given mapper function.
194
+ */
195
+ map<MapperType extends Mapper>(mapper: MapperType, args: MapperArguments<MapperType>): FlowrSearchBuilderOut<Generator, Transformers, Info, 'map'>;
196
+ /**
197
+ * A convenience function that combines {@link with} and the {@link Mapper.Enrichment} mapper to immediately add an enrichment and then map to its value(s).
198
+ */
199
+ get<ConcreteEnrichment extends Enrichment>(enrichment: ConcreteEnrichment, args?: EnrichmentArguments<ConcreteEnrichment>): FlowrSearchBuilderOut<Generator, Transformers, Info, 'with' | 'map'>;
171
200
  /**
172
201
  * merge combines the search results with those of another search.
173
202
  */
@@ -183,7 +212,7 @@ export declare class FlowrSearchBuilder<Generator extends GeneratorNames, Transf
183
212
  * This type summarizes all types that can be used in places in which the API expects you to provide a search query.
184
213
  * @see {@link FlowrSearch}
185
214
  */
186
- export type FlowrSearchLike = FlowrSearch | FlowrSearchBuilderType;
215
+ export type FlowrSearchLike<Info = ParentInformation, Generator extends GeneratorNames = GeneratorNames, Transformers extends TransformerNames[] = TransformerNames[], ElementType = FlowrSearchElements<Info, FlowrSearchElement<Info>[]>> = FlowrSearch<Info, Generator, Transformers, ElementType> | FlowrSearchBuilderType<Generator, Transformers, Info, ElementType>;
187
216
  export type SearchOutput<Search> = Search extends FlowrSearch ? Search : Search extends FlowrSearchBuilderType<infer Generator, infer Transformers, infer Info, infer Elements> ? FlowrSearch<Info, Generator, Transformers, Elements> : never;
188
217
  /**
189
218
  * Freezes any accepted {@link FlowrSearchLike} into a {@link FlowrSearch}.