@inluxc/propmaster 0.0.0-stage → 1.0.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 (444) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +696 -2
  3. package/dist/src/annotations/index.d.ts +11 -0
  4. package/dist/src/annotations/index.d.ts.map +1 -0
  5. package/dist/src/annotations/index.js +11 -0
  6. package/dist/src/annotations/index.js.map +1 -0
  7. package/dist/src/annotations/recorder.d.ts +57 -0
  8. package/dist/src/annotations/recorder.d.ts.map +1 -0
  9. package/dist/src/annotations/recorder.js +100 -0
  10. package/dist/src/annotations/recorder.js.map +1 -0
  11. package/dist/src/annotations/truncation.d.ts +34 -0
  12. package/dist/src/annotations/truncation.d.ts.map +1 -0
  13. package/dist/src/annotations/truncation.js +54 -0
  14. package/dist/src/annotations/truncation.js.map +1 -0
  15. package/dist/src/auth/apply.d.ts +15 -0
  16. package/dist/src/auth/apply.d.ts.map +1 -0
  17. package/dist/src/auth/apply.js +21 -0
  18. package/dist/src/auth/apply.js.map +1 -0
  19. package/dist/src/auth/setup.d.ts +56 -0
  20. package/dist/src/auth/setup.d.ts.map +1 -0
  21. package/dist/src/auth/setup.js +79 -0
  22. package/dist/src/auth/setup.js.map +1 -0
  23. package/dist/src/auth/state-file.d.ts +8 -0
  24. package/dist/src/auth/state-file.d.ts.map +1 -0
  25. package/dist/src/auth/state-file.js +13 -0
  26. package/dist/src/auth/state-file.js.map +1 -0
  27. package/dist/src/auth/token-manager.d.ts +61 -0
  28. package/dist/src/auth/token-manager.d.ts.map +1 -0
  29. package/dist/src/auth/token-manager.js +200 -0
  30. package/dist/src/auth/token-manager.js.map +1 -0
  31. package/dist/src/cli/banner.d.ts +23 -0
  32. package/dist/src/cli/banner.d.ts.map +1 -0
  33. package/dist/src/cli/banner.js +67 -0
  34. package/dist/src/cli/banner.js.map +1 -0
  35. package/dist/src/cli/check-tests.d.ts +143 -0
  36. package/dist/src/cli/check-tests.d.ts.map +1 -0
  37. package/dist/src/cli/check-tests.js +541 -0
  38. package/dist/src/cli/check-tests.js.map +1 -0
  39. package/dist/src/cli/coverage.d.ts +14 -0
  40. package/dist/src/cli/coverage.d.ts.map +1 -0
  41. package/dist/src/cli/coverage.js +97 -0
  42. package/dist/src/cli/coverage.js.map +1 -0
  43. package/dist/src/cli/doctor.d.ts +82 -0
  44. package/dist/src/cli/doctor.d.ts.map +1 -0
  45. package/dist/src/cli/doctor.js +656 -0
  46. package/dist/src/cli/doctor.js.map +1 -0
  47. package/dist/src/cli/env.d.ts +76 -0
  48. package/dist/src/cli/env.d.ts.map +1 -0
  49. package/dist/src/cli/env.js +344 -0
  50. package/dist/src/cli/env.js.map +1 -0
  51. package/dist/src/cli/failures.d.ts +29 -0
  52. package/dist/src/cli/failures.d.ts.map +1 -0
  53. package/dist/src/cli/failures.js +114 -0
  54. package/dist/src/cli/failures.js.map +1 -0
  55. package/dist/src/cli/fixture-catalog.d.ts +83 -0
  56. package/dist/src/cli/fixture-catalog.d.ts.map +1 -0
  57. package/dist/src/cli/fixture-catalog.js +773 -0
  58. package/dist/src/cli/fixture-catalog.js.map +1 -0
  59. package/dist/src/cli/fixture.d.ts +149 -0
  60. package/dist/src/cli/fixture.d.ts.map +1 -0
  61. package/dist/src/cli/fixture.js +742 -0
  62. package/dist/src/cli/fixture.js.map +1 -0
  63. package/dist/src/cli/flaky.d.ts +25 -0
  64. package/dist/src/cli/flaky.d.ts.map +1 -0
  65. package/dist/src/cli/flaky.js +96 -0
  66. package/dist/src/cli/flaky.js.map +1 -0
  67. package/dist/src/cli/generate.d.ts +37 -0
  68. package/dist/src/cli/generate.d.ts.map +1 -0
  69. package/dist/src/cli/generate.js +230 -0
  70. package/dist/src/cli/generate.js.map +1 -0
  71. package/dist/src/cli/init.d.ts +36 -0
  72. package/dist/src/cli/init.d.ts.map +1 -0
  73. package/dist/src/cli/init.js +1039 -0
  74. package/dist/src/cli/init.js.map +1 -0
  75. package/dist/src/cli/json-edit.d.ts +58 -0
  76. package/dist/src/cli/json-edit.d.ts.map +1 -0
  77. package/dist/src/cli/json-edit.js +250 -0
  78. package/dist/src/cli/json-edit.js.map +1 -0
  79. package/dist/src/cli/layout.d.ts +31 -0
  80. package/dist/src/cli/layout.d.ts.map +1 -0
  81. package/dist/src/cli/layout.js +175 -0
  82. package/dist/src/cli/layout.js.map +1 -0
  83. package/dist/src/cli/mcp-setup.d.ts +141 -0
  84. package/dist/src/cli/mcp-setup.d.ts.map +1 -0
  85. package/dist/src/cli/mcp-setup.js +548 -0
  86. package/dist/src/cli/mcp-setup.js.map +1 -0
  87. package/dist/src/cli/organize.d.ts +136 -0
  88. package/dist/src/cli/organize.d.ts.map +1 -0
  89. package/dist/src/cli/organize.js +467 -0
  90. package/dist/src/cli/organize.js.map +1 -0
  91. package/dist/src/cli/prompts.d.ts +102 -0
  92. package/dist/src/cli/prompts.d.ts.map +1 -0
  93. package/dist/src/cli/prompts.js +346 -0
  94. package/dist/src/cli/prompts.js.map +1 -0
  95. package/dist/src/cli/standards.d.ts +160 -0
  96. package/dist/src/cli/standards.d.ts.map +1 -0
  97. package/dist/src/cli/standards.js +389 -0
  98. package/dist/src/cli/standards.js.map +1 -0
  99. package/dist/src/cli/style.d.ts +28 -0
  100. package/dist/src/cli/style.d.ts.map +1 -0
  101. package/dist/src/cli/style.js +57 -0
  102. package/dist/src/cli/style.js.map +1 -0
  103. package/dist/src/config/env-loader.d.ts +33 -0
  104. package/dist/src/config/env-loader.d.ts.map +1 -0
  105. package/dist/src/config/env-loader.js +72 -0
  106. package/dist/src/config/env-loader.js.map +1 -0
  107. package/dist/src/config/index.d.ts +10 -0
  108. package/dist/src/config/index.d.ts.map +1 -0
  109. package/dist/src/config/index.js +10 -0
  110. package/dist/src/config/index.js.map +1 -0
  111. package/dist/src/config/loader.d.ts +66 -0
  112. package/dist/src/config/loader.d.ts.map +1 -0
  113. package/dist/src/config/loader.js +810 -0
  114. package/dist/src/config/loader.js.map +1 -0
  115. package/dist/src/config/schema.d.ts +596 -0
  116. package/dist/src/config/schema.d.ts.map +1 -0
  117. package/dist/src/config/schema.js +9 -0
  118. package/dist/src/config/schema.js.map +1 -0
  119. package/dist/src/containers/container-manager.d.ts +157 -0
  120. package/dist/src/containers/container-manager.d.ts.map +1 -0
  121. package/dist/src/containers/container-manager.js +627 -0
  122. package/dist/src/containers/container-manager.js.map +1 -0
  123. package/dist/src/coverage/code-coverage.d.ts +89 -0
  124. package/dist/src/coverage/code-coverage.d.ts.map +1 -0
  125. package/dist/src/coverage/code-coverage.js +395 -0
  126. package/dist/src/coverage/code-coverage.js.map +1 -0
  127. package/dist/src/coverage/inventory.d.ts +80 -0
  128. package/dist/src/coverage/inventory.d.ts.map +1 -0
  129. package/dist/src/coverage/inventory.js +417 -0
  130. package/dist/src/coverage/inventory.js.map +1 -0
  131. package/dist/src/coverage/languages.d.ts +34 -0
  132. package/dist/src/coverage/languages.d.ts.map +1 -0
  133. package/dist/src/coverage/languages.js +156 -0
  134. package/dist/src/coverage/languages.js.map +1 -0
  135. package/dist/src/coverage/report.d.ts +128 -0
  136. package/dist/src/coverage/report.d.ts.map +1 -0
  137. package/dist/src/coverage/report.js +472 -0
  138. package/dist/src/coverage/report.js.map +1 -0
  139. package/dist/src/errors.d.ts +164 -0
  140. package/dist/src/errors.d.ts.map +1 -0
  141. package/dist/src/errors.js +267 -0
  142. package/dist/src/errors.js.map +1 -0
  143. package/dist/src/fixtures/amqp.fixture.d.ts +163 -0
  144. package/dist/src/fixtures/amqp.fixture.d.ts.map +1 -0
  145. package/dist/src/fixtures/amqp.fixture.js +494 -0
  146. package/dist/src/fixtures/amqp.fixture.js.map +1 -0
  147. package/dist/src/fixtures/appium.fixture.d.ts +112 -0
  148. package/dist/src/fixtures/appium.fixture.d.ts.map +1 -0
  149. package/dist/src/fixtures/appium.fixture.js +309 -0
  150. package/dist/src/fixtures/appium.fixture.js.map +1 -0
  151. package/dist/src/fixtures/aws.d.ts +44 -0
  152. package/dist/src/fixtures/aws.d.ts.map +1 -0
  153. package/dist/src/fixtures/aws.js +93 -0
  154. package/dist/src/fixtures/aws.js.map +1 -0
  155. package/dist/src/fixtures/cassandra.fixture.d.ts +179 -0
  156. package/dist/src/fixtures/cassandra.fixture.d.ts.map +1 -0
  157. package/dist/src/fixtures/cassandra.fixture.js +489 -0
  158. package/dist/src/fixtures/cassandra.fixture.js.map +1 -0
  159. package/dist/src/fixtures/clickhouse.fixture.d.ts +171 -0
  160. package/dist/src/fixtures/clickhouse.fixture.d.ts.map +1 -0
  161. package/dist/src/fixtures/clickhouse.fixture.js +514 -0
  162. package/dist/src/fixtures/clickhouse.fixture.js.map +1 -0
  163. package/dist/src/fixtures/database.fixture.d.ts +63 -0
  164. package/dist/src/fixtures/database.fixture.d.ts.map +1 -0
  165. package/dist/src/fixtures/database.fixture.js +407 -0
  166. package/dist/src/fixtures/database.fixture.js.map +1 -0
  167. package/dist/src/fixtures/dynamodb.fixture.d.ts +243 -0
  168. package/dist/src/fixtures/dynamodb.fixture.d.ts.map +1 -0
  169. package/dist/src/fixtures/dynamodb.fixture.js +580 -0
  170. package/dist/src/fixtures/dynamodb.fixture.js.map +1 -0
  171. package/dist/src/fixtures/graphql.fixture.d.ts +107 -0
  172. package/dist/src/fixtures/graphql.fixture.d.ts.map +1 -0
  173. package/dist/src/fixtures/graphql.fixture.js +158 -0
  174. package/dist/src/fixtures/graphql.fixture.js.map +1 -0
  175. package/dist/src/fixtures/grpc.fixture.d.ts +167 -0
  176. package/dist/src/fixtures/grpc.fixture.d.ts.map +1 -0
  177. package/dist/src/fixtures/grpc.fixture.js +635 -0
  178. package/dist/src/fixtures/grpc.fixture.js.map +1 -0
  179. package/dist/src/fixtures/inbox.fixture.d.ts +136 -0
  180. package/dist/src/fixtures/inbox.fixture.d.ts.map +1 -0
  181. package/dist/src/fixtures/inbox.fixture.js +239 -0
  182. package/dist/src/fixtures/inbox.fixture.js.map +1 -0
  183. package/dist/src/fixtures/index.d.ts +174 -0
  184. package/dist/src/fixtures/index.d.ts.map +1 -0
  185. package/dist/src/fixtures/index.js +379 -0
  186. package/dist/src/fixtures/index.js.map +1 -0
  187. package/dist/src/fixtures/kafka-driver.d.ts +108 -0
  188. package/dist/src/fixtures/kafka-driver.d.ts.map +1 -0
  189. package/dist/src/fixtures/kafka-driver.js +113 -0
  190. package/dist/src/fixtures/kafka-driver.js.map +1 -0
  191. package/dist/src/fixtures/kafka.fixture.d.ts +75 -0
  192. package/dist/src/fixtures/kafka.fixture.d.ts.map +1 -0
  193. package/dist/src/fixtures/kafka.fixture.js +188 -0
  194. package/dist/src/fixtures/kafka.fixture.js.map +1 -0
  195. package/dist/src/fixtures/mock-server.fixture.d.ts +142 -0
  196. package/dist/src/fixtures/mock-server.fixture.d.ts.map +1 -0
  197. package/dist/src/fixtures/mock-server.fixture.js +271 -0
  198. package/dist/src/fixtures/mock-server.fixture.js.map +1 -0
  199. package/dist/src/fixtures/mongodb.fixture.d.ts +121 -0
  200. package/dist/src/fixtures/mongodb.fixture.d.ts.map +1 -0
  201. package/dist/src/fixtures/mongodb.fixture.js +258 -0
  202. package/dist/src/fixtures/mongodb.fixture.js.map +1 -0
  203. package/dist/src/fixtures/neo4j.fixture.d.ts +72 -0
  204. package/dist/src/fixtures/neo4j.fixture.d.ts.map +1 -0
  205. package/dist/src/fixtures/neo4j.fixture.js +202 -0
  206. package/dist/src/fixtures/neo4j.fixture.js.map +1 -0
  207. package/dist/src/fixtures/openapi.fixture.d.ts +101 -0
  208. package/dist/src/fixtures/openapi.fixture.d.ts.map +1 -0
  209. package/dist/src/fixtures/openapi.fixture.js +266 -0
  210. package/dist/src/fixtures/openapi.fixture.js.map +1 -0
  211. package/dist/src/fixtures/optional-package.d.ts +54 -0
  212. package/dist/src/fixtures/optional-package.d.ts.map +1 -0
  213. package/dist/src/fixtures/optional-package.js +79 -0
  214. package/dist/src/fixtures/optional-package.js.map +1 -0
  215. package/dist/src/fixtures/otp.fixture.d.ts +60 -0
  216. package/dist/src/fixtures/otp.fixture.d.ts.map +1 -0
  217. package/dist/src/fixtures/otp.fixture.js +101 -0
  218. package/dist/src/fixtures/otp.fixture.js.map +1 -0
  219. package/dist/src/fixtures/realtime.fixture.d.ts +205 -0
  220. package/dist/src/fixtures/realtime.fixture.d.ts.map +1 -0
  221. package/dist/src/fixtures/realtime.fixture.js +606 -0
  222. package/dist/src/fixtures/realtime.fixture.js.map +1 -0
  223. package/dist/src/fixtures/redis.fixture.d.ts +55 -0
  224. package/dist/src/fixtures/redis.fixture.d.ts.map +1 -0
  225. package/dist/src/fixtures/redis.fixture.js +209 -0
  226. package/dist/src/fixtures/redis.fixture.js.map +1 -0
  227. package/dist/src/fixtures/s3.fixture.d.ts +126 -0
  228. package/dist/src/fixtures/s3.fixture.d.ts.map +1 -0
  229. package/dist/src/fixtures/s3.fixture.js +296 -0
  230. package/dist/src/fixtures/s3.fixture.js.map +1 -0
  231. package/dist/src/fixtures/search.fixture.d.ts +178 -0
  232. package/dist/src/fixtures/search.fixture.d.ts.map +1 -0
  233. package/dist/src/fixtures/search.fixture.js +472 -0
  234. package/dist/src/fixtures/search.fixture.js.map +1 -0
  235. package/dist/src/fixtures/sqs.fixture.d.ts +172 -0
  236. package/dist/src/fixtures/sqs.fixture.d.ts.map +1 -0
  237. package/dist/src/fixtures/sqs.fixture.js +428 -0
  238. package/dist/src/fixtures/sqs.fixture.js.map +1 -0
  239. package/dist/src/index.d.ts +43 -0
  240. package/dist/src/index.d.ts.map +1 -0
  241. package/dist/src/index.js +48 -0
  242. package/dist/src/index.js.map +1 -0
  243. package/dist/src/mcp/guards.d.ts +21 -0
  244. package/dist/src/mcp/guards.d.ts.map +1 -0
  245. package/dist/src/mcp/guards.js +118 -0
  246. package/dist/src/mcp/guards.js.map +1 -0
  247. package/dist/src/mcp/project-tools.d.ts +14 -0
  248. package/dist/src/mcp/project-tools.d.ts.map +1 -0
  249. package/dist/src/mcp/project-tools.js +252 -0
  250. package/dist/src/mcp/project-tools.js.map +1 -0
  251. package/dist/src/mcp/protocol.d.ts +116 -0
  252. package/dist/src/mcp/protocol.d.ts.map +1 -0
  253. package/dist/src/mcp/protocol.js +199 -0
  254. package/dist/src/mcp/protocol.js.map +1 -0
  255. package/dist/src/mcp/server.d.ts +43 -0
  256. package/dist/src/mcp/server.d.ts.map +1 -0
  257. package/dist/src/mcp/server.js +244 -0
  258. package/dist/src/mcp/server.js.map +1 -0
  259. package/dist/src/mcp/test-tools.d.ts +65 -0
  260. package/dist/src/mcp/test-tools.d.ts.map +1 -0
  261. package/dist/src/mcp/test-tools.js +380 -0
  262. package/dist/src/mcp/test-tools.js.map +1 -0
  263. package/dist/src/mcp/tools.d.ts +49 -0
  264. package/dist/src/mcp/tools.d.ts.map +1 -0
  265. package/dist/src/mcp/tools.js +726 -0
  266. package/dist/src/mcp/tools.js.map +1 -0
  267. package/dist/src/network-error.d.ts +11 -0
  268. package/dist/src/network-error.d.ts.map +1 -0
  269. package/dist/src/network-error.js +34 -0
  270. package/dist/src/network-error.js.map +1 -0
  271. package/dist/src/openapi/contract.d.ts +98 -0
  272. package/dist/src/openapi/contract.d.ts.map +1 -0
  273. package/dist/src/openapi/contract.js +407 -0
  274. package/dist/src/openapi/contract.js.map +1 -0
  275. package/dist/src/openapi/generate.d.ts +89 -0
  276. package/dist/src/openapi/generate.d.ts.map +1 -0
  277. package/dist/src/openapi/generate.js +607 -0
  278. package/dist/src/openapi/generate.js.map +1 -0
  279. package/dist/src/openapi/load.d.ts +8 -0
  280. package/dist/src/openapi/load.d.ts.map +1 -0
  281. package/dist/src/openapi/load.js +26 -0
  282. package/dist/src/openapi/load.js.map +1 -0
  283. package/dist/src/package-manager.d.ts +58 -0
  284. package/dist/src/package-manager.d.ts.map +1 -0
  285. package/dist/src/package-manager.js +137 -0
  286. package/dist/src/package-manager.js.map +1 -0
  287. package/dist/src/reporter/history.d.ts +85 -0
  288. package/dist/src/reporter/history.d.ts.map +1 -0
  289. package/dist/src/reporter/history.js +147 -0
  290. package/dist/src/reporter/history.js.map +1 -0
  291. package/dist/src/reporter/index.d.ts +59 -0
  292. package/dist/src/reporter/index.d.ts.map +1 -0
  293. package/dist/src/reporter/index.js +201 -0
  294. package/dist/src/reporter/index.js.map +1 -0
  295. package/dist/src/reporter/last-run.d.ts +88 -0
  296. package/dist/src/reporter/last-run.d.ts.map +1 -0
  297. package/dist/src/reporter/last-run.js +133 -0
  298. package/dist/src/reporter/last-run.js.map +1 -0
  299. package/dist/src/reporter/quarantine.d.ts +62 -0
  300. package/dist/src/reporter/quarantine.d.ts.map +1 -0
  301. package/dist/src/reporter/quarantine.js +148 -0
  302. package/dist/src/reporter/quarantine.js.map +1 -0
  303. package/dist/src/secrets/index.d.ts +4 -0
  304. package/dist/src/secrets/index.d.ts.map +1 -0
  305. package/dist/src/secrets/index.js +3 -0
  306. package/dist/src/secrets/index.js.map +1 -0
  307. package/dist/src/secrets/provider.interface.d.ts +30 -0
  308. package/dist/src/secrets/provider.interface.d.ts.map +1 -0
  309. package/dist/src/secrets/provider.interface.js +2 -0
  310. package/dist/src/secrets/provider.interface.js.map +1 -0
  311. package/dist/src/secrets/providers/aws.provider.d.ts +33 -0
  312. package/dist/src/secrets/providers/aws.provider.d.ts.map +1 -0
  313. package/dist/src/secrets/providers/aws.provider.js +88 -0
  314. package/dist/src/secrets/providers/aws.provider.js.map +1 -0
  315. package/dist/src/secrets/providers/azure.provider.d.ts +26 -0
  316. package/dist/src/secrets/providers/azure.provider.d.ts.map +1 -0
  317. package/dist/src/secrets/providers/azure.provider.js +71 -0
  318. package/dist/src/secrets/providers/azure.provider.js.map +1 -0
  319. package/dist/src/secrets/providers/env-file.provider.d.ts +29 -0
  320. package/dist/src/secrets/providers/env-file.provider.d.ts.map +1 -0
  321. package/dist/src/secrets/providers/env-file.provider.js +56 -0
  322. package/dist/src/secrets/providers/env-file.provider.js.map +1 -0
  323. package/dist/src/secrets/providers/gitlab.provider.d.ts +26 -0
  324. package/dist/src/secrets/providers/gitlab.provider.d.ts.map +1 -0
  325. package/dist/src/secrets/providers/gitlab.provider.js +67 -0
  326. package/dist/src/secrets/providers/gitlab.provider.js.map +1 -0
  327. package/dist/src/secrets/providers/index.d.ts +52 -0
  328. package/dist/src/secrets/providers/index.d.ts.map +1 -0
  329. package/dist/src/secrets/providers/index.js +81 -0
  330. package/dist/src/secrets/providers/index.js.map +1 -0
  331. package/dist/src/secrets/providers/openbao.provider.d.ts +28 -0
  332. package/dist/src/secrets/providers/openbao.provider.d.ts.map +1 -0
  333. package/dist/src/secrets/providers/openbao.provider.js +29 -0
  334. package/dist/src/secrets/providers/openbao.provider.js.map +1 -0
  335. package/dist/src/secrets/providers/vault-compatible.d.ts +140 -0
  336. package/dist/src/secrets/providers/vault-compatible.d.ts.map +1 -0
  337. package/dist/src/secrets/providers/vault-compatible.js +405 -0
  338. package/dist/src/secrets/providers/vault-compatible.js.map +1 -0
  339. package/dist/src/secrets/providers/vault.provider.d.ts +27 -0
  340. package/dist/src/secrets/providers/vault.provider.d.ts.map +1 -0
  341. package/dist/src/secrets/providers/vault.provider.js +23 -0
  342. package/dist/src/secrets/providers/vault.provider.js.map +1 -0
  343. package/dist/src/secrets/secrets-manager.d.ts +67 -0
  344. package/dist/src/secrets/secrets-manager.d.ts.map +1 -0
  345. package/dist/src/secrets/secrets-manager.js +255 -0
  346. package/dist/src/secrets/secrets-manager.js.map +1 -0
  347. package/dist/src/steps/amqp.steps.d.ts +37 -0
  348. package/dist/src/steps/amqp.steps.d.ts.map +1 -0
  349. package/dist/src/steps/amqp.steps.js +86 -0
  350. package/dist/src/steps/amqp.steps.js.map +1 -0
  351. package/dist/src/steps/appium.steps.d.ts +53 -0
  352. package/dist/src/steps/appium.steps.d.ts.map +1 -0
  353. package/dist/src/steps/appium.steps.js +109 -0
  354. package/dist/src/steps/appium.steps.js.map +1 -0
  355. package/dist/src/steps/aws.steps.d.ts +47 -0
  356. package/dist/src/steps/aws.steps.d.ts.map +1 -0
  357. package/dist/src/steps/aws.steps.js +116 -0
  358. package/dist/src/steps/aws.steps.js.map +1 -0
  359. package/dist/src/steps/browser.steps.d.ts +54 -0
  360. package/dist/src/steps/browser.steps.d.ts.map +1 -0
  361. package/dist/src/steps/browser.steps.js +102 -0
  362. package/dist/src/steps/browser.steps.js.map +1 -0
  363. package/dist/src/steps/cassandra.steps.d.ts +32 -0
  364. package/dist/src/steps/cassandra.steps.d.ts.map +1 -0
  365. package/dist/src/steps/cassandra.steps.js +81 -0
  366. package/dist/src/steps/cassandra.steps.js.map +1 -0
  367. package/dist/src/steps/clickhouse.steps.d.ts +30 -0
  368. package/dist/src/steps/clickhouse.steps.d.ts.map +1 -0
  369. package/dist/src/steps/clickhouse.steps.js +73 -0
  370. package/dist/src/steps/clickhouse.steps.js.map +1 -0
  371. package/dist/src/steps/database.steps.d.ts +43 -0
  372. package/dist/src/steps/database.steps.d.ts.map +1 -0
  373. package/dist/src/steps/database.steps.js +79 -0
  374. package/dist/src/steps/database.steps.js.map +1 -0
  375. package/dist/src/steps/dynamodb.steps.d.ts +32 -0
  376. package/dist/src/steps/dynamodb.steps.d.ts.map +1 -0
  377. package/dist/src/steps/dynamodb.steps.js +89 -0
  378. package/dist/src/steps/dynamodb.steps.js.map +1 -0
  379. package/dist/src/steps/graphql.steps.d.ts +60 -0
  380. package/dist/src/steps/graphql.steps.d.ts.map +1 -0
  381. package/dist/src/steps/graphql.steps.js +76 -0
  382. package/dist/src/steps/graphql.steps.js.map +1 -0
  383. package/dist/src/steps/grpc.steps.d.ts +29 -0
  384. package/dist/src/steps/grpc.steps.d.ts.map +1 -0
  385. package/dist/src/steps/grpc.steps.js +68 -0
  386. package/dist/src/steps/grpc.steps.js.map +1 -0
  387. package/dist/src/steps/inbox.steps.d.ts +30 -0
  388. package/dist/src/steps/inbox.steps.d.ts.map +1 -0
  389. package/dist/src/steps/inbox.steps.js +72 -0
  390. package/dist/src/steps/inbox.steps.js.map +1 -0
  391. package/dist/src/steps/index.d.ts +43 -0
  392. package/dist/src/steps/index.d.ts.map +1 -0
  393. package/dist/src/steps/index.js +26 -0
  394. package/dist/src/steps/index.js.map +1 -0
  395. package/dist/src/steps/kafka.steps.d.ts +56 -0
  396. package/dist/src/steps/kafka.steps.d.ts.map +1 -0
  397. package/dist/src/steps/kafka.steps.js +61 -0
  398. package/dist/src/steps/kafka.steps.js.map +1 -0
  399. package/dist/src/steps/mock-server.steps.d.ts +21 -0
  400. package/dist/src/steps/mock-server.steps.d.ts.map +1 -0
  401. package/dist/src/steps/mock-server.steps.js +45 -0
  402. package/dist/src/steps/mock-server.steps.js.map +1 -0
  403. package/dist/src/steps/mongodb.steps.d.ts +107 -0
  404. package/dist/src/steps/mongodb.steps.d.ts.map +1 -0
  405. package/dist/src/steps/mongodb.steps.js +117 -0
  406. package/dist/src/steps/mongodb.steps.js.map +1 -0
  407. package/dist/src/steps/openapi.steps.d.ts +49 -0
  408. package/dist/src/steps/openapi.steps.d.ts.map +1 -0
  409. package/dist/src/steps/openapi.steps.js +113 -0
  410. package/dist/src/steps/openapi.steps.js.map +1 -0
  411. package/dist/src/steps/otp.steps.d.ts +43 -0
  412. package/dist/src/steps/otp.steps.d.ts.map +1 -0
  413. package/dist/src/steps/otp.steps.js +83 -0
  414. package/dist/src/steps/otp.steps.js.map +1 -0
  415. package/dist/src/steps/realtime.steps.d.ts +40 -0
  416. package/dist/src/steps/realtime.steps.d.ts.map +1 -0
  417. package/dist/src/steps/realtime.steps.js +116 -0
  418. package/dist/src/steps/realtime.steps.js.map +1 -0
  419. package/dist/src/steps/redis.steps.d.ts +54 -0
  420. package/dist/src/steps/redis.steps.d.ts.map +1 -0
  421. package/dist/src/steps/redis.steps.js +89 -0
  422. package/dist/src/steps/redis.steps.js.map +1 -0
  423. package/dist/src/steps/search.steps.d.ts +23 -0
  424. package/dist/src/steps/search.steps.d.ts.map +1 -0
  425. package/dist/src/steps/search.steps.js +54 -0
  426. package/dist/src/steps/search.steps.js.map +1 -0
  427. package/dist/src/test-data/factory.d.ts +82 -0
  428. package/dist/src/test-data/factory.d.ts.map +1 -0
  429. package/dist/src/test-data/factory.js +116 -0
  430. package/dist/src/test-data/factory.js.map +1 -0
  431. package/dist/src/test-data/index.d.ts +4 -0
  432. package/dist/src/test-data/index.d.ts.map +1 -0
  433. package/dist/src/test-data/index.js +4 -0
  434. package/dist/src/test-data/index.js.map +1 -0
  435. package/dist/src/test-data/registry.d.ts +37 -0
  436. package/dist/src/test-data/registry.d.ts.map +1 -0
  437. package/dist/src/test-data/registry.js +51 -0
  438. package/dist/src/test-data/registry.js.map +1 -0
  439. package/dist/src/test-data/tracking.d.ts +47 -0
  440. package/dist/src/test-data/tracking.d.ts.map +1 -0
  441. package/dist/src/test-data/tracking.js +166 -0
  442. package/dist/src/test-data/tracking.js.map +1 -0
  443. package/environments.json +263 -0
  444. package/package.json +299 -5
@@ -0,0 +1,627 @@
1
+ /**
2
+ * Testcontainers integration: starts a backend in a throwaway Docker container
3
+ * from the test run, so integration tests need no service started outside
4
+ * Playwright — the same command works on a laptop and on any CI agent with Docker.
5
+ *
6
+ * Opt in per backend with `container: true` (or options) in the fixture config,
7
+ * or `PW_<BACKEND>_CONTAINER=true`. One ContainerManager lives per Playwright
8
+ * worker (the `stagehandContainers` worker fixture): each container starts the
9
+ * first time a test in that worker needs it, is shared by the worker's later
10
+ * tests, and stops when the worker exits. Images, credentials and health checks
11
+ * match `compose.test.yaml` and Stagehand's CI.
12
+ *
13
+ * `testcontainers` is an optional peer dependency, loaded on first use.
14
+ */
15
+ import { existsSync } from 'node:fs';
16
+ import { createServer } from 'node:net';
17
+ import { basename, resolve } from 'node:path';
18
+ import { FixtureInitError } from '../errors.js';
19
+ import { loadOptional } from '../fixtures/optional-package.js';
20
+ /** Default image per backend — the same ones as compose.test.yaml and CI. */
21
+ export const DEFAULT_IMAGES = {
22
+ postgresql: 'postgres:15',
23
+ mysql: 'mysql:8.0',
24
+ mssql: 'mcr.microsoft.com/mssql/server:2022-latest',
25
+ redis: 'redis:7',
26
+ mongodb: 'mongo:7',
27
+ neo4j: 'neo4j:5',
28
+ kafka: 'apache/kafka:latest',
29
+ rabbitmq: 'rabbitmq:4',
30
+ moto: 'motoserver/moto:5.2.5',
31
+ elasticsearch: 'elasticsearch:9.5.5',
32
+ opensearch: 'opensearchproject/opensearch:3.10.0',
33
+ mailpit: 'axllent/mailpit:latest',
34
+ wiremock: 'wiremock/wiremock:3.13.2',
35
+ scylla: 'scylladb/scylla:2026.3.6',
36
+ clickhouse: 'clickhouse/clickhouse-server:26.10',
37
+ };
38
+ /** Throwaway credentials used when the config doesn't set its own. */
39
+ export const DEFAULT_CREDENTIALS = {
40
+ database: 'testdb',
41
+ username: 'testuser',
42
+ password: 'testpass',
43
+ mssqlPassword: 'TestPass123!',
44
+ neo4jPassword: 'testpassword',
45
+ };
46
+ const SLOW = new Set(['mssql', 'neo4j', 'elasticsearch', 'opensearch', 'scylla']);
47
+ const SQLCMD = '/opt/mssql-tools18/bin/sqlcmd';
48
+ /** `true` → {}, options → options, false/undefined → null. */
49
+ export function containerOptions(setting) {
50
+ if (!setting)
51
+ return null;
52
+ return setting === true ? {} : setting;
53
+ }
54
+ /** Parses a `PW_*_CONTAINER` value: `true`/`1`/`yes` → true, `false`/`0`/`no`/empty → false, anything else → an image name. */
55
+ export function parseContainerEnv(value) {
56
+ const v = value.trim();
57
+ if (/^(true|1|yes|on)$/i.test(v))
58
+ return true;
59
+ if (!v || /^(false|0|no|off)$/i.test(v))
60
+ return false;
61
+ return { image: v };
62
+ }
63
+ function baseSpec(kind, fixture, options) {
64
+ return {
65
+ kind,
66
+ fixture,
67
+ image: options.image ?? DEFAULT_IMAGES[kind],
68
+ startupTimeoutMs: (options.startupTimeout ?? (SLOW.has(kind) ? 120 : 60)) * 1000,
69
+ reuse: options.reuse ?? false,
70
+ };
71
+ }
72
+ const quote = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
73
+ /**
74
+ * SQL Server's password policy: at least 8 characters from at least three of
75
+ * upper case, lower case, digits and symbols. A weaker `sa` password makes the
76
+ * server exit at start-up, which otherwise only shows up as a failed health check.
77
+ */
78
+ export function meetsMssqlPasswordPolicy(password) {
79
+ const classes = [/[A-Z]/, /[a-z]/, /[0-9]/, /[^A-Za-z0-9]/].filter((re) => re.test(password)).length;
80
+ return password.length >= 8 && classes >= 3;
81
+ }
82
+ /** Init scripts copied into an image's /docker-entrypoint-initdb.d, prefixed to keep their order. */
83
+ function initDbFiles(scripts, dir = '/docker-entrypoint-initdb.d') {
84
+ return (scripts ?? []).map((s, i) => [resolve(s), `${dir}/${String(i + 1).padStart(2, '0')}-${basename(s)}`]);
85
+ }
86
+ // ─── Specs per backend (pure) ───────────────────────────────────────────────
87
+ export function databaseSpec(config, options) {
88
+ const fixture = 'databaseClient';
89
+ switch (config.type) {
90
+ case 'postgresql': {
91
+ const database = config.database || DEFAULT_CREDENTIALS.database;
92
+ const username = config.username ?? DEFAULT_CREDENTIALS.username;
93
+ const password = config.password ?? DEFAULT_CREDENTIALS.password;
94
+ return {
95
+ spec: {
96
+ ...baseSpec('postgresql', fixture, options),
97
+ env: { POSTGRES_DB: database, POSTGRES_USER: username, POSTGRES_PASSWORD: password },
98
+ port: 5432,
99
+ // -h: during init scripts the server only listens on its socket, so TCP readiness means init is done.
100
+ healthCheck: `pg_isready -h 127.0.0.1 -U ${quote(username)} -d ${quote(database)}`,
101
+ files: initDbFiles(options.initScripts),
102
+ },
103
+ resolved: { ...config, database, username, password },
104
+ };
105
+ }
106
+ case 'mysql': {
107
+ const database = config.database || DEFAULT_CREDENTIALS.database;
108
+ const username = config.username ?? DEFAULT_CREDENTIALS.username;
109
+ const password = config.password ?? DEFAULT_CREDENTIALS.password;
110
+ const env = username === 'root'
111
+ ? { MYSQL_DATABASE: database, MYSQL_ROOT_PASSWORD: password }
112
+ : { MYSQL_DATABASE: database, MYSQL_USER: username, MYSQL_PASSWORD: password, MYSQL_ROOT_PASSWORD: password };
113
+ return {
114
+ spec: {
115
+ ...baseSpec('mysql', fixture, options),
116
+ env,
117
+ port: 3306,
118
+ // During init the server runs with networking off, so a TCP ping means init is done.
119
+ healthCheck: 'mysqladmin ping -h 127.0.0.1 --silent',
120
+ files: initDbFiles(options.initScripts),
121
+ },
122
+ resolved: { ...config, database, username, password },
123
+ };
124
+ }
125
+ case 'mssql': {
126
+ const password = config.password ?? DEFAULT_CREDENTIALS.mssqlPassword;
127
+ if (!meetsMssqlPasswordPolicy(password)) {
128
+ throw new FixtureInitError(fixture, 'boot', {
129
+ reason: 'the configured database password is too weak for the SQL Server container (it needs 8+ characters ' +
130
+ 'from three of: upper case, lower case, digits, symbols). Set a stronger PW_DB_PASSWORD, or remove ' +
131
+ `the password from this environment's config to use the default ("${DEFAULT_CREDENTIALS.mssqlPassword}").`,
132
+ });
133
+ }
134
+ return {
135
+ spec: {
136
+ ...baseSpec('mssql', fixture, options),
137
+ env: { ACCEPT_EULA: 'Y', MSSQL_SA_PASSWORD: password },
138
+ port: 1433,
139
+ healthCheck: `${SQLCMD} -S localhost -U sa -P ${quote(password)} -C -Q 'SELECT 1'`,
140
+ files: initDbFiles(options.initScripts, '/stagehand-init'),
141
+ },
142
+ // The container only has the `sa` login; the database is created after start if needed.
143
+ resolved: {
144
+ ...config,
145
+ database: config.database || 'master',
146
+ username: 'sa',
147
+ password,
148
+ encrypt: false,
149
+ trustServerCertificate: true,
150
+ },
151
+ };
152
+ }
153
+ default:
154
+ throw new FixtureInitError(fixture, 'boot', {
155
+ reason: `container is not supported for database type "${config.type}"; SQLite needs no server, so remove the container option`,
156
+ });
157
+ }
158
+ }
159
+ export function redisSpec(config, options) {
160
+ const auth = config.password ? `-a ${quote(config.password)} --no-auth-warning ` : '';
161
+ return {
162
+ ...baseSpec('redis', 'redisClient', options),
163
+ env: {},
164
+ port: 6379,
165
+ command: config.password ? ['redis-server', '--requirepass', config.password] : undefined,
166
+ healthCheck: `redis-cli ${auth}ping | grep -q PONG`,
167
+ };
168
+ }
169
+ export function mongoDbSpec(config, options) {
170
+ const env = {};
171
+ if (config.username) {
172
+ env.MONGO_INITDB_ROOT_USERNAME = config.username;
173
+ env.MONGO_INITDB_ROOT_PASSWORD = config.password ?? DEFAULT_CREDENTIALS.password;
174
+ }
175
+ return {
176
+ ...baseSpec('mongodb', 'mongoDbClient', options),
177
+ env,
178
+ port: 27017,
179
+ healthCheck: `mongosh --quiet --eval 'db.runCommand({ ping: 1 }).ok' | grep -q 1`,
180
+ };
181
+ }
182
+ /**
183
+ * Neo4j is ready when its HTTP interface answers: it opens last, after Bolt and
184
+ * the databases. Not `cypher-shell`: that starts a JVM per check, which takes
185
+ * over the 5 s check timeout on a busy CI runner, so the container never turns
186
+ * healthy. The image has no curl or wget, but it has Perl.
187
+ */
188
+ const NEO4J_HEALTH_CHECK = `perl -MIO::Socket::INET -e '$s = IO::Socket::INET->new(PeerAddr => "127.0.0.1:7474", Timeout => 2) or exit 1; print $s "GET / HTTP/1.0\\r\\n\\r\\n"; exit((<$s> // "") =~ m{^HTTP/\\S+ 200} ? 0 : 1)'`;
189
+ export function neo4jSpec(config, options) {
190
+ const password = config.password || DEFAULT_CREDENTIALS.neo4jPassword;
191
+ if (password.length < 8) {
192
+ throw new FixtureInitError('neo4jClient', 'boot', { reason: 'the Neo4j image needs a password of at least 8 characters' });
193
+ }
194
+ return {
195
+ spec: {
196
+ ...baseSpec('neo4j', 'neo4jClient', options),
197
+ env: { NEO4J_AUTH: `neo4j/${password}` },
198
+ port: 7687,
199
+ healthCheck: NEO4J_HEALTH_CHECK,
200
+ },
201
+ password,
202
+ };
203
+ }
204
+ /** Kafka advertises host:hostPort to clients, so the host port must be known before start. */
205
+ export function kafkaSpec(options, host, hostPort) {
206
+ return {
207
+ ...baseSpec('kafka', 'kafkaClient', options),
208
+ reuse: false, // the host port changes every run, so a reused broker would advertise a stale address
209
+ env: {
210
+ KAFKA_NODE_ID: '1',
211
+ KAFKA_PROCESS_ROLES: 'broker,controller',
212
+ // INTERNAL for the health check inside the container, HOST for the tests.
213
+ KAFKA_LISTENERS: 'INTERNAL://0.0.0.0:19092,HOST://0.0.0.0:9092,CONTROLLER://0.0.0.0:9093',
214
+ KAFKA_ADVERTISED_LISTENERS: `INTERNAL://localhost:19092,HOST://${host}:${hostPort}`,
215
+ KAFKA_INTER_BROKER_LISTENER_NAME: 'INTERNAL',
216
+ KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER',
217
+ KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'INTERNAL:PLAINTEXT,HOST:PLAINTEXT,CONTROLLER:PLAINTEXT',
218
+ KAFKA_CONTROLLER_QUORUM_VOTERS: '1@localhost:9093',
219
+ KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true',
220
+ KAFKA_NUM_PARTITIONS: '1',
221
+ KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: '1',
222
+ CLUSTER_ID: 'MkU3OEVBNTcwNTJENDM2Qk',
223
+ },
224
+ port: 9092,
225
+ hostPort,
226
+ healthCheck: '/opt/kafka/bin/kafka-broker-api-versions.sh --bootstrap-server localhost:19092 > /dev/null',
227
+ };
228
+ }
229
+ /**
230
+ * RabbitMQ is ready when its AMQP listener answers the protocol header with a
231
+ * frame (first byte 1); the listener opens after `rabbitmq-diagnostics ping`
232
+ * already passes. Not the Erlang CLI: run as root before the broker has made
233
+ * its Erlang cookie, it makes the cookie itself, owned by root, and the broker
234
+ * crashes on `eacces`. With a 1 s interval on a busy CI runner, it got there first.
235
+ */
236
+ const RABBITMQ_HEALTH_CHECK = `bash -c 'exec 3<>/dev/tcp/127.0.0.1/5672 && printf "AMQP\\0\\0\\11\\1" >&3 && [ "$(head -c 1 <&3 | od -An -tx1)" = " 01" ]'`;
237
+ /**
238
+ * RabbitMQ: the image's default `guest` user may only connect from inside the
239
+ * container, so the broker gets the config's credentials (or throwaway ones).
240
+ */
241
+ export function rabbitMqSpec(config, options) {
242
+ const username = config.username || DEFAULT_CREDENTIALS.username;
243
+ const password = config.password || DEFAULT_CREDENTIALS.password;
244
+ const vhost = config.vhost || '/';
245
+ return {
246
+ spec: {
247
+ ...baseSpec('rabbitmq', 'amqpClient', options),
248
+ env: { RABBITMQ_DEFAULT_USER: username, RABBITMQ_DEFAULT_PASS: password, RABBITMQ_DEFAULT_VHOST: vhost },
249
+ port: 5672,
250
+ healthCheck: RABBITMQ_HEALTH_CHECK,
251
+ },
252
+ username,
253
+ password,
254
+ vhost,
255
+ };
256
+ }
257
+ /**
258
+ * Moto: one endpoint for S3, SQS, SNS and the rest of AWS. (LocalStack's
259
+ * image needs an auth token since 2026, so the container uses Moto.)
260
+ */
261
+ /**
262
+ * ScyllaDB by default, or Cassandra when the image is a Cassandra one
263
+ * (`PW_CASSANDRA_CONTAINER=cassandra:5`). Both speak CQL on 9042; ScyllaDB is
264
+ * ready in seconds rather than a minute. One CPU and little memory for each.
265
+ */
266
+ export function cassandraSpec(options) {
267
+ const base = baseSpec('scylla', 'cassandraClient', options);
268
+ const cassandra = /(^|\/)cassandra(:|$)/.test(base.image);
269
+ return {
270
+ ...base,
271
+ env: cassandra ? { MAX_HEAP_SIZE: '512M', HEAP_NEWSIZE: '128M', CASSANDRA_DC: 'datacenter1' } : {},
272
+ port: 9042,
273
+ healthCheck: "cqlsh -e 'SELECT now() FROM system.local' > /dev/null",
274
+ ...(cassandra ? {} : { command: ['--smp', '1', '--memory', '750M', '--overprovisioned', '1', '--developer-mode', '1'] }),
275
+ };
276
+ }
277
+ /**
278
+ * ClickHouse over HTTP (8123), with the config's credentials (or throwaway
279
+ * ones). No CLICKHOUSE_DB: the fixture creates the database, and without it
280
+ * the image skips its init server, which listens on 127.0.0.1 and would pass
281
+ * the health check before the real server is up.
282
+ */
283
+ export function clickHouseSpec(config, options) {
284
+ const username = config.username && config.username !== 'default' ? config.username : DEFAULT_CREDENTIALS.username;
285
+ const password = config.password || DEFAULT_CREDENTIALS.password;
286
+ return {
287
+ spec: {
288
+ ...baseSpec('clickhouse', 'clickHouseClient', options),
289
+ env: { CLICKHOUSE_USER: username, CLICKHOUSE_PASSWORD: password, CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: '1' },
290
+ port: 8123,
291
+ healthCheck: 'wget -qO- http://127.0.0.1:8123/ping > /dev/null',
292
+ },
293
+ username,
294
+ password,
295
+ };
296
+ }
297
+ export function motoSpec(options) {
298
+ return {
299
+ ...baseSpec('moto', 's3Client / sqsClient / dynamoDbClient', options),
300
+ env: {},
301
+ port: 5000,
302
+ healthCheck: 'curl -fs http://localhost:5000/moto-api/ > /dev/null',
303
+ };
304
+ }
305
+ /**
306
+ * Elasticsearch or OpenSearch, single node with security off (plain HTTP, no
307
+ * password). An image whose name contains `opensearch` starts OpenSearch; the
308
+ * bare names `elasticsearch` and `opensearch` pick the default image of each.
309
+ */
310
+ export function searchSpec(options) {
311
+ const named = options.image === 'opensearch' || options.image === 'elasticsearch' ? options.image : undefined;
312
+ const kind = named ?? (options.image && /opensearch/i.test(options.image) ? 'opensearch' : 'elasticsearch');
313
+ const common = {
314
+ 'discovery.type': 'single-node',
315
+ // Disk watermarks would turn indices read-only on a full CI disk.
316
+ 'cluster.routing.allocation.disk.threshold_enabled': 'false',
317
+ };
318
+ return {
319
+ ...baseSpec(kind, 'searchClient', { ...options, image: named ? undefined : options.image }),
320
+ env: kind === 'opensearch'
321
+ ? { ...common, DISABLE_SECURITY_PLUGIN: 'true', DISABLE_INSTALL_DEMO_CONFIG: 'true', OPENSEARCH_JAVA_OPTS: '-Xms512m -Xmx512m' }
322
+ : { ...common, 'xpack.security.enabled': 'false', ES_JAVA_OPTS: '-Xms512m -Xmx512m' },
323
+ port: 9200,
324
+ healthCheck: "curl -fs 'http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=1s' > /dev/null",
325
+ };
326
+ }
327
+ /** Mailpit: the API/UI on 8025 for the fixture, SMTP on 1025 for the app under test. */
328
+ export function mailpitSpec(options) {
329
+ return {
330
+ ...baseSpec('mailpit', 'inboxClient', options),
331
+ env: {},
332
+ port: 8025,
333
+ extraPorts: [1025],
334
+ healthCheck: '/mailpit readyz',
335
+ };
336
+ }
337
+ /** WireMock: stubs and the admin API on one port. */
338
+ export function wiremockSpec(options) {
339
+ return {
340
+ ...baseSpec('wiremock', 'mockServer', options),
341
+ env: {},
342
+ port: 8080,
343
+ healthCheck: 'curl -fs http://localhost:8080/__admin/health > /dev/null',
344
+ };
345
+ }
346
+ /** A free TCP port on this machine. */
347
+ export function freePort() {
348
+ return new Promise((resolvePort, reject) => {
349
+ const server = createServer();
350
+ server.unref();
351
+ server.on('error', reject);
352
+ server.listen(0, () => {
353
+ const address = server.address();
354
+ const port = typeof address === 'object' && address ? address.port : 0;
355
+ server.close(() => resolvePort(port));
356
+ });
357
+ });
358
+ }
359
+ // ─── Manager ────────────────────────────────────────────────────────────────
360
+ /** Extra test time allowed while a container without its own startup timeout starts. */
361
+ const DEFAULT_STARTUP_BUDGET_MS = 180_000;
362
+ /** On top of the startup timeout: pulling the image isn't part of it. */
363
+ const IMAGE_PULL_BUDGET_MS = 120_000;
364
+ /**
365
+ * Waits for a container start without spending the test's own timeout on it.
366
+ * The container starts during the first test that needs it, so that test's
367
+ * timeout is extended by the startup timeout first, then set back to its
368
+ * original value plus the time the start actually took. Outside a test (no
369
+ * `test.info()`) it just waits.
370
+ */
371
+ export async function withStartupBudget(pending, budgetMs) {
372
+ let info;
373
+ try {
374
+ const { test } = await import('@playwright/test');
375
+ info = test.info();
376
+ }
377
+ catch {
378
+ return pending;
379
+ }
380
+ const original = info.timeout;
381
+ if (!original)
382
+ return pending; // timeouts disabled
383
+ const t0 = Date.now();
384
+ info.setTimeout(original + budgetMs + IMAGE_PULL_BUDGET_MS);
385
+ try {
386
+ return await pending;
387
+ }
388
+ finally {
389
+ info.setTimeout(original + (Date.now() - t0));
390
+ }
391
+ }
392
+ /**
393
+ * Starts containers on demand and shares each one across the tests of one
394
+ * worker. Created by the `stagehandContainers` worker fixture.
395
+ */
396
+ export class ContainerManager {
397
+ started = new Map();
398
+ /** Keys whose container is up: tests that ask for them again don't wait. */
399
+ ready = new Set();
400
+ /** The database config with host/port/credentials pointing at a container. SQLite is returned unchanged. */
401
+ async database(config) {
402
+ const options = containerOptions(config.container);
403
+ if (!options || config.type === 'sqlite')
404
+ return config;
405
+ const { spec, resolved } = databaseSpec(config, options);
406
+ const started = await this.ensure(spec, async (c) => {
407
+ if (config.type !== 'mssql')
408
+ return;
409
+ const sql = (args) => this.exec(c, spec, [SQLCMD, '-S', 'localhost', '-U', 'sa', '-P', resolved.password, '-C', '-b', ...args]);
410
+ if (resolved.database !== 'master') {
411
+ const name = resolved.database.replace(/]/g, ']]');
412
+ await sql(['-Q', `IF DB_ID(N'${resolved.database.replace(/'/g, "''")}') IS NULL CREATE DATABASE [${name}]`]);
413
+ }
414
+ for (const [, target] of spec.files ?? [])
415
+ await sql(['-d', resolved.database, '-i', target]);
416
+ });
417
+ return { ...resolved, host: started.host, port: started.port, container: false };
418
+ }
419
+ async redis(config) {
420
+ const options = containerOptions(config.container);
421
+ if (!options)
422
+ return config;
423
+ const started = await this.ensure(redisSpec(config, options));
424
+ return { ...config, host: started.host, port: started.port, container: false };
425
+ }
426
+ async mongodb(config) {
427
+ const options = containerOptions(config.container);
428
+ if (!options)
429
+ return config;
430
+ const started = await this.ensure(mongoDbSpec(config, options));
431
+ return {
432
+ ...config,
433
+ uri: undefined,
434
+ srv: false,
435
+ host: started.host,
436
+ port: started.port,
437
+ database: config.database || DEFAULT_CREDENTIALS.database,
438
+ password: config.username ? (config.password ?? DEFAULT_CREDENTIALS.password) : config.password,
439
+ authSource: config.username ? (config.authSource ?? 'admin') : config.authSource,
440
+ container: false,
441
+ };
442
+ }
443
+ async neo4j(config) {
444
+ const options = containerOptions(config.container);
445
+ if (!options)
446
+ return config;
447
+ const { spec, password } = neo4jSpec(config, options);
448
+ const started = await this.ensure(spec);
449
+ return { ...config, uri: `bolt://${started.host}:${started.port}`, username: 'neo4j', password, container: false };
450
+ }
451
+ async kafka(config) {
452
+ const options = containerOptions(config.container);
453
+ if (!options)
454
+ return config;
455
+ const tc = await this.testcontainers('kafkaClient');
456
+ const host = (await tc.getContainerRuntimeClient()).info.containerRuntime.host;
457
+ // Key on the options, not the port: the port is chosen once, when the container starts.
458
+ const key = JSON.stringify(['kafka', options.image ?? DEFAULT_IMAGES.kafka]);
459
+ const started = await this.ensureKeyed(key, async () => this.start(kafkaSpec(options, host, await freePort())));
460
+ return { ...config, brokers: [`${started.host}:${started.port}`], ssl: false, sasl: undefined, container: false };
461
+ }
462
+ /** RabbitMQ: host/port/credentials point at the container (`url` is dropped). */
463
+ async amqp(config) {
464
+ const options = containerOptions(config.container);
465
+ if (!options)
466
+ return config;
467
+ const { spec, username, password, vhost } = rabbitMqSpec(config, options);
468
+ const started = await this.ensure(spec);
469
+ return { ...config, url: undefined, tls: false, host: started.host, port: started.port, username, password, vhost, container: false };
470
+ }
471
+ /** Moto: `endpoint` points at the container, with its `test` credentials and us-east-1 unless the config sets a region. */
472
+ async aws(config) {
473
+ const options = containerOptions(config.container);
474
+ if (!options)
475
+ return config;
476
+ const started = await this.ensure(motoSpec(options));
477
+ return {
478
+ ...config,
479
+ endpoint: `http://${started.host}:${started.port}`,
480
+ region: config.region ?? 'us-east-1',
481
+ accessKeyId: 'test',
482
+ secretAccessKey: 'test',
483
+ sessionToken: undefined,
484
+ profile: undefined,
485
+ container: false,
486
+ };
487
+ }
488
+ /** Cassandra / ScyllaDB: `contactPoints` point at the container, without credentials; the keyspace is created. */
489
+ async cassandra(config) {
490
+ const options = containerOptions(config.container);
491
+ if (!options)
492
+ return config;
493
+ const started = await this.ensure(cassandraSpec(options));
494
+ return {
495
+ ...config,
496
+ contactPoints: [`${started.host}:${started.port}`],
497
+ port: undefined,
498
+ localDataCenter: 'datacenter1',
499
+ username: undefined,
500
+ password: undefined,
501
+ createKeyspace: config.createKeyspace ?? true,
502
+ container: false,
503
+ };
504
+ }
505
+ /** ClickHouse: `url` and the credentials point at the container; the database is created. */
506
+ async clickhouse(config) {
507
+ const options = containerOptions(config.container);
508
+ if (!options)
509
+ return config;
510
+ const { spec, username, password } = clickHouseSpec(config, options);
511
+ const started = await this.ensure(spec);
512
+ return { ...config, url: `http://${started.host}:${started.port}`, username, password, createDatabase: config.createDatabase ?? true, container: false };
513
+ }
514
+ /** Elasticsearch / OpenSearch: `url` points at the container, without credentials (security is off). */
515
+ async search(config) {
516
+ const options = containerOptions(config.container);
517
+ if (!options)
518
+ return config;
519
+ const started = await this.ensure(searchSpec(options));
520
+ return { ...config, url: `http://${started.host}:${started.port}`, username: undefined, password: undefined, apiKey: undefined, container: false };
521
+ }
522
+ /** Mailpit: `url` points at its API, `smtpHost`/`smtpPort` at its SMTP server. */
523
+ async inbox(config) {
524
+ const options = containerOptions(config.container);
525
+ if (!options)
526
+ return config;
527
+ const started = await this.ensure(mailpitSpec(options));
528
+ return {
529
+ ...config,
530
+ url: `http://${started.host}:${started.port}`,
531
+ smtpHost: started.host,
532
+ smtpPort: started.extra[1025],
533
+ username: undefined,
534
+ password: undefined,
535
+ container: false,
536
+ };
537
+ }
538
+ /** WireMock: `url` (and the admin API) point at the container. */
539
+ async mock(config) {
540
+ const options = containerOptions(config.container);
541
+ if (!options)
542
+ return config;
543
+ const started = await this.ensure(wiremockSpec(options));
544
+ const url = `http://${started.host}:${started.port}`;
545
+ return { ...config, url, adminUrl: url, container: false };
546
+ }
547
+ /** Stops every container this worker started (reused ones keep running). */
548
+ async stopAll() {
549
+ const all = await Promise.allSettled([...this.started.values()]);
550
+ this.started.clear();
551
+ await Promise.allSettled(all.flatMap((r) => (r.status === 'fulfilled' && !r.value.reuse ? [r.value.container.stop({ timeout: 5_000 })] : [])));
552
+ }
553
+ ensure(spec, afterStart) {
554
+ const key = JSON.stringify([spec.kind, spec.image, spec.env, spec.command, spec.files]);
555
+ return this.ensureKeyed(key, async () => {
556
+ const started = await this.start(spec);
557
+ if (afterStart)
558
+ await afterStart(started.container);
559
+ return started;
560
+ }, spec.startupTimeoutMs);
561
+ }
562
+ ensureKeyed(key, create, startupTimeoutMs = DEFAULT_STARTUP_BUDGET_MS) {
563
+ let pending = this.started.get(key);
564
+ if (!pending) {
565
+ pending = create();
566
+ this.started.set(key, pending);
567
+ pending.then(() => this.ready.add(key), () => this.started.delete(key));
568
+ }
569
+ if (this.ready.has(key))
570
+ return pending;
571
+ return withStartupBudget(pending, startupTimeoutMs);
572
+ }
573
+ testcontainers(fixture) {
574
+ return loadOptional('testcontainers', `${fixture} with container`);
575
+ }
576
+ async start(spec) {
577
+ const tc = await this.testcontainers(spec.fixture);
578
+ let container = new tc.GenericContainer(spec.image)
579
+ .withEnvironment(spec.env)
580
+ .withExposedPorts(spec.hostPort ? { container: spec.port, host: spec.hostPort } : spec.port, ...(spec.extraPorts ?? []))
581
+ .withHealthCheck({
582
+ test: ['CMD-SHELL', spec.healthCheck],
583
+ interval: 1_000,
584
+ timeout: 5_000,
585
+ retries: Math.ceil(spec.startupTimeoutMs / 1_000),
586
+ })
587
+ .withWaitStrategy(tc.Wait.forHealthCheck())
588
+ .withStartupTimeout(spec.startupTimeoutMs)
589
+ .withLabels({ 'dev.stagehand.backend': spec.kind });
590
+ if (spec.command)
591
+ container = container.withCommand(spec.command);
592
+ if (spec.files?.length) {
593
+ const missing = spec.files.filter(([source]) => !existsSync(source)).map(([source]) => source);
594
+ if (missing.length) {
595
+ throw new FixtureInitError(spec.fixture, 'boot', { image: spec.image, reason: `init script not found: ${missing.join(', ')}` });
596
+ }
597
+ container = container.withCopyFilesToContainer(spec.files.map(([source, target]) => ({ source, target })));
598
+ }
599
+ if (spec.reuse)
600
+ container = container.withReuse();
601
+ try {
602
+ const started = await container.start();
603
+ const extra = Object.fromEntries((spec.extraPorts ?? []).map((p) => [p, started.getMappedPort(p)]));
604
+ return { container: started, host: started.getHost(), port: started.getMappedPort(spec.port), extra, reuse: spec.reuse };
605
+ }
606
+ catch (error) {
607
+ const message = error instanceof Error ? error.message : String(error);
608
+ const noRuntime = /container runtime|ECONNREFUSED|ENOENT|docker\.sock|Cannot connect to the Docker daemon/i.test(message);
609
+ throw new FixtureInitError(spec.fixture, 'boot', {
610
+ image: spec.image,
611
+ reason: noRuntime
612
+ ? `${message} (is Docker running? Testcontainers needs a Docker-compatible runtime)`
613
+ : `${message} (the container started but never became healthy; check its credentials and image, or run it by hand with the same settings to see its logs)`,
614
+ }, error instanceof Error ? error : undefined);
615
+ }
616
+ }
617
+ async exec(container, spec, command) {
618
+ const result = await container.exec(command);
619
+ if (result.exitCode !== 0) {
620
+ throw new FixtureInitError(spec.fixture, 'boot', {
621
+ image: spec.image,
622
+ reason: `setup command failed (${result.exitCode}): ${result.output.trim().slice(0, 500)}`,
623
+ });
624
+ }
625
+ }
626
+ }
627
+ //# sourceMappingURL=container-manager.js.map