@eagleoutice/flowr 2.1.9 → 2.1.11
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 +3 -0
- package/cli/flowr.js +8 -0
- package/cli/repl/commands/repl-query.js +13 -2
- package/config.d.ts +21 -0
- package/config.js +19 -2
- package/dataflow/environments/built-in.d.ts +2 -0
- package/dataflow/environments/built-in.js +2 -0
- package/dataflow/environments/default-builtin-config.js +3 -2
- package/dataflow/environments/define.js +78 -0
- package/dataflow/environments/identifier.d.ts +11 -3
- package/dataflow/environments/resolve-by-name.d.ts +12 -6
- package/dataflow/environments/resolve-by-name.js +105 -6
- package/dataflow/graph/vertex.d.ts +56 -1
- package/dataflow/graph/vertex.js +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +11 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +144 -49
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +7 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +47 -16
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +15 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +50 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +30 -1
- package/dataflow/internal/process/functions/call/common.js +15 -1
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +2 -1
- package/dataflow/internal/process/functions/call/known-call-handling.js +3 -2
- package/documentation/print-interface-wiki.js +13 -3
- package/documentation/print-query-wiki.js +13 -0
- package/package.json +1 -1
- package/queries/catalog/config-query/config-query-executor.d.ts +3 -0
- package/queries/catalog/config-query/config-query-executor.js +18 -0
- package/queries/catalog/config-query/config-query-format.d.ts +16 -0
- package/queries/catalog/config-query/config-query-format.js +24 -0
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
- package/queries/query.d.ts +7 -1
- package/queries/query.js +2 -0
- package/util/list-access.d.ts +48 -0
- package/util/list-access.js +115 -0
- package/util/version.js +1 -1
|
@@ -25,6 +25,7 @@ const doc_cli_option_1 = require("./doc-util/doc-cli-option");
|
|
|
25
25
|
const doc_issue_1 = require("./doc-util/doc-issue");
|
|
26
26
|
const location_map_query_executor_1 = require("../queries/catalog/location-map-query/location-map-query-executor");
|
|
27
27
|
const identify_link_to_last_call_relation_1 = require("../queries/catalog/call-context-query/identify-link-to-last-call-relation");
|
|
28
|
+
const config_query_executor_1 = require("../queries/catalog/config-query/config-query-executor");
|
|
28
29
|
(0, doc_query_1.registerQueryDocumentation)('call-context', {
|
|
29
30
|
name: 'Call-Context Query',
|
|
30
31
|
type: 'active',
|
|
@@ -208,6 +209,18 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
|
208
209
|
`;
|
|
209
210
|
}
|
|
210
211
|
});
|
|
212
|
+
(0, doc_query_1.registerQueryDocumentation)('config', {
|
|
213
|
+
name: 'Config Query',
|
|
214
|
+
type: 'active',
|
|
215
|
+
shortDescription: 'Returns the current configuration of flowR.',
|
|
216
|
+
functionName: config_query_executor_1.executeConfigQuery.name,
|
|
217
|
+
functionFile: '../queries/catalog/config-query/config-query-format.ts',
|
|
218
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- no need for async here
|
|
219
|
+
buildExplanation: async () => {
|
|
220
|
+
return `
|
|
221
|
+
This query provides access to the current configuration of the flowR instance. See the [Interface](${doc_files_1.FlowrWikiBaseRef}/Interface) wiki page for more information on what the configuration represents.`;
|
|
222
|
+
}
|
|
223
|
+
});
|
|
211
224
|
(0, doc_query_1.registerQueryDocumentation)('compound', {
|
|
212
225
|
name: 'Compound Query',
|
|
213
226
|
type: 'virtual',
|
package/package.json
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeConfigQuery = executeConfigQuery;
|
|
4
|
+
const log_1 = require("../../../util/log");
|
|
5
|
+
const config_1 = require("../../../config");
|
|
6
|
+
function executeConfigQuery(_, queries) {
|
|
7
|
+
if (queries.length !== 1) {
|
|
8
|
+
log_1.log.warn('Config query expects only up to one query, but got', queries.length);
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
'.meta': {
|
|
12
|
+
/* there is no sense in measuring a get */
|
|
13
|
+
timing: 0
|
|
14
|
+
},
|
|
15
|
+
config: (0, config_1.getConfig)()
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=config-query-executor.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
2
|
+
import { executeConfigQuery } from './config-query-executor';
|
|
3
|
+
import { type OutputFormatter } from '../../../util/ansi';
|
|
4
|
+
import Joi from 'joi';
|
|
5
|
+
import type { FlowrConfigOptions } from '../../../config';
|
|
6
|
+
export interface ConfigQuery extends BaseQueryFormat {
|
|
7
|
+
readonly type: 'config';
|
|
8
|
+
}
|
|
9
|
+
export interface ConfigQueryResult extends BaseQueryResult {
|
|
10
|
+
readonly config: FlowrConfigOptions;
|
|
11
|
+
}
|
|
12
|
+
export declare const ConfigQueryDefinition: {
|
|
13
|
+
readonly executor: typeof executeConfigQuery;
|
|
14
|
+
readonly asciiSummarizer: (formatter: OutputFormatter, _processed: unknown, queryResults: BaseQueryResult, result: string[]) => boolean;
|
|
15
|
+
readonly schema: Joi.ObjectSchema<any>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
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.ConfigQueryDefinition = void 0;
|
|
7
|
+
const config_query_executor_1 = require("./config-query-executor");
|
|
8
|
+
const ansi_1 = require("../../../util/ansi");
|
|
9
|
+
const time_1 = require("../../../util/time");
|
|
10
|
+
const joi_1 = __importDefault(require("joi"));
|
|
11
|
+
const json_1 = require("../../../util/json");
|
|
12
|
+
exports.ConfigQueryDefinition = {
|
|
13
|
+
executor: config_query_executor_1.executeConfigQuery,
|
|
14
|
+
asciiSummarizer: (formatter, _processed, queryResults, result) => {
|
|
15
|
+
const out = queryResults;
|
|
16
|
+
result.push(`Query: ${(0, ansi_1.bold)('config', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
|
|
17
|
+
result.push(` ╰ Config:\n${JSON.stringify(out.config, json_1.jsonReplacer, 4)}`);
|
|
18
|
+
return true;
|
|
19
|
+
},
|
|
20
|
+
schema: joi_1.default.object({
|
|
21
|
+
type: joi_1.default.string().valid('config').required().description('The type of the query.'),
|
|
22
|
+
}).description('The config query retrieves the current configuration of the flowR instance.')
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=config-query-format.js.map
|
|
@@ -19,6 +19,6 @@ exports.LocationMapQueryDefinition = {
|
|
|
19
19
|
},
|
|
20
20
|
schema: joi_1.default.object({
|
|
21
21
|
type: joi_1.default.string().valid('location-map').required().description('The type of the query.'),
|
|
22
|
-
}).description('The
|
|
22
|
+
}).description('The location map query retrieves the location of every id in the ast.')
|
|
23
23
|
};
|
|
24
24
|
//# sourceMappingURL=location-map-query-format.js.map
|
package/queries/query.d.ts
CHANGED
|
@@ -14,7 +14,8 @@ import type { PipelineOutput } from '../core/steps/pipeline/pipeline';
|
|
|
14
14
|
import type { DEFAULT_DATAFLOW_PIPELINE } from '../core/steps/pipeline/default-pipelines';
|
|
15
15
|
import Joi from 'joi';
|
|
16
16
|
import type { LocationMapQuery } from './catalog/location-map-query/location-map-query-format';
|
|
17
|
-
|
|
17
|
+
import type { ConfigQuery } from './catalog/config-query/config-query-format';
|
|
18
|
+
export type Query = CallContextQuery | ConfigQuery | DataflowQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | LineageQuery | DependenciesQuery | LocationMapQuery;
|
|
18
19
|
export type QueryArgumentsWithType<QueryType extends BaseQueryFormat['type']> = Query & {
|
|
19
20
|
type: QueryType;
|
|
20
21
|
};
|
|
@@ -33,6 +34,11 @@ export declare const SupportedQueries: {
|
|
|
33
34
|
readonly asciiSummarizer: (formatter: OutputFormatter, processed: PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>, queryResults: BaseQueryResult, result: string[]) => boolean;
|
|
34
35
|
readonly schema: Joi.ObjectSchema<any>;
|
|
35
36
|
};
|
|
37
|
+
readonly config: {
|
|
38
|
+
readonly executor: typeof import("./catalog/config-query/config-query-executor").executeConfigQuery;
|
|
39
|
+
readonly asciiSummarizer: (formatter: OutputFormatter, _processed: unknown, queryResults: BaseQueryResult, result: string[]) => boolean;
|
|
40
|
+
readonly schema: Joi.ObjectSchema<any>;
|
|
41
|
+
};
|
|
36
42
|
readonly dataflow: {
|
|
37
43
|
readonly executor: typeof import("./catalog/dataflow-query/dataflow-query-executor").executeDataflowQuery;
|
|
38
44
|
readonly asciiSummarizer: (formatter: OutputFormatter, _processed: PipelineOutput<import("../core/steps/pipeline/pipeline").Pipeline<{
|
package/queries/query.js
CHANGED
|
@@ -22,8 +22,10 @@ const cluster_query_format_1 = require("./catalog/cluster-query/cluster-query-fo
|
|
|
22
22
|
const dependencies_query_format_1 = require("./catalog/dependencies-query/dependencies-query-format");
|
|
23
23
|
const joi_1 = __importDefault(require("joi"));
|
|
24
24
|
const location_map_query_format_1 = require("./catalog/location-map-query/location-map-query-format");
|
|
25
|
+
const config_query_format_1 = require("./catalog/config-query/config-query-format");
|
|
25
26
|
exports.SupportedQueries = {
|
|
26
27
|
'call-context': call_context_query_format_1.CallContextQueryDefinition,
|
|
28
|
+
'config': config_query_format_1.ConfigQueryDefinition,
|
|
27
29
|
'dataflow': dataflow_query_format_1.DataflowQueryDefinition,
|
|
28
30
|
'id-map': id_map_query_format_1.IdMapQueryDefinition,
|
|
29
31
|
'normalized-ast': normalized_ast_query_format_1.NormalizedAstQueryDefinition,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { REnvironmentInformation } from '../dataflow/environments/environment';
|
|
2
|
+
import type { ContainerIndices, ContainerIndicesCollection } from '../dataflow/graph/vertex';
|
|
3
|
+
import type { RAccess } from '../r-bridge/lang-4.x/ast/model/nodes/r-access';
|
|
4
|
+
import type { ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
5
|
+
/**
|
|
6
|
+
* Resolves {@link accessedArg} in the {@link environment} and filters its indices according to {@link accessArg}.
|
|
7
|
+
*
|
|
8
|
+
* @param accessedArg - The argument to resolve
|
|
9
|
+
* @param accessArg - The argument which is used to filter the indices
|
|
10
|
+
* @param environment - The environment in which {@link accessedArg} is resolved
|
|
11
|
+
* @returns The filtered {@link ContainerIndicesCollection} of the resolved {@link accessedArg}
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveSingleIndex(accessedArg: {
|
|
14
|
+
lexeme: string;
|
|
15
|
+
}, accessArg: {
|
|
16
|
+
lexeme: string;
|
|
17
|
+
}, environment: REnvironmentInformation): ContainerIndicesCollection;
|
|
18
|
+
/**
|
|
19
|
+
* Filters the single indices of the {@link indicesCollection} according to the lexeme of the {@link accessArg}.
|
|
20
|
+
*
|
|
21
|
+
* @param indicesCollection - The {@link ContainerIndicesCollection} to filter
|
|
22
|
+
* @param accessArg - The argument which is used to filter {@link indicesCollection}
|
|
23
|
+
* @returns The filtered copy of {@link indicesCollection}
|
|
24
|
+
*/
|
|
25
|
+
export declare function filterIndices(indicesCollection: ContainerIndicesCollection, accessArg: {
|
|
26
|
+
lexeme: string;
|
|
27
|
+
}): ContainerIndicesCollection;
|
|
28
|
+
/**
|
|
29
|
+
* Constructs the definition of a nested access.
|
|
30
|
+
*
|
|
31
|
+
* Example:
|
|
32
|
+
* ```r
|
|
33
|
+
* person$credentials$username
|
|
34
|
+
* ```
|
|
35
|
+
* would result in a list with the index `credentials`, which has the subIndex `username`.
|
|
36
|
+
*
|
|
37
|
+
* @param accessedArg - The top level argument that is accessed
|
|
38
|
+
* @param leafIndices - The index at the end of the nested access i.e. `c` in `a$b$c`.
|
|
39
|
+
* @returns The constructed nested access
|
|
40
|
+
*/
|
|
41
|
+
export declare function constructNestedAccess<OtherInfo>(accessedArg: RAccess<OtherInfo & ParentInformation>, leafIndices: ContainerIndices): ContainerIndices[];
|
|
42
|
+
/**
|
|
43
|
+
* Adds the passed list of {@link leafSubIndices} to the leaf (sub-)indices of {@link indicesCollection}.
|
|
44
|
+
*
|
|
45
|
+
* @param indicesCollection - Indices where to add the sub indices.
|
|
46
|
+
* @param leafSubIndices - Indices that are added to the leaf indices.
|
|
47
|
+
*/
|
|
48
|
+
export declare function addSubIndicesToLeafIndices(indicesCollection: ContainerIndices[], leafSubIndices: ContainerIndices[]): ContainerIndices[];
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveSingleIndex = resolveSingleIndex;
|
|
4
|
+
exports.filterIndices = filterIndices;
|
|
5
|
+
exports.constructNestedAccess = constructNestedAccess;
|
|
6
|
+
exports.addSubIndicesToLeafIndices = addSubIndicesToLeafIndices;
|
|
7
|
+
const resolve_by_name_1 = require("../dataflow/environments/resolve-by-name");
|
|
8
|
+
const vertex_1 = require("../dataflow/graph/vertex");
|
|
9
|
+
const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
10
|
+
const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
|
|
11
|
+
/**
|
|
12
|
+
* Resolves {@link accessedArg} in the {@link environment} and filters its indices according to {@link accessArg}.
|
|
13
|
+
*
|
|
14
|
+
* @param accessedArg - The argument to resolve
|
|
15
|
+
* @param accessArg - The argument which is used to filter the indices
|
|
16
|
+
* @param environment - The environment in which {@link accessedArg} is resolved
|
|
17
|
+
* @returns The filtered {@link ContainerIndicesCollection} of the resolved {@link accessedArg}
|
|
18
|
+
*/
|
|
19
|
+
function resolveSingleIndex(accessedArg, accessArg, environment) {
|
|
20
|
+
const definitions = (0, resolve_by_name_1.resolveByName)(accessedArg.lexeme, environment);
|
|
21
|
+
const indicesCollection = definitions?.flatMap(def => def?.indicesCollection ?? []);
|
|
22
|
+
const accessedIndicesCollection = filterIndices(indicesCollection, accessArg);
|
|
23
|
+
return accessedIndicesCollection;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Filters the single indices of the {@link indicesCollection} according to the lexeme of the {@link accessArg}.
|
|
27
|
+
*
|
|
28
|
+
* @param indicesCollection - The {@link ContainerIndicesCollection} to filter
|
|
29
|
+
* @param accessArg - The argument which is used to filter {@link indicesCollection}
|
|
30
|
+
* @returns The filtered copy of {@link indicesCollection}
|
|
31
|
+
*/
|
|
32
|
+
function filterIndices(indicesCollection, accessArg) {
|
|
33
|
+
let accessedIndicesCollection = undefined;
|
|
34
|
+
for (const indices of indicesCollection ?? []) {
|
|
35
|
+
const filteredIndices = indices.indices.filter(index => accessArg.lexeme === index.lexeme);
|
|
36
|
+
if (filteredIndices.length == 0) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
accessedIndicesCollection ??= [];
|
|
40
|
+
accessedIndicesCollection.push({
|
|
41
|
+
indices: filteredIndices,
|
|
42
|
+
isContainer: indices.isContainer
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return accessedIndicesCollection;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Constructs the definition of a nested access.
|
|
49
|
+
*
|
|
50
|
+
* Example:
|
|
51
|
+
* ```r
|
|
52
|
+
* person$credentials$username
|
|
53
|
+
* ```
|
|
54
|
+
* would result in a list with the index `credentials`, which has the subIndex `username`.
|
|
55
|
+
*
|
|
56
|
+
* @param accessedArg - The top level argument that is accessed
|
|
57
|
+
* @param leafIndices - The index at the end of the nested access i.e. `c` in `a$b$c`.
|
|
58
|
+
* @returns The constructed nested access
|
|
59
|
+
*/
|
|
60
|
+
function constructNestedAccess(accessedArg, leafIndices) {
|
|
61
|
+
const accessed = accessedArg.accessed;
|
|
62
|
+
const accesses = accessedArg.access.filter(arg => arg !== r_function_call_1.EmptyArgument).map(arg => arg);
|
|
63
|
+
const indices = [];
|
|
64
|
+
for (const access of accesses) {
|
|
65
|
+
const newIndices = {
|
|
66
|
+
indices: [
|
|
67
|
+
{
|
|
68
|
+
lexeme: access.lexeme,
|
|
69
|
+
nodeId: access.info.id,
|
|
70
|
+
subIndices: [leafIndices],
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
isContainer: false,
|
|
74
|
+
};
|
|
75
|
+
if (accessed.type === type_1.RType.Access) {
|
|
76
|
+
const nestedIndices = constructNestedAccess(accessed, newIndices);
|
|
77
|
+
indices.push(...nestedIndices);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
indices.push(newIndices);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return indices;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Adds the passed list of {@link leafSubIndices} to the leaf (sub-)indices of {@link indicesCollection}.
|
|
87
|
+
*
|
|
88
|
+
* @param indicesCollection - Indices where to add the sub indices.
|
|
89
|
+
* @param leafSubIndices - Indices that are added to the leaf indices.
|
|
90
|
+
*/
|
|
91
|
+
function addSubIndicesToLeafIndices(indicesCollection, leafSubIndices) {
|
|
92
|
+
const result = [];
|
|
93
|
+
for (const indices of indicesCollection) {
|
|
94
|
+
const newIndices = [];
|
|
95
|
+
for (const index of indices.indices) {
|
|
96
|
+
let newSubIndices = [];
|
|
97
|
+
if ((0, vertex_1.isParentContainerIndex)(index)) {
|
|
98
|
+
newSubIndices = addSubIndicesToLeafIndices(index.subIndices, leafSubIndices);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
newSubIndices = leafSubIndices;
|
|
102
|
+
}
|
|
103
|
+
newIndices.push({
|
|
104
|
+
...index,
|
|
105
|
+
subIndices: newSubIndices,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
result.push({
|
|
109
|
+
...indices,
|
|
110
|
+
indices: newIndices,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=list-access.js.map
|
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.1.
|
|
6
|
+
const version = '2.1.11';
|
|
7
7
|
function flowrVersion() {
|
|
8
8
|
return new semver_1.SemVer(version);
|
|
9
9
|
}
|