@eagleoutice/flowr 2.2.13 → 2.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/cli/repl/commands/repl-cfg.d.ts +2 -2
- package/cli/repl/commands/repl-cfg.js +4 -4
- package/cli/repl/commands/repl-commands.js +3 -3
- package/cli/repl/commands/repl-execute.js +2 -1
- package/cli/repl/server/connection.js +1 -1
- package/cli/script-core/statistics-helper-core.js +1 -1
- package/config.js +1 -1
- package/control-flow/basic-cfg-guided-visitor.d.ts +3 -3
- package/control-flow/cfg-dead-code.d.ts +4 -0
- package/control-flow/cfg-dead-code.js +81 -0
- package/control-flow/cfg-simplification.d.ts +17 -6
- package/control-flow/cfg-simplification.js +23 -19
- package/control-flow/control-flow-graph.d.ts +2 -1
- package/control-flow/control-flow-graph.js +1 -0
- package/control-flow/dfg-cfg-guided-visitor.d.ts +4 -4
- package/control-flow/dfg-cfg-guided-visitor.js +1 -1
- package/control-flow/extract-cfg.d.ts +2 -2
- package/control-flow/extract-cfg.js +70 -67
- package/control-flow/semantic-cfg-guided-visitor.d.ts +17 -8
- package/control-flow/semantic-cfg-guided-visitor.js +50 -17
- package/control-flow/simple-visitor.d.ts +4 -0
- package/control-flow/simple-visitor.js +14 -0
- package/control-flow/syntax-cfg-guided-visitor.d.ts +2 -2
- package/dataflow/environments/built-in-config.d.ts +1 -0
- package/dataflow/environments/built-in.d.ts +10 -1
- package/dataflow/environments/built-in.js +9 -3
- package/dataflow/environments/default-builtin-config.js +1 -1
- package/dataflow/environments/resolve-by-name.d.ts +0 -36
- package/dataflow/environments/resolve-by-name.js +0 -240
- package/dataflow/eval/resolve/alias-tracking.d.ts +87 -0
- package/dataflow/eval/resolve/alias-tracking.js +349 -0
- package/dataflow/eval/resolve/resolve.d.ts +34 -0
- package/dataflow/eval/resolve/resolve.js +93 -0
- package/dataflow/eval/values/general.d.ts +27 -0
- package/dataflow/eval/values/general.js +73 -0
- package/dataflow/eval/values/intervals/interval-constants.d.ts +4 -0
- package/dataflow/eval/values/intervals/interval-constants.js +27 -0
- package/dataflow/eval/values/logical/logical-constants.d.ts +7 -0
- package/dataflow/eval/values/logical/logical-constants.js +31 -0
- package/dataflow/eval/values/r-value.d.ts +58 -0
- package/dataflow/eval/values/r-value.js +90 -0
- package/dataflow/eval/values/scalar/scalar-consatnts.d.ts +15 -0
- package/dataflow/eval/values/scalar/scalar-consatnts.js +35 -0
- package/dataflow/eval/values/sets/set-constants.d.ts +7 -0
- package/dataflow/eval/values/sets/set-constants.js +34 -0
- package/dataflow/eval/values/string/string-constants.d.ts +8 -0
- package/dataflow/eval/values/string/string-constants.js +40 -0
- package/dataflow/eval/values/vectors/vector-constants.d.ts +14 -0
- package/dataflow/eval/values/vectors/vector-constants.js +35 -0
- package/dataflow/graph/unknown-replacement.d.ts +11 -0
- package/dataflow/graph/unknown-replacement.js +12 -0
- package/dataflow/graph/unknown-side-effect.d.ts +7 -0
- package/dataflow/graph/unknown-side-effect.js +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +8 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +4 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +12 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +9 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +12 -15
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +23 -0
- package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
- package/documentation/doc-util/doc-cfg.d.ts +1 -1
- package/documentation/doc-util/doc-cfg.js +3 -3
- package/documentation/doc-util/doc-query.d.ts +6 -3
- package/documentation/doc-util/doc-query.js +3 -1
- package/documentation/print-cfg-wiki.js +31 -31
- package/documentation/print-dataflow-graph-wiki.js +4 -3
- package/documentation/print-engines-wiki.js +1 -1
- package/documentation/print-linter-wiki.d.ts +1 -0
- package/documentation/print-linter-wiki.js +76 -0
- package/documentation/print-query-wiki.js +80 -0
- package/linter/linter-executor.d.ts +9 -0
- package/linter/linter-executor.js +26 -0
- package/linter/linter-format.d.ts +65 -0
- package/linter/linter-format.js +9 -0
- package/linter/linter-rules.d.ts +42 -0
- package/linter/linter-rules.js +14 -0
- package/linter/rules/1-deprecated-functions.d.ts +34 -0
- package/linter/rules/1-deprecated-functions.js +54 -0
- package/linter/rules/2-file-path-validity.d.ts +48 -0
- package/linter/rules/2-file-path-validity.js +93 -0
- package/package.json +2 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -2
- package/queries/catalog/call-context-query/call-context-query-format.js +5 -1
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +2 -0
- package/queries/catalog/cluster-query/cluster-query-format.js +5 -1
- package/queries/catalog/config-query/config-query-format.d.ts +1 -0
- package/queries/catalog/config-query/config-query-format.js +2 -1
- package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +3 -0
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +20 -0
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +81 -0
- package/queries/catalog/control-flow-query/control-flow-query-format.js +34 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -1
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +2 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.js +9 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +33 -32
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -0
- package/queries/catalog/dependencies-query/dependencies-query-format.js +10 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -1
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -0
- package/queries/catalog/id-map-query/id-map-query-format.js +2 -1
- package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -0
- package/queries/catalog/lineage-query/lineage-query-format.js +5 -1
- package/queries/catalog/linter-query/linter-query-executor.d.ts +3 -0
- package/queries/catalog/linter-query/linter-query-executor.js +28 -0
- package/queries/catalog/linter-query/linter-query-format.d.ts +80 -0
- package/queries/catalog/linter-query/linter-query-format.js +44 -0
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -0
- package/queries/catalog/location-map-query/location-map-query-format.js +2 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -1
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
- package/queries/catalog/origin-query/origin-query-format.js +5 -1
- package/queries/catalog/project-query/project-query-executor.js +1 -1
- package/queries/catalog/project-query/project-query-format.d.ts +1 -0
- package/queries/catalog/project-query/project-query-format.js +2 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +3 -3
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +3 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -23
- package/queries/catalog/search-query/search-query-format.d.ts +1 -0
- package/queries/catalog/search-query/search-query-format.js +5 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +9 -1
- package/queries/query.d.ts +143 -1
- package/queries/query.js +4 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +11 -4
- package/r-bridge/retriever.js +1 -1
- package/search/flowr-search-builder.d.ts +31 -2
- package/search/flowr-search-builder.js +30 -0
- package/search/flowr-search.d.ts +7 -1
- package/search/search-executor/search-enrichers.d.ts +73 -0
- package/search/search-executor/search-enrichers.js +101 -0
- package/search/search-executor/search-generators.d.ts +6 -1
- package/search/search-executor/search-generators.js +21 -1
- package/search/search-executor/search-mappers.d.ts +19 -0
- package/search/search-executor/search-mappers.js +21 -0
- package/search/search-executor/search-transformer.d.ts +12 -0
- package/search/search-executor/search-transformer.js +11 -1
- package/slicing/criterion/parse.d.ts +8 -0
- package/slicing/criterion/parse.js +20 -0
- package/util/version.js +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeControlFlowQuery = executeControlFlowQuery;
|
|
4
|
+
const log_1 = require("../../../util/log");
|
|
5
|
+
const extract_cfg_1 = require("../../../control-flow/extract-cfg");
|
|
6
|
+
function executeControlFlowQuery({ dataflow: { graph }, ast }, queries) {
|
|
7
|
+
if (queries.length !== 1) {
|
|
8
|
+
log_1.log.warn('The control flow query expects only up to one query, but got', queries.length);
|
|
9
|
+
}
|
|
10
|
+
const query = queries[0];
|
|
11
|
+
const start = Date.now();
|
|
12
|
+
const controlFlow = (0, extract_cfg_1.extractCfg)(ast, graph, query.config?.simplificationPasses);
|
|
13
|
+
return {
|
|
14
|
+
'.meta': {
|
|
15
|
+
timing: Date.now() - start
|
|
16
|
+
},
|
|
17
|
+
controlFlow
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=control-flow-query-executor.js.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
2
|
+
import Joi from 'joi';
|
|
3
|
+
import { executeControlFlowQuery } from './control-flow-query-executor';
|
|
4
|
+
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
5
|
+
import type { ControlFlowInformation } from '../../../control-flow/control-flow-graph';
|
|
6
|
+
import type { CfgSimplificationPassName } from '../../../control-flow/cfg-simplification';
|
|
7
|
+
/**
|
|
8
|
+
* Provides the control flow graph with an optional, fixed configuration
|
|
9
|
+
*/
|
|
10
|
+
export interface ControlFlowQuery extends BaseQueryFormat {
|
|
11
|
+
readonly type: 'control-flow';
|
|
12
|
+
readonly config?: {
|
|
13
|
+
/**
|
|
14
|
+
* If set, the control flow graph will be simplified using the given passes.
|
|
15
|
+
* Defaults to the default simplification order.
|
|
16
|
+
*/
|
|
17
|
+
simplificationPasses?: readonly CfgSimplificationPassName[];
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface ControlFlowQueryResult extends BaseQueryResult {
|
|
21
|
+
readonly controlFlow: ControlFlowInformation;
|
|
22
|
+
}
|
|
23
|
+
export declare const ControlFlowQueryDefinition: {
|
|
24
|
+
readonly executor: typeof executeControlFlowQuery;
|
|
25
|
+
readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, processed: import("../../../core/steps/pipeline/pipeline").PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
|
|
26
|
+
readonly name: "parse";
|
|
27
|
+
readonly humanReadableName: "parse with R shell";
|
|
28
|
+
readonly description: "Parse the given R code into an AST";
|
|
29
|
+
readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
|
|
30
|
+
readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
|
|
31
|
+
readonly printer: {
|
|
32
|
+
readonly 0: typeof import("../../../core/print/print").internalPrinter;
|
|
33
|
+
readonly 2: {
|
|
34
|
+
(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
|
|
35
|
+
(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
|
|
36
|
+
};
|
|
37
|
+
readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
|
|
38
|
+
};
|
|
39
|
+
readonly dependencies: readonly [];
|
|
40
|
+
readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
|
|
41
|
+
} | {
|
|
42
|
+
readonly name: "normalize";
|
|
43
|
+
readonly humanReadableName: "normalize";
|
|
44
|
+
readonly description: "Normalize the AST to flowR's AST";
|
|
45
|
+
readonly processor: (results: {
|
|
46
|
+
parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
|
|
47
|
+
}, 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>>;
|
|
48
|
+
readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
|
|
49
|
+
readonly printer: {
|
|
50
|
+
readonly 0: typeof import("../../../core/print/print").internalPrinter;
|
|
51
|
+
readonly 2: typeof import("../../../core/print/normalize-printer").normalizedAstToJson;
|
|
52
|
+
readonly 5: typeof import("../../../core/print/normalize-printer").normalizedAstToQuads;
|
|
53
|
+
readonly 3: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaid;
|
|
54
|
+
readonly 4: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaidUrl;
|
|
55
|
+
};
|
|
56
|
+
readonly dependencies: readonly ["parse"];
|
|
57
|
+
readonly requiredInput: import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput;
|
|
58
|
+
} | {
|
|
59
|
+
readonly humanReadableName: "dataflow";
|
|
60
|
+
readonly processor: (results: {
|
|
61
|
+
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
62
|
+
}, input: {
|
|
63
|
+
request?: import("../../../r-bridge/retriever").RParseRequests;
|
|
64
|
+
parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
|
|
65
|
+
}) => import("../../../dataflow/info").DataflowInformation;
|
|
66
|
+
readonly requiredInput: {};
|
|
67
|
+
readonly name: "dataflow";
|
|
68
|
+
readonly description: "Construct the dataflow graph";
|
|
69
|
+
readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
|
|
70
|
+
readonly printer: {
|
|
71
|
+
readonly 0: typeof import("../../../core/print/print").internalPrinter;
|
|
72
|
+
readonly 2: typeof import("../../../core/print/dataflow-printer").dataflowGraphToJson;
|
|
73
|
+
readonly 5: typeof import("../../../core/print/dataflow-printer").dataflowGraphToQuads;
|
|
74
|
+
readonly 3: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaid;
|
|
75
|
+
readonly 4: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaidUrl;
|
|
76
|
+
};
|
|
77
|
+
readonly dependencies: readonly ["normalize"];
|
|
78
|
+
}>>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
79
|
+
readonly schema: Joi.ObjectSchema<any>;
|
|
80
|
+
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
81
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
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.ControlFlowQueryDefinition = void 0;
|
|
7
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
8
|
+
const joi_1 = __importDefault(require("joi"));
|
|
9
|
+
const control_flow_query_executor_1 = require("./control-flow-query-executor");
|
|
10
|
+
const control_flow_graph_1 = require("../../../control-flow/control-flow-graph");
|
|
11
|
+
const cfg_1 = require("../../../util/mermaid/cfg");
|
|
12
|
+
const cfg_simplification_1 = require("../../../control-flow/cfg-simplification");
|
|
13
|
+
exports.ControlFlowQueryDefinition = {
|
|
14
|
+
executor: control_flow_query_executor_1.executeControlFlowQuery,
|
|
15
|
+
asciiSummarizer: (formatter, processed, queryResults, result) => {
|
|
16
|
+
const out = queryResults;
|
|
17
|
+
result.push(`Query: ${(0, ansi_1.bold)('control-flow', formatter)} (${out['.meta'].timing.toFixed(0)}ms)`);
|
|
18
|
+
result.push(` ╰ CFG: ${(0, cfg_1.cfgToMermaidUrl)(out.controlFlow, processed.normalize)}`);
|
|
19
|
+
return true;
|
|
20
|
+
},
|
|
21
|
+
schema: joi_1.default.object({
|
|
22
|
+
type: joi_1.default.string().valid('control-flow').required().description('The type of the query.'),
|
|
23
|
+
config: joi_1.default.object({
|
|
24
|
+
simplificationPasses: joi_1.default.array().items(joi_1.default.string().valid(...Object.keys(cfg_simplification_1.CfgSimplificationPasses))).description('The simplification passes to apply to the control flow graph. If unset, the default simplification order will be used.')
|
|
25
|
+
}).optional().description('Optional configuration for the control flow query.')
|
|
26
|
+
}).description('The control flow query provides the control flow graph of the analysis, optionally simplified.'),
|
|
27
|
+
flattenInvolvedNodes: (queryResults) => {
|
|
28
|
+
const out = queryResults;
|
|
29
|
+
return [...out.controlFlow.graph.vertices(true)]
|
|
30
|
+
.filter(([, v]) => v.type !== control_flow_graph_1.CfgVertexType.Block)
|
|
31
|
+
.map(v => v[0]);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=control-flow-query-format.js.map
|
|
@@ -19,6 +19,7 @@ exports.DataflowLensQueryDefinition = {
|
|
|
19
19
|
},
|
|
20
20
|
schema: joi_1.default.object({
|
|
21
21
|
type: joi_1.default.string().valid('dataflow-lens').required().description('The type of the query.'),
|
|
22
|
-
}).description('The dataflow-lens query returns a simplified view on the dataflow graph')
|
|
22
|
+
}).description('The dataflow-lens query returns a simplified view on the dataflow graph'),
|
|
23
|
+
flattenInvolvedNodes: () => []
|
|
23
24
|
};
|
|
24
25
|
//# sourceMappingURL=dataflow-lens-query-format.js.map
|
|
@@ -2,6 +2,7 @@ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
|
2
2
|
import type { DataflowGraph } from '../../../dataflow/graph/graph';
|
|
3
3
|
import { executeDataflowQuery } from './dataflow-query-executor';
|
|
4
4
|
import Joi from 'joi';
|
|
5
|
+
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
5
6
|
/**
|
|
6
7
|
* Simple re-returns the dataflow graph of the analysis.
|
|
7
8
|
*/
|
|
@@ -69,4 +70,5 @@ export declare const DataflowQueryDefinition: {
|
|
|
69
70
|
readonly dependencies: readonly ["normalize"];
|
|
70
71
|
}>>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
71
72
|
readonly schema: Joi.ObjectSchema<any>;
|
|
73
|
+
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
72
74
|
};
|
|
@@ -19,6 +19,14 @@ exports.DataflowQueryDefinition = {
|
|
|
19
19
|
},
|
|
20
20
|
schema: joi_1.default.object({
|
|
21
21
|
type: joi_1.default.string().valid('dataflow').required().description('The type of the query.'),
|
|
22
|
-
}).description('The dataflow query simply returns the dataflow graph, there is no need to pass it multiple times!')
|
|
22
|
+
}).description('The dataflow query simply returns the dataflow graph, there is no need to pass it multiple times!'),
|
|
23
|
+
flattenInvolvedNodes: queryResults => {
|
|
24
|
+
const flattened = [];
|
|
25
|
+
const out = queryResults;
|
|
26
|
+
for (const id of out.graph.idMap?.keys() ?? []) {
|
|
27
|
+
flattened.push(id);
|
|
28
|
+
}
|
|
29
|
+
return flattened;
|
|
30
|
+
}
|
|
23
31
|
};
|
|
24
32
|
//# sourceMappingURL=dataflow-query-format.js.map
|
|
@@ -11,13 +11,16 @@ const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-
|
|
|
11
11
|
const visitor_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/visitor");
|
|
12
12
|
const assert_1 = require("../../../util/assert");
|
|
13
13
|
const objects_1 = require("../../../util/objects");
|
|
14
|
-
const resolve_by_name_1 = require("../../../dataflow/environments/resolve-by-name");
|
|
15
14
|
const library_functions_1 = require("./function-info/library-functions");
|
|
16
15
|
const source_functions_1 = require("./function-info/source-functions");
|
|
17
16
|
const read_functions_1 = require("./function-info/read-functions");
|
|
18
17
|
const write_functions_1 = require("./function-info/write-functions");
|
|
19
18
|
const function_info_1 = require("./function-info/function-info");
|
|
20
19
|
const identify_link_to_last_call_relation_1 = require("../call-context-query/identify-link-to-last-call-relation");
|
|
20
|
+
const r_value_1 = require("../../../dataflow/eval/values/r-value");
|
|
21
|
+
const general_1 = require("../../../dataflow/eval/values/general");
|
|
22
|
+
const alias_tracking_1 = require("../../../dataflow/eval/resolve/alias-tracking");
|
|
23
|
+
const string_constants_1 = require("../../../dataflow/eval/values/string/string-constants");
|
|
21
24
|
function collectNamespaceAccesses(data, libraries) {
|
|
22
25
|
/* for libraries, we have to additionally track all uses of `::` and `:::`, for this we currently simply traverse all uses */
|
|
23
26
|
(0, visitor_1.visitAst)(data.ast.ast, n => {
|
|
@@ -203,31 +206,32 @@ function resolveBasedOnConfig(data, vertex, argument, environment, idMap, resolv
|
|
|
203
206
|
full = false;
|
|
204
207
|
}
|
|
205
208
|
}
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
209
|
+
full = true;
|
|
210
|
+
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(argument, { environment, graph: data.dataflow.graph, full: full }));
|
|
211
|
+
if (resolved) {
|
|
212
|
+
const values = [];
|
|
213
|
+
for (const value of resolved.elements) {
|
|
214
|
+
if (!(0, r_value_1.isValue)(value)) {
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
217
|
+
if (value.type === 'string' && (0, r_value_1.isValue)(value.value)) {
|
|
218
|
+
values.push(value.value.str);
|
|
219
|
+
}
|
|
220
|
+
else if (value.type === 'logical' && (0, r_value_1.isValue)(value.value)) {
|
|
221
|
+
values.push(value.value.valueOf() ? 'TRUE' : 'FALSE');
|
|
222
|
+
}
|
|
223
|
+
else if (value.type === 'vector' && (0, r_value_1.isValue)(value.elements)) {
|
|
224
|
+
const elements = (0, string_constants_1.collectStrings)(value.elements);
|
|
225
|
+
if (elements === undefined) {
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
values.push(...elements);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
return undefined;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return values;
|
|
231
235
|
}
|
|
232
236
|
}
|
|
233
237
|
/**
|
|
@@ -254,16 +258,14 @@ function getArgumentValue(data, vertex, argumentIndex, argumentName, resolveValu
|
|
|
254
258
|
valueNode = valueNode.value;
|
|
255
259
|
}
|
|
256
260
|
if (valueNode) {
|
|
257
|
-
// TDODO: extend vector support etc.
|
|
258
261
|
// this should be evaluated in the callee-context
|
|
259
|
-
const values = resolveBasedOnConfig(data, vertex, valueNode, vertex.environment, graph.idMap, resolveValue)
|
|
260
|
-
?.map(unwrapRValue) ?? [dependencies_query_format_1.Unknown];
|
|
262
|
+
const values = resolveBasedOnConfig(data, vertex, valueNode, vertex.environment, graph.idMap, resolveValue) ?? [dependencies_query_format_1.Unknown];
|
|
261
263
|
map.set(ref, new Set(values));
|
|
262
264
|
}
|
|
263
265
|
}
|
|
264
266
|
return map;
|
|
265
267
|
}
|
|
266
|
-
if (vertex.args.length
|
|
268
|
+
if (argumentIndex < vertex.args.length) {
|
|
267
269
|
const arg = (0, graph_1.getReferenceOfArgument)(vertex.args[argumentIndex]);
|
|
268
270
|
if (!arg) {
|
|
269
271
|
return undefined;
|
|
@@ -273,8 +275,7 @@ function getArgumentValue(data, vertex, argumentIndex, argumentName, resolveValu
|
|
|
273
275
|
valueNode = valueNode.value;
|
|
274
276
|
}
|
|
275
277
|
if (valueNode) {
|
|
276
|
-
const values = resolveBasedOnConfig(data, vertex, valueNode, vertex.environment, graph.idMap, resolveValue)
|
|
277
|
-
?.map(unwrapRValue) ?? [dependencies_query_format_1.Unknown];
|
|
278
|
+
const values = resolveBasedOnConfig(data, vertex, valueNode, vertex.environment, graph.idMap, resolveValue) ?? [dependencies_query_format_1.Unknown];
|
|
278
279
|
return new Map([[arg, new Set(values)]]);
|
|
279
280
|
}
|
|
280
281
|
}
|
|
@@ -94,4 +94,5 @@ export declare const DependenciesQueryDefinition: {
|
|
|
94
94
|
readonly dependencies: readonly ["normalize"];
|
|
95
95
|
}>>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
96
96
|
readonly schema: Joi.ObjectSchema<any>;
|
|
97
|
+
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
97
98
|
};
|
|
@@ -53,6 +53,15 @@ exports.DependenciesQueryDefinition = {
|
|
|
53
53
|
sourceFunctions: functionInfoSchema.description('The set of source functions to search for.'),
|
|
54
54
|
readFunctions: functionInfoSchema.description('The set of data reading functions to search for.'),
|
|
55
55
|
writeFunctions: functionInfoSchema.description('The set of data writing functions to search for.'),
|
|
56
|
-
}).description('The dependencies query retrieves and returns the set of all dependencies in the dataflow graph, which includes libraries, sourced files, read data, and written data.')
|
|
56
|
+
}).description('The dependencies query retrieves and returns the set of all dependencies in the dataflow graph, which includes libraries, sourced files, read data, and written data.'),
|
|
57
|
+
flattenInvolvedNodes: (queryResults) => {
|
|
58
|
+
const out = queryResults;
|
|
59
|
+
return [
|
|
60
|
+
...out.libraries.map(library => library.nodeId),
|
|
61
|
+
...out.sourcedFiles.map(sourced => sourced.nodeId),
|
|
62
|
+
...out.readData.map(read => read.nodeId),
|
|
63
|
+
...out.writtenData.map(write => write.nodeId)
|
|
64
|
+
];
|
|
65
|
+
}
|
|
57
66
|
};
|
|
58
67
|
//# sourceMappingURL=dependencies-query-format.js.map
|
|
@@ -22,6 +22,7 @@ exports.HappensBeforeQueryDefinition = {
|
|
|
22
22
|
type: joi_1.default.string().valid('happens-before').required().description('The type of the query.'),
|
|
23
23
|
a: joi_1.default.string().required().description('The first slicing criterion.'),
|
|
24
24
|
b: joi_1.default.string().required().description('The second slicing criterion.')
|
|
25
|
-
}).description('Happens-Before tracks whether a always happens before b.')
|
|
25
|
+
}).description('Happens-Before tracks whether a always happens before b.'),
|
|
26
|
+
flattenInvolvedNodes: () => []
|
|
26
27
|
};
|
|
27
28
|
//# sourceMappingURL=happens-before-query-format.js.map
|
|
@@ -19,6 +19,7 @@ exports.IdMapQueryDefinition = {
|
|
|
19
19
|
},
|
|
20
20
|
schema: joi_1.default.object({
|
|
21
21
|
type: joi_1.default.string().valid('id-map').required().description('The type of the query.'),
|
|
22
|
-
}).description('The id map query retrieves the id map from the normalized AST.')
|
|
22
|
+
}).description('The id map query retrieves the id map from the normalized AST.'),
|
|
23
|
+
flattenInvolvedNodes: () => []
|
|
23
24
|
};
|
|
24
25
|
//# sourceMappingURL=id-map-query-format.js.map
|
|
@@ -71,4 +71,5 @@ export declare const LineageQueryDefinition: {
|
|
|
71
71
|
readonly dependencies: readonly ["normalize"];
|
|
72
72
|
}>>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
73
73
|
readonly schema: Joi.ObjectSchema<any>;
|
|
74
|
+
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
74
75
|
};
|
|
@@ -22,6 +22,10 @@ exports.LineageQueryDefinition = {
|
|
|
22
22
|
schema: joi_1.default.object({
|
|
23
23
|
type: joi_1.default.string().valid('lineage').required().description('The type of the query.'),
|
|
24
24
|
criterion: joi_1.default.string().required().description('The slicing criterion of the node to get the lineage of.')
|
|
25
|
-
}).description('Lineage query used to find the lineage of a node in the dataflow graph')
|
|
25
|
+
}).description('Lineage query used to find the lineage of a node in the dataflow graph'),
|
|
26
|
+
flattenInvolvedNodes: (queryResults) => {
|
|
27
|
+
const out = queryResults;
|
|
28
|
+
return Object.values(out.lineages).flatMap(lineage => [...lineage]);
|
|
29
|
+
}
|
|
26
30
|
};
|
|
27
31
|
//# sourceMappingURL=lineage-query-format.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeLinterQuery = executeLinterQuery;
|
|
4
|
+
const linter_rules_1 = require("../../../linter/linter-rules");
|
|
5
|
+
const log_1 = require("../../../util/log");
|
|
6
|
+
const linter_executor_1 = require("../../../linter/linter-executor");
|
|
7
|
+
function executeLinterQuery({ ast, dataflow }, queries) {
|
|
8
|
+
const flattened = queries.flatMap(q => q.rules ?? Object.keys(linter_rules_1.LintingRules));
|
|
9
|
+
const distinct = new Set(flattened);
|
|
10
|
+
if (distinct.size !== flattened.length) {
|
|
11
|
+
const pretty = [...distinct].filter(r => flattened.indexOf(r) !== flattened.lastIndexOf(r)).map(r => typeof r === 'string' ? r : r.name).join(', ');
|
|
12
|
+
log_1.log.warn(`Linter query collection contains duplicate rules ${pretty}, only linting for each rule once`);
|
|
13
|
+
}
|
|
14
|
+
const results = { results: {} };
|
|
15
|
+
const start = Date.now();
|
|
16
|
+
const input = { normalize: ast, dataflow };
|
|
17
|
+
for (const entry of distinct) {
|
|
18
|
+
const ruleName = typeof entry === 'string' ? entry : entry.name;
|
|
19
|
+
results.results[ruleName] = (0, linter_executor_1.executeLintingRule)(ruleName, input, entry?.config);
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
...results,
|
|
23
|
+
'.meta': {
|
|
24
|
+
timing: Date.now() - start
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=linter-query-executor.js.map
|
|
@@ -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,44 @@
|
|
|
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
|
+
const doc_code_1 = require("../../../documentation/doc-util/doc-code");
|
|
14
|
+
exports.LinterQueryDefinition = {
|
|
15
|
+
executor: linter_query_executor_1.executeLinterQuery,
|
|
16
|
+
asciiSummarizer: (formatter, _processed, queryResults, result) => {
|
|
17
|
+
const out = queryResults;
|
|
18
|
+
result.push(`Query: ${(0, ansi_1.bold)('linter', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
|
|
19
|
+
for (const [ruleName, results] of Object.entries(out.results)) {
|
|
20
|
+
const rule = linter_rules_1.LintingRules[ruleName];
|
|
21
|
+
result.push(` ╰ ${ruleName}:`);
|
|
22
|
+
for (const certainty of [linter_format_1.LintingCertainty.Definitely, linter_format_1.LintingCertainty.Maybe]) {
|
|
23
|
+
const certaintyResults = results.results.filter(r => r.certainty === certainty);
|
|
24
|
+
if (certaintyResults.length) {
|
|
25
|
+
result.push(` ╰ ${certainty}:`);
|
|
26
|
+
for (const res of certaintyResults) {
|
|
27
|
+
result.push(` ╰ ${rule.prettyPrint(res)}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
result.push(` ╰ _Metadata_: ${(0, doc_code_1.codeInline)(JSON.stringify(results['.meta']))}`);
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
},
|
|
35
|
+
schema: joi_1.default.object({
|
|
36
|
+
type: joi_1.default.string().valid('linter').required().description('The type of the query.'),
|
|
37
|
+
rules: joi_1.default.array().items(joi_1.default.string().valid(...Object.keys(linter_rules_1.LintingRules)), joi_1.default.object({
|
|
38
|
+
name: joi_1.default.string().valid(...Object.keys(linter_rules_1.LintingRules)).required(),
|
|
39
|
+
config: joi_1.default.object()
|
|
40
|
+
})).description('The rules to lint for. If unset, all rules will be included.')
|
|
41
|
+
}).description('The linter query lints for the given set of rules and returns the result.'),
|
|
42
|
+
flattenInvolvedNodes: () => []
|
|
43
|
+
};
|
|
44
|
+
//# 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
|
|
@@ -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('
|
|
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': {
|