@qawolf/ci-sdk 0.22.0 → 0.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (461) hide show
  1. package/README.md +9 -0
  2. package/dist/index.d.mts +561 -0
  3. package/dist/index.d.ts +561 -0
  4. package/dist/index.js +1619 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.mjs +1610 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/package.json +13 -9
  9. package/dist/cjs/index.d.ts +0 -5
  10. package/dist/cjs/index.d.ts.map +0 -1
  11. package/dist/cjs/index.js +0 -7
  12. package/dist/cjs/index.js.map +0 -1
  13. package/dist/cjs/lib/api/ci-greenlight.d.ts +0 -145
  14. package/dist/cjs/lib/api/ci-greenlight.d.ts.map +0 -1
  15. package/dist/cjs/lib/api/ci-greenlight.js +0 -52
  16. package/dist/cjs/lib/api/ci-greenlight.js.map +0 -1
  17. package/dist/cjs/lib/api/generate-signed-url-for-run-inputs-executables.d.ts +0 -5
  18. package/dist/cjs/lib/api/generate-signed-url-for-run-inputs-executables.d.ts.map +0 -1
  19. package/dist/cjs/lib/api/generate-signed-url-for-run-inputs-executables.js +0 -38
  20. package/dist/cjs/lib/api/generate-signed-url-for-run-inputs-executables.js.map +0 -1
  21. package/dist/cjs/lib/api/generate-signed-url-for-team-storage.d.ts +0 -5
  22. package/dist/cjs/lib/api/generate-signed-url-for-team-storage.d.ts.map +0 -1
  23. package/dist/cjs/lib/api/generate-signed-url-for-team-storage.js +0 -38
  24. package/dist/cjs/lib/api/generate-signed-url-for-team-storage.js.map +0 -1
  25. package/dist/cjs/lib/api/graphql.d.ts +0 -33
  26. package/dist/cjs/lib/api/graphql.d.ts.map +0 -1
  27. package/dist/cjs/lib/api/graphql.js +0 -70
  28. package/dist/cjs/lib/api/graphql.js.map +0 -1
  29. package/dist/cjs/lib/api/index.d.ts +0 -3
  30. package/dist/cjs/lib/api/index.d.ts.map +0 -1
  31. package/dist/cjs/lib/api/index.js +0 -6
  32. package/dist/cjs/lib/api/index.js.map +0 -1
  33. package/dist/cjs/lib/api/notify-vcs-branch-build-deployed-mutation.d.ts +0 -27
  34. package/dist/cjs/lib/api/notify-vcs-branch-build-deployed-mutation.d.ts.map +0 -1
  35. package/dist/cjs/lib/api/notify-vcs-branch-build-deployed-mutation.js +0 -59
  36. package/dist/cjs/lib/api/notify-vcs-branch-build-deployed-mutation.js.map +0 -1
  37. package/dist/cjs/lib/api/notify-vcs-branch-merge-canceled-mutation.d.ts +0 -16
  38. package/dist/cjs/lib/api/notify-vcs-branch-merge-canceled-mutation.d.ts.map +0 -1
  39. package/dist/cjs/lib/api/notify-vcs-branch-merge-canceled-mutation.js +0 -26
  40. package/dist/cjs/lib/api/notify-vcs-branch-merge-canceled-mutation.js.map +0 -1
  41. package/dist/cjs/lib/api/notify-vcs-branch-merge-completed-mutation.d.ts +0 -17
  42. package/dist/cjs/lib/api/notify-vcs-branch-merge-completed-mutation.d.ts.map +0 -1
  43. package/dist/cjs/lib/api/notify-vcs-branch-merge-completed-mutation.js +0 -27
  44. package/dist/cjs/lib/api/notify-vcs-branch-merge-completed-mutation.js.map +0 -1
  45. package/dist/cjs/lib/api-types.d.ts +0 -6
  46. package/dist/cjs/lib/api-types.d.ts.map +0 -1
  47. package/dist/cjs/lib/api-types.js +0 -3
  48. package/dist/cjs/lib/api-types.js.map +0 -1
  49. package/dist/cjs/lib/other.d.ts +0 -6
  50. package/dist/cjs/lib/other.d.ts.map +0 -1
  51. package/dist/cjs/lib/other.js +0 -18
  52. package/dist/cjs/lib/other.js.map +0 -1
  53. package/dist/cjs/lib/sdk/defaults/fetch.d.ts +0 -2
  54. package/dist/cjs/lib/sdk/defaults/fetch.d.ts.map +0 -1
  55. package/dist/cjs/lib/sdk/defaults/fetch.js +0 -5
  56. package/dist/cjs/lib/sdk/defaults/fetch.js.map +0 -1
  57. package/dist/cjs/lib/sdk/defaults/log.d.ts +0 -3
  58. package/dist/cjs/lib/sdk/defaults/log.d.ts.map +0 -1
  59. package/dist/cjs/lib/sdk/defaults/log.js +0 -15
  60. package/dist/cjs/lib/sdk/defaults/log.js.map +0 -1
  61. package/dist/cjs/lib/sdk/defaults/serviceBase.d.ts +0 -2
  62. package/dist/cjs/lib/sdk/defaults/serviceBase.d.ts.map +0 -1
  63. package/dist/cjs/lib/sdk/defaults/serviceBase.js +0 -5
  64. package/dist/cjs/lib/sdk/defaults/serviceBase.js.map +0 -1
  65. package/dist/cjs/lib/sdk/defaults/userAgent.d.ts +0 -2
  66. package/dist/cjs/lib/sdk/defaults/userAgent.d.ts.map +0 -1
  67. package/dist/cjs/lib/sdk/defaults/userAgent.js +0 -6
  68. package/dist/cjs/lib/sdk/defaults/userAgent.js.map +0 -1
  69. package/dist/cjs/lib/sdk/dependencies.d.ts +0 -8
  70. package/dist/cjs/lib/sdk/dependencies.d.ts.map +0 -1
  71. package/dist/cjs/lib/sdk/dependencies.js +0 -3
  72. package/dist/cjs/lib/sdk/dependencies.js.map +0 -1
  73. package/dist/cjs/lib/sdk/domain/attemptDeploy/index.d.ts +0 -39
  74. package/dist/cjs/lib/sdk/domain/attemptDeploy/index.d.ts.map +0 -1
  75. package/dist/cjs/lib/sdk/domain/attemptDeploy/index.js +0 -111
  76. package/dist/cjs/lib/sdk/domain/attemptDeploy/index.js.map +0 -1
  77. package/dist/cjs/lib/sdk/domain/attemptDeploy/types.d.ts +0 -65
  78. package/dist/cjs/lib/sdk/domain/attemptDeploy/types.d.ts.map +0 -1
  79. package/dist/cjs/lib/sdk/domain/attemptDeploy/types.js +0 -3
  80. package/dist/cjs/lib/sdk/domain/attemptDeploy/types.js.map +0 -1
  81. package/dist/cjs/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-run-inputs-executables.d.ts +0 -5
  82. package/dist/cjs/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-run-inputs-executables.d.ts.map +0 -1
  83. package/dist/cjs/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-run-inputs-executables.js +0 -46
  84. package/dist/cjs/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-run-inputs-executables.js.map +0 -1
  85. package/dist/cjs/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-team-storage.d.ts +0 -17
  86. package/dist/cjs/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-team-storage.d.ts.map +0 -1
  87. package/dist/cjs/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-team-storage.js +0 -46
  88. package/dist/cjs/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-team-storage.js.map +0 -1
  89. package/dist/cjs/lib/sdk/domain/generateSignedUrls/types.d.ts +0 -23
  90. package/dist/cjs/lib/sdk/domain/generateSignedUrls/types.d.ts.map +0 -1
  91. package/dist/cjs/lib/sdk/domain/generateSignedUrls/types.js +0 -3
  92. package/dist/cjs/lib/sdk/domain/generateSignedUrls/types.js.map +0 -1
  93. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/constants.d.ts +0 -5
  94. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/constants.d.ts.map +0 -1
  95. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/constants.js +0 -8
  96. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/constants.js.map +0 -1
  97. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/createEnvironmentAction.d.ts +0 -19
  98. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/createEnvironmentAction.d.ts.map +0 -1
  99. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/createEnvironmentAction.js +0 -63
  100. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/createEnvironmentAction.js.map +0 -1
  101. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/createEnvironmentVariables.d.ts +0 -9
  102. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/createEnvironmentVariables.d.ts.map +0 -1
  103. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/createEnvironmentVariables.js +0 -32
  104. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/createEnvironmentVariables.js.map +0 -1
  105. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/deleteEnvironment.d.ts +0 -6
  106. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/deleteEnvironment.d.ts.map +0 -1
  107. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/deleteEnvironment.js +0 -27
  108. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/deleteEnvironment.js.map +0 -1
  109. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/deleteEnvironmentAction.d.ts +0 -6
  110. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/deleteEnvironmentAction.d.ts.map +0 -1
  111. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/deleteEnvironmentAction.js +0 -13
  112. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/deleteEnvironmentAction.js.map +0 -1
  113. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/findOrCreateEnvironment.d.ts +0 -29
  114. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/findOrCreateEnvironment.d.ts.map +0 -1
  115. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/findOrCreateEnvironment.js +0 -152
  116. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/findOrCreateEnvironment.js.map +0 -1
  117. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/findOrCreateTrigger.d.ts +0 -18
  118. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/findOrCreateTrigger.d.ts.map +0 -1
  119. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/findOrCreateTrigger.js +0 -96
  120. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/findOrCreateTrigger.js.map +0 -1
  121. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/findRepositoryIdByName.d.ts +0 -6
  122. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/findRepositoryIdByName.d.ts.map +0 -1
  123. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/findRepositoryIdByName.js +0 -36
  124. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/findRepositoryIdByName.js.map +0 -1
  125. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/getEnvironmentIdForBranch.d.ts +0 -4
  126. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/getEnvironmentIdForBranch.d.ts.map +0 -1
  127. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/getEnvironmentIdForBranch.js +0 -37
  128. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/getEnvironmentIdForBranch.js.map +0 -1
  129. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/getEnvironmentVariablesFromEnvironment.d.ts +0 -6
  130. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/getEnvironmentVariablesFromEnvironment.d.ts.map +0 -1
  131. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/getEnvironmentVariablesFromEnvironment.js +0 -34
  132. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/getEnvironmentVariablesFromEnvironment.js.map +0 -1
  133. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/getTagsFromEnvironment.d.ts +0 -9
  134. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/getTagsFromEnvironment.d.ts.map +0 -1
  135. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/getTagsFromEnvironment.js +0 -40
  136. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/getTagsFromEnvironment.js.map +0 -1
  137. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/index.d.ts +0 -23
  138. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/index.d.ts.map +0 -1
  139. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/index.js +0 -31
  140. package/dist/cjs/lib/sdk/domain/legacy_previewTesting/index.js.map +0 -1
  141. package/dist/cjs/lib/sdk/domain/poll-ci-greenlight.d.ts +0 -84
  142. package/dist/cjs/lib/sdk/domain/poll-ci-greenlight.d.ts.map +0 -1
  143. package/dist/cjs/lib/sdk/domain/poll-ci-greenlight.js +0 -165
  144. package/dist/cjs/lib/sdk/domain/poll-ci-greenlight.js.map +0 -1
  145. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/index.d.ts +0 -37
  146. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/index.d.ts.map +0 -1
  147. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/index.js +0 -23
  148. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/index.js.map +0 -1
  149. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/lib/aliases.d.ts +0 -24
  150. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/lib/aliases.d.ts.map +0 -1
  151. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/lib/aliases.js +0 -19
  152. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/lib/aliases.js.map +0 -1
  153. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/lib/domain-failure.d.ts +0 -18
  154. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/lib/domain-failure.d.ts.map +0 -1
  155. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/lib/domain-failure.js +0 -59
  156. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/lib/domain-failure.js.map +0 -1
  157. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/lib/graphql-error.d.ts +0 -23
  158. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/lib/graphql-error.d.ts.map +0 -1
  159. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/lib/graphql-error.js +0 -26
  160. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/lib/graphql-error.js.map +0 -1
  161. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/lib/retry.d.ts +0 -16
  162. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/lib/retry.d.ts.map +0 -1
  163. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/lib/retry.js +0 -26
  164. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/lib/retry.js.map +0 -1
  165. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-build-deployed.d.ts +0 -65
  166. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-build-deployed.d.ts.map +0 -1
  167. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-build-deployed.js +0 -84
  168. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-build-deployed.js.map +0 -1
  169. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-canceled.d.ts +0 -20
  170. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-canceled.d.ts.map +0 -1
  171. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-canceled.js +0 -48
  172. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-canceled.js.map +0 -1
  173. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-completed.d.ts +0 -13
  174. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-completed.d.ts.map +0 -1
  175. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-completed.js +0 -53
  176. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-completed.js.map +0 -1
  177. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/types.d.ts +0 -40
  178. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/types.d.ts.map +0 -1
  179. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/types.js +0 -3
  180. package/dist/cjs/lib/sdk/domain/vcsBranchTesting/types.js.map +0 -1
  181. package/dist/cjs/lib/sdk/index.d.ts +0 -36
  182. package/dist/cjs/lib/sdk/index.d.ts.map +0 -1
  183. package/dist/cjs/lib/sdk/index.js +0 -44
  184. package/dist/cjs/lib/sdk/index.js.map +0 -1
  185. package/dist/cjs/package.json +0 -1
  186. package/dist/cjs/tests/test-lib.d.ts +0 -43
  187. package/dist/cjs/tests/test-lib.d.ts.map +0 -1
  188. package/dist/cjs/tests/test-lib.js +0 -148
  189. package/dist/cjs/tests/test-lib.js.map +0 -1
  190. package/dist/esm/index.d.ts +0 -5
  191. package/dist/esm/index.d.ts.map +0 -1
  192. package/dist/esm/index.js +0 -4
  193. package/dist/esm/index.js.map +0 -1
  194. package/dist/esm/lib/api/ci-greenlight.d.ts +0 -145
  195. package/dist/esm/lib/api/ci-greenlight.d.ts.map +0 -1
  196. package/dist/esm/lib/api/ci-greenlight.js +0 -49
  197. package/dist/esm/lib/api/ci-greenlight.js.map +0 -1
  198. package/dist/esm/lib/api/generate-signed-url-for-run-inputs-executables.d.ts +0 -5
  199. package/dist/esm/lib/api/generate-signed-url-for-run-inputs-executables.d.ts.map +0 -1
  200. package/dist/esm/lib/api/generate-signed-url-for-run-inputs-executables.js +0 -35
  201. package/dist/esm/lib/api/generate-signed-url-for-run-inputs-executables.js.map +0 -1
  202. package/dist/esm/lib/api/generate-signed-url-for-team-storage.d.ts +0 -5
  203. package/dist/esm/lib/api/generate-signed-url-for-team-storage.d.ts.map +0 -1
  204. package/dist/esm/lib/api/generate-signed-url-for-team-storage.js +0 -35
  205. package/dist/esm/lib/api/generate-signed-url-for-team-storage.js.map +0 -1
  206. package/dist/esm/lib/api/graphql.d.ts +0 -33
  207. package/dist/esm/lib/api/graphql.d.ts.map +0 -1
  208. package/dist/esm/lib/api/graphql.js +0 -67
  209. package/dist/esm/lib/api/graphql.js.map +0 -1
  210. package/dist/esm/lib/api/index.d.ts +0 -3
  211. package/dist/esm/lib/api/index.d.ts.map +0 -1
  212. package/dist/esm/lib/api/index.js +0 -3
  213. package/dist/esm/lib/api/index.js.map +0 -1
  214. package/dist/esm/lib/api/notify-vcs-branch-build-deployed-mutation.d.ts +0 -27
  215. package/dist/esm/lib/api/notify-vcs-branch-build-deployed-mutation.d.ts.map +0 -1
  216. package/dist/esm/lib/api/notify-vcs-branch-build-deployed-mutation.js +0 -56
  217. package/dist/esm/lib/api/notify-vcs-branch-build-deployed-mutation.js.map +0 -1
  218. package/dist/esm/lib/api/notify-vcs-branch-merge-canceled-mutation.d.ts +0 -16
  219. package/dist/esm/lib/api/notify-vcs-branch-merge-canceled-mutation.d.ts.map +0 -1
  220. package/dist/esm/lib/api/notify-vcs-branch-merge-canceled-mutation.js +0 -23
  221. package/dist/esm/lib/api/notify-vcs-branch-merge-canceled-mutation.js.map +0 -1
  222. package/dist/esm/lib/api/notify-vcs-branch-merge-completed-mutation.d.ts +0 -17
  223. package/dist/esm/lib/api/notify-vcs-branch-merge-completed-mutation.d.ts.map +0 -1
  224. package/dist/esm/lib/api/notify-vcs-branch-merge-completed-mutation.js +0 -24
  225. package/dist/esm/lib/api/notify-vcs-branch-merge-completed-mutation.js.map +0 -1
  226. package/dist/esm/lib/api-types.d.ts +0 -6
  227. package/dist/esm/lib/api-types.d.ts.map +0 -1
  228. package/dist/esm/lib/api-types.js +0 -2
  229. package/dist/esm/lib/api-types.js.map +0 -1
  230. package/dist/esm/lib/other.d.ts +0 -6
  231. package/dist/esm/lib/other.d.ts.map +0 -1
  232. package/dist/esm/lib/other.js +0 -11
  233. package/dist/esm/lib/other.js.map +0 -1
  234. package/dist/esm/lib/sdk/defaults/fetch.d.ts +0 -2
  235. package/dist/esm/lib/sdk/defaults/fetch.d.ts.map +0 -1
  236. package/dist/esm/lib/sdk/defaults/fetch.js +0 -2
  237. package/dist/esm/lib/sdk/defaults/fetch.js.map +0 -1
  238. package/dist/esm/lib/sdk/defaults/log.d.ts +0 -3
  239. package/dist/esm/lib/sdk/defaults/log.d.ts.map +0 -1
  240. package/dist/esm/lib/sdk/defaults/log.js +0 -12
  241. package/dist/esm/lib/sdk/defaults/log.js.map +0 -1
  242. package/dist/esm/lib/sdk/defaults/serviceBase.d.ts +0 -2
  243. package/dist/esm/lib/sdk/defaults/serviceBase.d.ts.map +0 -1
  244. package/dist/esm/lib/sdk/defaults/serviceBase.js +0 -2
  245. package/dist/esm/lib/sdk/defaults/serviceBase.js.map +0 -1
  246. package/dist/esm/lib/sdk/defaults/userAgent.d.ts +0 -2
  247. package/dist/esm/lib/sdk/defaults/userAgent.d.ts.map +0 -1
  248. package/dist/esm/lib/sdk/defaults/userAgent.js +0 -3
  249. package/dist/esm/lib/sdk/defaults/userAgent.js.map +0 -1
  250. package/dist/esm/lib/sdk/dependencies.d.ts +0 -8
  251. package/dist/esm/lib/sdk/dependencies.d.ts.map +0 -1
  252. package/dist/esm/lib/sdk/dependencies.js +0 -2
  253. package/dist/esm/lib/sdk/dependencies.js.map +0 -1
  254. package/dist/esm/lib/sdk/domain/attemptDeploy/index.d.ts +0 -39
  255. package/dist/esm/lib/sdk/domain/attemptDeploy/index.d.ts.map +0 -1
  256. package/dist/esm/lib/sdk/domain/attemptDeploy/index.js +0 -108
  257. package/dist/esm/lib/sdk/domain/attemptDeploy/index.js.map +0 -1
  258. package/dist/esm/lib/sdk/domain/attemptDeploy/types.d.ts +0 -65
  259. package/dist/esm/lib/sdk/domain/attemptDeploy/types.d.ts.map +0 -1
  260. package/dist/esm/lib/sdk/domain/attemptDeploy/types.js +0 -2
  261. package/dist/esm/lib/sdk/domain/attemptDeploy/types.js.map +0 -1
  262. package/dist/esm/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-run-inputs-executables.d.ts +0 -5
  263. package/dist/esm/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-run-inputs-executables.d.ts.map +0 -1
  264. package/dist/esm/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-run-inputs-executables.js +0 -43
  265. package/dist/esm/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-run-inputs-executables.js.map +0 -1
  266. package/dist/esm/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-team-storage.d.ts +0 -17
  267. package/dist/esm/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-team-storage.d.ts.map +0 -1
  268. package/dist/esm/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-team-storage.js +0 -43
  269. package/dist/esm/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-team-storage.js.map +0 -1
  270. package/dist/esm/lib/sdk/domain/generateSignedUrls/types.d.ts +0 -23
  271. package/dist/esm/lib/sdk/domain/generateSignedUrls/types.d.ts.map +0 -1
  272. package/dist/esm/lib/sdk/domain/generateSignedUrls/types.js +0 -2
  273. package/dist/esm/lib/sdk/domain/generateSignedUrls/types.js.map +0 -1
  274. package/dist/esm/lib/sdk/domain/legacy_previewTesting/constants.d.ts +0 -5
  275. package/dist/esm/lib/sdk/domain/legacy_previewTesting/constants.d.ts.map +0 -1
  276. package/dist/esm/lib/sdk/domain/legacy_previewTesting/constants.js +0 -5
  277. package/dist/esm/lib/sdk/domain/legacy_previewTesting/constants.js.map +0 -1
  278. package/dist/esm/lib/sdk/domain/legacy_previewTesting/createEnvironmentAction.d.ts +0 -19
  279. package/dist/esm/lib/sdk/domain/legacy_previewTesting/createEnvironmentAction.d.ts.map +0 -1
  280. package/dist/esm/lib/sdk/domain/legacy_previewTesting/createEnvironmentAction.js +0 -59
  281. package/dist/esm/lib/sdk/domain/legacy_previewTesting/createEnvironmentAction.js.map +0 -1
  282. package/dist/esm/lib/sdk/domain/legacy_previewTesting/createEnvironmentVariables.d.ts +0 -9
  283. package/dist/esm/lib/sdk/domain/legacy_previewTesting/createEnvironmentVariables.d.ts.map +0 -1
  284. package/dist/esm/lib/sdk/domain/legacy_previewTesting/createEnvironmentVariables.js +0 -29
  285. package/dist/esm/lib/sdk/domain/legacy_previewTesting/createEnvironmentVariables.js.map +0 -1
  286. package/dist/esm/lib/sdk/domain/legacy_previewTesting/deleteEnvironment.d.ts +0 -6
  287. package/dist/esm/lib/sdk/domain/legacy_previewTesting/deleteEnvironment.d.ts.map +0 -1
  288. package/dist/esm/lib/sdk/domain/legacy_previewTesting/deleteEnvironment.js +0 -24
  289. package/dist/esm/lib/sdk/domain/legacy_previewTesting/deleteEnvironment.js.map +0 -1
  290. package/dist/esm/lib/sdk/domain/legacy_previewTesting/deleteEnvironmentAction.d.ts +0 -6
  291. package/dist/esm/lib/sdk/domain/legacy_previewTesting/deleteEnvironmentAction.d.ts.map +0 -1
  292. package/dist/esm/lib/sdk/domain/legacy_previewTesting/deleteEnvironmentAction.js +0 -9
  293. package/dist/esm/lib/sdk/domain/legacy_previewTesting/deleteEnvironmentAction.js.map +0 -1
  294. package/dist/esm/lib/sdk/domain/legacy_previewTesting/findOrCreateEnvironment.d.ts +0 -29
  295. package/dist/esm/lib/sdk/domain/legacy_previewTesting/findOrCreateEnvironment.d.ts.map +0 -1
  296. package/dist/esm/lib/sdk/domain/legacy_previewTesting/findOrCreateEnvironment.js +0 -149
  297. package/dist/esm/lib/sdk/domain/legacy_previewTesting/findOrCreateEnvironment.js.map +0 -1
  298. package/dist/esm/lib/sdk/domain/legacy_previewTesting/findOrCreateTrigger.d.ts +0 -18
  299. package/dist/esm/lib/sdk/domain/legacy_previewTesting/findOrCreateTrigger.d.ts.map +0 -1
  300. package/dist/esm/lib/sdk/domain/legacy_previewTesting/findOrCreateTrigger.js +0 -93
  301. package/dist/esm/lib/sdk/domain/legacy_previewTesting/findOrCreateTrigger.js.map +0 -1
  302. package/dist/esm/lib/sdk/domain/legacy_previewTesting/findRepositoryIdByName.d.ts +0 -6
  303. package/dist/esm/lib/sdk/domain/legacy_previewTesting/findRepositoryIdByName.d.ts.map +0 -1
  304. package/dist/esm/lib/sdk/domain/legacy_previewTesting/findRepositoryIdByName.js +0 -33
  305. package/dist/esm/lib/sdk/domain/legacy_previewTesting/findRepositoryIdByName.js.map +0 -1
  306. package/dist/esm/lib/sdk/domain/legacy_previewTesting/getEnvironmentIdForBranch.d.ts +0 -4
  307. package/dist/esm/lib/sdk/domain/legacy_previewTesting/getEnvironmentIdForBranch.d.ts.map +0 -1
  308. package/dist/esm/lib/sdk/domain/legacy_previewTesting/getEnvironmentIdForBranch.js +0 -34
  309. package/dist/esm/lib/sdk/domain/legacy_previewTesting/getEnvironmentIdForBranch.js.map +0 -1
  310. package/dist/esm/lib/sdk/domain/legacy_previewTesting/getEnvironmentVariablesFromEnvironment.d.ts +0 -6
  311. package/dist/esm/lib/sdk/domain/legacy_previewTesting/getEnvironmentVariablesFromEnvironment.d.ts.map +0 -1
  312. package/dist/esm/lib/sdk/domain/legacy_previewTesting/getEnvironmentVariablesFromEnvironment.js +0 -31
  313. package/dist/esm/lib/sdk/domain/legacy_previewTesting/getEnvironmentVariablesFromEnvironment.js.map +0 -1
  314. package/dist/esm/lib/sdk/domain/legacy_previewTesting/getTagsFromEnvironment.d.ts +0 -9
  315. package/dist/esm/lib/sdk/domain/legacy_previewTesting/getTagsFromEnvironment.d.ts.map +0 -1
  316. package/dist/esm/lib/sdk/domain/legacy_previewTesting/getTagsFromEnvironment.js +0 -37
  317. package/dist/esm/lib/sdk/domain/legacy_previewTesting/getTagsFromEnvironment.js.map +0 -1
  318. package/dist/esm/lib/sdk/domain/legacy_previewTesting/index.d.ts +0 -23
  319. package/dist/esm/lib/sdk/domain/legacy_previewTesting/index.d.ts.map +0 -1
  320. package/dist/esm/lib/sdk/domain/legacy_previewTesting/index.js +0 -27
  321. package/dist/esm/lib/sdk/domain/legacy_previewTesting/index.js.map +0 -1
  322. package/dist/esm/lib/sdk/domain/poll-ci-greenlight.d.ts +0 -84
  323. package/dist/esm/lib/sdk/domain/poll-ci-greenlight.d.ts.map +0 -1
  324. package/dist/esm/lib/sdk/domain/poll-ci-greenlight.js +0 -162
  325. package/dist/esm/lib/sdk/domain/poll-ci-greenlight.js.map +0 -1
  326. package/dist/esm/lib/sdk/domain/vcsBranchTesting/index.d.ts +0 -37
  327. package/dist/esm/lib/sdk/domain/vcsBranchTesting/index.d.ts.map +0 -1
  328. package/dist/esm/lib/sdk/domain/vcsBranchTesting/index.js +0 -19
  329. package/dist/esm/lib/sdk/domain/vcsBranchTesting/index.js.map +0 -1
  330. package/dist/esm/lib/sdk/domain/vcsBranchTesting/lib/aliases.d.ts +0 -24
  331. package/dist/esm/lib/sdk/domain/vcsBranchTesting/lib/aliases.d.ts.map +0 -1
  332. package/dist/esm/lib/sdk/domain/vcsBranchTesting/lib/aliases.js +0 -14
  333. package/dist/esm/lib/sdk/domain/vcsBranchTesting/lib/aliases.js.map +0 -1
  334. package/dist/esm/lib/sdk/domain/vcsBranchTesting/lib/domain-failure.d.ts +0 -18
  335. package/dist/esm/lib/sdk/domain/vcsBranchTesting/lib/domain-failure.d.ts.map +0 -1
  336. package/dist/esm/lib/sdk/domain/vcsBranchTesting/lib/domain-failure.js +0 -56
  337. package/dist/esm/lib/sdk/domain/vcsBranchTesting/lib/domain-failure.js.map +0 -1
  338. package/dist/esm/lib/sdk/domain/vcsBranchTesting/lib/graphql-error.d.ts +0 -23
  339. package/dist/esm/lib/sdk/domain/vcsBranchTesting/lib/graphql-error.d.ts.map +0 -1
  340. package/dist/esm/lib/sdk/domain/vcsBranchTesting/lib/graphql-error.js +0 -23
  341. package/dist/esm/lib/sdk/domain/vcsBranchTesting/lib/graphql-error.js.map +0 -1
  342. package/dist/esm/lib/sdk/domain/vcsBranchTesting/lib/retry.d.ts +0 -16
  343. package/dist/esm/lib/sdk/domain/vcsBranchTesting/lib/retry.d.ts.map +0 -1
  344. package/dist/esm/lib/sdk/domain/vcsBranchTesting/lib/retry.js +0 -23
  345. package/dist/esm/lib/sdk/domain/vcsBranchTesting/lib/retry.js.map +0 -1
  346. package/dist/esm/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-build-deployed.d.ts +0 -65
  347. package/dist/esm/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-build-deployed.d.ts.map +0 -1
  348. package/dist/esm/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-build-deployed.js +0 -81
  349. package/dist/esm/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-build-deployed.js.map +0 -1
  350. package/dist/esm/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-canceled.d.ts +0 -20
  351. package/dist/esm/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-canceled.d.ts.map +0 -1
  352. package/dist/esm/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-canceled.js +0 -45
  353. package/dist/esm/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-canceled.js.map +0 -1
  354. package/dist/esm/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-completed.d.ts +0 -13
  355. package/dist/esm/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-completed.d.ts.map +0 -1
  356. package/dist/esm/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-completed.js +0 -50
  357. package/dist/esm/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-completed.js.map +0 -1
  358. package/dist/esm/lib/sdk/domain/vcsBranchTesting/types.d.ts +0 -40
  359. package/dist/esm/lib/sdk/domain/vcsBranchTesting/types.d.ts.map +0 -1
  360. package/dist/esm/lib/sdk/domain/vcsBranchTesting/types.js +0 -2
  361. package/dist/esm/lib/sdk/domain/vcsBranchTesting/types.js.map +0 -1
  362. package/dist/esm/lib/sdk/index.d.ts +0 -36
  363. package/dist/esm/lib/sdk/index.d.ts.map +0 -1
  364. package/dist/esm/lib/sdk/index.js +0 -40
  365. package/dist/esm/lib/sdk/index.js.map +0 -1
  366. package/dist/esm/package.json +0 -1
  367. package/dist/esm/tests/test-lib.d.ts +0 -43
  368. package/dist/esm/tests/test-lib.d.ts.map +0 -1
  369. package/dist/esm/tests/test-lib.js +0 -140
  370. package/dist/esm/tests/test-lib.js.map +0 -1
  371. package/dist/package.json +0 -42
  372. package/dist/types/index.d.ts +0 -5
  373. package/dist/types/index.d.ts.map +0 -1
  374. package/dist/types/lib/api/ci-greenlight.d.ts +0 -145
  375. package/dist/types/lib/api/ci-greenlight.d.ts.map +0 -1
  376. package/dist/types/lib/api/generate-signed-url-for-run-inputs-executables.d.ts +0 -5
  377. package/dist/types/lib/api/generate-signed-url-for-run-inputs-executables.d.ts.map +0 -1
  378. package/dist/types/lib/api/generate-signed-url-for-team-storage.d.ts +0 -5
  379. package/dist/types/lib/api/generate-signed-url-for-team-storage.d.ts.map +0 -1
  380. package/dist/types/lib/api/graphql.d.ts +0 -33
  381. package/dist/types/lib/api/graphql.d.ts.map +0 -1
  382. package/dist/types/lib/api/index.d.ts +0 -3
  383. package/dist/types/lib/api/index.d.ts.map +0 -1
  384. package/dist/types/lib/api/notify-vcs-branch-build-deployed-mutation.d.ts +0 -27
  385. package/dist/types/lib/api/notify-vcs-branch-build-deployed-mutation.d.ts.map +0 -1
  386. package/dist/types/lib/api/notify-vcs-branch-merge-canceled-mutation.d.ts +0 -16
  387. package/dist/types/lib/api/notify-vcs-branch-merge-canceled-mutation.d.ts.map +0 -1
  388. package/dist/types/lib/api/notify-vcs-branch-merge-completed-mutation.d.ts +0 -17
  389. package/dist/types/lib/api/notify-vcs-branch-merge-completed-mutation.d.ts.map +0 -1
  390. package/dist/types/lib/api-types.d.ts +0 -6
  391. package/dist/types/lib/api-types.d.ts.map +0 -1
  392. package/dist/types/lib/other.d.ts +0 -6
  393. package/dist/types/lib/other.d.ts.map +0 -1
  394. package/dist/types/lib/sdk/defaults/fetch.d.ts +0 -2
  395. package/dist/types/lib/sdk/defaults/fetch.d.ts.map +0 -1
  396. package/dist/types/lib/sdk/defaults/log.d.ts +0 -3
  397. package/dist/types/lib/sdk/defaults/log.d.ts.map +0 -1
  398. package/dist/types/lib/sdk/defaults/serviceBase.d.ts +0 -2
  399. package/dist/types/lib/sdk/defaults/serviceBase.d.ts.map +0 -1
  400. package/dist/types/lib/sdk/defaults/userAgent.d.ts +0 -2
  401. package/dist/types/lib/sdk/defaults/userAgent.d.ts.map +0 -1
  402. package/dist/types/lib/sdk/dependencies.d.ts +0 -8
  403. package/dist/types/lib/sdk/dependencies.d.ts.map +0 -1
  404. package/dist/types/lib/sdk/domain/attemptDeploy/index.d.ts +0 -39
  405. package/dist/types/lib/sdk/domain/attemptDeploy/index.d.ts.map +0 -1
  406. package/dist/types/lib/sdk/domain/attemptDeploy/types.d.ts +0 -65
  407. package/dist/types/lib/sdk/domain/attemptDeploy/types.d.ts.map +0 -1
  408. package/dist/types/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-run-inputs-executables.d.ts +0 -5
  409. package/dist/types/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-run-inputs-executables.d.ts.map +0 -1
  410. package/dist/types/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-team-storage.d.ts +0 -17
  411. package/dist/types/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-team-storage.d.ts.map +0 -1
  412. package/dist/types/lib/sdk/domain/generateSignedUrls/types.d.ts +0 -23
  413. package/dist/types/lib/sdk/domain/generateSignedUrls/types.d.ts.map +0 -1
  414. package/dist/types/lib/sdk/domain/legacy_previewTesting/constants.d.ts +0 -5
  415. package/dist/types/lib/sdk/domain/legacy_previewTesting/constants.d.ts.map +0 -1
  416. package/dist/types/lib/sdk/domain/legacy_previewTesting/createEnvironmentAction.d.ts +0 -19
  417. package/dist/types/lib/sdk/domain/legacy_previewTesting/createEnvironmentAction.d.ts.map +0 -1
  418. package/dist/types/lib/sdk/domain/legacy_previewTesting/createEnvironmentVariables.d.ts +0 -9
  419. package/dist/types/lib/sdk/domain/legacy_previewTesting/createEnvironmentVariables.d.ts.map +0 -1
  420. package/dist/types/lib/sdk/domain/legacy_previewTesting/deleteEnvironment.d.ts +0 -6
  421. package/dist/types/lib/sdk/domain/legacy_previewTesting/deleteEnvironment.d.ts.map +0 -1
  422. package/dist/types/lib/sdk/domain/legacy_previewTesting/deleteEnvironmentAction.d.ts +0 -6
  423. package/dist/types/lib/sdk/domain/legacy_previewTesting/deleteEnvironmentAction.d.ts.map +0 -1
  424. package/dist/types/lib/sdk/domain/legacy_previewTesting/findOrCreateEnvironment.d.ts +0 -29
  425. package/dist/types/lib/sdk/domain/legacy_previewTesting/findOrCreateEnvironment.d.ts.map +0 -1
  426. package/dist/types/lib/sdk/domain/legacy_previewTesting/findOrCreateTrigger.d.ts +0 -18
  427. package/dist/types/lib/sdk/domain/legacy_previewTesting/findOrCreateTrigger.d.ts.map +0 -1
  428. package/dist/types/lib/sdk/domain/legacy_previewTesting/findRepositoryIdByName.d.ts +0 -6
  429. package/dist/types/lib/sdk/domain/legacy_previewTesting/findRepositoryIdByName.d.ts.map +0 -1
  430. package/dist/types/lib/sdk/domain/legacy_previewTesting/getEnvironmentIdForBranch.d.ts +0 -4
  431. package/dist/types/lib/sdk/domain/legacy_previewTesting/getEnvironmentIdForBranch.d.ts.map +0 -1
  432. package/dist/types/lib/sdk/domain/legacy_previewTesting/getEnvironmentVariablesFromEnvironment.d.ts +0 -6
  433. package/dist/types/lib/sdk/domain/legacy_previewTesting/getEnvironmentVariablesFromEnvironment.d.ts.map +0 -1
  434. package/dist/types/lib/sdk/domain/legacy_previewTesting/getTagsFromEnvironment.d.ts +0 -9
  435. package/dist/types/lib/sdk/domain/legacy_previewTesting/getTagsFromEnvironment.d.ts.map +0 -1
  436. package/dist/types/lib/sdk/domain/legacy_previewTesting/index.d.ts +0 -23
  437. package/dist/types/lib/sdk/domain/legacy_previewTesting/index.d.ts.map +0 -1
  438. package/dist/types/lib/sdk/domain/poll-ci-greenlight.d.ts +0 -84
  439. package/dist/types/lib/sdk/domain/poll-ci-greenlight.d.ts.map +0 -1
  440. package/dist/types/lib/sdk/domain/vcsBranchTesting/index.d.ts +0 -37
  441. package/dist/types/lib/sdk/domain/vcsBranchTesting/index.d.ts.map +0 -1
  442. package/dist/types/lib/sdk/domain/vcsBranchTesting/lib/aliases.d.ts +0 -24
  443. package/dist/types/lib/sdk/domain/vcsBranchTesting/lib/aliases.d.ts.map +0 -1
  444. package/dist/types/lib/sdk/domain/vcsBranchTesting/lib/domain-failure.d.ts +0 -18
  445. package/dist/types/lib/sdk/domain/vcsBranchTesting/lib/domain-failure.d.ts.map +0 -1
  446. package/dist/types/lib/sdk/domain/vcsBranchTesting/lib/graphql-error.d.ts +0 -23
  447. package/dist/types/lib/sdk/domain/vcsBranchTesting/lib/graphql-error.d.ts.map +0 -1
  448. package/dist/types/lib/sdk/domain/vcsBranchTesting/lib/retry.d.ts +0 -16
  449. package/dist/types/lib/sdk/domain/vcsBranchTesting/lib/retry.d.ts.map +0 -1
  450. package/dist/types/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-build-deployed.d.ts +0 -65
  451. package/dist/types/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-build-deployed.d.ts.map +0 -1
  452. package/dist/types/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-canceled.d.ts +0 -20
  453. package/dist/types/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-canceled.d.ts.map +0 -1
  454. package/dist/types/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-completed.d.ts +0 -13
  455. package/dist/types/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-completed.d.ts.map +0 -1
  456. package/dist/types/lib/sdk/domain/vcsBranchTesting/types.d.ts +0 -40
  457. package/dist/types/lib/sdk/domain/vcsBranchTesting/types.d.ts.map +0 -1
  458. package/dist/types/lib/sdk/index.d.ts +0 -36
  459. package/dist/types/lib/sdk/index.d.ts.map +0 -1
  460. package/dist/types/tests/test-lib.d.ts +0 -43
  461. package/dist/types/tests/test-lib.d.ts.map +0 -1
package/dist/index.js ADDED
@@ -0,0 +1,1619 @@
1
+ 'use strict';
2
+
3
+ var slugify = require('slugify');
4
+
5
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
+
7
+ var slugify__default = /*#__PURE__*/_interopDefault(slugify);
8
+
9
+ var __defProp = Object.defineProperty;
10
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
11
+
12
+ // src/lib/other.ts
13
+ function sleep(ms) {
14
+ return new Promise((resolve) => setTimeout(resolve, ms));
15
+ }
16
+ __name(sleep, "sleep");
17
+ function pluralize(count) {
18
+ return count === 1 ? "" : "s";
19
+ }
20
+ __name(pluralize, "pluralize");
21
+ function getBackoffMs(attemptNumber, minWaitMs = 1e3, maxWaitMs = 1e4) {
22
+ return Math.min(maxWaitMs, minWaitMs * 1.2 ** attemptNumber);
23
+ }
24
+ __name(getBackoffMs, "getBackoffMs");
25
+ var buildFetchWithTimeout = /* @__PURE__ */ __name((fetch, timeout) => async (...args) => fetch(args[0], {
26
+ ...args[1],
27
+ signal: AbortSignal.timeout(timeout)
28
+ }), "buildFetchWithTimeout");
29
+
30
+ // src/lib/sdk/defaults/fetch.ts
31
+ var defaultFetch = globalThis.fetch;
32
+
33
+ // src/lib/sdk/defaults/log.ts
34
+ var defaultLogDriver = {
35
+ error(message, error) {
36
+ console.error(message, error);
37
+ },
38
+ info(message) {
39
+ console.log(message);
40
+ },
41
+ warn(message) {
42
+ console.warn(message);
43
+ }
44
+ };
45
+
46
+ // src/lib/sdk/defaults/serviceBase.ts
47
+ var defaultServiceBase = "https://app.qawolf.com/";
48
+
49
+ // package.json
50
+ var version = "0.23.1";
51
+
52
+ // src/lib/sdk/defaults/userAgent.ts
53
+ var defaultUserAgent = `ci-sdk/${version}`;
54
+
55
+ // src/lib/api/log.ts
56
+ async function logFetchError({ log, methodName, response }) {
57
+ if (response.ok) return;
58
+ const { eventId, failureMessage } = await (async () => {
59
+ try {
60
+ const body = await response.json().catch(() => response.text());
61
+ if (typeof body === "object" && body !== null) {
62
+ return {
63
+ eventId: body.eventId,
64
+ failureMessage: body.failureMessage
65
+ };
66
+ }
67
+ return {
68
+ eventId: void 0,
69
+ failureMessage: body
70
+ };
71
+ } catch {
72
+ return {
73
+ eventId: undefined,
74
+ failureMessage: undefined
75
+ };
76
+ }
77
+ })();
78
+ const eventIdSuffix = eventId ? ` (Event ID: ${eventId})` : "";
79
+ const messageSuffix = failureMessage ? `: ${failureMessage}` : "";
80
+ const statusText = response.status >= 500 ? "Server Error" : response.statusText || "Unknown Error";
81
+ log.error(`\u274C [${methodName}] ${response.status} ${statusText}${eventIdSuffix}${messageSuffix}`);
82
+ }
83
+ __name(logFetchError, "logFetchError");
84
+
85
+ // src/lib/sdk/domain/attemptDeploy/index.ts
86
+ async function attemptNotifyDeploy(deps, apiConfig, config) {
87
+ const { fetch: localFetch, log } = deps;
88
+ try {
89
+ const response = await localFetch(new URL("/api/webhooks/deploy_success", apiConfig.serviceBase), {
90
+ body: JSON.stringify({
91
+ branch: config.branch,
92
+ commit_url: config.commitUrl,
93
+ deduplication_key: config.deduplicationKey,
94
+ deployment_type: config.deploymentType,
95
+ deployment_url: config.deploymentUrl,
96
+ hosting_service: config.hostingService,
97
+ merge_request_number: config.hostingService === "GitLab" ? config.mergeRequestNumber : void 0,
98
+ pull_request_number: config.hostingService === "GitHub" ? config.pullRequestNumber : void 0,
99
+ repository: config.repository,
100
+ sha: config.sha,
101
+ variables: config.variables
102
+ }),
103
+ headers: {
104
+ Authorization: `Bearer ${apiConfig.apiKey}`,
105
+ "Content-Type": "application/json",
106
+ "User-Agent": apiConfig.userAgent
107
+ },
108
+ method: "POST"
109
+ });
110
+ if (!response.ok) return handleErrorResponse(response, log);
111
+ const data = await response.json();
112
+ return handleSuccessResponse(data, log);
113
+ } catch (error) {
114
+ log.error(`\u{1F6AB} Network error from deploy_success, aborting.`);
115
+ return {
116
+ abortReason: "network-error",
117
+ httpStatus: undefined,
118
+ outcome: "aborted"
119
+ };
120
+ }
121
+ }
122
+ __name(attemptNotifyDeploy, "attemptNotifyDeploy");
123
+ async function handleErrorResponse(response, log) {
124
+ const status = response.status;
125
+ let abortReason;
126
+ if (status === undefined) abortReason = "network-error";
127
+ else if (status === 401) abortReason = "401-unauthorized";
128
+ else if (status === 403) abortReason = "403-forbidden";
129
+ else if (status >= 500) abortReason = "5XX-server-error";
130
+ else abortReason = "4XX-client-error";
131
+ await logFetchError({
132
+ log,
133
+ methodName: "attemptNotifyDeploy",
134
+ response
135
+ });
136
+ return {
137
+ abortReason,
138
+ httpStatus: status,
139
+ outcome: "aborted"
140
+ };
141
+ }
142
+ __name(handleErrorResponse, "handleErrorResponse");
143
+ async function handleSuccessResponse(data, log) {
144
+ const { environment, results } = data;
145
+ const isPreviewDeployment = environment && !environment.isStatic;
146
+ if (environment) {
147
+ const logPrefix = environment.isStatic ? "Static environment" : "Preview environment";
148
+ log.info(`${logPrefix}: ${environment.alias} (id: ${environment.id})`);
149
+ }
150
+ if (results.length === 0) {
151
+ if (isPreviewDeployment) {
152
+ log.info(`\u2705 Deployment notification was successful. No run was created for this deployment.`);
153
+ return {
154
+ environmentId: environment.id,
155
+ outcome: "success",
156
+ runId: undefined
157
+ };
158
+ }
159
+ log.error(`\u{1F6AB} No trigger matched the request. Please contact support.`);
160
+ return {
161
+ failReason: "no-matched-trigger",
162
+ outcome: "failed"
163
+ };
164
+ }
165
+ if (!environment) {
166
+ log.error(`\u{1F6AB} No environment matched the request. Please contact support.`);
167
+ return {
168
+ failReason: "no-environment",
169
+ outcome: "failed"
170
+ };
171
+ }
172
+ const failedTrigger = results.find((t) => "failure_reason" in t);
173
+ if (failedTrigger) {
174
+ log.error(`\u{1F6AB} Run could not be created. Reason: "${failedTrigger.failure_reason}". Please contact support.`);
175
+ return {
176
+ failReason: "run-could-not-be-created",
177
+ outcome: "failed"
178
+ };
179
+ }
180
+ const duplicateSuite = results.find((t) => "duplicate_suite_id" in t);
181
+ if (duplicateSuite) {
182
+ log.info(`\u2705 Deployment notification was successful. Previous run ID: ${duplicateSuite.duplicate_suite_id} already exists for this deployment.`);
183
+ return {
184
+ environmentId: environment.id,
185
+ outcome: "success",
186
+ runId: duplicateSuite.duplicate_suite_id
187
+ };
188
+ }
189
+ const successfulTrigger = results.find((t) => "created_suite_id" in t);
190
+ if (!successfulTrigger) {
191
+ log.error(`\u{1F6AB} No trigger matched the request. Please contact support.`);
192
+ return {
193
+ failReason: "no-matched-trigger",
194
+ outcome: "failed"
195
+ };
196
+ }
197
+ log.info(`\u2705 Deployment notification was successful. Run created with ID: ${successfulTrigger.created_suite_id}`);
198
+ return {
199
+ environmentId: environment.id,
200
+ outcome: "success",
201
+ runId: successfulTrigger.created_suite_id
202
+ };
203
+ }
204
+ __name(handleSuccessResponse, "handleSuccessResponse");
205
+
206
+ // src/lib/api/generate-signed-url-for-run-inputs-executables.ts
207
+ async function callGenerateSignedUrlForRunInputsExecutablesStorage({ apiKey, serviceBase, userAgent }, { destinationFilePath }, { fetch: localFetch, log }) {
208
+ try {
209
+ const response = await localFetch(new URL(`${serviceBase}/api/v0/run-inputs-executables-signed-urls?file=${encodeURIComponent(destinationFilePath)}`), {
210
+ headers: {
211
+ Authorization: `Bearer ${apiKey}`,
212
+ "Content-Type": "application/json",
213
+ "User-Agent": userAgent
214
+ },
215
+ method: "GET"
216
+ });
217
+ if (response.status === 200) {
218
+ const json = await response.json();
219
+ return {
220
+ fileLocation: json.fileLocation,
221
+ httpStatus: response.status,
222
+ playgroundFileLocation: json.playgroundFileLocation,
223
+ signedUrl: json.signedUrl,
224
+ success: true
225
+ };
226
+ }
227
+ await logFetchError({
228
+ log,
229
+ methodName: "callGenerateSignedUrlForRunInputsExecutablesStorage",
230
+ response
231
+ });
232
+ return {
233
+ errorMessage: await response.text(),
234
+ httpStatus: response.status,
235
+ success: false
236
+ };
237
+ } catch (e) {
238
+ return {
239
+ errorMessage: "Network error, aborting request to generate signed URL",
240
+ httpStatus: 0,
241
+ success: false
242
+ };
243
+ }
244
+ }
245
+ __name(callGenerateSignedUrlForRunInputsExecutablesStorage, "callGenerateSignedUrlForRunInputsExecutablesStorage");
246
+
247
+ // src/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-run-inputs-executables.ts
248
+ async function generateSignedUrlForRunInputsExecutablesStorage(deps, apiConfig, config) {
249
+ const { log } = deps;
250
+ if (!config.destinationFilePath) {
251
+ log.error(`\u{1F6AB} destinationFilePath is a required config parameter`);
252
+ return {
253
+ abortReason: "sdk-argument-validation-failed",
254
+ success: false
255
+ };
256
+ }
257
+ const responseState = await callGenerateSignedUrlForRunInputsExecutablesStorage(apiConfig, config, deps);
258
+ if (!responseState.success) {
259
+ let abortReason = "XXX-other-http-code";
260
+ if (responseState.httpStatus >= 500) {
261
+ abortReason = "5XX-server-error";
262
+ log.error(`\u{1F6AB} Unrecoverable error (status ${responseState.httpStatus}) when generating signed upload url: aborting.`);
263
+ } else {
264
+ if (responseState.httpStatus === 400) abortReason = "400-invalid-request";
265
+ else if (responseState.httpStatus === 401) abortReason = "401-invalid-credentials";
266
+ else if (responseState.httpStatus === 403) abortReason = "403-forbidden";
267
+ else if (responseState.httpStatus === 0) abortReason = "client-network-error";
268
+ log.error(`\u{1F6AB} Unrecoverable error (status ${responseState.httpStatus}) when generating signed upload url: ${responseState.errorMessage ? `${responseState.errorMessage}.` : ""} aborting.`);
269
+ }
270
+ return {
271
+ abortReason,
272
+ httpStatus: responseState.httpStatus,
273
+ success: false
274
+ };
275
+ }
276
+ log.info(`\u2705 Generated Signed Upload URL: ${responseState.signedUrl}.`);
277
+ return {
278
+ fileLocation: responseState.fileLocation,
279
+ playgroundFileLocation: responseState.playgroundFileLocation,
280
+ success: true,
281
+ uploadUrl: responseState.signedUrl
282
+ };
283
+ }
284
+ __name(generateSignedUrlForRunInputsExecutablesStorage, "generateSignedUrlForRunInputsExecutablesStorage");
285
+
286
+ // src/lib/api/generate-signed-url-for-team-storage.ts
287
+ async function callGenerateSignedUrlForTempTeamStorage({ apiKey, serviceBase, userAgent }, { destinationFilePath }, { fetch: localFetch, log }) {
288
+ try {
289
+ const response = await localFetch(new URL(`${serviceBase}/api/v0/team-storage-signed-url?file=${destinationFilePath}`), {
290
+ headers: {
291
+ Authorization: `Bearer ${apiKey}`,
292
+ "Content-Type": "application/json",
293
+ "User-Agent": userAgent
294
+ },
295
+ method: "GET"
296
+ });
297
+ if (response.status === 200) {
298
+ const json = await response.json();
299
+ return {
300
+ fileLocation: json.fileLocation,
301
+ httpStatus: response.status,
302
+ playgroundFileLocation: json.playgroundFileLocation,
303
+ signedUrl: json.signedUrl,
304
+ success: true
305
+ };
306
+ }
307
+ await logFetchError({
308
+ log,
309
+ methodName: "callGenerateSignedUrlForTempTeamStorage",
310
+ response
311
+ });
312
+ return {
313
+ errorMessage: await response.text(),
314
+ httpStatus: response.status,
315
+ success: false
316
+ };
317
+ } catch (e) {
318
+ return {
319
+ errorMessage: "Network error, aborting request to generate signed URL",
320
+ httpStatus: 0,
321
+ success: false
322
+ };
323
+ }
324
+ }
325
+ __name(callGenerateSignedUrlForTempTeamStorage, "callGenerateSignedUrlForTempTeamStorage");
326
+
327
+ // src/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-team-storage.ts
328
+ async function generateSignedUrlForTempTeamStorage(deps, apiConfig, config) {
329
+ const { log } = deps;
330
+ if (!config.destinationFilePath) {
331
+ log.error(`\u{1F6AB} destinationFilePath is a required config parameter`);
332
+ return {
333
+ abortReason: "sdk-argument-validation-failed",
334
+ success: false
335
+ };
336
+ }
337
+ const responseState = await callGenerateSignedUrlForTempTeamStorage(apiConfig, config, deps);
338
+ if (!responseState.success) {
339
+ let abortReason = "XXX-other-http-code";
340
+ if (responseState.httpStatus >= 500) {
341
+ abortReason = "5XX-server-error";
342
+ log.error(`\u{1F6AB} Unrecoverable error (status ${responseState.httpStatus}) when generating signed upload url: aborting.`);
343
+ } else {
344
+ if (responseState.httpStatus === 400) abortReason = "400-invalid-request";
345
+ else if (responseState.httpStatus === 401) abortReason = "401-invalid-credentials";
346
+ else if (responseState.httpStatus === 403) abortReason = "403-forbidden";
347
+ else if (responseState.httpStatus === 0) abortReason = "client-network-error";
348
+ log.error(`\u{1F6AB} Unrecoverable error (status ${responseState.httpStatus}) when generating signed upload url: ${responseState.errorMessage ? `${responseState.errorMessage}.` : ""} aborting.`);
349
+ }
350
+ return {
351
+ abortReason,
352
+ httpStatus: responseState.httpStatus,
353
+ success: false
354
+ };
355
+ }
356
+ log.info(`\u2705 Generated Signed Upload URL: ${responseState.signedUrl}.`);
357
+ return {
358
+ fileLocation: responseState.fileLocation,
359
+ playgroundFileLocation: responseState.playgroundFileLocation,
360
+ success: true,
361
+ uploadUrl: responseState.signedUrl
362
+ };
363
+ }
364
+ __name(generateSignedUrlForTempTeamStorage, "generateSignedUrlForTempTeamStorage");
365
+
366
+ // src/lib/sdk/domain/legacy_previewTesting/constants.ts
367
+ var qawolfBaseUrl = "https://app.qawolf.com";
368
+ var qawolfGraphQLEndpoint = `${qawolfBaseUrl}/api/graphql`;
369
+ var previewDeploymentType = "qawolf-preview";
370
+
371
+ // src/lib/sdk/domain/legacy_previewTesting/createEnvironmentVariables.ts
372
+ async function createEnvironmentVariables(deps, apiConfig, { environmentId, variables }) {
373
+ const environmentVariableRequests = Object.keys(variables).map(async (key) => {
374
+ const value = variables[key];
375
+ return deps.fetch(qawolfGraphQLEndpoint, {
376
+ body: JSON.stringify({
377
+ query: `
378
+ mutation UpsertEnvironmentVariable($environmentId: ID!, $value: String!, $name: String) {
379
+ upsertEnvironmentVariable(environmentId: $environmentId, value: $value, name: $name) {
380
+ id
381
+ }
382
+ }
383
+ `,
384
+ variables: {
385
+ environmentId,
386
+ name: key,
387
+ value
388
+ }
389
+ }),
390
+ headers: {
391
+ Authorization: `Bearer ${apiConfig.apiKey}`,
392
+ "Content-Type": "application/json"
393
+ },
394
+ method: "post"
395
+ });
396
+ });
397
+ await Promise.all(environmentVariableRequests);
398
+ }
399
+ __name(createEnvironmentVariables, "createEnvironmentVariables");
400
+
401
+ // src/lib/sdk/domain/legacy_previewTesting/findOrCreateEnvironment.ts
402
+ async function findOrCreateEnvironment(deps, apiConfig, { baseEnvironmentId, branch, pr, qaWolfTeamId }) {
403
+ const retrievalResponse = await deps.fetch(qawolfGraphQLEndpoint, {
404
+ body: JSON.stringify({
405
+ query: `
406
+ query Environments($where: EnvironmentWhereInput) {
407
+ environments(where: $where) {
408
+ id
409
+ }
410
+ }
411
+ `,
412
+ variables: {
413
+ where: {
414
+ deletedAt: {
415
+ equals: null
416
+ },
417
+ name: {
418
+ equals: pr ? `[PR] #${pr.number} - ${pr.title}` : `[Preview] ${branch}`
419
+ }
420
+ }
421
+ }
422
+ }),
423
+ headers: {
424
+ Authorization: `Bearer ${apiConfig.apiKey}`,
425
+ "Content-Type": "application/json"
426
+ },
427
+ method: "post"
428
+ });
429
+ const jsonResponse = await retrievalResponse.json();
430
+ if (jsonResponse.data.environments[0]) {
431
+ const environmentId = jsonResponse.data.environments[0].id;
432
+ deps.log.info(`Environment already exists with ID: ${environmentId}`);
433
+ return environmentId;
434
+ }
435
+ const creationResponse = await deps.fetch(qawolfGraphQLEndpoint, {
436
+ body: JSON.stringify({
437
+ operationName: "createEnvironment",
438
+ query: `
439
+ mutation createEnvironment($name: String!, $teamId: String!) {
440
+ createEnvironment(name: $name, teamId: $teamId) {
441
+ id
442
+ branchId
443
+ }
444
+ }
445
+ `,
446
+ variables: {
447
+ name: pr ? `[PR] #${pr.number} - ${pr.title}` : `[Preview] ${branch}`,
448
+ teamId: qaWolfTeamId
449
+ }
450
+ }),
451
+ headers: {
452
+ Authorization: `Bearer ${apiConfig.apiKey}`,
453
+ "Content-Type": "application/json"
454
+ },
455
+ method: "post"
456
+ });
457
+ const createionResponseJson = await creationResponse.json();
458
+ deps.log.info(`Environment response: ${JSON.stringify(createionResponseJson)}`);
459
+ if (!createionResponseJson.data.createEnvironment.id) throw Error("Environment ID not found in response");
460
+ const multiBranchResponse = await deps.fetch(qawolfGraphQLEndpoint, {
461
+ body: JSON.stringify({
462
+ query: `
463
+ query teamBranches($teamId: String!) {
464
+ teamBranches: activeTeamBranches(teamId: $teamId) {
465
+ id
466
+ environments{
467
+ id
468
+ }
469
+ }
470
+ }
471
+ `,
472
+ variables: {
473
+ teamId: qaWolfTeamId
474
+ }
475
+ }),
476
+ headers: {
477
+ Authorization: `Bearer ${apiConfig.apiKey}`,
478
+ "Content-Type": "application/json"
479
+ },
480
+ method: "post"
481
+ });
482
+ const multiBranchResponseJson = await multiBranchResponse.json();
483
+ const hasMultipleBranches = multiBranchResponseJson.data.teamBranches.length > 1;
484
+ if (!hasMultipleBranches) return createionResponseJson.data.createEnvironment.id;
485
+ const sourceEnvironmentResponse = await deps.fetch(qawolfGraphQLEndpoint, {
486
+ body: JSON.stringify({
487
+ query: `
488
+ query EnvironmentWithBranch($where: EnvironmentWhereUniqueInput!) {
489
+ environment(where: $where) {
490
+ id
491
+ branchId
492
+ }
493
+ }
494
+ `,
495
+ variables: {
496
+ where: {
497
+ id: baseEnvironmentId
498
+ }
499
+ }
500
+ }),
501
+ headers: {
502
+ Authorization: `Bearer ${apiConfig.apiKey}`,
503
+ "Content-Type": "application/json"
504
+ },
505
+ method: "post"
506
+ });
507
+ const sourceEnvironmentJson = await sourceEnvironmentResponse.json();
508
+ const baseBranchId = sourceEnvironmentJson.data.environment.branchId;
509
+ const targetBranchId = createionResponseJson.data.createEnvironment.branchId;
510
+ if (!baseBranchId) throw Error("Base branch ID not found in response");
511
+ deps.log.info(`Promoting workflows from branch ${baseBranchId} to ${targetBranchId}`);
512
+ const promotionResponse = await deps.fetch(qawolfGraphQLEndpoint, {
513
+ body: JSON.stringify({
514
+ query: `
515
+ mutation PromoteWorkflowsToBranch(
516
+ $sourceTeamBranchId: String!
517
+ $targetTeamBranchId: String!
518
+ ) {
519
+ promoteWorkflowsToBranch(
520
+ mergeStrategy: overwrite
521
+ sourceTeamBranchId: $sourceTeamBranchId
522
+ targetTeamBranchId: $targetTeamBranchId
523
+ )
524
+ }
525
+ `,
526
+ variables: {
527
+ sourceTeamBranchId: baseBranchId,
528
+ targetTeamBranchId: targetBranchId
529
+ }
530
+ }),
531
+ headers: {
532
+ Authorization: `Bearer ${apiConfig.apiKey}`,
533
+ "Content-Type": "application/json"
534
+ },
535
+ method: "post"
536
+ });
537
+ const promotionResponseJson = await promotionResponse.json();
538
+ if (!promotionResponseJson) throw Error("Promotion failed");
539
+ return createionResponseJson.data.createEnvironment.id;
540
+ }
541
+ __name(findOrCreateEnvironment, "findOrCreateEnvironment");
542
+
543
+ // src/lib/sdk/domain/legacy_previewTesting/findOrCreateTrigger.ts
544
+ async function findOrCreateTrigger(deps, apiConfig, args) {
545
+ const { branch, environmentId, pr, qaWolfTeamId, repositoryId, tags } = args;
546
+ const triggerName = `Deployments of ${pr ? `PR #${pr.number} - ${pr.title}` : `branch ${branch}`}`;
547
+ const retrievalResponse = await deps.fetch(qawolfGraphQLEndpoint, {
548
+ body: JSON.stringify({
549
+ query: `query getTriggersForBranch($where: TriggerWhereInput) {
550
+ triggers(where: $where) {
551
+ environment_id
552
+ id
553
+ }
554
+ }
555
+ `,
556
+ variables: {
557
+ where: {
558
+ environment_id: {
559
+ equals: environmentId
560
+ },
561
+ name: {
562
+ equals: triggerName
563
+ }
564
+ }
565
+ }
566
+ }),
567
+ headers: {
568
+ Authorization: `Bearer ${apiConfig.apiKey}`,
569
+ "Content-Type": "application/json"
570
+ },
571
+ method: "post"
572
+ });
573
+ const retrievalResponseJson = await retrievalResponse.json();
574
+ if (retrievalResponseJson.data.triggers[0]) {
575
+ const triggerId2 = retrievalResponseJson.data.triggers[0].id;
576
+ const environmentId2 = retrievalResponseJson.data.triggers[0].environment_id;
577
+ deps.log.info(`Trigger with name ${triggerName} already exists with id ${triggerId2} in environment ${environmentId2}`);
578
+ return triggerId2;
579
+ }
580
+ const creationResponse = await deps.fetch(qawolfGraphQLEndpoint, {
581
+ body: JSON.stringify({
582
+ operationName: "createTrigger",
583
+ query: `
584
+ mutation createTrigger(
585
+ $codeHostingServiceRepositoryId: ID!,
586
+ $deploymentBranches: String!,
587
+ $deploymentEnvironment: String!,
588
+ $deploymentProvider: String!,
589
+ $environmentId: ID!,
590
+ $name: String!,
591
+ $teamId: ID!,
592
+ $tag_ids: [ID!]
593
+ ) {
594
+ createTrigger(
595
+ codeHostingServiceRepositoryId: $codeHostingServiceRepositoryId,
596
+ deployment_branches: $deploymentBranches,
597
+ deployment_environment: $deploymentEnvironment,
598
+ deployment_provider: $deploymentProvider,
599
+ environment_id: $environmentId,
600
+ name: $name,
601
+ team_id: $teamId,
602
+ tag_ids: $tag_ids
603
+ ) {
604
+ id
605
+ __typename
606
+ }
607
+ }
608
+ `,
609
+ variables: {
610
+ codeHostingServiceRepositoryId: repositoryId,
611
+ deploymentBranches: branch,
612
+ deploymentEnvironment: previewDeploymentType,
613
+ deploymentProvider: "generic",
614
+ environmentId,
615
+ name: triggerName,
616
+ tag_ids: tags?.map((tag) => tag.id),
617
+ teamId: qaWolfTeamId
618
+ }
619
+ }),
620
+ headers: {
621
+ Authorization: `Bearer ${apiConfig.apiKey}`,
622
+ "Content-Type": "application/json"
623
+ },
624
+ method: "post"
625
+ });
626
+ const creationResponseJson = await creationResponse.json();
627
+ deps.log.info(`Trigger response: ${JSON.stringify(creationResponseJson)}`);
628
+ const triggerId = creationResponseJson.data?.createTrigger?.id;
629
+ if (!triggerId) throw Error("Trigger ID not found in response");
630
+ deps.log.info(`Trigger created with ID: ${triggerId}`);
631
+ return triggerId;
632
+ }
633
+ __name(findOrCreateTrigger, "findOrCreateTrigger");
634
+
635
+ // src/lib/sdk/domain/legacy_previewTesting/findRepositoryIdByName.ts
636
+ async function findRepositoryIdByName(deps, apiConfig, { headRepoFullName }) {
637
+ const response = await deps.fetch(qawolfGraphQLEndpoint, {
638
+ body: JSON.stringify({
639
+ query: `
640
+ query codeHostingServiceRepositories($where: CodeHostingServiceRepositoryWhereInput) {
641
+ codeHostingServiceRepositories(where: $where) {
642
+ id
643
+ }
644
+ }
645
+ `,
646
+ variables: {
647
+ where: {
648
+ externalFullName: {
649
+ equals: headRepoFullName
650
+ }
651
+ }
652
+ }
653
+ }),
654
+ headers: {
655
+ Authorization: `Bearer ${apiConfig.apiKey}`,
656
+ "Content-Type": "application/json"
657
+ },
658
+ method: "post"
659
+ });
660
+ const responseJson = await response.json();
661
+ deps.log.info(`Repository response: ${JSON.stringify(responseJson)}`);
662
+ const repositories = responseJson.data.codeHostingServiceRepositories;
663
+ if (!repositories[0]) return;
664
+ return repositories[0].id;
665
+ }
666
+ __name(findRepositoryIdByName, "findRepositoryIdByName");
667
+
668
+ // src/lib/sdk/domain/legacy_previewTesting/getEnvironmentVariablesFromEnvironment.ts
669
+ async function getEnvironmentVariablesFromEnvironment(deps, apiConfig, { environmentId }) {
670
+ const retrievalResponse = await deps.fetch(qawolfGraphQLEndpoint, {
671
+ body: JSON.stringify({
672
+ query: `
673
+ query EnvironmentVariables($where: EnvironmentWhereUniqueInput!) {
674
+ environment(where: $where) {
675
+ id
676
+ variablesJSON
677
+ }
678
+ }
679
+ `,
680
+ variables: {
681
+ where: {
682
+ id: environmentId
683
+ }
684
+ }
685
+ }),
686
+ headers: {
687
+ Authorization: `Bearer ${apiConfig.apiKey}`,
688
+ "Content-Type": "application/json"
689
+ },
690
+ method: "post"
691
+ });
692
+ const retrievalResponseJson = await retrievalResponse.json();
693
+ if (!retrievalResponseJson.data.environment) {
694
+ throw Error(`Environment not found with ID: ${environmentId}. Please check the environment ID is correct.`);
695
+ }
696
+ return JSON.parse(retrievalResponseJson.data.environment.variablesJSON);
697
+ }
698
+ __name(getEnvironmentVariablesFromEnvironment, "getEnvironmentVariablesFromEnvironment");
699
+
700
+ // src/lib/sdk/domain/legacy_previewTesting/getTagsFromEnvironment.ts
701
+ async function getTagsFromGenericTriggerInEnvironment(deps, apiConfig, { environmentId }) {
702
+ const retrievalResponse = await deps.fetch(qawolfGraphQLEndpoint, {
703
+ body: JSON.stringify({
704
+ query: `
705
+ query GenericTriggerTagsFromEnvironment($where: EnvironmentWhereUniqueInput!) {
706
+ environment(where: $where) {
707
+ id
708
+ triggers(where: {deployment_provider: {equals: "generic"}}) {
709
+ id
710
+ tags {
711
+ id
712
+ name
713
+ }
714
+ }
715
+ }
716
+ }
717
+ `,
718
+ variables: {
719
+ where: {
720
+ id: environmentId
721
+ }
722
+ }
723
+ }),
724
+ headers: {
725
+ Authorization: `Bearer ${apiConfig.apiKey}`,
726
+ "Content-Type": "application/json"
727
+ },
728
+ method: "post"
729
+ });
730
+ const retrievalResponseJson = await retrievalResponse.json();
731
+ if (!retrievalResponseJson.data.environment) {
732
+ throw Error(`Environment not found with ID: ${environmentId}. Please check the environment ID is correct.`);
733
+ }
734
+ return retrievalResponseJson.data.environment.triggers[0]?.tags?.map((tag) => tag);
735
+ }
736
+ __name(getTagsFromGenericTriggerInEnvironment, "getTagsFromGenericTriggerInEnvironment");
737
+
738
+ // src/lib/sdk/domain/legacy_previewTesting/createEnvironmentAction.ts
739
+ var createEnvironmentAction = /* @__PURE__ */ __name(async (deps, apiConfig, { baseEnvironmentId, branch, deploymentUrl, headRepoFullName, pr, qaWolfTeamId, variables }) => {
740
+ deps.log.info("Creating environment for pull request...");
741
+ const environmentId = await findOrCreateEnvironment(deps, apiConfig, {
742
+ baseEnvironmentId,
743
+ branch,
744
+ pr,
745
+ qaWolfTeamId
746
+ });
747
+ deps.log.info(`Environment created with ID: ${environmentId}`);
748
+ const baseEnvironmentVariablesJSON = baseEnvironmentId ? await getEnvironmentVariablesFromEnvironment(deps, apiConfig, {
749
+ environmentId: baseEnvironmentId
750
+ }) : {};
751
+ if (typeof baseEnvironmentVariablesJSON !== "object") {
752
+ deps.log.error("baseEnvironmentVariablesJSON is not an object");
753
+ throw Error("baseEnvironmentVariablesJSON is not an object");
754
+ }
755
+ const combinedEnvironmentVariables = {
756
+ ...baseEnvironmentVariablesJSON,
757
+ ...variables,
758
+ ...deploymentUrl ? {
759
+ URL: deploymentUrl
760
+ } : {}
761
+ };
762
+ deps.log.info("Creating environment variables...");
763
+ await createEnvironmentVariables(deps, apiConfig, {
764
+ environmentId,
765
+ variables: combinedEnvironmentVariables
766
+ });
767
+ deps.log.info(`Environment variables created for environment ID: ${environmentId}`);
768
+ deps.log.info("Retrieving repository ID...");
769
+ const repositoryId = await findRepositoryIdByName(deps, apiConfig, {
770
+ headRepoFullName
771
+ });
772
+ deps.log.info(repositoryId ? `Repository ID retrieved: ${repositoryId}` : "Repository not integrated with QA Wolf, enable it in the settings page to get PR comments and checks.");
773
+ const tags = baseEnvironmentId ? await getTagsFromGenericTriggerInEnvironment(deps, apiConfig, {
774
+ environmentId: baseEnvironmentId
775
+ }) : undefined;
776
+ deps.log.info(`Tags retrieved: ${tags?.map((tag) => tag.name).join(", ")}`);
777
+ deps.log.info("Creating trigger for deployment...");
778
+ await findOrCreateTrigger(deps, apiConfig, {
779
+ branch,
780
+ environmentId,
781
+ pr,
782
+ qaWolfTeamId,
783
+ repositoryId,
784
+ tags
785
+ });
786
+ }, "createEnvironmentAction");
787
+
788
+ // src/lib/sdk/domain/legacy_previewTesting/deleteEnvironment.ts
789
+ async function deleteEnvironment(deps, apiConfig, { environmentId }) {
790
+ await deps.fetch(qawolfGraphQLEndpoint, {
791
+ body: JSON.stringify({
792
+ query: `
793
+ mutation deleteEnvironment($environmentId: ID!) {
794
+ deleteEnvironment(environment_id: $environmentId) {
795
+ id
796
+ }
797
+ }
798
+ `,
799
+ variables: {
800
+ environmentId
801
+ }
802
+ }),
803
+ headers: {
804
+ Authorization: `Bearer ${apiConfig.apiKey}`,
805
+ "Content-Type": "application/json"
806
+ },
807
+ method: "post"
808
+ });
809
+ deps.log.info(`Environment deleted with ID: ${environmentId}`);
810
+ }
811
+ __name(deleteEnvironment, "deleteEnvironment");
812
+
813
+ // src/lib/sdk/domain/legacy_previewTesting/getEnvironmentIdForBranch.ts
814
+ async function getEnvironmentIdForBranch(deps, apiConfig, branch) {
815
+ const response = await deps.fetch(qawolfGraphQLEndpoint, {
816
+ body: JSON.stringify({
817
+ query: `
818
+ query getTriggersForBranch($where: TriggerWhereInput) {
819
+ triggers(where: $where) {
820
+ id
821
+ environment_id
822
+ }
823
+ }
824
+ `,
825
+ variables: {
826
+ where: {
827
+ deployment_branches: {
828
+ contains: branch
829
+ }
830
+ }
831
+ }
832
+ }),
833
+ headers: {
834
+ Authorization: `Bearer ${apiConfig.apiKey}`,
835
+ "Content-Type": "application/json"
836
+ },
837
+ method: "post"
838
+ });
839
+ const responseJson = await response.json();
840
+ deps.log.info(`Trigger response: ${JSON.stringify(responseJson)}`);
841
+ const triggers = responseJson.data.triggers;
842
+ if (!triggers || !triggers[0]) throw Error(`No environment found for branch: ${branch}`);
843
+ return triggers[0].environment_id;
844
+ }
845
+ __name(getEnvironmentIdForBranch, "getEnvironmentIdForBranch");
846
+
847
+ // src/lib/sdk/domain/legacy_previewTesting/deleteEnvironmentAction.ts
848
+ var deleteEnvironmentAction = /* @__PURE__ */ __name(async (deps, apiConfig, { branch }) => {
849
+ deps.log.info("Retrieving environment ID for deletion...");
850
+ const environmentId = await getEnvironmentIdForBranch(deps, apiConfig, branch);
851
+ deps.log.info(`Deleting environment with ID: ${environmentId}`);
852
+ await deleteEnvironment(deps, apiConfig, {
853
+ environmentId
854
+ });
855
+ }, "deleteEnvironmentAction");
856
+
857
+ // src/lib/sdk/domain/legacy_previewTesting/index.ts
858
+ async function testPreview(deps, apiConfig, config) {
859
+ await createEnvironmentAction(deps, apiConfig, {
860
+ baseEnvironmentId: config.baseEnvironmentId,
861
+ branch: config.branch,
862
+ deploymentUrl: config.deploymentUrl,
863
+ headRepoFullName: config.repoFullName,
864
+ pr: config.pr,
865
+ qaWolfTeamId: config.qaWolfTeamId,
866
+ variables: config.variables
867
+ });
868
+ return attemptNotifyDeploy(deps, apiConfig, {
869
+ branch: config.branch,
870
+ commitUrl: config.commitUrl,
871
+ deploymentType: previewDeploymentType,
872
+ deploymentUrl: config.deploymentUrl,
873
+ sha: config.sha,
874
+ variables: config.variables
875
+ });
876
+ }
877
+ __name(testPreview, "testPreview");
878
+ async function removeEnvironment(deps, apiConfig, config) {
879
+ await deleteEnvironmentAction(deps, apiConfig, config);
880
+ }
881
+ __name(removeEnvironment, "removeEnvironment");
882
+
883
+ // src/lib/api/ci-greenlight.ts
884
+ async function fetchCiGreenlightStatus({ apiKey, serviceBase, userAgent }, { runId }, { fetch: localFetch, log }) {
885
+ try {
886
+ const resp = await localFetch(new URL(`/api/v0/ci-greenlight/${encodeURIComponent(runId)}`, serviceBase), {
887
+ headers: {
888
+ Authorization: `Bearer ${apiKey}`,
889
+ "User-Agent": userAgent
890
+ }
891
+ });
892
+ if (resp.ok) {
893
+ const greenlightStatus = await resp.json();
894
+ return {
895
+ greenlightStatus,
896
+ httpStatus: resp.status,
897
+ ok: true
898
+ };
899
+ }
900
+ await logFetchError({
901
+ log,
902
+ methodName: "fetchCiGreenlightStatus",
903
+ response: resp
904
+ });
905
+ if (resp.status === 404) {
906
+ return {
907
+ canRetry: true,
908
+ errorType: "not-found",
909
+ httpStatus: resp.status,
910
+ ok: false
911
+ };
912
+ }
913
+ if (resp.status >= 500) {
914
+ return {
915
+ canRetry: true,
916
+ errorType: "server",
917
+ httpStatus: resp.status,
918
+ ok: false
919
+ };
920
+ }
921
+ return {
922
+ canRetry: false,
923
+ errorType: "client",
924
+ httpStatus: resp.status,
925
+ ok: false
926
+ };
927
+ } catch (e) {
928
+ return {
929
+ canRetry: true,
930
+ errorType: "network",
931
+ httpStatus: 0,
932
+ ok: false
933
+ };
934
+ }
935
+ }
936
+ __name(fetchCiGreenlightStatus, "fetchCiGreenlightStatus");
937
+
938
+ // src/lib/sdk/domain/poll-ci-greenlight.ts
939
+ var safeDefaults = {
940
+ abortOnSuperseded: false,
941
+ maxRetries: 10,
942
+ pollTimeout: 120 * 60 * 1e3,
943
+ retryInterval: 10 * 1e3,
944
+ runInProgressInterval: 30 * 1e3,
945
+ runUnderReviewInterval: 60 * 1e3
946
+ };
947
+ async function pollCiGreenlightStatus(deps, apiConfig, { onRunStageChanged = /* @__PURE__ */ __name(() => undefined, "onRunStageChanged"), runId, ...pollConfig }) {
948
+ let retries = 0;
949
+ const { log } = deps;
950
+ const { abortOnSuperseded = safeDefaults.abortOnSuperseded, maxRetries = safeDefaults.maxRetries, pollTimeout = safeDefaults.pollTimeout, retryInterval = safeDefaults.retryInterval, runInProgressInterval = safeDefaults.runInProgressInterval, runUnderReviewInterval = safeDefaults.runUnderReviewInterval } = pollConfig;
951
+ let currentStatus = undefined;
952
+ const startedAt = Date.now();
953
+ let hasTimedOut = false;
954
+ while (!(hasTimedOut = Date.now() - startedAt > pollTimeout)) {
955
+ const responseState = await fetchCiGreenlightStatus(apiConfig, {
956
+ runId
957
+ }, deps);
958
+ if (!responseState.ok && !responseState.canRetry) {
959
+ log.error(`\u{1F6AB} Unrecoverable error (status ${responseState.httpStatus}) from CI greenlight, aborting.`);
960
+ return {
961
+ abortReason: "4XX-client-error",
962
+ httpStatus: responseState.httpStatus,
963
+ outcome: "aborted"
964
+ };
965
+ }
966
+ if (!responseState.ok) {
967
+ retries += 1;
968
+ if (retries > maxRetries) {
969
+ log.error(`\u{1F6AB} Unrecoverable error${responseState.httpStatus ? ` (status ${responseState.httpStatus})` : ""} from CI greenlight, aborting after ${maxRetries} attempts.`);
970
+ if (responseState.errorType === "network") {
971
+ return {
972
+ abortReason: "network-error",
973
+ httpStatus: undefined,
974
+ outcome: "aborted"
975
+ };
976
+ }
977
+ let abortReason = "XXX-other-http-code";
978
+ if (responseState.errorType === "not-found") abortReason = "404-run-not-found";
979
+ else if (responseState.errorType === "server") abortReason = "5XX-server-error";
980
+ else ;
981
+ return {
982
+ abortReason,
983
+ httpStatus: responseState.httpStatus,
984
+ outcome: "aborted"
985
+ };
986
+ }
987
+ const { errorType, httpStatus } = responseState;
988
+ const retryLabel = `${httpStatus ? ` (status ${httpStatus})` : ""}, will try again... (${retries}/${maxRetries})`;
989
+ if (errorType === "network") log.warn(`\u274C Network error${retryLabel}`);
990
+ else if (errorType === "not-found") log.info(`\u23F3 Run not found${retryLabel}`);
991
+ else if (errorType === "server") log.warn(`\u274C Server error${retryLabel}`);
992
+ await sleep(retryInterval);
993
+ continue;
994
+ }
995
+ retries = 0;
996
+ const { greenlightStatus } = responseState;
997
+ const previousStatus = currentStatus;
998
+ currentStatus = greenlightStatus;
999
+ if (!previousStatus || previousStatus.runStage !== greenlightStatus.runStage) {
1000
+ try {
1001
+ await onRunStageChanged(greenlightStatus, previousStatus);
1002
+ } catch (e) {
1003
+ log.error(`Error in onRunStageChanged callback`, e);
1004
+ }
1005
+ }
1006
+ const urlInfo = `See ${greenlightStatus.relevantRunUrl}`;
1007
+ const { greenlight, relevantRunId, relevantRunUrl, relevantRunWithBugsUrl, rootRunId, rootRunUrl, runStage } = greenlightStatus;
1008
+ if (rootRunId !== relevantRunId) {
1009
+ const supersedingDetails = `
1010
+ - Root: ${rootRunUrl}
1011
+ - Superseding: ${relevantRunUrl}`;
1012
+ if (abortOnSuperseded) {
1013
+ log.warn(`\u274C Aborting due to superseded run (option 'abortOnSuperseded' is enabled).${supersedingDetails}`);
1014
+ return {
1015
+ abortReason: "superseded-run",
1016
+ httpStatus: undefined,
1017
+ outcome: "aborted"
1018
+ };
1019
+ }
1020
+ log.info(`Root run was superseded:${supersedingDetails}`);
1021
+ }
1022
+ if (runStage === "completed") {
1023
+ const { blockingBugsCount, blockingBugUrls = [], nonBlockingBugsCount, nonBlockingBugUrls = [] } = greenlightStatus;
1024
+ const blockingBugList = blockingBugUrls.map((url) => `
1025
+ \u2022 ${url}`).join("");
1026
+ const nonBlockingBugList = nonBlockingBugUrls.map((url) => `
1027
+ \u2022 ${url}`).join("");
1028
+ const bugsListInText = `${blockingBugUrls.length > 0 ? `
1029
+ BLOCKING BUGS:${blockingBugList}` : ""}${nonBlockingBugUrls.length > 0 ? `
1030
+ NON BLOCKING BUGS:${nonBlockingBugList}` : ""}`;
1031
+ if (greenlight) {
1032
+ log.info(`\u2705 Run passed and no blocking bugs found${nonBlockingBugsCount > 0 ? ` and ${nonBlockingBugsCount} non-blocking bug${pluralize(nonBlockingBugsCount)} found` : ""}.
1033
+ ${urlInfo}`);
1034
+ return {
1035
+ greenlightStatus,
1036
+ outcome: "success"
1037
+ };
1038
+ } else {
1039
+ log.warn(`\u274C Run failed and ${blockingBugsCount} blocking bug${pluralize(blockingBugsCount)} found${nonBlockingBugsCount ? ` and ${nonBlockingBugsCount} non-blocking bug${pluralize(nonBlockingBugsCount)}` : ""}.
1040
+ See ${relevantRunWithBugsUrl}
1041
+ You may review the priority of certain bugs to mark these non-blocking and retry the job.
1042
+ ` + bugsListInText);
1043
+ return {
1044
+ greenlightStatus,
1045
+ outcome: "failed"
1046
+ };
1047
+ }
1048
+ }
1049
+ if (runStage === "canceled") {
1050
+ log.info(`\u{1F6AB} Run was canceled. Aborting... Please contact support.
1051
+ ${urlInfo}`);
1052
+ return {
1053
+ abortReason: "run-canceled",
1054
+ httpStatus: undefined,
1055
+ outcome: "aborted"
1056
+ };
1057
+ }
1058
+ if (hasTimedOut) {
1059
+ log.warn(`\u274C Poll timed out after ${pollTimeout / 1e3}s. Aborting...`);
1060
+ return {
1061
+ abortReason: "poll-timed-out",
1062
+ httpStatus: undefined,
1063
+ outcome: "aborted"
1064
+ };
1065
+ }
1066
+ if (runStage === "initializing") {
1067
+ log.info(`\u23F3 Run is in progress... ${urlInfo}`);
1068
+ await sleep(runInProgressInterval);
1069
+ } else if (runStage === "underReview") {
1070
+ log.info(`\u{1F575}\uFE0F Run is under review... ${urlInfo}`);
1071
+ await sleep(runUnderReviewInterval);
1072
+ } else throw Error(`Unexpected run stage: ${runStage}`);
1073
+ }
1074
+ log.warn(`\u274C Poll timed out after ${pollTimeout / 1e3}s. Aborting...`);
1075
+ return {
1076
+ abortReason: "poll-timed-out",
1077
+ httpStatus: undefined,
1078
+ outcome: "aborted"
1079
+ };
1080
+ }
1081
+ __name(pollCiGreenlightStatus, "pollCiGreenlightStatus");
1082
+
1083
+ // src/lib/api/graphql.ts
1084
+ var GraphQLBadResponseError = class GraphQLBadResponseError2 extends Error {
1085
+ static {
1086
+ __name(this, "GraphQLBadResponseError");
1087
+ }
1088
+ constructor(message) {
1089
+ super(message);
1090
+ this.name = "GraphQLBadResponseError";
1091
+ }
1092
+ };
1093
+ function mapErrorCodeToAbortReason({ errorCode, log }) {
1094
+ switch (errorCode) {
1095
+ case "BAD_USER_INPUT":
1096
+ return "invalid-input";
1097
+ case "FORBIDDEN":
1098
+ return "forbidden";
1099
+ case "INTERNAL":
1100
+ return "server-error";
1101
+ case "UNAUTHENTICATED":
1102
+ return "unauthenticated";
1103
+ default:
1104
+ log.error(`Unknown error code. ${errorCode}`);
1105
+ return "server-error";
1106
+ }
1107
+ }
1108
+ __name(mapErrorCodeToAbortReason, "mapErrorCodeToAbortReason");
1109
+ async function qawolfGraphql({ apiConfig: { apiKey, serviceBase, userAgent }, deps: { fetch: localFetch, log }, name, query: queryGql, variables }) {
1110
+ try {
1111
+ const response = await localFetch(new URL(`/api/graphql`, serviceBase), {
1112
+ body: JSON.stringify({
1113
+ query: queryGql,
1114
+ variables
1115
+ }),
1116
+ headers: {
1117
+ Authorization: `Bearer ${apiKey}`,
1118
+ "Content-Type": "application/json",
1119
+ "User-Agent": userAgent
1120
+ },
1121
+ method: "post"
1122
+ });
1123
+ let rawBody;
1124
+ try {
1125
+ rawBody = await response.json();
1126
+ } catch (e) {
1127
+ throw new GraphQLBadResponseError(`[GraphQL] Unexpected response schema. Not valid JSON body.`);
1128
+ }
1129
+ if ("errors" in rawBody) {
1130
+ for (const error of rawBody.errors) log.warn(`\u274C [GraphQL] error: ${error.message}`);
1131
+ const firstError = rawBody.errors[0];
1132
+ const eventId = firstError?.extensions?.eventId;
1133
+ const errorCode = firstError?.extensions?.code;
1134
+ return {
1135
+ abortReason: mapErrorCodeToAbortReason({
1136
+ errorCode,
1137
+ log
1138
+ }),
1139
+ eventId,
1140
+ isGqlError: true
1141
+ };
1142
+ }
1143
+ if (!("data" in rawBody)) {
1144
+ throw new GraphQLBadResponseError(`[GraphQL] Unexpected response schema. Missing 'data' in response body. This is a bug.`);
1145
+ }
1146
+ if (!(name in rawBody.data)) {
1147
+ throw new GraphQLBadResponseError(`[GraphQL] Unexpected response schema. Missing 'data.${name}' in response body. This is a bug.`);
1148
+ }
1149
+ return {
1150
+ isGqlError: false,
1151
+ responseBody: rawBody.data[name]
1152
+ };
1153
+ } catch (e) {
1154
+ if (e instanceof GraphQLBadResponseError) throw e;
1155
+ log.error(`\u274C [GraphQL] network error: ${e instanceof Error ? e.message : e}`);
1156
+ return {
1157
+ abortReason: "network-error",
1158
+ isGqlError: true
1159
+ };
1160
+ }
1161
+ }
1162
+ __name(qawolfGraphql, "qawolfGraphql");
1163
+ function logGraphQLError({ log, methodName, payload }) {
1164
+ const eventIdSuffix = payload.eventId ? ` (Event ID: ${payload.eventId})` : "";
1165
+ switch (payload.abortReason) {
1166
+ case "forbidden":
1167
+ log.error(`\u274C [${methodName}] Forbidden. Aborting${eventIdSuffix}`);
1168
+ break;
1169
+ case "invalid-input":
1170
+ log.error(`\u274C [${methodName}] Bad GraphQL input. This is a bug. Aborting${eventIdSuffix}`);
1171
+ break;
1172
+ case "network-error":
1173
+ log.error(`\u274C [${methodName}] Network error. Aborting${eventIdSuffix}`);
1174
+ break;
1175
+ case "server-error":
1176
+ log.error(`\u274C [${methodName}] Server error. Aborting${eventIdSuffix}`);
1177
+ break;
1178
+ case "unauthenticated":
1179
+ log.error(`\u274C [${methodName}] Unauthenticated. Aborting${eventIdSuffix}`);
1180
+ break;
1181
+ default:
1182
+ payload.abortReason;
1183
+ log.error(`\u274C [${methodName}] Unknown error. ${payload.abortReason} This is a bug${eventIdSuffix}`);
1184
+ }
1185
+ }
1186
+ __name(logGraphQLError, "logGraphQLError");
1187
+
1188
+ // src/lib/api/notify-vcs-branch-merge-canceled-mutation.ts
1189
+ var mutationName = "notifyVCSBranchMergeCanceled";
1190
+ var mutationGql = `
1191
+ mutation NotifyVCSBranchMergeCanceled($headEnvironmentAlias: String!) {
1192
+ ${mutationName}(headEnvironmentAlias: $headEnvironmentAlias) {
1193
+ outcome
1194
+ failureCode
1195
+ failureDetails
1196
+ }
1197
+ }`;
1198
+ async function callNotifyVCSBranchMergeCanceledMutation(deps, apiConfig, { headEnvironmentAlias }) {
1199
+ return qawolfGraphql({
1200
+ apiConfig,
1201
+ deps,
1202
+ name: mutationName,
1203
+ query: mutationGql,
1204
+ variables: {
1205
+ headEnvironmentAlias
1206
+ }
1207
+ });
1208
+ }
1209
+ __name(callNotifyVCSBranchMergeCanceledMutation, "callNotifyVCSBranchMergeCanceledMutation");
1210
+
1211
+ // src/lib/sdk/domain/vcsBranchTesting/lib/domain-failure.ts
1212
+ function domainFailureToAbortResult({ log, methodName, result }) {
1213
+ switch (result.failureCode) {
1214
+ case "base-environment-not-found":
1215
+ log.error(`\u274C [${methodName}] Base environment not found. Aborting.`);
1216
+ return {
1217
+ abortReason: result.failureCode,
1218
+ outcome: "aborted"
1219
+ };
1220
+ case "base-trigger-not-found":
1221
+ log.error(`\u274C [${methodName}] Base trigger not found. A QA Wolf representative should set this up for you. Aborting.`);
1222
+ return {
1223
+ abortReason: result.failureCode,
1224
+ outcome: "aborted"
1225
+ };
1226
+ case "head-environment-not-found":
1227
+ log.error(`\u274C [${methodName}] Head environment not found. Aborting.`);
1228
+ return {
1229
+ abortReason: result.failureCode,
1230
+ outcome: "aborted"
1231
+ };
1232
+ case "head-trigger-not-found":
1233
+ log.error(`\u274C [${methodName}] Head trigger not found. Aborting.`);
1234
+ return {
1235
+ abortReason: result.failureCode,
1236
+ outcome: "aborted"
1237
+ };
1238
+ case "invalid-input":
1239
+ log.error(`\u274C [${methodName}] Invalid input: ${result.failureDetails} Aborting.`);
1240
+ return {
1241
+ abortReason: result.failureCode,
1242
+ outcome: "aborted"
1243
+ };
1244
+ case "non-ephemeral-head-environment-violation":
1245
+ log.error(`\u274C [${methodName}] Non-ephemeral head environment violation. Aborting.`);
1246
+ return {
1247
+ abortReason: result.failureCode,
1248
+ outcome: "aborted"
1249
+ };
1250
+ case "repository-not-found":
1251
+ log.error(`\u274C [${methodName}] Repository not found: ${result.failureDetails} Aborting.`);
1252
+ return {
1253
+ abortReason: result.failureCode,
1254
+ outcome: "aborted"
1255
+ };
1256
+ case "run-creation-failed":
1257
+ log.error(`\u274C [${methodName}] Run creation failed: ${result.failureDetails}. Aborting.`);
1258
+ return {
1259
+ abortReason: result.failureCode,
1260
+ outcome: "aborted"
1261
+ };
1262
+ default:
1263
+ result.failureCode;
1264
+ throw Error(`[${methodName}] Unreachable code detected. This is a bug. ${result.failureCode}`);
1265
+ }
1266
+ }
1267
+ __name(domainFailureToAbortResult, "domainFailureToAbortResult");
1268
+
1269
+ // src/lib/sdk/domain/vcsBranchTesting/lib/retry.ts
1270
+ async function retryWithExponentialBackoff({ log, maxRetries, methodName, retriableAbortReasons, runOnce }) {
1271
+ let attemptNumber = 0;
1272
+ let result;
1273
+ do {
1274
+ attemptNumber++;
1275
+ log.info(`\u{1F501} [${methodName}] Attempt ${attemptNumber}/${maxRetries + 1}.`);
1276
+ result = await runOnce();
1277
+ if (result.outcome === "success" || !retriableAbortReasons.includes(result.abortReason)) return result;
1278
+ if (attemptNumber >= maxRetries + 1) return result;
1279
+ const backoffMs = getBackoffMs(attemptNumber);
1280
+ const secondsApproximation = (backoffMs / 1e3).toFixed(1);
1281
+ log.warn(`\u23F3 [${methodName}] Retrying in ${secondsApproximation} seconds.`);
1282
+ await sleep(backoffMs);
1283
+ } while (true);
1284
+ }
1285
+ __name(retryWithExponentialBackoff, "retryWithExponentialBackoff");
1286
+
1287
+ // src/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-canceled.ts
1288
+ async function runNotifyVCSMergeCanceledOnce(deps, apiConfig, input) {
1289
+ const log = deps.log;
1290
+ const { headEnvironmentAlias } = input;
1291
+ const resp = await callNotifyVCSBranchMergeCanceledMutation(deps, apiConfig, {
1292
+ headEnvironmentAlias
1293
+ });
1294
+ if (resp.isGqlError) {
1295
+ logGraphQLError({
1296
+ log,
1297
+ methodName: "notifyVCSBranchMergeCanceled",
1298
+ payload: resp
1299
+ });
1300
+ return {
1301
+ abortReason: resp.abortReason,
1302
+ eventId: resp.eventId,
1303
+ outcome: "aborted"
1304
+ };
1305
+ }
1306
+ const result = resp.responseBody;
1307
+ if (result.outcome === "success") {
1308
+ log.info(`\u2705 [notifyVCSBranchMergeCanceled] Successfully notified the CI system that the merge was canceled.`);
1309
+ return {
1310
+ outcome: "success"
1311
+ };
1312
+ }
1313
+ result.outcome;
1314
+ return domainFailureToAbortResult({
1315
+ log,
1316
+ methodName: "notifyVCSBranchMergeCanceled",
1317
+ result
1318
+ });
1319
+ }
1320
+ __name(runNotifyVCSMergeCanceledOnce, "runNotifyVCSMergeCanceledOnce");
1321
+ async function notifyVCSBranchMergeCanceled(deps, apiConfig, input) {
1322
+ const { maxRetries = 10 } = input;
1323
+ return retryWithExponentialBackoff({
1324
+ log: deps.log,
1325
+ maxRetries,
1326
+ methodName: "notifyVCSBranchMergeCanceled",
1327
+ retriableAbortReasons: [
1328
+ "network-error",
1329
+ "server-error"
1330
+ ],
1331
+ runOnce: /* @__PURE__ */ __name(() => runNotifyVCSMergeCanceledOnce(deps, apiConfig, input), "runOnce")
1332
+ });
1333
+ }
1334
+ __name(notifyVCSBranchMergeCanceled, "notifyVCSBranchMergeCanceled");
1335
+
1336
+ // src/lib/api/notify-vcs-branch-merge-completed-mutation.ts
1337
+ var mutationName2 = "notifyVCSBranchMergeCompleted";
1338
+ var mutationGql2 = `
1339
+ mutation NotifyVCSBranchMergeCompleted($baseEnvironmentAlias: String, $headEnvironmentAlias: String!) {
1340
+ ${mutationName2}(baseEnvironmentAlias: $baseEnvironmentAlias, headEnvironmentAlias: $headEnvironmentAlias) {
1341
+ outcome
1342
+ failureCode
1343
+ failureDetails
1344
+ }
1345
+ }`;
1346
+ async function callNotifyVCSBranchMergeCompletedMutation(deps, apiConfig, { baseEnvironmentAlias, headEnvironmentAlias }) {
1347
+ return qawolfGraphql({
1348
+ apiConfig,
1349
+ deps,
1350
+ name: mutationName2,
1351
+ query: mutationGql2,
1352
+ variables: {
1353
+ baseEnvironmentAlias: baseEnvironmentAlias ?? null,
1354
+ headEnvironmentAlias
1355
+ }
1356
+ });
1357
+ }
1358
+ __name(callNotifyVCSBranchMergeCompletedMutation, "callNotifyVCSBranchMergeCompletedMutation");
1359
+
1360
+ // src/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-completed.ts
1361
+ async function runNotifyVCSBranchMergeCompletedOnce(deps, apiConfig, input) {
1362
+ const log = deps.log;
1363
+ const { baseEnvironmentsMapping, baseVcsBranch: vcsBaseBranch } = input;
1364
+ const baseEnvironmentAlias = baseEnvironmentsMapping?.find((mapping) => mapping.vcsBranch === vcsBaseBranch)?.environmentAlias;
1365
+ if (baseEnvironmentAlias === undefined) {
1366
+ log.info(`\u2139\uFE0F [notifyVCSBranchMergeCompleted] Could not find a base environment for VCS branch '${vcsBaseBranch}'. Fall back to use the default base environment`);
1367
+ }
1368
+ const resp = await callNotifyVCSBranchMergeCompletedMutation(deps, apiConfig, {
1369
+ baseEnvironmentAlias,
1370
+ headEnvironmentAlias: input.headEnvironmentAlias
1371
+ });
1372
+ if (resp.isGqlError) {
1373
+ logGraphQLError({
1374
+ log,
1375
+ methodName: "notifyVCSBranchMergeCompleted",
1376
+ payload: resp
1377
+ });
1378
+ return {
1379
+ abortReason: resp.abortReason,
1380
+ eventId: resp.eventId,
1381
+ outcome: "aborted"
1382
+ };
1383
+ }
1384
+ const result = resp.responseBody;
1385
+ if (result.outcome === "success") {
1386
+ log.info(`\u2705 [notifyVCSBranchMergeCompleted] Successfully notified the CI system that the merge was completed.`);
1387
+ return {
1388
+ outcome: "success"
1389
+ };
1390
+ }
1391
+ result.outcome;
1392
+ return domainFailureToAbortResult({
1393
+ log,
1394
+ methodName: "notifyVCSBranchMergeCompleted",
1395
+ result
1396
+ });
1397
+ }
1398
+ __name(runNotifyVCSBranchMergeCompletedOnce, "runNotifyVCSBranchMergeCompletedOnce");
1399
+ async function notifyVCSBranchMergeCompleted(deps, apiConfig, input) {
1400
+ const { maxRetries = 10 } = input;
1401
+ return retryWithExponentialBackoff({
1402
+ log: deps.log,
1403
+ maxRetries,
1404
+ methodName: "notifyVCSBranchMergeCompleted",
1405
+ retriableAbortReasons: [
1406
+ "network-error",
1407
+ "server-error"
1408
+ ],
1409
+ runOnce: /* @__PURE__ */ __name(() => runNotifyVCSBranchMergeCompletedOnce(deps, apiConfig, input), "runOnce")
1410
+ });
1411
+ }
1412
+ __name(notifyVCSBranchMergeCompleted, "notifyVCSBranchMergeCompleted");
1413
+
1414
+ // src/lib/api/notify-vcs-branch-build-deployed-mutation.ts
1415
+ var mutationName3 = "notifyVCSBranchBuildDeployed";
1416
+ var mutationGql3 = `
1417
+ mutation NotifyVCSBranchBuildDeployed(
1418
+ $headVcsCommitId: String!,
1419
+ $baseVcsBranch: String,
1420
+ $headEnvironmentVariablesJson: String!,
1421
+ $baseEnvironmentAlias: String,
1422
+ $headEnvironmentAlias: String!,
1423
+ $concurrencyLimit: Int,
1424
+ $headEnvironmentName: String,
1425
+ $headVcsBranch: String,
1426
+ $headVcsCommitUrl: String,
1427
+ $pullOrMergeRequestNumber: Int
1428
+ ) {
1429
+ ${mutationName3}(
1430
+ headVcsCommitId: $headVcsCommitId,
1431
+ baseVcsBranch: $baseVcsBranch,
1432
+ headEnvironmentVariablesJson: $headEnvironmentVariablesJson,
1433
+ baseEnvironmentAlias: $baseEnvironmentAlias,
1434
+ headEnvironmentAlias: $headEnvironmentAlias,
1435
+ concurrencyLimit: $concurrencyLimit,
1436
+ headEnvironmentName: $headEnvironmentName,
1437
+ headVcsBranch: $headVcsBranch,
1438
+ headVcsCommitUrl: $headVcsCommitUrl,
1439
+ pullOrMergeRequestNumber: $pullOrMergeRequestNumber
1440
+ ) {
1441
+ outcome
1442
+ codeHostingServiceInstallationPlatform
1443
+ failureCode
1444
+ failureDetails
1445
+ runId
1446
+ }
1447
+ }`;
1448
+ async function callNotifyVCSBranchBuildDeployedMutation(deps, apiConfig, { baseEnvironmentAlias, baseVcsBranch, concurrencyLimit, headEnvironmentAlias, headEnvironmentName, headEnvironmentVariables, headVcsBranch, headVcsCommitId, headVcsCommitUrl, pullOrMergeRequestNumber }) {
1449
+ return qawolfGraphql({
1450
+ apiConfig,
1451
+ deps,
1452
+ name: mutationName3,
1453
+ query: mutationGql3,
1454
+ variables: {
1455
+ baseEnvironmentAlias: baseEnvironmentAlias ?? null,
1456
+ baseVcsBranch: baseVcsBranch ?? null,
1457
+ concurrencyLimit: concurrencyLimit ?? null,
1458
+ headEnvironmentAlias,
1459
+ headEnvironmentName,
1460
+ headEnvironmentVariablesJson: JSON.stringify(headEnvironmentVariables),
1461
+ headVcsBranch: headVcsBranch ?? null,
1462
+ headVcsCommitId,
1463
+ headVcsCommitUrl: headVcsCommitUrl ?? null,
1464
+ pullOrMergeRequestNumber: pullOrMergeRequestNumber ?? null
1465
+ }
1466
+ });
1467
+ }
1468
+ __name(callNotifyVCSBranchBuildDeployedMutation, "callNotifyVCSBranchBuildDeployedMutation");
1469
+
1470
+ // src/lib/sdk/domain/vcsBranchTesting/notifyVCSBranchBuildDeployed/index.ts
1471
+ async function runNotifyVCSBranchBuildDeployedOnce(deps, apiConfig, input) {
1472
+ const { baseEnvironmentsMapping, baseVcsBranch, concurrencyLimit, headEnvironmentAlias, headEnvironmentName, headEnvironmentVariables, headVcsBranch, headVcsCommitId, headVcsCommitUrl, pullOrMergeRequestNumber } = input;
1473
+ const log = deps.log;
1474
+ const baseEnvironmentAlias = baseEnvironmentsMapping?.find((mapping) => mapping.vcsBranch === baseVcsBranch)?.environmentAlias;
1475
+ let finalConcurrencyLimit = concurrencyLimit;
1476
+ if (typeof concurrencyLimit === "number") {
1477
+ if (concurrencyLimit === Infinity) finalConcurrencyLimit = 0;
1478
+ else if (Number.isNaN(concurrencyLimit) || !Number.isInteger(concurrencyLimit)) {
1479
+ log.error(`\u274C [notifyVCSBranchBuildDeployed] Invalid concurrency limit '${concurrencyLimit}'. Must be a positive integer.`);
1480
+ return {
1481
+ abortReason: "invalid-input",
1482
+ outcome: "aborted"
1483
+ };
1484
+ }
1485
+ if (concurrencyLimit < 0) {
1486
+ log.error(`\u274C [notifyVCSBranchBuildDeployed] Invalid concurrency limit '${concurrencyLimit}'. Must be a positive integer.`);
1487
+ return {
1488
+ abortReason: "invalid-input",
1489
+ outcome: "aborted"
1490
+ };
1491
+ }
1492
+ }
1493
+ const resp = await callNotifyVCSBranchBuildDeployedMutation(deps, apiConfig, {
1494
+ baseEnvironmentAlias,
1495
+ baseVcsBranch,
1496
+ concurrencyLimit: finalConcurrencyLimit,
1497
+ headEnvironmentAlias,
1498
+ headEnvironmentName,
1499
+ headEnvironmentVariables,
1500
+ headVcsBranch,
1501
+ headVcsCommitId,
1502
+ headVcsCommitUrl,
1503
+ pullOrMergeRequestNumber
1504
+ });
1505
+ if (resp.isGqlError) {
1506
+ logGraphQLError({
1507
+ log,
1508
+ methodName: "notifyVCSBranchBuildDeployed",
1509
+ payload: resp
1510
+ });
1511
+ return {
1512
+ abortReason: resp.abortReason,
1513
+ eventId: resp.eventId,
1514
+ outcome: "aborted"
1515
+ };
1516
+ }
1517
+ const result = resp.responseBody;
1518
+ if (result.outcome === "success") {
1519
+ const codeHostingInfo = result.codeHostingServiceInstallationPlatform == null ? "" : `, and code hosting service integration '${result.codeHostingServiceInstallationPlatform}'.`;
1520
+ log.info(`\u2705 [notifyVCSBranchBuildDeployed] Success. Run was deployed with ID: '${result.runId}'${codeHostingInfo}`);
1521
+ return {
1522
+ codeHostingServiceInstallationType: result.codeHostingServiceInstallationPlatform ?? undefined,
1523
+ outcome: "success",
1524
+ runId: result.runId
1525
+ };
1526
+ }
1527
+ result.outcome;
1528
+ return domainFailureToAbortResult({
1529
+ log,
1530
+ methodName: "notifyVCSBranchBuildDeployed",
1531
+ result
1532
+ });
1533
+ }
1534
+ __name(runNotifyVCSBranchBuildDeployedOnce, "runNotifyVCSBranchBuildDeployedOnce");
1535
+ async function notifyVCSBranchBuildDeployed(deps, apiConfig, input) {
1536
+ const { maxRetries = 10 } = input;
1537
+ return retryWithExponentialBackoff({
1538
+ log: deps.log,
1539
+ maxRetries,
1540
+ methodName: "notifyVCSBranchBuildDeployed",
1541
+ retriableAbortReasons: [
1542
+ "network-error",
1543
+ "server-error",
1544
+ "run-creation-failed"
1545
+ ],
1546
+ runOnce: /* @__PURE__ */ __name(() => runNotifyVCSBranchBuildDeployedOnce(deps, apiConfig, input), "runOnce")
1547
+ });
1548
+ }
1549
+ __name(notifyVCSBranchBuildDeployed, "notifyVCSBranchBuildDeployed");
1550
+ function pullRequestDetailsToEnvironmentAlias({ codeHostingServiceOrganization, codeHostingServiceRepositoryName, pullRequestIdentifier }) {
1551
+ return arbitraryStringToEnvironmentAlias(`${codeHostingServiceOrganization}-${codeHostingServiceRepositoryName}-pr-${pullRequestIdentifier}`);
1552
+ }
1553
+ __name(pullRequestDetailsToEnvironmentAlias, "pullRequestDetailsToEnvironmentAlias");
1554
+ function arbitraryStringToEnvironmentAlias(arbitraryString) {
1555
+ return slugify__default.default(arbitraryString, {
1556
+ lower: true
1557
+ });
1558
+ }
1559
+ __name(arbitraryStringToEnvironmentAlias, "arbitraryStringToEnvironmentAlias");
1560
+
1561
+ // src/lib/sdk/domain/vcsBranchTesting/index.ts
1562
+ function makeVCSBranchTestingSDK({ apiKey, serviceBase = defaultServiceBase, userAgent = defaultUserAgent }, { fetch = defaultFetch, log = defaultLogDriver } = {}) {
1563
+ const deps = {
1564
+ fetch,
1565
+ log
1566
+ };
1567
+ const apiConfig = {
1568
+ apiKey,
1569
+ serviceBase,
1570
+ userAgent
1571
+ };
1572
+ return {
1573
+ notifyVCSBranchBuildDeployed: notifyVCSBranchBuildDeployed.bind(null, deps, apiConfig),
1574
+ notifyVCSBranchMergeCanceled: notifyVCSBranchMergeCanceled.bind(null, deps, apiConfig),
1575
+ notifyVCSBranchMergeCompleted: notifyVCSBranchMergeCompleted.bind(null, deps, apiConfig)
1576
+ };
1577
+ }
1578
+ __name(makeVCSBranchTestingSDK, "makeVCSBranchTestingSDK");
1579
+
1580
+ // src/lib/sdk/index.ts
1581
+ function makeQaWolfSdk({ apiKey, serviceBase = defaultServiceBase, userAgent = defaultUserAgent }, { fetch = defaultFetch, log = defaultLogDriver } = {}) {
1582
+ if (typeof fetch !== "function") {
1583
+ throw Error(`QA Wolf CI-SDK requires fetch to be defined. Make sure you are using NodeJS 18+, OR pass a fetch polyfill to the makeQaWolfSdk function.
1584
+ We recommend 'undici' package for that purpose. See the Requirement section of our README for more guidance.`);
1585
+ }
1586
+ const deps = {
1587
+ // Versions of fetch may have different default timeouts. For consistency, we explicitly set it to 60 seconds here.
1588
+ fetch: buildFetchWithTimeout(fetch, 6e4),
1589
+ log
1590
+ };
1591
+ const apiConfig = {
1592
+ apiKey,
1593
+ serviceBase,
1594
+ userAgent
1595
+ };
1596
+ return {
1597
+ attemptNotifyDeploy: attemptNotifyDeploy.bind(null, deps, apiConfig),
1598
+ /**
1599
+ * @deprecated Use `experimental_vcsBranchTesting` instead.
1600
+ */
1601
+ experimental_removeEnvironment: removeEnvironment.bind(null, deps, apiConfig),
1602
+ /**
1603
+ * @deprecated Use `experimental_vcsBranchTesting` instead.
1604
+ */
1605
+ experimental_testPreview: testPreview.bind(null, deps, apiConfig),
1606
+ experimental_vcsBranchTesting: makeVCSBranchTestingSDK(apiConfig, deps),
1607
+ generateSignedUrlForRunInputsExecutablesStorage: generateSignedUrlForRunInputsExecutablesStorage.bind(null, deps, apiConfig),
1608
+ generateSignedUrlForTempTeamStorage: generateSignedUrlForTempTeamStorage.bind(null, deps, apiConfig),
1609
+ pollCiGreenlightStatus: pollCiGreenlightStatus.bind(null, deps, apiConfig)
1610
+ };
1611
+ }
1612
+ __name(makeQaWolfSdk, "makeQaWolfSdk");
1613
+
1614
+ exports.arbitraryStringToEnvironmentAlias = arbitraryStringToEnvironmentAlias;
1615
+ exports.makeQaWolfSdk = makeQaWolfSdk;
1616
+ exports.makeVCSBranchTestingSDK = makeVCSBranchTestingSDK;
1617
+ exports.pullRequestDetailsToEnvironmentAlias = pullRequestDetailsToEnvironmentAlias;
1618
+ //# sourceMappingURL=index.js.map
1619
+ //# sourceMappingURL=index.js.map