@eagleoutice/flowr 2.4.7 → 2.4.8
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 +43 -39
- package/abstract-interpretation/data-frame/absint-visitor.js +3 -2
- package/benchmark/slicer.js +1 -1
- package/benchmark/summarizer/first-phase/process.js +1 -1
- package/cli/repl/commands/repl-query.js +11 -2
- package/cli/repl/core.d.ts +2 -2
- package/cli/repl/core.js +26 -7
- package/cli/repl/server/connection.js +3 -1
- package/cli/repl/server/messages/message-slice.d.ts +3 -0
- package/cli/repl/server/messages/message-slice.js +2 -0
- package/control-flow/extract-cfg.d.ts +3 -3
- package/control-flow/extract-cfg.js +4 -4
- package/control-flow/useless-loop.js +30 -21
- package/dataflow/environments/built-in.d.ts +1 -1
- package/dataflow/environments/default-builtin-config.d.ts +9 -0
- package/dataflow/environments/default-builtin-config.js +21 -21
- package/dataflow/environments/environment.js +18 -9
- package/dataflow/environments/overwrite.js +2 -2
- package/dataflow/extractor.js +1 -1
- package/dataflow/graph/diff-dataflow-graph.js +4 -4
- package/dataflow/graph/graph.d.ts +3 -3
- package/dataflow/graph/graph.js +4 -1
- package/dataflow/graph/quads.js +4 -4
- package/dataflow/info.js +1 -1
- package/dataflow/internal/linker.d.ts +2 -0
- package/dataflow/internal/linker.js +18 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +68 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +5 -18
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +4 -5
- package/dataflow/internal/process/functions/call/common.js +4 -3
- package/documentation/doc-util/doc-query.js +6 -2
- package/documentation/doc-util/doc-types.d.ts +7 -2
- package/documentation/doc-util/doc-types.js +20 -4
- package/documentation/print-core-wiki.js +5 -1
- package/documentation/print-dataflow-graph-wiki.js +21 -12
- package/documentation/print-faq-wiki.js +5 -0
- package/documentation/print-interface-wiki.js +2 -0
- package/documentation/print-linter-wiki.js +2 -3
- package/documentation/print-query-wiki.js +22 -7
- package/linter/linter-executor.js +25 -17
- package/linter/linter-format.d.ts +10 -1
- package/linter/linter-format.js +8 -0
- package/linter/linter-rules.d.ts +1 -0
- package/linter/rules/absolute-path.js +8 -8
- package/linter/rules/dataframe-access-validation.js +1 -1
- package/linter/rules/file-path-validity.js +8 -11
- package/linter/rules/naming-convention.d.ts +5 -1
- package/linter/rules/naming-convention.js +24 -8
- package/linter/rules/seeded-randomness.js +2 -2
- package/linter/rules/unused-definition.js +1 -1
- package/package.json +17 -15
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +5 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +14 -12
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +6 -5
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +2 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +1 -1
- package/queries/catalog/config-query/config-query-executor.js +7 -1
- package/queries/catalog/config-query/config-query-format.d.ts +7 -0
- package/queries/catalog/config-query/config-query-format.js +72 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +50 -75
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +50 -26
- package/queries/catalog/dependencies-query/dependencies-query-format.js +75 -20
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +2 -2
- package/queries/catalog/dependencies-query/function-info/visualize-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +13 -0
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +1 -1
- package/queries/catalog/linter-query/linter-query-format.js +4 -0
- package/queries/query-print.d.ts +2 -2
- package/queries/query-print.js +3 -2
- package/queries/query.d.ts +28 -21
- package/search/flowr-search-builder.d.ts +1 -1
- package/search/flowr-search-builder.js +1 -1
- package/search/flowr-search-filters.d.ts +20 -10
- package/search/flowr-search-filters.js +19 -3
- package/search/search-executor/search-enrichers.d.ts +1 -1
- package/search/search-executor/search-enrichers.js +3 -2
- package/search/search-executor/search-generators.js +1 -1
- package/search/search-executor/search-transformer.js +1 -1
- package/util/objects.d.ts +11 -0
- package/util/objects.js +26 -0
- package/util/version.js +1 -1
package/queries/query.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ 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
28
|
import type { AsyncOrSync, AsyncOrSyncType } from 'ts-essentials';
|
|
29
|
+
import type { FlowrConfigOptions } from '../config';
|
|
29
30
|
/**
|
|
30
31
|
* These are all queries that can be executed from within flowR
|
|
31
32
|
* {@link SynchronousQuery} are queries that can be executed synchronously, i.e., they do not return a Promise.
|
|
@@ -42,15 +43,19 @@ export type QueryExecutor<Query extends BaseQueryFormat, Result extends BaseQuer
|
|
|
42
43
|
type SupportedQueries = {
|
|
43
44
|
[QueryType in Query['type']]: SupportedQuery<QueryType>;
|
|
44
45
|
};
|
|
45
|
-
export interface SupportedQuery<QueryType extends BaseQueryFormat['type']> {
|
|
46
|
+
export interface SupportedQuery<QueryType extends BaseQueryFormat['type'] = BaseQueryFormat['type']> {
|
|
46
47
|
executor: QueryExecutor<QueryArgumentsWithType<QueryType>, BaseQueryResult>;
|
|
47
|
-
|
|
48
|
+
/** optional completion in, e.g., the repl */
|
|
49
|
+
completer?: (splitLine: readonly string[], config: FlowrConfigOptions) => string[];
|
|
50
|
+
/** optional query construction from an, e.g., repl line */
|
|
51
|
+
fromLine?: (splitLine: readonly string[], config: FlowrConfigOptions) => Query | Query[] | undefined;
|
|
52
|
+
asciiSummarizer: (formatter: OutputFormatter, processed: PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>, queryResults: BaseQueryResult, resultStrings: string[], query: readonly Query[]) => boolean;
|
|
48
53
|
schema: Joi.ObjectSchema;
|
|
49
54
|
/**
|
|
50
55
|
* 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.
|
|
51
56
|
* If this query does not involve any nodes, an empty array can be returned.
|
|
52
57
|
*/
|
|
53
|
-
flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
58
|
+
flattenInvolvedNodes: (queryResults: BaseQueryResult, query: readonly Query[]) => NodeId[];
|
|
54
59
|
}
|
|
55
60
|
export declare const SupportedQueries: {
|
|
56
61
|
readonly 'call-context': {
|
|
@@ -62,6 +67,8 @@ export declare const SupportedQueries: {
|
|
|
62
67
|
readonly config: {
|
|
63
68
|
readonly executor: typeof import("./catalog/config-query/config-query-executor").executeConfigQuery;
|
|
64
69
|
readonly asciiSummarizer: (formatter: OutputFormatter, _processed: unknown, queryResults: BaseQueryResult, result: string[]) => boolean;
|
|
70
|
+
readonly completer: (partialLine: readonly string[], config: FlowrConfigOptions) => string[];
|
|
71
|
+
readonly fromLine: (line: readonly string[], _config: FlowrConfigOptions) => [ConfigQuery];
|
|
65
72
|
readonly schema: Joi.ObjectSchema<any>;
|
|
66
73
|
readonly flattenInvolvedNodes: () => never[];
|
|
67
74
|
};
|
|
@@ -107,7 +114,7 @@ export declare const SupportedQueries: {
|
|
|
107
114
|
}, input: {
|
|
108
115
|
request?: import("../r-bridge/retriever").RParseRequests;
|
|
109
116
|
parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
|
|
110
|
-
}, config:
|
|
117
|
+
}, config: FlowrConfigOptions) => import("../dataflow/info").DataflowInformation;
|
|
111
118
|
readonly requiredInput: {};
|
|
112
119
|
readonly name: "dataflow";
|
|
113
120
|
readonly description: "Construct the dataflow graph";
|
|
@@ -166,7 +173,7 @@ export declare const SupportedQueries: {
|
|
|
166
173
|
}, input: {
|
|
167
174
|
request?: import("../r-bridge/retriever").RParseRequests;
|
|
168
175
|
parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
|
|
169
|
-
}, config:
|
|
176
|
+
}, config: FlowrConfigOptions) => import("../dataflow/info").DataflowInformation;
|
|
170
177
|
readonly requiredInput: {};
|
|
171
178
|
readonly name: "dataflow";
|
|
172
179
|
readonly description: "Construct the dataflow graph";
|
|
@@ -225,7 +232,7 @@ export declare const SupportedQueries: {
|
|
|
225
232
|
}, input: {
|
|
226
233
|
request?: import("../r-bridge/retriever").RParseRequests;
|
|
227
234
|
parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
|
|
228
|
-
}, config:
|
|
235
|
+
}, config: FlowrConfigOptions) => import("../dataflow/info").DataflowInformation;
|
|
229
236
|
readonly requiredInput: {};
|
|
230
237
|
readonly name: "dataflow";
|
|
231
238
|
readonly description: "Construct the dataflow graph";
|
|
@@ -284,7 +291,7 @@ export declare const SupportedQueries: {
|
|
|
284
291
|
}, input: {
|
|
285
292
|
request?: import("../r-bridge/retriever").RParseRequests;
|
|
286
293
|
parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
|
|
287
|
-
}, config:
|
|
294
|
+
}, config: FlowrConfigOptions) => import("../dataflow/info").DataflowInformation;
|
|
288
295
|
readonly requiredInput: {};
|
|
289
296
|
readonly name: "dataflow";
|
|
290
297
|
readonly description: "Construct the dataflow graph";
|
|
@@ -343,7 +350,7 @@ export declare const SupportedQueries: {
|
|
|
343
350
|
}, input: {
|
|
344
351
|
request?: import("../r-bridge/retriever").RParseRequests;
|
|
345
352
|
parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
|
|
346
|
-
}, config:
|
|
353
|
+
}, config: FlowrConfigOptions) => import("../dataflow/info").DataflowInformation;
|
|
347
354
|
readonly requiredInput: {};
|
|
348
355
|
readonly name: "dataflow";
|
|
349
356
|
readonly description: "Construct the dataflow graph";
|
|
@@ -402,7 +409,7 @@ export declare const SupportedQueries: {
|
|
|
402
409
|
}, input: {
|
|
403
410
|
request?: import("../r-bridge/retriever").RParseRequests;
|
|
404
411
|
parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
|
|
405
|
-
}, config:
|
|
412
|
+
}, config: FlowrConfigOptions) => import("../dataflow/info").DataflowInformation;
|
|
406
413
|
readonly requiredInput: {};
|
|
407
414
|
readonly name: "dataflow";
|
|
408
415
|
readonly description: "Construct the dataflow graph";
|
|
@@ -461,7 +468,7 @@ export declare const SupportedQueries: {
|
|
|
461
468
|
}, input: {
|
|
462
469
|
request?: import("../r-bridge/retriever").RParseRequests;
|
|
463
470
|
parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
|
|
464
|
-
}, config:
|
|
471
|
+
}, config: FlowrConfigOptions) => import("../dataflow/info").DataflowInformation;
|
|
465
472
|
readonly requiredInput: {};
|
|
466
473
|
readonly name: "dataflow";
|
|
467
474
|
readonly description: "Construct the dataflow graph";
|
|
@@ -520,7 +527,7 @@ export declare const SupportedQueries: {
|
|
|
520
527
|
}, input: {
|
|
521
528
|
request?: import("../r-bridge/retriever").RParseRequests;
|
|
522
529
|
parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
|
|
523
|
-
}, config:
|
|
530
|
+
}, config: FlowrConfigOptions) => import("../dataflow/info").DataflowInformation;
|
|
524
531
|
readonly requiredInput: {};
|
|
525
532
|
readonly name: "dataflow";
|
|
526
533
|
readonly description: "Construct the dataflow graph";
|
|
@@ -579,7 +586,7 @@ export declare const SupportedQueries: {
|
|
|
579
586
|
}, input: {
|
|
580
587
|
request?: import("../r-bridge/retriever").RParseRequests;
|
|
581
588
|
parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
|
|
582
|
-
}, config:
|
|
589
|
+
}, config: FlowrConfigOptions) => import("../dataflow/info").DataflowInformation;
|
|
583
590
|
readonly requiredInput: {};
|
|
584
591
|
readonly name: "dataflow";
|
|
585
592
|
readonly description: "Construct the dataflow graph";
|
|
@@ -638,7 +645,7 @@ export declare const SupportedQueries: {
|
|
|
638
645
|
}, input: {
|
|
639
646
|
request?: import("../r-bridge/retriever").RParseRequests;
|
|
640
647
|
parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
|
|
641
|
-
}, config:
|
|
648
|
+
}, config: FlowrConfigOptions) => import("../dataflow/info").DataflowInformation;
|
|
642
649
|
readonly requiredInput: {};
|
|
643
650
|
readonly name: "dataflow";
|
|
644
651
|
readonly description: "Construct the dataflow graph";
|
|
@@ -651,9 +658,9 @@ export declare const SupportedQueries: {
|
|
|
651
658
|
readonly 4: typeof import("../core/print/dataflow-printer").dataflowGraphToMermaidUrl;
|
|
652
659
|
};
|
|
653
660
|
readonly dependencies: readonly ["normalize"];
|
|
654
|
-
}>>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
661
|
+
}>>, queryResults: BaseQueryResult, result: string[], queries: readonly Query[]) => true;
|
|
655
662
|
readonly schema: Joi.ObjectSchema<any>;
|
|
656
|
-
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
663
|
+
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult, query: readonly Query[]) => NodeId[];
|
|
657
664
|
};
|
|
658
665
|
readonly 'location-map': {
|
|
659
666
|
readonly executor: typeof import("./catalog/location-map-query/location-map-query-executor").executeLocationMapQuery;
|
|
@@ -703,7 +710,7 @@ export declare const SupportedQueries: {
|
|
|
703
710
|
}, input: {
|
|
704
711
|
request?: import("../r-bridge/retriever").RParseRequests;
|
|
705
712
|
parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
|
|
706
|
-
}, config:
|
|
713
|
+
}, config: FlowrConfigOptions) => import("../dataflow/info").DataflowInformation;
|
|
707
714
|
readonly requiredInput: {};
|
|
708
715
|
readonly name: "dataflow";
|
|
709
716
|
readonly description: "Construct the dataflow graph";
|
|
@@ -762,7 +769,7 @@ export declare const SupportedQueries: {
|
|
|
762
769
|
}, input: {
|
|
763
770
|
request?: import("../r-bridge/retriever").RParseRequests;
|
|
764
771
|
parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
|
|
765
|
-
}, config:
|
|
772
|
+
}, config: FlowrConfigOptions) => import("../dataflow/info").DataflowInformation;
|
|
766
773
|
readonly requiredInput: {};
|
|
767
774
|
readonly name: "dataflow";
|
|
768
775
|
readonly description: "Construct the dataflow graph";
|
|
@@ -821,7 +828,7 @@ export declare const SupportedQueries: {
|
|
|
821
828
|
}, input: {
|
|
822
829
|
request?: import("../r-bridge/retriever").RParseRequests;
|
|
823
830
|
parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
|
|
824
|
-
}, config:
|
|
831
|
+
}, config: FlowrConfigOptions) => import("../dataflow/info").DataflowInformation;
|
|
825
832
|
readonly requiredInput: {};
|
|
826
833
|
readonly name: "dataflow";
|
|
827
834
|
readonly description: "Construct the dataflow graph";
|
|
@@ -880,7 +887,7 @@ export declare const SupportedQueries: {
|
|
|
880
887
|
}, input: {
|
|
881
888
|
request?: import("../r-bridge/retriever").RParseRequests;
|
|
882
889
|
parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
|
|
883
|
-
}, config:
|
|
890
|
+
}, config: FlowrConfigOptions) => import("../dataflow/info").DataflowInformation;
|
|
884
891
|
readonly requiredInput: {};
|
|
885
892
|
readonly name: "dataflow";
|
|
886
893
|
readonly description: "Construct the dataflow graph";
|
|
@@ -939,7 +946,7 @@ export declare const SupportedQueries: {
|
|
|
939
946
|
}, input: {
|
|
940
947
|
request?: import("../r-bridge/retriever").RParseRequests;
|
|
941
948
|
parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
|
|
942
|
-
}, config:
|
|
949
|
+
}, config: FlowrConfigOptions) => import("../dataflow/info").DataflowInformation;
|
|
943
950
|
readonly requiredInput: {};
|
|
944
951
|
readonly name: "dataflow";
|
|
945
952
|
readonly description: "Construct the dataflow graph";
|
|
@@ -998,7 +1005,7 @@ export declare const SupportedQueries: {
|
|
|
998
1005
|
}, input: {
|
|
999
1006
|
request?: import("../r-bridge/retriever").RParseRequests;
|
|
1000
1007
|
parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
|
|
1001
|
-
}, config:
|
|
1008
|
+
}, config: FlowrConfigOptions) => import("../dataflow/info").DataflowInformation;
|
|
1002
1009
|
readonly requiredInput: {};
|
|
1003
1010
|
readonly name: "dataflow";
|
|
1004
1011
|
readonly description: "Construct the dataflow graph";
|
|
@@ -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
|
-
|
|
199
|
+
to<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
|
*/
|
|
@@ -185,7 +185,7 @@ class FlowrSearchBuilder {
|
|
|
185
185
|
/**
|
|
186
186
|
* 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).
|
|
187
187
|
*/
|
|
188
|
-
|
|
188
|
+
to(enrichment, args) {
|
|
189
189
|
return this.with(enrichment, args).map(search_mappers_1.Mapper.Enrichment, enrichment);
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { RType } from '../r-bridge/lang-4.x/ast/model/type';
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type { FlowrSearchElement } from './flowr-search';
|
|
6
|
-
import type { MergeableRecord } from '../util/objects';
|
|
2
|
+
import { VertexType } from '../dataflow/graph/vertex';
|
|
3
|
+
import type { ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
|
+
import type { FlowrSearchElement, FlowrSearchInput } from './flowr-search';
|
|
7
5
|
import type { Enrichment } from './search-executor/search-enrichers';
|
|
6
|
+
import type { BuiltInMappingName } from '../dataflow/environments/built-in';
|
|
7
|
+
import type { Pipeline } from '../core/steps/pipeline/pipeline';
|
|
8
8
|
export type FlowrFilterName = keyof typeof FlowrFilters;
|
|
9
9
|
interface FlowrFilterWithArgs<Filter extends FlowrFilterName, Args extends FlowrFilterArgs<Filter>> {
|
|
10
10
|
name: Filter;
|
|
@@ -21,9 +21,14 @@ export declare enum FlowrFilter {
|
|
|
21
21
|
* This filter accepts {@link MatchesEnrichmentArgs}, which includes the enrichment to match for, as well as the regular expression to test the enrichment's (non-pretty-printed) JSON representation for.
|
|
22
22
|
* To test for included function names in an enrichment like {@link Enrichment.CallTargets}, the helper function {@link testFunctionsIgnoringPackage} can be used.
|
|
23
23
|
*/
|
|
24
|
-
MatchesEnrichment = "matches-enrichment"
|
|
24
|
+
MatchesEnrichment = "matches-enrichment",
|
|
25
|
+
/**
|
|
26
|
+
* Only returns search elements whose {@link FunctionOriginInformation} match a given pattern or value.
|
|
27
|
+
* This filter accepts {@link OriginKindArgs}, which includes the {@link DataflowGraphVertexFunctionCall.origin} to match for, whether to match for every or some origins, and whether to include non-function-calls in the filtered query.
|
|
28
|
+
*/
|
|
29
|
+
OriginKind = "origin-kind"
|
|
25
30
|
}
|
|
26
|
-
export type FlowrFilterFunction<T
|
|
31
|
+
export type FlowrFilterFunction<T> = (e: FlowrSearchElement<ParentInformation>, args: T, data: FlowrSearchInput<Pipeline>) => boolean;
|
|
27
32
|
export declare const ValidFlowrFilters: Set<string>;
|
|
28
33
|
export declare const ValidFlowrFiltersReverse: {
|
|
29
34
|
[k: string]: string;
|
|
@@ -31,12 +36,18 @@ export declare const ValidFlowrFiltersReverse: {
|
|
|
31
36
|
export declare const FlowrFilters: {
|
|
32
37
|
readonly "drop-empty-arguments": (e: FlowrSearchElement<ParentInformation>, _args: never) => boolean;
|
|
33
38
|
readonly "matches-enrichment": (e: FlowrSearchElement<ParentInformation>, args: MatchesEnrichmentArgs<Enrichment>) => boolean;
|
|
39
|
+
readonly "origin-kind": (e: FlowrSearchElement<ParentInformation>, args: OriginKindArgs, data: FlowrSearchInput<Pipeline>) => boolean;
|
|
34
40
|
};
|
|
35
41
|
export type FlowrFilterArgs<F extends FlowrFilter> = typeof FlowrFilters[F] extends FlowrFilterFunction<infer Args> ? Args : never;
|
|
36
|
-
export interface MatchesEnrichmentArgs<E extends Enrichment>
|
|
42
|
+
export interface MatchesEnrichmentArgs<E extends Enrichment> {
|
|
37
43
|
enrichment: E;
|
|
38
44
|
test: RegExp;
|
|
39
45
|
}
|
|
46
|
+
export interface OriginKindArgs {
|
|
47
|
+
origin: BuiltInMappingName | RegExp;
|
|
48
|
+
matchType?: 'some' | 'every';
|
|
49
|
+
keepNonFunctionCalls?: boolean;
|
|
50
|
+
}
|
|
40
51
|
export declare function testFunctionsIgnoringPackage(functions: string[]): RegExp;
|
|
41
52
|
type ValidFilterTypes<F extends FlowrFilter = FlowrFilter> = FlowrFilterName | FlowrFilterWithArgs<F, FlowrFilterArgs<F>> | RType | VertexType;
|
|
42
53
|
/**
|
|
@@ -91,8 +102,7 @@ export declare function isBinaryTree(tree: unknown): tree is {
|
|
|
91
102
|
};
|
|
92
103
|
interface FilterData {
|
|
93
104
|
readonly element: FlowrSearchElement<ParentInformation>;
|
|
94
|
-
readonly
|
|
95
|
-
readonly dataflow: DataflowInformation;
|
|
105
|
+
readonly data: FlowrSearchInput<Pipeline>;
|
|
96
106
|
}
|
|
97
107
|
export declare function evalFilter<Filter extends FlowrFilter>(filter: FlowrFilterExpression<Filter>, data: FilterData): boolean;
|
|
98
108
|
export {};
|
|
@@ -21,6 +21,11 @@ var FlowrFilter;
|
|
|
21
21
|
* To test for included function names in an enrichment like {@link Enrichment.CallTargets}, the helper function {@link testFunctionsIgnoringPackage} can be used.
|
|
22
22
|
*/
|
|
23
23
|
FlowrFilter["MatchesEnrichment"] = "matches-enrichment";
|
|
24
|
+
/**
|
|
25
|
+
* Only returns search elements whose {@link FunctionOriginInformation} match a given pattern or value.
|
|
26
|
+
* This filter accepts {@link OriginKindArgs}, which includes the {@link DataflowGraphVertexFunctionCall.origin} to match for, whether to match for every or some origins, and whether to include non-function-calls in the filtered query.
|
|
27
|
+
*/
|
|
28
|
+
FlowrFilter["OriginKind"] = "origin-kind";
|
|
24
29
|
})(FlowrFilter || (exports.FlowrFilter = FlowrFilter = {}));
|
|
25
30
|
exports.ValidFlowrFilters = new Set(Object.values(FlowrFilter));
|
|
26
31
|
exports.ValidFlowrFiltersReverse = Object.fromEntries(Object.entries(FlowrFilter).map(([k, v]) => [v, k]));
|
|
@@ -31,6 +36,17 @@ exports.FlowrFilters = {
|
|
|
31
36
|
[FlowrFilter.MatchesEnrichment]: ((e, args) => {
|
|
32
37
|
const content = JSON.stringify((0, search_enrichers_1.enrichmentContent)(e, args.enrichment));
|
|
33
38
|
return content !== undefined && args.test.test(content);
|
|
39
|
+
}),
|
|
40
|
+
[FlowrFilter.OriginKind]: ((e, args, data) => {
|
|
41
|
+
const dfgNode = data.dataflow.graph.getVertex(e.node.info.id);
|
|
42
|
+
if (!dfgNode || dfgNode.tag !== vertex_1.VertexType.FunctionCall) {
|
|
43
|
+
return args.keepNonFunctionCalls ?? false;
|
|
44
|
+
}
|
|
45
|
+
const match = typeof args.origin === 'string' ?
|
|
46
|
+
(origin) => args.origin === origin :
|
|
47
|
+
(origin) => args.origin.test(origin);
|
|
48
|
+
const origins = Array.isArray(dfgNode.origin) ? dfgNode.origin : [dfgNode.origin];
|
|
49
|
+
return args.matchType === 'every' ? origins.every(match) : origins.some(match);
|
|
34
50
|
})
|
|
35
51
|
};
|
|
36
52
|
function testFunctionsIgnoringPackage(functions) {
|
|
@@ -140,13 +156,13 @@ const evalVisit = {
|
|
|
140
156
|
xor: ({ left, right }, data) => evalTree(left, data) !== evalTree(right, data),
|
|
141
157
|
not: ({ operand }, data) => !evalTree(operand, data),
|
|
142
158
|
'r-type': ({ value }, { element }) => element.node.type === value,
|
|
143
|
-
'vertex-type': ({ value }, {
|
|
144
|
-
'special': ({ value }, { element }) => {
|
|
159
|
+
'vertex-type': ({ value }, { data: { dataflow }, element }) => dataflow.graph.getVertex(element.node.info.id)?.tag === value,
|
|
160
|
+
'special': ({ value }, { data, element }) => {
|
|
145
161
|
const name = typeof value === 'string' ? value : value.name;
|
|
146
162
|
const args = typeof value === 'string' ? undefined : value.args;
|
|
147
163
|
const getHandler = exports.FlowrFilters[name];
|
|
148
164
|
if (getHandler) {
|
|
149
|
-
return getHandler(element, args);
|
|
165
|
+
return getHandler(element, args, data);
|
|
150
166
|
}
|
|
151
167
|
throw new Error(`Couldn't find special filter with name ${name}`);
|
|
152
168
|
}
|
|
@@ -103,7 +103,7 @@ export declare const Enrichments: {
|
|
|
103
103
|
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
104
104
|
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
105
105
|
config: import("../../config").FlowrConfigOptions;
|
|
106
|
-
}, args: Omit<LinkToLastCall<
|
|
106
|
+
}, args: Omit<LinkToLastCall<import("../../queries/catalog/call-context-query/call-context-query-format").CallNameTypes>, "type">[] | undefined, prev: LastCallContent | undefined) => LastCallContent;
|
|
107
107
|
mapper: ({ linkedIds }: LastCallContent) => FlowrSearchElement<ParentInformation>[];
|
|
108
108
|
};
|
|
109
109
|
readonly "cfg-information": {
|
|
@@ -11,6 +11,7 @@ const extract_cfg_1 = require("../../control-flow/extract-cfg");
|
|
|
11
11
|
const dfg_get_origin_1 = require("../../dataflow/origin/dfg-get-origin");
|
|
12
12
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
13
13
|
const cfg_simplification_1 = require("../../control-flow/cfg-simplification");
|
|
14
|
+
const call_context_query_executor_1 = require("../../queries/catalog/call-context-query/call-context-query-executor");
|
|
14
15
|
/**
|
|
15
16
|
* An enumeration that stores the names of the available enrichments that can be applied to a set of search elements.
|
|
16
17
|
* See {@link FlowrSearchBuilder.with} for more information on how to apply enrichments.
|
|
@@ -74,11 +75,11 @@ exports.Enrichments = {
|
|
|
74
75
|
const content = prev ?? { linkedIds: [] };
|
|
75
76
|
const vertex = data.dataflow.graph.get(e.node.info.id);
|
|
76
77
|
if (vertex !== undefined && vertex[0].tag === vertex_1.VertexType.FunctionCall) {
|
|
77
|
-
const cfg = (0, extract_cfg_1.
|
|
78
|
+
const cfg = (0, extract_cfg_1.extractCfgQuick)(data.normalize);
|
|
78
79
|
for (const arg of args) {
|
|
79
80
|
const lastCalls = (0, identify_link_to_last_call_relation_1.identifyLinkToLastCallRelation)(vertex[0].id, cfg.graph, data.dataflow.graph, {
|
|
80
81
|
...arg,
|
|
81
|
-
callName:
|
|
82
|
+
callName: (0, call_context_query_executor_1.promoteCallName)(arg.callName),
|
|
82
83
|
type: 'link-to-last-call',
|
|
83
84
|
});
|
|
84
85
|
for (const lastCall of lastCalls) {
|
|
@@ -65,7 +65,7 @@ function generateFromQuery(data, args) {
|
|
|
65
65
|
}
|
|
66
66
|
const nodes = new Set();
|
|
67
67
|
const queryDef = query_1.SupportedQueries[query];
|
|
68
|
-
for (const node of queryDef.flattenInvolvedNodes(content)) {
|
|
68
|
+
for (const node of queryDef.flattenInvolvedNodes(content, args.from)) {
|
|
69
69
|
nodes.add({ node: data.normalize.idMap.get(node) });
|
|
70
70
|
}
|
|
71
71
|
nodesByQuery.set(query, nodes);
|
|
@@ -93,7 +93,7 @@ function getSkip(data, elements, { count }) {
|
|
|
93
93
|
return elements.mutate(e => sortFully(e).slice(count));
|
|
94
94
|
}
|
|
95
95
|
function getFilter(data, elements, { filter }) {
|
|
96
|
-
return elements.mutate(e => e.filter(e => (0, flowr_search_filters_1.evalFilter)(filter, { element: e,
|
|
96
|
+
return elements.mutate(e => e.filter(e => (0, flowr_search_filters_1.evalFilter)(filter, { element: e, data })));
|
|
97
97
|
}
|
|
98
98
|
function getWith(data, elements, { info, args }) {
|
|
99
99
|
return elements.enrich(data, info, args).mutate(s => s.map(e => (0, search_enrichers_1.enrichElement)(e, elements, data, info, args)));
|
package/util/objects.d.ts
CHANGED
|
@@ -10,12 +10,23 @@ type OrReadonly<T> = T | Readonly<T> | DeepReadonly<T>;
|
|
|
10
10
|
/**
|
|
11
11
|
* Given two objects deeply merges them, if an object is an array it will merge the array values!
|
|
12
12
|
* Guarantees some type safety by requiring objects to merge to be from the same type (allows undefined)
|
|
13
|
+
*
|
|
14
|
+
* @see {@link deepMergeObjectInPlace} to merge into an existing object
|
|
13
15
|
*/
|
|
14
16
|
export declare function deepMergeObject<T extends Mergeable>(base: Required<OrReadonly<T>>, addon?: T | DeepPartial<T> | Partial<T>): Required<T>;
|
|
15
17
|
export declare function deepMergeObject<T extends Mergeable>(base: DeepRequired<OrReadonly<T>>, addon?: T | DeepPartial<T> | Partial<T>): DeepRequired<T>;
|
|
16
18
|
export declare function deepMergeObject<T extends Mergeable>(base: OrReadonly<T>, addon?: DeepPartial<T> | Partial<T>): T;
|
|
17
19
|
export declare function deepMergeObject(base: Mergeable, addon: Mergeable): Mergeable;
|
|
18
20
|
export declare function deepMergeObject(base?: Mergeable, addon?: Mergeable): Mergeable | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Given two objects deeply merges them, if an object is an array it will merge the array values!
|
|
23
|
+
* Modifies the `base` object in place and also returns it.
|
|
24
|
+
* Guarantees some type safety by requiring objects to merge to be from the same type (allows undefined)
|
|
25
|
+
*
|
|
26
|
+
* @see {@link deepMergeObject} to create a new merged object
|
|
27
|
+
*/
|
|
28
|
+
export declare function deepMergeObjectInPlace<T extends Mergeable>(base: T, addon?: DeepPartial<T> | Partial<T>): T;
|
|
29
|
+
export declare function deepMergeObjectInPlace<T extends Mergeable>(base: T | undefined, addon?: DeepPartial<T> | Partial<T>): T | undefined;
|
|
19
30
|
type Defined<T> = Exclude<T, undefined>;
|
|
20
31
|
type DefinedRecord<T> = {
|
|
21
32
|
[K in keyof T as T[K] extends undefined ? never : K]: Defined<T[K]>;
|
package/util/objects.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isObjectOrArray = isObjectOrArray;
|
|
4
4
|
exports.deepMergeObject = deepMergeObject;
|
|
5
|
+
exports.deepMergeObjectInPlace = deepMergeObjectInPlace;
|
|
5
6
|
exports.compactRecord = compactRecord;
|
|
6
7
|
const json_1 = require("./json");
|
|
7
8
|
/**
|
|
@@ -56,6 +57,31 @@ function deepMergeObjectWithResult(addon, base, result) {
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
}
|
|
60
|
+
function deepMergeObjectInPlace(base, addon) {
|
|
61
|
+
if (!base) {
|
|
62
|
+
return addon;
|
|
63
|
+
}
|
|
64
|
+
else if (!addon) {
|
|
65
|
+
return base;
|
|
66
|
+
}
|
|
67
|
+
else if (typeof base !== 'object' || typeof addon !== 'object') {
|
|
68
|
+
// this case should be guarded by type guards, but in case we do not know
|
|
69
|
+
throw new Error('illegal types for deepMergeObjectInPlace!');
|
|
70
|
+
}
|
|
71
|
+
assertSameType(base, addon);
|
|
72
|
+
const baseIsArray = Array.isArray(base);
|
|
73
|
+
const addonIsArray = Array.isArray(addon);
|
|
74
|
+
if (!baseIsArray && !addonIsArray) {
|
|
75
|
+
deepMergeObjectWithResult(addon, base, base);
|
|
76
|
+
}
|
|
77
|
+
else if (baseIsArray && addonIsArray) {
|
|
78
|
+
(base).push(...addon);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
throw new Error('cannot merge object with array!');
|
|
82
|
+
}
|
|
83
|
+
return base;
|
|
84
|
+
}
|
|
59
85
|
function assertSameType(base, addon) {
|
|
60
86
|
if (base !== undefined && addon !== undefined && typeof base !== typeof addon) {
|
|
61
87
|
throw new Error(`cannot merge different types! ${typeof base} (${JSON.stringify(base, json_1.jsonReplacer)}) !== ${typeof addon} (${JSON.stringify(addon, json_1.jsonReplacer)})`);
|
package/util/version.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.flowrVersion = flowrVersion;
|
|
4
4
|
const semver_1 = require("semver");
|
|
5
5
|
// this is automatically replaced with the current version by release-it
|
|
6
|
-
const version = '2.4.
|
|
6
|
+
const version = '2.4.8';
|
|
7
7
|
function flowrVersion() {
|
|
8
8
|
return new semver_1.SemVer(version);
|
|
9
9
|
}
|