@eagleoutice/flowr 2.3.0 → 2.4.1
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 +42 -30
- package/abstract-interpretation/data-frame/absint-visitor.d.ts +2 -3
- package/abstract-interpretation/data-frame/absint-visitor.js +14 -16
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +3 -3
- package/abstract-interpretation/data-frame/semantics.d.ts +1 -1
- package/abstract-interpretation/data-frame/semantics.js +7 -10
- package/abstract-interpretation/data-frame/shape-inference.js +2 -8
- package/benchmark/slicer.js +7 -5
- package/benchmark/stats/size-of.js +3 -3
- package/benchmark/summarizer/second-phase/graph.js +1 -1
- package/benchmark/summarizer/second-phase/process.js +1 -1
- package/cli/benchmark-app.d.ts +1 -0
- package/cli/benchmark-app.js +1 -0
- package/cli/benchmark-helper-app.d.ts +1 -0
- package/cli/benchmark-helper-app.js +4 -3
- package/cli/common/options.js +2 -0
- package/cli/repl/commands/repl-query.js +1 -1
- package/cli/repl/server/connection.js +14 -5
- package/control-flow/basic-cfg-guided-visitor.d.ts +1 -2
- package/control-flow/basic-cfg-guided-visitor.js +0 -6
- package/control-flow/cfg-simplification.d.ts +6 -0
- package/control-flow/cfg-simplification.js +18 -9
- package/control-flow/control-flow-graph.d.ts +2 -8
- package/control-flow/control-flow-graph.js +1 -6
- package/control-flow/extract-cfg.d.ts +2 -2
- package/control-flow/extract-cfg.js +52 -63
- package/core/pipeline-executor.js +0 -8
- package/core/steps/all/static-slicing/00-slice.d.ts +7 -1
- package/core/steps/all/static-slicing/00-slice.js +9 -3
- package/core/steps/pipeline/default-pipelines.d.ts +74 -74
- package/dataflow/environments/append.js +1 -1
- package/dataflow/environments/built-in-config.d.ts +12 -4
- package/dataflow/environments/built-in-config.js +23 -82
- package/dataflow/environments/built-in.d.ts +40 -6
- package/dataflow/environments/built-in.js +119 -23
- package/dataflow/environments/clone.d.ts +3 -2
- package/dataflow/environments/clone.js +6 -5
- package/dataflow/environments/define.js +1 -2
- package/dataflow/environments/diff.js +1 -3
- package/dataflow/environments/environment.d.ts +18 -24
- package/dataflow/environments/environment.js +25 -37
- package/dataflow/environments/overwrite.d.ts +1 -1
- package/dataflow/environments/overwrite.js +1 -1
- package/dataflow/environments/remove.d.ts +2 -2
- package/dataflow/environments/remove.js +3 -4
- package/dataflow/environments/resolve-by-name.d.ts +3 -3
- package/dataflow/environments/resolve-by-name.js +4 -5
- package/dataflow/eval/resolve/alias-tracking.d.ts +12 -12
- package/dataflow/eval/resolve/alias-tracking.js +12 -12
- package/dataflow/eval/resolve/resolve.js +1 -1
- package/dataflow/extractor.js +6 -1
- package/dataflow/graph/dataflowgraph-builder.d.ts +3 -1
- package/dataflow/graph/dataflowgraph-builder.js +2 -2
- package/dataflow/graph/graph.d.ts +2 -1
- package/dataflow/graph/graph.js +6 -2
- package/dataflow/graph/invert-dfg.d.ts +2 -0
- package/dataflow/graph/invert-dfg.js +17 -0
- package/dataflow/info.d.ts +1 -1
- package/dataflow/internal/linker.js +9 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +3 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +1 -1
- package/dataflow/processor.d.ts +5 -1
- package/documentation/doc-util/doc-env.js +1 -2
- package/documentation/doc-util/doc-query.js +1 -1
- package/documentation/doc-util/doc-search.js +2 -2
- package/documentation/print-cfg-wiki.js +3 -4
- package/documentation/print-core-wiki.js +2 -2
- package/documentation/print-dataflow-graph-wiki.js +7 -0
- package/documentation/print-faq-wiki.js +4 -0
- package/documentation/print-linter-wiki.js +32 -4
- package/documentation/print-linting-and-testing-wiki.js +13 -1
- package/documentation/print-onboarding-wiki.js +4 -0
- package/documentation/print-query-wiki.js +12 -3
- package/linter/linter-executor.js +1 -2
- package/linter/linter-format.d.ts +26 -4
- package/linter/linter-format.js +25 -6
- package/linter/linter-rules.d.ts +40 -12
- package/linter/linter-rules.js +3 -1
- package/linter/rules/absolute-path.d.ts +4 -7
- package/linter/rules/absolute-path.js +9 -6
- package/linter/rules/dataframe-access-validation.d.ts +3 -1
- package/linter/rules/dataframe-access-validation.js +3 -1
- package/linter/rules/dead-code.d.ts +43 -0
- package/linter/rules/dead-code.js +50 -0
- package/linter/rules/deprecated-functions.d.ts +3 -2
- package/linter/rules/deprecated-functions.js +3 -1
- package/linter/rules/file-path-validity.d.ts +4 -4
- package/linter/rules/file-path-validity.js +8 -6
- package/linter/rules/naming-convention.d.ts +4 -3
- package/linter/rules/naming-convention.js +3 -1
- package/linter/rules/seeded-randomness.d.ts +4 -3
- package/linter/rules/seeded-randomness.js +3 -1
- package/linter/rules/unused-definition.d.ts +2 -0
- package/linter/rules/unused-definition.js +3 -1
- package/package.json +1 -1
- package/queries/base-query-format.d.ts +2 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +7 -7
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +24 -1
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +9 -5
- package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -2
- package/queries/catalog/dependencies-query/function-info/write-functions.js +6 -0
- package/queries/catalog/linter-query/linter-query-format.js +1 -1
- package/queries/catalog/location-map-query/location-map-query-executor.js +7 -5
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +3 -0
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -0
- package/queries/catalog/search-query/search-query-executor.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +3 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -1
- package/queries/query-print.d.ts +1 -1
- package/queries/query-print.js +0 -1
- package/queries/query.d.ts +16 -5
- package/queries/query.js +24 -11
- package/search/flowr-search-builder.d.ts +6 -6
- package/search/flowr-search-executor.d.ts +2 -2
- package/search/flowr-search-executor.js +1 -1
- package/search/flowr-search.d.ts +13 -8
- package/search/flowr-search.js +21 -0
- package/search/search-executor/search-enrichers.d.ts +87 -20
- package/search/search-executor/search-enrichers.js +44 -5
- package/search/search-executor/search-generators.d.ts +4 -4
- package/search/search-executor/search-generators.js +12 -7
- package/search/search-executor/search-mappers.js +3 -2
- package/search/search-executor/search-transformer.d.ts +3 -3
- package/search/search-executor/search-transformer.js +2 -2
- package/slicing/static/fingerprint.js +1 -2
- package/slicing/static/slice-call.d.ts +2 -1
- package/slicing/static/slice-call.js +3 -3
- package/slicing/static/static-slicer.d.ts +6 -5
- package/slicing/static/static-slicer.js +13 -7
- package/util/collections/arrays.d.ts +2 -0
- package/util/collections/arrays.js +9 -0
- package/util/containers.d.ts +1 -0
- package/util/containers.js +1 -0
- package/util/json.js +1 -4
- package/util/mermaid/dfg.js +5 -4
- package/util/prefix.d.ts +1 -1
- package/util/range.d.ts +1 -0
- package/util/range.js +5 -1
- package/util/version.js +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeLocationMapQuery = executeLocationMapQuery;
|
|
4
|
-
const
|
|
4
|
+
const parse_1 = require("../../../slicing/criterion/parse");
|
|
5
|
+
const assert_1 = require("../../../util/assert");
|
|
5
6
|
const fileIdRegex = /^(?<file>.*(\.[rR]))-/;
|
|
6
7
|
function fuzzyFindFile(node, idMap) {
|
|
7
8
|
if (node?.info.file) {
|
|
@@ -22,10 +23,11 @@ function fuzzyFindFile(node, idMap) {
|
|
|
22
23
|
return '<inline>';
|
|
23
24
|
}
|
|
24
25
|
function executeLocationMapQuery({ ast, dataflow: { graph } }, queries) {
|
|
25
|
-
if (queries.length !== 1) {
|
|
26
|
-
log_1.log.warn('Id-Map query expects only up to one query, but got', queries.length);
|
|
27
|
-
}
|
|
28
26
|
const start = Date.now();
|
|
27
|
+
const criteriaOfInterest = new Set(queries
|
|
28
|
+
.flatMap(q => q.ids ?? [])
|
|
29
|
+
.map(c => (0, parse_1.tryResolveSliceCriterionToId)(c, ast.idMap))
|
|
30
|
+
.filter(assert_1.isNotUndefined));
|
|
29
31
|
const locationMap = {
|
|
30
32
|
files: {},
|
|
31
33
|
ids: {}
|
|
@@ -38,7 +40,7 @@ function executeLocationMapQuery({ ast, dataflow: { graph } }, queries) {
|
|
|
38
40
|
count++;
|
|
39
41
|
}
|
|
40
42
|
for (const [id, node] of ast.idMap.entries()) {
|
|
41
|
-
if (node.location) {
|
|
43
|
+
if (node.location && (criteriaOfInterest.size === 0 || criteriaOfInterest.has(id))) {
|
|
42
44
|
const file = fuzzyFindFile(node, ast.idMap);
|
|
43
45
|
locationMap.ids[id] = [
|
|
44
46
|
inverseMap.get(file) ?? -1,
|
|
@@ -4,8 +4,11 @@ import { type OutputFormatter } from '../../../util/text/ansi';
|
|
|
4
4
|
import Joi from 'joi';
|
|
5
5
|
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
6
6
|
import type { SourceRange } from '../../../util/range';
|
|
7
|
+
import type { SingleSlicingCriterion } from '../../../slicing/criterion/parse';
|
|
7
8
|
export interface LocationMapQuery extends BaseQueryFormat {
|
|
8
9
|
readonly type: 'location-map';
|
|
10
|
+
/** Optional list of ids to filter the results by. If not provided, all ids will be included. */
|
|
11
|
+
readonly ids?: readonly SingleSlicingCriterion[];
|
|
9
12
|
}
|
|
10
13
|
export type FileId = number & {
|
|
11
14
|
readonly __fileId?: unique symbol;
|
|
@@ -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
|
+
ids: joi_1.default.array().items(joi_1.default.string()).optional().description('Optional list of ids to filter the results by.')
|
|
26
27
|
}).description('The location map query retrieves the location of every id in the ast.'),
|
|
27
28
|
flattenInvolvedNodes: () => []
|
|
28
29
|
};
|
|
@@ -9,7 +9,7 @@ function executeSearch({ ast, dataflow, config }, queries) {
|
|
|
9
9
|
const { search } = query;
|
|
10
10
|
results.push({
|
|
11
11
|
ids: (0, flowr_search_executor_1.runSearch)(search, { normalize: ast, dataflow, config })
|
|
12
|
-
.map(({ node }) => node.info.id),
|
|
12
|
+
.getElements().map(({ node }) => node.info.id),
|
|
13
13
|
search
|
|
14
14
|
});
|
|
15
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { StaticSliceQuery, StaticSliceQueryResult } from './static-slice-query-format';
|
|
2
2
|
import type { BasicQueryData } from '../../base-query-format';
|
|
3
3
|
export declare function fingerPrintOfQuery(query: StaticSliceQuery): string;
|
|
4
|
-
export declare function executeStaticSliceQuery({ dataflow
|
|
4
|
+
export declare function executeStaticSliceQuery({ dataflow, ast, config }: BasicQueryData, queries: readonly StaticSliceQuery[]): StaticSliceQueryResult;
|
|
@@ -7,10 +7,11 @@ const reconstruct_1 = require("../../../reconstruct/reconstruct");
|
|
|
7
7
|
const auto_select_defaults_1 = require("../../../reconstruct/auto-select/auto-select-defaults");
|
|
8
8
|
const magic_comments_1 = require("../../../reconstruct/auto-select/magic-comments");
|
|
9
9
|
const log_1 = require("../../../util/log");
|
|
10
|
+
const _00_slice_1 = require("../../../core/steps/all/static-slicing/00-slice");
|
|
10
11
|
function fingerPrintOfQuery(query) {
|
|
11
12
|
return JSON.stringify(query);
|
|
12
13
|
}
|
|
13
|
-
function executeStaticSliceQuery({ dataflow
|
|
14
|
+
function executeStaticSliceQuery({ dataflow, ast, config }, queries) {
|
|
14
15
|
const start = Date.now();
|
|
15
16
|
const results = {};
|
|
16
17
|
for (const query of queries) {
|
|
@@ -20,7 +21,7 @@ function executeStaticSliceQuery({ dataflow: { graph }, ast, config }, queries)
|
|
|
20
21
|
}
|
|
21
22
|
const { criteria, noReconstruction, noMagicComments } = query;
|
|
22
23
|
const sliceStart = Date.now();
|
|
23
|
-
const slice = (0, static_slicer_1.
|
|
24
|
+
const slice = (0, static_slicer_1.staticSlice)(dataflow, ast, criteria, query.direction ?? _00_slice_1.SliceDirection.Backward, config.solver.slicer?.threshold);
|
|
24
25
|
const sliceEnd = Date.now();
|
|
25
26
|
if (noReconstruction) {
|
|
26
27
|
results[key] = { slice: { ...slice, '.meta': { timing: sliceEnd - sliceStart } } };
|
|
@@ -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 { SliceDirection } from '../../../core/steps/all/static-slicing/00-slice';
|
|
7
8
|
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
8
9
|
/** Calculates and returns all clusters encountered in the dataflow graph. */
|
|
9
10
|
export interface StaticSliceQuery extends BaseQueryFormat {
|
|
@@ -14,6 +15,8 @@ export interface StaticSliceQuery extends BaseQueryFormat {
|
|
|
14
15
|
readonly noReconstruction?: boolean;
|
|
15
16
|
/** Should the magic comments (force-including lines within the slice) be ignored? */
|
|
16
17
|
readonly noMagicComments?: boolean;
|
|
18
|
+
/** The direction to slice in. Defaults to backward slicing if unset. */
|
|
19
|
+
readonly direction?: SliceDirection;
|
|
17
20
|
}
|
|
18
21
|
export interface StaticSliceQueryResult extends BaseQueryResult {
|
|
19
22
|
/**
|
|
@@ -9,6 +9,7 @@ const time_1 = require("../../../util/text/time");
|
|
|
9
9
|
const joi_1 = __importDefault(require("joi"));
|
|
10
10
|
const static_slice_query_executor_1 = require("./static-slice-query-executor");
|
|
11
11
|
const query_print_1 = require("../../query-print");
|
|
12
|
+
const _00_slice_1 = require("../../../core/steps/all/static-slicing/00-slice");
|
|
12
13
|
exports.StaticSliceQueryDefinition = {
|
|
13
14
|
executor: static_slice_query_executor_1.executeStaticSliceQuery,
|
|
14
15
|
asciiSummarizer: (formatter, _processed, queryResults, result) => {
|
|
@@ -37,7 +38,8 @@ exports.StaticSliceQueryDefinition = {
|
|
|
37
38
|
type: joi_1.default.string().valid('static-slice').required().description('The type of the query.'),
|
|
38
39
|
criteria: joi_1.default.array().items(joi_1.default.string()).min(0).required().description('The slicing criteria to use.'),
|
|
39
40
|
noReconstruction: joi_1.default.boolean().optional().description('Do not reconstruct the slice into readable code.'),
|
|
40
|
-
noMagicComments: joi_1.default.boolean().optional().description('Should the magic comments (force-including lines within the slice) be ignored?')
|
|
41
|
+
noMagicComments: joi_1.default.boolean().optional().description('Should the magic comments (force-including lines within the slice) be ignored?'),
|
|
42
|
+
direction: joi_1.default.string().valid(...Object.values(_00_slice_1.SliceDirection)).optional().description('The direction to slice in. Defaults to backward slicing if unset.')
|
|
41
43
|
}).description('Slice query used to slice the dataflow graph'),
|
|
42
44
|
flattenInvolvedNodes: (queryResults) => {
|
|
43
45
|
const flattened = [];
|
package/queries/query-print.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ import type { DEFAULT_DATAFLOW_PIPELINE } from '../core/steps/pipeline/default-p
|
|
|
5
5
|
import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
6
6
|
export declare function asciiCallContext(formatter: OutputFormatter, results: QueryResults<'call-context'>['call-context'], processed: PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>): string;
|
|
7
7
|
export declare function summarizeIdsIfTooLong(formatter: OutputFormatter, ids: readonly NodeId[]): string;
|
|
8
|
-
export declare function asciiSummaryOfQueryResult(formatter: OutputFormatter, totalInMs: number, results: QueryResults<
|
|
8
|
+
export declare function asciiSummaryOfQueryResult<S extends SupportedQueryTypes>(formatter: OutputFormatter, totalInMs: number, results: Awaited<QueryResults<S>>, processed: PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>): string;
|
package/queries/query-print.js
CHANGED
|
@@ -81,7 +81,6 @@ function asciiSummaryOfQueryResult(formatter, totalInMs, results, processed) {
|
|
|
81
81
|
}
|
|
82
82
|
result.push(`Query: ${(0, ansi_1.bold)(query, formatter)}`);
|
|
83
83
|
let timing = -1;
|
|
84
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
85
84
|
for (const [key, value] of Object.entries(queryResults)) {
|
|
86
85
|
if (key === '.meta') {
|
|
87
86
|
timing = value.timing;
|
package/queries/query.d.ts
CHANGED
|
@@ -25,11 +25,20 @@ import type { LinterQuery } from './catalog/linter-query/linter-query-format';
|
|
|
25
25
|
import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
26
26
|
import type { ControlFlowQuery } from './catalog/control-flow-query/control-flow-query-format';
|
|
27
27
|
import type { DfShapeQuery } from './catalog/df-shape-query/df-shape-query-format';
|
|
28
|
+
import type { AsyncOrSync, AsyncOrSyncType } from 'ts-essentials';
|
|
29
|
+
/**
|
|
30
|
+
* These are all queries that can be executed from within flowR
|
|
31
|
+
* {@link SynchronousQuery} are queries that can be executed synchronously, i.e., they do not return a Promise.
|
|
32
|
+
*/
|
|
28
33
|
export type Query = CallContextQuery | ConfigQuery | SearchQuery | DataflowQuery | ControlFlowQuery | DataflowLensQuery | DfShapeQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | LineageQuery | DependenciesQuery | LocationMapQuery | HappensBeforeQuery | ResolveValueQuery | ProjectQuery | OriginQuery | LinterQuery;
|
|
34
|
+
export type SynchronousQuery = Exclude<Query, {
|
|
35
|
+
executor: (query: Query) => Promise<unknown>;
|
|
36
|
+
}>;
|
|
37
|
+
export type SupportedSynchronousQueryTypes = SynchronousQuery['type'];
|
|
29
38
|
export type QueryArgumentsWithType<QueryType extends BaseQueryFormat['type']> = Query & {
|
|
30
39
|
type: QueryType;
|
|
31
40
|
};
|
|
32
|
-
export type QueryExecutor<Query extends BaseQueryFormat, Result extends BaseQueryResult> = (data: BasicQueryData, query: readonly Query[]) => Result
|
|
41
|
+
export type QueryExecutor<Query extends BaseQueryFormat, Result extends BaseQueryResult> = (data: BasicQueryData, query: readonly Query[]) => AsyncOrSync<Result>;
|
|
33
42
|
type SupportedQueries = {
|
|
34
43
|
[QueryType in Query['type']]: SupportedQuery<QueryType>;
|
|
35
44
|
};
|
|
@@ -1008,17 +1017,19 @@ export declare const SupportedQueries: {
|
|
|
1008
1017
|
};
|
|
1009
1018
|
};
|
|
1010
1019
|
export type SupportedQueryTypes = keyof typeof SupportedQueries;
|
|
1011
|
-
export type QueryResult<Type extends Query['type']> = ReturnType<typeof SupportedQueries[Type]['executor']
|
|
1012
|
-
export declare function executeQueriesOfSameType<SpecificQuery extends
|
|
1020
|
+
export type QueryResult<Type extends Query['type']> = AsyncOrSync<ReturnType<typeof SupportedQueries[Type]['executor']>>;
|
|
1021
|
+
export declare function executeQueriesOfSameType<SpecificQuery extends SynchronousQuery>(data: BasicQueryData, queries: readonly SpecificQuery[]): AsyncOrSyncType<QueryResult<SpecificQuery['type']>>;
|
|
1022
|
+
export declare function executeQueriesOfSameType<SpecificQuery extends Query>(data: BasicQueryData, queries: readonly SpecificQuery[]): QueryResult<SpecificQuery['type']>;
|
|
1013
1023
|
export type QueryResults<Base extends SupportedQueryTypes> = {
|
|
1014
|
-
readonly [QueryType in Base]: QueryResult<QueryType
|
|
1024
|
+
readonly [QueryType in Base]: Awaited<QueryResult<QueryType>>;
|
|
1015
1025
|
} & BaseQueryResult;
|
|
1016
1026
|
type OmitFromValues<T, K extends string | number | symbol> = {
|
|
1017
1027
|
[P in keyof T]?: Omit<T[P], K>;
|
|
1018
1028
|
};
|
|
1019
1029
|
export type QueryResultsWithoutMeta<Queries extends Query> = OmitFromValues<Omit<QueryResults<Queries['type']>, '.meta'>, '.meta'>;
|
|
1020
1030
|
export type Queries<Base extends SupportedQueryTypes, VirtualArguments extends VirtualCompoundConstraint<Base> = VirtualCompoundConstraint<Base>> = readonly (QueryArgumentsWithType<Base> | VirtualQueryArgumentsWithType<Base, VirtualArguments>)[];
|
|
1021
|
-
export declare function executeQueries<Base extends
|
|
1031
|
+
export declare function executeQueries<Base extends SupportedSynchronousQueryTypes, VirtualArguments extends VirtualCompoundConstraint<Base> = VirtualCompoundConstraint<Base>>(data: BasicQueryData, queries: Queries<Base, VirtualArguments>): QueryResults<Base>;
|
|
1032
|
+
export declare function executeQueries<Base extends SupportedQueryTypes, VirtualArguments extends VirtualCompoundConstraint<Base> = VirtualCompoundConstraint<Base>>(data: BasicQueryData, queries: Queries<Base, VirtualArguments>): AsyncOrSync<QueryResults<Base>>;
|
|
1022
1033
|
export declare function SupportedQueriesSchema(): Joi.AlternativesSchema<any>;
|
|
1023
1034
|
export declare const CompoundQuerySchema: Joi.ObjectSchema<any>;
|
|
1024
1035
|
export declare function VirtualQuerySchema(): Joi.AlternativesSchema<any>;
|
package/queries/query.js
CHANGED
|
@@ -53,7 +53,7 @@ exports.SupportedQueries = {
|
|
|
53
53
|
'origin': origin_query_format_1.OriginQueryDefinition,
|
|
54
54
|
'linter': linter_query_format_1.LinterQueryDefinition
|
|
55
55
|
};
|
|
56
|
-
function executeQueriesOfSameType(data,
|
|
56
|
+
function executeQueriesOfSameType(data, queries) {
|
|
57
57
|
(0, assert_1.guard)(queries.length > 0, 'At least one query must be provided');
|
|
58
58
|
/* every query must have the same type */
|
|
59
59
|
(0, assert_1.guard)(queries.every(q => q.type === queries[0].type), 'All queries must have the same type');
|
|
@@ -67,9 +67,7 @@ function isVirtualQuery(query) {
|
|
|
67
67
|
function groupQueriesByType(queries) {
|
|
68
68
|
const grouped = {};
|
|
69
69
|
function addQuery(query) {
|
|
70
|
-
|
|
71
|
-
grouped[query.type] = [];
|
|
72
|
-
}
|
|
70
|
+
grouped[query.type] ??= [];
|
|
73
71
|
grouped[query.type].push(query);
|
|
74
72
|
}
|
|
75
73
|
for (const query of queries) {
|
|
@@ -86,17 +84,32 @@ function groupQueriesByType(queries) {
|
|
|
86
84
|
}
|
|
87
85
|
return grouped;
|
|
88
86
|
}
|
|
87
|
+
function isPromiseLike(value) {
|
|
88
|
+
return value !== null && typeof value === 'object' && typeof value.then === 'function';
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* This is the main query execution function that takes a set of queries and executes them on the given data.
|
|
92
|
+
*/
|
|
89
93
|
function executeQueries(data, queries) {
|
|
90
94
|
const now = Date.now();
|
|
91
95
|
const grouped = groupQueriesByType(queries);
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
const entries = Object.entries(grouped);
|
|
97
|
+
const results = entries.map(([type, group]) => [type, executeQueriesOfSameType(data, group)]);
|
|
98
|
+
if (results.length === 0 || results.every(([_, r]) => !isPromiseLike(r))) {
|
|
99
|
+
// all results are synchronous, we can return them directly
|
|
100
|
+
const r = Object.fromEntries(results);
|
|
101
|
+
r['.meta'] = {
|
|
102
|
+
timing: Date.now() - now
|
|
103
|
+
};
|
|
104
|
+
return r;
|
|
95
105
|
}
|
|
96
|
-
results[
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
106
|
+
return Promise.all(results.map(([type, result]) => Promise.resolve(result).then(resolvedResult => [type, resolvedResult]))).then(resultsArray => {
|
|
107
|
+
const results = Object.fromEntries(resultsArray);
|
|
108
|
+
results['.meta'] = {
|
|
109
|
+
timing: Date.now() - now
|
|
110
|
+
};
|
|
111
|
+
return results;
|
|
112
|
+
});
|
|
100
113
|
}
|
|
101
114
|
function SupportedQueriesSchema() {
|
|
102
115
|
return joi_1.default.alternatives(Object.values(exports.SupportedQueries).map(q => q.schema)).description('Supported queries');
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
2
|
-
import type { FlowrSearchElement,
|
|
2
|
+
import type { FlowrSearchElement, FlowrSearchElements, FlowrSearchGetFilter } from './flowr-search';
|
|
3
3
|
import type { FlowrFilter, 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,
|
|
8
|
+
import type { Enrichment, EnrichmentElementArguments } from './search-executor/search-enrichers';
|
|
9
9
|
import type { MapperArguments } from './search-executor/search-mappers';
|
|
10
10
|
import { Mapper } from './search-executor/search-mappers';
|
|
11
11
|
import type { Query } from '../queries/query';
|
|
@@ -28,7 +28,7 @@ export declare const FlowrSearchGenerator: {
|
|
|
28
28
|
* Internally, the {@link SupportedQuery#flattenInvolvedNodes} function is used to flatten the resulting nodes of the query.
|
|
29
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
30
|
*/
|
|
31
|
-
readonly fromQuery: (...from: readonly Query[]) => FlowrSearchBuilder<"from-query", [], ParentInformation, FlowrSearchElements<ParentInformation,
|
|
31
|
+
readonly fromQuery: (...from: readonly Query[]) => FlowrSearchBuilder<"from-query", [], ParentInformation, FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>>;
|
|
32
32
|
/**
|
|
33
33
|
* Returns all elements (nodes/dataflow vertices) from the given data.
|
|
34
34
|
*/
|
|
@@ -86,7 +86,7 @@ export declare const Q: {
|
|
|
86
86
|
* Internally, the {@link SupportedQuery#flattenInvolvedNodes} function is used to flatten the resulting nodes of the query.
|
|
87
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
88
|
*/
|
|
89
|
-
readonly fromQuery: (...from: readonly Query[]) => FlowrSearchBuilder<"from-query", [], ParentInformation, FlowrSearchElements<ParentInformation,
|
|
89
|
+
readonly fromQuery: (...from: readonly Query[]) => FlowrSearchBuilder<"from-query", [], ParentInformation, FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>>;
|
|
90
90
|
/**
|
|
91
91
|
* Returns all elements (nodes/dataflow vertices) from the given data.
|
|
92
92
|
*/
|
|
@@ -188,7 +188,7 @@ export declare class FlowrSearchBuilder<Generator extends GeneratorNames, Transf
|
|
|
188
188
|
* Adds the given enrichment to each element of the search.
|
|
189
189
|
* Added enrichments can later be retrieved using the {@link enrichmentContent} function.
|
|
190
190
|
*/
|
|
191
|
-
with<ConcreteEnrichment extends Enrichment>(enrichment: ConcreteEnrichment, args?:
|
|
191
|
+
with<ConcreteEnrichment extends Enrichment>(enrichment: ConcreteEnrichment, args?: EnrichmentElementArguments<ConcreteEnrichment>): FlowrSearchBuilderOut<Generator, Transformers, Info, 'with'>;
|
|
192
192
|
/**
|
|
193
193
|
* Maps the elements of the search to new values using the given mapper function.
|
|
194
194
|
*/
|
|
@@ -196,7 +196,7 @@ export declare class FlowrSearchBuilder<Generator extends GeneratorNames, Transf
|
|
|
196
196
|
/**
|
|
197
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
198
|
*/
|
|
199
|
-
get<ConcreteEnrichment extends Enrichment>(enrichment: ConcreteEnrichment, args?:
|
|
199
|
+
get<ConcreteEnrichment extends Enrichment>(enrichment: ConcreteEnrichment, args?: EnrichmentElementArguments<ConcreteEnrichment>): FlowrSearchBuilderOut<Generator, Transformers, Info, 'with' | 'map'>;
|
|
200
200
|
/**
|
|
201
201
|
* merge combines the search results with those of another search.
|
|
202
202
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FlowrSearch, FlowrSearchLike, SearchOutput } from './flowr-search-builder';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FlowrSearchInput } from './flowr-search';
|
|
3
3
|
import type { Pipeline } from '../core/steps/pipeline/pipeline';
|
|
4
|
-
type GetSearchElements<S> = S extends FlowrSearch<infer _, infer _, infer _, infer Elements> ? Elements
|
|
4
|
+
type GetSearchElements<S> = S extends FlowrSearch<infer _, infer _, infer _, infer Elements> ? Elements : never;
|
|
5
5
|
/**
|
|
6
6
|
* Run a search with the given search query and data.
|
|
7
7
|
*/
|
|
@@ -11,6 +11,6 @@ function runSearch(search, data) {
|
|
|
11
11
|
const s = (0, flowr_search_builder_1.getFlowrSearch)(search);
|
|
12
12
|
return s.search.reduce((acc, transformer) => (0, search_transformer_1.getTransformer)(transformer.name)(data, acc, transformer.args),
|
|
13
13
|
/* support multiple arguments may be abstracted away in search frontend */
|
|
14
|
-
(0, search_generators_1.getGenerator)(s.generator.name)(data, s.generator.args))
|
|
14
|
+
(0, search_generators_1.getGenerator)(s.generator.name)(data, s.generator.args));
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=flowr-search-executor.js.map
|
package/search/flowr-search.d.ts
CHANGED
|
@@ -3,22 +3,18 @@ import type { Pipeline, PipelineOutput, PipelineStepOutputWithName } from '../co
|
|
|
3
3
|
import type { NormalizedAst } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
4
|
import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
5
5
|
import type { DataflowInformation } from '../dataflow/info';
|
|
6
|
-
import type { BaseQueryResult } from '../queries/base-query-format';
|
|
7
|
-
import type { Query } from '../queries/query';
|
|
8
6
|
import type { FlowrConfigOptions } from '../config';
|
|
9
|
-
import type {
|
|
7
|
+
import type { Enrichment, EnrichmentSearchArguments, EnrichmentElementContent, EnrichmentSearchContent } from './search-executor/search-enrichers';
|
|
10
8
|
/**
|
|
11
9
|
* Yes, for now we do technically not need a wrapper around the RNode, but this allows us to attach caches etc.
|
|
12
10
|
* just for the respective search.
|
|
13
11
|
*/
|
|
14
12
|
export interface FlowrSearchElement<Info> {
|
|
15
13
|
readonly node: RNode<Info>;
|
|
14
|
+
readonly enrichments?: {
|
|
15
|
+
[E in Enrichment]?: EnrichmentElementContent<E>;
|
|
16
|
+
};
|
|
16
17
|
}
|
|
17
|
-
export interface FlowrSearchElementFromQuery<Info> extends FlowrSearchElement<Info> {
|
|
18
|
-
readonly query: Query['type'];
|
|
19
|
-
readonly queryResult: BaseQueryResult;
|
|
20
|
-
}
|
|
21
|
-
export type FlowrSearchElementMaybeFromQuery<Info> = MarkOptional<FlowrSearchElementFromQuery<Info>, 'query' | 'queryResult'>;
|
|
22
18
|
export interface FlowrSearchNodeBase<Type extends string, Name extends string, Args extends Record<string, unknown> | undefined> {
|
|
23
19
|
readonly type: Type;
|
|
24
20
|
readonly name: Name;
|
|
@@ -59,10 +55,19 @@ export type FlowrSearchInput<P extends Pipeline> = MinimumInputForFlowrSearch<P>
|
|
|
59
55
|
/** Intentionally, we abstract away from an array to avoid the use of conventional typescript operations */
|
|
60
56
|
export declare class FlowrSearchElements<Info = NoInfo, Elements extends FlowrSearchElement<Info>[] = FlowrSearchElement<Info>[]> {
|
|
61
57
|
private elements;
|
|
58
|
+
private enrichments;
|
|
62
59
|
constructor(elements?: Elements);
|
|
63
60
|
add(element: FlowrSearchElement<Info>): this;
|
|
64
61
|
addAll(elements: FlowrSearchElement<Info>[]): this;
|
|
65
62
|
getElements(): Readonly<Elements>;
|
|
66
63
|
mutate<OutElements extends Elements>(mutator: (elements: Elements) => OutElements): this;
|
|
64
|
+
/**
|
|
65
|
+
* Enriches this flowr search element collection with the given enrichment.
|
|
66
|
+
* To retrieve enrichment content for a given enrichment type, use {@link enrichmentContent}.
|
|
67
|
+
*
|
|
68
|
+
* Please note that this function does not also enrich individual elements, which is done through {@link enrichElement}. Both functions are called in a consise manner in {@link FlowrSearchBuilder.with}, which is the preferred way to add enrichments to a search.
|
|
69
|
+
*/
|
|
70
|
+
enrich<E extends Enrichment>(data: FlowrSearchInput<Pipeline>, enrichment: E, args?: EnrichmentSearchArguments<E>): this;
|
|
71
|
+
enrichmentContent<E extends Enrichment>(enrichment: E): EnrichmentSearchContent<E>;
|
|
67
72
|
}
|
|
68
73
|
export {};
|
package/search/flowr-search.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FlowrSearchElements = void 0;
|
|
4
|
+
const search_enrichers_1 = require("./search-executor/search-enrichers");
|
|
4
5
|
/** Intentionally, we abstract away from an array to avoid the use of conventional typescript operations */
|
|
5
6
|
class FlowrSearchElements {
|
|
6
7
|
elements = [];
|
|
8
|
+
enrichments = {};
|
|
7
9
|
constructor(elements) {
|
|
8
10
|
if (elements) {
|
|
9
11
|
this.elements = elements;
|
|
@@ -24,6 +26,25 @@ class FlowrSearchElements {
|
|
|
24
26
|
this.elements = mutator(this.elements);
|
|
25
27
|
return this;
|
|
26
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Enriches this flowr search element collection with the given enrichment.
|
|
31
|
+
* To retrieve enrichment content for a given enrichment type, use {@link enrichmentContent}.
|
|
32
|
+
*
|
|
33
|
+
* Please note that this function does not also enrich individual elements, which is done through {@link enrichElement}. Both functions are called in a consise manner in {@link FlowrSearchBuilder.with}, which is the preferred way to add enrichments to a search.
|
|
34
|
+
*/
|
|
35
|
+
enrich(data, enrichment, args) {
|
|
36
|
+
const enrichmentData = search_enrichers_1.Enrichments[enrichment];
|
|
37
|
+
if (enrichmentData.enrichSearch !== undefined) {
|
|
38
|
+
this.enrichments = {
|
|
39
|
+
...this.enrichments ?? {},
|
|
40
|
+
[enrichment]: enrichmentData.enrichSearch(this, data, args, this.enrichments?.[enrichment])
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
enrichmentContent(enrichment) {
|
|
46
|
+
return this.enrichments?.[enrichment];
|
|
47
|
+
}
|
|
27
48
|
}
|
|
28
49
|
exports.FlowrSearchElements = FlowrSearchElements;
|
|
29
50
|
//# sourceMappingURL=flowr-search.js.map
|
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
import type { FlowrSearchElement, FlowrSearchInput } from '../flowr-search';
|
|
1
|
+
import type { FlowrSearchElement, FlowrSearchElements, FlowrSearchInput } from '../flowr-search';
|
|
2
2
|
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
3
|
import type { Pipeline } from '../../core/steps/pipeline/pipeline';
|
|
4
4
|
import type { MergeableRecord } from '../../util/objects';
|
|
5
5
|
import type { Identifier } from '../../dataflow/environments/identifier';
|
|
6
6
|
import type { LinkToLastCall } from '../../queries/catalog/call-context-query/call-context-query-format';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
[E in Enrichment]?: EnrichmentContent<E>;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export interface EnrichmentData<EnrichmentContent extends MergeableRecord, EnrichmentArguments = undefined> {
|
|
7
|
+
import { type NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
8
|
+
import type { ControlFlowInformation } from '../../control-flow/control-flow-graph';
|
|
9
|
+
import type { QueryResult, SynchronousQuery } from '../../queries/query';
|
|
10
|
+
import type { CfgSimplificationPassName } from '../../control-flow/cfg-simplification';
|
|
11
|
+
import type { AsyncOrSyncType } from 'ts-essentials';
|
|
12
|
+
export interface EnrichmentData<ElementContent extends MergeableRecord, ElementArguments = undefined, SearchContent extends MergeableRecord = never, SearchArguments = ElementArguments> {
|
|
17
13
|
/**
|
|
18
14
|
* A function that is applied to each element of the search to enrich it with additional data.
|
|
19
15
|
*/
|
|
20
|
-
readonly
|
|
16
|
+
readonly enrichElement?: (element: FlowrSearchElement<ParentInformation>, search: FlowrSearchElements<ParentInformation>, data: FlowrSearchInput<Pipeline>, args: ElementArguments | undefined, previousValue: ElementContent | undefined) => ElementContent;
|
|
17
|
+
readonly enrichSearch?: (search: FlowrSearchElements<ParentInformation>, data: FlowrSearchInput<Pipeline>, args: SearchArguments | undefined, previousValue: SearchContent | undefined) => SearchContent;
|
|
21
18
|
/**
|
|
22
19
|
* The mapping function used by the {@link Mapper.Enrichment} mapper.
|
|
23
20
|
*/
|
|
24
|
-
readonly mapper
|
|
21
|
+
readonly mapper?: (content: ElementContent) => FlowrSearchElement<ParentInformation>[];
|
|
25
22
|
}
|
|
26
|
-
export type
|
|
27
|
-
export type
|
|
23
|
+
export type EnrichmentElementContent<E extends Enrichment> = typeof Enrichments[E] extends EnrichmentData<infer EC, infer _EA, infer _SC, infer _SA> ? EC : never;
|
|
24
|
+
export type EnrichmentElementArguments<E extends Enrichment> = typeof Enrichments[E] extends EnrichmentData<infer _EC, infer EA, infer _SC, infer _SA> ? EA : never;
|
|
25
|
+
export type EnrichmentSearchContent<E extends Enrichment> = typeof Enrichments[E] extends EnrichmentData<infer _EC, infer _EA, infer SC, infer _SA> ? SC : never;
|
|
26
|
+
export type EnrichmentSearchArguments<E extends Enrichment> = typeof Enrichments[E] extends EnrichmentData<infer _EC, infer _EA, infer _SC, infer SA> ? SA : never;
|
|
28
27
|
/**
|
|
29
28
|
* An enumeration that stores the names of the available enrichments that can be applied to a set of search elements.
|
|
30
29
|
* See {@link FlowrSearchBuilder.with} for more information on how to apply enrichments.
|
|
31
30
|
*/
|
|
32
31
|
export declare enum Enrichment {
|
|
33
32
|
CallTargets = "call-targets",
|
|
34
|
-
LastCall = "last-call"
|
|
33
|
+
LastCall = "last-call",
|
|
34
|
+
CfgInformation = "cfg-information",
|
|
35
|
+
QueryData = "query-data"
|
|
35
36
|
}
|
|
36
37
|
export interface CallTargetsContent extends MergeableRecord {
|
|
37
38
|
/**
|
|
@@ -43,13 +44,52 @@ export interface CallTargetsContent extends MergeableRecord {
|
|
|
43
44
|
export interface LastCallContent extends MergeableRecord {
|
|
44
45
|
linkedIds: FlowrSearchElement<ParentInformation>[];
|
|
45
46
|
}
|
|
47
|
+
export interface CfgInformationElementContent extends MergeableRecord {
|
|
48
|
+
/**
|
|
49
|
+
* Whether the current node is a root node in the CFG, which is a node that is not contained inside of a function definition.
|
|
50
|
+
*/
|
|
51
|
+
isRoot: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the current node is reachable from the root of the CFG.
|
|
54
|
+
* Only has a value if {@link CfgInformationArguments.checkReachable} was true.
|
|
55
|
+
*/
|
|
56
|
+
isReachable?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface CfgInformationSearchContent extends MergeableRecord {
|
|
59
|
+
/**
|
|
60
|
+
* The CFG attached to the search, extracted using {@link extractCfg}.
|
|
61
|
+
*/
|
|
62
|
+
cfg: ControlFlowInformation;
|
|
63
|
+
/**
|
|
64
|
+
* The set of all nodes that are reachable from the root of the CFG, extracted using {@link visitCfgInOrder}.
|
|
65
|
+
* Only has a value if {@link CfgInformationArguments.checkReachable} was true.
|
|
66
|
+
*/
|
|
67
|
+
reachableNodes?: Set<NodeId>;
|
|
68
|
+
}
|
|
69
|
+
export interface CfgInformationArguments extends MergeableRecord {
|
|
70
|
+
/** Whether to recalculate the CFG information if it already exists on the current search. Defaults to `false`. */
|
|
71
|
+
forceRefresh?: boolean;
|
|
72
|
+
/** The simplification passes that should be run on the extracted CFG. Defaults to the entries of {@link DefaultCfgSimplificationOrder}. */
|
|
73
|
+
simplificationPasses?: CfgSimplificationPassName[];
|
|
74
|
+
/** Whether to check nodes for reachability, and subsequently set {@link CfgInformationSearchContent.reachableNodes} and {@link CfgInformationElementContent.isReachable}. Defaults to `false`. */
|
|
75
|
+
checkReachable?: boolean;
|
|
76
|
+
}
|
|
77
|
+
export interface QueryDataElementContent extends MergeableRecord {
|
|
78
|
+
/** The name of the query that this element originated from. To get each query's data, see {@link QueryDataSearchContent}. */
|
|
79
|
+
query: SynchronousQuery['type'];
|
|
80
|
+
}
|
|
81
|
+
export interface QueryDataSearchContent extends MergeableRecord {
|
|
82
|
+
queries: {
|
|
83
|
+
[QueryType in SynchronousQuery['type']]: AsyncOrSyncType<QueryResult<QueryType>>;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
46
86
|
/**
|
|
47
87
|
* The registry of enrichments that are currently supported by the search.
|
|
48
88
|
* See {@link FlowrSearchBuilder.with} for more information on how to apply enrichments.
|
|
49
89
|
*/
|
|
50
90
|
export declare const Enrichments: {
|
|
51
91
|
readonly "call-targets": {
|
|
52
|
-
|
|
92
|
+
enrichElement: (e: FlowrSearchElement<ParentInformation>, _s: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, data: import("../../core/steps/pipeline/pipeline").PipelineOutput<Pipeline<import("../../core/steps/pipeline-step").IPipelineStep<import("../../core/steps/pipeline-step").PipelineStepName, (...args: any[]) => any>>> & {
|
|
53
93
|
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
54
94
|
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
55
95
|
config: import("../../config").FlowrConfigOptions;
|
|
@@ -59,13 +99,40 @@ export declare const Enrichments: {
|
|
|
59
99
|
mapper: ({ targets }: CallTargetsContent) => FlowrSearchElement<ParentInformation>[];
|
|
60
100
|
};
|
|
61
101
|
readonly "last-call": {
|
|
62
|
-
|
|
102
|
+
enrichElement: (e: FlowrSearchElement<ParentInformation>, _s: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, data: import("../../core/steps/pipeline/pipeline").PipelineOutput<Pipeline<import("../../core/steps/pipeline-step").IPipelineStep<import("../../core/steps/pipeline-step").PipelineStepName, (...args: any[]) => any>>> & {
|
|
63
103
|
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
64
104
|
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
65
105
|
config: import("../../config").FlowrConfigOptions;
|
|
66
106
|
}, args: Omit<LinkToLastCall<string | RegExp>, "type">[] | undefined, prev: LastCallContent | undefined) => LastCallContent;
|
|
67
107
|
mapper: ({ linkedIds }: LastCallContent) => FlowrSearchElement<ParentInformation>[];
|
|
68
108
|
};
|
|
109
|
+
readonly "cfg-information": {
|
|
110
|
+
enrichElement: (e: FlowrSearchElement<ParentInformation>, search: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, _data: import("../../core/steps/pipeline/pipeline").PipelineOutput<Pipeline<import("../../core/steps/pipeline-step").IPipelineStep<import("../../core/steps/pipeline-step").PipelineStepName, (...args: any[]) => any>>> & {
|
|
111
|
+
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
112
|
+
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
113
|
+
config: import("../../config").FlowrConfigOptions;
|
|
114
|
+
}, _args: CfgInformationArguments | undefined, prev: CfgInformationElementContent | undefined) => {
|
|
115
|
+
isRoot: boolean;
|
|
116
|
+
isReachable: boolean | undefined;
|
|
117
|
+
};
|
|
118
|
+
enrichSearch: (_search: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, data: import("../../core/steps/pipeline/pipeline").PipelineOutput<Pipeline<import("../../core/steps/pipeline-step").IPipelineStep<import("../../core/steps/pipeline-step").PipelineStepName, (...args: any[]) => any>>> & {
|
|
119
|
+
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
120
|
+
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
121
|
+
config: import("../../config").FlowrConfigOptions;
|
|
122
|
+
}, args: CfgInformationArguments | undefined, prev: CfgInformationSearchContent | undefined) => CfgInformationSearchContent;
|
|
123
|
+
};
|
|
124
|
+
readonly "query-data": {
|
|
125
|
+
enrichElement: (_e: FlowrSearchElement<ParentInformation>, _search: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, _data: import("../../core/steps/pipeline/pipeline").PipelineOutput<Pipeline<import("../../core/steps/pipeline-step").IPipelineStep<import("../../core/steps/pipeline-step").PipelineStepName, (...args: any[]) => any>>> & {
|
|
126
|
+
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
127
|
+
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
128
|
+
config: import("../../config").FlowrConfigOptions;
|
|
129
|
+
}, args: QueryDataElementContent | undefined, prev: QueryDataElementContent | undefined) => QueryDataElementContent;
|
|
130
|
+
enrichSearch: (_search: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, _data: import("../../core/steps/pipeline/pipeline").PipelineOutput<Pipeline<import("../../core/steps/pipeline-step").IPipelineStep<import("../../core/steps/pipeline-step").PipelineStepName, (...args: any[]) => any>>> & {
|
|
131
|
+
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
132
|
+
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
133
|
+
config: import("../../config").FlowrConfigOptions;
|
|
134
|
+
}, args: QueryDataSearchContent | undefined, prev: QueryDataSearchContent | undefined) => Required<QueryDataSearchContent>;
|
|
135
|
+
};
|
|
69
136
|
};
|
|
70
137
|
/**
|
|
71
138
|
* Returns the content of the given enrichment type from a {@link FlowrSearchElement}.
|
|
@@ -73,5 +140,5 @@ export declare const Enrichments: {
|
|
|
73
140
|
* @param e - The search element whose enrichment content should be retrieved.
|
|
74
141
|
* @param enrichment - The enrichment content, if present, else `undefined`.
|
|
75
142
|
*/
|
|
76
|
-
export declare function enrichmentContent<E extends Enrichment>(e: FlowrSearchElement<ParentInformation>, enrichment: E):
|
|
77
|
-
export declare function
|
|
143
|
+
export declare function enrichmentContent<E extends Enrichment>(e: FlowrSearchElement<ParentInformation>, enrichment: E): EnrichmentElementContent<E>;
|
|
144
|
+
export declare function enrichElement<Element extends FlowrSearchElement<ParentInformation>, E extends Enrichment>(e: Element, s: FlowrSearchElements<ParentInformation>, data: FlowrSearchInput<Pipeline>, enrichment: E, args?: EnrichmentElementArguments<E>): Element;
|