@eagleoutice/flowr 2.12.2 → 2.13.0

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 (319) hide show
  1. package/README.md +38 -91
  2. package/abstract-interpretation/data-frame/dataframe-domain.d.ts +3 -3
  3. package/abstract-interpretation/data-frame/dataframe-domain.js +14 -6
  4. package/abstract-interpretation/data-frame/semantics.js +12 -16
  5. package/abstract-interpretation/domains/abstract-domain.d.ts +46 -44
  6. package/abstract-interpretation/domains/abstract-domain.js +146 -6
  7. package/abstract-interpretation/domains/bounded-set-domain.d.ts +16 -25
  8. package/abstract-interpretation/domains/bounded-set-domain.js +22 -69
  9. package/abstract-interpretation/domains/interval-domain.d.ts +27 -36
  10. package/abstract-interpretation/domains/interval-domain.js +111 -146
  11. package/abstract-interpretation/domains/lattice.d.ts +3 -3
  12. package/abstract-interpretation/domains/multi-value-state-domain.js +3 -3
  13. package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -19
  14. package/abstract-interpretation/domains/partial-product-domain.js +21 -54
  15. package/abstract-interpretation/domains/positive-interval-domain.d.ts +8 -12
  16. package/abstract-interpretation/domains/positive-interval-domain.js +21 -50
  17. package/abstract-interpretation/domains/product-domain.d.ts +1 -1
  18. package/abstract-interpretation/domains/product-domain.js +4 -4
  19. package/abstract-interpretation/domains/set-range-domain.d.ts +60 -56
  20. package/abstract-interpretation/domains/set-range-domain.js +141 -200
  21. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +17 -23
  22. package/abstract-interpretation/domains/set-upper-bound-domain.js +59 -103
  23. package/abstract-interpretation/domains/singleton-domain.d.ts +15 -18
  24. package/abstract-interpretation/domains/singleton-domain.js +33 -72
  25. package/abstract-interpretation/domains/state-abstract-domain.d.ts +12 -16
  26. package/abstract-interpretation/domains/state-abstract-domain.js +36 -126
  27. package/abstract-interpretation/domains/state-domain-like.d.ts +2 -2
  28. package/abstract-interpretation/domains/value-abstract-domain.d.ts +120 -0
  29. package/abstract-interpretation/domains/{satisfiable-domain.js → value-abstract-domain.js} +14 -2
  30. package/benchmark/slicer.d.ts +2 -2
  31. package/benchmark/slicer.js +6 -5
  32. package/cli/common/options.d.ts +10 -0
  33. package/cli/common/options.js +2 -0
  34. package/cli/common/scripts-info.d.ts +10 -0
  35. package/cli/flowr-main-options.d.ts +4 -0
  36. package/cli/flowr-main-options.js +5 -0
  37. package/cli/flowr.d.ts +5 -0
  38. package/cli/flowr.js +15 -7
  39. package/cli/repl/commands/repl-query.js +42 -20
  40. package/cli/repl/commands/repl-signature.js +2 -2
  41. package/cli/repl/core.d.ts +14 -5
  42. package/cli/repl/core.js +32 -17
  43. package/cli/repl/parser/slice-query-parser.d.ts +69 -8
  44. package/cli/repl/parser/slice-query-parser.js +82 -13
  45. package/cli/repl/path-input.d.ts +6 -0
  46. package/cli/repl/path-input.js +41 -0
  47. package/cli/repl/print-version.js +3 -5
  48. package/cli/slicer-app.d.ts +2 -0
  49. package/cli/slicer-app.js +2 -1
  50. package/config.d.ts +54 -6
  51. package/config.js +133 -12
  52. package/control-flow/control-flow-graph.d.ts +3 -2
  53. package/control-flow/control-flow-graph.js +34 -14
  54. package/control-flow/semantic-cfg-guided-visitor.d.ts +3 -0
  55. package/control-flow/semantic-cfg-guided-visitor.js +3 -0
  56. package/core/steps/all/static-slicing/10-reconstruct.d.ts +6 -0
  57. package/core/steps/all/static-slicing/10-reconstruct.js +3 -1
  58. package/data/r-base-packages.generated.d.ts +1 -1
  59. package/data/r-base-packages.generated.js +3 -3
  60. package/data/sigdb/sigdb.remote.json +53 -53
  61. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  62. package/dataflow/environments/built-in-proc-name.js +2 -0
  63. package/dataflow/environments/built-in.d.ts +2 -0
  64. package/dataflow/environments/built-in.js +2 -0
  65. package/dataflow/environments/default-builtin-config.d.ts +3 -5
  66. package/dataflow/environments/default-builtin-config.js +2 -2
  67. package/dataflow/environments/environment.d.ts +9 -0
  68. package/dataflow/environments/environment.js +28 -7
  69. package/dataflow/environments/identifier.d.ts +1 -2
  70. package/dataflow/environments/identifier.js +1 -5
  71. package/dataflow/extractor.js +1 -2
  72. package/dataflow/graph/dataflowgraph-builder.js +42 -3
  73. package/dataflow/graph/df-helper.d.ts +15 -0
  74. package/dataflow/graph/df-helper.js +20 -0
  75. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +4 -4
  76. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -0
  77. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +13 -0
  78. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +4 -0
  79. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +57 -11
  80. package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +12 -0
  81. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +233 -0
  82. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +2 -1
  83. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -3
  84. package/documentation/data/faq/faqs.js +12 -1
  85. package/documentation/doc-readme.js +1 -1
  86. package/documentation/doc-util/doc-files.d.ts +2 -2
  87. package/documentation/doc-util/doc-files.js +4 -7
  88. package/documentation/doc-util/doc-query.d.ts +12 -9
  89. package/documentation/doc-util/doc-query.js +63 -28
  90. package/documentation/wiki-absint.js +1 -4
  91. package/documentation/wiki-analyzer.js +8 -3
  92. package/documentation/wiki-cfg.js +3 -2
  93. package/documentation/wiki-dataflow-graph.js +14 -4
  94. package/documentation/wiki-interface.js +29 -16
  95. package/documentation/wiki-mk/doc-maker.js +1 -1
  96. package/documentation/wiki-query.js +189 -30
  97. package/documentation/wiki-signature-database.d.ts +1 -1
  98. package/documentation/wiki-signature-database.js +53 -27
  99. package/linter/linter-output.d.ts +24 -0
  100. package/linter/linter-output.js +117 -0
  101. package/linter/linter-rules.d.ts +2 -4
  102. package/linter/rules/dataframe-access-validation.js +4 -4
  103. package/linter/rules/deprecated-functions.d.ts +2 -4
  104. package/linter/rules/deprecated-functions.js +58 -3
  105. package/linter/rules/undefined-symbol.js +18 -10
  106. package/linter/rules/unused-definition.js +24 -0
  107. package/package.json +5 -2
  108. package/project/context/flowr-analyzer-context.d.ts +59 -1
  109. package/project/context/flowr-analyzer-context.js +118 -3
  110. package/project/context/flowr-analyzer-dependencies-context.d.ts +32 -7
  111. package/project/context/flowr-analyzer-dependencies-context.js +33 -3
  112. package/project/context/flowr-analyzer-files-context.d.ts +32 -0
  113. package/project/context/flowr-analyzer-files-context.js +132 -14
  114. package/project/context/flowr-analyzer-loading-order-context.d.ts +6 -0
  115. package/project/context/flowr-analyzer-loading-order-context.js +20 -0
  116. package/project/context/flowr-analyzer-meta-context.d.ts +92 -10
  117. package/project/context/flowr-analyzer-meta-context.js +64 -23
  118. package/project/context/flowr-file.d.ts +7 -0
  119. package/project/context/flowr-file.js +7 -0
  120. package/project/context/project-kind.d.ts +22 -0
  121. package/project/context/project-kind.js +27 -0
  122. package/project/dependency-version-space.d.ts +166 -0
  123. package/project/dependency-version-space.js +564 -0
  124. package/project/flowr-analyzer-builder.js +1 -1
  125. package/project/flowr-analyzer.d.ts +4 -0
  126. package/project/flowr-analyzer.js +5 -0
  127. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
  128. package/project/plugins/file-plugins/files/flowr-description-file.js +7 -0
  129. package/project/plugins/file-plugins/files/flowr-namespace-file.js +5 -1
  130. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +739 -0
  131. package/project/plugins/file-plugins/files/flowr-rda-file.js +2407 -0
  132. package/project/plugins/file-plugins/files/flowr-rproject-file.d.ts +31 -0
  133. package/project/plugins/file-plugins/files/flowr-rproject-file.js +66 -0
  134. package/project/plugins/file-plugins/files/r-fun-tab.d.ts +828 -0
  135. package/project/plugins/file-plugins/files/r-fun-tab.js +1039 -0
  136. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
  137. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
  138. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +1 -1
  139. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +1 -1
  140. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +1 -1
  141. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +1 -1
  142. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +1 -1
  143. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +1 -1
  144. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +1 -1
  145. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +1 -1
  146. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +1 -1
  147. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +26 -0
  148. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +38 -0
  149. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +17 -0
  150. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +30 -0
  151. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.d.ts +22 -0
  152. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.js +36 -0
  153. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +1 -1
  154. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
  155. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +1 -1
  156. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
  157. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +3 -4
  158. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +5 -6
  159. package/project/plugins/flowr-analyzer-plugin.js +5 -0
  160. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +1 -1
  161. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
  162. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.d.ts +14 -0
  163. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.js +53 -0
  164. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +1 -1
  165. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.d.ts +15 -0
  166. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.js +33 -0
  167. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.d.ts +1 -1
  168. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +18 -13
  169. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.d.ts +13 -0
  170. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.js +32 -0
  171. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +1 -1
  172. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
  173. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +8 -1
  174. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +70 -7
  175. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.d.ts +1 -1
  176. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -1
  177. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +1 -1
  178. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.d.ts +18 -0
  179. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +62 -0
  180. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +4 -1
  181. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +5 -13
  182. package/project/plugins/package-version-plugins/package.d.ts +4 -1
  183. package/project/plugins/package-version-plugins/package.js +8 -5
  184. package/project/plugins/plugin-registry.d.ts +11 -3
  185. package/project/plugins/plugin-registry.js +24 -5
  186. package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.d.ts +51 -0
  187. package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.js +101 -0
  188. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +10 -5
  189. package/project/sigdb/build.js +12 -2
  190. package/project/sigdb/decode.d.ts +7 -0
  191. package/project/sigdb/decode.js +35 -4
  192. package/project/sigdb/decompress.d.ts +2 -0
  193. package/project/sigdb/decompress.js +5 -0
  194. package/project/sigdb/manifest.d.ts +5 -0
  195. package/project/sigdb/manifest.js +37 -6
  196. package/project/sigdb/reader.d.ts +82 -2
  197. package/project/sigdb/reader.js +226 -14
  198. package/project/sigdb/schema.d.ts +31 -5
  199. package/project/sigdb/schema.js +7 -3
  200. package/project/sigdb/{version.d.ts → sigdb-version.d.ts} +21 -1
  201. package/project/sigdb/sigdb-version.js +119 -0
  202. package/queries/catalog/absint-query/absint-query-format.d.ts +2 -0
  203. package/queries/catalog/absint-query/absint-query-format.js +2 -0
  204. package/queries/catalog/call-context-query/call-context-query-executor.js +30 -3
  205. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -0
  206. package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
  207. package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
  208. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +6 -0
  209. package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -0
  210. package/queries/catalog/call-graph-query/expand-library-internals.d.ts +19 -0
  211. package/queries/catalog/call-graph-query/expand-library-internals.js +59 -0
  212. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -0
  213. package/queries/catalog/cluster-query/cluster-query-format.js +1 -0
  214. package/queries/catalog/config-query/config-query-executor.js +15 -6
  215. package/queries/catalog/config-query/config-query-format.d.ts +18 -4
  216. package/queries/catalog/config-query/config-query-format.js +246 -96
  217. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -0
  218. package/queries/catalog/control-flow-query/control-flow-query-format.js +1 -0
  219. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -0
  220. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -0
  221. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -0
  222. package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -0
  223. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -7
  224. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +13 -1
  225. package/queries/catalog/dependencies-query/dependencies-query-format.js +117 -17
  226. package/queries/catalog/dice-query/dice-query-executor.js +6 -9
  227. package/queries/catalog/dice-query/dice-query-format.d.ts +4 -5
  228. package/queries/catalog/dice-query/dice-query-format.js +10 -6
  229. package/queries/catalog/does-call-query/does-call-query-executor.js +15 -2
  230. package/queries/catalog/does-call-query/does-call-query-format.d.ts +8 -0
  231. package/queries/catalog/does-call-query/does-call-query-format.js +4 -1
  232. package/queries/catalog/files-query/files-query-format.d.ts +2 -0
  233. package/queries/catalog/files-query/files-query-format.js +2 -0
  234. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.d.ts +6 -0
  235. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +277 -0
  236. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +119 -0
  237. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +331 -0
  238. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
  239. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -0
  240. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -0
  241. package/queries/catalog/id-map-query/id-map-query-format.js +1 -0
  242. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
  243. package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -0
  244. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
  245. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -0
  246. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
  247. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -0
  248. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -0
  249. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -0
  250. package/queries/catalog/linter-query/linter-query-executor.js +11 -2
  251. package/queries/catalog/linter-query/linter-query-format.d.ts +9 -4
  252. package/queries/catalog/linter-query/linter-query-format.js +44 -21
  253. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
  254. package/queries/catalog/location-map-query/location-map-query-format.js +2 -0
  255. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -0
  256. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -0
  257. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
  258. package/queries/catalog/origin-query/origin-query-format.js +2 -0
  259. package/queries/catalog/project-query/project-query-executor.d.ts +0 -15
  260. package/queries/catalog/project-query/project-query-executor.js +19 -62
  261. package/queries/catalog/project-query/project-query-format.d.ts +7 -18
  262. package/queries/catalog/project-query/project-query-format.js +3 -18
  263. package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
  264. package/queries/catalog/provenance-query/provenance-query-format.js +2 -0
  265. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
  266. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -0
  267. package/queries/catalog/search-query/search-query-format.d.ts +1 -0
  268. package/queries/catalog/search-query/search-query-format.js +1 -0
  269. package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -0
  270. package/queries/catalog/signature-query/signature-query-executor.js +267 -57
  271. package/queries/catalog/signature-query/signature-query-format.d.ts +37 -6
  272. package/queries/catalog/signature-query/signature-query-format.js +41 -5
  273. package/queries/catalog/signature-query/signature-query-render.js +48 -6
  274. package/queries/catalog/slice-query-options.d.ts +49 -0
  275. package/queries/catalog/slice-query-options.js +50 -0
  276. package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -12
  277. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -15
  278. package/queries/catalog/static-slice-query/static-slice-query-format.js +9 -10
  279. package/queries/query-print.js +3 -1
  280. package/queries/query.d.ts +63 -3
  281. package/queries/query.js +9 -2
  282. package/r-bridge/data/data.d.ts +16 -0
  283. package/r-bridge/data/data.js +20 -0
  284. package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -0
  285. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
  286. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
  287. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +19 -16
  288. package/reconstruct/reconstruct.d.ts +18 -1
  289. package/reconstruct/reconstruct.js +42 -19
  290. package/slicing/criterion/parse.d.ts +4 -0
  291. package/slicing/criterion/parse.js +4 -0
  292. package/slicing/static/slice-call.js +17 -9
  293. package/slicing/static/static-slicer.d.ts +1 -1
  294. package/slicing/static/static-slicer.js +5 -4
  295. package/util/files.d.ts +19 -1
  296. package/util/files.js +45 -3
  297. package/util/glob.d.ts +19 -0
  298. package/util/glob.js +67 -0
  299. package/util/log.d.ts +12 -0
  300. package/util/log.js +17 -1
  301. package/util/logic.d.ts +6 -0
  302. package/util/logic.js +31 -1
  303. package/util/mermaid/dfg.js +17 -12
  304. package/util/mermaid/mermaid.js +2 -2
  305. package/util/objects.d.ts +5 -0
  306. package/util/objects.js +8 -0
  307. package/util/r-version.d.ts +9 -1
  308. package/util/r-version.js +27 -2
  309. package/util/schema.d.ts +16 -0
  310. package/util/schema.js +89 -4
  311. package/util/text/ansi.d.ts +4 -0
  312. package/util/text/ansi.js +27 -3
  313. package/util/text/strings.d.ts +9 -0
  314. package/util/text/strings.js +29 -0
  315. package/util/version.js +79 -6
  316. package/abstract-interpretation/domains/satisfiable-domain.d.ts +0 -29
  317. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +0 -22
  318. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +0 -52
  319. package/project/sigdb/version.js +0 -55
@@ -3,8 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SigDatabaseSet = exports.SigDatabase = void 0;
6
+ exports.SigDatabaseSet = exports.SigDatabase = exports.MergedSignatureSource = void 0;
7
7
  exports.readSignatureDb = readSignatureDb;
8
+ exports.availableVersionEntries = availableVersionEntries;
9
+ exports.sourceForPackage = sourceForPackage;
8
10
  exports.getSharedSigSourceSync = getSharedSigSourceSync;
9
11
  exports.getSharedSigSource = getSharedSigSource;
10
12
  exports.verifyShardedDatabase = verifyShardedDatabase;
@@ -19,7 +21,7 @@ const node_path_1 = __importDefault(require("node:path"));
19
21
  const node_readline_1 = __importDefault(require("node:readline"));
20
22
  const r_version_1 = require("../../util/r-version");
21
23
  const schema_1 = require("./schema");
22
- const version_1 = require("./version");
24
+ const sigdb_version_1 = require("./sigdb-version");
23
25
  const index_format_1 = require("./index-format");
24
26
  const decode_1 = require("./decode");
25
27
  const decompress_1 = require("./decompress");
@@ -86,6 +88,154 @@ async function readSignatureDb(file) {
86
88
  }
87
89
  return { ...header, strings, blobs, pkgs, meta };
88
90
  }
91
+ /**
92
+ * The versions a source can answer for a package (dated releases, base-R core releases, and the recorded latest),
93
+ * deduplicated and ascending by R-version order. This is the single enumeration both the signature query and the
94
+ * version-guessing query build on.
95
+ */
96
+ function availableVersionEntries(src, pkg) {
97
+ const map = new Map();
98
+ for (const r of src.releaseDates(pkg)) {
99
+ if (!map.has(r.version.str)) {
100
+ map.set(r.version.str, r.date);
101
+ }
102
+ }
103
+ for (const v of src.coreVersions(pkg) ?? []) {
104
+ if (!map.has(v.str)) {
105
+ map.set(v.str, src.releaseDate(pkg, v.str));
106
+ }
107
+ }
108
+ const latest = src.latestVersion(pkg);
109
+ if (latest && !map.has(latest.str)) {
110
+ map.set(latest.str, src.releaseDate(pkg, latest.str));
111
+ }
112
+ return [...map.entries()]
113
+ .map(([version, date]) => ({ version, ...(date ? { date } : {}) }))
114
+ // versions that differ in writing but not in R-version order (`1.2` vs `1.2.0`) are settled by release date
115
+ .sort((a, b) => r_version_1.RVersion.compare(a.version, b.version) || (a.date && b.date ? a.date.getTime() - b.date.getTime() : 0));
116
+ }
117
+ /**
118
+ * The reverse index `class -> owning package` over every package's latest version. S3 ownership (a same-named
119
+ * constructor plus a registered method) is a stronger signal than an S4 `exportClasses`, so S3-owned classes are
120
+ * indexed first and an S4 class only claims a name no S3 owner already took.
121
+ */
122
+ function buildClassOwnerIndex(src) {
123
+ const index = new Map();
124
+ const libs = src.packageNames().map(pkg => ({ pkg, lib: src.lookup(pkg) }));
125
+ for (const pick of [(l) => l?.s3Classes, (l) => l?.s4Classes]) {
126
+ for (const { pkg, lib } of libs) {
127
+ for (const cls of pick(lib) ?? []) {
128
+ if (!index.has(cls)) {
129
+ index.set(cls, pkg);
130
+ }
131
+ }
132
+ }
133
+ }
134
+ return index;
135
+ }
136
+ /** the package owning `className` at a specific version (linear scan; S3 and S4 both count) */
137
+ function classOwnerAtVersion(src, className, version) {
138
+ return src.packageNames().find(pkg => {
139
+ const lib = src.lookup(pkg, version);
140
+ return (lib?.s3Classes.includes(className) ?? false) || (lib?.s4Classes.includes(className) ?? false);
141
+ });
142
+ }
143
+ /** union view over multiple sources for the same package; routes queries to the appropriate source */
144
+ class MergedSignatureSource {
145
+ sources;
146
+ constructor(sources) {
147
+ this.sources = sources;
148
+ }
149
+ /** source carrying a version, or the one with the newest release when unpinned */
150
+ pick(pkg, version) {
151
+ if (version !== undefined) {
152
+ return this.sources.find(s => s.hasVersion(pkg, version));
153
+ }
154
+ let best, bestSource;
155
+ for (const s of this.sources) {
156
+ const latest = s.has(pkg) ? s.latestVersion(pkg) : undefined;
157
+ if (latest && (best === undefined || r_version_1.RVersion.compare(latest.str, best.str) > 0)) {
158
+ best = latest;
159
+ bestSource = s;
160
+ }
161
+ }
162
+ return bestSource ?? this.sources.find(s => s.has(pkg));
163
+ }
164
+ has(pkg) {
165
+ return this.sources.some(s => s.has(pkg));
166
+ }
167
+ hasVersion(pkg, version) {
168
+ return this.sources.some(s => s.hasVersion(pkg, version));
169
+ }
170
+ isCranVersion(pkg, version) {
171
+ return this.pick(pkg, version)?.isCranVersion(pkg, version) ?? false;
172
+ }
173
+ lookup(pkg, version) {
174
+ return this.pick(pkg, version)?.lookup(pkg, version);
175
+ }
176
+ classOwner(className, version) {
177
+ for (const s of this.sources) {
178
+ const owner = s.classOwner(className, version);
179
+ if (owner !== undefined) {
180
+ return owner;
181
+ }
182
+ }
183
+ return undefined;
184
+ }
185
+ functions(pkg, version) {
186
+ return this.pick(pkg, version)?.functions(pkg, version);
187
+ }
188
+ functionByName(pkg, name, version) {
189
+ return this.pick(pkg, version)?.functionByName(pkg, name, version);
190
+ }
191
+ transitiveCallees(pkg, name, version) {
192
+ return this.pick(pkg, version)?.transitiveCallees(pkg, name, version);
193
+ }
194
+ dependencies(pkg, version) {
195
+ return this.pick(pkg, version)?.dependencies(pkg, version);
196
+ }
197
+ packageNames() {
198
+ return [...new Set(this.sources.flatMap(s => s.packageNames()))];
199
+ }
200
+ isBaseR(pkg) {
201
+ return this.sources.some(s => s.has(pkg) && s.isBaseR(pkg));
202
+ }
203
+ coreVersions(pkg) {
204
+ return this.sources.find(s => s.has(pkg))?.coreVersions(pkg);
205
+ }
206
+ releaseDate(pkg, version) {
207
+ return this.pick(pkg, version)?.releaseDate(pkg, version);
208
+ }
209
+ releaseDates(pkg) {
210
+ const map = new Map();
211
+ for (const s of this.sources) {
212
+ for (const r of s.releaseDates(pkg)) {
213
+ if (!map.has(r.version.str)) {
214
+ map.set(r.version.str, r);
215
+ }
216
+ }
217
+ }
218
+ return [...map.values()].sort((a, b) => r_version_1.RVersion.compare(a.version.str, b.version.str));
219
+ }
220
+ latestVersion(pkg) {
221
+ let best;
222
+ for (const s of this.sources) {
223
+ const latest = s.latestVersion(pkg);
224
+ if (latest && (best === undefined || r_version_1.RVersion.compare(latest.str, best.str) > 0)) {
225
+ best = latest;
226
+ }
227
+ }
228
+ return best;
229
+ }
230
+ // merged view owns no handles; underlying sources keep theirs
231
+ close() { }
232
+ }
233
+ exports.MergedSignatureSource = MergedSignatureSource;
234
+ /** source that answers for pkg, merging all sources that carry it; undefined if none do */
235
+ function sourceForPackage(sources, pkg) {
236
+ const having = sources.filter(s => s.has(pkg));
237
+ return having.length === 0 ? undefined : having.length === 1 ? having[0] : new MergedSignatureSource(having);
238
+ }
89
239
  /**
90
240
  * Fast, partial reader for a single bundle. `open()`/`openSync()` load the string dictionary + `.idx`
91
241
  * once (a single ranged read of the dictionary section -- no full parse), then every query seeks straight
@@ -97,6 +247,8 @@ class SigDatabase {
97
247
  /** parsed blobs by blob index so repeated lookups skip the re-read + JSON.parse; FIFO-bounded to cap memory */
98
248
  blobCache = new Map();
99
249
  static BlobCacheCap = 2048;
250
+ /** reverse index `S3 class -> owning package`, over every package's latest version; built once (see {@link classOwner}) */
251
+ classIndex;
100
252
  fd;
101
253
  strings;
102
254
  index;
@@ -204,6 +356,10 @@ class SigDatabase {
204
356
  hasVersion(pkg, version) {
205
357
  return this.blob(pkg)?.versions[version] !== undefined;
206
358
  }
359
+ /** whether a version is a current CRAN release (not in the package's `noncran`/removed set) */
360
+ isCranVersion(pkg, version) {
361
+ return !this.blob(pkg)?.noncran?.includes(version);
362
+ }
207
363
  lookup(pkg, version) {
208
364
  const blob = this.blob(pkg);
209
365
  const meta = this.index.meta[pkg];
@@ -212,15 +368,37 @@ class SigDatabase {
212
368
  }
213
369
  return (0, decode_1.deriveLibraryExports)(this.strings, blob, meta, pkg, version, this.cranBase);
214
370
  }
215
- functions(pkg, version) {
371
+ classOwner(className, version) {
372
+ if (version !== undefined) {
373
+ return classOwnerAtVersion(this, className, version);
374
+ }
375
+ this.classIndex ??= buildClassOwnerIndex(this);
376
+ return this.classIndex.get(className);
377
+ }
378
+ /** resolve a package version to its blob and the function-record indices of that version (the shared prologue of {@link functions}/{@link functionByName}) */
379
+ versionFns(pkg, version) {
216
380
  const blob = this.blob(pkg);
217
381
  const meta = this.index.meta[pkg];
218
382
  if (!blob || !meta) {
219
383
  return undefined;
220
384
  }
221
- const ver = (0, version_1.resolveVersion)(blob, meta[0], version);
385
+ const ver = (0, sigdb_version_1.resolveVersion)(blob, meta[0], version);
222
386
  const idxs = ver !== undefined ? (0, decode_1.versionFnIndices)(blob, ver) : undefined;
223
- return idxs?.map(i => (0, decode_1.decodeFunction)(this.strings, blob, i));
387
+ return idxs !== undefined ? { blob, idxs } : undefined;
388
+ }
389
+ functions(pkg, version) {
390
+ const r = this.versionFns(pkg, version);
391
+ return r?.idxs.map(i => (0, decode_1.decodeFunction)(this.strings, r.blob, i));
392
+ }
393
+ functionByName(pkg, name, version) {
394
+ const r = this.versionFns(pkg, version);
395
+ // compare the stored name-string index and decode only the match, rather than the whole package
396
+ const hit = r?.idxs.find(i => this.strings[r.blob.fns[i][0]] === name);
397
+ return hit !== undefined && r !== undefined ? (0, decode_1.decodeFunction)(this.strings, r.blob, hit) : undefined;
398
+ }
399
+ transitiveCallees(pkg, name, version) {
400
+ const fns = this.functions(pkg, version);
401
+ return fns?.some(f => f.name === name) ? (0, decode_1.transitiveCallees)(fns, name) : undefined;
224
402
  }
225
403
  dependencies(pkg, version) {
226
404
  const blob = this.blob(pkg);
@@ -228,7 +406,7 @@ class SigDatabase {
228
406
  if (!blob || !meta) {
229
407
  return undefined;
230
408
  }
231
- const ver = (0, version_1.resolveVersion)(blob, meta[0], version);
409
+ const ver = (0, sigdb_version_1.resolveVersion)(blob, meta[0], version);
232
410
  return ver !== undefined ? (0, decode_1.decodeDependencies)(this.strings, blob, ver) : undefined;
233
411
  }
234
412
  /** whether this is an R-core / base package (its versions are the R releases it shipped with; see {@link SigDbPkgMeta}) */
@@ -252,19 +430,19 @@ class SigDatabase {
252
430
  if (!blob || !meta) {
253
431
  return undefined;
254
432
  }
255
- const ver = version ?? (0, version_1.newestVersion)(blob, meta[0]);
433
+ const ver = version ?? (0, sigdb_version_1.newestVersion)(blob, meta[0]);
256
434
  const day = ver !== undefined ? blob.dates[ver] : undefined;
257
- return day !== undefined ? new Date((0, version_1.dayToMillis)(day)) : undefined;
435
+ return day !== undefined ? new Date((0, sigdb_version_1.dayToMillis)(day)) : undefined;
258
436
  }
259
437
  /** every known release date of a package, in ascending R-version order (empty when no dates were stored) */
260
438
  releaseDates(pkg) {
261
- return (0, version_1.releasesOf)(this.blob(pkg));
439
+ return (0, sigdb_version_1.releasesOf)(this.blob(pkg));
262
440
  }
263
441
  /** the newest version of a package by release date (falling back to the recorded latest, then SemVer order) */
264
442
  latestVersion(pkg) {
265
443
  const blob = this.blob(pkg);
266
444
  const meta = this.index.meta[pkg];
267
- const ver = blob && meta ? (0, version_1.newestVersion)(blob, meta[0]) : undefined;
445
+ const ver = blob && meta ? (0, sigdb_version_1.newestVersion)(blob, meta[0]) : undefined;
268
446
  return ver !== undefined ? r_version_1.RVersion.parseOrZero(ver) : undefined;
269
447
  }
270
448
  /** close the underlying file descriptor (idempotent; safe to call more than once) */
@@ -272,6 +450,7 @@ class SigDatabase {
272
450
  if (!this.closed) {
273
451
  this.closed = true;
274
452
  this.blobCache.clear();
453
+ this.classIndex = undefined;
275
454
  node_fs_1.default.closeSync(this.fd);
276
455
  }
277
456
  }
@@ -303,6 +482,8 @@ class SigDatabaseSet {
303
482
  /** package name to shard indices, ordered by preference (current before full) */
304
483
  routes;
305
484
  cacheDir;
485
+ /** reverse index `S3 class -> owning package`, over every package's latest version; built once (see {@link classOwner}) */
486
+ classIndex;
306
487
  constructor(manifest, baseDir, indices, routes, cacheDir) {
307
488
  this.manifest = manifest;
308
489
  this.baseDir = baseDir;
@@ -477,9 +658,25 @@ class SigDatabaseSet {
477
658
  hasVersion(pkg, version) {
478
659
  return this.route(pkg, version).length > 0;
479
660
  }
661
+ /** whether a version is a current CRAN release (not in the package's `noncran`/removed set) */
662
+ isCranVersion(pkg, version) {
663
+ return !this.historyBlob(pkg)?.noncran?.includes(version);
664
+ }
480
665
  packageNames() {
481
666
  return [...this.routes.keys()];
482
667
  }
668
+ /** the on-demand load state (opened + unpacked) of every shard in this set */
669
+ shardStatus() {
670
+ return this.manifest.shards.map((ref, i) => {
671
+ const compressed = (0, decompress_1.isCompressed)((0, decompress_1.resolveSource)(this.baseDir, ref.path));
672
+ return {
673
+ id: ref.id,
674
+ compressed,
675
+ accessed: this.opened[i] !== undefined,
676
+ unpacked: !compressed || (0, decompress_1.isUnpacked)(ref.hash, this.cacheDir)
677
+ };
678
+ });
679
+ }
483
680
  /** open (blocking) and return every shard database with its manifest ref -- used for whole-set verification */
484
681
  allShards() {
485
682
  return this.manifest.shards.map((ref, i) => ({ ref, db: this.shard(i) }));
@@ -501,9 +698,23 @@ class SigDatabaseSet {
501
698
  lookup(pkg, version) {
502
699
  return this.firstOf(pkg, version, db => db.lookup(pkg, version));
503
700
  }
701
+ classOwner(className, version) {
702
+ if (version !== undefined) {
703
+ return classOwnerAtVersion(this, className, version);
704
+ }
705
+ this.classIndex ??= buildClassOwnerIndex(this);
706
+ return this.classIndex.get(className);
707
+ }
504
708
  functions(pkg, version) {
505
709
  return this.firstOf(pkg, version, db => db.functions(pkg, version));
506
710
  }
711
+ functionByName(pkg, name, version) {
712
+ return this.firstOf(pkg, version, db => db.functionByName(pkg, name, version));
713
+ }
714
+ transitiveCallees(pkg, name, version) {
715
+ const fns = this.functions(pkg, version);
716
+ return fns?.some(f => f.name === name) ? (0, decode_1.transitiveCallees)(fns, name) : undefined;
717
+ }
507
718
  dependencies(pkg, version) {
508
719
  return this.firstOf(pkg, version, db => db.dependencies(pkg, version));
509
720
  }
@@ -524,7 +735,7 @@ class SigDatabaseSet {
524
735
  }
525
736
  /** every known release of a package (version + date), ascending -- read once from the most complete shard */
526
737
  releaseDates(pkg) {
527
- return (0, version_1.releasesOf)(this.historyBlob(pkg));
738
+ return (0, sigdb_version_1.releasesOf)(this.historyBlob(pkg));
528
739
  }
529
740
  /** the release date of a package version (defaulting to the newest release), or `undefined` if unknown */
530
741
  releaseDate(pkg, version) {
@@ -532,14 +743,14 @@ class SigDatabaseSet {
532
743
  if (!blob) {
533
744
  return undefined;
534
745
  }
535
- const ver = version ?? (0, version_1.newestVersion)(blob, this.manifest.meta?.[pkg]?.[0] ?? '');
746
+ const ver = version ?? (0, sigdb_version_1.newestVersion)(blob, this.manifest.meta?.[pkg]?.[0] ?? '');
536
747
  const day = ver !== undefined ? blob.dates[ver] : undefined;
537
- return day !== undefined ? new Date((0, version_1.dayToMillis)(day)) : undefined;
748
+ return day !== undefined ? new Date((0, sigdb_version_1.dayToMillis)(day)) : undefined;
538
749
  }
539
750
  /** the newest version of a package by release date (falling back to the recorded latest, then SemVer order) */
540
751
  latestVersion(pkg) {
541
752
  const blob = this.historyBlob(pkg);
542
- const ver = blob ? (0, version_1.newestVersion)(blob, this.manifest.meta?.[pkg]?.[0] ?? '') : undefined;
753
+ const ver = blob ? (0, sigdb_version_1.newestVersion)(blob, this.manifest.meta?.[pkg]?.[0] ?? '') : undefined;
543
754
  return ver !== undefined ? r_version_1.RVersion.parseOrZero(ver) : undefined;
544
755
  }
545
756
  /**
@@ -552,6 +763,7 @@ class SigDatabaseSet {
552
763
  }
553
764
  this.opened.fill(undefined);
554
765
  this.dictCache.clear();
766
+ this.classIndex = undefined;
555
767
  }
556
768
  }
557
769
  exports.SigDatabaseSet = SigDatabaseSet;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * On-disk schema of the `flowr-sigdb` database (schema 4): the constants, enums, numeric tuple forms and
2
+ * On-disk schema of the `flowr-sigdb` database (schema 5): the constants, enums, numeric tuple forms and
3
3
  * data interfaces that define the serialized format and its read view. The reader/writer/builder logic that
4
4
  * operates on these lives in `./sigdb` (which re-exports this module, so `./sigdb` stays the single entry point).
5
5
  */
@@ -16,6 +16,13 @@ export interface LibraryExports {
16
16
  /** defined-but-not-exported identifiers (only available when internal names are stored, which we usually avoid in the db) */
17
17
  readonly internal: readonly string[];
18
18
  readonly deprecated: readonly string[];
19
+ /**
20
+ * S3 classes this package version OWNS: it registers at least one S3 method for the class (its NAMESPACE's
21
+ * `S3method(generic, class)`) AND exports a same-named constructor function. See {@link FnProp.S3Owner}.
22
+ */
23
+ readonly s3Classes: readonly string[];
24
+ /** S4 classes this package version OWNS: it exports the class via its NAMESPACE `exportClasses()`. See {@link FnProp.S4Owner}. */
25
+ readonly s4Classes: readonly string[];
19
26
  /** flag indicating whether this is a package available on CRAN */
20
27
  readonly cran: boolean;
21
28
  /** package documentation url base in case this package is found at a different endpoint */
@@ -24,7 +31,7 @@ export interface LibraryExports {
24
31
  readonly locations?: ReadonlyMap<string, SigDefinitionLocation>;
25
32
  }
26
33
  export declare const SigDbMagic = "flowr-sigdb";
27
- export declare const SigDbSchema = 4;
34
+ export declare const SigDbSchema = 5;
28
35
  /** default CRAN source-package base URL, used to build a version's tarball link */
29
36
  export declare const DefaultCranBase = "https://cran.r-project.org/src/contrib/";
30
37
  /**
@@ -43,7 +50,20 @@ export declare const enum FnProp {
43
50
  CanThrow = 16,
44
51
  Deprecated = 32,
45
52
  CallsInternal = 64,
46
- NonDeterministic = 128
53
+ NonDeterministic = 128,
54
+ NoDoc = 256,
55
+ S3Method = 512,
56
+ /**
57
+ * An exported function that is also an S3 class this package OWNS: it is a same-named constructor for a
58
+ * class the package registers at least one S3 method for (see {@link LibraryExports.s3Classes}, derived
59
+ * from this bit by {@link deriveLibraryExports}).
60
+ */
61
+ S3Owner = 1024,
62
+ /**
63
+ * Set on the name of an S4 class this package OWNS: it exports the class via its NAMESPACE `exportClasses()`
64
+ * (see {@link LibraryExports.s4Classes}, derived from this bit by {@link deriveLibraryExports}).
65
+ */
66
+ S4Owner = 2048
47
67
  }
48
68
  /** the {@link FnProp} bit to its name (for decoding); integer keys iterate in ascending bit order */
49
69
  export declare const FnPropNames: Readonly<Record<FnProp, string>>;
@@ -61,8 +81,12 @@ export declare const enum ParamFlag {
61
81
  export type SigParam = number | [nameIdx: number, flags: number] | [nameIdx: number, flags: number, defaultIdx: number];
62
82
  /** a full signature: the ordered parameter list */
63
83
  export type Sig = SigParam[];
64
- /** one function record `[nameIdx, sigIdx, cgIdx, propBits, fileIdx, line]` (`sigIdx`/`cgIdx`/`fileIdx` are -1 when absent) */
65
- export type SigFn = [nameIdx: number, sigIdx: number, cgIdx: number, propBits: number, fileIdx: number, line: number];
84
+ /**
85
+ * One function record `[nameIdx, sigIdx, cgIdx, propBits, fileIdx, line]` (`sigIdx`/`cgIdx`/`fileIdx` are -1 when
86
+ * absent), with an optional trailing `topicIdx` (the Rd help topic, present only when it differs from the name).
87
+ * The trailing element is additive: readers that stop at `line` ignore it, so older bundles stay readable.
88
+ */
89
+ export type SigFn = [nameIdx: number, sigIdx: number, cgIdx: number, propBits: number, fileIdx: number, line: number] | [nameIdx: number, sigIdx: number, cgIdx: number, propBits: number, fileIdx: number, line: number, topicIdx: number];
66
90
  /** the kind of a package dependency (mirrors the DESCRIPTION fields) */
67
91
  export declare const enum DepType {
68
92
  Depends = 0,
@@ -163,6 +187,8 @@ export interface SigFunctionInfo {
163
187
  readonly callees: readonly string[];
164
188
  readonly file?: string;
165
189
  readonly line?: number;
190
+ /** the Rd help topic (man-page name) documenting this function, when it differs from {@link name} */
191
+ readonly topic?: string;
166
192
  }
167
193
  /** one declared package dependency, e.g. `{ name: 'testthat', type: Suggests, constraint: '>= 2.1.0' }` */
168
194
  export interface SigDependencyInfo {
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  /**
3
- * On-disk schema of the `flowr-sigdb` database (schema 4): the constants, enums, numeric tuple forms and
3
+ * On-disk schema of the `flowr-sigdb` database (schema 5): the constants, enums, numeric tuple forms and
4
4
  * data interfaces that define the serialized format and its read view. The reader/writer/builder logic that
5
5
  * operates on these lives in `./sigdb` (which re-exports this module, so `./sigdb` stays the single entry point).
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.DepTypeNames = exports.FnPropNames = exports.SigDbExt = exports.MaxDefaultLength = exports.DefaultCranBase = exports.SigDbSchema = exports.SigDbMagic = void 0;
9
9
  exports.SigDbMagic = 'flowr-sigdb';
10
- exports.SigDbSchema = 4;
10
+ exports.SigDbSchema = 5;
11
11
  /** default CRAN source-package base URL, used to build a version's tarball link */
12
12
  exports.DefaultCranBase = 'https://cran.r-project.org/src/contrib/';
13
13
  /**
@@ -26,7 +26,11 @@ exports.FnPropNames = {
26
26
  [16 /* FnProp.CanThrow */]: 'can-throw',
27
27
  [32 /* FnProp.Deprecated */]: 'deprecated',
28
28
  [64 /* FnProp.CallsInternal */]: 'calls-internal',
29
- [128 /* FnProp.NonDeterministic */]: 'non-deterministic'
29
+ [128 /* FnProp.NonDeterministic */]: 'non-deterministic',
30
+ [256 /* FnProp.NoDoc */]: 'no-doc',
31
+ [512 /* FnProp.S3Method */]: 's3-method',
32
+ [1024 /* FnProp.S3Owner */]: 's3-owner',
33
+ [2048 /* FnProp.S4Owner */]: 's4-owner'
30
34
  };
31
35
  /** the {@link DepType} values in order, with their names (for decoding) */
32
36
  exports.DepTypeNames = ['depends', 'imports', 'linkingTo', 'suggests', 'enhances'];
@@ -7,12 +7,32 @@ import { RVersion } from '../../util/r-version';
7
7
  import type { PkgBlob } from './schema';
8
8
  /** milliseconds since the Unix epoch for a stored day count (dates are stored at day granularity to save space) */
9
9
  export declare function dayToMillis(day: number): number;
10
+ /** the inclusive millisecond window spanned by a `YYYY`, `YYYY.MM`, or `YYYY.MM.DD` date spec */
11
+ export interface DateWindow {
12
+ readonly lower: number;
13
+ readonly upper: number;
14
+ }
15
+ /**
16
+ * Parse a `YYYY`, `YYYY.MM`, or `YYYY.MM.DD` spec into its inclusive `[lower, upper]` millisecond window (the whole
17
+ * year / month / day named), or `undefined` when malformed or out of range (month `1..12`, day `1..31`).
18
+ */
19
+ export declare function parseDateWindow(spec: string): DateWindow | undefined;
20
+ /** whether `spec` is a release-date bound like `<=2026` or `>=2021.05` (a comparator is required) */
21
+ export declare function isDateBound(spec: string): boolean;
22
+ /**
23
+ * A release-date predicate for a bound like `<=2026`, `>=2021.05.03` (`YYYY.MM.DD`, comparator required), or
24
+ * `undefined` when `spec` is not a date bound. An undated release (or an impossible date) never matches.
25
+ */
26
+ export declare function releaseDateBound(spec: string): ((date: Date | undefined) => boolean) | undefined;
10
27
  /** one release: a parsed version paired with its release date */
11
28
  export interface VersionRelease {
12
29
  readonly version: RVersion;
13
30
  readonly date: Date;
14
31
  }
15
- /** the known releases of a blob, ascending by R-version order (empty when no dates were stored) */
32
+ /**
33
+ * The known releases of a blob, ascending by R-version order (empty when no dates were stored). Versions that
34
+ * differ in writing but not in order (`1.2` and `1.2.0`) compare equal, so their dates settle them.
35
+ */
16
36
  export declare function releasesOf(blob: Readonly<PkgBlob> | undefined): VersionRelease[];
17
37
  /** the version with the newest release date (falling back to `latest`, then the highest by R-version order) */
18
38
  export declare function newestVersion(blob: Readonly<PkgBlob>, latest: string): string | undefined;
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dayToMillis = dayToMillis;
4
+ exports.parseDateWindow = parseDateWindow;
5
+ exports.isDateBound = isDateBound;
6
+ exports.releaseDateBound = releaseDateBound;
7
+ exports.releasesOf = releasesOf;
8
+ exports.newestVersion = newestVersion;
9
+ exports.resolveVersion = resolveVersion;
10
+ /**
11
+ * Version/date resolution over a {@link PkgBlob}: parsing stored version strings into comparable
12
+ * {@link RVersion}s, decoding the day-granularity release dates, and picking the effective version for a query.
13
+ * Split out of `../sigdb` so the reader/writer there stays focused on the byte format.
14
+ */
15
+ const r_version_1 = require("../../util/r-version");
16
+ /** milliseconds since the Unix epoch for a stored day count (dates are stored at day granularity to save space) */
17
+ function dayToMillis(day) {
18
+ return day * 86_400_000;
19
+ }
20
+ const DatePartsRegex = /^((?:19|20)\d{2})(?:\.(\d{1,2}))?(?:\.(\d{1,2}))?$/;
21
+ /** the comparators + `YYYY.MM.DD` date a release-date bound may use (a comparator disambiguates from a calendar version) */
22
+ const DateBoundRegex = /^(<=|>=|<|>|=)\s*((?:19|20)\d{2}(?:\.\d{1,2}){0,2})$/;
23
+ /**
24
+ * Parse a `YYYY`, `YYYY.MM`, or `YYYY.MM.DD` spec into its inclusive `[lower, upper]` millisecond window (the whole
25
+ * year / month / day named), or `undefined` when malformed or out of range (month `1..12`, day `1..31`).
26
+ */
27
+ function parseDateWindow(spec) {
28
+ const m = DatePartsRegex.exec(spec.trim());
29
+ if (!m) {
30
+ return undefined;
31
+ }
32
+ const year = Number(m[1]);
33
+ const month = m[2] !== undefined ? Number(m[2]) : undefined;
34
+ const day = m[3] !== undefined ? Number(m[3]) : undefined;
35
+ // reject impossible month/day rather than letting Date.UTC silently roll over (`2021.13` -> Jan 2022)
36
+ if ((month !== undefined && (month < 1 || month > 12)) || (day !== undefined && (day < 1 || day > 31))) {
37
+ return undefined;
38
+ }
39
+ const lower = Date.UTC(year, (month ?? 1) - 1, day ?? 1);
40
+ const upper = day !== undefined ? lower + 86_400_000 - 1
41
+ : month !== undefined ? Date.UTC(year, month, 1) - 1
42
+ : Date.UTC(year + 1, 0, 1) - 1;
43
+ return { lower, upper };
44
+ }
45
+ /** whether `spec` is a release-date bound like `<=2026` or `>=2021.05` (a comparator is required) */
46
+ function isDateBound(spec) {
47
+ return DateBoundRegex.test(spec.trim());
48
+ }
49
+ /**
50
+ * A release-date predicate for a bound like `<=2026`, `>=2021.05.03` (`YYYY.MM.DD`, comparator required), or
51
+ * `undefined` when `spec` is not a date bound. An undated release (or an impossible date) never matches.
52
+ */
53
+ function releaseDateBound(spec) {
54
+ const m = DateBoundRegex.exec(spec.trim());
55
+ if (!m) {
56
+ return undefined;
57
+ }
58
+ const cmp = m[1];
59
+ const window = parseDateWindow(m[2]);
60
+ if (!window) {
61
+ return () => false; // a valid comparator but an impossible date matches nothing
62
+ }
63
+ const { lower, upper } = window;
64
+ return date => {
65
+ if (date === undefined) {
66
+ return false;
67
+ }
68
+ const t = date.getTime();
69
+ switch (cmp) {
70
+ case '<=': return t <= upper;
71
+ case '<': return t < lower;
72
+ case '>=': return t >= lower;
73
+ case '>': return t > upper;
74
+ default: return t >= lower && t <= upper;
75
+ }
76
+ };
77
+ }
78
+ /**
79
+ * The known releases of a blob, ascending by R-version order (empty when no dates were stored). Versions that
80
+ * differ in writing but not in order (`1.2` and `1.2.0`) compare equal, so their dates settle them.
81
+ */
82
+ function releasesOf(blob) {
83
+ if (!blob) {
84
+ return [];
85
+ }
86
+ return Object.entries(blob.dates)
87
+ .map(([ver, day]) => ({ version: r_version_1.RVersion.parseOrZero(ver), date: new Date(dayToMillis(day)) }))
88
+ .sort((a, b) => r_version_1.RVersion.compare(a.version.str, b.version.str) || (a.date.getTime() - b.date.getTime()));
89
+ }
90
+ /** the version with the newest release date (falling back to `latest`, then the highest by R-version order) */
91
+ function newestVersion(blob, latest) {
92
+ let best;
93
+ let bestDay = -Infinity;
94
+ for (const [ver, day] of Object.entries(blob.dates)) {
95
+ if (day > bestDay) {
96
+ bestDay = day;
97
+ best = ver;
98
+ }
99
+ }
100
+ if (best !== undefined) {
101
+ return best;
102
+ }
103
+ if (blob.versions[latest]) {
104
+ return latest;
105
+ }
106
+ // no dates and no recorded latest: pick the highest by R's numeric-version order (not string order)
107
+ return r_version_1.RVersion.highest(Object.keys(blob.versions));
108
+ }
109
+ /** pick the version tuple: requested, else the package's latest, else the highest present by R-version order */
110
+ function resolveVersion(blob, latest, version) {
111
+ if (version && blob.versions[version]) {
112
+ return version;
113
+ }
114
+ if (blob.versions[latest]) {
115
+ return latest;
116
+ }
117
+ return r_version_1.RVersion.highest(Object.keys(blob.versions));
118
+ }
119
+ //# sourceMappingURL=sigdb-version.js.map
@@ -26,11 +26,13 @@ export type AbsintQueryDomain<AbsintType extends AbsintQueryType = AbsintQueryTy
26
26
  declare function absintQueryCompleter(line: readonly string[], startingNewArg: boolean, _config: FlowrConfig): CommandCompletions;
27
27
  declare function absintQueryLineParser(output: ReplOutput, line: readonly string[], _config: FlowrConfig): ParsedQueryLine<'absint'>;
28
28
  export declare const AbsintQueryDefinition: {
29
+ readonly title: "Abstract Interpretation Query";
29
30
  readonly executor: typeof executeAbsintQuery;
30
31
  readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
31
32
  readonly jsonFormatter: (queryResults: BaseQueryResult) => object;
32
33
  readonly completer: typeof absintQueryCompleter;
33
34
  readonly fromLine: typeof absintQueryLineParser;
35
+ readonly syntax: "@absint <inference-type> [(<criteria>)] <code | file://path>";
34
36
  readonly schema: Joi.ObjectSchema<any>;
35
37
  readonly flattenInvolvedNodes: () => never[];
36
38
  };
@@ -61,6 +61,7 @@ function absintQueryLineParser(output, line, _config) {
61
61
  };
62
62
  }
63
63
  exports.AbsintQueryDefinition = {
64
+ title: 'Abstract Interpretation Query',
64
65
  executor: absint_query_executor_1.executeAbsintQuery,
65
66
  asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
66
67
  const out = queryResults;
@@ -92,6 +93,7 @@ exports.AbsintQueryDefinition = {
92
93
  },
93
94
  completer: absintQueryCompleter,
94
95
  fromLine: absintQueryLineParser,
96
+ syntax: '@absint <inference-type> [(<criteria>)] <code | file://path>',
95
97
  schema: joi_1.default.object({
96
98
  type: joi_1.default.string().valid('absint').required().description('The type of the query.'),
97
99
  inference: joi_1.default.string().valid(...record_1.Record.keys(exports.AbsintQueryInferences)).required().description('The type of abstract interpretation inference.'),