@credibledata/cred-cli 0.0.103 → 0.0.105

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 (430) hide show
  1. package/README.md +106 -1
  2. package/dist/agent-contract.spec.js +548 -0
  3. package/dist/agent-contract.spec.js.map +1 -0
  4. package/dist/browser.js +72 -0
  5. package/dist/browser.js.map +1 -0
  6. package/dist/browser.spec.js +125 -0
  7. package/dist/browser.spec.js.map +1 -0
  8. package/dist/client/api.js +4137 -1159
  9. package/dist/client/api.js.map +1 -1
  10. package/dist/client-codeassist/api.js +476 -0
  11. package/dist/client-codeassist/api.js.map +1 -0
  12. package/dist/client-codeassist/base.js +69 -0
  13. package/dist/client-codeassist/base.js.map +1 -0
  14. package/dist/client-codeassist/common.js +162 -0
  15. package/dist/client-codeassist/common.js.map +1 -0
  16. package/dist/client-codeassist/configuration.js +44 -0
  17. package/dist/client-codeassist/configuration.js.map +1 -0
  18. package/dist/client-codeassist/index.js +32 -0
  19. package/dist/client-codeassist/index.js.map +1 -0
  20. package/dist/clientconfiguration.js +17 -289
  21. package/dist/clientconfiguration.js.map +1 -1
  22. package/dist/clientconfiguration.spec.js +35 -96
  23. package/dist/clientconfiguration.spec.js.map +1 -1
  24. package/dist/commands/add.js +103 -3
  25. package/dist/commands/add.js.map +1 -1
  26. package/dist/commands/add.spec.js +113 -0
  27. package/dist/commands/add.spec.js.map +1 -0
  28. package/dist/commands/connection/createconnections.js +104 -7
  29. package/dist/commands/connection/createconnections.js.map +1 -1
  30. package/dist/commands/connection/createconnections.spec.js +35 -1
  31. package/dist/commands/connection/createconnections.spec.js.map +1 -1
  32. package/dist/commands/connection/deleteconnection.js +4 -2
  33. package/dist/commands/connection/deleteconnection.js.map +1 -1
  34. package/dist/commands/connection/deleteconnection.spec.js +6 -1
  35. package/dist/commands/connection/deleteconnection.spec.js.map +1 -1
  36. package/dist/commands/connection/listconnections.js +2 -0
  37. package/dist/commands/connection/listconnections.js.map +1 -1
  38. package/dist/commands/connection/updateconnection.js +365 -0
  39. package/dist/commands/connection/updateconnection.js.map +1 -0
  40. package/dist/commands/connection/updateconnection.spec.js +625 -0
  41. package/dist/commands/connection/updateconnection.spec.js.map +1 -0
  42. package/dist/commands/database/createdatabase.js +52 -0
  43. package/dist/commands/database/createdatabase.js.map +1 -0
  44. package/dist/commands/database/database.spec.js +267 -0
  45. package/dist/commands/database/database.spec.js.map +1 -0
  46. package/dist/commands/database/deletedatabase.js +91 -0
  47. package/dist/commands/database/deletedatabase.js.map +1 -0
  48. package/dist/commands/database/getdatabase.js +97 -0
  49. package/dist/commands/database/getdatabase.js.map +1 -0
  50. package/dist/commands/database/listdatabases.js +36 -0
  51. package/dist/commands/database/listdatabases.js.map +1 -0
  52. package/dist/commands/database/shared.js +125 -0
  53. package/dist/commands/database/shared.js.map +1 -0
  54. package/dist/commands/database/shared.spec.js +109 -0
  55. package/dist/commands/database/shared.spec.js.map +1 -0
  56. package/dist/commands/database/updatedatabase.js +39 -0
  57. package/dist/commands/database/updatedatabase.js.map +1 -0
  58. package/dist/commands/environment/createenvironment.js +59 -28
  59. package/dist/commands/environment/createenvironment.js.map +1 -1
  60. package/dist/commands/environment/createenvironment.spec.js +29 -0
  61. package/dist/commands/environment/createenvironment.spec.js.map +1 -1
  62. package/dist/commands/environment/deleteenvironment.js +3 -2
  63. package/dist/commands/environment/deleteenvironment.js.map +1 -1
  64. package/dist/commands/environment/deleteenvironment.spec.js +5 -1
  65. package/dist/commands/environment/deleteenvironment.spec.js.map +1 -1
  66. package/dist/commands/environment/getenvironment.js +1 -0
  67. package/dist/commands/environment/getenvironment.js.map +1 -1
  68. package/dist/commands/environment/listenvironments.js +40 -8
  69. package/dist/commands/environment/listenvironments.js.map +1 -1
  70. package/dist/commands/environment/listenvironments.spec.js +41 -2
  71. package/dist/commands/environment/listenvironments.spec.js.map +1 -1
  72. package/dist/commands/environment/setenvironment.js +145 -6
  73. package/dist/commands/environment/setenvironment.js.map +1 -1
  74. package/dist/commands/environment/setenvironment.spec.js +256 -8
  75. package/dist/commands/environment/setenvironment.spec.js.map +1 -1
  76. package/dist/commands/environment/updateenvironment.js +12 -8
  77. package/dist/commands/environment/updateenvironment.js.map +1 -1
  78. package/dist/commands/environment/updateenvironment.spec.js +36 -2
  79. package/dist/commands/environment/updateenvironment.spec.js.map +1 -1
  80. package/dist/commands/get.js +64 -1
  81. package/dist/commands/get.js.map +1 -1
  82. package/dist/commands/group/addmember.js +3 -1
  83. package/dist/commands/group/addmember.js.map +1 -1
  84. package/dist/commands/group/addmember.spec.js +7 -2
  85. package/dist/commands/group/addmember.spec.js.map +1 -1
  86. package/dist/commands/group/creategroup.js +2 -0
  87. package/dist/commands/group/creategroup.js.map +1 -1
  88. package/dist/commands/group/deletegroup.js +3 -1
  89. package/dist/commands/group/deletegroup.js.map +1 -1
  90. package/dist/commands/group/deletegroup.spec.js +7 -1
  91. package/dist/commands/group/deletegroup.spec.js.map +1 -1
  92. package/dist/commands/group/getgroup.js +2 -0
  93. package/dist/commands/group/getgroup.js.map +1 -1
  94. package/dist/commands/group/listgroups.js +2 -0
  95. package/dist/commands/group/listgroups.js.map +1 -1
  96. package/dist/commands/group/removemember.js +3 -1
  97. package/dist/commands/group/removemember.js.map +1 -1
  98. package/dist/commands/group/removemember.spec.js +7 -2
  99. package/dist/commands/group/removemember.spec.js.map +1 -1
  100. package/dist/commands/groupaccesstoken/deleteToken.js +2 -1
  101. package/dist/commands/groupaccesstoken/deleteToken.js.map +1 -1
  102. package/dist/commands/groupaccesstoken/groupContainer.js +2 -0
  103. package/dist/commands/groupaccesstoken/groupContainer.js.map +1 -1
  104. package/dist/commands/list.js +24 -4
  105. package/dist/commands/list.js.map +1 -1
  106. package/dist/commands/materialization/cancelrun.js +3 -1
  107. package/dist/commands/materialization/cancelrun.js.map +1 -1
  108. package/dist/commands/materialization/getindex.js +2 -0
  109. package/dist/commands/materialization/getindex.js.map +1 -1
  110. package/dist/commands/materialization/getmaterialization.js +2 -0
  111. package/dist/commands/materialization/getmaterialization.js.map +1 -1
  112. package/dist/commands/materialization/getpreaggregate.js +2 -0
  113. package/dist/commands/materialization/getpreaggregate.js.map +1 -1
  114. package/dist/commands/materialization/getrun.js +2 -0
  115. package/dist/commands/materialization/getrun.js.map +1 -1
  116. package/dist/commands/materialization/listindexes.js +2 -0
  117. package/dist/commands/materialization/listindexes.js.map +1 -1
  118. package/dist/commands/materialization/listmaterializations.js +2 -0
  119. package/dist/commands/materialization/listmaterializations.js.map +1 -1
  120. package/dist/commands/materialization/listpreaggregates.js +2 -0
  121. package/dist/commands/materialization/listpreaggregates.js.map +1 -1
  122. package/dist/commands/materialization/listruns.js +3 -1
  123. package/dist/commands/materialization/listruns.js.map +1 -1
  124. package/dist/commands/materialization/rerun.js +3 -1
  125. package/dist/commands/materialization/rerun.js.map +1 -1
  126. package/dist/commands/misc/inquirerHost.js +87 -0
  127. package/dist/commands/misc/inquirerHost.js.map +1 -0
  128. package/dist/commands/misc/inquirerHost.spec.js +91 -0
  129. package/dist/commands/misc/inquirerHost.spec.js.map +1 -0
  130. package/dist/commands/misc/login.js +348 -58
  131. package/dist/commands/misc/login.js.map +1 -1
  132. package/dist/commands/misc/login.spec.js +525 -7
  133. package/dist/commands/misc/login.spec.js.map +1 -1
  134. package/dist/commands/misc/logout.js +26 -3
  135. package/dist/commands/misc/logout.js.map +1 -1
  136. package/dist/commands/misc/logout.spec.js +52 -12
  137. package/dist/commands/misc/logout.spec.js.map +1 -1
  138. package/dist/commands/misc/resolveLoginTarget.spec.js +90 -0
  139. package/dist/commands/misc/resolveLoginTarget.spec.js.map +1 -0
  140. package/dist/commands/misc/scope.spec.js +108 -0
  141. package/dist/commands/misc/scope.spec.js.map +1 -0
  142. package/dist/commands/misc/set-access-token.js +1 -1
  143. package/dist/commands/misc/set-access-token.js.map +1 -1
  144. package/dist/commands/misc/set-access-token.spec.js +13 -2
  145. package/dist/commands/misc/set-access-token.spec.js.map +1 -1
  146. package/dist/commands/misc/setup.js +819 -0
  147. package/dist/commands/misc/setup.js.map +1 -0
  148. package/dist/commands/misc/setup.spec.js +783 -0
  149. package/dist/commands/misc/setup.spec.js.map +1 -0
  150. package/dist/commands/misc/status.js +168 -0
  151. package/dist/commands/misc/status.js.map +1 -0
  152. package/dist/commands/misc/status.spec.js +301 -0
  153. package/dist/commands/misc/status.spec.js.map +1 -0
  154. package/dist/commands/misc/token.js +57 -0
  155. package/dist/commands/misc/token.js.map +1 -0
  156. package/dist/commands/misc/token.spec.js +92 -0
  157. package/dist/commands/misc/token.spec.js.map +1 -0
  158. package/dist/commands/package/deletepackage.js +4 -2
  159. package/dist/commands/package/deletepackage.js.map +1 -1
  160. package/dist/commands/package/deletepackage.spec.js +7 -1
  161. package/dist/commands/package/deletepackage.spec.js.map +1 -1
  162. package/dist/commands/package/getpackage.js +142 -0
  163. package/dist/commands/package/getpackage.js.map +1 -0
  164. package/dist/commands/package/getpackage.spec.js +246 -0
  165. package/dist/commands/package/getpackage.spec.js.map +1 -0
  166. package/dist/commands/package/listpackages.js +2 -0
  167. package/dist/commands/package/listpackages.js.map +1 -1
  168. package/dist/commands/package/publish.archive.spec.js +570 -0
  169. package/dist/commands/package/publish.archive.spec.js.map +1 -0
  170. package/dist/commands/package/publish.js +780 -49
  171. package/dist/commands/package/publish.js.map +1 -1
  172. package/dist/commands/package/publish.spec.js +451 -8
  173. package/dist/commands/package/publish.spec.js.map +1 -1
  174. package/dist/commands/package/updatepackage.js +22 -19
  175. package/dist/commands/package/updatepackage.js.map +1 -1
  176. package/dist/commands/package/updatepackage.spec.js +36 -1
  177. package/dist/commands/package/updatepackage.spec.js.map +1 -1
  178. package/dist/commands/permission/createpermission.js +3 -1
  179. package/dist/commands/permission/createpermission.js.map +1 -1
  180. package/dist/commands/permission/deletepermission.js +6 -3
  181. package/dist/commands/permission/deletepermission.js.map +1 -1
  182. package/dist/commands/permission/getpermission.js +2 -0
  183. package/dist/commands/permission/getpermission.js.map +1 -1
  184. package/dist/commands/permission/listpermissions.js +2 -0
  185. package/dist/commands/permission/listpermissions.js.map +1 -1
  186. package/dist/commands/rm.js +21 -0
  187. package/dist/commands/rm.js.map +1 -1
  188. package/dist/commands/set.js +40 -6
  189. package/dist/commands/set.js.map +1 -1
  190. package/dist/commands/set.spec.js +123 -0
  191. package/dist/commands/set.spec.js.map +1 -0
  192. package/dist/commands/table/addtable.js +155 -0
  193. package/dist/commands/table/addtable.js.map +1 -0
  194. package/dist/commands/table/deletetable.js +45 -0
  195. package/dist/commands/table/deletetable.js.map +1 -0
  196. package/dist/commands/table/gettable.js +32 -0
  197. package/dist/commands/table/gettable.js.map +1 -0
  198. package/dist/commands/table/listtables.js +36 -0
  199. package/dist/commands/table/listtables.js.map +1 -0
  200. package/dist/commands/table/table.spec.js +304 -0
  201. package/dist/commands/table/table.spec.js.map +1 -0
  202. package/dist/commands/table/tablefile.js +195 -0
  203. package/dist/commands/table/tablefile.js.map +1 -0
  204. package/dist/commands/table/tablefile.spec.js +158 -0
  205. package/dist/commands/table/tablefile.spec.js.map +1 -0
  206. package/dist/commands/update.js +21 -0
  207. package/dist/commands/update.js.map +1 -1
  208. package/dist/commands/version/archive-unarchive-version.js +4 -2
  209. package/dist/commands/version/archive-unarchive-version.js.map +1 -1
  210. package/dist/commands/version/archive-unarchive-version.spec.js +6 -1
  211. package/dist/commands/version/archive-unarchive-version.spec.js.map +1 -1
  212. package/dist/commands/version/listversions.js +2 -0
  213. package/dist/commands/version/listversions.js.map +1 -1
  214. package/dist/common/UserGroupId.js +9 -4
  215. package/dist/common/UserGroupId.js.map +1 -1
  216. package/dist/common/UserGroupId.spec.js +5 -0
  217. package/dist/common/UserGroupId.spec.js.map +1 -1
  218. package/dist/constants.js +37 -143
  219. package/dist/constants.js.map +1 -1
  220. package/dist/index.js +487 -90
  221. package/dist/index.js.map +1 -1
  222. package/dist/logger.js +42 -9
  223. package/dist/logger.js.map +1 -1
  224. package/dist/session.js +56 -0
  225. package/dist/session.js.map +1 -0
  226. package/dist/session.spec.js +103 -0
  227. package/dist/session.spec.js.map +1 -0
  228. package/dist/setup-core/briefing.js +176 -0
  229. package/dist/setup-core/briefing.js.map +1 -0
  230. package/dist/setup-core/credstore.js +415 -0
  231. package/dist/setup-core/credstore.js.map +1 -0
  232. package/dist/setup-core/credstore.spec.js +238 -0
  233. package/dist/setup-core/credstore.spec.js.map +1 -0
  234. package/dist/setup-core/environments.js +267 -0
  235. package/dist/setup-core/environments.js.map +1 -0
  236. package/dist/setup-core/flow.e2e.js +165 -0
  237. package/dist/setup-core/flow.e2e.js.map +1 -0
  238. package/dist/setup-core/flow.js +765 -0
  239. package/dist/setup-core/flow.js.map +1 -0
  240. package/dist/setup-core/flow.spec.js +1348 -0
  241. package/dist/setup-core/flow.spec.js.map +1 -0
  242. package/dist/setup-core/folderconfig.js +283 -0
  243. package/dist/setup-core/folderconfig.js.map +1 -0
  244. package/dist/setup-core/git.js +97 -0
  245. package/dist/setup-core/git.js.map +1 -0
  246. package/dist/setup-core/host.js +77 -0
  247. package/dist/setup-core/host.js.map +1 -0
  248. package/dist/setup-core/importconnections.js +470 -0
  249. package/dist/setup-core/importconnections.js.map +1 -0
  250. package/dist/setup-core/importconnections.spec.js +594 -0
  251. package/dist/setup-core/importconnections.spec.js.map +1 -0
  252. package/dist/setup-core/liveness.js +94 -0
  253. package/dist/setup-core/liveness.js.map +1 -0
  254. package/dist/setup-core/liveness.spec.js +59 -0
  255. package/dist/setup-core/liveness.spec.js.map +1 -0
  256. package/dist/setup-core/localpublisherconfig.js +26 -0
  257. package/dist/setup-core/localpublisherconfig.js.map +1 -0
  258. package/dist/setup-core/localpublisherconfig.spec.js +29 -0
  259. package/dist/setup-core/localpublisherconfig.spec.js.map +1 -0
  260. package/dist/setup-core/mcpconfig.js +198 -0
  261. package/dist/setup-core/mcpconfig.js.map +1 -0
  262. package/dist/setup-core/mcpconfig.spec.js +205 -0
  263. package/dist/setup-core/mcpconfig.spec.js.map +1 -0
  264. package/dist/setup-core/packagemanifest.js +55 -0
  265. package/dist/setup-core/packagemanifest.js.map +1 -0
  266. package/dist/setup-core/ports.js +182 -0
  267. package/dist/setup-core/ports.js.map +1 -0
  268. package/dist/setup-core/ports.spec.js +173 -0
  269. package/dist/setup-core/ports.spec.js.map +1 -0
  270. package/dist/setup-core/publisherconfig.js +268 -0
  271. package/dist/setup-core/publisherconfig.js.map +1 -0
  272. package/dist/setup-core/publisherconfig.oracle.js +166 -0
  273. package/dist/setup-core/publisherconfig.oracle.js.map +1 -0
  274. package/dist/setup-core/publisherconfig.spec.js +277 -0
  275. package/dist/setup-core/publisherconfig.spec.js.map +1 -0
  276. package/dist/setup-core/publisherversion.js +26 -0
  277. package/dist/setup-core/publisherversion.js.map +1 -0
  278. package/dist/setup-core/readiness.spec.js +161 -0
  279. package/dist/setup-core/readiness.spec.js.map +1 -0
  280. package/dist/setup-core/readylines.js +169 -0
  281. package/dist/setup-core/readylines.js.map +1 -0
  282. package/dist/setup-core/readylines.spec.js +70 -0
  283. package/dist/setup-core/readylines.spec.js.map +1 -0
  284. package/dist/setup-core/refresh.js +348 -0
  285. package/dist/setup-core/refresh.js.map +1 -0
  286. package/dist/setup-core/refresh.spec.js +501 -0
  287. package/dist/setup-core/refresh.spec.js.map +1 -0
  288. package/dist/setup-core/skills.js +279 -0
  289. package/dist/setup-core/skills.js.map +1 -0
  290. package/dist/setup-core/skills.spec.js +334 -0
  291. package/dist/setup-core/skills.spec.js.map +1 -0
  292. package/dist/setup-core/supervisor.js +879 -0
  293. package/dist/setup-core/supervisor.js.map +1 -0
  294. package/dist/setup-core/supervisor.spec.js +833 -0
  295. package/dist/setup-core/supervisor.spec.js.map +1 -0
  296. package/dist/setup-core/writefile.js +61 -0
  297. package/dist/setup-core/writefile.js.map +1 -0
  298. package/dist/setup-core/writefile.spec.js +68 -0
  299. package/dist/setup-core/writefile.spec.js.map +1 -0
  300. package/dist/utils.js +409 -3
  301. package/dist/utils.js.map +1 -1
  302. package/dist/utils.spec.js +373 -2
  303. package/dist/utils.spec.js.map +1 -1
  304. package/dist/versioncheck-refresh.js +18 -0
  305. package/dist/versioncheck-refresh.js.map +1 -0
  306. package/dist/versioncheck.js +324 -0
  307. package/dist/versioncheck.js.map +1 -0
  308. package/dist/versioncheck.spec.js +587 -0
  309. package/dist/versioncheck.spec.js.map +1 -0
  310. package/node_modules/@credibledata/cli-auth/dist/index.d.ts +86 -0
  311. package/node_modules/@credibledata/cli-auth/dist/index.js +102 -0
  312. package/node_modules/@credibledata/cli-auth/package.json +19 -0
  313. package/package.json +18 -6
  314. package/.github/workflows/build.yml +0 -23
  315. package/.mocharc.json +0 -10
  316. package/.prettierignore +0 -2
  317. package/.prettierrc +0 -4
  318. package/README-DEV.md +0 -40
  319. package/coverage/coverage-summary.json +0 -40
  320. package/coverage/tmp/coverage-2152-1789496974457-0.json +0 -1
  321. package/coverage/tmp/coverage-2153-1789496954404-0.json +0 -1
  322. package/docker/Dockerfile.ci +0 -18
  323. package/docker-compose.yml +0 -18
  324. package/eslint.config.mjs +0 -45
  325. package/generate-client.sh +0 -27
  326. package/mocha.setup.ts +0 -4
  327. package/openapitools.json +0 -10
  328. package/src/client/.openapi-generator/FILES +0 -9
  329. package/src/client/.openapi-generator/VERSION +0 -1
  330. package/src/client/.openapi-generator-ignore +0 -23
  331. package/src/client/api.ts +0 -15999
  332. package/src/client/base.ts +0 -86
  333. package/src/client/common.ts +0 -150
  334. package/src/client/configuration.ts +0 -110
  335. package/src/client/git_push.sh +0 -57
  336. package/src/client/index.ts +0 -18
  337. package/src/clientconfiguration.spec.ts +0 -615
  338. package/src/clientconfiguration.ts +0 -364
  339. package/src/commands/add.ts +0 -191
  340. package/src/commands/connection/createconnections.spec.ts +0 -413
  341. package/src/commands/connection/createconnections.ts +0 -109
  342. package/src/commands/connection/deleteconnection.spec.ts +0 -189
  343. package/src/commands/connection/deleteconnection.ts +0 -57
  344. package/src/commands/connection/listconnections.spec.ts +0 -132
  345. package/src/commands/connection/listconnections.ts +0 -58
  346. package/src/commands/environment/createenvironment.spec.ts +0 -249
  347. package/src/commands/environment/createenvironment.ts +0 -73
  348. package/src/commands/environment/deleteenvironment.spec.ts +0 -152
  349. package/src/commands/environment/deleteenvironment.ts +0 -48
  350. package/src/commands/environment/getenvironment.spec.ts +0 -110
  351. package/src/commands/environment/getenvironment.ts +0 -43
  352. package/src/commands/environment/listenvironments.spec.ts +0 -123
  353. package/src/commands/environment/listenvironments.ts +0 -67
  354. package/src/commands/environment/setenvironment.spec.ts +0 -63
  355. package/src/commands/environment/setenvironment.ts +0 -14
  356. package/src/commands/environment/updateenvironment.spec.ts +0 -386
  357. package/src/commands/environment/updateenvironment.ts +0 -168
  358. package/src/commands/get.ts +0 -153
  359. package/src/commands/group/addmember.spec.ts +0 -257
  360. package/src/commands/group/addmember.ts +0 -85
  361. package/src/commands/group/creategroup.spec.ts +0 -146
  362. package/src/commands/group/creategroup.ts +0 -54
  363. package/src/commands/group/deletegroup.spec.ts +0 -120
  364. package/src/commands/group/deletegroup.ts +0 -45
  365. package/src/commands/group/getgroup.spec.ts +0 -129
  366. package/src/commands/group/getgroup.ts +0 -47
  367. package/src/commands/group/listgroups.spec.ts +0 -137
  368. package/src/commands/group/listgroups.ts +0 -45
  369. package/src/commands/group/removemember.spec.ts +0 -224
  370. package/src/commands/group/removemember.ts +0 -75
  371. package/src/commands/groupaccesstoken/createToken.spec.ts +0 -211
  372. package/src/commands/groupaccesstoken/createToken.ts +0 -72
  373. package/src/commands/groupaccesstoken/deleteToken.spec.ts +0 -147
  374. package/src/commands/groupaccesstoken/deleteToken.ts +0 -29
  375. package/src/commands/groupaccesstoken/groupContainer.ts +0 -83
  376. package/src/commands/groupaccesstoken/listTokens.spec.ts +0 -147
  377. package/src/commands/groupaccesstoken/listTokens.ts +0 -29
  378. package/src/commands/legacy.ts +0 -5
  379. package/src/commands/list.ts +0 -326
  380. package/src/commands/materialization/cancelrun.ts +0 -70
  381. package/src/commands/materialization/getindex.ts +0 -55
  382. package/src/commands/materialization/getmaterialization.ts +0 -57
  383. package/src/commands/materialization/getpreaggregate.ts +0 -58
  384. package/src/commands/materialization/getrun.ts +0 -55
  385. package/src/commands/materialization/listindexes.ts +0 -69
  386. package/src/commands/materialization/listmaterializations.ts +0 -53
  387. package/src/commands/materialization/listpreaggregates.ts +0 -74
  388. package/src/commands/materialization/listruns.ts +0 -77
  389. package/src/commands/materialization/rerun.ts +0 -123
  390. package/src/commands/misc/login.spec.ts +0 -371
  391. package/src/commands/misc/login.ts +0 -343
  392. package/src/commands/misc/logout.spec.ts +0 -32
  393. package/src/commands/misc/logout.ts +0 -9
  394. package/src/commands/misc/loopbackOAuth.ts +0 -127
  395. package/src/commands/misc/set-access-token.spec.ts +0 -95
  396. package/src/commands/misc/set-access-token.ts +0 -32
  397. package/src/commands/package/deletepackage.spec.ts +0 -164
  398. package/src/commands/package/deletepackage.ts +0 -58
  399. package/src/commands/package/listpackages.spec.ts +0 -163
  400. package/src/commands/package/listpackages.ts +0 -74
  401. package/src/commands/package/publish.spec.ts +0 -642
  402. package/src/commands/package/publish.ts +0 -236
  403. package/src/commands/package/updatepackage.spec.ts +0 -319
  404. package/src/commands/package/updatepackage.ts +0 -95
  405. package/src/commands/permission/createpermission.spec.ts +0 -507
  406. package/src/commands/permission/createpermission.ts +0 -181
  407. package/src/commands/permission/deletepermission.ts +0 -117
  408. package/src/commands/permission/getpermission.ts +0 -115
  409. package/src/commands/permission/listpermissions.ts +0 -101
  410. package/src/commands/permission/scope.ts +0 -180
  411. package/src/commands/rm.ts +0 -146
  412. package/src/commands/set.ts +0 -25
  413. package/src/commands/update.ts +0 -107
  414. package/src/commands/version/archive-unarchive-version.spec.ts +0 -456
  415. package/src/commands/version/archive-unarchive-version.ts +0 -108
  416. package/src/commands/version/listversions.spec.ts +0 -138
  417. package/src/commands/version/listversions.ts +0 -45
  418. package/src/common/UserGroupId.spec.ts +0 -115
  419. package/src/common/UserGroupId.ts +0 -137
  420. package/src/constants.spec.ts +0 -111
  421. package/src/constants.ts +0 -228
  422. package/src/index.ts +0 -378
  423. package/src/logger.spec.ts +0 -158
  424. package/src/logger.ts +0 -90
  425. package/src/polyfills/file.polyfill.ts +0 -6
  426. package/src/utils.spec.ts +0 -135
  427. package/src/utils.ts +0 -115
  428. package/src/validator.spec.ts +0 -51
  429. package/src/validator.ts +0 -44
  430. package/tsconfig.json +0 -17
@@ -0,0 +1,833 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ const chai_1 = require("chai");
49
+ const child_process_1 = __importDefault(require("child_process"));
50
+ const events_1 = require("events");
51
+ const fs_1 = __importDefault(require("fs"));
52
+ const os_1 = __importDefault(require("os"));
53
+ const path_1 = require("path");
54
+ const stream_1 = require("stream");
55
+ const sinon_1 = __importDefault(require("sinon"));
56
+ const credstore_1 = require("./credstore");
57
+ const environments_1 = require("./environments");
58
+ const refresh = __importStar(require("./refresh"));
59
+ const supervisor_1 = require("./supervisor");
60
+ const PROD = environments_1.auth0ConfigsByEnv.production;
61
+ /** An access token with plenty of life left, so no renewal is attempted. */
62
+ function liveToken() {
63
+ const part = (value) => Buffer.from(JSON.stringify(value)).toString("base64url");
64
+ return `${part({ alg: "HS256", typ: "JWT" })}.${part({
65
+ aud: PROD.audience,
66
+ exp: Math.floor(Date.now() / 1000) + 7200,
67
+ })}.signature`;
68
+ }
69
+ const READY = "PUBLISHER_READY url=http://127.0.0.1:4000 mcp=http://127.0.0.1:4040 environments=1 packages=1 load_errors=0\n";
70
+ /** A stand-in for the spawned publisher: real streams, controllable exit. */
71
+ class FakeChild extends events_1.EventEmitter {
72
+ constructor() {
73
+ super(...arguments);
74
+ this.stdout = new stream_1.PassThrough();
75
+ this.stderr = new stream_1.PassThrough();
76
+ this.pid = undefined;
77
+ /** Every signal sent, in order — the escalation ladder is the assertion. */
78
+ this.signals = [];
79
+ /** Node sets these on a real child once it is gone; `stopTree` reads them. */
80
+ this.exitCode = null;
81
+ this.signalCode = null;
82
+ }
83
+ kill(signal = "SIGTERM") {
84
+ this.signals.push(signal);
85
+ return true;
86
+ }
87
+ /**
88
+ * Exit the way a real child does: state first, then `exit`, then `close`
89
+ * once its stdio has drained, which can be after more output arrives.
90
+ */
91
+ exit(code, signal = null) {
92
+ this.exitCode = code;
93
+ this.signalCode = signal;
94
+ this.emit("exit", code);
95
+ setImmediate(() => this.emit("close", code, signal));
96
+ }
97
+ }
98
+ function hostRecording(onOpenUrl) {
99
+ const logs = [];
100
+ return {
101
+ logs,
102
+ select(_m, choices) {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ return choices[0].value;
105
+ });
106
+ },
107
+ selectMany() {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ return [];
110
+ });
111
+ },
112
+ confirm() {
113
+ return __awaiter(this, void 0, void 0, function* () {
114
+ return true;
115
+ });
116
+ },
117
+ log(level, message) {
118
+ logs.push(`${level}: ${message}`);
119
+ },
120
+ write() { },
121
+ openUrl() {
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ if (onOpenUrl)
124
+ yield onOpenUrl();
125
+ });
126
+ },
127
+ };
128
+ }
129
+ describe("startPublisher", () => {
130
+ let workDir;
131
+ let child;
132
+ beforeEach(() => {
133
+ workDir = fs_1.default.mkdtempSync((0, path_1.join)(os_1.default.tmpdir(), "supervisor-"));
134
+ child = new FakeChild();
135
+ sinon_1.default
136
+ .stub(child_process_1.default, "spawn")
137
+ .returns(child);
138
+ });
139
+ afterEach(() => {
140
+ sinon_1.default.restore();
141
+ fs_1.default.rmSync(workDir, { recursive: true, force: true });
142
+ });
143
+ function credStore() {
144
+ const configPath = (0, path_1.join)(workDir, ".cred");
145
+ fs_1.default.writeFileSync(configPath, JSON.stringify({
146
+ configPerEnvironment: {
147
+ production: { jwtAccessToken: liveToken(), refreshToken: "r" },
148
+ },
149
+ activeEnvironment: "production",
150
+ }));
151
+ return new credstore_1.ClientConfiguration(configPath);
152
+ }
153
+ function options(host, openBrowser = true) {
154
+ return {
155
+ directory: workDir,
156
+ serverRoot: workDir,
157
+ configPath: (0, path_1.join)(workDir, "publisher.config.json"),
158
+ config: { frozenConfig: false, environments: [] },
159
+ uiPort: 4000,
160
+ mcpPort: 4040,
161
+ watchEnvironment: "local",
162
+ publisherVersion: "0.0.248",
163
+ host,
164
+ credStore: credStore(),
165
+ openBrowser,
166
+ };
167
+ }
168
+ /** Let queued stream and promise callbacks run. */
169
+ const settle = () => new Promise((resolve) => setImmediate(resolve));
170
+ // The publisher's one `exit` event fires while `openUrl` is still awaiting —
171
+ // the real host awaits a full `exec()` of the OS browser command, so this is
172
+ // hundreds of ms on the default path. `waitForExit` subscribes only after
173
+ // that, so without latching the code its promise never settles: nothing is
174
+ // left holding the event loop, and the process ends with `exitCode` unset —
175
+ // reporting success after telling the user the publisher is serving.
176
+ /** Boot to the point where `startPublisher` has returned a session. */
177
+ function boot(host_1) {
178
+ return __awaiter(this, arguments, void 0, function* (host, openBrowser = false) {
179
+ const started = (0, supervisor_1.startPublisher)(options(host, openBrowser));
180
+ yield settle();
181
+ child.stdout.write(READY);
182
+ return started;
183
+ });
184
+ }
185
+ describe("what reaches the terminal", () => {
186
+ // What the Publisher (0.9.5) prints on a normal boot and on a bad save,
187
+ // in winston's `simple` format with its colours on.
188
+ const BOOT = [
189
+ "\x1b[32minfo\x1b[39m: Reinitializing database schema dropping and recreating all tables",
190
+ "\x1b[32minfo\x1b[39m: Dropped table: connections",
191
+ "\x1b[33mwarn\x1b[39m: PUBLISHER_DUCKDB_MEMORY_LIMIT is unset: … See docs/configuration.md.",
192
+ ].join("\n");
193
+ const RECOMPILE_FAILED = '\x1b[31merror\x1b[39m: Watch: failed to recompile package "bars" in environment "local" {"error":{}}';
194
+ function hostWriting() {
195
+ const host = hostRecording();
196
+ host.written = "";
197
+ host.write = (chunk) => {
198
+ host.written += chunk;
199
+ };
200
+ return host;
201
+ }
202
+ it("shows the server's errors, keeps the rest in the log file, and says where", () => __awaiter(void 0, void 0, void 0, function* () {
203
+ const host = hostWriting();
204
+ const started = (0, supervisor_1.startPublisher)(options(host));
205
+ yield settle();
206
+ child.stdout.write(`${BOOT}\n`);
207
+ child.stderr.write("npm warn deprecated inflight@1.0.6: leaks memory\n");
208
+ child.stdout.write(READY);
209
+ const running = yield started;
210
+ child.stdout.write(`${RECOMPILE_FAILED}\n`);
211
+ yield settle();
212
+ (0, chai_1.expect)(host.written).to.equal(`${RECOMPILE_FAILED}\n`);
213
+ (0, chai_1.expect)(host.logs.join("\n")).to.contain("The first run downloads it, which takes about 30 seconds.");
214
+ (0, chai_1.expect)(host.logs.join("\n")).to.contain("publisher.log");
215
+ child.exit(0);
216
+ yield running.waitForExit();
217
+ // No extra wait: `waitForExit` settles only once the log is on disk,
218
+ // even when the writes are still queued at `exit` on a slow disk.
219
+ const log = fs_1.default.readFileSync((0, supervisor_1.publisherLogPath)(workDir), "utf-8");
220
+ (0, chai_1.expect)(log).to.contain("Dropped table: connections");
221
+ (0, chai_1.expect)(log).to.contain("npm warn deprecated");
222
+ (0, chai_1.expect)(log).to.contain("failed to recompile");
223
+ }));
224
+ it("keeps output that arrives after exit in the log file", () => __awaiter(void 0, void 0, void 0, function* () {
225
+ const host = hostWriting();
226
+ const started = (0, supervisor_1.startPublisher)(options(host));
227
+ yield settle();
228
+ child.exit(1);
229
+ // A crash on boot: the stack reaches the pipe after `exit` has fired.
230
+ child.stderr.write("Error: boom\n at main (server.js:1:1)\n");
231
+ yield (0, chai_1.expect)(started).to.be.rejectedWith("exited with code 1");
232
+ // Read as soon as the failure is thrown: the CLI exits right then.
233
+ const log = fs_1.default.readFileSync((0, supervisor_1.publisherLogPath)(workDir), "utf-8");
234
+ (0, chai_1.expect)(log).to.contain("Error: boom");
235
+ (0, chai_1.expect)(log).to.contain("at main (server.js:1:1)");
236
+ }));
237
+ it("streams everything with showAllOutput, as --debug asks", () => __awaiter(void 0, void 0, void 0, function* () {
238
+ const host = hostWriting();
239
+ const started = (0, supervisor_1.startPublisher)(Object.assign(Object.assign({}, options(host)), { showAllOutput: true }));
240
+ yield settle();
241
+ child.stdout.write(`${BOOT}\n`);
242
+ child.stdout.write(READY);
243
+ const running = yield started;
244
+ (0, chai_1.expect)(host.written).to.contain("Dropped table: connections");
245
+ child.exit(0);
246
+ yield running.waitForExit();
247
+ }));
248
+ it("quiets npm's own notices, unless the user set a level", () => __awaiter(void 0, void 0, void 0, function* () {
249
+ const running = yield boot(hostRecording());
250
+ const env = child_process_1.default.spawn
251
+ .firstCall.args[2].env;
252
+ (0, chai_1.expect)(env.npm_config_loglevel).to.equal("error");
253
+ child.exit(0);
254
+ yield running.waitForExit();
255
+ }));
256
+ it("isShownLine: errors and stderr, not info, warn or npm notices", () => {
257
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)(RECOMPILE_FAILED, "stdout")).to.equal(true);
258
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)("error: plain", "stdout")).to.equal(true);
259
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)("\x1b[32minfo\x1b[39m: Dropped table: x", "stdout")).to.equal(false);
260
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)("warn: something", "stdout")).to.equal(false);
261
+ // The one info line shown: a fixed model's recompile, so the error
262
+ // above it is visibly over. Other watch-mode info lines stay hidden.
263
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)('\x1b[32minfo\x1b[39m: Watch: recompiled package "bars" in environment "local"', "stdout")).to.equal(true);
264
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)("\x1b[32minfo\x1b[39m: Watch change: /tmp/x/bars/model.malloy", "stdout")).to.equal(false);
265
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)('PUBLISHER_INIT_FAILED error="bad config"', "stderr")).to.equal(true);
266
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)("line 1: 'nope_field' is not defined", "stderr")).to.equal(true);
267
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)(" at Object.<anonymous> (server.js:1:1)", "stderr")).to.equal(false);
268
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)(READY.trim(), "stderr")).to.equal(false);
269
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)("npm warn deprecated glob@7", "stderr")).to.equal(false);
270
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)(" ", "stderr")).to.equal(false);
271
+ });
272
+ // Winston's JSON format, which the Publisher switches to when
273
+ // OTEL_EXPORTER_OTLP_ENDPOINT is set. These lines are its real output
274
+ // for the same calls, keys sorted as it writes them.
275
+ it("isShownLine: the same rules for the server's JSON lines", () => {
276
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)('{"error":{},"level":"error","message":"Watch: failed to recompile package \\"bars\\" in environment \\"local\\"","timestamp":"2026-10-14T16:39:52.466Z"}', "stdout")).to.equal(true);
277
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)('{"level":"info","message":"Watch: recompiled package \\"bars\\" in environment \\"local\\"","timestamp":"2026-10-14T16:39:52.467Z"}', "stdout")).to.equal(true);
278
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)('{"level":"info","message":"Dropped table: connections","timestamp":"2026-10-14T16:39:52.467Z"}', "stdout")).to.equal(false);
279
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)('{"level":"warn","message":"PUBLISHER_DUCKDB_MEMORY_LIMIT is unset","timestamp":"2026-10-14T16:39:52.467Z"}', "stdout")).to.equal(false);
280
+ (0, chai_1.expect)((0, supervisor_1.isShownLine)('{"level": oops', "stdout")).to.equal(false);
281
+ });
282
+ });
283
+ // Without it the server trusts the last session's `publisher.db` over the
284
+ // config just written, so every session after the first served that
285
+ // session's expired token.
286
+ it("rebuilds the server's store from the config on every boot", () => __awaiter(void 0, void 0, void 0, function* () {
287
+ const running = yield boot(hostRecording());
288
+ const args = child_process_1.default.spawn.firstCall
289
+ .args[1];
290
+ (0, chai_1.expect)(args).to.include("--init");
291
+ child.exit(0);
292
+ yield running.waitForExit();
293
+ }));
294
+ // What `isOwnSessionRunning` checks alongside the config: a pid that is
295
+ // alive, so leftover files from a killed session do not read as running.
296
+ it("records the publisher's pid while it runs, and removes it on exit", () => __awaiter(void 0, void 0, void 0, function* () {
297
+ Object.defineProperty(child, "pid", { value: 424242 });
298
+ const running = yield boot(hostRecording());
299
+ const pidPath = (0, path_1.join)(workDir, supervisor_1.SESSION_PID_FILE);
300
+ (0, chai_1.expect)(fs_1.default.readFileSync(pidPath, "utf-8")).to.equal("424242\n");
301
+ child.exit(0);
302
+ yield running.waitForExit();
303
+ (0, chai_1.expect)(fs_1.default.existsSync(pidPath)).to.equal(false);
304
+ }));
305
+ it("still reports the exit code when the server dies during the browser launch", () => __awaiter(void 0, void 0, void 0, function* () {
306
+ const host = hostRecording(() => __awaiter(void 0, void 0, void 0, function* () {
307
+ child.exit(1);
308
+ yield settle();
309
+ }));
310
+ const running = yield boot(host, true);
311
+ (0, chai_1.expect)(yield running.waitForExit()).to.equal(1);
312
+ }));
313
+ it("still reports the exit code when the server dies before anyone waits", () => __awaiter(void 0, void 0, void 0, function* () {
314
+ const running = yield boot(hostRecording());
315
+ child.exit(3);
316
+ yield settle();
317
+ (0, chai_1.expect)(yield running.waitForExit()).to.equal(3);
318
+ }));
319
+ it("resolves normally for a server that exits while being waited on", () => __awaiter(void 0, void 0, void 0, function* () {
320
+ const running = yield boot(hostRecording());
321
+ const waiting = running.waitForExit();
322
+ child.exit(0);
323
+ (0, chai_1.expect)(yield waiting).to.equal(0);
324
+ }));
325
+ /** Exit without `close`: the server is gone, its stdio is still open. */
326
+ function exitWithoutClose(code) {
327
+ child.exitCode = code;
328
+ child.emit("exit", code);
329
+ }
330
+ it("waits for the log file to close before reporting the exit", () => __awaiter(void 0, void 0, void 0, function* () {
331
+ const running = yield boot(hostRecording());
332
+ let exited;
333
+ const waiting = running.waitForExit().then((code) => {
334
+ exited = code;
335
+ return code;
336
+ });
337
+ exitWithoutClose(0);
338
+ child.stdout.write("info: shut down\n");
339
+ yield settle();
340
+ yield settle();
341
+ (0, chai_1.expect)(exited).to.equal(undefined);
342
+ child.emit("close", 0, null);
343
+ (0, chai_1.expect)(yield waiting).to.equal(0);
344
+ const log = fs_1.default.readFileSync((0, supervisor_1.publisherLogPath)(workDir), "utf-8");
345
+ (0, chai_1.expect)(log).to.contain("info: shut down");
346
+ }));
347
+ it("reports the exit after LOG_DRAIN_WAIT_MS when the log never closes", () => __awaiter(void 0, void 0, void 0, function* () {
348
+ const running = yield boot(hostRecording());
349
+ const clock = sinon_1.default.useFakeTimers({
350
+ toFake: ["setTimeout", "clearTimeout"],
351
+ });
352
+ try {
353
+ let exited;
354
+ void running.waitForExit().then((code) => {
355
+ exited = code;
356
+ });
357
+ exitWithoutClose(2);
358
+ yield clock.tickAsync(supervisor_1.LOG_DRAIN_WAIT_MS - 1);
359
+ (0, chai_1.expect)(exited).to.equal(undefined);
360
+ yield clock.tickAsync(1);
361
+ (0, chai_1.expect)(exited).to.equal(2);
362
+ }
363
+ finally {
364
+ clock.restore();
365
+ }
366
+ }));
367
+ // stdout and stderr are independent, unordered streams. Sharing one buffer
368
+ // between them lets an stderr write splice into the middle of a readiness
369
+ // line that arrived in two stdout chunks: the first half still carries the
370
+ // `PUBLISHER_READY` marker but has lost `environments=`, so the parse
371
+ // returns undefined and the verdict is never reached. The server then dies
372
+ // on the 120s boot timeout despite having come up fine — intermittently,
373
+ // and only on machines where the chunks land that way.
374
+ // SIGTERM alone left a wedged publisher running and `waitUntilStopped`
375
+ // blocked on it — a second Ctrl-C only re-sent SIGTERM, so the way out was
376
+ // killing the CLI from another tab, which is the one path that skips the
377
+ // config cleanup and leaves a token on disk.
378
+ it("escalates to SIGKILL when the publisher ignores SIGTERM", () => __awaiter(void 0, void 0, void 0, function* () {
379
+ const clock = sinon_1.default.useFakeTimers({
380
+ toFake: ["setTimeout", "clearTimeout"],
381
+ });
382
+ try {
383
+ const host = hostRecording();
384
+ const running = yield boot(host);
385
+ running.stop();
386
+ (0, chai_1.expect)(child.signals).to.eql(["SIGTERM"]);
387
+ clock.tick(5000);
388
+ (0, chai_1.expect)(child.signals).to.eql(["SIGTERM", "SIGKILL"]);
389
+ (0, chai_1.expect)(host.logs.join("\n")).to.contain("did not stop within 5s");
390
+ }
391
+ finally {
392
+ clock.restore();
393
+ }
394
+ }));
395
+ it("does not send SIGKILL to a publisher that stopped when asked", () => __awaiter(void 0, void 0, void 0, function* () {
396
+ const clock = sinon_1.default.useFakeTimers({
397
+ toFake: ["setTimeout", "clearTimeout"],
398
+ });
399
+ try {
400
+ const running = yield boot(hostRecording());
401
+ running.stop();
402
+ child.exit(0);
403
+ clock.tick(60000);
404
+ (0, chai_1.expect)(child.signals).to.eql(["SIGTERM"]);
405
+ }
406
+ finally {
407
+ clock.restore();
408
+ }
409
+ }));
410
+ it("does not stack a second escalation when stopped twice", () => __awaiter(void 0, void 0, void 0, function* () {
411
+ const clock = sinon_1.default.useFakeTimers({
412
+ toFake: ["setTimeout", "clearTimeout"],
413
+ });
414
+ try {
415
+ const running = yield boot(hostRecording());
416
+ running.stop();
417
+ running.stop();
418
+ clock.tick(5000);
419
+ // Two SIGTERMs (one per Ctrl-C) but only ever one SIGKILL.
420
+ (0, chai_1.expect)(child.signals).to.eql(["SIGTERM", "SIGTERM", "SIGKILL"]);
421
+ }
422
+ finally {
423
+ clock.restore();
424
+ }
425
+ }));
426
+ it("reads a readiness line split across chunks with stderr interleaved", () => __awaiter(void 0, void 0, void 0, function* () {
427
+ const host = hostRecording();
428
+ const started = (0, supervisor_1.startPublisher)(options(host, false));
429
+ yield settle();
430
+ child.stdout.write("PUBLISHER_READY url=http://127.0.0.1:4000 mcp=http://127.0.0.1:4040 envir");
431
+ yield settle();
432
+ child.stderr.write("warn: a package took a while to load\n");
433
+ yield settle();
434
+ child.stdout.write("onments=1 packages=1 load_errors=0\n");
435
+ const running = yield started;
436
+ (0, chai_1.expect)(running.mcpUrl).to.equal("http://127.0.0.1:4040/mcp");
437
+ }));
438
+ it("fails on an init failure written to stderr once the log is complete", () => __awaiter(void 0, void 0, void 0, function* () {
439
+ const host = hostRecording();
440
+ const started = (0, supervisor_1.startPublisher)(options(host, false));
441
+ let failure;
442
+ started.catch((error) => {
443
+ failure = error;
444
+ });
445
+ yield settle();
446
+ child.stdout.write("info: loading ");
447
+ yield settle();
448
+ child.stderr.write('PUBLISHER_INIT_FAILED error="connection duckdb is reserved"\n');
449
+ yield settle();
450
+ // Not thrown while the server is still stopping and writing.
451
+ (0, chai_1.expect)(failure).to.equal(undefined);
452
+ (0, chai_1.expect)(child.signals).to.eql(["SIGTERM"]);
453
+ child.stderr.write("info: closing connections\n");
454
+ child.exit(null, "SIGTERM");
455
+ yield (0, chai_1.expect)(started).to.be.rejectedWith("duckdb is reserved");
456
+ const log = fs_1.default.readFileSync((0, supervisor_1.publisherLogPath)(workDir), "utf-8");
457
+ (0, chai_1.expect)(log).to.contain("PUBLISHER_INIT_FAILED");
458
+ (0, chai_1.expect)(log).to.contain("info: closing connections");
459
+ }));
460
+ it("does not wait past LOG_DRAIN_WAIT_MS for a server that will not close", () => __awaiter(void 0, void 0, void 0, function* () {
461
+ const clock = sinon_1.default.useFakeTimers({
462
+ toFake: ["setTimeout", "clearTimeout"],
463
+ });
464
+ try {
465
+ const started = (0, supervisor_1.startPublisher)(options(hostRecording(), false));
466
+ let failure;
467
+ started.catch((error) => {
468
+ failure = error;
469
+ });
470
+ yield settle();
471
+ child.stderr.write('PUBLISHER_INIT_FAILED error="bad config"\n');
472
+ yield settle();
473
+ yield clock.tickAsync(supervisor_1.LOG_DRAIN_WAIT_MS - 1);
474
+ (0, chai_1.expect)(failure).to.equal(undefined);
475
+ yield clock.tickAsync(1);
476
+ (0, chai_1.expect)(failure === null || failure === void 0 ? void 0 : failure.message).to.contain("bad config");
477
+ }
478
+ finally {
479
+ clock.restore();
480
+ }
481
+ }));
482
+ /** A host whose Ctrl-C the test presses, recording the subscription. */
483
+ function interruptibleHost() {
484
+ let handler;
485
+ return Object.assign(Object.assign({}, hostRecording()), { onInterrupt(h) {
486
+ handler = h;
487
+ return () => {
488
+ handler = undefined;
489
+ };
490
+ }, interrupt: () => handler === null || handler === void 0 ? void 0 : handler(), subscribed: () => handler !== undefined });
491
+ }
492
+ // The child runs in its own process group, so a terminal Ctrl-C reaches
493
+ // only the CLI. Unhandled, Node's default exit left the publisher serving on
494
+ // both ports with the live-token config on disk — and the boot wait, up to
495
+ // two minutes, is exactly when people press Ctrl-C.
496
+ it("stops the publisher and removes its token file when interrupted before it is ready", () => __awaiter(void 0, void 0, void 0, function* () {
497
+ const host = interruptibleHost();
498
+ const opts = options(host, false);
499
+ const started = (0, supervisor_1.startPublisher)(opts);
500
+ yield settle();
501
+ (0, chai_1.expect)(fs_1.default.existsSync(opts.configPath), "config written at spawn").to.equal(true);
502
+ host.interrupt();
503
+ (0, chai_1.expect)(child.signals).to.eql(["SIGTERM"]);
504
+ child.exit(null, "SIGTERM");
505
+ try {
506
+ yield started;
507
+ chai_1.expect.fail("expected the boot to be abandoned");
508
+ }
509
+ catch (error) {
510
+ (0, chai_1.expect)(error.message).to.equal("Stopped before the local Publisher was ready. It has been shut down.");
511
+ }
512
+ (0, chai_1.expect)(fs_1.default.existsSync(opts.configPath)).to.equal(false);
513
+ }));
514
+ it("stops a running session on interrupt, and lets go of the signal once it exits", () => __awaiter(void 0, void 0, void 0, function* () {
515
+ const host = interruptibleHost();
516
+ const running = yield boot(host);
517
+ (0, chai_1.expect)(host.subscribed()).to.equal(true);
518
+ host.interrupt();
519
+ (0, chai_1.expect)(child.signals).to.eql(["SIGTERM"]);
520
+ child.exit(null, "SIGTERM");
521
+ (0, chai_1.expect)(yield running.waitForExit()).to.equal(null);
522
+ // Unsubscribed: a later Ctrl-C gets the host's default, not a handler
523
+ // signalling a pid that is gone.
524
+ (0, chai_1.expect)(host.subscribed()).to.equal(false);
525
+ }));
526
+ });
527
+ /**
528
+ * The renewal loop's two signals are different facts: the token on disk is
529
+ * fresh, and the running server has read it. A renewal that wrote a fresh token
530
+ * but could not get the server to reload it leaves the first true and the second
531
+ * false — and the expiry check alone would not look again until the new token
532
+ * neared its own expiry, while queries failed on the old one.
533
+ */
534
+ describe("startTokenLoop", () => {
535
+ let workDir;
536
+ let clock;
537
+ beforeEach(() => {
538
+ workDir = fs_1.default.mkdtempSync((0, path_1.join)(os_1.default.tmpdir(), "token-loop-"));
539
+ clock = sinon_1.default.useFakeTimers({ toFake: ["setInterval", "clearInterval"] });
540
+ sinon_1.default.stub(refresh, "ensureFreshTokens").resolves({ status: "fresh" });
541
+ });
542
+ afterEach(() => {
543
+ clock.restore();
544
+ sinon_1.default.restore();
545
+ fs_1.default.rmSync(workDir, { recursive: true, force: true });
546
+ });
547
+ const ENDPOINTS = {
548
+ mcpUrl: "http://127.0.0.1:4040/mcp",
549
+ apiUrl: "http://127.0.0.1:4000",
550
+ };
551
+ function loopOptions(secondsLeft, connections = [], store = {}) {
552
+ var _a;
553
+ const host = hostRecording();
554
+ const opts = {
555
+ directory: workDir,
556
+ serverRoot: workDir,
557
+ configPath: (0, path_1.join)(workDir, "publisher.config.json"),
558
+ config: {
559
+ frozenConfig: false,
560
+ environments: [
561
+ {
562
+ name: "default",
563
+ packages: [{ name: "shop", location: workDir }],
564
+ connections,
565
+ },
566
+ ],
567
+ },
568
+ uiPort: 4000,
569
+ mcpPort: 4040,
570
+ watchEnvironment: "default",
571
+ publisherVersion: "0.0.248",
572
+ host,
573
+ credStore: {
574
+ secondsUntilExpiry: secondsLeft,
575
+ getApiAccessToken: (_a = store.token) !== null && _a !== void 0 ? _a : (() => "fresh-token"),
576
+ isTokenValid: () => { var _a, _b; return ({ valid: (_b = (_a = store.valid) === null || _a === void 0 ? void 0 : _a.call(store)) !== null && _b !== void 0 ? _b : true }); },
577
+ },
578
+ openBrowser: false,
579
+ };
580
+ return { host, opts };
581
+ }
582
+ it("retries a reload that failed after a renewal, on the next tick, until it lands", () => __awaiter(void 0, void 0, void 0, function* () {
583
+ // Due once; after the renewal the token on disk has hours left.
584
+ let secondsLeft = 60;
585
+ const { host, opts } = loopOptions(() => secondsLeft);
586
+ const fetchStub = sinon_1.default.stub(globalThis, "fetch");
587
+ fetchStub.onCall(0).rejects(new Error("connect ECONNREFUSED"));
588
+ fetchStub.onCall(1).rejects(new Error("connect ECONNREFUSED"));
589
+ fetchStub.onCall(2).resolves(new Response("{}", { status: 200 }));
590
+ const child = new FakeChild();
591
+ (0, supervisor_1.startTokenLoop)(opts, child, ENDPOINTS, "boot-token");
592
+ yield clock.tickAsync(supervisor_1.TOKEN_CHECK_INTERVAL_MS);
593
+ secondsLeft = 7200;
594
+ (0, chai_1.expect)(fetchStub.callCount, "the renewal's reload").to.equal(1);
595
+ (0, chai_1.expect)(host.logs.join("\n")).to.contain("Retrying every minute");
596
+ yield clock.tickAsync(supervisor_1.TOKEN_CHECK_INTERVAL_MS);
597
+ (0, chai_1.expect)(fetchStub.callCount, "retried although the token is fresh").to.equal(2);
598
+ yield clock.tickAsync(supervisor_1.TOKEN_CHECK_INTERVAL_MS);
599
+ (0, chai_1.expect)(fetchStub.callCount).to.equal(3);
600
+ (0, chai_1.expect)(host.logs.join("\n")).to.contain("The publisher is using the renewed warehouse token.");
601
+ // Landed: nothing more until the token is due again.
602
+ yield clock.tickAsync(supervisor_1.TOKEN_CHECK_INTERVAL_MS * 3);
603
+ (0, chai_1.expect)(fetchStub.callCount).to.equal(3);
604
+ child.exit(0);
605
+ }));
606
+ // `reload_package` recompiles against the connections the server already
607
+ // holds, so on its own it answered 200 and the old token stayed live. The
608
+ // connection update is what swaps the credential.
609
+ it("puts the renewed token into each publisher connection before reloading", () => __awaiter(void 0, void 0, void 0, function* () {
610
+ const { host, opts } = loopOptions(() => 60, [
611
+ {
612
+ name: "credible",
613
+ type: "publisher",
614
+ publisherConnection: { connectionUri: "https://dp/api/v0" },
615
+ },
616
+ { name: "local", type: "duckdb" },
617
+ ]);
618
+ const fetchStub = sinon_1.default
619
+ .stub(globalThis, "fetch")
620
+ .callsFake(() => __awaiter(void 0, void 0, void 0, function* () { return new Response("{}", { status: 200 }); }));
621
+ const child = new FakeChild();
622
+ (0, supervisor_1.startTokenLoop)(opts, child, ENDPOINTS, "boot-token");
623
+ yield clock.tickAsync(supervisor_1.TOKEN_CHECK_INTERVAL_MS);
624
+ (0, chai_1.expect)(fetchStub.callCount, "one update, then one reload").to.equal(2);
625
+ const [updateUrl, update] = fetchStub.firstCall.args;
626
+ (0, chai_1.expect)(updateUrl).to.equal("http://127.0.0.1:4000/api/v0/environments/default/connections/credible");
627
+ (0, chai_1.expect)(update.method).to.equal("PATCH");
628
+ (0, chai_1.expect)(JSON.parse(String(update.body))).to.eql({
629
+ publisherConnection: {
630
+ connectionUri: "https://dp/api/v0",
631
+ accessToken: "fresh-token",
632
+ },
633
+ });
634
+ (0, chai_1.expect)(fetchStub.secondCall.args[0]).to.equal(ENDPOINTS.mcpUrl);
635
+ (0, chai_1.expect)(host.logs).to.include("info: Renewed the warehouse token.");
636
+ child.exit(0);
637
+ }));
638
+ it("does not report a renewal the server refused", () => __awaiter(void 0, void 0, void 0, function* () {
639
+ let secondsLeft = 60;
640
+ const { host, opts } = loopOptions(() => secondsLeft, [
641
+ {
642
+ name: "credible",
643
+ type: "publisher",
644
+ publisherConnection: { connectionUri: "https://dp/api/v0" },
645
+ },
646
+ ]);
647
+ const fetchStub = sinon_1.default
648
+ .stub(globalThis, "fetch")
649
+ .resolves(new Response("{}", { status: 409 }));
650
+ const child = new FakeChild();
651
+ (0, supervisor_1.startTokenLoop)(opts, child, ENDPOINTS, "boot-token");
652
+ yield clock.tickAsync(supervisor_1.TOKEN_CHECK_INTERVAL_MS);
653
+ secondsLeft = 7200;
654
+ (0, chai_1.expect)(fetchStub.callCount, "no reload after a refused update").to.equal(1);
655
+ (0, chai_1.expect)(host.logs.join("\n")).to.not.contain("Renewed the warehouse token.");
656
+ (0, chai_1.expect)(host.logs.join("\n")).to.contain("updating connection credible returned HTTP 409");
657
+ child.exit(0);
658
+ }));
659
+ // Nothing awaits the tick, so a throw became an unhandled rejection and the
660
+ // CLI's handler for those exited: the publisher kept running with its token
661
+ // file on disk.
662
+ it("skips a tick whose token check throws, and keeps checking", () => __awaiter(void 0, void 0, void 0, function* () {
663
+ let calls = 0;
664
+ const { host, opts } = loopOptions(() => {
665
+ calls += 1;
666
+ if (calls === 1)
667
+ throw new Error("~/.cred is not valid JSON");
668
+ return 7200;
669
+ });
670
+ const unhandled = sinon_1.default.spy();
671
+ process.on("unhandledRejection", unhandled);
672
+ const child = new FakeChild();
673
+ try {
674
+ (0, supervisor_1.startTokenLoop)(opts, child, ENDPOINTS, "fresh-token");
675
+ yield clock.tickAsync(supervisor_1.TOKEN_CHECK_INTERVAL_MS);
676
+ yield new Promise((resolve) => setImmediate(resolve));
677
+ (0, chai_1.expect)(unhandled.called).to.equal(false);
678
+ (0, chai_1.expect)(host.logs).to.include("warn: Could not check the warehouse token: ~/.cred is not valid JSON. Trying again in a minute.");
679
+ yield clock.tickAsync(supervisor_1.TOKEN_CHECK_INTERVAL_MS);
680
+ (0, chai_1.expect)(calls, "the next tick still ran").to.equal(2);
681
+ }
682
+ finally {
683
+ process.off("unhandledRejection", unhandled);
684
+ child.exit(0);
685
+ }
686
+ }));
687
+ it("does nothing while the token has life left and no reload is owed", () => __awaiter(void 0, void 0, void 0, function* () {
688
+ const { opts } = loopOptions(() => 7200);
689
+ const fetchStub = sinon_1.default.stub(globalThis, "fetch");
690
+ const child = new FakeChild();
691
+ (0, supervisor_1.startTokenLoop)(opts, child, ENDPOINTS, "fresh-token");
692
+ yield clock.tickAsync(supervisor_1.TOKEN_CHECK_INTERVAL_MS * 5);
693
+ (0, chai_1.expect)(fetchStub.called).to.equal(false);
694
+ child.exit(0);
695
+ }));
696
+ // Another `cred dev`, a `cred` command or the VS Code extension refreshed
697
+ // ~/.cred first. The token on disk then has hours left, so an expiry check
698
+ // alone never pushed it, and this server kept the old one until it 401'd.
699
+ it("pushes a token another process refreshed, although it is not due", () => __awaiter(void 0, void 0, void 0, function* () {
700
+ let onDisk = "boot-token";
701
+ const { host, opts } = loopOptions(() => 7200, [
702
+ {
703
+ name: "credible",
704
+ type: "publisher",
705
+ publisherConnection: { connectionUri: "https://dp/api/v0" },
706
+ },
707
+ ], { token: () => onDisk });
708
+ const fetchStub = sinon_1.default
709
+ .stub(globalThis, "fetch")
710
+ .callsFake(() => __awaiter(void 0, void 0, void 0, function* () { return new Response("{}", { status: 200 }); }));
711
+ const child = new FakeChild();
712
+ (0, supervisor_1.startTokenLoop)(opts, child, ENDPOINTS, "boot-token");
713
+ yield clock.tickAsync(supervisor_1.TOKEN_CHECK_INTERVAL_MS);
714
+ (0, chai_1.expect)(fetchStub.called, "same token as the boot").to.equal(false);
715
+ onDisk = "refreshed-elsewhere";
716
+ yield clock.tickAsync(supervisor_1.TOKEN_CHECK_INTERVAL_MS);
717
+ (0, chai_1.expect)(fetchStub.callCount, "one update, then one reload").to.equal(2);
718
+ (0, chai_1.expect)(JSON.parse(String(fetchStub.firstCall.args[1].body))).to.eql({
719
+ publisherConnection: {
720
+ connectionUri: "https://dp/api/v0",
721
+ accessToken: "refreshed-elsewhere",
722
+ },
723
+ });
724
+ (0, chai_1.expect)(host.logs).to.include("info: Renewed the warehouse token.");
725
+ yield clock.tickAsync(supervisor_1.TOKEN_CHECK_INTERVAL_MS * 3);
726
+ (0, chai_1.expect)(fetchStub.callCount, "nothing more once it is applied").to.equal(2);
727
+ child.exit(0);
728
+ }));
729
+ // Auth0 unreachable while the token still works: say so once, hand the
730
+ // server nothing (it already has this token), and never claim a renewal.
731
+ it("warns once and pushes nothing while offline with a valid token", () => __awaiter(void 0, void 0, void 0, function* () {
732
+ refresh.ensureFreshTokens.resolves({
733
+ status: "offline",
734
+ reason: "Could not reach auth.example.",
735
+ });
736
+ const { host, opts } = loopOptions(() => 60, [], {
737
+ token: () => "boot-token",
738
+ });
739
+ const fetchStub = sinon_1.default.stub(globalThis, "fetch");
740
+ const child = new FakeChild();
741
+ (0, supervisor_1.startTokenLoop)(opts, child, ENDPOINTS, "boot-token");
742
+ yield clock.tickAsync(supervisor_1.TOKEN_CHECK_INTERVAL_MS * 3);
743
+ (0, chai_1.expect)(fetchStub.called).to.equal(false);
744
+ (0, chai_1.expect)(host.logs).to.eql([
745
+ "warn: Could not reach auth.example. Continuing with the token on disk.",
746
+ ]);
747
+ child.exit(0);
748
+ }));
749
+ it("says to run cred login, once, when offline and the token has expired", () => __awaiter(void 0, void 0, void 0, function* () {
750
+ refresh.ensureFreshTokens.resolves({
751
+ status: "offline",
752
+ reason: "Could not reach auth.example.",
753
+ });
754
+ const { host, opts } = loopOptions(() => -30, [], {
755
+ token: () => "boot-token",
756
+ valid: () => false,
757
+ });
758
+ const fetchStub = sinon_1.default.stub(globalThis, "fetch");
759
+ const child = new FakeChild();
760
+ (0, supervisor_1.startTokenLoop)(opts, child, ENDPOINTS, "boot-token");
761
+ yield clock.tickAsync(supervisor_1.TOKEN_CHECK_INTERVAL_MS * 3);
762
+ (0, chai_1.expect)(fetchStub.called).to.equal(false);
763
+ (0, chai_1.expect)(host.logs).to.eql([
764
+ "warn: Could not renew the warehouse token: Could not reach auth.example. The token on disk has expired. Queries may start failing until you run `cred login`.",
765
+ ]);
766
+ child.exit(0);
767
+ }));
768
+ // MCP reports a failed tool call as HTTP 200 with `result.isError`.
769
+ it("treats a reload the tool reported as failed as a failure, and retries it", () => __awaiter(void 0, void 0, void 0, function* () {
770
+ const { host, opts } = loopOptions(() => 60);
771
+ const fetchStub = sinon_1.default.stub(globalThis, "fetch");
772
+ fetchStub.onCall(0).callsFake(() => __awaiter(void 0, void 0, void 0, function* () {
773
+ return new Response(JSON.stringify({
774
+ jsonrpc: "2.0",
775
+ id: 1,
776
+ result: {
777
+ isError: true,
778
+ content: [
779
+ { type: "text", text: "Package shop not found" },
780
+ ],
781
+ },
782
+ }), { status: 200, headers: { "Content-Type": "application/json" } });
783
+ }));
784
+ fetchStub.onCall(1).callsFake(() => __awaiter(void 0, void 0, void 0, function* () { return new Response("{}"); }));
785
+ const child = new FakeChild();
786
+ (0, supervisor_1.startTokenLoop)(opts, child, ENDPOINTS, "boot-token");
787
+ yield clock.tickAsync(supervisor_1.TOKEN_CHECK_INTERVAL_MS);
788
+ (0, chai_1.expect)(host.logs.join("\n")).to.contain("could not hand it to the publisher: reload of shop failed: Package shop not found");
789
+ (0, chai_1.expect)(host.logs.join("\n")).to.not.contain("Renewed the warehouse token.");
790
+ yield clock.tickAsync(supervisor_1.TOKEN_CHECK_INTERVAL_MS);
791
+ (0, chai_1.expect)(fetchStub.callCount, "retried").to.equal(2);
792
+ (0, chai_1.expect)(host.logs).to.include("info: The publisher is using the renewed warehouse token.");
793
+ child.exit(0);
794
+ }));
795
+ });
796
+ describe("toolCallFailure", () => {
797
+ it("reads an error out of a server-sent-events frame", () => {
798
+ const body = 'event: message\ndata: {"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"Unknown tool: reload_package"}}\n\n';
799
+ (0, chai_1.expect)((0, supervisor_1.toolCallFailure)("text/event-stream", body)).to.equal("Unknown tool: reload_package");
800
+ });
801
+ it("passes a result that is not flagged as an error", () => {
802
+ const body = 'data: {"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","text":"ok"}]}}\n';
803
+ (0, chai_1.expect)((0, supervisor_1.toolCallFailure)("text/event-stream", body)).to.equal(undefined);
804
+ });
805
+ it("skips a blank data: line, a keep-alive rather than a reply", () => {
806
+ const body = 'data:\n\ndata: {"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","text":"ok"}]}}\n';
807
+ (0, chai_1.expect)((0, supervisor_1.toolCallFailure)("text/event-stream", body)).to.equal(undefined);
808
+ });
809
+ it("counts a body it cannot read as a failure", () => {
810
+ (0, chai_1.expect)((0, supervisor_1.toolCallFailure)("application/json", "<html>")).to.equal("the server sent a response that could not be read");
811
+ });
812
+ });
813
+ // Not exercised on Windows here: these pin the command it would run.
814
+ describe("npxLauncher", () => {
815
+ it("runs npx directly where it is an executable", () => {
816
+ (0, chai_1.expect)((0, supervisor_1.npxLauncher)("darwin", "/usr/local/bin/node")).to.eql({
817
+ command: "npx",
818
+ args: [],
819
+ });
820
+ });
821
+ it("runs npx's script with the running node on Windows", () => {
822
+ const execPath = (0, path_1.join)("C:", "Program Files", "nodejs", "node.exe");
823
+ const script = (0, path_1.join)("C:", "Program Files", "nodejs", "node_modules", "npm", "bin", "npx-cli.js");
824
+ (0, chai_1.expect)((0, supervisor_1.npxLauncher)("win32", execPath, (file) => file === script)).to.eql({
825
+ command: execPath,
826
+ args: [script],
827
+ });
828
+ });
829
+ it("refuses clearly on Windows when npx is not beside node", () => {
830
+ (0, chai_1.expect)(() => (0, supervisor_1.npxLauncher)("win32", "C:/node/node.exe", () => false)).to.throw(/Could not find npx next to C:\/node\/node.exe/);
831
+ });
832
+ });
833
+ //# sourceMappingURL=supervisor.spec.js.map