mcp-server-azure-devops 1.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 (929) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +265 -0
  3. package/dist/clients/azure-devops.d.ts +105 -0
  4. package/dist/clients/azure-devops.js +492 -0
  5. package/dist/clients/azure-devops.js.map +1 -0
  6. package/dist/clients/azure-devops.spec.unit.d.ts +1 -0
  7. package/dist/clients/azure-devops.spec.unit.js +37 -0
  8. package/dist/clients/azure-devops.spec.unit.js.map +1 -0
  9. package/dist/extension.d.ts +3 -0
  10. package/dist/extension.js +93 -0
  11. package/dist/extension.js.map +1 -0
  12. package/dist/features/organizations/__test__/test-helpers.d.ts +13 -0
  13. package/dist/features/organizations/__test__/test-helpers.js +34 -0
  14. package/dist/features/organizations/__test__/test-helpers.js.map +1 -0
  15. package/dist/features/organizations/index.d.ts +13 -0
  16. package/dist/features/organizations/index.js +44 -0
  17. package/dist/features/organizations/index.js.map +1 -0
  18. package/dist/features/organizations/index.spec.unit.d.ts +1 -0
  19. package/dist/features/organizations/index.spec.unit.js +71 -0
  20. package/dist/features/organizations/index.spec.unit.js.map +1 -0
  21. package/dist/features/organizations/list-organizations/feature.d.ts +13 -0
  22. package/dist/features/organizations/list-organizations/feature.js +95 -0
  23. package/dist/features/organizations/list-organizations/feature.js.map +1 -0
  24. package/dist/features/organizations/list-organizations/feature.spec.int.d.ts +1 -0
  25. package/dist/features/organizations/list-organizations/feature.spec.int.js +32 -0
  26. package/dist/features/organizations/list-organizations/feature.spec.int.js.map +1 -0
  27. package/dist/features/organizations/list-organizations/feature.spec.unit.d.ts +1 -0
  28. package/dist/features/organizations/list-organizations/feature.spec.unit.js +110 -0
  29. package/dist/features/organizations/list-organizations/feature.spec.unit.js.map +1 -0
  30. package/dist/features/organizations/list-organizations/index.d.ts +2 -0
  31. package/dist/features/organizations/list-organizations/index.js +3 -0
  32. package/dist/features/organizations/list-organizations/index.js.map +1 -0
  33. package/dist/features/organizations/list-organizations/schema.d.ts +2 -0
  34. package/dist/features/organizations/list-organizations/schema.js +3 -0
  35. package/dist/features/organizations/list-organizations/schema.js.map +1 -0
  36. package/dist/features/organizations/schemas.d.ts +6 -0
  37. package/dist/features/organizations/schemas.js +7 -0
  38. package/dist/features/organizations/schemas.js.map +1 -0
  39. package/dist/features/organizations/tool-definitions.d.ts +5 -0
  40. package/dist/features/organizations/tool-definitions.js +13 -0
  41. package/dist/features/organizations/tool-definitions.js.map +1 -0
  42. package/dist/features/organizations/types.d.ts +21 -0
  43. package/dist/features/organizations/types.js +5 -0
  44. package/dist/features/organizations/types.js.map +1 -0
  45. package/dist/features/pipelines/artifacts.d.ts +11 -0
  46. package/dist/features/pipelines/artifacts.js +280 -0
  47. package/dist/features/pipelines/artifacts.js.map +1 -0
  48. package/dist/features/pipelines/artifacts.spec.unit.d.ts +1 -0
  49. package/dist/features/pipelines/artifacts.spec.unit.js +98 -0
  50. package/dist/features/pipelines/artifacts.spec.unit.js.map +1 -0
  51. package/dist/features/pipelines/download-pipeline-artifact/feature.d.ts +3 -0
  52. package/dist/features/pipelines/download-pipeline-artifact/feature.js +216 -0
  53. package/dist/features/pipelines/download-pipeline-artifact/feature.js.map +1 -0
  54. package/dist/features/pipelines/download-pipeline-artifact/feature.spec.unit.d.ts +1 -0
  55. package/dist/features/pipelines/download-pipeline-artifact/feature.spec.unit.js +63 -0
  56. package/dist/features/pipelines/download-pipeline-artifact/feature.spec.unit.js.map +1 -0
  57. package/dist/features/pipelines/download-pipeline-artifact/index.d.ts +2 -0
  58. package/dist/features/pipelines/download-pipeline-artifact/index.js +3 -0
  59. package/dist/features/pipelines/download-pipeline-artifact/index.js.map +1 -0
  60. package/dist/features/pipelines/download-pipeline-artifact/schema.d.ts +17 -0
  61. package/dist/features/pipelines/download-pipeline-artifact/schema.js +20 -0
  62. package/dist/features/pipelines/download-pipeline-artifact/schema.js.map +1 -0
  63. package/dist/features/pipelines/get-pipeline/feature.d.ts +10 -0
  64. package/dist/features/pipelines/get-pipeline/feature.js +43 -0
  65. package/dist/features/pipelines/get-pipeline/feature.js.map +1 -0
  66. package/dist/features/pipelines/get-pipeline/feature.spec.int.d.ts +1 -0
  67. package/dist/features/pipelines/get-pipeline/feature.spec.int.js +52 -0
  68. package/dist/features/pipelines/get-pipeline/feature.spec.int.js.map +1 -0
  69. package/dist/features/pipelines/get-pipeline/feature.spec.unit.d.ts +1 -0
  70. package/dist/features/pipelines/get-pipeline/feature.spec.unit.js +87 -0
  71. package/dist/features/pipelines/get-pipeline/feature.spec.unit.js.map +1 -0
  72. package/dist/features/pipelines/get-pipeline/index.d.ts +2 -0
  73. package/dist/features/pipelines/get-pipeline/index.js +3 -0
  74. package/dist/features/pipelines/get-pipeline/index.js.map +1 -0
  75. package/dist/features/pipelines/get-pipeline/schema.d.ts +17 -0
  76. package/dist/features/pipelines/get-pipeline/schema.js +26 -0
  77. package/dist/features/pipelines/get-pipeline/schema.js.map +1 -0
  78. package/dist/features/pipelines/get-pipeline-log/feature.d.ts +3 -0
  79. package/dist/features/pipelines/get-pipeline-log/feature.js +54 -0
  80. package/dist/features/pipelines/get-pipeline-log/feature.js.map +1 -0
  81. package/dist/features/pipelines/get-pipeline-log/feature.spec.unit.d.ts +1 -0
  82. package/dist/features/pipelines/get-pipeline-log/feature.spec.unit.js +79 -0
  83. package/dist/features/pipelines/get-pipeline-log/feature.spec.unit.js.map +1 -0
  84. package/dist/features/pipelines/get-pipeline-log/index.d.ts +2 -0
  85. package/dist/features/pipelines/get-pipeline-log/index.js +3 -0
  86. package/dist/features/pipelines/get-pipeline-log/index.js.map +1 -0
  87. package/dist/features/pipelines/get-pipeline-log/schema.d.ts +26 -0
  88. package/dist/features/pipelines/get-pipeline-log/schema.js +37 -0
  89. package/dist/features/pipelines/get-pipeline-log/schema.js.map +1 -0
  90. package/dist/features/pipelines/get-pipeline-run/feature.d.ts +3 -0
  91. package/dist/features/pipelines/get-pipeline-run/feature.js +73 -0
  92. package/dist/features/pipelines/get-pipeline-run/feature.js.map +1 -0
  93. package/dist/features/pipelines/get-pipeline-run/feature.spec.unit.d.ts +1 -0
  94. package/dist/features/pipelines/get-pipeline-run/feature.spec.unit.js +154 -0
  95. package/dist/features/pipelines/get-pipeline-run/feature.spec.unit.js.map +1 -0
  96. package/dist/features/pipelines/get-pipeline-run/index.d.ts +2 -0
  97. package/dist/features/pipelines/get-pipeline-run/index.js +3 -0
  98. package/dist/features/pipelines/get-pipeline-run/index.js.map +1 -0
  99. package/dist/features/pipelines/get-pipeline-run/schema.d.ts +14 -0
  100. package/dist/features/pipelines/get-pipeline-run/schema.js +16 -0
  101. package/dist/features/pipelines/get-pipeline-run/schema.js.map +1 -0
  102. package/dist/features/pipelines/helpers.d.ts +3 -0
  103. package/dist/features/pipelines/helpers.js +25 -0
  104. package/dist/features/pipelines/helpers.js.map +1 -0
  105. package/dist/features/pipelines/index.d.ts +19 -0
  106. package/dist/features/pipelines/index.js +137 -0
  107. package/dist/features/pipelines/index.js.map +1 -0
  108. package/dist/features/pipelines/index.spec.unit.d.ts +1 -0
  109. package/dist/features/pipelines/index.spec.unit.js +221 -0
  110. package/dist/features/pipelines/index.spec.unit.js.map +1 -0
  111. package/dist/features/pipelines/list-pipeline-runs/feature.d.ts +3 -0
  112. package/dist/features/pipelines/list-pipeline-runs/feature.js +95 -0
  113. package/dist/features/pipelines/list-pipeline-runs/feature.js.map +1 -0
  114. package/dist/features/pipelines/list-pipeline-runs/feature.spec.unit.d.ts +1 -0
  115. package/dist/features/pipelines/list-pipeline-runs/feature.spec.unit.js +146 -0
  116. package/dist/features/pipelines/list-pipeline-runs/feature.spec.unit.js.map +1 -0
  117. package/dist/features/pipelines/list-pipeline-runs/index.d.ts +2 -0
  118. package/dist/features/pipelines/list-pipeline-runs/index.js +3 -0
  119. package/dist/features/pipelines/list-pipeline-runs/index.js.map +1 -0
  120. package/dist/features/pipelines/list-pipeline-runs/schema.d.ts +35 -0
  121. package/dist/features/pipelines/list-pipeline-runs/schema.js +47 -0
  122. package/dist/features/pipelines/list-pipeline-runs/schema.js.map +1 -0
  123. package/dist/features/pipelines/list-pipelines/feature.d.ts +10 -0
  124. package/dist/features/pipelines/list-pipelines/feature.js +39 -0
  125. package/dist/features/pipelines/list-pipelines/feature.js.map +1 -0
  126. package/dist/features/pipelines/list-pipelines/feature.spec.int.d.ts +1 -0
  127. package/dist/features/pipelines/list-pipelines/feature.spec.int.js +34 -0
  128. package/dist/features/pipelines/list-pipelines/feature.spec.int.js.map +1 -0
  129. package/dist/features/pipelines/list-pipelines/feature.spec.unit.d.ts +1 -0
  130. package/dist/features/pipelines/list-pipelines/feature.spec.unit.js +89 -0
  131. package/dist/features/pipelines/list-pipelines/feature.spec.unit.js.map +1 -0
  132. package/dist/features/pipelines/list-pipelines/index.d.ts +2 -0
  133. package/dist/features/pipelines/list-pipelines/index.js +3 -0
  134. package/dist/features/pipelines/list-pipelines/index.js.map +1 -0
  135. package/dist/features/pipelines/list-pipelines/schema.d.ts +17 -0
  136. package/dist/features/pipelines/list-pipelines/schema.js +20 -0
  137. package/dist/features/pipelines/list-pipelines/schema.js.map +1 -0
  138. package/dist/features/pipelines/pipeline-timeline/feature.d.ts +3 -0
  139. package/dist/features/pipelines/pipeline-timeline/feature.js +92 -0
  140. package/dist/features/pipelines/pipeline-timeline/feature.js.map +1 -0
  141. package/dist/features/pipelines/pipeline-timeline/feature.spec.unit.d.ts +1 -0
  142. package/dist/features/pipelines/pipeline-timeline/feature.spec.unit.js +98 -0
  143. package/dist/features/pipelines/pipeline-timeline/feature.spec.unit.js.map +1 -0
  144. package/dist/features/pipelines/pipeline-timeline/index.d.ts +2 -0
  145. package/dist/features/pipelines/pipeline-timeline/index.js +3 -0
  146. package/dist/features/pipelines/pipeline-timeline/index.js.map +1 -0
  147. package/dist/features/pipelines/pipeline-timeline/schema.d.ts +23 -0
  148. package/dist/features/pipelines/pipeline-timeline/schema.js +48 -0
  149. package/dist/features/pipelines/pipeline-timeline/schema.js.map +1 -0
  150. package/dist/features/pipelines/tool-definitions.d.ts +5 -0
  151. package/dist/features/pipelines/tool-definitions.js +63 -0
  152. package/dist/features/pipelines/tool-definitions.js.map +1 -0
  153. package/dist/features/pipelines/trigger-pipeline/feature.d.ts +10 -0
  154. package/dist/features/pipelines/trigger-pipeline/feature.js +62 -0
  155. package/dist/features/pipelines/trigger-pipeline/feature.js.map +1 -0
  156. package/dist/features/pipelines/trigger-pipeline/feature.spec.int.d.ts +1 -0
  157. package/dist/features/pipelines/trigger-pipeline/feature.spec.int.js +83 -0
  158. package/dist/features/pipelines/trigger-pipeline/feature.spec.int.js.map +1 -0
  159. package/dist/features/pipelines/trigger-pipeline/feature.spec.unit.d.ts +1 -0
  160. package/dist/features/pipelines/trigger-pipeline/feature.spec.unit.js +110 -0
  161. package/dist/features/pipelines/trigger-pipeline/feature.spec.unit.js.map +1 -0
  162. package/dist/features/pipelines/trigger-pipeline/index.d.ts +2 -0
  163. package/dist/features/pipelines/trigger-pipeline/index.js +3 -0
  164. package/dist/features/pipelines/trigger-pipeline/index.js.map +1 -0
  165. package/dist/features/pipelines/trigger-pipeline/schema.d.ts +41 -0
  166. package/dist/features/pipelines/trigger-pipeline/schema.js +42 -0
  167. package/dist/features/pipelines/trigger-pipeline/schema.js.map +1 -0
  168. package/dist/features/pipelines/types.d.ts +122 -0
  169. package/dist/features/pipelines/types.js +2 -0
  170. package/dist/features/pipelines/types.js.map +1 -0
  171. package/dist/features/projects/__test__/test-helpers.d.ts +13 -0
  172. package/dist/features/projects/__test__/test-helpers.js +31 -0
  173. package/dist/features/projects/__test__/test-helpers.js.map +1 -0
  174. package/dist/features/projects/get-project/feature.d.ts +11 -0
  175. package/dist/features/projects/get-project/feature.js +26 -0
  176. package/dist/features/projects/get-project/feature.js.map +1 -0
  177. package/dist/features/projects/get-project/feature.spec.int.d.ts +1 -0
  178. package/dist/features/projects/get-project/feature.spec.int.js +37 -0
  179. package/dist/features/projects/get-project/feature.spec.int.js.map +1 -0
  180. package/dist/features/projects/get-project/feature.spec.unit.d.ts +1 -0
  181. package/dist/features/projects/get-project/feature.spec.unit.js +39 -0
  182. package/dist/features/projects/get-project/feature.spec.unit.js.map +1 -0
  183. package/dist/features/projects/get-project/index.d.ts +2 -0
  184. package/dist/features/projects/get-project/index.js +3 -0
  185. package/dist/features/projects/get-project/index.js.map +1 -0
  186. package/dist/features/projects/get-project/schema.d.ts +2 -0
  187. package/dist/features/projects/get-project/schema.js +3 -0
  188. package/dist/features/projects/get-project/schema.js.map +1 -0
  189. package/dist/features/projects/get-project-details/feature.d.ts +78 -0
  190. package/dist/features/projects/get-project-details/feature.js +182 -0
  191. package/dist/features/projects/get-project-details/feature.js.map +1 -0
  192. package/dist/features/projects/get-project-details/feature.spec.int.d.ts +1 -0
  193. package/dist/features/projects/get-project-details/feature.spec.int.js +118 -0
  194. package/dist/features/projects/get-project-details/feature.spec.int.js.map +1 -0
  195. package/dist/features/projects/get-project-details/feature.spec.unit.d.ts +1 -0
  196. package/dist/features/projects/get-project-details/feature.spec.unit.js +377 -0
  197. package/dist/features/projects/get-project-details/feature.spec.unit.js.map +1 -0
  198. package/dist/features/projects/get-project-details/index.d.ts +2 -0
  199. package/dist/features/projects/get-project-details/index.js +3 -0
  200. package/dist/features/projects/get-project-details/index.js.map +1 -0
  201. package/dist/features/projects/get-project-details/schema.d.ts +2 -0
  202. package/dist/features/projects/get-project-details/schema.js +3 -0
  203. package/dist/features/projects/get-project-details/schema.js.map +1 -0
  204. package/dist/features/projects/index.d.ts +15 -0
  205. package/dist/features/projects/index.js +61 -0
  206. package/dist/features/projects/index.js.map +1 -0
  207. package/dist/features/projects/index.spec.unit.d.ts +1 -0
  208. package/dist/features/projects/index.spec.unit.js +129 -0
  209. package/dist/features/projects/index.spec.unit.js.map +1 -0
  210. package/dist/features/projects/list-projects/feature.d.ts +10 -0
  211. package/dist/features/projects/list-projects/feature.js +22 -0
  212. package/dist/features/projects/list-projects/feature.js.map +1 -0
  213. package/dist/features/projects/list-projects/feature.spec.int.d.ts +1 -0
  214. package/dist/features/projects/list-projects/feature.spec.int.js +52 -0
  215. package/dist/features/projects/list-projects/feature.spec.int.js.map +1 -0
  216. package/dist/features/projects/list-projects/index.d.ts +2 -0
  217. package/dist/features/projects/list-projects/index.js +3 -0
  218. package/dist/features/projects/list-projects/index.js.map +1 -0
  219. package/dist/features/projects/list-projects/schema.d.ts +2 -0
  220. package/dist/features/projects/list-projects/schema.js +3 -0
  221. package/dist/features/projects/list-projects/schema.js.map +1 -0
  222. package/dist/features/projects/schemas.d.ts +64 -0
  223. package/dist/features/projects/schemas.js +73 -0
  224. package/dist/features/projects/schemas.js.map +1 -0
  225. package/dist/features/projects/tool-definitions.d.ts +5 -0
  226. package/dist/features/projects/tool-definitions.js +23 -0
  227. package/dist/features/projects/tool-definitions.js.map +1 -0
  228. package/dist/features/projects/types.d.ts +11 -0
  229. package/dist/features/projects/types.js +2 -0
  230. package/dist/features/projects/types.js.map +1 -0
  231. package/dist/features/pull-requests/add-pull-request-comment/feature.d.ts +13 -0
  232. package/dist/features/pull-requests/add-pull-request-comment/feature.js +127 -0
  233. package/dist/features/pull-requests/add-pull-request-comment/feature.js.map +1 -0
  234. package/dist/features/pull-requests/add-pull-request-comment/feature.spec.int.d.ts +1 -0
  235. package/dist/features/pull-requests/add-pull-request-comment/feature.spec.int.js +184 -0
  236. package/dist/features/pull-requests/add-pull-request-comment/feature.spec.int.js.map +1 -0
  237. package/dist/features/pull-requests/add-pull-request-comment/feature.spec.unit.d.ts +1 -0
  238. package/dist/features/pull-requests/add-pull-request-comment/feature.spec.unit.js +257 -0
  239. package/dist/features/pull-requests/add-pull-request-comment/feature.spec.unit.js.map +1 -0
  240. package/dist/features/pull-requests/add-pull-request-comment/index.d.ts +1 -0
  241. package/dist/features/pull-requests/add-pull-request-comment/index.js +2 -0
  242. package/dist/features/pull-requests/add-pull-request-comment/index.js.map +1 -0
  243. package/dist/features/pull-requests/create-pull-request/feature.d.ts +12 -0
  244. package/dist/features/pull-requests/create-pull-request/feature.js +96 -0
  245. package/dist/features/pull-requests/create-pull-request/feature.js.map +1 -0
  246. package/dist/features/pull-requests/create-pull-request/feature.spec.int.d.ts +1 -0
  247. package/dist/features/pull-requests/create-pull-request/feature.spec.int.js +109 -0
  248. package/dist/features/pull-requests/create-pull-request/feature.spec.int.js.map +1 -0
  249. package/dist/features/pull-requests/create-pull-request/feature.spec.unit.d.ts +1 -0
  250. package/dist/features/pull-requests/create-pull-request/feature.spec.unit.js +110 -0
  251. package/dist/features/pull-requests/create-pull-request/feature.spec.unit.js.map +1 -0
  252. package/dist/features/pull-requests/create-pull-request/index.d.ts +2 -0
  253. package/dist/features/pull-requests/create-pull-request/index.js +3 -0
  254. package/dist/features/pull-requests/create-pull-request/index.js.map +1 -0
  255. package/dist/features/pull-requests/create-pull-request/schema.d.ts +2 -0
  256. package/dist/features/pull-requests/create-pull-request/schema.js +3 -0
  257. package/dist/features/pull-requests/create-pull-request/schema.js.map +1 -0
  258. package/dist/features/pull-requests/get-pull-request/feature.d.ts +6 -0
  259. package/dist/features/pull-requests/get-pull-request/feature.js +19 -0
  260. package/dist/features/pull-requests/get-pull-request/feature.js.map +1 -0
  261. package/dist/features/pull-requests/get-pull-request/feature.spec.int.d.ts +1 -0
  262. package/dist/features/pull-requests/get-pull-request/feature.spec.int.js +107 -0
  263. package/dist/features/pull-requests/get-pull-request/feature.spec.int.js.map +1 -0
  264. package/dist/features/pull-requests/get-pull-request/feature.spec.unit.d.ts +1 -0
  265. package/dist/features/pull-requests/get-pull-request/feature.spec.unit.js +35 -0
  266. package/dist/features/pull-requests/get-pull-request/feature.spec.unit.js.map +1 -0
  267. package/dist/features/pull-requests/get-pull-request/index.d.ts +2 -0
  268. package/dist/features/pull-requests/get-pull-request/index.js +3 -0
  269. package/dist/features/pull-requests/get-pull-request/index.js.map +1 -0
  270. package/dist/features/pull-requests/get-pull-request/schema.d.ts +1 -0
  271. package/dist/features/pull-requests/get-pull-request/schema.js +2 -0
  272. package/dist/features/pull-requests/get-pull-request/schema.js.map +1 -0
  273. package/dist/features/pull-requests/get-pull-request-changes/feature.d.ts +22 -0
  274. package/dist/features/pull-requests/get-pull-request-changes/feature.js +57 -0
  275. package/dist/features/pull-requests/get-pull-request-changes/feature.js.map +1 -0
  276. package/dist/features/pull-requests/get-pull-request-changes/feature.spec.unit.d.ts +1 -0
  277. package/dist/features/pull-requests/get-pull-request-changes/feature.spec.unit.js +75 -0
  278. package/dist/features/pull-requests/get-pull-request-changes/feature.spec.unit.js.map +1 -0
  279. package/dist/features/pull-requests/get-pull-request-changes/index.d.ts +1 -0
  280. package/dist/features/pull-requests/get-pull-request-changes/index.js +2 -0
  281. package/dist/features/pull-requests/get-pull-request-changes/index.js.map +1 -0
  282. package/dist/features/pull-requests/get-pull-request-checks/feature.d.ts +51 -0
  283. package/dist/features/pull-requests/get-pull-request-checks/feature.js +256 -0
  284. package/dist/features/pull-requests/get-pull-request-checks/feature.js.map +1 -0
  285. package/dist/features/pull-requests/get-pull-request-checks/feature.spec.unit.d.ts +1 -0
  286. package/dist/features/pull-requests/get-pull-request-checks/feature.spec.unit.js +136 -0
  287. package/dist/features/pull-requests/get-pull-request-checks/feature.spec.unit.js.map +1 -0
  288. package/dist/features/pull-requests/get-pull-request-checks/index.d.ts +1 -0
  289. package/dist/features/pull-requests/get-pull-request-checks/index.js +2 -0
  290. package/dist/features/pull-requests/get-pull-request-checks/index.js.map +1 -0
  291. package/dist/features/pull-requests/get-pull-request-comments/feature.d.ts +13 -0
  292. package/dist/features/pull-requests/get-pull-request-comments/feature.js +85 -0
  293. package/dist/features/pull-requests/get-pull-request-comments/feature.js.map +1 -0
  294. package/dist/features/pull-requests/get-pull-request-comments/feature.spec.int.d.ts +1 -0
  295. package/dist/features/pull-requests/get-pull-request-comments/feature.spec.int.js +214 -0
  296. package/dist/features/pull-requests/get-pull-request-comments/feature.spec.int.js.map +1 -0
  297. package/dist/features/pull-requests/get-pull-request-comments/feature.spec.unit.d.ts +1 -0
  298. package/dist/features/pull-requests/get-pull-request-comments/feature.spec.unit.js +338 -0
  299. package/dist/features/pull-requests/get-pull-request-comments/feature.spec.unit.js.map +1 -0
  300. package/dist/features/pull-requests/get-pull-request-comments/index.d.ts +1 -0
  301. package/dist/features/pull-requests/get-pull-request-comments/index.js +2 -0
  302. package/dist/features/pull-requests/get-pull-request-comments/index.js.map +1 -0
  303. package/dist/features/pull-requests/index.d.ts +20 -0
  304. package/dist/features/pull-requests/index.js +138 -0
  305. package/dist/features/pull-requests/index.js.map +1 -0
  306. package/dist/features/pull-requests/index.spec.unit.d.ts +1 -0
  307. package/dist/features/pull-requests/index.spec.unit.js +259 -0
  308. package/dist/features/pull-requests/index.spec.unit.js.map +1 -0
  309. package/dist/features/pull-requests/list-pull-requests/feature.d.ts +17 -0
  310. package/dist/features/pull-requests/list-pull-requests/feature.js +78 -0
  311. package/dist/features/pull-requests/list-pull-requests/feature.js.map +1 -0
  312. package/dist/features/pull-requests/list-pull-requests/feature.spec.int.d.ts +1 -0
  313. package/dist/features/pull-requests/list-pull-requests/feature.spec.int.js +122 -0
  314. package/dist/features/pull-requests/list-pull-requests/feature.spec.int.js.map +1 -0
  315. package/dist/features/pull-requests/list-pull-requests/feature.spec.unit.d.ts +1 -0
  316. package/dist/features/pull-requests/list-pull-requests/feature.spec.unit.js +178 -0
  317. package/dist/features/pull-requests/list-pull-requests/feature.spec.unit.js.map +1 -0
  318. package/dist/features/pull-requests/list-pull-requests/index.d.ts +2 -0
  319. package/dist/features/pull-requests/list-pull-requests/index.js +3 -0
  320. package/dist/features/pull-requests/list-pull-requests/index.js.map +1 -0
  321. package/dist/features/pull-requests/list-pull-requests/schema.d.ts +1 -0
  322. package/dist/features/pull-requests/list-pull-requests/schema.js +2 -0
  323. package/dist/features/pull-requests/list-pull-requests/schema.js.map +1 -0
  324. package/dist/features/pull-requests/schemas.d.ts +318 -0
  325. package/dist/features/pull-requests/schemas.js +280 -0
  326. package/dist/features/pull-requests/schemas.js.map +1 -0
  327. package/dist/features/pull-requests/tool-definitions.d.ts +5 -0
  328. package/dist/features/pull-requests/tool-definitions.js +52 -0
  329. package/dist/features/pull-requests/tool-definitions.js.map +1 -0
  330. package/dist/features/pull-requests/types.d.ts +100 -0
  331. package/dist/features/pull-requests/types.js +2 -0
  332. package/dist/features/pull-requests/types.js.map +1 -0
  333. package/dist/features/pull-requests/update-pull-request/feature.d.ts +9 -0
  334. package/dist/features/pull-requests/update-pull-request/feature.js +246 -0
  335. package/dist/features/pull-requests/update-pull-request/feature.js.map +1 -0
  336. package/dist/features/pull-requests/update-pull-request/feature.spec.int.d.ts +1 -0
  337. package/dist/features/pull-requests/update-pull-request/feature.spec.int.js +160 -0
  338. package/dist/features/pull-requests/update-pull-request/feature.spec.int.js.map +1 -0
  339. package/dist/features/pull-requests/update-pull-request/feature.spec.unit.d.ts +1 -0
  340. package/dist/features/pull-requests/update-pull-request/feature.spec.unit.js +278 -0
  341. package/dist/features/pull-requests/update-pull-request/feature.spec.unit.js.map +1 -0
  342. package/dist/features/pull-requests/update-pull-request/index.d.ts +1 -0
  343. package/dist/features/pull-requests/update-pull-request/index.js +2 -0
  344. package/dist/features/pull-requests/update-pull-request/index.js.map +1 -0
  345. package/dist/features/releases/create-release/feature.d.ts +3 -0
  346. package/dist/features/releases/create-release/feature.js +48 -0
  347. package/dist/features/releases/create-release/feature.js.map +1 -0
  348. package/dist/features/releases/create-release/index.d.ts +2 -0
  349. package/dist/features/releases/create-release/index.js +3 -0
  350. package/dist/features/releases/create-release/index.js.map +1 -0
  351. package/dist/features/releases/create-release/schema.d.ts +20 -0
  352. package/dist/features/releases/create-release/schema.js +21 -0
  353. package/dist/features/releases/create-release/schema.js.map +1 -0
  354. package/dist/features/releases/deploy-release-stage/feature.d.ts +9 -0
  355. package/dist/features/releases/deploy-release-stage/feature.js +35 -0
  356. package/dist/features/releases/deploy-release-stage/feature.js.map +1 -0
  357. package/dist/features/releases/deploy-release-stage/index.d.ts +2 -0
  358. package/dist/features/releases/deploy-release-stage/index.js +3 -0
  359. package/dist/features/releases/deploy-release-stage/index.js.map +1 -0
  360. package/dist/features/releases/deploy-release-stage/schema.d.ts +17 -0
  361. package/dist/features/releases/deploy-release-stage/schema.js +17 -0
  362. package/dist/features/releases/deploy-release-stage/schema.js.map +1 -0
  363. package/dist/features/releases/get-release/feature.d.ts +3 -0
  364. package/dist/features/releases/get-release/feature.js +31 -0
  365. package/dist/features/releases/get-release/feature.js.map +1 -0
  366. package/dist/features/releases/get-release/index.d.ts +2 -0
  367. package/dist/features/releases/get-release/index.js +3 -0
  368. package/dist/features/releases/get-release/index.js.map +1 -0
  369. package/dist/features/releases/get-release/schema.d.ts +11 -0
  370. package/dist/features/releases/get-release/schema.js +10 -0
  371. package/dist/features/releases/get-release/schema.js.map +1 -0
  372. package/dist/features/releases/get-release-definition/feature.d.ts +3 -0
  373. package/dist/features/releases/get-release-definition/feature.js +31 -0
  374. package/dist/features/releases/get-release-definition/feature.js.map +1 -0
  375. package/dist/features/releases/get-release-definition/index.d.ts +2 -0
  376. package/dist/features/releases/get-release-definition/index.js +3 -0
  377. package/dist/features/releases/get-release-definition/index.js.map +1 -0
  378. package/dist/features/releases/get-release-definition/schema.d.ts +11 -0
  379. package/dist/features/releases/get-release-definition/schema.js +10 -0
  380. package/dist/features/releases/get-release-definition/schema.js.map +1 -0
  381. package/dist/features/releases/index.d.ts +11 -0
  382. package/dist/features/releases/index.js +102 -0
  383. package/dist/features/releases/index.js.map +1 -0
  384. package/dist/features/releases/list-release-definitions/feature.d.ts +3 -0
  385. package/dist/features/releases/list-release-definitions/feature.js +28 -0
  386. package/dist/features/releases/list-release-definitions/feature.js.map +1 -0
  387. package/dist/features/releases/list-release-definitions/index.d.ts +2 -0
  388. package/dist/features/releases/list-release-definitions/index.js +3 -0
  389. package/dist/features/releases/list-release-definitions/index.js.map +1 -0
  390. package/dist/features/releases/list-release-definitions/schema.d.ts +17 -0
  391. package/dist/features/releases/list-release-definitions/schema.js +21 -0
  392. package/dist/features/releases/list-release-definitions/schema.js.map +1 -0
  393. package/dist/features/releases/list-releases/feature.d.ts +3 -0
  394. package/dist/features/releases/list-releases/feature.js +28 -0
  395. package/dist/features/releases/list-releases/feature.js.map +1 -0
  396. package/dist/features/releases/list-releases/index.d.ts +2 -0
  397. package/dist/features/releases/list-releases/index.js +3 -0
  398. package/dist/features/releases/list-releases/index.js.map +1 -0
  399. package/dist/features/releases/list-releases/schema.d.ts +26 -0
  400. package/dist/features/releases/list-releases/schema.js +27 -0
  401. package/dist/features/releases/list-releases/schema.js.map +1 -0
  402. package/dist/features/releases/tool-definitions.d.ts +2 -0
  403. package/dist/features/releases/tool-definitions.js +46 -0
  404. package/dist/features/releases/tool-definitions.js.map +1 -0
  405. package/dist/features/releases/types.d.ts +32 -0
  406. package/dist/features/releases/types.js +2 -0
  407. package/dist/features/releases/types.js.map +1 -0
  408. package/dist/features/repositories/__test__/test-helpers.d.ts +13 -0
  409. package/dist/features/repositories/__test__/test-helpers.js +31 -0
  410. package/dist/features/repositories/__test__/test-helpers.js.map +1 -0
  411. package/dist/features/repositories/create-branch/feature.d.ts +6 -0
  412. package/dist/features/repositories/create-branch/feature.js +30 -0
  413. package/dist/features/repositories/create-branch/feature.js.map +1 -0
  414. package/dist/features/repositories/create-branch/feature.spec.unit.d.ts +1 -0
  415. package/dist/features/repositories/create-branch/feature.spec.unit.js +34 -0
  416. package/dist/features/repositories/create-branch/feature.spec.unit.js.map +1 -0
  417. package/dist/features/repositories/create-branch/index.d.ts +1 -0
  418. package/dist/features/repositories/create-branch/index.js +2 -0
  419. package/dist/features/repositories/create-branch/index.js.map +1 -0
  420. package/dist/features/repositories/create-commit/feature.d.ts +6 -0
  421. package/dist/features/repositories/create-commit/feature.js +119 -0
  422. package/dist/features/repositories/create-commit/feature.js.map +1 -0
  423. package/dist/features/repositories/create-commit/feature.spec.unit.d.ts +1 -0
  424. package/dist/features/repositories/create-commit/feature.spec.unit.js +155 -0
  425. package/dist/features/repositories/create-commit/feature.spec.unit.js.map +1 -0
  426. package/dist/features/repositories/create-commit/index.d.ts +1 -0
  427. package/dist/features/repositories/create-commit/index.js +2 -0
  428. package/dist/features/repositories/create-commit/index.js.map +1 -0
  429. package/dist/features/repositories/get-all-repositories-tree/feature.d.ts +22 -0
  430. package/dist/features/repositories/get-all-repositories-tree/feature.js +299 -0
  431. package/dist/features/repositories/get-all-repositories-tree/feature.js.map +1 -0
  432. package/dist/features/repositories/get-all-repositories-tree/feature.spec.int.d.ts +1 -0
  433. package/dist/features/repositories/get-all-repositories-tree/feature.spec.int.js +87 -0
  434. package/dist/features/repositories/get-all-repositories-tree/feature.spec.int.js.map +1 -0
  435. package/dist/features/repositories/get-all-repositories-tree/feature.spec.unit.d.ts +1 -0
  436. package/dist/features/repositories/get-all-repositories-tree/feature.spec.unit.js +389 -0
  437. package/dist/features/repositories/get-all-repositories-tree/feature.spec.unit.js.map +1 -0
  438. package/dist/features/repositories/get-all-repositories-tree/index.d.ts +2 -0
  439. package/dist/features/repositories/get-all-repositories-tree/index.js +3 -0
  440. package/dist/features/repositories/get-all-repositories-tree/index.js.map +1 -0
  441. package/dist/features/repositories/get-all-repositories-tree/schema.d.ts +2 -0
  442. package/dist/features/repositories/get-all-repositories-tree/schema.js +4 -0
  443. package/dist/features/repositories/get-all-repositories-tree/schema.js.map +1 -0
  444. package/dist/features/repositories/get-file-content/feature.d.ts +23 -0
  445. package/dist/features/repositories/get-file-content/feature.js +93 -0
  446. package/dist/features/repositories/get-file-content/feature.js.map +1 -0
  447. package/dist/features/repositories/get-file-content/feature.spec.int.d.ts +1 -0
  448. package/dist/features/repositories/get-file-content/feature.spec.int.js +84 -0
  449. package/dist/features/repositories/get-file-content/feature.spec.int.js.map +1 -0
  450. package/dist/features/repositories/get-file-content/feature.spec.unit.d.ts +1 -0
  451. package/dist/features/repositories/get-file-content/feature.spec.unit.js +126 -0
  452. package/dist/features/repositories/get-file-content/feature.spec.unit.js.map +1 -0
  453. package/dist/features/repositories/get-file-content/index.d.ts +2 -0
  454. package/dist/features/repositories/get-file-content/index.js +3 -0
  455. package/dist/features/repositories/get-file-content/index.js.map +1 -0
  456. package/dist/features/repositories/get-file-content/schema.d.ts +2 -0
  457. package/dist/features/repositories/get-file-content/schema.js +4 -0
  458. package/dist/features/repositories/get-file-content/schema.js.map +1 -0
  459. package/dist/features/repositories/get-repository/feature.d.ts +12 -0
  460. package/dist/features/repositories/get-repository/feature.js +27 -0
  461. package/dist/features/repositories/get-repository/feature.js.map +1 -0
  462. package/dist/features/repositories/get-repository/feature.spec.int.d.ts +1 -0
  463. package/dist/features/repositories/get-repository/feature.spec.int.js +42 -0
  464. package/dist/features/repositories/get-repository/feature.spec.int.js.map +1 -0
  465. package/dist/features/repositories/get-repository/feature.spec.unit.d.ts +1 -0
  466. package/dist/features/repositories/get-repository/feature.spec.unit.js +39 -0
  467. package/dist/features/repositories/get-repository/feature.spec.unit.js.map +1 -0
  468. package/dist/features/repositories/get-repository/index.d.ts +2 -0
  469. package/dist/features/repositories/get-repository/index.js +3 -0
  470. package/dist/features/repositories/get-repository/index.js.map +1 -0
  471. package/dist/features/repositories/get-repository/schema.d.ts +2 -0
  472. package/dist/features/repositories/get-repository/schema.js +3 -0
  473. package/dist/features/repositories/get-repository/schema.js.map +1 -0
  474. package/dist/features/repositories/get-repository-details/feature.d.ts +11 -0
  475. package/dist/features/repositories/get-repository-details/feature.js +64 -0
  476. package/dist/features/repositories/get-repository-details/feature.js.map +1 -0
  477. package/dist/features/repositories/get-repository-details/feature.spec.int.d.ts +1 -0
  478. package/dist/features/repositories/get-repository-details/feature.spec.int.js +117 -0
  479. package/dist/features/repositories/get-repository-details/feature.spec.int.js.map +1 -0
  480. package/dist/features/repositories/get-repository-details/feature.spec.unit.d.ts +1 -0
  481. package/dist/features/repositories/get-repository-details/feature.spec.unit.js +253 -0
  482. package/dist/features/repositories/get-repository-details/feature.spec.unit.js.map +1 -0
  483. package/dist/features/repositories/get-repository-details/index.d.ts +2 -0
  484. package/dist/features/repositories/get-repository-details/index.js +3 -0
  485. package/dist/features/repositories/get-repository-details/index.js.map +1 -0
  486. package/dist/features/repositories/get-repository-details/schema.d.ts +2 -0
  487. package/dist/features/repositories/get-repository-details/schema.js +3 -0
  488. package/dist/features/repositories/get-repository-details/schema.js.map +1 -0
  489. package/dist/features/repositories/get-repository-tree/feature.d.ts +6 -0
  490. package/dist/features/repositories/get-repository-tree/feature.js +62 -0
  491. package/dist/features/repositories/get-repository-tree/feature.js.map +1 -0
  492. package/dist/features/repositories/get-repository-tree/feature.spec.unit.d.ts +1 -0
  493. package/dist/features/repositories/get-repository-tree/feature.spec.unit.js +67 -0
  494. package/dist/features/repositories/get-repository-tree/feature.spec.unit.js.map +1 -0
  495. package/dist/features/repositories/get-repository-tree/index.d.ts +1 -0
  496. package/dist/features/repositories/get-repository-tree/index.js +2 -0
  497. package/dist/features/repositories/get-repository-tree/index.js.map +1 -0
  498. package/dist/features/repositories/index.d.ts +21 -0
  499. package/dist/features/repositories/index.js +160 -0
  500. package/dist/features/repositories/index.js.map +1 -0
  501. package/dist/features/repositories/index.spec.unit.d.ts +1 -0
  502. package/dist/features/repositories/index.spec.unit.js +289 -0
  503. package/dist/features/repositories/index.spec.unit.js.map +1 -0
  504. package/dist/features/repositories/list-commits/feature.d.ts +6 -0
  505. package/dist/features/repositories/list-commits/feature.js +72 -0
  506. package/dist/features/repositories/list-commits/feature.js.map +1 -0
  507. package/dist/features/repositories/list-commits/feature.spec.unit.d.ts +1 -0
  508. package/dist/features/repositories/list-commits/feature.spec.unit.js +56 -0
  509. package/dist/features/repositories/list-commits/feature.spec.unit.js.map +1 -0
  510. package/dist/features/repositories/list-commits/index.d.ts +1 -0
  511. package/dist/features/repositories/list-commits/index.js +2 -0
  512. package/dist/features/repositories/list-commits/index.js.map +1 -0
  513. package/dist/features/repositories/list-repositories/feature.d.ts +10 -0
  514. package/dist/features/repositories/list-repositories/feature.js +22 -0
  515. package/dist/features/repositories/list-repositories/feature.js.map +1 -0
  516. package/dist/features/repositories/list-repositories/feature.spec.int.d.ts +1 -0
  517. package/dist/features/repositories/list-repositories/feature.spec.int.js +54 -0
  518. package/dist/features/repositories/list-repositories/feature.spec.int.js.map +1 -0
  519. package/dist/features/repositories/list-repositories/feature.spec.unit.d.ts +1 -0
  520. package/dist/features/repositories/list-repositories/feature.spec.unit.js +57 -0
  521. package/dist/features/repositories/list-repositories/feature.spec.unit.js.map +1 -0
  522. package/dist/features/repositories/list-repositories/index.d.ts +2 -0
  523. package/dist/features/repositories/list-repositories/index.js +3 -0
  524. package/dist/features/repositories/list-repositories/index.js.map +1 -0
  525. package/dist/features/repositories/list-repositories/schema.d.ts +2 -0
  526. package/dist/features/repositories/list-repositories/schema.js +3 -0
  527. package/dist/features/repositories/list-repositories/schema.js.map +1 -0
  528. package/dist/features/repositories/schemas.d.ts +237 -0
  529. package/dist/features/repositories/schemas.js +303 -0
  530. package/dist/features/repositories/schemas.js.map +1 -0
  531. package/dist/features/repositories/tool-definitions.d.ts +5 -0
  532. package/dist/features/repositories/tool-definitions.js +91 -0
  533. package/dist/features/repositories/tool-definitions.js.map +1 -0
  534. package/dist/features/repositories/types.d.ts +167 -0
  535. package/dist/features/repositories/types.js +2 -0
  536. package/dist/features/repositories/types.js.map +1 -0
  537. package/dist/features/search/index.d.ts +15 -0
  538. package/dist/features/search/index.js +46 -0
  539. package/dist/features/search/index.js.map +1 -0
  540. package/dist/features/search/index.spec.unit.d.ts +1 -0
  541. package/dist/features/search/index.spec.unit.js +141 -0
  542. package/dist/features/search/index.spec.unit.js.map +1 -0
  543. package/dist/features/search/schemas.d.ts +171 -0
  544. package/dist/features/search/schemas.js +156 -0
  545. package/dist/features/search/schemas.js.map +1 -0
  546. package/dist/features/search/schemas.spec.unit.d.ts +0 -0
  547. package/dist/features/search/schemas.spec.unit.js +38 -0
  548. package/dist/features/search/schemas.spec.unit.js.map +1 -0
  549. package/dist/features/search/search-code/feature.d.ts +10 -0
  550. package/dist/features/search/search-code/feature.js +171 -0
  551. package/dist/features/search/search-code/feature.js.map +1 -0
  552. package/dist/features/search/search-code/feature.spec.int.d.ts +1 -0
  553. package/dist/features/search/search-code/feature.spec.int.js +190 -0
  554. package/dist/features/search/search-code/feature.spec.int.js.map +1 -0
  555. package/dist/features/search/search-code/feature.spec.unit.d.ts +1 -0
  556. package/dist/features/search/search-code/feature.spec.unit.js +963 -0
  557. package/dist/features/search/search-code/feature.spec.unit.js.map +1 -0
  558. package/dist/features/search/search-code/index.d.ts +2 -0
  559. package/dist/features/search/search-code/index.js +3 -0
  560. package/dist/features/search/search-code/index.js.map +1 -0
  561. package/dist/features/search/search-wiki/feature.d.ts +10 -0
  562. package/dist/features/search/search-wiki/feature.js +126 -0
  563. package/dist/features/search/search-wiki/feature.js.map +1 -0
  564. package/dist/features/search/search-wiki/feature.spec.int.d.ts +1 -0
  565. package/dist/features/search/search-wiki/feature.spec.int.js +65 -0
  566. package/dist/features/search/search-wiki/feature.spec.int.js.map +1 -0
  567. package/dist/features/search/search-wiki/feature.spec.unit.d.ts +1 -0
  568. package/dist/features/search/search-wiki/feature.spec.unit.js +171 -0
  569. package/dist/features/search/search-wiki/feature.spec.unit.js.map +1 -0
  570. package/dist/features/search/search-wiki/index.d.ts +1 -0
  571. package/dist/features/search/search-wiki/index.js +2 -0
  572. package/dist/features/search/search-wiki/index.js.map +1 -0
  573. package/dist/features/search/search-work-items/feature.d.ts +10 -0
  574. package/dist/features/search/search-work-items/feature.js +112 -0
  575. package/dist/features/search/search-work-items/feature.js.map +1 -0
  576. package/dist/features/search/search-work-items/feature.spec.int.d.ts +1 -0
  577. package/dist/features/search/search-work-items/feature.spec.int.js +148 -0
  578. package/dist/features/search/search-work-items/feature.spec.int.js.map +1 -0
  579. package/dist/features/search/search-work-items/feature.spec.unit.d.ts +1 -0
  580. package/dist/features/search/search-work-items/feature.spec.unit.js +337 -0
  581. package/dist/features/search/search-work-items/feature.spec.unit.js.map +1 -0
  582. package/dist/features/search/search-work-items/index.d.ts +1 -0
  583. package/dist/features/search/search-work-items/index.js +2 -0
  584. package/dist/features/search/search-work-items/index.js.map +1 -0
  585. package/dist/features/search/tool-definitions.d.ts +5 -0
  586. package/dist/features/search/tool-definitions.js +23 -0
  587. package/dist/features/search/tool-definitions.js.map +1 -0
  588. package/dist/features/search/types.d.ts +537 -0
  589. package/dist/features/search/types.js +2 -0
  590. package/dist/features/search/types.js.map +1 -0
  591. package/dist/features/users/get-me/feature.d.ts +12 -0
  592. package/dist/features/users/get-me/feature.js +90 -0
  593. package/dist/features/users/get-me/feature.js.map +1 -0
  594. package/dist/features/users/get-me/feature.spec.int.d.ts +1 -0
  595. package/dist/features/users/get-me/feature.spec.int.js +31 -0
  596. package/dist/features/users/get-me/feature.spec.int.js.map +1 -0
  597. package/dist/features/users/get-me/feature.spec.unit.d.ts +1 -0
  598. package/dist/features/users/get-me/feature.spec.unit.js +159 -0
  599. package/dist/features/users/get-me/feature.spec.unit.js.map +1 -0
  600. package/dist/features/users/get-me/index.d.ts +2 -0
  601. package/dist/features/users/get-me/index.js +3 -0
  602. package/dist/features/users/get-me/index.js.map +1 -0
  603. package/dist/features/users/get-me/schema.d.ts +2 -0
  604. package/dist/features/users/get-me/schema.js +3 -0
  605. package/dist/features/users/get-me/schema.js.map +1 -0
  606. package/dist/features/users/index.d.ts +17 -0
  607. package/dist/features/users/index.js +33 -0
  608. package/dist/features/users/index.js.map +1 -0
  609. package/dist/features/users/index.spec.unit.d.ts +1 -0
  610. package/dist/features/users/index.spec.unit.js +69 -0
  611. package/dist/features/users/index.spec.unit.js.map +1 -0
  612. package/dist/features/users/schemas.d.ts +5 -0
  613. package/dist/features/users/schemas.js +6 -0
  614. package/dist/features/users/schemas.js.map +1 -0
  615. package/dist/features/users/tool-definitions.d.ts +5 -0
  616. package/dist/features/users/tool-definitions.js +13 -0
  617. package/dist/features/users/tool-definitions.js.map +1 -0
  618. package/dist/features/users/types.d.ts +17 -0
  619. package/dist/features/users/types.js +2 -0
  620. package/dist/features/users/types.js.map +1 -0
  621. package/dist/features/wikis/create-wiki/feature.d.ts +49 -0
  622. package/dist/features/wikis/create-wiki/feature.js +53 -0
  623. package/dist/features/wikis/create-wiki/feature.js.map +1 -0
  624. package/dist/features/wikis/create-wiki/feature.spec.int.d.ts +1 -0
  625. package/dist/features/wikis/create-wiki/feature.spec.int.js +42 -0
  626. package/dist/features/wikis/create-wiki/feature.spec.int.js.map +1 -0
  627. package/dist/features/wikis/create-wiki/feature.spec.unit.d.ts +1 -0
  628. package/dist/features/wikis/create-wiki/feature.spec.unit.js +166 -0
  629. package/dist/features/wikis/create-wiki/feature.spec.unit.js.map +1 -0
  630. package/dist/features/wikis/create-wiki/index.d.ts +2 -0
  631. package/dist/features/wikis/create-wiki/index.js +3 -0
  632. package/dist/features/wikis/create-wiki/index.js.map +1 -0
  633. package/dist/features/wikis/create-wiki/schema.d.ts +53 -0
  634. package/dist/features/wikis/create-wiki/schema.js +57 -0
  635. package/dist/features/wikis/create-wiki/schema.js.map +1 -0
  636. package/dist/features/wikis/create-wiki-page/feature.d.ts +18 -0
  637. package/dist/features/wikis/create-wiki-page/feature.js +58 -0
  638. package/dist/features/wikis/create-wiki-page/feature.js.map +1 -0
  639. package/dist/features/wikis/create-wiki-page/feature.spec.int.d.ts +1 -0
  640. package/dist/features/wikis/create-wiki-page/feature.spec.int.js +272 -0
  641. package/dist/features/wikis/create-wiki-page/feature.spec.int.js.map +1 -0
  642. package/dist/features/wikis/create-wiki-page/feature.spec.unit.d.ts +1 -0
  643. package/dist/features/wikis/create-wiki-page/feature.spec.unit.js +139 -0
  644. package/dist/features/wikis/create-wiki-page/feature.spec.unit.js.map +1 -0
  645. package/dist/features/wikis/create-wiki-page/index.d.ts +2 -0
  646. package/dist/features/wikis/create-wiki-page/index.js +3 -0
  647. package/dist/features/wikis/create-wiki-page/index.js.map +1 -0
  648. package/dist/features/wikis/create-wiki-page/schema.d.ts +26 -0
  649. package/dist/features/wikis/create-wiki-page/schema.js +33 -0
  650. package/dist/features/wikis/create-wiki-page/schema.js.map +1 -0
  651. package/dist/features/wikis/get-wiki-page/feature.d.ts +33 -0
  652. package/dist/features/wikis/get-wiki-page/feature.js +32 -0
  653. package/dist/features/wikis/get-wiki-page/feature.js.map +1 -0
  654. package/dist/features/wikis/get-wiki-page/feature.spec.int.d.ts +1 -0
  655. package/dist/features/wikis/get-wiki-page/feature.spec.int.js +56 -0
  656. package/dist/features/wikis/get-wiki-page/feature.spec.int.js.map +1 -0
  657. package/dist/features/wikis/get-wiki-page/feature.spec.unit.d.ts +1 -0
  658. package/dist/features/wikis/get-wiki-page/feature.spec.unit.js +86 -0
  659. package/dist/features/wikis/get-wiki-page/feature.spec.unit.js.map +1 -0
  660. package/dist/features/wikis/get-wiki-page/index.d.ts +2 -0
  661. package/dist/features/wikis/get-wiki-page/index.js +3 -0
  662. package/dist/features/wikis/get-wiki-page/index.js.map +1 -0
  663. package/dist/features/wikis/get-wiki-page/schema.d.ts +20 -0
  664. package/dist/features/wikis/get-wiki-page/schema.js +20 -0
  665. package/dist/features/wikis/get-wiki-page/schema.js.map +1 -0
  666. package/dist/features/wikis/get-wikis/feature.d.ts +25 -0
  667. package/dist/features/wikis/get-wikis/feature.js +34 -0
  668. package/dist/features/wikis/get-wikis/feature.js.map +1 -0
  669. package/dist/features/wikis/get-wikis/feature.spec.int.d.ts +1 -0
  670. package/dist/features/wikis/get-wikis/feature.spec.int.js +32 -0
  671. package/dist/features/wikis/get-wikis/feature.spec.int.js.map +1 -0
  672. package/dist/features/wikis/get-wikis/feature.spec.unit.d.ts +1 -0
  673. package/dist/features/wikis/get-wikis/feature.spec.unit.js +81 -0
  674. package/dist/features/wikis/get-wikis/feature.spec.unit.js.map +1 -0
  675. package/dist/features/wikis/get-wikis/index.d.ts +2 -0
  676. package/dist/features/wikis/get-wikis/index.js +3 -0
  677. package/dist/features/wikis/get-wikis/index.js.map +1 -0
  678. package/dist/features/wikis/get-wikis/schema.d.ts +14 -0
  679. package/dist/features/wikis/get-wikis/schema.js +18 -0
  680. package/dist/features/wikis/get-wikis/schema.js.map +1 -0
  681. package/dist/features/wikis/index.d.ts +16 -0
  682. package/dist/features/wikis/index.js +109 -0
  683. package/dist/features/wikis/index.js.map +1 -0
  684. package/dist/features/wikis/index.spec.unit.d.ts +1 -0
  685. package/dist/features/wikis/index.spec.unit.js +212 -0
  686. package/dist/features/wikis/index.spec.unit.js.map +1 -0
  687. package/dist/features/wikis/list-wiki-pages/feature.d.ts +20 -0
  688. package/dist/features/wikis/list-wiki-pages/feature.js +43 -0
  689. package/dist/features/wikis/list-wiki-pages/feature.js.map +1 -0
  690. package/dist/features/wikis/list-wiki-pages/feature.spec.int.d.ts +1 -0
  691. package/dist/features/wikis/list-wiki-pages/feature.spec.int.js +228 -0
  692. package/dist/features/wikis/list-wiki-pages/feature.spec.int.js.map +1 -0
  693. package/dist/features/wikis/list-wiki-pages/feature.spec.unit.d.ts +1 -0
  694. package/dist/features/wikis/list-wiki-pages/feature.spec.unit.js +392 -0
  695. package/dist/features/wikis/list-wiki-pages/feature.spec.unit.js.map +1 -0
  696. package/dist/features/wikis/list-wiki-pages/index.d.ts +2 -0
  697. package/dist/features/wikis/list-wiki-pages/index.js +3 -0
  698. package/dist/features/wikis/list-wiki-pages/index.js.map +1 -0
  699. package/dist/features/wikis/list-wiki-pages/schema.d.ts +18 -0
  700. package/dist/features/wikis/list-wiki-pages/schema.js +19 -0
  701. package/dist/features/wikis/list-wiki-pages/schema.js.map +1 -0
  702. package/dist/features/wikis/tool-definitions.d.ts +5 -0
  703. package/dist/features/wikis/tool-definitions.js +43 -0
  704. package/dist/features/wikis/tool-definitions.js.map +1 -0
  705. package/dist/features/wikis/update-wiki-page/feature.d.ts +12 -0
  706. package/dist/features/wikis/update-wiki-page/feature.js +27 -0
  707. package/dist/features/wikis/update-wiki-page/feature.js.map +1 -0
  708. package/dist/features/wikis/update-wiki-page/feature.spec.int.d.ts +1 -0
  709. package/dist/features/wikis/update-wiki-page/feature.spec.int.js +37 -0
  710. package/dist/features/wikis/update-wiki-page/feature.spec.int.js.map +1 -0
  711. package/dist/features/wikis/update-wiki-page/index.d.ts +2 -0
  712. package/dist/features/wikis/update-wiki-page/index.js +3 -0
  713. package/dist/features/wikis/update-wiki-page/index.js.map +1 -0
  714. package/dist/features/wikis/update-wiki-page/schema.d.ts +26 -0
  715. package/dist/features/wikis/update-wiki-page/schema.js +29 -0
  716. package/dist/features/wikis/update-wiki-page/schema.js.map +1 -0
  717. package/dist/features/work-items/__test__/fixtures.d.ts +9 -0
  718. package/dist/features/work-items/__test__/fixtures.js +23 -0
  719. package/dist/features/work-items/__test__/fixtures.js.map +1 -0
  720. package/dist/features/work-items/__test__/test-helpers.d.ts +13 -0
  721. package/dist/features/work-items/__test__/test-helpers.js +31 -0
  722. package/dist/features/work-items/__test__/test-helpers.js.map +1 -0
  723. package/dist/features/work-items/__test__/test-utils.d.ts +17 -0
  724. package/dist/features/work-items/__test__/test-utils.js +35 -0
  725. package/dist/features/work-items/__test__/test-utils.js.map +1 -0
  726. package/dist/features/work-items/create-work-item/feature.d.ts +12 -0
  727. package/dist/features/work-items/create-work-item/feature.js +96 -0
  728. package/dist/features/work-items/create-work-item/feature.js.map +1 -0
  729. package/dist/features/work-items/create-work-item/feature.spec.int.d.ts +1 -0
  730. package/dist/features/work-items/create-work-item/feature.spec.int.js +103 -0
  731. package/dist/features/work-items/create-work-item/feature.spec.int.js.map +1 -0
  732. package/dist/features/work-items/create-work-item/feature.spec.unit.d.ts +1 -0
  733. package/dist/features/work-items/create-work-item/feature.spec.unit.js +44 -0
  734. package/dist/features/work-items/create-work-item/feature.spec.unit.js.map +1 -0
  735. package/dist/features/work-items/create-work-item/index.d.ts +2 -0
  736. package/dist/features/work-items/create-work-item/index.js +3 -0
  737. package/dist/features/work-items/create-work-item/index.js.map +1 -0
  738. package/dist/features/work-items/create-work-item/schema.d.ts +2 -0
  739. package/dist/features/work-items/create-work-item/schema.js +3 -0
  740. package/dist/features/work-items/create-work-item/schema.js.map +1 -0
  741. package/dist/features/work-items/get-work-item/feature.d.ts +12 -0
  742. package/dist/features/work-items/get-work-item/feature.js +66 -0
  743. package/dist/features/work-items/get-work-item/feature.js.map +1 -0
  744. package/dist/features/work-items/get-work-item/feature.spec.int.d.ts +1 -0
  745. package/dist/features/work-items/get-work-item/feature.spec.int.js +136 -0
  746. package/dist/features/work-items/get-work-item/feature.spec.int.js.map +1 -0
  747. package/dist/features/work-items/get-work-item/feature.spec.unit.d.ts +1 -0
  748. package/dist/features/work-items/get-work-item/feature.spec.unit.js +29 -0
  749. package/dist/features/work-items/get-work-item/feature.spec.unit.js.map +1 -0
  750. package/dist/features/work-items/get-work-item/index.d.ts +2 -0
  751. package/dist/features/work-items/get-work-item/index.js +3 -0
  752. package/dist/features/work-items/get-work-item/index.js.map +1 -0
  753. package/dist/features/work-items/get-work-item/schema.d.ts +2 -0
  754. package/dist/features/work-items/get-work-item/schema.js +3 -0
  755. package/dist/features/work-items/get-work-item/schema.js.map +1 -0
  756. package/dist/features/work-items/index.d.ts +17 -0
  757. package/dist/features/work-items/index.js +103 -0
  758. package/dist/features/work-items/index.js.map +1 -0
  759. package/dist/features/work-items/index.spec.unit.d.ts +1 -0
  760. package/dist/features/work-items/index.spec.unit.js +197 -0
  761. package/dist/features/work-items/index.spec.unit.js.map +1 -0
  762. package/dist/features/work-items/list-work-items/feature.d.ts +10 -0
  763. package/dist/features/work-items/list-work-items/feature.js +86 -0
  764. package/dist/features/work-items/list-work-items/feature.js.map +1 -0
  765. package/dist/features/work-items/list-work-items/feature.spec.int.d.ts +1 -0
  766. package/dist/features/work-items/list-work-items/feature.spec.int.js +101 -0
  767. package/dist/features/work-items/list-work-items/feature.spec.int.js.map +1 -0
  768. package/dist/features/work-items/list-work-items/feature.spec.unit.d.ts +1 -0
  769. package/dist/features/work-items/list-work-items/feature.spec.unit.js +93 -0
  770. package/dist/features/work-items/list-work-items/feature.spec.unit.js.map +1 -0
  771. package/dist/features/work-items/list-work-items/index.d.ts +2 -0
  772. package/dist/features/work-items/list-work-items/index.js +3 -0
  773. package/dist/features/work-items/list-work-items/index.js.map +1 -0
  774. package/dist/features/work-items/list-work-items/schema.d.ts +2 -0
  775. package/dist/features/work-items/list-work-items/schema.js +3 -0
  776. package/dist/features/work-items/list-work-items/schema.js.map +1 -0
  777. package/dist/features/work-items/manage-work-item-link/feature.d.ts +24 -0
  778. package/dist/features/work-items/manage-work-item-link/feature.js +73 -0
  779. package/dist/features/work-items/manage-work-item-link/feature.js.map +1 -0
  780. package/dist/features/work-items/manage-work-item-link/feature.spec.int.d.ts +1 -0
  781. package/dist/features/work-items/manage-work-item-link/feature.spec.int.js +73 -0
  782. package/dist/features/work-items/manage-work-item-link/feature.spec.int.js.map +1 -0
  783. package/dist/features/work-items/manage-work-item-link/feature.spec.unit.d.ts +1 -0
  784. package/dist/features/work-items/manage-work-item-link/feature.spec.unit.js +135 -0
  785. package/dist/features/work-items/manage-work-item-link/feature.spec.unit.js.map +1 -0
  786. package/dist/features/work-items/manage-work-item-link/index.d.ts +2 -0
  787. package/dist/features/work-items/manage-work-item-link/index.js +3 -0
  788. package/dist/features/work-items/manage-work-item-link/index.js.map +1 -0
  789. package/dist/features/work-items/manage-work-item-link/schema.d.ts +2 -0
  790. package/dist/features/work-items/manage-work-item-link/schema.js +3 -0
  791. package/dist/features/work-items/manage-work-item-link/schema.js.map +1 -0
  792. package/dist/features/work-items/schemas.d.ts +147 -0
  793. package/dist/features/work-items/schemas.js +131 -0
  794. package/dist/features/work-items/schemas.js.map +1 -0
  795. package/dist/features/work-items/tool-definitions.d.ts +5 -0
  796. package/dist/features/work-items/tool-definitions.js +33 -0
  797. package/dist/features/work-items/tool-definitions.js.map +1 -0
  798. package/dist/features/work-items/types.d.ts +39 -0
  799. package/dist/features/work-items/types.js +2 -0
  800. package/dist/features/work-items/types.js.map +1 -0
  801. package/dist/features/work-items/update-work-item/feature.d.ts +12 -0
  802. package/dist/features/work-items/update-work-item/feature.js +100 -0
  803. package/dist/features/work-items/update-work-item/feature.js.map +1 -0
  804. package/dist/features/work-items/update-work-item/feature.spec.int.d.ts +1 -0
  805. package/dist/features/work-items/update-work-item/feature.spec.int.js +82 -0
  806. package/dist/features/work-items/update-work-item/feature.spec.int.js.map +1 -0
  807. package/dist/features/work-items/update-work-item/feature.spec.unit.d.ts +1 -0
  808. package/dist/features/work-items/update-work-item/feature.spec.unit.js +36 -0
  809. package/dist/features/work-items/update-work-item/feature.spec.unit.js.map +1 -0
  810. package/dist/features/work-items/update-work-item/index.d.ts +2 -0
  811. package/dist/features/work-items/update-work-item/index.js +3 -0
  812. package/dist/features/work-items/update-work-item/index.js.map +1 -0
  813. package/dist/features/work-items/update-work-item/schema.d.ts +2 -0
  814. package/dist/features/work-items/update-work-item/schema.js +3 -0
  815. package/dist/features/work-items/update-work-item/schema.js.map +1 -0
  816. package/dist/index.d.ts +14 -0
  817. package/dist/index.js +127931 -0
  818. package/dist/index.js.map +1 -0
  819. package/dist/index.spec.unit.d.ts +1 -0
  820. package/dist/index.spec.unit.js +81 -0
  821. package/dist/index.spec.unit.js.map +1 -0
  822. package/dist/server.d.ts +21 -0
  823. package/dist/server.js +378 -0
  824. package/dist/server.js.map +1 -0
  825. package/dist/server.spec.e2e.d.ts +1 -0
  826. package/dist/server.spec.e2e.js +224 -0
  827. package/dist/server.spec.e2e.js.map +1 -0
  828. package/dist/setup-env.spec.unit.d.ts +1 -0
  829. package/dist/setup-env.spec.unit.js +144 -0
  830. package/dist/setup-env.spec.unit.js.map +1 -0
  831. package/dist/setup.d.ts +6 -0
  832. package/dist/setup.js +124 -0
  833. package/dist/setup.js.map +1 -0
  834. package/dist/shared/api/client.d.ts +91 -0
  835. package/dist/shared/api/client.js +238 -0
  836. package/dist/shared/api/client.js.map +1 -0
  837. package/dist/shared/api/index.d.ts +1 -0
  838. package/dist/shared/api/index.js +2 -0
  839. package/dist/shared/api/index.js.map +1 -0
  840. package/dist/shared/auth/auth-factory.d.ts +43 -0
  841. package/dist/shared/auth/auth-factory.js +136 -0
  842. package/dist/shared/auth/auth-factory.js.map +1 -0
  843. package/dist/shared/auth/auth-factory.spec.unit.d.ts +1 -0
  844. package/dist/shared/auth/auth-factory.spec.unit.js +36 -0
  845. package/dist/shared/auth/auth-factory.spec.unit.js.map +1 -0
  846. package/dist/shared/auth/client-factory.d.ts +109 -0
  847. package/dist/shared/auth/client-factory.js +268 -0
  848. package/dist/shared/auth/client-factory.js.map +1 -0
  849. package/dist/shared/auth/index.d.ts +11 -0
  850. package/dist/shared/auth/index.js +12 -0
  851. package/dist/shared/auth/index.js.map +1 -0
  852. package/dist/shared/azure-devops-url.d.ts +17 -0
  853. package/dist/shared/azure-devops-url.js +116 -0
  854. package/dist/shared/azure-devops-url.js.map +1 -0
  855. package/dist/shared/azure-devops-url.spec.unit.d.ts +1 -0
  856. package/dist/shared/azure-devops-url.spec.unit.js +101 -0
  857. package/dist/shared/azure-devops-url.spec.unit.js.map +1 -0
  858. package/dist/shared/config/index.d.ts +1 -0
  859. package/dist/shared/config/index.js +2 -0
  860. package/dist/shared/config/index.js.map +1 -0
  861. package/dist/shared/config/version.d.ts +4 -0
  862. package/dist/shared/config/version.js +5 -0
  863. package/dist/shared/config/version.js.map +1 -0
  864. package/dist/shared/enums/index.d.ts +40 -0
  865. package/dist/shared/enums/index.js +81 -0
  866. package/dist/shared/enums/index.js.map +1 -0
  867. package/dist/shared/enums/index.spec.unit.d.ts +1 -0
  868. package/dist/shared/enums/index.spec.unit.js +73 -0
  869. package/dist/shared/enums/index.spec.unit.js.map +1 -0
  870. package/dist/shared/errors/azure-devops-errors.d.ts +107 -0
  871. package/dist/shared/errors/azure-devops-errors.js +150 -0
  872. package/dist/shared/errors/azure-devops-errors.js.map +1 -0
  873. package/dist/shared/errors/handle-request-error.d.ts +31 -0
  874. package/dist/shared/errors/handle-request-error.js +91 -0
  875. package/dist/shared/errors/handle-request-error.js.map +1 -0
  876. package/dist/shared/errors/index.d.ts +1 -0
  877. package/dist/shared/errors/index.js +2 -0
  878. package/dist/shared/errors/index.js.map +1 -0
  879. package/dist/shared/test/test-helpers.d.ts +20 -0
  880. package/dist/shared/test/test-helpers.js +52 -0
  881. package/dist/shared/test/test-helpers.js.map +1 -0
  882. package/dist/shared/types/config.d.ts +27 -0
  883. package/dist/shared/types/config.js +2 -0
  884. package/dist/shared/types/config.js.map +1 -0
  885. package/dist/shared/types/index.d.ts +1 -0
  886. package/dist/shared/types/index.js +2 -0
  887. package/dist/shared/types/index.js.map +1 -0
  888. package/dist/shared/types/request-handler.d.ts +21 -0
  889. package/dist/shared/types/request-handler.js +2 -0
  890. package/dist/shared/types/request-handler.js.map +1 -0
  891. package/dist/shared/types/tool-definition.d.ts +10 -0
  892. package/dist/shared/types/tool-definition.js +2 -0
  893. package/dist/shared/types/tool-definition.js.map +1 -0
  894. package/dist/shared/utils/serialize.d.ts +7 -0
  895. package/dist/shared/utils/serialize.js +21 -0
  896. package/dist/shared/utils/serialize.js.map +1 -0
  897. package/dist/utils/environment.d.ts +15 -0
  898. package/dist/utils/environment.js +45 -0
  899. package/dist/utils/environment.js.map +1 -0
  900. package/dist/utils/environment.spec.unit.d.ts +1 -0
  901. package/dist/utils/environment.spec.unit.js +62 -0
  902. package/dist/utils/environment.spec.unit.js.map +1 -0
  903. package/docs/SOLUTION_SUMMARY.md +145 -0
  904. package/docs/authentication.md +267 -0
  905. package/docs/azure-identity-authentication.md +187 -0
  906. package/docs/ci-setup.md +61 -0
  907. package/docs/examples/README.md +33 -0
  908. package/docs/examples/azure-cli-authentication.env +25 -0
  909. package/docs/examples/azure-identity-authentication.env +33 -0
  910. package/docs/examples/pat-authentication.env +24 -0
  911. package/docs/important-knowledge/azure-devops-rest-api-research.md +88 -0
  912. package/docs/important-knowledge/llm-tldr-cli.md +37 -0
  913. package/docs/npm-trusted-publishers-migration.md +142 -0
  914. package/docs/release-troubleshooting.md +153 -0
  915. package/docs/testing/README.md +140 -0
  916. package/docs/testing/setup.md +72 -0
  917. package/docs/tools/README.md +73 -0
  918. package/docs/tools/core-navigation.md +114 -0
  919. package/docs/tools/organizations.md +73 -0
  920. package/docs/tools/pipelines.md +532 -0
  921. package/docs/tools/projects.md +114 -0
  922. package/docs/tools/pull-requests.md +1108 -0
  923. package/docs/tools/repositories.md +610 -0
  924. package/docs/tools/resources.md +133 -0
  925. package/docs/tools/search.md +165 -0
  926. package/docs/tools/user-tools.md +39 -0
  927. package/docs/tools/wiki.md +192 -0
  928. package/docs/tools/work-items.md +182 -0
  929. package/package.json +129 -0
@@ -0,0 +1,963 @@
1
+ import axios from 'axios';
2
+ import { searchCode } from './feature';
3
+ import { AzureDevOpsError } from '../../../shared/errors';
4
+ import { GitVersionType } from 'azure-devops-node-api/interfaces/GitInterfaces';
5
+ // Mock Azure Identity
6
+ jest.mock('@azure/identity', () => {
7
+ const mockGetToken = jest.fn().mockResolvedValue({ token: 'mock-token' });
8
+ return {
9
+ DefaultAzureCredential: jest.fn().mockImplementation(() => ({
10
+ getToken: mockGetToken,
11
+ })),
12
+ AzureCliCredential: jest.fn().mockImplementation(() => ({
13
+ getToken: mockGetToken,
14
+ })),
15
+ };
16
+ });
17
+ // Mock axios
18
+ jest.mock('axios');
19
+ const mockedAxios = axios;
20
+ describe('searchCode unit', () => {
21
+ // Mock WebApi connection
22
+ const mockConnection = {
23
+ getGitApi: jest.fn().mockImplementation(() => ({
24
+ getItemContent: jest.fn().mockImplementation((_repoId, path) => {
25
+ // Return different content based on the path to simulate different files
26
+ if (path === '/src/example.ts') {
27
+ return Buffer.from('export function example() { return "test"; }');
28
+ }
29
+ return Buffer.from('// Empty file');
30
+ }),
31
+ })),
32
+ _getHttpClient: jest.fn().mockReturnValue({
33
+ getAuthorizationHeader: jest.fn().mockReturnValue('Bearer mock-token'),
34
+ }),
35
+ getCoreApi: jest.fn().mockImplementation(() => ({
36
+ getProjects: jest
37
+ .fn()
38
+ .mockResolvedValue([{ name: 'TestProject', id: 'project-id' }]),
39
+ })),
40
+ serverUrl: 'https://dev.azure.com/testorg',
41
+ };
42
+ // Store original console.error
43
+ const originalConsoleError = console.error;
44
+ beforeEach(() => {
45
+ jest.clearAllMocks();
46
+ // Mock console.error to prevent error messages from being displayed during tests
47
+ console.error = jest.fn();
48
+ });
49
+ afterEach(() => {
50
+ // Restore original console.error
51
+ console.error = originalConsoleError;
52
+ });
53
+ test('should return search results with content', async () => {
54
+ // Arrange
55
+ const mockSearchResponse = {
56
+ data: {
57
+ count: 1,
58
+ results: [
59
+ {
60
+ fileName: 'example.ts',
61
+ path: '/src/example.ts',
62
+ matches: {
63
+ content: [
64
+ {
65
+ charOffset: 17,
66
+ length: 7,
67
+ },
68
+ ],
69
+ },
70
+ collection: {
71
+ name: 'DefaultCollection',
72
+ },
73
+ project: {
74
+ name: 'TestProject',
75
+ id: 'project-id',
76
+ },
77
+ repository: {
78
+ name: 'TestRepo',
79
+ id: 'repo-id',
80
+ type: 'git',
81
+ },
82
+ versions: [
83
+ {
84
+ branchName: 'main',
85
+ changeId: 'commit-hash',
86
+ },
87
+ ],
88
+ contentId: 'content-hash',
89
+ },
90
+ ],
91
+ },
92
+ };
93
+ mockedAxios.post.mockResolvedValueOnce(mockSearchResponse);
94
+ // Create a mock stream with content
95
+ const fileContent = 'export function example() { return "test"; }';
96
+ const mockStream = {
97
+ on: jest.fn().mockImplementation((event, callback) => {
98
+ if (event === 'data') {
99
+ // Call the callback with the data
100
+ callback(Buffer.from(fileContent));
101
+ }
102
+ else if (event === 'end') {
103
+ // Call the end callback asynchronously
104
+ setTimeout(callback, 0);
105
+ }
106
+ return mockStream; // Return this for chaining
107
+ }),
108
+ };
109
+ // Mock Git API to return content
110
+ const mockGitApi = {
111
+ getItemContent: jest.fn().mockResolvedValue(mockStream),
112
+ };
113
+ const mockConnectionWithContent = {
114
+ ...mockConnection,
115
+ getGitApi: jest.fn().mockResolvedValue(mockGitApi),
116
+ serverUrl: 'https://dev.azure.com/testorg',
117
+ };
118
+ // Act
119
+ const result = await searchCode(mockConnectionWithContent, {
120
+ searchText: 'example',
121
+ projectId: 'TestProject',
122
+ includeContent: true,
123
+ });
124
+ // Assert
125
+ expect(result).toBeDefined();
126
+ expect(result.count).toBe(1);
127
+ expect(result.results).toHaveLength(1);
128
+ expect(result.results[0].fileName).toBe('example.ts');
129
+ expect(result.results[0].content).toBe('export function example() { return "test"; }');
130
+ expect(mockedAxios.post).toHaveBeenCalledTimes(1);
131
+ expect(mockGitApi.getItemContent).toHaveBeenCalledTimes(1);
132
+ expect(mockGitApi.getItemContent).toHaveBeenCalledWith('repo-id', '/src/example.ts', 'TestProject', undefined, undefined, undefined, undefined, false, {
133
+ version: 'commit-hash',
134
+ versionType: GitVersionType.Commit,
135
+ }, true);
136
+ });
137
+ test('should use organizationId override for services search', async () => {
138
+ mockedAxios.post.mockResolvedValueOnce({
139
+ data: {
140
+ count: 0,
141
+ results: [],
142
+ },
143
+ });
144
+ await searchCode(mockConnection, {
145
+ searchText: 'override',
146
+ projectId: 'ProjectX',
147
+ organizationId: 'override-org',
148
+ });
149
+ expect(mockedAxios.post).toHaveBeenCalledWith('https://almsearch.dev.azure.com/override-org/ProjectX/_apis/search/codesearchresults?api-version=7.1', expect.any(Object), expect.any(Object));
150
+ });
151
+ test('should build server search URL when using Azure DevOps Server', async () => {
152
+ const serverConnection = {
153
+ ...mockConnection,
154
+ serverUrl: 'https://ado.local/tfs/DefaultCollection',
155
+ };
156
+ mockedAxios.post.mockResolvedValueOnce({
157
+ data: {
158
+ count: 0,
159
+ results: [],
160
+ },
161
+ });
162
+ await searchCode(serverConnection, {
163
+ searchText: 'server',
164
+ projectId: 'ProjectX',
165
+ });
166
+ expect(mockedAxios.post).toHaveBeenCalledWith('https://ado.local/tfs/DefaultCollection/ProjectX/_apis/search/codesearchresults?api-version=7.1', expect.any(Object), expect.any(Object));
167
+ });
168
+ test('should not fetch content when includeContent is false', async () => {
169
+ // Arrange
170
+ const mockSearchResponse = {
171
+ data: {
172
+ count: 1,
173
+ results: [
174
+ {
175
+ fileName: 'example.ts',
176
+ path: '/src/example.ts',
177
+ matches: {
178
+ content: [
179
+ {
180
+ charOffset: 17,
181
+ length: 7,
182
+ },
183
+ ],
184
+ },
185
+ collection: {
186
+ name: 'DefaultCollection',
187
+ },
188
+ project: {
189
+ name: 'TestProject',
190
+ id: 'project-id',
191
+ },
192
+ repository: {
193
+ name: 'TestRepo',
194
+ id: 'repo-id',
195
+ type: 'git',
196
+ },
197
+ versions: [
198
+ {
199
+ branchName: 'main',
200
+ changeId: 'commit-hash',
201
+ },
202
+ ],
203
+ contentId: 'content-hash',
204
+ },
205
+ ],
206
+ },
207
+ };
208
+ mockedAxios.post.mockResolvedValueOnce(mockSearchResponse);
209
+ // Act
210
+ const result = await searchCode(mockConnection, {
211
+ searchText: 'example',
212
+ projectId: 'TestProject',
213
+ includeContent: false,
214
+ });
215
+ // Assert
216
+ expect(result).toBeDefined();
217
+ expect(result.count).toBe(1);
218
+ expect(result.results).toHaveLength(1);
219
+ expect(result.results[0].fileName).toBe('example.ts');
220
+ expect(result.results[0].content).toBeUndefined();
221
+ expect(mockConnection.getGitApi).not.toHaveBeenCalled();
222
+ });
223
+ test('should handle empty search results', async () => {
224
+ // Arrange
225
+ const mockSearchResponse = {
226
+ data: {
227
+ count: 0,
228
+ results: [],
229
+ },
230
+ };
231
+ mockedAxios.post.mockResolvedValueOnce(mockSearchResponse);
232
+ // Act
233
+ const result = await searchCode(mockConnection, {
234
+ searchText: 'nonexistent',
235
+ projectId: 'TestProject',
236
+ });
237
+ // Assert
238
+ expect(result).toBeDefined();
239
+ expect(result.count).toBe(0);
240
+ expect(result.results).toHaveLength(0);
241
+ });
242
+ test('should handle API errors', async () => {
243
+ // Arrange
244
+ const axiosError = new Error('API Error');
245
+ axiosError.isAxiosError = true;
246
+ axiosError.response = {
247
+ status: 404,
248
+ data: {
249
+ message: 'Project not found',
250
+ },
251
+ };
252
+ mockedAxios.post.mockRejectedValueOnce(axiosError);
253
+ // Act & Assert
254
+ await expect(searchCode(mockConnection, {
255
+ searchText: 'example',
256
+ projectId: 'NonExistentProject',
257
+ })).rejects.toThrow(AzureDevOpsError);
258
+ });
259
+ test('should propagate custom errors when thrown internally', async () => {
260
+ // Arrange
261
+ const customError = new AzureDevOpsError('Custom error');
262
+ // Mock axios to properly return the custom error
263
+ mockedAxios.post.mockImplementationOnce(() => {
264
+ throw customError;
265
+ });
266
+ // Act & Assert
267
+ await expect(searchCode(mockConnection, {
268
+ searchText: 'example',
269
+ projectId: 'TestProject',
270
+ })).rejects.toThrow(AzureDevOpsError);
271
+ // Reset mock and set it up again for the second test
272
+ mockedAxios.post.mockReset();
273
+ mockedAxios.post.mockImplementationOnce(() => {
274
+ throw customError;
275
+ });
276
+ await expect(searchCode(mockConnection, {
277
+ searchText: 'example',
278
+ projectId: 'TestProject',
279
+ })).rejects.toThrow('Custom error');
280
+ });
281
+ test('should apply filters when provided', async () => {
282
+ // Arrange
283
+ const mockSearchResponse = {
284
+ data: {
285
+ count: 1,
286
+ results: [
287
+ {
288
+ fileName: 'example.ts',
289
+ path: '/src/example.ts',
290
+ matches: {
291
+ content: [
292
+ {
293
+ charOffset: 17,
294
+ length: 7,
295
+ },
296
+ ],
297
+ },
298
+ collection: {
299
+ name: 'DefaultCollection',
300
+ },
301
+ project: {
302
+ name: 'TestProject',
303
+ id: 'project-id',
304
+ },
305
+ repository: {
306
+ name: 'TestRepo',
307
+ id: 'repo-id',
308
+ type: 'git',
309
+ },
310
+ versions: [
311
+ {
312
+ branchName: 'main',
313
+ changeId: 'commit-hash',
314
+ },
315
+ ],
316
+ contentId: 'content-hash',
317
+ },
318
+ ],
319
+ },
320
+ };
321
+ mockedAxios.post.mockResolvedValueOnce(mockSearchResponse);
322
+ // Act
323
+ await searchCode(mockConnection, {
324
+ searchText: 'example',
325
+ projectId: 'TestProject',
326
+ filters: {
327
+ Repository: ['TestRepo'],
328
+ Path: ['/src'],
329
+ Branch: ['main'],
330
+ CodeElement: ['function'],
331
+ },
332
+ });
333
+ // Assert
334
+ expect(mockedAxios.post).toHaveBeenCalledWith(expect.any(String), expect.objectContaining({
335
+ filters: {
336
+ Project: ['TestProject'],
337
+ Repository: ['TestRepo'],
338
+ Path: ['/src'],
339
+ Branch: ['main'],
340
+ CodeElement: ['function'],
341
+ },
342
+ }), expect.any(Object));
343
+ });
344
+ test('should handle pagination parameters', async () => {
345
+ // Arrange
346
+ const mockSearchResponse = {
347
+ data: {
348
+ count: 100,
349
+ results: Array(10)
350
+ .fill(0)
351
+ .map((_, i) => ({
352
+ fileName: `example${i}.ts`,
353
+ path: `/src/example${i}.ts`,
354
+ matches: {
355
+ content: [
356
+ {
357
+ charOffset: 17,
358
+ length: 7,
359
+ },
360
+ ],
361
+ },
362
+ collection: {
363
+ name: 'DefaultCollection',
364
+ },
365
+ project: {
366
+ name: 'TestProject',
367
+ id: 'project-id',
368
+ },
369
+ repository: {
370
+ name: 'TestRepo',
371
+ id: 'repo-id',
372
+ type: 'git',
373
+ },
374
+ versions: [
375
+ {
376
+ branchName: 'main',
377
+ changeId: 'commit-hash',
378
+ },
379
+ ],
380
+ contentId: `content-hash-${i}`,
381
+ })),
382
+ },
383
+ };
384
+ mockedAxios.post.mockResolvedValueOnce(mockSearchResponse);
385
+ // Act
386
+ await searchCode(mockConnection, {
387
+ searchText: 'example',
388
+ projectId: 'TestProject',
389
+ top: 10,
390
+ skip: 20,
391
+ });
392
+ // Assert
393
+ expect(mockedAxios.post).toHaveBeenCalledWith(expect.any(String), expect.objectContaining({
394
+ $top: 10,
395
+ $skip: 20,
396
+ }), expect.any(Object));
397
+ });
398
+ test('should handle errors when fetching file content', async () => {
399
+ // Arrange
400
+ const mockSearchResponse = {
401
+ data: {
402
+ count: 1,
403
+ results: [
404
+ {
405
+ fileName: 'example.ts',
406
+ path: '/src/example.ts',
407
+ matches: {
408
+ content: [
409
+ {
410
+ charOffset: 17,
411
+ length: 7,
412
+ },
413
+ ],
414
+ },
415
+ collection: {
416
+ name: 'DefaultCollection',
417
+ },
418
+ project: {
419
+ name: 'TestProject',
420
+ id: 'project-id',
421
+ },
422
+ repository: {
423
+ name: 'TestRepo',
424
+ id: 'repo-id',
425
+ type: 'git',
426
+ },
427
+ versions: [
428
+ {
429
+ branchName: 'main',
430
+ changeId: 'commit-hash',
431
+ },
432
+ ],
433
+ contentId: 'content-hash',
434
+ },
435
+ ],
436
+ },
437
+ };
438
+ mockedAxios.post.mockResolvedValueOnce(mockSearchResponse);
439
+ // Mock Git API to throw an error
440
+ const mockGitApi = {
441
+ getItemContent: jest
442
+ .fn()
443
+ .mockRejectedValue(new Error('Failed to fetch content')),
444
+ };
445
+ const mockConnectionWithError = {
446
+ ...mockConnection,
447
+ getGitApi: jest.fn().mockResolvedValue(mockGitApi),
448
+ };
449
+ // Act
450
+ const result = await searchCode(mockConnectionWithError, {
451
+ searchText: 'example',
452
+ projectId: 'TestProject',
453
+ includeContent: true,
454
+ });
455
+ // Assert
456
+ expect(result).toBeDefined();
457
+ expect(result.count).toBe(1);
458
+ expect(result.results).toHaveLength(1);
459
+ // Content should be undefined when there's an error fetching it
460
+ expect(result.results[0].content).toBeUndefined();
461
+ });
462
+ test('should use default project when projectId is not provided', async () => {
463
+ // Arrange
464
+ // Set up environment variable for default project
465
+ const originalEnv = process.env.AZURE_DEVOPS_DEFAULT_PROJECT;
466
+ process.env.AZURE_DEVOPS_DEFAULT_PROJECT = 'DefaultProject';
467
+ const mockSearchResponse = {
468
+ data: {
469
+ count: 2,
470
+ results: [
471
+ {
472
+ fileName: 'example1.ts',
473
+ path: '/src/example1.ts',
474
+ matches: {
475
+ content: [
476
+ {
477
+ charOffset: 17,
478
+ length: 7,
479
+ },
480
+ ],
481
+ },
482
+ collection: {
483
+ name: 'DefaultCollection',
484
+ },
485
+ project: {
486
+ name: 'DefaultProject',
487
+ id: 'default-project-id',
488
+ },
489
+ repository: {
490
+ name: 'Repo1',
491
+ id: 'repo-id-1',
492
+ type: 'git',
493
+ },
494
+ versions: [
495
+ {
496
+ branchName: 'main',
497
+ changeId: 'commit-hash-1',
498
+ },
499
+ ],
500
+ contentId: 'content-hash-1',
501
+ },
502
+ {
503
+ fileName: 'example2.ts',
504
+ path: '/src/example2.ts',
505
+ matches: {
506
+ content: [
507
+ {
508
+ charOffset: 17,
509
+ length: 7,
510
+ },
511
+ ],
512
+ },
513
+ collection: {
514
+ name: 'DefaultCollection',
515
+ },
516
+ project: {
517
+ name: 'DefaultProject',
518
+ id: 'default-project-id',
519
+ },
520
+ repository: {
521
+ name: 'Repo2',
522
+ id: 'repo-id-2',
523
+ type: 'git',
524
+ },
525
+ versions: [
526
+ {
527
+ branchName: 'main',
528
+ changeId: 'commit-hash-2',
529
+ },
530
+ ],
531
+ contentId: 'content-hash-2',
532
+ },
533
+ ],
534
+ },
535
+ };
536
+ mockedAxios.post.mockResolvedValueOnce(mockSearchResponse);
537
+ try {
538
+ // Act
539
+ const result = await searchCode(mockConnection, {
540
+ searchText: 'example',
541
+ includeContent: false,
542
+ });
543
+ // Assert
544
+ expect(result).toBeDefined();
545
+ expect(result.count).toBe(2);
546
+ expect(result.results).toHaveLength(2);
547
+ expect(result.results[0].project.name).toBe('DefaultProject');
548
+ expect(result.results[1].project.name).toBe('DefaultProject');
549
+ expect(mockedAxios.post).toHaveBeenCalledTimes(1);
550
+ expect(mockedAxios.post).toHaveBeenCalledWith(expect.stringContaining('https://almsearch.dev.azure.com/testorg/DefaultProject/_apis/search/codesearchresults'), expect.objectContaining({
551
+ filters: expect.objectContaining({
552
+ Project: ['DefaultProject'],
553
+ }),
554
+ }), expect.any(Object));
555
+ }
556
+ finally {
557
+ // Restore original environment variable
558
+ process.env.AZURE_DEVOPS_DEFAULT_PROJECT = originalEnv;
559
+ }
560
+ });
561
+ test('should throw error when no projectId is provided and no default project is set', async () => {
562
+ // Arrange
563
+ // Ensure no default project is set
564
+ const originalEnv = process.env.AZURE_DEVOPS_DEFAULT_PROJECT;
565
+ process.env.AZURE_DEVOPS_DEFAULT_PROJECT = '';
566
+ try {
567
+ // Act & Assert
568
+ await expect(searchCode(mockConnection, {
569
+ searchText: 'example',
570
+ includeContent: false,
571
+ })).rejects.toThrow('Project ID is required');
572
+ }
573
+ finally {
574
+ // Restore original environment variable
575
+ process.env.AZURE_DEVOPS_DEFAULT_PROJECT = originalEnv;
576
+ }
577
+ });
578
+ test('should handle includeContent for different content types', async () => {
579
+ // Arrange
580
+ const mockSearchResponse = {
581
+ data: {
582
+ count: 4,
583
+ results: [
584
+ // Result 1 - Buffer content
585
+ {
586
+ fileName: 'example1.ts',
587
+ path: '/src/example1.ts',
588
+ matches: {
589
+ content: [
590
+ {
591
+ charOffset: 17,
592
+ length: 7,
593
+ },
594
+ ],
595
+ },
596
+ collection: {
597
+ name: 'DefaultCollection',
598
+ },
599
+ project: {
600
+ name: 'TestProject',
601
+ id: 'project-id',
602
+ },
603
+ repository: {
604
+ name: 'TestRepo',
605
+ id: 'repo-id-1',
606
+ type: 'git',
607
+ },
608
+ versions: [
609
+ {
610
+ branchName: 'main',
611
+ changeId: 'commit-hash-1',
612
+ },
613
+ ],
614
+ contentId: 'content-hash-1',
615
+ },
616
+ // Result 2 - String content
617
+ {
618
+ fileName: 'example2.ts',
619
+ path: '/src/example2.ts',
620
+ matches: {
621
+ content: [
622
+ {
623
+ charOffset: 17,
624
+ length: 7,
625
+ },
626
+ ],
627
+ },
628
+ collection: {
629
+ name: 'DefaultCollection',
630
+ },
631
+ project: {
632
+ name: 'TestProject',
633
+ id: 'project-id',
634
+ },
635
+ repository: {
636
+ name: 'TestRepo',
637
+ id: 'repo-id-2',
638
+ type: 'git',
639
+ },
640
+ versions: [
641
+ {
642
+ branchName: 'main',
643
+ changeId: 'commit-hash-2',
644
+ },
645
+ ],
646
+ contentId: 'content-hash-2',
647
+ },
648
+ // Result 3 - Object content
649
+ {
650
+ fileName: 'example3.ts',
651
+ path: '/src/example3.ts',
652
+ matches: {
653
+ content: [
654
+ {
655
+ charOffset: 17,
656
+ length: 7,
657
+ },
658
+ ],
659
+ },
660
+ collection: {
661
+ name: 'DefaultCollection',
662
+ },
663
+ project: {
664
+ name: 'TestProject',
665
+ id: 'project-id',
666
+ },
667
+ repository: {
668
+ name: 'TestRepo',
669
+ id: 'repo-id-3',
670
+ type: 'git',
671
+ },
672
+ versions: [
673
+ {
674
+ branchName: 'main',
675
+ changeId: 'commit-hash-3',
676
+ },
677
+ ],
678
+ contentId: 'content-hash-3',
679
+ },
680
+ // Result 4 - Uint8Array content
681
+ {
682
+ fileName: 'example4.ts',
683
+ path: '/src/example4.ts',
684
+ matches: {
685
+ content: [
686
+ {
687
+ charOffset: 17,
688
+ length: 7,
689
+ },
690
+ ],
691
+ },
692
+ collection: {
693
+ name: 'DefaultCollection',
694
+ },
695
+ project: {
696
+ name: 'TestProject',
697
+ id: 'project-id',
698
+ },
699
+ repository: {
700
+ name: 'TestRepo',
701
+ id: 'repo-id-4',
702
+ type: 'git',
703
+ },
704
+ versions: [
705
+ {
706
+ branchName: 'main',
707
+ changeId: 'commit-hash-4',
708
+ },
709
+ ],
710
+ contentId: 'content-hash-4',
711
+ },
712
+ ],
713
+ },
714
+ };
715
+ mockedAxios.post.mockResolvedValueOnce(mockSearchResponse);
716
+ // Create mock contents for each type - all as streams, since that's what getItemContent returns
717
+ // These are all streams but with different content to demonstrate handling different data types from the stream
718
+ const createMockStream = (content) => ({
719
+ on: jest.fn().mockImplementation((event, callback) => {
720
+ if (event === 'data') {
721
+ callback(Buffer.from(content));
722
+ }
723
+ else if (event === 'end') {
724
+ setTimeout(callback, 0);
725
+ }
726
+ return createMockStream(content); // Return this for chaining
727
+ }),
728
+ });
729
+ // Create four different mock streams with different content
730
+ const mockStream1 = createMockStream('Buffer content');
731
+ const mockStream2 = createMockStream('String content');
732
+ const mockStream3 = createMockStream(JSON.stringify({ foo: 'bar', baz: 42 }));
733
+ const mockStream4 = createMockStream('hello');
734
+ // Mock Git API to return our different mock streams for each repository
735
+ const mockGitApi = {
736
+ getItemContent: jest
737
+ .fn()
738
+ .mockImplementationOnce(() => Promise.resolve(mockStream1))
739
+ .mockImplementationOnce(() => Promise.resolve(mockStream2))
740
+ .mockImplementationOnce(() => Promise.resolve(mockStream3))
741
+ .mockImplementationOnce(() => Promise.resolve(mockStream4)),
742
+ };
743
+ const mockConnectionWithStreams = {
744
+ ...mockConnection,
745
+ getGitApi: jest.fn().mockResolvedValue(mockGitApi),
746
+ serverUrl: 'https://dev.azure.com/testorg',
747
+ };
748
+ // Act
749
+ const result = await searchCode(mockConnectionWithStreams, {
750
+ searchText: 'example',
751
+ projectId: 'TestProject',
752
+ includeContent: true,
753
+ });
754
+ // Assert
755
+ expect(result).toBeDefined();
756
+ expect(result.count).toBe(4);
757
+ expect(result.results).toHaveLength(4);
758
+ // Check each result has appropriate content from the streams
759
+ // Result 1 - Buffer content stream
760
+ expect(result.results[0].content).toBe('Buffer content');
761
+ // Result 2 - String content stream
762
+ expect(result.results[1].content).toBe('String content');
763
+ // Result 3 - JSON object content stream
764
+ expect(result.results[2].content).toBe('{"foo":"bar","baz":42}');
765
+ // Result 4 - Text content stream
766
+ expect(result.results[3].content).toBe('hello');
767
+ // Git API should have been called 4 times
768
+ expect(mockGitApi.getItemContent).toHaveBeenCalledTimes(4);
769
+ // Verify the parameters for the first call
770
+ expect(mockGitApi.getItemContent.mock.calls[0]).toEqual([
771
+ 'repo-id-1',
772
+ '/src/example1.ts',
773
+ 'TestProject',
774
+ undefined,
775
+ undefined,
776
+ undefined,
777
+ undefined,
778
+ false,
779
+ {
780
+ version: 'commit-hash-1',
781
+ versionType: GitVersionType.Commit,
782
+ },
783
+ true,
784
+ ]);
785
+ });
786
+ test('should properly convert content stream to string', async () => {
787
+ // Arrange
788
+ const mockSearchResponse = {
789
+ data: {
790
+ count: 1,
791
+ results: [
792
+ {
793
+ fileName: 'example.ts',
794
+ path: '/src/example.ts',
795
+ matches: {
796
+ content: [
797
+ {
798
+ charOffset: 17,
799
+ length: 7,
800
+ },
801
+ ],
802
+ },
803
+ collection: {
804
+ name: 'DefaultCollection',
805
+ },
806
+ project: {
807
+ name: 'TestProject',
808
+ id: 'project-id',
809
+ },
810
+ repository: {
811
+ name: 'TestRepo',
812
+ id: 'repo-id',
813
+ type: 'git',
814
+ },
815
+ versions: [
816
+ {
817
+ branchName: 'main',
818
+ changeId: 'commit-hash',
819
+ },
820
+ ],
821
+ contentId: 'content-hash',
822
+ },
823
+ ],
824
+ },
825
+ };
826
+ mockedAxios.post.mockResolvedValueOnce(mockSearchResponse);
827
+ // Create a mock ReadableStream
828
+ const mockContent = 'This is the file content';
829
+ // Create a simplified mock stream that emits the content
830
+ const mockStream = {
831
+ on: jest.fn().mockImplementation((event, callback) => {
832
+ if (event === 'data') {
833
+ // Call the callback with the data
834
+ callback(Buffer.from(mockContent));
835
+ }
836
+ else if (event === 'end') {
837
+ // Call the end callback asynchronously
838
+ setTimeout(callback, 0);
839
+ }
840
+ return mockStream; // Return this for chaining
841
+ }),
842
+ };
843
+ // Mock Git API to return our mock stream
844
+ const mockGitApi = {
845
+ getItemContent: jest.fn().mockResolvedValue(mockStream),
846
+ };
847
+ const mockConnectionWithStream = {
848
+ ...mockConnection,
849
+ getGitApi: jest.fn().mockResolvedValue(mockGitApi),
850
+ serverUrl: 'https://dev.azure.com/testorg',
851
+ };
852
+ // Act
853
+ const result = await searchCode(mockConnectionWithStream, {
854
+ searchText: 'example',
855
+ projectId: 'TestProject',
856
+ includeContent: true,
857
+ });
858
+ // Assert
859
+ expect(result).toBeDefined();
860
+ expect(result.count).toBe(1);
861
+ expect(result.results).toHaveLength(1);
862
+ // Check that the content was properly converted from stream to string
863
+ expect(result.results[0].content).toBe(mockContent);
864
+ // Verify the stream event handlers were attached
865
+ expect(mockStream.on).toHaveBeenCalledWith('data', expect.any(Function));
866
+ expect(mockStream.on).toHaveBeenCalledWith('end', expect.any(Function));
867
+ expect(mockStream.on).toHaveBeenCalledWith('error', expect.any(Function));
868
+ // Verify the parameters for getItemContent
869
+ expect(mockGitApi.getItemContent).toHaveBeenCalledWith('repo-id', '/src/example.ts', 'TestProject', undefined, undefined, undefined, undefined, false, {
870
+ version: 'commit-hash',
871
+ versionType: GitVersionType.Commit,
872
+ }, true);
873
+ });
874
+ test('should limit top to 10 when includeContent is true', async () => {
875
+ // Arrange
876
+ const mockSearchResponse = {
877
+ data: {
878
+ count: 10,
879
+ results: Array(10)
880
+ .fill(0)
881
+ .map((_, i) => ({
882
+ fileName: `example${i}.ts`,
883
+ path: `/src/example${i}.ts`,
884
+ matches: {
885
+ content: [
886
+ {
887
+ charOffset: 17,
888
+ length: 7,
889
+ },
890
+ ],
891
+ },
892
+ collection: {
893
+ name: 'DefaultCollection',
894
+ },
895
+ project: {
896
+ name: 'TestProject',
897
+ id: 'project-id',
898
+ },
899
+ repository: {
900
+ name: 'TestRepo',
901
+ id: 'repo-id',
902
+ type: 'git',
903
+ },
904
+ versions: [
905
+ {
906
+ branchName: 'main',
907
+ changeId: 'commit-hash',
908
+ },
909
+ ],
910
+ contentId: `content-hash-${i}`,
911
+ })),
912
+ },
913
+ };
914
+ mockedAxios.post.mockResolvedValueOnce(mockSearchResponse);
915
+ // For this test, we don't need to mock the Git API since we're only testing the top parameter
916
+ // We'll create a connection that doesn't have includeContent functionality
917
+ const mockConnectionWithoutContent = {
918
+ ...mockConnection,
919
+ getGitApi: jest.fn().mockImplementation(() => {
920
+ throw new Error('Git API not available');
921
+ }),
922
+ serverUrl: 'https://dev.azure.com/testorg',
923
+ };
924
+ // Act
925
+ await searchCode(mockConnectionWithoutContent, {
926
+ searchText: 'example',
927
+ projectId: 'TestProject',
928
+ top: 50, // User tries to get 50 results
929
+ includeContent: true, // But includeContent is true
930
+ });
931
+ // Assert
932
+ expect(mockedAxios.post).toHaveBeenCalledWith(expect.any(String), expect.objectContaining({
933
+ $top: 10, // Should be limited to 10
934
+ }), expect.any(Object));
935
+ });
936
+ test('should not limit top when includeContent is false', async () => {
937
+ // Arrange
938
+ const mockSearchResponse = {
939
+ data: {
940
+ count: 50,
941
+ results: Array(50)
942
+ .fill(0)
943
+ .map((_, i) => ({
944
+ // ... simplified result object
945
+ fileName: `example${i}.ts`,
946
+ })),
947
+ },
948
+ };
949
+ mockedAxios.post.mockResolvedValueOnce(mockSearchResponse);
950
+ // Act
951
+ await searchCode(mockConnection, {
952
+ searchText: 'example',
953
+ projectId: 'TestProject',
954
+ top: 50, // User wants 50 results
955
+ includeContent: false, // includeContent is false
956
+ });
957
+ // Assert
958
+ expect(mockedAxios.post).toHaveBeenCalledWith(expect.any(String), expect.objectContaining({
959
+ $top: 50, // Should use requested value
960
+ }), expect.any(Object));
961
+ });
962
+ });
963
+ //# sourceMappingURL=feature.spec.unit.js.map