@eagleoutice/flowr 2.5.0 → 2.6.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.
Files changed (254) hide show
  1. package/README.md +46 -35
  2. package/abstract-interpretation/data-frame/absint-visitor.d.ts +1 -1
  3. package/abstract-interpretation/data-frame/absint-visitor.js +1 -1
  4. package/cli/flowr.js +11 -33
  5. package/cli/repl/commands/repl-cfg.d.ts +5 -5
  6. package/cli/repl/commands/repl-cfg.js +21 -22
  7. package/cli/repl/commands/repl-commands.d.ts +3 -3
  8. package/cli/repl/commands/repl-commands.js +2 -0
  9. package/cli/repl/commands/repl-dataflow.d.ts +5 -5
  10. package/cli/repl/commands/repl-dataflow.js +27 -30
  11. package/cli/repl/commands/repl-execute.d.ts +1 -1
  12. package/cli/repl/commands/repl-execute.js +8 -7
  13. package/cli/repl/commands/repl-lineage.d.ts +2 -2
  14. package/cli/repl/commands/repl-lineage.js +11 -11
  15. package/cli/repl/commands/repl-main.d.ts +35 -7
  16. package/cli/repl/commands/repl-normalize.d.ts +3 -3
  17. package/cli/repl/commands/repl-normalize.js +15 -19
  18. package/cli/repl/commands/repl-parse.d.ts +2 -2
  19. package/cli/repl/commands/repl-parse.js +14 -8
  20. package/cli/repl/commands/repl-query.d.ts +3 -3
  21. package/cli/repl/commands/repl-query.js +29 -19
  22. package/cli/repl/commands/repl-quit.js +1 -0
  23. package/cli/repl/commands/repl-version.d.ts +1 -16
  24. package/cli/repl/commands/repl-version.js +2 -18
  25. package/cli/repl/core.d.ts +12 -9
  26. package/cli/repl/core.js +26 -12
  27. package/cli/repl/print-version.js +2 -2
  28. package/cli/repl/server/connection.d.ts +7 -3
  29. package/cli/repl/server/connection.js +46 -50
  30. package/cli/repl/server/messages/message-hello.d.ts +1 -1
  31. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  32. package/cli/repl/server/server.js +2 -2
  33. package/cli/slicer-app.js +1 -1
  34. package/config.d.ts +1 -1
  35. package/config.js +4 -1
  36. package/control-flow/extract-cfg.d.ts +1 -1
  37. package/control-flow/extract-cfg.js +1 -1
  38. package/core/pipeline-executor.d.ts +5 -0
  39. package/core/pipeline-executor.js +5 -0
  40. package/core/steps/all/core/20-dataflow.d.ts +3 -1
  41. package/core/steps/pipeline/create-pipeline.js +1 -1
  42. package/core/steps/pipeline/default-pipelines.d.ts +24 -8
  43. package/core/steps/pipeline/default-pipelines.js +4 -1
  44. package/dataflow/environments/default-builtin-config.js +8 -0
  45. package/dataflow/eval/resolve/alias-tracking.js +2 -0
  46. package/dataflow/eval/resolve/resolve.js +3 -0
  47. package/dataflow/eval/values/r-value.d.ts +4 -1
  48. package/dataflow/eval/values/r-value.js +2 -0
  49. package/dataflow/extractor.d.ts +4 -1
  50. package/dataflow/extractor.js +7 -5
  51. package/dataflow/fn/higher-order-function.d.ts +9 -0
  52. package/dataflow/fn/higher-order-function.js +75 -0
  53. package/dataflow/graph/dataflowgraph-builder.d.ts +11 -12
  54. package/dataflow/graph/dataflowgraph-builder.js +6 -6
  55. package/documentation/doc-util/doc-query.d.ts +3 -6
  56. package/documentation/doc-util/doc-query.js +5 -17
  57. package/documentation/doc-util/doc-repl.js +5 -2
  58. package/documentation/doc-util/doc-search.js +7 -10
  59. package/documentation/doc-util/doc-structure.d.ts +4 -0
  60. package/documentation/doc-util/doc-structure.js +28 -0
  61. package/documentation/doc-util/doc-types.d.ts +5 -1
  62. package/documentation/doc-util/doc-types.js +29 -3
  63. package/documentation/print-analyzer-wiki.d.ts +1 -0
  64. package/documentation/print-analyzer-wiki.js +137 -0
  65. package/documentation/print-core-wiki.d.ts +2 -1
  66. package/documentation/print-core-wiki.js +58 -4
  67. package/documentation/print-dataflow-graph-wiki.js +16 -23
  68. package/documentation/print-interface-wiki.js +18 -1
  69. package/documentation/print-linter-wiki.js +5 -1
  70. package/documentation/print-normalized-ast-wiki.js +6 -8
  71. package/documentation/print-query-wiki.js +20 -0
  72. package/documentation/print-readme.js +1 -1
  73. package/engines.d.ts +9 -0
  74. package/engines.js +38 -0
  75. package/linter/linter-executor.d.ts +2 -8
  76. package/linter/linter-executor.js +9 -4
  77. package/linter/linter-format.d.ts +8 -9
  78. package/linter/linter-rules.d.ts +57 -15
  79. package/linter/linter-rules.js +2 -0
  80. package/linter/rules/absolute-path.d.ts +1 -0
  81. package/linter/rules/dataframe-access-validation.d.ts +4 -3
  82. package/linter/rules/dataframe-access-validation.js +7 -4
  83. package/linter/rules/dead-code.d.ts +2 -1
  84. package/linter/rules/deprecated-functions.d.ts +15 -28
  85. package/linter/rules/deprecated-functions.js +5 -43
  86. package/linter/rules/file-path-validity.d.ts +2 -1
  87. package/linter/rules/file-path-validity.js +1 -1
  88. package/linter/rules/function-finder-util.d.ts +51 -0
  89. package/linter/rules/function-finder-util.js +77 -0
  90. package/linter/rules/naming-convention.d.ts +2 -1
  91. package/linter/rules/network-functions.d.ts +40 -0
  92. package/linter/rules/network-functions.js +24 -0
  93. package/linter/rules/seeded-randomness.d.ts +2 -1
  94. package/linter/rules/unused-definition.d.ts +2 -1
  95. package/linter/rules/useless-loop.d.ts +3 -2
  96. package/linter/rules/useless-loop.js +4 -6
  97. package/package.json +2 -1
  98. package/project/cache/flowr-analyzer-cache.d.ts +94 -0
  99. package/project/cache/flowr-analyzer-cache.js +164 -0
  100. package/project/cache/flowr-cache.d.ts +28 -0
  101. package/project/cache/flowr-cache.js +49 -0
  102. package/project/cfg-kind.d.ts +17 -0
  103. package/project/cfg-kind.js +22 -0
  104. package/project/context/abstract-flowr-analyzer-context.d.ts +39 -0
  105. package/project/context/abstract-flowr-analyzer-context.js +46 -0
  106. package/project/context/flowr-analyzer-context.d.ts +54 -0
  107. package/project/context/flowr-analyzer-context.js +58 -0
  108. package/project/context/flowr-analyzer-dependencies-context.d.ts +39 -0
  109. package/project/context/flowr-analyzer-dependencies-context.js +43 -0
  110. package/project/context/flowr-analyzer-files-context.d.ts +87 -0
  111. package/project/context/flowr-analyzer-files-context.js +134 -0
  112. package/project/context/flowr-analyzer-loading-order-context.d.ts +77 -0
  113. package/project/context/flowr-analyzer-loading-order-context.js +96 -0
  114. package/project/context/flowr-file.d.ts +89 -0
  115. package/project/context/flowr-file.js +78 -0
  116. package/project/flowr-analyzer-builder.d.ts +106 -0
  117. package/project/flowr-analyzer-builder.js +197 -0
  118. package/project/flowr-analyzer.d.ts +126 -0
  119. package/project/flowr-analyzer.js +88 -0
  120. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +17 -0
  121. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +28 -0
  122. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +21 -0
  123. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +34 -0
  124. package/project/plugins/file-plugins/flowr-description-file.d.ts +24 -0
  125. package/project/plugins/file-plugins/flowr-description-file.js +38 -0
  126. package/project/plugins/flowr-analyzer-plugin.d.ts +90 -0
  127. package/project/plugins/flowr-analyzer-plugin.js +82 -0
  128. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +14 -0
  129. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +56 -0
  130. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.d.ts +13 -0
  131. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +33 -0
  132. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +14 -0
  133. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +41 -0
  134. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
  135. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +29 -0
  136. package/project/plugins/package-version-plugins/package.d.ts +15 -0
  137. package/project/plugins/package-version-plugins/package.js +56 -0
  138. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +15 -0
  139. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +44 -0
  140. package/queries/base-query-format.d.ts +2 -8
  141. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
  142. package/queries/catalog/call-context-query/call-context-query-executor.js +21 -13
  143. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -3
  144. package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
  145. package/queries/catalog/cluster-query/cluster-query-executor.d.ts +1 -1
  146. package/queries/catalog/cluster-query/cluster-query-executor.js +2 -2
  147. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -54
  148. package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
  149. package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
  150. package/queries/catalog/config-query/config-query-executor.js +5 -5
  151. package/queries/catalog/config-query/config-query-format.d.ts +1 -1
  152. package/queries/catalog/config-query/config-query-format.js +1 -1
  153. package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
  154. package/queries/catalog/control-flow-query/control-flow-query-executor.js +3 -3
  155. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -54
  156. package/queries/catalog/control-flow-query/control-flow-query-format.js +2 -2
  157. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.d.ts +1 -1
  158. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -2
  159. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -54
  160. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -1
  161. package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +1 -1
  162. package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
  163. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -54
  164. package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -1
  165. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -1
  166. package/queries/catalog/dependencies-query/dependencies-query-executor.js +19 -12
  167. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +7 -56
  168. package/queries/catalog/dependencies-query/dependencies-query-format.js +7 -4
  169. package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +1 -1
  170. package/queries/catalog/df-shape-query/df-shape-query-executor.js +4 -4
  171. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +1 -54
  172. package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
  173. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
  174. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
  175. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -54
  176. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -1
  177. package/queries/catalog/id-map-query/id-map-query-executor.d.ts +1 -1
  178. package/queries/catalog/id-map-query/id-map-query-executor.js +2 -2
  179. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -54
  180. package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
  181. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +3 -0
  182. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +45 -0
  183. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +22 -0
  184. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +32 -0
  185. package/queries/catalog/lineage-query/lineage-query-executor.d.ts +1 -1
  186. package/queries/catalog/lineage-query/lineage-query-executor.js +2 -2
  187. package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -54
  188. package/queries/catalog/lineage-query/lineage-query-format.js +1 -1
  189. package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
  190. package/queries/catalog/linter-query/linter-query-executor.js +2 -3
  191. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -54
  192. package/queries/catalog/linter-query/linter-query-format.js +1 -1
  193. package/queries/catalog/location-map-query/location-map-query-executor.d.ts +1 -1
  194. package/queries/catalog/location-map-query/location-map-query-executor.js +3 -2
  195. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  196. package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
  197. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +1 -1
  198. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -2
  199. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -54
  200. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -1
  201. package/queries/catalog/origin-query/origin-query-executor.d.ts +2 -2
  202. package/queries/catalog/origin-query/origin-query-executor.js +3 -3
  203. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -54
  204. package/queries/catalog/origin-query/origin-query-format.js +1 -1
  205. package/queries/catalog/project-query/project-query-executor.d.ts +1 -1
  206. package/queries/catalog/project-query/project-query-executor.js +2 -2
  207. package/queries/catalog/project-query/project-query-format.d.ts +1 -54
  208. package/queries/catalog/project-query/project-query-format.js +1 -1
  209. package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
  210. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -2
  211. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -54
  212. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
  213. package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
  214. package/queries/catalog/search-query/search-query-executor.js +3 -3
  215. package/queries/catalog/search-query/search-query-format.d.ts +1 -54
  216. package/queries/catalog/search-query/search-query-format.js +1 -1
  217. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
  218. package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -3
  219. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -54
  220. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -1
  221. package/queries/query-print.d.ts +4 -4
  222. package/queries/query-print.js +12 -12
  223. package/queries/query.d.ts +37 -885
  224. package/queries/query.js +3 -1
  225. package/r-bridge/parser.d.ts +7 -0
  226. package/r-bridge/retriever.d.ts +6 -5
  227. package/r-bridge/retriever.js +9 -5
  228. package/search/flowr-search-executor.d.ts +3 -5
  229. package/search/flowr-search-executor.js +6 -4
  230. package/search/flowr-search-filters.d.ts +12 -6
  231. package/search/flowr-search-filters.js +1 -1
  232. package/search/flowr-search.d.ts +5 -16
  233. package/search/flowr-search.js +14 -5
  234. package/search/search-executor/search-enrichers.d.ts +37 -36
  235. package/search/search-executor/search-enrichers.js +5 -4
  236. package/search/search-executor/search-generators.d.ts +12 -12
  237. package/search/search-executor/search-generators.js +27 -19
  238. package/search/search-executor/search-mappers.d.ts +5 -5
  239. package/search/search-executor/search-transformer.d.ts +17 -17
  240. package/search/search-executor/search-transformer.js +14 -7
  241. package/util/collections/arrays.d.ts +1 -0
  242. package/util/collections/arrays.js +15 -0
  243. package/util/collections/objectmap.d.ts +17 -0
  244. package/util/collections/objectmap.js +28 -0
  245. package/util/containers.d.ts +0 -1
  246. package/util/containers.js +0 -1
  247. package/util/files.d.ts +17 -0
  248. package/util/files.js +65 -0
  249. package/util/formats/adapter.d.ts +4 -2
  250. package/util/formats/adapter.js +11 -4
  251. package/util/r-value.d.ts +1 -1
  252. package/util/r-value.js +2 -0
  253. package/util/version.d.ts +17 -0
  254. package/util/version.js +28 -1
@@ -1,19 +1,19 @@
1
- import type { FlowrSearchElement, FlowrSearchInput } from '../flowr-search';
1
+ import type { FlowrSearchElement } from '../flowr-search';
2
2
  import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
3
3
  import type { Enrichment } from './search-enrichers';
4
4
  import type { MergeableRecord } from '../../util/objects';
5
- import type { Pipeline } from '../../core/steps/pipeline/pipeline';
5
+ import type { FlowrAnalysisProvider } from '../../project/flowr-analyzer';
6
6
  export declare enum Mapper {
7
7
  Enrichment = "enrichment"
8
8
  }
9
9
  export interface MapperData<Arguments extends string | MergeableRecord> {
10
- mapper: (e: FlowrSearchElement<ParentInformation>, data: FlowrSearchInput<Pipeline>, args: Arguments) => FlowrSearchElement<ParentInformation>[];
10
+ mapper: (e: FlowrSearchElement<ParentInformation>, data: FlowrAnalysisProvider, args: Arguments) => FlowrSearchElement<ParentInformation>[];
11
11
  }
12
12
  export type MapperArguments<M extends Mapper> = typeof Mappers[M] extends MapperData<infer Arguments> ? Arguments : never;
13
13
  declare const Mappers: {
14
14
  readonly enrichment: {
15
- mapper: (e: FlowrSearchElement<ParentInformation>, _data: FlowrSearchInput<Pipeline>, enrichment: Enrichment) => FlowrSearchElement<ParentInformation>[];
15
+ mapper: (e: FlowrSearchElement<ParentInformation>, _data: FlowrAnalysisProvider, enrichment: Enrichment) => FlowrSearchElement<ParentInformation>[];
16
16
  };
17
17
  };
18
- export declare function map<Element extends FlowrSearchElement<ParentInformation>, MapperType extends Mapper>(e: Element, data: FlowrSearchInput<Pipeline>, mapper: MapperType, args: MapperArguments<MapperType>): Element[];
18
+ export declare function map<Element extends FlowrSearchElement<ParentInformation>, MapperType extends Mapper>(e: Element, data: FlowrAnalysisProvider, mapper: MapperType, args: MapperArguments<MapperType>): Element[];
19
19
  export {};
@@ -1,11 +1,11 @@
1
- import type { FlowrSearchElement, FlowrSearchElements, FlowrSearchInput, FlowrSearchTransformerNodeBase } from '../flowr-search';
2
- import type { Pipeline } from '../../core/steps/pipeline/pipeline';
1
+ import type { FlowrSearchElement, FlowrSearchElements, FlowrSearchTransformerNodeBase } from '../flowr-search';
3
2
  import type { LastOfArray, Tail2TypesOrUndefined, TailOfArray } from '../../util/collections/arrays';
4
3
  import type { FlowrFilterExpression } from '../flowr-search-filters';
5
4
  import type { FlowrSearchGeneratorNode } from './search-generators';
6
5
  import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
7
6
  import type { Enrichment, EnrichmentElementArguments } from './search-enrichers';
8
7
  import type { Mapper, MapperArguments } from './search-mappers';
8
+ import type { FlowrAnalysisProvider } from '../../project/flowr-analyzer';
9
9
  /**
10
10
  * This is a union of all possible transformer node types
11
11
  */
@@ -37,35 +37,35 @@ export declare const transformers: {
37
37
  export declare function getTransformer<Name extends TransformerNames>(name: Name): typeof transformers[Name];
38
38
  /** If we already have no more elements, cascade will not add any but keep the empty elements, otherwise it will now be NewElements */
39
39
  type CascadeEmpty<Elements extends FlowrSearchElement<ParentInformation>[], NewElements extends FlowrSearchElement<ParentInformation>[]> = Elements extends [] ? FlowrSearchElements<ParentInformation, []> : FlowrSearchElements<ParentInformation, NewElements>;
40
- declare function getFirst<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE): CascadeEmpty<Elements, [Elements[0]]>;
41
- declare function getLast<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE): CascadeEmpty<Elements, [LastOfArray<Elements>]>;
42
- declare function getIndex<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE, { index }: {
40
+ declare function getFirst<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE): CascadeEmpty<Elements, [Elements[0]]>;
41
+ declare function getLast<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE): CascadeEmpty<Elements, [LastOfArray<Elements>]>;
42
+ declare function getIndex<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE, { index }: {
43
43
  index: number;
44
44
  }): CascadeEmpty<Elements, [Elements[number]]>;
45
- declare function getSelect<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE, { select }: {
45
+ declare function getSelect<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE, { select }: {
46
46
  select: number[];
47
47
  }): CascadeEmpty<Elements, Elements>;
48
- declare function getTail<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE): CascadeEmpty<Elements, TailOfArray<Elements>>;
49
- declare function getTake<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE, { count }: {
48
+ declare function getTail<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE): CascadeEmpty<Elements, TailOfArray<Elements>>;
49
+ declare function getTake<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE, { count }: {
50
50
  count: number;
51
51
  }): CascadeEmpty<Elements, TailOfArray<Elements>>;
52
- declare function getSkip<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE, { count }: {
52
+ declare function getSkip<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE, { count }: {
53
53
  count: number;
54
54
  }): CascadeEmpty<Elements, TailOfArray<Elements>>;
55
- declare function getFilter<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE, { filter }: {
55
+ declare function getFilter<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE, { filter }: {
56
56
  filter: FlowrFilterExpression;
57
- }): CascadeEmpty<Elements, Elements | []>;
58
- declare function getWith<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE, { info, args }: {
57
+ }): Promise<CascadeEmpty<Elements, Elements | []>>;
58
+ declare function getWith<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(input: FlowrAnalysisProvider, elements: FSE, { info, args }: {
59
59
  info: Enrichment;
60
60
  args?: EnrichmentElementArguments<Enrichment>;
61
- }): FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>;
62
- declare function getMap<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE, { mapper, args }: {
61
+ }): Promise<FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>>;
62
+ declare function getMap<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE, { mapper, args }: {
63
63
  mapper: Mapper;
64
64
  args: MapperArguments<Mapper>;
65
65
  }): FlowrSearchElements<ParentInformation, Elements>;
66
- declare function getMerge<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE, other: {
66
+ declare function getMerge<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE, other: {
67
67
  search: unknown[];
68
68
  generator: FlowrSearchGeneratorNode;
69
- }): FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>;
70
- declare function getUnique<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE): CascadeEmpty<Elements, Elements>;
69
+ }): Promise<FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>>;
70
+ declare function getUnique<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrAnalysisProvider, elements: FSE): CascadeEmpty<Elements, Elements>;
71
71
  export {};
@@ -92,19 +92,26 @@ function getTake(data, elements, { count }) {
92
92
  function getSkip(data, elements, { count }) {
93
93
  return elements.mutate(e => sortFully(e).slice(count));
94
94
  }
95
- function getFilter(data, elements, { filter }) {
96
- return elements.mutate(e => e.filter(e => (0, flowr_search_filters_1.evalFilter)(filter, { element: e, data })));
97
- }
98
- function getWith(data, elements, { info, args }) {
99
- return elements.enrich(data, info, args).mutate(s => s.map(e => (0, search_enrichers_1.enrichElement)(e, elements, data, info, args)));
95
+ async function getFilter(data, elements, { filter }) {
96
+ const dataflow = await data.dataflow();
97
+ return elements.mutate(e => e.filter(e => (0, flowr_search_filters_1.evalFilter)(filter, { element: e, data: { dataflow } })));
98
+ }
99
+ async function getWith(input, elements, { info, args }) {
100
+ const data = {
101
+ normalize: await input.normalize(),
102
+ dataflow: await input.dataflow(),
103
+ cfg: await input.controlflow(),
104
+ config: input.flowrConfig
105
+ };
106
+ return (await elements.enrich(input, info, args)).mutate(async (s) => await Promise.all(s.map(e => (0, search_enrichers_1.enrichElement)(e, elements, data, info, args))));
100
107
  }
101
108
  function getMap(data, elements, { mapper, args }) {
102
109
  return elements.mutate(elements => elements.flatMap(e => (0, search_mappers_1.map)(e, data, mapper, args)));
103
110
  }
104
- function getMerge(
111
+ async function getMerge(
105
112
  /* search has to be unknown because it is a recursive type */
106
113
  data, elements, other) {
107
- const resultOther = (0, flowr_search_executor_1.runSearch)(other, data);
114
+ const resultOther = await (0, flowr_search_executor_1.runSearch)(other, data);
108
115
  return elements.addAll([...resultOther.getElements()]);
109
116
  }
110
117
  function getUnique(data, elements) {
@@ -90,3 +90,4 @@ export declare function equidistantSampling<T>(list: readonly T[], sampleCount:
90
90
  export declare function cartesianProduct<T>(...arrays: T[][]): T[][];
91
91
  /** merge two arrays, removing duplicates */
92
92
  export declare function uniqueArrayMerge<T>(left: readonly T[], right: readonly T[]): T[];
93
+ export declare function arraysGroupBy<T, K>(arr: readonly T[], keyFn: (elem: T) => K): Map<K, T[]>;
@@ -11,6 +11,7 @@ exports.arrayEqual = arrayEqual;
11
11
  exports.equidistantSampling = equidistantSampling;
12
12
  exports.cartesianProduct = cartesianProduct;
13
13
  exports.uniqueArrayMerge = uniqueArrayMerge;
14
+ exports.arraysGroupBy = arraysGroupBy;
14
15
  const assert_1 = require("../assert");
15
16
  /**
16
17
  * Splits the array every time the given predicate fires.
@@ -224,4 +225,18 @@ function uniqueArrayMerge(left, right) {
224
225
  }
225
226
  return Array.from(result);
226
227
  }
228
+ function arraysGroupBy(arr, keyFn) {
229
+ const result = new Map();
230
+ for (const elem of arr) {
231
+ const key = keyFn(elem);
232
+ const group = result.get(key);
233
+ if (group) {
234
+ group.push(elem);
235
+ }
236
+ else {
237
+ result.set(key, [elem]);
238
+ }
239
+ }
240
+ return result;
241
+ }
227
242
  //# sourceMappingURL=arrays.js.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A map type that accepts an arbitrary object as key.
3
+ * {@link JSON.stringify} is used to create the actual key for the underlying map.
4
+ * This can be helpful if value equality is desired.
5
+ */
6
+ export declare class ObjectMap<K, V> {
7
+ private readonly internal;
8
+ private makeKey;
9
+ /**
10
+ * Sets a value for a given key.
11
+ */
12
+ set(key: K, v: V): void;
13
+ /**
14
+ * Return the value for the key.
15
+ */
16
+ get(key: K): V | undefined;
17
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ObjectMap = void 0;
4
+ /**
5
+ * A map type that accepts an arbitrary object as key.
6
+ * {@link JSON.stringify} is used to create the actual key for the underlying map.
7
+ * This can be helpful if value equality is desired.
8
+ */
9
+ class ObjectMap {
10
+ internal = new Map();
11
+ makeKey(key) {
12
+ return JSON.stringify(key);
13
+ }
14
+ /**
15
+ * Sets a value for a given key.
16
+ */
17
+ set(key, v) {
18
+ this.internal.set(this.makeKey(key), v);
19
+ }
20
+ /**
21
+ * Return the value for the key.
22
+ */
23
+ get(key) {
24
+ return this.internal.get(this.makeKey(key));
25
+ }
26
+ }
27
+ exports.ObjectMap = ObjectMap;
28
+ //# sourceMappingURL=objectmap.js.map
@@ -17,7 +17,6 @@ export declare function getAccessOperands<OtherInfo>(args: readonly RFunctionArg
17
17
  *
18
18
  * @param name - Name to resolve
19
19
  * @param environment - Environment in which name is resolved
20
- * @param builtInEnvironment - Built-in environment
21
20
  * @returns The indicesCollection of the resolved definitions
22
21
  */
23
22
  export declare function resolveIndicesByName(name: Identifier, environment: REnvironmentInformation): ContainerIndices[] | undefined;
@@ -24,7 +24,6 @@ function getAccessOperands(args) {
24
24
  *
25
25
  * @param name - Name to resolve
26
26
  * @param environment - Environment in which name is resolved
27
- * @param builtInEnvironment - Built-in environment
28
27
  * @returns The indicesCollection of the resolved definitions
29
28
  */
30
29
  function resolveIndicesByName(name, environment) {
package/util/files.d.ts CHANGED
@@ -1,4 +1,6 @@
1
+ import type { PathLike } from 'fs';
1
2
  import type { RParseRequestFromFile } from '../r-bridge/retriever';
3
+ import type { FlowrFileProvider } from '../project/context/flowr-file';
2
4
  /**
3
5
  * Represents a table, identified by a header and a list of rows.
4
6
  */
@@ -11,8 +13,16 @@ export interface Table {
11
13
  * @param dir - Directory path to start the search from
12
14
  * @param suffix - Suffix of the files to be retrieved
13
15
  * Based on {@link https://stackoverflow.com/a/45130990}
16
+ *
17
+ * @see {@link getAllFilesSync} for a synchronous version.
14
18
  */
15
19
  export declare function getAllFiles(dir: string, suffix?: RegExp): AsyncGenerator<string>;
20
+ /**
21
+ * Retrieves all files in the given directory recursively (synchronously)
22
+ *
23
+ * @see {@link getAllFiles} - for an asynchronous version.
24
+ */
25
+ export declare function getAllFilesSync(dir: string, suffix?: RegExp): Generator<string>;
16
26
  /**
17
27
  * Retrieves all R files in a given directory (asynchronously)
18
28
  *
@@ -63,3 +73,10 @@ export declare function readLineByLineSync(filePath: string, onLine: (line: Buff
63
73
  * @param directory - The directory whose parent to return
64
74
  */
65
75
  export declare function getParentDirectory(directory: string): string;
76
+ /**
77
+ * Parses the given file in the 'Debian Control Format'.
78
+ * @param file - The file to parse
79
+ * @returns Map containing the keys and values of the provided file.
80
+ */
81
+ export declare function parseDCF(file: FlowrFileProvider<string>): Map<string, string[]>;
82
+ export declare function isFilePath(p: PathLike): boolean;
package/util/files.js CHANGED
@@ -37,12 +37,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getAllFiles = getAllFiles;
40
+ exports.getAllFilesSync = getAllFilesSync;
40
41
  exports.allRFiles = allRFiles;
41
42
  exports.allRFilesFrom = allRFilesFrom;
42
43
  exports.writeTableAsCsv = writeTableAsCsv;
43
44
  exports.readLineByLine = readLineByLine;
44
45
  exports.readLineByLineSync = readLineByLineSync;
45
46
  exports.getParentDirectory = getParentDirectory;
47
+ exports.parseDCF = parseDCF;
48
+ exports.isFilePath = isFilePath;
46
49
  const fs_1 = __importStar(require("fs"));
47
50
  const path_1 = __importDefault(require("path"));
48
51
  const log_1 = require("./log");
@@ -52,6 +55,8 @@ const n_readlines_1 = __importDefault(require("n-readlines"));
52
55
  * @param dir - Directory path to start the search from
53
56
  * @param suffix - Suffix of the files to be retrieved
54
57
  * Based on {@link https://stackoverflow.com/a/45130990}
58
+ *
59
+ * @see {@link getAllFilesSync} for a synchronous version.
55
60
  */
56
61
  async function* getAllFiles(dir, suffix = /.*/) {
57
62
  const entries = await fs_1.promises.readdir(dir, { withFileTypes: true, recursive: false });
@@ -65,6 +70,23 @@ async function* getAllFiles(dir, suffix = /.*/) {
65
70
  }
66
71
  }
67
72
  }
73
+ /**
74
+ * Retrieves all files in the given directory recursively (synchronously)
75
+ *
76
+ * @see {@link getAllFiles} - for an asynchronous version.
77
+ */
78
+ function* getAllFilesSync(dir, suffix = /.*/) {
79
+ const entries = fs_1.default.readdirSync(dir, { withFileTypes: true, recursive: false });
80
+ for (const subEntries of entries) {
81
+ const res = path_1.default.resolve(dir, subEntries.name);
82
+ if (subEntries.isDirectory()) {
83
+ yield* getAllFilesSync(res, suffix);
84
+ }
85
+ else if (suffix.test(subEntries.name)) {
86
+ yield res;
87
+ }
88
+ }
89
+ }
68
90
  const rFileRegex = /\.[rR]$/;
69
91
  /**
70
92
  * Retrieves all R files in a given directory (asynchronously)
@@ -182,4 +204,47 @@ function getParentDirectory(directory) {
182
204
  // apparently this is somehow the best way to do it in node, what
183
205
  return directory.split(path_1.default.sep).slice(0, -1).join(path_1.default.sep);
184
206
  }
207
+ /**
208
+ * Parses the given file in the 'Debian Control Format'.
209
+ * @param file - The file to parse
210
+ * @returns Map containing the keys and values of the provided file.
211
+ */
212
+ function parseDCF(file) {
213
+ const result = new Map();
214
+ let currentKey = '';
215
+ let currentValue = '';
216
+ const indentRegex = new RegExp(/^\s/);
217
+ const firstColonRegex = new RegExp(/:(.*)/s);
218
+ const fileContent = file.content().split(/\r?\n/);
219
+ for (const line of fileContent) {
220
+ if (indentRegex.test(line)) {
221
+ currentValue += '\n' + line.trim();
222
+ }
223
+ else {
224
+ if (currentKey) {
225
+ const values = currentValue ? cleanValues(currentValue) : [];
226
+ result.set(currentKey, values);
227
+ }
228
+ const [key, rest] = line.split(firstColonRegex).map(s => s.trim());
229
+ currentKey = key.trim();
230
+ currentValue = rest.trim();
231
+ }
232
+ }
233
+ if (currentKey) {
234
+ const values = currentValue ? cleanValues(currentValue) : [];
235
+ result.set(currentKey, values);
236
+ }
237
+ return result;
238
+ }
239
+ const cleanSplitRegex = /[\n,]+/;
240
+ const cleanQuotesRegex = /'/g;
241
+ function cleanValues(values) {
242
+ return values
243
+ .split(cleanSplitRegex)
244
+ .map(s => s.trim().replace(cleanQuotesRegex, ''))
245
+ .filter(s => s.length > 0);
246
+ }
247
+ function isFilePath(p) {
248
+ return fs_1.default.existsSync(p) && fs_1.default.statSync(p).isFile();
249
+ }
185
250
  //# sourceMappingURL=files.js.map
@@ -1,10 +1,11 @@
1
- import type { RParseRequest } from '../../r-bridge/retriever';
1
+ import type { RParseRequest, RParseRequestFromText } from '../../r-bridge/retriever';
2
+ import type { SupportedFormats } from './adapter-format';
2
3
  export declare const FileAdapters: {
3
4
  readonly R: {
4
5
  convertRequest: (request: RParseRequest) => RParseRequest;
5
6
  };
6
7
  readonly Rmd: {
7
- convertRequest: (request: RParseRequest) => import("../../r-bridge/retriever").RParseRequestFromText<import("./adapters/rmd-adapter").RmdInfo>;
8
+ convertRequest: (request: RParseRequest) => RParseRequestFromText<import("./adapters/rmd-adapter").RmdInfo>;
8
9
  };
9
10
  };
10
11
  export declare const DocumentTypeToFormat: {
@@ -13,4 +14,5 @@ export declare const DocumentTypeToFormat: {
13
14
  };
14
15
  export type AdapterReturnTypes = ReturnType<typeof FileAdapters[keyof typeof FileAdapters]['convertRequest']>;
15
16
  export declare function requestFromFile(path: string): AdapterReturnTypes;
17
+ export declare function requestFromText(text: string, typeHint?: SupportedFormats): AdapterReturnTypes;
16
18
  export declare function inferFileType(request: RParseRequest): keyof typeof FileAdapters;
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.DocumentTypeToFormat = exports.FileAdapters = void 0;
7
7
  exports.requestFromFile = requestFromFile;
8
+ exports.requestFromText = requestFromText;
8
9
  exports.inferFileType = inferFileType;
9
10
  const r_adapter_1 = require("./adapters/r-adapter");
10
11
  const path_1 = __importDefault(require("path"));
@@ -25,12 +26,18 @@ function requestFromFile(path) {
25
26
  const type = inferFileType(baseRequest);
26
27
  return exports.FileAdapters[type].convertRequest(baseRequest);
27
28
  }
29
+ function requestFromText(text, typeHint) {
30
+ const baseRequest = {
31
+ request: 'text',
32
+ content: text,
33
+ info: typeHint ? { type: typeHint } : undefined
34
+ };
35
+ const type = inferFileType(baseRequest);
36
+ return exports.FileAdapters[type].convertRequest(baseRequest);
37
+ }
28
38
  function inferFileType(request) {
29
39
  if (request.request === 'text') {
30
- // For now we don't know what type the request is
31
- // and have to assume it is normal R Code
32
- // In the future we could add a heuristic to guess the type
33
- return 'R';
40
+ return request.info ? request.info.type : 'R';
34
41
  }
35
42
  const type = path_1.default.extname(request.content).toLowerCase();
36
43
  // Fallback to default if unknown
package/util/r-value.d.ts CHANGED
@@ -20,4 +20,4 @@ export declare function unliftRValue(value: ValueString): RStringValue | undefin
20
20
  export declare function unliftRValue(value: ValueNumber | ValueInterval): RNumberValue | undefined;
21
21
  export declare function unliftRValue(value: ValueLogical): RLogicalValue | undefined;
22
22
  export declare function unliftRValue(value: ValueVector): (RStringValue | RNumberValue | RLogicalValue)[] | undefined;
23
- export declare function unliftRValue(value: Value): RStringValue | RNumberValue | boolean | (RStringValue | RNumberValue | RLogicalValue)[] | undefined;
23
+ export declare function unliftRValue(value: Value): RStringValue | RNumberValue | 'fn-def' | boolean | ('fn-def' | RStringValue | RNumberValue | RLogicalValue)[] | undefined;
package/util/r-value.js CHANGED
@@ -106,6 +106,8 @@ function unliftRValue(value) {
106
106
  case 'missing': {
107
107
  return undefined;
108
108
  }
109
+ case 'function-definition':
110
+ return 'fn-def';
109
111
  default:
110
112
  (0, assert_1.assertUnreachable)(type);
111
113
  }
package/util/version.d.ts CHANGED
@@ -1,2 +1,19 @@
1
1
  import { SemVer } from 'semver';
2
+ import type { KnownParser } from '../r-bridge/parser';
3
+ import type { ReplOutput } from '../cli/repl/commands/repl-main';
4
+ import type { FlowrAnalysisProvider } from '../project/flowr-analyzer';
2
5
  export declare function flowrVersion(): SemVer;
6
+ type Version = `${number}.${number}.${number}`;
7
+ /**
8
+ * Describes the version of flowR and the used R interpreter.
9
+ */
10
+ export interface VersionInformation {
11
+ /** The version of flowR */
12
+ flowr: Version;
13
+ /** The version of R identified by the underlying {@link RShell} */
14
+ r: Version | 'unknown' | 'none';
15
+ engine: string;
16
+ }
17
+ export declare function retrieveVersionInformation(input: KnownParser | FlowrAnalysisProvider): Promise<VersionInformation>;
18
+ export declare function printVersionInformation(output: ReplOutput, input: KnownParser | FlowrAnalysisProvider): Promise<void>;
19
+ export {};
package/util/version.js CHANGED
@@ -1,10 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.flowrVersion = flowrVersion;
4
+ exports.retrieveVersionInformation = retrieveVersionInformation;
5
+ exports.printVersionInformation = printVersionInformation;
4
6
  const semver_1 = require("semver");
7
+ const assert_1 = require("./assert");
5
8
  // this is automatically replaced with the current version by release-it
6
- const version = '2.5.0';
9
+ const version = '2.6.1';
7
10
  function flowrVersion() {
8
11
  return new semver_1.SemVer(version);
9
12
  }
13
+ const versionRegex = /^\d+\.\d+\.\d+/m;
14
+ async function retrieveVersionInformation(input) {
15
+ const flowr = flowrVersion().toString();
16
+ let r;
17
+ let name;
18
+ if ('name' in input) {
19
+ r = await input.rVersion();
20
+ name = input.name;
21
+ }
22
+ else {
23
+ const parserInformation = await input.parserInformation();
24
+ r = parserInformation.name === 'r-shell' ? parserInformation.rVersion : 'unknown';
25
+ name = parserInformation.name;
26
+ }
27
+ (0, assert_1.guard)(versionRegex.test(flowr), `flowR version ${flowr} does not match the expected format!`);
28
+ (0, assert_1.guard)(r === 'unknown' || r === 'none' || versionRegex.test(r), `R version ${r} does not match the expected format!`);
29
+ return { flowr: flowr, r: r, engine: name };
30
+ }
31
+ async function printVersionInformation(output, input) {
32
+ const { flowr, r, engine } = await retrieveVersionInformation(input);
33
+ output.stdout(`Engine: ${engine}`);
34
+ output.stdout(` flowR: ${flowr}`);
35
+ output.stdout(` R: ${r}`);
36
+ }
10
37
  //# sourceMappingURL=version.js.map