@cucumber/react-components 24.1.2 → 24.3.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 (425) hide show
  1. package/LICENSE +1 -1
  2. package/dist/src/CucumberQueryContext.d.ts +1 -2
  3. package/dist/src/CucumberQueryContext.d.ts.map +1 -1
  4. package/dist/src/CucumberQueryContext.js +2 -2
  5. package/dist/src/CucumberQueryContext.js.map +1 -1
  6. package/dist/src/GherkinQueryContext.d.ts +1 -2
  7. package/dist/src/GherkinQueryContext.d.ts.map +1 -1
  8. package/dist/src/GherkinQueryContext.js +2 -2
  9. package/dist/src/GherkinQueryContext.js.map +1 -1
  10. package/dist/src/SearchContext.d.ts +11 -5
  11. package/dist/src/SearchContext.d.ts.map +1 -1
  12. package/dist/src/SearchContext.js +4 -2
  13. package/dist/src/SearchContext.js.map +1 -1
  14. package/dist/src/ciCommitLink.d.ts +1 -1
  15. package/dist/src/ciCommitLink.d.ts.map +1 -1
  16. package/dist/src/ciCommitLink.js +1 -1
  17. package/dist/src/ciCommitLink.js.map +1 -1
  18. package/dist/src/components/app/CICommitLink.d.ts +2 -2
  19. package/dist/src/components/app/CICommitLink.d.ts.map +1 -1
  20. package/dist/src/components/app/CICommitLink.js +3 -8
  21. package/dist/src/components/app/CICommitLink.js.map +1 -1
  22. package/dist/src/components/app/CIJobLink.d.ts +2 -2
  23. package/dist/src/components/app/CIJobLink.d.ts.map +1 -1
  24. package/dist/src/components/app/CIJobLink.js +3 -7
  25. package/dist/src/components/app/CIJobLink.js.map +1 -1
  26. package/dist/src/components/app/ControlledSearchProvider.d.ts +2 -2
  27. package/dist/src/components/app/ControlledSearchProvider.d.ts.map +1 -1
  28. package/dist/src/components/app/ControlledSearchProvider.js +24 -2
  29. package/dist/src/components/app/ControlledSearchProvider.js.map +1 -1
  30. package/dist/src/components/app/CopyButton.d.ts +2 -1
  31. package/dist/src/components/app/CopyButton.d.ts.map +1 -1
  32. package/dist/src/components/app/CopyButton.js +4 -4
  33. package/dist/src/components/app/CopyButton.js.map +1 -1
  34. package/dist/src/components/app/DocumentAccordion.d.ts +3 -3
  35. package/dist/src/components/app/DocumentAccordion.d.ts.map +1 -1
  36. package/dist/src/components/app/DocumentAccordion.js +12 -20
  37. package/dist/src/components/app/DocumentAccordion.js.map +1 -1
  38. package/dist/src/components/app/DocumentAccordion.module.scss +15 -7
  39. package/dist/src/components/app/EnvelopesProvider.d.ts +2 -2
  40. package/dist/src/components/app/EnvelopesProvider.d.ts.map +1 -1
  41. package/dist/src/components/app/EnvelopesProvider.js +3 -2
  42. package/dist/src/components/app/EnvelopesProvider.js.map +1 -1
  43. package/dist/src/components/app/ExecutionSummary.d.ts +1 -1
  44. package/dist/src/components/app/ExecutionSummary.d.ts.map +1 -1
  45. package/dist/src/components/app/ExecutionSummary.js +3 -49
  46. package/dist/src/components/app/ExecutionSummary.js.map +1 -1
  47. package/dist/src/components/app/FilteredDocuments.d.ts +1 -1
  48. package/dist/src/components/app/FilteredDocuments.d.ts.map +1 -1
  49. package/dist/src/components/app/FilteredDocuments.js +4 -4
  50. package/dist/src/components/app/FilteredDocuments.js.map +1 -1
  51. package/dist/src/components/app/GherkinDocumentList.d.ts +3 -3
  52. package/dist/src/components/app/GherkinDocumentList.d.ts.map +1 -1
  53. package/dist/src/components/app/GherkinDocumentList.js +8 -9
  54. package/dist/src/components/app/GherkinDocumentList.js.map +1 -1
  55. package/dist/src/components/app/Header.d.ts +1 -1
  56. package/dist/src/components/app/Header.d.ts.map +1 -1
  57. package/dist/src/components/app/Header.js +4 -4
  58. package/dist/src/components/app/Header.js.map +1 -1
  59. package/dist/src/components/app/HealthChart.d.ts +1 -1
  60. package/dist/src/components/app/HealthChart.d.ts.map +1 -1
  61. package/dist/src/components/app/HealthChart.js +6 -7
  62. package/dist/src/components/app/HealthChart.js.map +1 -1
  63. package/dist/src/components/app/HighLight.d.ts +2 -2
  64. package/dist/src/components/app/HighLight.d.ts.map +1 -1
  65. package/dist/src/components/app/HighLight.js +15 -9
  66. package/dist/src/components/app/HighLight.js.map +1 -1
  67. package/dist/src/components/app/ImplementationIcon.d.ts +2 -2
  68. package/dist/src/components/app/ImplementationIcon.d.ts.map +1 -1
  69. package/dist/src/components/app/ImplementationIcon.js +2 -2
  70. package/dist/src/components/app/ImplementationIcon.js.map +1 -1
  71. package/dist/src/components/app/InMemorySearchProvider.d.ts +2 -2
  72. package/dist/src/components/app/InMemorySearchProvider.d.ts.map +1 -1
  73. package/dist/src/components/app/InMemorySearchProvider.js +3 -2
  74. package/dist/src/components/app/InMemorySearchProvider.js.map +1 -1
  75. package/dist/src/components/app/NavigationButton.d.ts +1 -1
  76. package/dist/src/components/app/NavigationButton.d.ts.map +1 -1
  77. package/dist/src/components/app/NavigationButton.js +2 -2
  78. package/dist/src/components/app/NavigationButton.js.map +1 -1
  79. package/dist/src/components/app/OSIcon.d.ts +2 -2
  80. package/dist/src/components/app/OSIcon.d.ts.map +1 -1
  81. package/dist/src/components/app/OSIcon.js +4 -4
  82. package/dist/src/components/app/OSIcon.js.map +1 -1
  83. package/dist/src/components/app/QueriesProvider.d.ts +3 -3
  84. package/dist/src/components/app/QueriesProvider.d.ts.map +1 -1
  85. package/dist/src/components/app/QueriesProvider.js +4 -3
  86. package/dist/src/components/app/QueriesProvider.js.map +1 -1
  87. package/dist/src/components/app/Report.d.ts +1 -1
  88. package/dist/src/components/app/Report.d.ts.map +1 -1
  89. package/dist/src/components/app/Report.js +2 -11
  90. package/dist/src/components/app/Report.js.map +1 -1
  91. package/dist/src/components/app/RuntimeIcon.d.ts +2 -2
  92. package/dist/src/components/app/RuntimeIcon.d.ts.map +1 -1
  93. package/dist/src/components/app/RuntimeIcon.js +4 -4
  94. package/dist/src/components/app/RuntimeIcon.js.map +1 -1
  95. package/dist/src/components/app/SearchBar.d.ts +1 -1
  96. package/dist/src/components/app/SearchBar.d.ts.map +1 -1
  97. package/dist/src/components/app/SearchBar.js +9 -24
  98. package/dist/src/components/app/SearchBar.js.map +1 -1
  99. package/dist/src/components/app/StatusesSummary.d.ts +1 -1
  100. package/dist/src/components/app/StatusesSummary.d.ts.map +1 -1
  101. package/dist/src/components/app/StatusesSummary.js +8 -11
  102. package/dist/src/components/app/StatusesSummary.js.map +1 -1
  103. package/dist/src/components/app/TestRunHooks.d.ts +1 -1
  104. package/dist/src/components/app/TestRunHooks.d.ts.map +1 -1
  105. package/dist/src/components/app/TestRunHooks.js +5 -5
  106. package/dist/src/components/app/TestRunHooks.js.map +1 -1
  107. package/dist/src/components/app/UrlSearchProvider.d.ts +1 -1
  108. package/dist/src/components/app/UrlSearchProvider.d.ts.map +1 -1
  109. package/dist/src/components/app/UrlSearchProvider.js +6 -3
  110. package/dist/src/components/app/UrlSearchProvider.js.map +1 -1
  111. package/dist/src/components/app/icons/CucumberLogo.d.ts +1 -1
  112. package/dist/src/components/app/icons/CucumberLogo.d.ts.map +1 -1
  113. package/dist/src/components/app/icons/CucumberLogo.js +2 -6
  114. package/dist/src/components/app/icons/CucumberLogo.js.map +1 -1
  115. package/dist/src/components/app/icons/Jvm.d.ts +1 -1
  116. package/dist/src/components/app/icons/Jvm.d.ts.map +1 -1
  117. package/dist/src/components/app/icons/Jvm.js +2 -7
  118. package/dist/src/components/app/icons/Jvm.js.map +1 -1
  119. package/dist/src/components/app/icons/Linux.d.ts +1 -1
  120. package/dist/src/components/app/icons/Linux.d.ts.map +1 -1
  121. package/dist/src/components/app/icons/Linux.js +2 -17
  122. package/dist/src/components/app/icons/Linux.js.map +1 -1
  123. package/dist/src/components/app/icons/MacOS.d.ts +1 -1
  124. package/dist/src/components/app/icons/MacOS.d.ts.map +1 -1
  125. package/dist/src/components/app/icons/MacOS.js +2 -3
  126. package/dist/src/components/app/icons/MacOS.js.map +1 -1
  127. package/dist/src/components/app/icons/NodeJs.d.ts +1 -1
  128. package/dist/src/components/app/icons/NodeJs.d.ts.map +1 -1
  129. package/dist/src/components/app/icons/NodeJs.js +2 -5
  130. package/dist/src/components/app/icons/NodeJs.js.map +1 -1
  131. package/dist/src/components/app/icons/Ruby.d.ts +1 -1
  132. package/dist/src/components/app/icons/Ruby.d.ts.map +1 -1
  133. package/dist/src/components/app/icons/Ruby.js +2 -3
  134. package/dist/src/components/app/icons/Ruby.js.map +1 -1
  135. package/dist/src/components/app/icons/Windows.d.ts +1 -1
  136. package/dist/src/components/app/icons/Windows.d.ts.map +1 -1
  137. package/dist/src/components/app/icons/Windows.js +2 -3
  138. package/dist/src/components/app/icons/Windows.js.map +1 -1
  139. package/dist/src/components/app/makeSetupString.d.ts +1 -1
  140. package/dist/src/components/app/makeSetupString.d.ts.map +1 -1
  141. package/dist/src/components/app/makeSetupString.js.map +1 -1
  142. package/dist/src/components/app/markdownComponents.d.ts +9 -0
  143. package/dist/src/components/app/markdownComponents.d.ts.map +1 -0
  144. package/dist/src/components/app/markdownComponents.js +6 -0
  145. package/dist/src/components/app/markdownComponents.js.map +1 -0
  146. package/dist/src/components/app/rehypePlugins.d.ts +2 -2
  147. package/dist/src/components/app/rehypePlugins.d.ts.map +1 -1
  148. package/dist/src/components/app/rehypePlugins.js.map +1 -1
  149. package/dist/src/components/app/remarkPlugins.d.ts +2 -2
  150. package/dist/src/components/app/remarkPlugins.d.ts.map +1 -1
  151. package/dist/src/components/app/remarkPlugins.js.map +1 -1
  152. package/dist/src/components/customise/CustomRendering.d.ts +18 -18
  153. package/dist/src/components/customise/CustomRendering.d.ts.map +1 -1
  154. package/dist/src/components/customise/CustomRendering.js +10 -9
  155. package/dist/src/components/customise/CustomRendering.js.map +1 -1
  156. package/dist/src/components/customise/CustomRendering.stories.scss +0 -17
  157. package/dist/src/components/gherkin/Anchor.d.ts +3 -3
  158. package/dist/src/components/gherkin/Anchor.d.ts.map +1 -1
  159. package/dist/src/components/gherkin/Anchor.js +3 -6
  160. package/dist/src/components/gherkin/Anchor.js.map +1 -1
  161. package/dist/src/components/gherkin/Background.d.ts +3 -3
  162. package/dist/src/components/gherkin/Background.d.ts.map +1 -1
  163. package/dist/src/components/gherkin/Background.js +4 -10
  164. package/dist/src/components/gherkin/Background.js.map +1 -1
  165. package/dist/src/components/gherkin/Children.d.ts +3 -3
  166. package/dist/src/components/gherkin/Children.d.ts.map +1 -1
  167. package/dist/src/components/gherkin/Children.js +3 -3
  168. package/dist/src/components/gherkin/Children.js.map +1 -1
  169. package/dist/src/components/gherkin/DataTable.d.ts +3 -3
  170. package/dist/src/components/gherkin/DataTable.d.ts.map +1 -1
  171. package/dist/src/components/gherkin/DataTable.js +4 -6
  172. package/dist/src/components/gherkin/DataTable.js.map +1 -1
  173. package/dist/src/components/gherkin/Description.d.ts +3 -3
  174. package/dist/src/components/gherkin/Description.d.ts.map +1 -1
  175. package/dist/src/components/gherkin/Description.js +3 -4
  176. package/dist/src/components/gherkin/Description.js.map +1 -1
  177. package/dist/src/components/gherkin/DocString.d.ts +3 -3
  178. package/dist/src/components/gherkin/DocString.d.ts.map +1 -1
  179. package/dist/src/components/gherkin/DocString.js +3 -4
  180. package/dist/src/components/gherkin/DocString.js.map +1 -1
  181. package/dist/src/components/gherkin/ErrorMessage.d.ts +2 -2
  182. package/dist/src/components/gherkin/ErrorMessage.d.ts.map +1 -1
  183. package/dist/src/components/gherkin/ErrorMessage.js +5 -3
  184. package/dist/src/components/gherkin/ErrorMessage.js.map +1 -1
  185. package/dist/src/components/gherkin/ErrorMessage.module.scss +17 -5
  186. package/dist/src/components/gherkin/Examples.d.ts +3 -3
  187. package/dist/src/components/gherkin/Examples.d.ts.map +1 -1
  188. package/dist/src/components/gherkin/Examples.js +7 -18
  189. package/dist/src/components/gherkin/Examples.js.map +1 -1
  190. package/dist/src/components/gherkin/Feature.d.ts +3 -3
  191. package/dist/src/components/gherkin/Feature.d.ts.map +1 -1
  192. package/dist/src/components/gherkin/Feature.js +14 -24
  193. package/dist/src/components/gherkin/Feature.js.map +1 -1
  194. package/dist/src/components/gherkin/GherkinDocument.d.ts +3 -3
  195. package/dist/src/components/gherkin/GherkinDocument.d.ts.map +1 -1
  196. package/dist/src/components/gherkin/GherkinDocument.js +3 -3
  197. package/dist/src/components/gherkin/GherkinDocument.js.map +1 -1
  198. package/dist/src/components/gherkin/Keyword.d.ts +2 -2
  199. package/dist/src/components/gherkin/Keyword.d.ts.map +1 -1
  200. package/dist/src/components/gherkin/Keyword.js +3 -3
  201. package/dist/src/components/gherkin/Keyword.js.map +1 -1
  202. package/dist/src/components/gherkin/Keyword.module.scss +0 -1
  203. package/dist/src/components/gherkin/Parameter.d.ts +3 -3
  204. package/dist/src/components/gherkin/Parameter.d.ts.map +1 -1
  205. package/dist/src/components/gherkin/Parameter.js +4 -4
  206. package/dist/src/components/gherkin/Parameter.js.map +1 -1
  207. package/dist/src/components/gherkin/Rule.d.ts +3 -3
  208. package/dist/src/components/gherkin/Rule.d.ts.map +1 -1
  209. package/dist/src/components/gherkin/Rule.js +11 -21
  210. package/dist/src/components/gherkin/Rule.js.map +1 -1
  211. package/dist/src/components/gherkin/Scenario.d.ts +3 -3
  212. package/dist/src/components/gherkin/Scenario.d.ts.map +1 -1
  213. package/dist/src/components/gherkin/Scenario.js +5 -14
  214. package/dist/src/components/gherkin/Scenario.js.map +1 -1
  215. package/dist/src/components/gherkin/StatusIcon.d.ts +2 -2
  216. package/dist/src/components/gherkin/StatusIcon.d.ts.map +1 -1
  217. package/dist/src/components/gherkin/StatusIcon.js +10 -10
  218. package/dist/src/components/gherkin/StatusIcon.js.map +1 -1
  219. package/dist/src/components/gherkin/StepsList.d.ts +1 -1
  220. package/dist/src/components/gherkin/StepsList.d.ts.map +1 -1
  221. package/dist/src/components/gherkin/StepsList.js +2 -2
  222. package/dist/src/components/gherkin/StepsList.js.map +1 -1
  223. package/dist/src/components/gherkin/Tags.d.ts +3 -3
  224. package/dist/src/components/gherkin/Tags.d.ts.map +1 -1
  225. package/dist/src/components/gherkin/Tags.js +4 -5
  226. package/dist/src/components/gherkin/Tags.js.map +1 -1
  227. package/dist/src/components/gherkin/Title.d.ts +3 -3
  228. package/dist/src/components/gherkin/Title.d.ts.map +1 -1
  229. package/dist/src/components/gherkin/Title.js +3 -4
  230. package/dist/src/components/gherkin/Title.js.map +1 -1
  231. package/dist/src/components/gherkin/attachment/Attachment.d.ts +3 -3
  232. package/dist/src/components/gherkin/attachment/Attachment.d.ts.map +1 -1
  233. package/dist/src/components/gherkin/attachment/Attachment.js +14 -17
  234. package/dist/src/components/gherkin/attachment/Attachment.js.map +1 -1
  235. package/dist/src/components/gherkin/attachment/Attachment.module.scss +15 -5
  236. package/dist/src/components/gherkin/attachment/Image.d.ts +4 -4
  237. package/dist/src/components/gherkin/attachment/Image.d.ts.map +1 -1
  238. package/dist/src/components/gherkin/attachment/Image.js +6 -8
  239. package/dist/src/components/gherkin/attachment/Image.js.map +1 -1
  240. package/dist/src/components/gherkin/attachment/Links.d.ts +3 -3
  241. package/dist/src/components/gherkin/attachment/Links.d.ts.map +1 -1
  242. package/dist/src/components/gherkin/attachment/Links.js +7 -10
  243. package/dist/src/components/gherkin/attachment/Links.js.map +1 -1
  244. package/dist/src/components/gherkin/attachment/Log.d.ts +3 -3
  245. package/dist/src/components/gherkin/attachment/Log.d.ts.map +1 -1
  246. package/dist/src/components/gherkin/attachment/Log.js +3 -3
  247. package/dist/src/components/gherkin/attachment/Log.js.map +1 -1
  248. package/dist/src/components/gherkin/attachment/Text.d.ts +3 -3
  249. package/dist/src/components/gherkin/attachment/Text.d.ts.map +1 -1
  250. package/dist/src/components/gherkin/attachment/Text.js +4 -6
  251. package/dist/src/components/gherkin/attachment/Text.js.map +1 -1
  252. package/dist/src/components/gherkin/attachment/Unknown.d.ts +2 -2
  253. package/dist/src/components/gherkin/attachment/Unknown.d.ts.map +1 -1
  254. package/dist/src/components/gherkin/attachment/Unknown.js +9 -17
  255. package/dist/src/components/gherkin/attachment/Unknown.js.map +1 -1
  256. package/dist/src/components/gherkin/attachment/Video.d.ts +3 -3
  257. package/dist/src/components/gherkin/attachment/Video.d.ts.map +1 -1
  258. package/dist/src/components/gherkin/attachment/Video.js +6 -10
  259. package/dist/src/components/gherkin/attachment/Video.js.map +1 -1
  260. package/dist/src/components/gherkin/attachment/attachmentFilename.d.ts +1 -1
  261. package/dist/src/components/gherkin/attachment/attachmentFilename.d.ts.map +1 -1
  262. package/dist/src/components/gherkin/attachment/attachmentFilename.js.map +1 -1
  263. package/dist/src/components/gherkin/attachment/base64Decode.d.ts +9 -1
  264. package/dist/src/components/gherkin/attachment/base64Decode.d.ts.map +1 -1
  265. package/dist/src/components/gherkin/attachment/base64Decode.js +17 -3
  266. package/dist/src/components/gherkin/attachment/base64Decode.js.map +1 -1
  267. package/dist/src/components/gherkin/attachment/useText.d.ts +1 -1
  268. package/dist/src/components/gherkin/attachment/useText.d.ts.map +1 -1
  269. package/dist/src/components/gherkin/attachment/useText.js +3 -3
  270. package/dist/src/components/gherkin/attachment/useText.js.map +1 -1
  271. package/dist/src/components/gherkin/composeHookStepTitle.d.ts +1 -1
  272. package/dist/src/components/gherkin/composeHookStepTitle.d.ts.map +1 -1
  273. package/dist/src/components/gherkin/composeHookStepTitle.js +1 -1
  274. package/dist/src/components/gherkin/composeHookStepTitle.js.map +1 -1
  275. package/dist/src/components/gherkin/composePickleStepTitle.d.ts +1 -1
  276. package/dist/src/components/gherkin/composePickleStepTitle.d.ts.map +1 -1
  277. package/dist/src/components/gherkin/composePickleStepTitle.js +2 -2
  278. package/dist/src/components/gherkin/composePickleStepTitle.js.map +1 -1
  279. package/dist/src/components/gherkin/statusName.d.ts +2 -2
  280. package/dist/src/components/gherkin/statusName.d.ts.map +1 -1
  281. package/dist/src/components/gherkin/statusName.js.map +1 -1
  282. package/dist/src/components/results/AmbiguousResult.d.ts +8 -0
  283. package/dist/src/components/results/AmbiguousResult.d.ts.map +1 -0
  284. package/dist/src/components/results/AmbiguousResult.js +11 -0
  285. package/dist/src/components/results/AmbiguousResult.js.map +1 -0
  286. package/dist/src/components/results/AmbiguousResult.module.scss +22 -0
  287. package/dist/src/components/results/FailedResult.d.ts +8 -0
  288. package/dist/src/components/results/FailedResult.d.ts.map +1 -0
  289. package/dist/src/components/results/FailedResult.js +15 -0
  290. package/dist/src/components/results/FailedResult.js.map +1 -0
  291. package/dist/src/components/results/PendingResult.d.ts +8 -0
  292. package/dist/src/components/results/PendingResult.d.ts.map +1 -0
  293. package/dist/src/components/results/PendingResult.js +12 -0
  294. package/dist/src/components/results/PendingResult.js.map +1 -0
  295. package/dist/src/components/results/ResultNote.d.ts +3 -0
  296. package/dist/src/components/results/ResultNote.d.ts.map +1 -0
  297. package/dist/src/components/results/ResultNote.js +6 -0
  298. package/dist/src/components/results/ResultNote.js.map +1 -0
  299. package/dist/src/components/results/ResultNote.module.scss +6 -0
  300. package/dist/src/components/results/SkippedResult.d.ts +8 -0
  301. package/dist/src/components/results/SkippedResult.d.ts.map +1 -0
  302. package/dist/src/components/results/SkippedResult.js +12 -0
  303. package/dist/src/components/results/SkippedResult.js.map +1 -0
  304. package/dist/src/components/results/SourceReference.d.ts +8 -0
  305. package/dist/src/components/results/SourceReference.d.ts.map +1 -0
  306. package/dist/src/components/results/SourceReference.js +13 -0
  307. package/dist/src/components/results/SourceReference.js.map +1 -0
  308. package/dist/src/components/results/SourceReference.module.scss +10 -0
  309. package/dist/src/components/results/TestCaseOutcome.d.ts +2 -2
  310. package/dist/src/components/results/TestCaseOutcome.d.ts.map +1 -1
  311. package/dist/src/components/results/TestCaseOutcome.js +5 -9
  312. package/dist/src/components/results/TestCaseOutcome.js.map +1 -1
  313. package/dist/src/components/results/TestRunHookOutcome.d.ts +2 -2
  314. package/dist/src/components/results/TestRunHookOutcome.d.ts.map +1 -1
  315. package/dist/src/components/results/TestRunHookOutcome.js +4 -13
  316. package/dist/src/components/results/TestRunHookOutcome.js.map +1 -1
  317. package/dist/src/components/results/TestStepAttachments.d.ts +2 -2
  318. package/dist/src/components/results/TestStepAttachments.d.ts.map +1 -1
  319. package/dist/src/components/results/TestStepAttachments.js +4 -5
  320. package/dist/src/components/results/TestStepAttachments.js.map +1 -1
  321. package/dist/src/components/results/TestStepDuration.d.ts +2 -2
  322. package/dist/src/components/results/TestStepDuration.d.ts.map +1 -1
  323. package/dist/src/components/results/TestStepDuration.js +4 -2
  324. package/dist/src/components/results/TestStepDuration.js.map +1 -1
  325. package/dist/src/components/results/TestStepOutcome.d.ts +2 -2
  326. package/dist/src/components/results/TestStepOutcome.d.ts.map +1 -1
  327. package/dist/src/components/results/TestStepOutcome.js +18 -27
  328. package/dist/src/components/results/TestStepOutcome.js.map +1 -1
  329. package/dist/src/components/results/TestStepOutcome.module.scss +1 -1
  330. package/dist/src/components/results/UndefinedResult.d.ts +8 -0
  331. package/dist/src/components/results/UndefinedResult.d.ts.map +1 -0
  332. package/dist/src/components/results/UndefinedResult.js +18 -0
  333. package/dist/src/components/results/UndefinedResult.js.map +1 -0
  334. package/dist/src/components/results/UndefinedResult.module.scss +14 -0
  335. package/dist/src/components/results/index.d.ts +1 -1
  336. package/dist/src/components/results/index.d.ts.map +1 -1
  337. package/dist/src/components/results/index.js +1 -1
  338. package/dist/src/components/results/index.js.map +1 -1
  339. package/dist/src/formatExecutionDuration.js.map +1 -1
  340. package/dist/src/hooks/helpers.js.map +1 -1
  341. package/dist/src/hooks/useFilteredDocuments.d.ts +2 -2
  342. package/dist/src/hooks/useFilteredDocuments.d.ts.map +1 -1
  343. package/dist/src/hooks/useFilteredDocuments.js +70 -18
  344. package/dist/src/hooks/useFilteredDocuments.js.map +1 -1
  345. package/dist/src/hooks/useMostSevereStatusByUri.js.map +1 -1
  346. package/dist/src/hooks/useQueries.d.ts +2 -2
  347. package/dist/src/hooks/useQueries.d.ts.map +1 -1
  348. package/dist/src/hooks/useQueries.js.map +1 -1
  349. package/dist/src/hooks/useResultStatistics.d.ts +3 -2
  350. package/dist/src/hooks/useResultStatistics.d.ts.map +1 -1
  351. package/dist/src/hooks/useResultStatistics.js +19 -2
  352. package/dist/src/hooks/useResultStatistics.js.map +1 -1
  353. package/dist/src/hooks/useSearch.d.ts +1 -1
  354. package/dist/src/hooks/useSearch.d.ts.map +1 -1
  355. package/dist/src/hooks/useSearch.js.map +1 -1
  356. package/dist/src/hooks/useTestCaseStarted.d.ts +6 -1
  357. package/dist/src/hooks/useTestCaseStarted.d.ts.map +1 -1
  358. package/dist/src/hooks/useTestCaseStarted.js +13 -10
  359. package/dist/src/hooks/useTestCaseStarted.js.map +1 -1
  360. package/dist/src/hooks/useTestRunHooks.d.ts +1 -1
  361. package/dist/src/hooks/useTestRunHooks.d.ts.map +1 -1
  362. package/dist/src/hooks/useTestRunHooks.js.map +1 -1
  363. package/dist/src/search/FeatureSearch.d.ts +12 -3
  364. package/dist/src/search/FeatureSearch.d.ts.map +1 -1
  365. package/dist/src/search/FeatureSearch.js +9 -17
  366. package/dist/src/search/FeatureSearch.js.map +1 -1
  367. package/dist/src/search/ScenarioLikeSearch.d.ts +8 -13
  368. package/dist/src/search/ScenarioLikeSearch.d.ts.map +1 -1
  369. package/dist/src/search/ScenarioLikeSearch.js +13 -17
  370. package/dist/src/search/ScenarioLikeSearch.js.map +1 -1
  371. package/dist/src/search/StepSearch.d.ts +9 -16
  372. package/dist/src/search/StepSearch.d.ts.map +1 -1
  373. package/dist/src/search/StepSearch.js +13 -17
  374. package/dist/src/search/StepSearch.js.map +1 -1
  375. package/dist/src/search/TextSearch.d.ts +11 -2
  376. package/dist/src/search/TextSearch.d.ts.map +1 -1
  377. package/dist/src/search/TextSearch.js +59 -52
  378. package/dist/src/search/TextSearch.js.map +1 -1
  379. package/dist/src/search/createSearchIndex.d.ts +7 -0
  380. package/dist/src/search/createSearchIndex.d.ts.map +1 -0
  381. package/dist/src/search/createSearchIndex.js +10 -0
  382. package/dist/src/search/createSearchIndex.js.map +1 -0
  383. package/dist/src/search/deriveLineageConstraints.d.ts +8 -0
  384. package/dist/src/search/deriveLineageConstraints.d.ts.map +1 -0
  385. package/dist/src/search/deriveLineageConstraints.js +38 -0
  386. package/dist/src/search/deriveLineageConstraints.js.map +1 -0
  387. package/dist/src/search/index.d.ts +3 -1
  388. package/dist/src/search/index.d.ts.map +1 -1
  389. package/dist/src/search/index.js +3 -1
  390. package/dist/src/search/index.js.map +1 -1
  391. package/dist/src/search/pruneGherkinDocuments.d.ts +24 -0
  392. package/dist/src/search/pruneGherkinDocuments.d.ts.map +1 -0
  393. package/dist/src/search/pruneGherkinDocuments.js +180 -0
  394. package/dist/src/search/pruneGherkinDocuments.js.map +1 -0
  395. package/dist/src/search/types.d.ts +39 -8
  396. package/dist/src/search/types.d.ts.map +1 -1
  397. package/dist/src/search/types.js +1 -1
  398. package/dist/src/search/types.js.map +1 -1
  399. package/dist/src/styles/statuses.scss +7 -13
  400. package/dist/src/toRepositoryId.d.ts +1 -1
  401. package/dist/src/toRepositoryId.d.ts.map +1 -1
  402. package/dist/src/toRepositoryId.js +7 -6
  403. package/dist/src/toRepositoryId.js.map +1 -1
  404. package/dist/tsconfig.build.tsbuildinfo +1 -1
  405. package/package.json +56 -71
  406. package/dist/src/components/results/TestStepResultDetails.d.ts +0 -4
  407. package/dist/src/components/results/TestStepResultDetails.d.ts.map +0 -1
  408. package/dist/src/components/results/TestStepResultDetails.js +0 -16
  409. package/dist/src/components/results/TestStepResultDetails.js.map +0 -1
  410. package/dist/src/countScenariosByStatuses.d.ts +0 -8
  411. package/dist/src/countScenariosByStatuses.d.ts.map +0 -1
  412. package/dist/src/countScenariosByStatuses.js +0 -22
  413. package/dist/src/countScenariosByStatuses.js.map +0 -1
  414. package/dist/src/filter/filterByStatus.d.ts +0 -5
  415. package/dist/src/filter/filterByStatus.d.ts.map +0 -1
  416. package/dist/src/filter/filterByStatus.js +0 -23
  417. package/dist/src/filter/filterByStatus.js.map +0 -1
  418. package/dist/src/search/Search.d.ts +0 -11
  419. package/dist/src/search/Search.d.ts.map +0 -1
  420. package/dist/src/search/Search.js +0 -46
  421. package/dist/src/search/Search.js.map +0 -1
  422. package/dist/src/search/TagSearch.d.ts +0 -4
  423. package/dist/src/search/TagSearch.d.ts.map +0 -1
  424. package/dist/src/search/TagSearch.js +0 -57
  425. package/dist/src/search/TagSearch.js.map +0 -1
@@ -1,4 +1,13 @@
1
- import { Feature, GherkinDocument } from '@cucumber/messages';
2
- import { TypedIndex } from './types.js';
3
- export declare function createFeatureSearch(): Promise<TypedIndex<Feature, GherkinDocument>>;
1
+ import type { GherkinDocument } from '@cucumber/messages';
2
+ import type { IndexHit, TypedIndex } from './types.js';
3
+ /**
4
+ * A little different to the other indexes - a Feature doesn't have its own id,
5
+ * so we use the uri of the GherkinDocument as a pointer
6
+ */
7
+ export declare class FeatureSearch implements TypedIndex<GherkinDocument> {
8
+ private readonly index;
9
+ constructor();
10
+ search(term: string): Promise<ReadonlyArray<IndexHit>>;
11
+ add(gherkinDocument: GherkinDocument, _uri: string): Promise<this>;
12
+ }
4
13
  //# sourceMappingURL=FeatureSearch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureSearch.d.ts","sourceRoot":"","sources":["../../../src/search/FeatureSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAG7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAuCvC,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,CAQzF"}
1
+ {"version":3,"file":"FeatureSearch.d.ts","sourceRoot":"","sources":["../../../src/search/FeatureSearch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGzD,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAOtD;;;GAGG;AACH,qBAAa,aAAc,YAAW,UAAU,CAAC,eAAe,CAAC;IAC/D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;;IAStC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAOtD,GAAG,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAUzE"}
@@ -4,27 +4,28 @@ const schema = {
4
4
  description: 'string',
5
5
  };
6
6
  /**
7
- * A little different than the other indexes - a Feature doesn't have its own id,
7
+ * A little different to the other indexes - a Feature doesn't have its own id,
8
8
  * so we use the uri of the GherkinDocument as a pointer
9
9
  */
10
- class FeatureSearch {
11
- featuresByUri = new Map();
10
+ export class FeatureSearch {
12
11
  index;
13
- constructor(index) {
14
- this.index = index;
12
+ constructor() {
13
+ this.index = create({
14
+ schema,
15
+ sort: { enabled: false },
16
+ });
15
17
  }
16
18
  async search(term) {
17
19
  const { hits } = await search(this.index, {
18
20
  term,
19
21
  });
20
- return hits.map((hit) => this.featuresByUri.get(hit.id));
22
+ return hits.map((hit) => ({ uri: hit.id, id: hit.id }));
21
23
  }
22
- async add(gherkinDocument) {
24
+ async add(gherkinDocument, _uri) {
23
25
  if (!gherkinDocument.feature)
24
26
  return this;
25
27
  if (!gherkinDocument.uri)
26
28
  throw new Error('Missing uri on gherkinDocument');
27
- this.featuresByUri.set(gherkinDocument.uri, gherkinDocument.feature);
28
29
  await insert(this.index, {
29
30
  id: gherkinDocument.uri,
30
31
  name: gherkinDocument.feature.name,
@@ -33,13 +34,4 @@ class FeatureSearch {
33
34
  return this;
34
35
  }
35
36
  }
36
- export async function createFeatureSearch() {
37
- const index = await create({
38
- schema,
39
- sort: {
40
- enabled: false,
41
- },
42
- });
43
- return new FeatureSearch(index);
44
- }
45
37
  //# sourceMappingURL=FeatureSearch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureSearch.js","sourceRoot":"","sources":["../../../src/search/FeatureSearch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAS,MAAM,EAAE,MAAM,cAAc,CAAA;AAI5D,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,QAA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} from '@cucumber/messages'\nimport { create, insert, Orama, search } from '@orama/orama'\n\nimport { TypedIndex } from './types.js'\n\nconst schema = {\n name: 'string',\n description: 'string',\n} as const\n\n/**\n * A little different than the other indexes - a Feature doesn't have its own id,\n * so we use the uri of the GherkinDocument as a pointer\n */\nclass FeatureSearch implements TypedIndex<Feature, GherkinDocument> {\n private readonly featuresByUri = new Map<string, Feature>()\n private readonly index: Orama<typeof schema>\n\n constructor(index: Orama<typeof schema>) {\n this.index = index\n }\n\n async search(term: string): Promise<Array<Feature>> {\n const { hits } = await search(this.index, {\n term,\n })\n return hits.map((hit) => this.featuresByUri.get(hit.id)) as Feature[]\n }\n\n async add(gherkinDocument: GherkinDocument): Promise<this> {\n if (!gherkinDocument.feature) return this\n if (!gherkinDocument.uri) throw new Error('Missing uri on gherkinDocument')\n this.featuresByUri.set(gherkinDocument.uri, gherkinDocument.feature)\n await insert(this.index, {\n id: gherkinDocument.uri,\n name: gherkinDocument.feature.name,\n description: gherkinDocument.feature.description,\n })\n return this\n }\n}\n\nexport async function createFeatureSearch(): Promise<TypedIndex<Feature, GherkinDocument>> {\n const index: Orama<typeof schema> = await create({\n schema,\n sort: {\n enabled: false,\n },\n })\n return new FeatureSearch(index)\n}\n"]}
1
+ {"version":3,"file":"FeatureSearch.js","sourceRoot":"","sources":["../../../src/search/FeatureSearch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAc,MAAM,EAAE,MAAM,cAAc,CAAA;AAIjE,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,QAAQ;CACb,CAAA;AAEV;;;GAGG;AACH,MAAM,OAAO,aAAa;IACP,KAAK,CAAsB;IAE5C;QACE,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;YAClB,MAAM;YACN,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;SACzB,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAY;QACvB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE;YACxC,IAAI;SACL,CAAC,CAAA;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;IACzD,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,eAAgC,EAAE,IAAY;QACtD,IAAI,CAAC,eAAe,CAAC,OAAO;YAAE,OAAO,IAAI,CAAA;QACzC,IAAI,CAAC,eAAe,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QAC3E,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE;YACvB,EAAE,EAAE,eAAe,CAAC,GAAG;YACvB,IAAI,EAAE,eAAe,CAAC,OAAO,CAAC,IAAI;YAClC,WAAW,EAAE,eAAe,CAAC,OAAO,CAAC,WAAW;SACjD,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;CACF","sourcesContent":["import type { GherkinDocument } from '@cucumber/messages'\nimport { create, insert, type Orama, search } from '@orama/orama'\n\nimport type { IndexHit, TypedIndex } from './types.js'\n\nconst schema = {\n name: 'string',\n description: 'string',\n} as const\n\n/**\n * A little different to the other indexes - a Feature doesn't have its own id,\n * so we use the uri of the GherkinDocument as a pointer\n */\nexport class FeatureSearch implements TypedIndex<GherkinDocument> {\n private readonly index: Orama<typeof schema>\n\n constructor() {\n this.index = create({\n schema,\n sort: { enabled: false },\n })\n }\n\n async search(term: string): Promise<ReadonlyArray<IndexHit>> {\n const { hits } = await search(this.index, {\n term,\n })\n return hits.map((hit) => ({ uri: hit.id, id: hit.id }))\n }\n\n async add(gherkinDocument: GherkinDocument, _uri: string): Promise<this> {\n if (!gherkinDocument.feature) return this\n if (!gherkinDocument.uri) throw new Error('Missing uri on gherkinDocument')\n await insert(this.index, {\n id: gherkinDocument.uri,\n name: gherkinDocument.feature.name,\n description: gherkinDocument.feature.description,\n })\n return this\n }\n}\n"]}
@@ -1,9 +1,4 @@
1
- import { Orama } from '@orama/orama';
2
- import { TypedIndex } from './types.js';
3
- declare const schema: {
4
- readonly name: "string";
5
- readonly description: "string";
6
- };
1
+ import { type TypedIndex } from './types.js';
7
2
  export interface ScenarioLike {
8
3
  id: string;
9
4
  name: string;
@@ -13,13 +8,13 @@ export interface ScenarioLike {
13
8
  * Can be used for Backgrounds, Scenarios and Rules, searching against the
14
9
  * name and description
15
10
  */
16
- declare class ScenarioLikeSearch<T extends ScenarioLike> implements TypedIndex<T> {
17
- private itemById;
11
+ export declare class ScenarioLikeSearch<T extends ScenarioLike> implements TypedIndex<T> {
18
12
  private readonly index;
19
- constructor(index: Orama<typeof schema>);
20
- search(term: string): Promise<Array<T>>;
21
- add(item: T): Promise<this>;
13
+ constructor();
14
+ search(term: string): Promise<{
15
+ uri: string;
16
+ id: string;
17
+ }[]>;
18
+ add(item: T, uri: string): Promise<this>;
22
19
  }
23
- export declare function createScenarioLikeSearch<T extends ScenarioLike>(): Promise<ScenarioLikeSearch<T>>;
24
- export {};
25
20
  //# sourceMappingURL=ScenarioLikeSearch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScenarioLikeSearch.d.ts","sourceRoot":"","sources":["../../../src/search/ScenarioLikeSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,EAAU,MAAM,cAAc,CAAA;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvC,QAAA,MAAM,MAAM;;;CAGF,CAAA;AAEV,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;;GAGG;AACH,cAAM,kBAAkB,CAAC,CAAC,SAAS,YAAY,CAAE,YAAW,UAAU,CAAC,CAAC,CAAC;IACvE,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;gBAEhC,KAAK,EAAE,KAAK,CAAC,OAAO,MAAM,CAAC;IAIjC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAOvC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CASlC;AAED,wBAAsB,wBAAwB,CAAC,CAAC,SAAS,YAAY,KAAK,OAAO,CAC/E,kBAAkB,CAAC,CAAC,CAAC,CACtB,CAQA"}
1
+ {"version":3,"file":"ScenarioLikeSearch.d.ts","sourceRoot":"","sources":["../../../src/search/ScenarioLikeSearch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAA;AAO1D,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;;GAGG;AACH,qBAAa,kBAAkB,CAAC,CAAC,SAAS,YAAY,CAAE,YAAW,UAAU,CAAC,CAAC,CAAC;IAC9E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;;IAStC,MAAM,CAAC,IAAI,EAAE,MAAM;;;;IAUnB,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAQ/C"}
@@ -1,4 +1,5 @@
1
1
  import { create, insert, search } from '@orama/orama';
2
+ import { ID_SEPARATOR } from './types.js';
2
3
  const schema = {
3
4
  name: 'string',
4
5
  description: 'string',
@@ -7,35 +8,30 @@ const schema = {
7
8
  * Can be used for Backgrounds, Scenarios and Rules, searching against the
8
9
  * name and description
9
10
  */
10
- class ScenarioLikeSearch {
11
- itemById = new Map();
11
+ export class ScenarioLikeSearch {
12
12
  index;
13
- constructor(index) {
14
- this.index = index;
13
+ constructor() {
14
+ this.index = create({
15
+ schema,
16
+ sort: { enabled: false },
17
+ });
15
18
  }
16
19
  async search(term) {
17
20
  const { hits } = await search(this.index, {
18
21
  term,
19
22
  });
20
- return hits.map((hit) => this.itemById.get(hit.id));
23
+ return hits.map((hit) => {
24
+ const [uri, id] = hit.id.split(ID_SEPARATOR);
25
+ return { uri, id };
26
+ });
21
27
  }
22
- async add(item) {
23
- this.itemById.set(item.id, item);
28
+ async add(item, uri) {
24
29
  await insert(this.index, {
25
- id: item.id,
30
+ id: uri + ID_SEPARATOR + item.id,
26
31
  name: item.name,
27
32
  description: item.description,
28
33
  });
29
34
  return this;
30
35
  }
31
36
  }
32
- export async function createScenarioLikeSearch() {
33
- const index = await create({
34
- schema,
35
- sort: {
36
- enabled: false,
37
- },
38
- });
39
- return new ScenarioLikeSearch(index);
40
- }
41
37
  //# sourceMappingURL=ScenarioLikeSearch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScenarioLikeSearch.js","sourceRoot":"","sources":["../../../src/search/ScenarioLikeSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAS,MAAM,EAAE,MAAM,cAAc,CAAA;AAI5D,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,QAAQ;CACb,CAAA;AAQV;;;GAGG;AACH,MAAM,kBAAkB;IACd,QAAQ,GAAG,IAAI,GAAG,EAAa,CAAA;IACtB,KAAK,CAAsB;IAE5C,YAAY,KAA2B;QACrC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAY;QACvB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE;YACxC,IAAI;SACL,CAAC,CAAA;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAQ,CAAA;IAC5D,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAO;QACf,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;QAChC,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE;YACvB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAED,MAAM,CAAC,KAAK,UAAU,wBAAwB;IAG5C,MAAM,KAAK,GAAyB,MAAM,MAAM,CAAC;QAC/C,MAAM;QACN,IAAI,EAAE;YACJ,OAAO,EAAE,KAAK;SACf;KACF,CAAC,CAAA;IACF,OAAO,IAAI,kBAAkB,CAAI,KAAK,CAAC,CAAA;AACzC,CAAC","sourcesContent":["import { create, insert, Orama, search } from '@orama/orama'\n\nimport { TypedIndex } from './types.js'\n\nconst schema = {\n name: 'string',\n description: 'string',\n} as const\n\nexport interface ScenarioLike {\n id: string\n name: string\n description: string\n}\n\n/**\n * Can be used for Backgrounds, Scenarios and Rules, searching against the\n * name and description\n */\nclass ScenarioLikeSearch<T extends ScenarioLike> implements TypedIndex<T> {\n private itemById = new Map<string, T>()\n private readonly index: Orama<typeof schema>\n\n constructor(index: Orama<typeof schema>) {\n this.index = index\n }\n\n async search(term: string): Promise<Array<T>> {\n const { hits } = await search(this.index, {\n term,\n })\n return hits.map((hit) => this.itemById.get(hit.id)) as T[]\n }\n\n async add(item: T): Promise<this> {\n this.itemById.set(item.id, item)\n await insert(this.index, {\n id: item.id,\n name: item.name,\n description: item.description,\n })\n return this\n }\n}\n\nexport async function createScenarioLikeSearch<T extends ScenarioLike>(): Promise<\n ScenarioLikeSearch<T>\n> {\n const index: Orama<typeof schema> = await create({\n schema,\n sort: {\n enabled: false,\n },\n })\n return new ScenarioLikeSearch<T>(index)\n}\n"]}
1
+ {"version":3,"file":"ScenarioLikeSearch.js","sourceRoot":"","sources":["../../../src/search/ScenarioLikeSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAc,MAAM,EAAE,MAAM,cAAc,CAAA;AAEjE,OAAO,EAAE,YAAY,EAAmB,MAAM,YAAY,CAAA;AAE1D,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,QAAQ;CACb,CAAA;AAQV;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IACZ,KAAK,CAAsB;IAE5C;QACE,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;YAClB,MAAM;YACN,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;SACzB,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAY;QACvB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE;YACxC,IAAI;SACL,CAAC,CAAA;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACtB,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;YAC5C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,CAAA;QACpB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAO,EAAE,GAAW;QAC5B,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE;YACvB,EAAE,EAAE,GAAG,GAAG,YAAY,GAAG,IAAI,CAAC,EAAE;YAChC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;CACF","sourcesContent":["import { create, insert, type Orama, search } from '@orama/orama'\n\nimport { ID_SEPARATOR, type TypedIndex } from './types.js'\n\nconst schema = {\n name: 'string',\n description: 'string',\n} as const\n\nexport interface ScenarioLike {\n id: string\n name: string\n description: string\n}\n\n/**\n * Can be used for Backgrounds, Scenarios and Rules, searching against the\n * name and description\n */\nexport class ScenarioLikeSearch<T extends ScenarioLike> implements TypedIndex<T> {\n private readonly index: Orama<typeof schema>\n\n constructor() {\n this.index = create({\n schema,\n sort: { enabled: false },\n })\n }\n\n async search(term: string) {\n const { hits } = await search(this.index, {\n term,\n })\n return hits.map((hit) => {\n const [uri, id] = hit.id.split(ID_SEPARATOR)\n return { uri, id }\n })\n }\n\n async add(item: T, uri: string): Promise<this> {\n await insert(this.index, {\n id: uri + ID_SEPARATOR + item.id,\n name: item.name,\n description: item.description,\n })\n return this\n }\n}\n"]}
@@ -1,19 +1,12 @@
1
- import { Step } from '@cucumber/messages';
2
- import { Orama } from '@orama/orama';
3
- import { TypedIndex } from './types.js';
4
- declare const schema: {
5
- readonly keyword: "string";
6
- readonly text: "string";
7
- readonly docString: "string";
8
- readonly dataTable: "string[]";
9
- };
10
- declare class StepSearch implements TypedIndex<Step> {
11
- private readonly stepById;
1
+ import type { Step } from '@cucumber/messages';
2
+ import { type TypedIndex } from './types.js';
3
+ export declare class StepSearch implements TypedIndex<Step> {
12
4
  private readonly index;
13
- constructor(index: Orama<typeof schema>);
14
- search(term: string): Promise<Array<Step>>;
15
- add(step: Step): Promise<this>;
5
+ constructor();
6
+ search(term: string): Promise<{
7
+ uri: string;
8
+ id: string;
9
+ }[]>;
10
+ add(step: Step, uri: string): Promise<this>;
16
11
  }
17
- export declare function createStepSearch(): Promise<StepSearch>;
18
- export {};
19
12
  //# sourceMappingURL=StepSearch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StepSearch.d.ts","sourceRoot":"","sources":["../../../src/search/StepSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,OAAO,EAAkB,KAAK,EAAU,MAAM,cAAc,CAAA;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvC,QAAA,MAAM,MAAM;;;;;CAKF,CAAA;AAEV,cAAM,UAAW,YAAW,UAAU,CAAC,IAAI,CAAC;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;IACnD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;gBAEhC,KAAK,EAAE,KAAK,CAAC,OAAO,MAAM,CAAC;IAIjC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAU1C,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAWrC;AAED,wBAAsB,gBAAgB,wBAQrC"}
1
+ {"version":3,"file":"StepSearch.d.ts","sourceRoot":"","sources":["../../../src/search/StepSearch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAG9C,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAA;AAS1D,qBAAa,UAAW,YAAW,UAAU,CAAC,IAAI,CAAC;IACjD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;;IAStC,MAAM,CAAC,IAAI,EAAE,MAAM;;;;IAanB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAUlD"}
@@ -1,15 +1,18 @@
1
1
  import { create, insert, search } from '@orama/orama';
2
+ import { ID_SEPARATOR } from './types.js';
2
3
  const schema = {
3
4
  keyword: 'string',
4
5
  text: 'string',
5
6
  docString: 'string',
6
7
  dataTable: 'string[]',
7
8
  };
8
- class StepSearch {
9
- stepById = new Map();
9
+ export class StepSearch {
10
10
  index;
11
- constructor(index) {
12
- this.index = index;
11
+ constructor() {
12
+ this.index = create({
13
+ schema,
14
+ sort: { enabled: false },
15
+ });
13
16
  }
14
17
  async search(term) {
15
18
  const { hits } = await search(this.index, {
@@ -18,12 +21,14 @@ class StepSearch {
18
21
  text: 2,
19
22
  },
20
23
  });
21
- return hits.map((hit) => this.stepById.get(hit.id));
24
+ return hits.map((hit) => {
25
+ const [uri, id] = hit.id.split(ID_SEPARATOR);
26
+ return { uri, id };
27
+ });
22
28
  }
23
- async add(step) {
24
- this.stepById.set(step.id, step);
29
+ async add(step, uri) {
25
30
  await insert(this.index, {
26
- id: step.id,
31
+ id: uri + ID_SEPARATOR + step.id,
27
32
  keyword: step.keyword,
28
33
  text: step.text,
29
34
  docString: step.docString?.content,
@@ -32,13 +37,4 @@ class StepSearch {
32
37
  return this;
33
38
  }
34
39
  }
35
- export async function createStepSearch() {
36
- const index = await create({
37
- schema,
38
- sort: {
39
- enabled: false,
40
- },
41
- });
42
- return new StepSearch(index);
43
- }
44
40
  //# sourceMappingURL=StepSearch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StepSearch.js","sourceRoot":"","sources":["../../../src/search/StepSearch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAS,MAAM,EAAE,MAAM,cAAc,CAAA;AAI5D,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,QAAQ;IACjB,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,UAAU;CACb,CAAA;AAEV,MAAM,UAAU;IACG,QAAQ,GAAG,IAAI,GAAG,EAAgB,CAAA;IAClC,KAAK,CAAsB;IAE5C,YAAY,KAA2B;QACrC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAY;QACvB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE;YACxC,IAAI;YACJ,KAAK,EAAE;gBACL,IAAI,EAAE,CAAC;aACR;SACF,CAAC,CAAA;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAW,CAAA;IAC/D,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAU;QAClB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;QAChC,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE;YACvB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO;YAClC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;SACtF,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,MAAM,KAAK,GAAyB,MAAM,MAAM,CAAC;QAC/C,MAAM;QACN,IAAI,EAAE;YACJ,OAAO,EAAE,KAAK;SACf;KACF,CAAC,CAAA;IACF,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC","sourcesContent":["import { Step } from '@cucumber/messages'\nimport { create, insert, Orama, search } from '@orama/orama'\n\nimport { TypedIndex } from './types.js'\n\nconst schema = {\n keyword: 'string',\n text: 'string',\n docString: 'string',\n dataTable: 'string[]',\n} as const\n\nclass StepSearch implements TypedIndex<Step> {\n private readonly stepById = new Map<string, Step>()\n private readonly index: Orama<typeof schema>\n\n constructor(index: Orama<typeof schema>) {\n this.index = index\n }\n\n async search(term: string): Promise<Array<Step>> {\n const { hits } = await search(this.index, {\n term,\n boost: {\n text: 2,\n },\n })\n return hits.map((hit) => this.stepById.get(hit.id)) as Step[]\n }\n\n async add(step: Step): Promise<this> {\n this.stepById.set(step.id, step)\n await insert(this.index, {\n id: step.id,\n keyword: step.keyword,\n text: step.text,\n docString: step.docString?.content,\n dataTable: step.dataTable?.rows.flatMap((row) => row.cells).map((cell) => cell.value),\n })\n return this\n }\n}\n\nexport async function createStepSearch() {\n const index: Orama<typeof schema> = await create({\n schema,\n sort: {\n enabled: false,\n },\n })\n return new StepSearch(index)\n}\n"]}
1
+ {"version":3,"file":"StepSearch.js","sourceRoot":"","sources":["../../../src/search/StepSearch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAc,MAAM,EAAE,MAAM,cAAc,CAAA;AAEjE,OAAO,EAAE,YAAY,EAAmB,MAAM,YAAY,CAAA;AAE1D,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,QAAQ;IACjB,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,UAAU;CACb,CAAA;AAEV,MAAM,OAAO,UAAU;IACJ,KAAK,CAAsB;IAE5C;QACE,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;YAClB,MAAM;YACN,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;SACzB,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAY;QACvB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE;YACxC,IAAI;YACJ,KAAK,EAAE;gBACL,IAAI,EAAE,CAAC;aACR;SACF,CAAC,CAAA;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACtB,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;YAC5C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,CAAA;QACpB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAU,EAAE,GAAW;QAC/B,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE;YACvB,EAAE,EAAE,GAAG,GAAG,YAAY,GAAG,IAAI,CAAC,EAAE;YAChC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO;YAClC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;SACtF,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;CACF","sourcesContent":["import type { Step } from '@cucumber/messages'\nimport { create, insert, type Orama, search } from '@orama/orama'\n\nimport { ID_SEPARATOR, type TypedIndex } from './types.js'\n\nconst schema = {\n keyword: 'string',\n text: 'string',\n docString: 'string',\n dataTable: 'string[]',\n} as const\n\nexport class StepSearch implements TypedIndex<Step> {\n private readonly index: Orama<typeof schema>\n\n constructor() {\n this.index = create({\n schema,\n sort: { enabled: false },\n })\n }\n\n async search(term: string) {\n const { hits } = await search(this.index, {\n term,\n boost: {\n text: 2,\n },\n })\n return hits.map((hit) => {\n const [uri, id] = hit.id.split(ID_SEPARATOR)\n return { uri, id }\n })\n }\n\n async add(step: Step, uri: string): Promise<this> {\n await insert(this.index, {\n id: uri + ID_SEPARATOR + step.id,\n keyword: step.keyword,\n text: step.text,\n docString: step.docString?.content,\n dataTable: step.dataTable?.rows.flatMap((row) => row.cells).map((cell) => cell.value),\n })\n return this\n }\n}\n"]}
@@ -1,3 +1,12 @@
1
- import { Searchable } from './types.js';
2
- export declare function createTextSearch(): Promise<Searchable>;
1
+ import type { GherkinDocument } from '@cucumber/messages';
2
+ import type { SearchHits, SearchIndex } from './types.js';
3
+ export declare class TextSearch implements SearchIndex {
4
+ private readonly featureSearch;
5
+ private readonly backgroundSearch;
6
+ private readonly ruleSearch;
7
+ private readonly scenarioSearch;
8
+ private readonly stepSearch;
9
+ search(query: string): Promise<SearchHits | false>;
10
+ add(gherkinDocument: GherkinDocument): Promise<void>;
11
+ }
3
12
  //# sourceMappingURL=TextSearch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextSearch.d.ts","sourceRoot":"","sources":["../../../src/search/TextSearch.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAc,MAAM,YAAY,CAAA;AAmEnD,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,UAAU,CAAC,CAU5D"}
1
+ {"version":3,"file":"TextSearch.d.ts","sourceRoot":"","sources":["../../../src/search/TextSearch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,eAAe,EAAkB,MAAM,oBAAoB,CAAA;AAIrF,OAAO,KAAK,EAAgC,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAEvF,qBAAa,UAAW,YAAW,WAAW;IAC5C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAsB;IACpD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAuC;IACxE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAiC;IAC5D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqC;IACpE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmB;IAEjC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC;IA6ClD,GAAG,CAAC,eAAe,EAAE,eAAe;CAclD"}
@@ -1,63 +1,70 @@
1
- import { GherkinDocumentWalker } from '@cucumber/gherkin-utils';
2
- import { createFeatureSearch } from './FeatureSearch.js';
3
- import { createScenarioLikeSearch } from './ScenarioLikeSearch.js';
4
- import { createStepSearch } from './StepSearch.js';
5
- class TextSearch {
6
- gherkinDocuments = [];
7
- stepSearch;
8
- backgroundSearch;
9
- scenarioSearch;
10
- ruleSearch;
11
- featureSearch;
12
- constructor(stepSearch, backgroundSearch, scenarioSearch, ruleSearch, featureSearch) {
13
- this.stepSearch = stepSearch;
14
- this.backgroundSearch = backgroundSearch;
15
- this.scenarioSearch = scenarioSearch;
16
- this.ruleSearch = ruleSearch;
17
- this.featureSearch = featureSearch;
18
- }
1
+ import { walkGherkinDocument } from '@cucumber/gherkin-utils';
2
+ import { FeatureSearch } from './FeatureSearch.js';
3
+ import { ScenarioLikeSearch } from './ScenarioLikeSearch.js';
4
+ import { StepSearch } from './StepSearch.js';
5
+ export class TextSearch {
6
+ featureSearch = new FeatureSearch();
7
+ backgroundSearch = new ScenarioLikeSearch();
8
+ ruleSearch = new ScenarioLikeSearch();
9
+ scenarioSearch = new ScenarioLikeSearch();
10
+ stepSearch = new StepSearch();
19
11
  async search(query) {
20
- const [matchingSteps, matchingBackgrounds, matchingScenarios, matchingRules, matchingFeatures] = await Promise.all([
21
- this.stepSearch.search(query),
12
+ const [featureHits, backgroundHits, ruleHits, scenarioHits, stepHits] = await Promise.all([
13
+ this.featureSearch.search(query),
22
14
  this.backgroundSearch.search(query),
23
- this.scenarioSearch.search(query),
24
15
  this.ruleSearch.search(query),
25
- this.featureSearch.search(query),
16
+ this.scenarioSearch.search(query),
17
+ this.stepSearch.search(query),
26
18
  ]);
27
- const walker = new GherkinDocumentWalker({
28
- acceptStep: (step) => matchingSteps.includes(step),
29
- acceptBackground: (background) => matchingBackgrounds.includes(background),
30
- acceptScenario: (scenario) => matchingScenarios.includes(scenario),
31
- acceptRule: (rule) => matchingRules.includes(rule),
32
- acceptFeature: (feature) => matchingFeatures.includes(feature),
33
- });
34
- return this.gherkinDocuments
35
- .map((gherkinDocument) => walker.walkGherkinDocument(gherkinDocument))
36
- .filter((gherkinDocument) => !!gherkinDocument);
19
+ const allHits = [
20
+ ...featureHits,
21
+ ...backgroundHits,
22
+ ...ruleHits,
23
+ ...scenarioHits,
24
+ ...stepHits,
25
+ ];
26
+ if (allHits.length === 0) {
27
+ return false;
28
+ }
29
+ const map = new Map();
30
+ const getOrDefault = (uri) => {
31
+ let entry = map.get(uri);
32
+ if (!entry) {
33
+ entry = { feature: false, background: [], rule: [], scenario: [], step: [] };
34
+ map.set(uri, entry);
35
+ }
36
+ return entry;
37
+ };
38
+ for (const hit of featureHits) {
39
+ getOrDefault(hit.uri).feature = true;
40
+ }
41
+ for (const hit of backgroundHits) {
42
+ getOrDefault(hit.uri).background.push(hit.id);
43
+ }
44
+ for (const hit of ruleHits) {
45
+ getOrDefault(hit.uri).rule.push(hit.id);
46
+ }
47
+ for (const hit of scenarioHits) {
48
+ getOrDefault(hit.uri).scenario.push(hit.id);
49
+ }
50
+ for (const hit of stepHits) {
51
+ getOrDefault(hit.uri).step.push(hit.id);
52
+ }
53
+ return map;
37
54
  }
38
55
  async add(gherkinDocument) {
39
- this.gherkinDocuments.push(gherkinDocument);
40
- const promises = [];
41
- const walker = new GherkinDocumentWalker({}, {
42
- handleStep: (step) => promises.push(this.stepSearch.add(step)),
43
- handleBackground: (background) => promises.push(this.backgroundSearch.add(background)),
44
- handleScenario: (scenario) => promises.push(this.scenarioSearch.add(scenario)),
45
- handleRule: (rule) => promises.push(this.ruleSearch.add(rule)),
56
+ const uri = gherkinDocument.uri;
57
+ if (!uri) {
58
+ return;
59
+ }
60
+ const promises = walkGherkinDocument(gherkinDocument, [], {
61
+ feature: (_feature, acc) => [...acc, this.featureSearch.add(gherkinDocument, uri)],
62
+ background: (background, acc) => [...acc, this.backgroundSearch.add(background, uri)],
63
+ rule: (rule, acc) => [...acc, this.ruleSearch.add(rule, uri)],
64
+ scenario: (scenario, acc) => [...acc, this.scenarioSearch.add(scenario, uri)],
65
+ step: (step, acc) => [...acc, this.stepSearch.add(step, uri)],
46
66
  });
47
- promises.push(this.featureSearch.add(gherkinDocument));
48
- walker.walkGherkinDocument(gherkinDocument);
49
67
  await Promise.all(promises);
50
- return this;
51
68
  }
52
69
  }
53
- export async function createTextSearch() {
54
- const [stepSearch, backgroundSearch, scenarioSearch, ruleSearch, featureSearch] = await Promise.all([
55
- createStepSearch(),
56
- createScenarioLikeSearch(),
57
- createScenarioLikeSearch(),
58
- createScenarioLikeSearch(),
59
- createFeatureSearch(),
60
- ]);
61
- return new TextSearch(stepSearch, backgroundSearch, scenarioSearch, ruleSearch, featureSearch);
62
- }
63
70
  //# sourceMappingURL=TextSearch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextSearch.js","sourceRoot":"","sources":["../../../src/search/TextSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAG/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAGlD,MAAM,UAAU;IACG,gBAAgB,GAAsB,EAAE,CAAA;IAExC,UAAU,CAAkB;IAC5B,gBAAgB,CAAwB;IACxC,cAAc,CAAsB;IACpC,UAAU,CAAkB;IAC5B,aAAa,CAAsC;IAEpE,YACE,UAA4B,EAC5B,gBAAwC,EACxC,cAAoC,EACpC,UAA4B,EAC5B,aAAmD;QAEnD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;QACxC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAA;QACpC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;IACpC,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,KAAa;QAC/B,MAAM,CAAC,aAAa,EAAE,mBAAmB,EA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["import { GherkinDocumentWalker } from '@cucumber/gherkin-utils'\nimport { Background, Feature, GherkinDocument, Rule, Scenario, Step } from '@cucumber/messages'\n\nimport { createFeatureSearch } from './FeatureSearch.js'\nimport { createScenarioLikeSearch } from './ScenarioLikeSearch.js'\nimport { createStepSearch } from './StepSearch.js'\nimport { Searchable, TypedIndex } from './types.js'\n\nclass TextSearch {\n private readonly gherkinDocuments: GherkinDocument[] = []\n\n private readonly stepSearch: TypedIndex<Step>\n private readonly backgroundSearch: TypedIndex<Background>\n private readonly scenarioSearch: TypedIndex<Scenario>\n private readonly ruleSearch: TypedIndex<Rule>\n private readonly featureSearch: TypedIndex<Feature, GherkinDocument>\n\n constructor(\n stepSearch: TypedIndex<Step>,\n backgroundSearch: TypedIndex<Background>,\n scenarioSearch: TypedIndex<Scenario>,\n ruleSearch: TypedIndex<Rule>,\n featureSearch: TypedIndex<Feature, GherkinDocument>\n ) {\n this.stepSearch = stepSearch\n this.backgroundSearch = backgroundSearch\n this.scenarioSearch = scenarioSearch\n this.ruleSearch = ruleSearch\n this.featureSearch = featureSearch\n }\n\n public async search(query: string): Promise<readonly GherkinDocument[]> {\n const [matchingSteps, matchingBackgrounds, matchingScenarios, matchingRules, matchingFeatures] =\n await Promise.all([\n this.stepSearch.search(query),\n this.backgroundSearch.search(query),\n this.scenarioSearch.search(query),\n this.ruleSearch.search(query),\n this.featureSearch.search(query),\n ])\n\n const walker = new GherkinDocumentWalker({\n acceptStep: (step) => matchingSteps.includes(step),\n acceptBackground: (background) => matchingBackgrounds.includes(background),\n acceptScenario: (scenario) => matchingScenarios.includes(scenario),\n acceptRule: (rule) => matchingRules.includes(rule),\n acceptFeature: (feature) => matchingFeatures.includes(feature),\n })\n\n return this.gherkinDocuments\n .map((gherkinDocument) => walker.walkGherkinDocument(gherkinDocument))\n .filter((gherkinDocument) => !!gherkinDocument) as readonly GherkinDocument[]\n }\n\n public async add(gherkinDocument: GherkinDocument) {\n this.gherkinDocuments.push(gherkinDocument)\n const promises: Promise<unknown>[] = []\n const walker = new GherkinDocumentWalker(\n {},\n {\n handleStep: (step) => promises.push(this.stepSearch.add(step)),\n handleBackground: (background) => promises.push(this.backgroundSearch.add(background)),\n handleScenario: (scenario) => promises.push(this.scenarioSearch.add(scenario)),\n handleRule: (rule) => promises.push(this.ruleSearch.add(rule)),\n }\n )\n promises.push(this.featureSearch.add(gherkinDocument))\n walker.walkGherkinDocument(gherkinDocument)\n await Promise.all(promises)\n return this\n }\n}\n\nexport async function createTextSearch(): Promise<Searchable> {\n const [stepSearch, backgroundSearch, scenarioSearch, ruleSearch, featureSearch] =\n await Promise.all([\n createStepSearch(),\n createScenarioLikeSearch<Background>(),\n createScenarioLikeSearch<Scenario>(),\n createScenarioLikeSearch<Rule>(),\n createFeatureSearch(),\n ])\n return new TextSearch(stepSearch, backgroundSearch, scenarioSearch, ruleSearch, featureSearch)\n}\n"]}
1
+ {"version":3,"file":"TextSearch.js","sourceRoot":"","sources":["../../../src/search/TextSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C,MAAM,OAAO,UAAU;IACJ,aAAa,GAAG,IAAI,aAAa,EAAE,CAAA;IACnC,gBAAgB,GAAG,IAAI,kBAAkB,EAAc,CAAA;IACvD,UAAU,GAAG,IAAI,kBAAkB,EAAQ,CAAA;IAC3C,cAAc,GAAG,IAAI,kBAAkB,EAAY,CAAA;IACnD,UAAU,GAAG,IAAI,UAAU,EAAE,CAAA;IAEvC,KAAK,CAAC,MAAM,CAAC,KAAa;QAC/B,MAAM,CAAC,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,GAA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;YAC7D,QAAQ,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YAC7E,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC9D,CAAC,CAAA;QACF,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAC7B,CAAC;CACF","sourcesContent":["import { walkGherkinDocument } from '@cucumber/gherkin-utils'\nimport type { Background, GherkinDocument, Rule, Scenario } from '@cucumber/messages'\nimport { FeatureSearch } from './FeatureSearch.js'\nimport { ScenarioLikeSearch } from './ScenarioLikeSearch.js'\nimport { StepSearch } from './StepSearch.js'\nimport type { DocumentSearchHits, IndexHit, SearchHits, SearchIndex } from './types.js'\n\nexport class TextSearch implements SearchIndex {\n private readonly featureSearch = new FeatureSearch()\n private readonly backgroundSearch = new ScenarioLikeSearch<Background>()\n private readonly ruleSearch = new ScenarioLikeSearch<Rule>()\n private readonly scenarioSearch = new ScenarioLikeSearch<Scenario>()\n private readonly stepSearch = new StepSearch()\n\n public async search(query: string): Promise<SearchHits | false> {\n const [featureHits, backgroundHits, ruleHits, scenarioHits, stepHits] = await Promise.all([\n this.featureSearch.search(query),\n this.backgroundSearch.search(query),\n this.ruleSearch.search(query),\n this.scenarioSearch.search(query),\n this.stepSearch.search(query),\n ])\n const allHits: ReadonlyArray<IndexHit> = [\n ...featureHits,\n ...backgroundHits,\n ...ruleHits,\n ...scenarioHits,\n ...stepHits,\n ]\n if (allHits.length === 0) {\n return false\n }\n const map = new Map<string, DocumentSearchHits>()\n const getOrDefault = (uri: string) => {\n let entry = map.get(uri)\n if (!entry) {\n entry = { feature: false, background: [], rule: [], scenario: [], step: [] }\n map.set(uri, entry)\n }\n return entry\n }\n for (const hit of featureHits) {\n getOrDefault(hit.uri).feature = true\n }\n for (const hit of backgroundHits) {\n getOrDefault(hit.uri).background.push(hit.id)\n }\n for (const hit of ruleHits) {\n getOrDefault(hit.uri).rule.push(hit.id)\n }\n for (const hit of scenarioHits) {\n getOrDefault(hit.uri).scenario.push(hit.id)\n }\n for (const hit of stepHits) {\n getOrDefault(hit.uri).step.push(hit.id)\n }\n return map\n }\n\n public async add(gherkinDocument: GherkinDocument) {\n const uri = gherkinDocument.uri\n if (!uri) {\n return\n }\n const promises = walkGherkinDocument<Array<Promise<unknown>>>(gherkinDocument, [], {\n feature: (_feature, acc) => [...acc, this.featureSearch.add(gherkinDocument, uri)],\n background: (background, acc) => [...acc, this.backgroundSearch.add(background, uri)],\n rule: (rule, acc) => [...acc, this.ruleSearch.add(rule, uri)],\n scenario: (scenario, acc) => [...acc, this.scenarioSearch.add(scenario, uri)],\n step: (step, acc) => [...acc, this.stepSearch.add(step, uri)],\n })\n await Promise.all(promises)\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import type { GherkinDocument } from '@cucumber/messages';
2
+ import type { SearchIndex } from './types.js';
3
+ /**
4
+ * Creates a search index that supports querying by term
5
+ */
6
+ export declare function createSearchIndex(gherkinDocuments: ReadonlyArray<GherkinDocument>): Promise<SearchIndex>;
7
+ //# sourceMappingURL=createSearchIndex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSearchIndex.d.ts","sourceRoot":"","sources":["../../../src/search/createSearchIndex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,aAAa,CAAC,eAAe,CAAC,GAC/C,OAAO,CAAC,WAAW,CAAC,CAItB"}
@@ -0,0 +1,10 @@
1
+ import { TextSearch } from './TextSearch.js';
2
+ /**
3
+ * Creates a search index that supports querying by term
4
+ */
5
+ export async function createSearchIndex(gherkinDocuments) {
6
+ const textSearch = new TextSearch();
7
+ await Promise.all(gherkinDocuments.map((gherkinDocument) => textSearch.add(gherkinDocument)));
8
+ return textSearch;
9
+ }
10
+ //# sourceMappingURL=createSearchIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSearchIndex.js","sourceRoot":"","sources":["../../../src/search/createSearchIndex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,gBAAgD;IAEhD,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAA;IACnC,MAAM,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,eAAe,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;IAC7F,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["import type { GherkinDocument } from '@cucumber/messages'\n\nimport { TextSearch } from './TextSearch.js'\nimport type { SearchIndex } from './types.js'\n\n/**\n * Creates a search index that supports querying by term\n */\nexport async function createSearchIndex(\n gherkinDocuments: ReadonlyArray<GherkinDocument>\n): Promise<SearchIndex> {\n const textSearch = new TextSearch()\n await Promise.all(gherkinDocuments.map((gherkinDocument) => textSearch.add(gherkinDocument)))\n return textSearch\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import type { Pickle } from '@cucumber/messages';
2
+ import type { Lineage } from '@cucumber/query';
3
+ import type { LineageConstraints } from './types.js';
4
+ export declare function deriveLineageConstraints(items: ReadonlyArray<{
5
+ pickle: Pickle;
6
+ lineage: Lineage;
7
+ }>): LineageConstraints;
8
+ //# sourceMappingURL=deriveLineageConstraints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deriveLineageConstraints.d.ts","sourceRoot":"","sources":["../../../src/search/deriveLineageConstraints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpD,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,aAAa,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,GACzD,kBAAkB,CAoCpB"}
@@ -0,0 +1,38 @@
1
+ export function deriveLineageConstraints(items) {
2
+ const gherkinDocument = new Set();
3
+ const background = new Set();
4
+ const rule = new Set();
5
+ const scenario = new Set();
6
+ const examples = new Set();
7
+ const example = new Set();
8
+ for (const { pickle, lineage } of items) {
9
+ gherkinDocument.add(pickle.uri);
10
+ if (lineage.background) {
11
+ background.add(lineage.background.id);
12
+ }
13
+ if (lineage.ruleBackground) {
14
+ background.add(lineage.ruleBackground.id);
15
+ }
16
+ if (lineage.rule) {
17
+ rule.add(lineage.rule.id);
18
+ }
19
+ if (lineage.scenario) {
20
+ scenario.add(lineage.scenario.id);
21
+ }
22
+ if (lineage.examples) {
23
+ examples.add(lineage.examples.id);
24
+ }
25
+ if (lineage.example) {
26
+ example.add(lineage.example.id);
27
+ }
28
+ }
29
+ return {
30
+ gherkinDocument,
31
+ background,
32
+ rule,
33
+ scenario,
34
+ examples,
35
+ example,
36
+ };
37
+ }
38
+ //# sourceMappingURL=deriveLineageConstraints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deriveLineageConstraints.js","sourceRoot":"","sources":["../../../src/search/deriveLineageConstraints.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,wBAAwB,CACtC,KAA0D;IAE1D,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAA;IACzC,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAA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umber/messages'\nimport type { Lineage } from '@cucumber/query'\nimport type { LineageConstraints } from './types.js'\n\nexport function deriveLineageConstraints(\n items: ReadonlyArray<{ pickle: Pickle; lineage: Lineage }>\n): LineageConstraints {\n const gherkinDocument = new Set<string>()\n const background = new Set<string>()\n const rule = new Set<string>()\n const scenario = new Set<string>()\n const examples = new Set<string>()\n const example = new Set<string>()\n for (const { pickle, lineage } of items) {\n gherkinDocument.add(pickle.uri)\n if (lineage.background) {\n background.add(lineage.background.id)\n }\n if (lineage.ruleBackground) {\n background.add(lineage.ruleBackground.id)\n }\n if (lineage.rule) {\n rule.add(lineage.rule.id)\n }\n if (lineage.scenario) {\n scenario.add(lineage.scenario.id)\n }\n if (lineage.examples) {\n examples.add(lineage.examples.id)\n }\n if (lineage.example) {\n example.add(lineage.example.id)\n }\n }\n return {\n gherkinDocument,\n background,\n rule,\n scenario,\n examples,\n example,\n }\n}\n"]}
@@ -1,3 +1,5 @@
1
- export { createSearch } from './Search.js';
1
+ export * from './createSearchIndex.js';
2
+ export * from './deriveLineageConstraints.js';
3
+ export * from './pruneGherkinDocuments.js';
2
4
  export * from './types.js';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/search/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,YAAY,CAAA"}
@@ -1,3 +1,5 @@
1
- export { createSearch } from './Search.js';
1
+ export * from './createSearchIndex.js';
2
+ export * from './deriveLineageConstraints.js';
3
+ export * from './pruneGherkinDocuments.js';
2
4
  export * from './types.js';
3
5
  //# sourceMappingURL=index.js.map