@cucumber/react-components 21.1.1 → 22.1.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 (293) hide show
  1. package/README.md +2 -1
  2. package/dist/src/CucumberQueryContext.js +3 -8
  3. package/dist/src/CucumberQueryContext.js.map +1 -1
  4. package/dist/src/EnvelopesQueryContext.js +8 -20
  5. package/dist/src/EnvelopesQueryContext.js.map +1 -1
  6. package/dist/src/GherkinQueryContext.js +3 -8
  7. package/dist/src/GherkinQueryContext.js.map +1 -1
  8. package/dist/src/SearchQueryContext.js +24 -53
  9. package/dist/src/SearchQueryContext.js.map +1 -1
  10. package/dist/src/UriContext.js +2 -7
  11. package/dist/src/UriContext.js.map +1 -1
  12. package/dist/src/ciCommitLink.js +3 -9
  13. package/dist/src/ciCommitLink.js.map +1 -1
  14. package/dist/src/components/CucumberReact.d.ts +1 -1
  15. package/dist/src/components/CucumberReact.d.ts.map +1 -1
  16. package/dist/src/components/CucumberReact.js +7 -14
  17. package/dist/src/components/CucumberReact.js.map +1 -1
  18. package/dist/src/components/app/CICommitLink.js +14 -22
  19. package/dist/src/components/app/CICommitLink.js.map +1 -1
  20. package/dist/src/components/app/CIJobLink.js +8 -15
  21. package/dist/src/components/app/CIJobLink.js.map +1 -1
  22. package/dist/src/components/app/EnvelopesWrapper.js +11 -38
  23. package/dist/src/components/app/EnvelopesWrapper.js.map +1 -1
  24. package/dist/src/components/app/ExecutionSummary.js +54 -61
  25. package/dist/src/components/app/ExecutionSummary.js.map +1 -1
  26. package/dist/src/components/app/FilteredResults.d.ts.map +1 -1
  27. package/dist/src/components/app/FilteredResults.js +21 -39
  28. package/dist/src/components/app/FilteredResults.js.map +1 -1
  29. package/dist/src/components/app/GherkinDocumentList.js +27 -57
  30. package/dist/src/components/app/GherkinDocumentList.js.map +1 -1
  31. package/dist/src/components/app/HighLight.js +14 -21
  32. package/dist/src/components/app/HighLight.js.map +1 -1
  33. package/dist/src/components/app/NavigationButton.js +4 -23
  34. package/dist/src/components/app/NavigationButton.js.map +1 -1
  35. package/dist/src/components/app/NoMatchResult.js +8 -15
  36. package/dist/src/components/app/NoMatchResult.js.map +1 -1
  37. package/dist/src/components/app/OSIcon.js +10 -17
  38. package/dist/src/components/app/OSIcon.js.map +1 -1
  39. package/dist/src/components/app/QueriesWrapper.d.ts +1 -1
  40. package/dist/src/components/app/QueriesWrapper.d.ts.map +1 -1
  41. package/dist/src/components/app/QueriesWrapper.js +7 -14
  42. package/dist/src/components/app/QueriesWrapper.js.map +1 -1
  43. package/dist/src/components/app/RuntimeIcon.js +10 -17
  44. package/dist/src/components/app/RuntimeIcon.js.map +1 -1
  45. package/dist/src/components/app/SearchBar.d.ts.map +1 -1
  46. package/dist/src/components/app/SearchBar.js +25 -30
  47. package/dist/src/components/app/SearchBar.js.map +1 -1
  48. package/dist/src/components/app/SearchWrapper.d.ts +1 -1
  49. package/dist/src/components/app/SearchWrapper.d.ts.map +1 -1
  50. package/dist/src/components/app/SearchWrapper.js +4 -46
  51. package/dist/src/components/app/SearchWrapper.js.map +1 -1
  52. package/dist/src/components/app/StatusesSummary.js +8 -15
  53. package/dist/src/components/app/StatusesSummary.js.map +1 -1
  54. package/dist/src/components/app/icons/CucumberLogo.d.ts +1 -1
  55. package/dist/src/components/app/icons/CucumberLogo.js +7 -14
  56. package/dist/src/components/app/icons/CucumberLogo.js.map +1 -1
  57. package/dist/src/components/app/icons/Jvm.d.ts +1 -1
  58. package/dist/src/components/app/icons/Jvm.js +8 -15
  59. package/dist/src/components/app/icons/Jvm.js.map +1 -1
  60. package/dist/src/components/app/icons/Linux.js +18 -25
  61. package/dist/src/components/app/icons/Linux.js.map +1 -1
  62. package/dist/src/components/app/icons/MacOS.d.ts +1 -1
  63. package/dist/src/components/app/icons/MacOS.js +4 -11
  64. package/dist/src/components/app/icons/MacOS.js.map +1 -1
  65. package/dist/src/components/app/icons/NodeJs.d.ts +1 -1
  66. package/dist/src/components/app/icons/NodeJs.js +34 -41
  67. package/dist/src/components/app/icons/NodeJs.js.map +1 -1
  68. package/dist/src/components/app/icons/Ruby.d.ts +1 -1
  69. package/dist/src/components/app/icons/Ruby.js +4 -11
  70. package/dist/src/components/app/icons/Ruby.js.map +1 -1
  71. package/dist/src/components/app/icons/Windows.js +4 -11
  72. package/dist/src/components/app/icons/Windows.js.map +1 -1
  73. package/dist/src/components/app/index.d.ts +11 -11
  74. package/dist/src/components/app/index.d.ts.map +1 -1
  75. package/dist/src/components/app/index.js +11 -27
  76. package/dist/src/components/app/index.js.map +1 -1
  77. package/dist/src/components/app/rehypePlugins.d.ts.map +1 -1
  78. package/dist/src/components/app/rehypePlugins.js +8 -13
  79. package/dist/src/components/app/rehypePlugins.js.map +1 -1
  80. package/dist/src/components/app/remarkPlugins.js +3 -8
  81. package/dist/src/components/app/remarkPlugins.js.map +1 -1
  82. package/dist/src/components/app/statuses.js +2 -27
  83. package/dist/src/components/app/statuses.js.map +1 -1
  84. package/dist/src/components/customise/customRendering.d.ts +2 -1
  85. package/dist/src/components/customise/customRendering.d.ts.map +1 -1
  86. package/dist/src/components/customise/customRendering.js +6 -33
  87. package/dist/src/components/customise/customRendering.js.map +1 -1
  88. package/dist/src/components/customise/index.d.ts +2 -2
  89. package/dist/src/components/customise/index.d.ts.map +1 -1
  90. package/dist/src/components/customise/index.js +2 -18
  91. package/dist/src/components/customise/index.js.map +1 -1
  92. package/dist/src/components/customise/theming.js +1 -2
  93. package/dist/src/components/gherkin/Anchor.d.ts +1 -1
  94. package/dist/src/components/gherkin/Anchor.d.ts.map +1 -1
  95. package/dist/src/components/gherkin/Anchor.js +11 -18
  96. package/dist/src/components/gherkin/Anchor.js.map +1 -1
  97. package/dist/src/components/gherkin/Attachment.d.ts +1 -1
  98. package/dist/src/components/gherkin/Attachment.d.ts.map +1 -1
  99. package/dist/src/components/gherkin/Attachment.js +43 -77
  100. package/dist/src/components/gherkin/Attachment.js.map +1 -1
  101. package/dist/src/components/gherkin/Background.d.ts +1 -1
  102. package/dist/src/components/gherkin/Background.d.ts.map +1 -1
  103. package/dist/src/components/gherkin/Background.js +17 -24
  104. package/dist/src/components/gherkin/Background.js.map +1 -1
  105. package/dist/src/components/gherkin/Children.d.ts +1 -1
  106. package/dist/src/components/gherkin/Children.d.ts.map +1 -1
  107. package/dist/src/components/gherkin/Children.js +7 -14
  108. package/dist/src/components/gherkin/Children.js.map +1 -1
  109. package/dist/src/components/gherkin/DataTable.d.ts +1 -1
  110. package/dist/src/components/gherkin/DataTable.d.ts.map +1 -1
  111. package/dist/src/components/gherkin/DataTable.js +12 -19
  112. package/dist/src/components/gherkin/DataTable.js.map +1 -1
  113. package/dist/src/components/gherkin/Description.d.ts +1 -1
  114. package/dist/src/components/gherkin/Description.d.ts.map +1 -1
  115. package/dist/src/components/gherkin/Description.js +9 -16
  116. package/dist/src/components/gherkin/Description.js.map +1 -1
  117. package/dist/src/components/gherkin/DocString.d.ts +1 -1
  118. package/dist/src/components/gherkin/DocString.d.ts.map +1 -1
  119. package/dist/src/components/gherkin/DocString.js +9 -16
  120. package/dist/src/components/gherkin/DocString.js.map +1 -1
  121. package/dist/src/components/gherkin/ErrorMessage.d.ts +3 -3
  122. package/dist/src/components/gherkin/ErrorMessage.d.ts.map +1 -1
  123. package/dist/src/components/gherkin/ErrorMessage.js +8 -15
  124. package/dist/src/components/gherkin/ErrorMessage.js.map +1 -1
  125. package/dist/src/components/gherkin/ExampleDetail.js +31 -61
  126. package/dist/src/components/gherkin/ExampleDetail.js.map +1 -1
  127. package/dist/src/components/gherkin/Examples.d.ts +1 -1
  128. package/dist/src/components/gherkin/Examples.d.ts.map +1 -1
  129. package/dist/src/components/gherkin/Examples.js +20 -27
  130. package/dist/src/components/gherkin/Examples.js.map +1 -1
  131. package/dist/src/components/gherkin/ExamplesContext.d.ts +1 -1
  132. package/dist/src/components/gherkin/ExamplesContext.js +2 -5
  133. package/dist/src/components/gherkin/ExamplesContext.js.map +1 -1
  134. package/dist/src/components/gherkin/ExamplesTable.d.ts +1 -1
  135. package/dist/src/components/gherkin/ExamplesTable.d.ts.map +1 -1
  136. package/dist/src/components/gherkin/ExamplesTable.js +29 -59
  137. package/dist/src/components/gherkin/ExamplesTable.js.map +1 -1
  138. package/dist/src/components/gherkin/Feature.d.ts +1 -1
  139. package/dist/src/components/gherkin/Feature.d.ts.map +1 -1
  140. package/dist/src/components/gherkin/Feature.js +24 -31
  141. package/dist/src/components/gherkin/Feature.js.map +1 -1
  142. package/dist/src/components/gherkin/GherkinDocument.d.ts +1 -1
  143. package/dist/src/components/gherkin/GherkinDocument.d.ts.map +1 -1
  144. package/dist/src/components/gherkin/GherkinDocument.js +7 -14
  145. package/dist/src/components/gherkin/GherkinDocument.js.map +1 -1
  146. package/dist/src/components/gherkin/GherkinStep.d.ts +1 -1
  147. package/dist/src/components/gherkin/GherkinStep.d.ts.map +1 -1
  148. package/dist/src/components/gherkin/GherkinStep.js +38 -46
  149. package/dist/src/components/gherkin/GherkinStep.js.map +1 -1
  150. package/dist/src/components/gherkin/GherkinSteps.d.ts +1 -1
  151. package/dist/src/components/gherkin/GherkinSteps.d.ts.map +1 -1
  152. package/dist/src/components/gherkin/GherkinSteps.js +10 -17
  153. package/dist/src/components/gherkin/GherkinSteps.js.map +1 -1
  154. package/dist/src/components/gherkin/HookStep.d.ts +1 -1
  155. package/dist/src/components/gherkin/HookStep.d.ts.map +1 -1
  156. package/dist/src/components/gherkin/HookStep.js +22 -52
  157. package/dist/src/components/gherkin/HookStep.js.map +1 -1
  158. package/dist/src/components/gherkin/HookSteps.js +5 -12
  159. package/dist/src/components/gherkin/HookSteps.js.map +1 -1
  160. package/dist/src/components/gherkin/Keyword.d.ts +1 -1
  161. package/dist/src/components/gherkin/Keyword.d.ts.map +1 -1
  162. package/dist/src/components/gherkin/Keyword.js +7 -14
  163. package/dist/src/components/gherkin/Keyword.js.map +1 -1
  164. package/dist/src/components/gherkin/MDG.js +25 -32
  165. package/dist/src/components/gherkin/MDG.js.map +1 -1
  166. package/dist/src/components/gherkin/Parameter.d.ts +1 -1
  167. package/dist/src/components/gherkin/Parameter.d.ts.map +1 -1
  168. package/dist/src/components/gherkin/Parameter.js +7 -14
  169. package/dist/src/components/gherkin/Parameter.js.map +1 -1
  170. package/dist/src/components/gherkin/Rule.d.ts +1 -1
  171. package/dist/src/components/gherkin/Rule.d.ts.map +1 -1
  172. package/dist/src/components/gherkin/Rule.js +22 -29
  173. package/dist/src/components/gherkin/Rule.js.map +1 -1
  174. package/dist/src/components/gherkin/Scenario.d.ts +1 -1
  175. package/dist/src/components/gherkin/Scenario.d.ts.map +1 -1
  176. package/dist/src/components/gherkin/Scenario.js +35 -65
  177. package/dist/src/components/gherkin/Scenario.js.map +1 -1
  178. package/dist/src/components/gherkin/StatusIcon.d.ts +1 -1
  179. package/dist/src/components/gherkin/StatusIcon.d.ts.map +1 -1
  180. package/dist/src/components/gherkin/StatusIcon.js +16 -23
  181. package/dist/src/components/gherkin/StatusIcon.js.map +1 -1
  182. package/dist/src/components/gherkin/StepItem.js +7 -14
  183. package/dist/src/components/gherkin/StepItem.js.map +1 -1
  184. package/dist/src/components/gherkin/StepsList.js +4 -11
  185. package/dist/src/components/gherkin/StepsList.js.map +1 -1
  186. package/dist/src/components/gherkin/Tags.d.ts +1 -1
  187. package/dist/src/components/gherkin/Tags.d.ts.map +1 -1
  188. package/dist/src/components/gherkin/Tags.js +9 -16
  189. package/dist/src/components/gherkin/Tags.js.map +1 -1
  190. package/dist/src/components/gherkin/Title.d.ts +1 -1
  191. package/dist/src/components/gherkin/Title.d.ts.map +1 -1
  192. package/dist/src/components/gherkin/Title.js +9 -16
  193. package/dist/src/components/gherkin/Title.js.map +1 -1
  194. package/dist/src/components/gherkin/attachmentFilename.js +3 -10
  195. package/dist/src/components/gherkin/attachmentFilename.js.map +1 -1
  196. package/dist/src/components/gherkin/index.d.ts +25 -25
  197. package/dist/src/components/gherkin/index.d.ts.map +1 -1
  198. package/dist/src/components/gherkin/index.js +25 -41
  199. package/dist/src/components/gherkin/index.js.map +1 -1
  200. package/dist/src/components/gherkin/isNumber.js +1 -4
  201. package/dist/src/components/gherkin/isNumber.js.map +1 -1
  202. package/dist/src/components/gherkin/statusName.js +1 -3
  203. package/dist/src/components/gherkin/statusName.js.map +1 -1
  204. package/dist/src/components/index.d.ts +4 -4
  205. package/dist/src/components/index.d.ts.map +1 -1
  206. package/dist/src/components/index.js +4 -33
  207. package/dist/src/components/index.js.map +1 -1
  208. package/dist/src/components/results/TestStepResultDetails.d.ts +4 -0
  209. package/dist/src/components/results/TestStepResultDetails.d.ts.map +1 -0
  210. package/dist/src/components/results/TestStepResultDetails.js +16 -0
  211. package/dist/src/components/results/TestStepResultDetails.js.map +1 -0
  212. package/dist/src/components/results/index.d.ts +2 -0
  213. package/dist/src/components/results/index.d.ts.map +1 -0
  214. package/dist/src/components/results/index.js +2 -0
  215. package/dist/src/components/results/index.js.map +1 -0
  216. package/dist/src/countScenariosByStatuses.d.ts +2 -1
  217. package/dist/src/countScenariosByStatuses.d.ts.map +1 -1
  218. package/dist/src/countScenariosByStatuses.js +26 -33
  219. package/dist/src/countScenariosByStatuses.js.map +1 -1
  220. package/dist/src/filter/filterByStatus.d.ts +2 -1
  221. package/dist/src/filter/filterByStatus.d.ts.map +1 -1
  222. package/dist/src/filter/filterByStatus.js +9 -9
  223. package/dist/src/filter/filterByStatus.js.map +1 -1
  224. package/dist/src/hooks/index.d.ts +2 -2
  225. package/dist/src/hooks/index.d.ts.map +1 -1
  226. package/dist/src/hooks/index.js +2 -18
  227. package/dist/src/hooks/index.js.map +1 -1
  228. package/dist/src/hooks/useFilteredDocuments.d.ts +3 -0
  229. package/dist/src/hooks/useFilteredDocuments.d.ts.map +1 -0
  230. package/dist/src/hooks/useFilteredDocuments.js +27 -0
  231. package/dist/src/hooks/useFilteredDocuments.js.map +1 -0
  232. package/dist/src/hooks/useQueries.d.ts +1 -1
  233. package/dist/src/hooks/useQueries.d.ts.map +1 -1
  234. package/dist/src/hooks/useQueries.js +8 -15
  235. package/dist/src/hooks/useQueries.js.map +1 -1
  236. package/dist/src/hooks/useResultStatistics.d.ts +6 -0
  237. package/dist/src/hooks/useResultStatistics.d.ts.map +1 -0
  238. package/dist/src/hooks/useResultStatistics.js +7 -0
  239. package/dist/src/hooks/useResultStatistics.js.map +1 -0
  240. package/dist/src/hooks/useSearch.d.ts +1 -1
  241. package/dist/src/hooks/useSearch.d.ts.map +1 -1
  242. package/dist/src/hooks/useSearch.js +4 -11
  243. package/dist/src/hooks/useSearch.js.map +1 -1
  244. package/dist/src/index.d.ts +7 -7
  245. package/dist/src/index.d.ts.map +1 -1
  246. package/dist/src/index.js +8 -43
  247. package/dist/src/index.js.map +1 -1
  248. package/dist/src/isTagExpression.js +1 -4
  249. package/dist/src/isTagExpression.js.map +1 -1
  250. package/dist/src/search/FeatureSearch.d.ts +3 -7
  251. package/dist/src/search/FeatureSearch.d.ts.map +1 -1
  252. package/dist/src/search/FeatureSearch.js +31 -31
  253. package/dist/src/search/FeatureSearch.js.map +1 -1
  254. package/dist/src/search/ScenarioLikeSearch.d.ts +25 -0
  255. package/dist/src/search/ScenarioLikeSearch.d.ts.map +1 -0
  256. package/dist/src/search/ScenarioLikeSearch.js +41 -0
  257. package/dist/src/search/ScenarioLikeSearch.js.map +1 -0
  258. package/dist/src/search/Search.d.ts +9 -9
  259. package/dist/src/search/Search.d.ts.map +1 -1
  260. package/dist/src/search/Search.js +34 -20
  261. package/dist/src/search/Search.js.map +1 -1
  262. package/dist/src/search/StepSearch.d.ts +16 -8
  263. package/dist/src/search/StepSearch.d.ts.map +1 -1
  264. package/dist/src/search/StepSearch.js +33 -44
  265. package/dist/src/search/StepSearch.js.map +1 -1
  266. package/dist/src/search/TagSearch.d.ts +2 -10
  267. package/dist/src/search/TagSearch.d.ts.map +1 -1
  268. package/dist/src/search/TagSearch.js +17 -18
  269. package/dist/src/search/TagSearch.js.map +1 -1
  270. package/dist/src/search/TextSearch.d.ts +2 -11
  271. package/dist/src/search/TextSearch.d.ts.map +1 -1
  272. package/dist/src/search/TextSearch.js +47 -36
  273. package/dist/src/search/TextSearch.js.map +1 -1
  274. package/dist/src/search/index.d.ts +3 -0
  275. package/dist/src/search/index.d.ts.map +1 -0
  276. package/dist/src/search/index.js +3 -0
  277. package/dist/src/search/index.js.map +1 -0
  278. package/dist/src/search/types.d.ts +14 -0
  279. package/dist/src/search/types.d.ts.map +1 -0
  280. package/dist/src/search/types.js +2 -0
  281. package/dist/src/search/types.js.map +1 -0
  282. package/dist/src/toRepositoryId.js +1 -4
  283. package/dist/src/toRepositoryId.js.map +1 -1
  284. package/dist/tsconfig.build.tsbuildinfo +1 -1
  285. package/package.json +35 -27
  286. package/dist/src/search/RuleSearch.d.ts +0 -9
  287. package/dist/src/search/RuleSearch.d.ts.map +0 -1
  288. package/dist/src/search/RuleSearch.js +0 -42
  289. package/dist/src/search/RuleSearch.js.map +0 -1
  290. package/dist/src/search/ScenarioSearch.d.ts +0 -9
  291. package/dist/src/search/ScenarioSearch.d.ts.map +0 -1
  292. package/dist/src/search/ScenarioSearch.js +0 -42
  293. package/dist/src/search/ScenarioSearch.js.map +0 -1
@@ -1,12 +1,3 @@
1
- import * as messages from '@cucumber/messages';
2
- export default class TextSearch {
3
- private readonly featureSearch;
4
- private readonly backgroundSearch;
5
- private readonly scenarioSearch;
6
- private readonly stepSearch;
7
- private readonly ruleSearch;
8
- private readonly gherkinDocuments;
9
- search(query: string): messages.GherkinDocument[];
10
- add(gherkinDocument: messages.GherkinDocument): void;
11
- }
1
+ import { Searchable } from './types.js';
2
+ export declare function createTextSearch(): Promise<Searchable>;
12
3
  //# sourceMappingURL=TextSearch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextSearch.d.ts","sourceRoot":"","sources":["../../../src/search/TextSearch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAA;AAQ9C,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAsB;IACpD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAuB;IACxD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAuB;IACtD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmB;IAC9C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmB;IAE9C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAiC;IAE3D,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC,eAAe,EAAE;IAuBjD,GAAG,CAAC,eAAe,EAAE,QAAQ,CAAC,eAAe;CAerD"}
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,52 +1,63 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const gherkin_utils_1 = require("@cucumber/gherkin-utils");
7
- const FeatureSearch_1 = __importDefault(require("./FeatureSearch"));
8
- const RuleSearch_1 = __importDefault(require("./RuleSearch"));
9
- const ScenarioSearch_1 = __importDefault(require("./ScenarioSearch"));
10
- const StepSearch_1 = __importDefault(require("./StepSearch"));
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';
11
5
  class TextSearch {
12
- constructor() {
13
- this.featureSearch = new FeatureSearch_1.default();
14
- this.backgroundSearch = new ScenarioSearch_1.default();
15
- this.scenarioSearch = new ScenarioSearch_1.default();
16
- this.stepSearch = new StepSearch_1.default();
17
- this.ruleSearch = new RuleSearch_1.default();
18
- this.gherkinDocuments = [];
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;
19
18
  }
20
- search(query) {
21
- const matchingSteps = this.stepSearch.search(query);
22
- const matchingBackgrounds = this.backgroundSearch.search(query);
23
- const matchingScenarios = this.scenarioSearch.search(query);
24
- const matchingRules = this.ruleSearch.search(query);
25
- const matchingFeatures = this.featureSearch.search(query);
26
- const walker = new gherkin_utils_1.GherkinDocumentWalker({
19
+ async search(query) {
20
+ const [matchingSteps, matchingBackgrounds, matchingScenarios, matchingRules, matchingFeatures] = await Promise.all([
21
+ this.stepSearch.search(query),
22
+ this.backgroundSearch.search(query),
23
+ this.scenarioSearch.search(query),
24
+ this.ruleSearch.search(query),
25
+ this.featureSearch.search(query),
26
+ ]);
27
+ const walker = new GherkinDocumentWalker({
27
28
  acceptStep: (step) => matchingSteps.includes(step),
28
- acceptScenario: (scenario) => matchingScenarios.includes(scenario),
29
- // TODO: This is an ugly hack to work around the fact that Scenario and Background are no longer interchangeable,
30
- // because tags is now mandatory.
31
29
  acceptBackground: (background) => matchingBackgrounds.includes(background),
30
+ acceptScenario: (scenario) => matchingScenarios.includes(scenario),
32
31
  acceptRule: (rule) => matchingRules.includes(rule),
33
32
  acceptFeature: (feature) => matchingFeatures.includes(feature),
34
33
  });
35
34
  return this.gherkinDocuments
36
35
  .map((gherkinDocument) => walker.walkGherkinDocument(gherkinDocument))
37
- .filter((gherkinDocument) => gherkinDocument !== null);
36
+ .filter((gherkinDocument) => !!gherkinDocument);
38
37
  }
39
- add(gherkinDocument) {
38
+ async add(gherkinDocument) {
40
39
  this.gherkinDocuments.push(gherkinDocument);
41
- const walker = new gherkin_utils_1.GherkinDocumentWalker({}, {
42
- handleStep: (step) => this.stepSearch.add(step),
43
- handleScenario: (scenario) => this.scenarioSearch.add(scenario),
44
- handleBackground: (background) => this.backgroundSearch.add(background),
45
- handleRule: (rule) => this.ruleSearch.add(rule),
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)),
46
46
  });
47
- this.featureSearch.add(gherkinDocument);
47
+ promises.push(this.featureSearch.add(gherkinDocument));
48
48
  walker.walkGherkinDocument(gherkinDocument);
49
+ await Promise.all(promises);
50
+ return this;
49
51
  }
50
52
  }
51
- exports.default = TextSearch;
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
+ }
52
63
  //# sourceMappingURL=TextSearch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextSearch.js","sourceRoot":"","sources":["../../../src/search/TextSearch.ts"],"names":[],"mappings":";;;;;AAAA,2DAA+D;AAI/D,oEAA2C;AAC3C,8DAAqC;AACrC,sEAA6C;AAC7C,8DAAqC;AAErC,MAAqB,UAAU;IAA/B;QACmB,kBAAa,GAAG,IAAI,uBAAa,EAAE,CAAA;QACnC,qBAAgB,GAAG,IAAI,wBAAc,EAAE,CAAA;QACvC,mBAAc,GAAG,IAAI,wBAAc,EAAE,CAAA;QACrC,eAAU,GAAG,IAAI,oBAAU,EAAE,CAAA;QAC7B,eA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EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,CAAC,GAC7E,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,gBAAgB,EAAE;QAClB,wBAAwB,EAAc;QACtC,wBAAwB,EAAY;QACpC,wBAAwB,EAAQ;QAChC,mBAAmB,EAAE;KACtB,CAAC,CAAA;IACJ,OAAO,IAAI,UAAU,CAAC,UAAU,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,CAAC,CAAA;AAChG,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { createSearch } from './Search.js';
2
+ export * from './types.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,3 @@
1
+ export { createSearch } from './Search.js';
2
+ export * from './types.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,cAAc,YAAY,CAAA"}
@@ -0,0 +1,14 @@
1
+ import { GherkinDocument } from '@cucumber/messages';
2
+ /**
3
+ * Facade for an index that supports searching for and adding items of a given
4
+ * type. Also supports a different type being added if needed.
5
+ */
6
+ export interface TypedIndex<ReturnedType, SourceType = ReturnedType> {
7
+ search: (query: string) => Promise<readonly ReturnedType[]>;
8
+ add: (item: SourceType) => Promise<this>;
9
+ }
10
+ /**
11
+ * Shorthand type for an index of Gherkin documents.
12
+ */
13
+ export type Searchable = TypedIndex<GherkinDocument>;
14
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/search/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD;;;GAGG;AACH,MAAM,WAAW,UAAU,CAAC,YAAY,EAAE,UAAU,GAAG,YAAY;IACjE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC,CAAA;IAC3D,GAAG,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACzC;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/search/types.ts"],"names":[],"mappings":""}
@@ -1,6 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function toRepositoryId(s) {
1
+ export default function toRepositoryId(s) {
4
2
  if (!s.includes('://') && s.includes(':')) {
5
3
  // scp style URL (not really a URL)
6
4
  const [host, path] = s.split(':', 2);
@@ -10,5 +8,4 @@ function toRepositoryId(s) {
10
8
  const url = new URL(s);
11
9
  return `${url.hostname}${url.pathname}`;
12
10
  }
13
- exports.default = toRepositoryId;
14
11
  //# sourceMappingURL=toRepositoryId.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"toRepositoryId.js","sourceRoot":"","sources":["../../src/toRepositoryId.ts"],"names":[],"mappings":";;AAAA,SAAwB,cAAc,CAAC,CAAS;IAC9C,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACzC,mCAAmC;QACnC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QACpC,CAAC,GAAG,SAAS,IAAI,IAAI,IAAI,EAAE,CAAA;KAC5B;IACD,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;IAC3B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAA;IACtB,OAAO,GAAG,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAA;AACzC,CAAC;AATD,iCASC"}
1
+ {"version":3,"file":"toRepositoryId.js","sourceRoot":"","sources":["../../src/toRepositoryId.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAS;IAC9C,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACzC,mCAAmC;QACnC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QACpC,CAAC,GAAG,SAAS,IAAI,IAAI,IAAI,EAAE,CAAA;KAC5B;IACD,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;IAC3B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAA;IACtB,OAAO,GAAG,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAA;AACzC,CAAC"}