@supatype/cli 0.1.7 → 0.1.9

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 (404) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-test.log +128 -128
  3. package/.turbo/turbo-typecheck.log +1 -1
  4. package/LICENSE +202 -0
  5. package/deno.d.ts +1 -1
  6. package/dist/app/framework.js +1 -1
  7. package/dist/app/framework.js.map +1 -1
  8. package/dist/augmentation-generator.d.ts +1 -1
  9. package/dist/augmentation-generator.js +3 -3
  10. package/dist/augmentation-generator.js.map +1 -1
  11. package/dist/binary-cache.d.ts +30 -8
  12. package/dist/binary-cache.d.ts.map +1 -1
  13. package/dist/binary-cache.js +47 -35
  14. package/dist/binary-cache.js.map +1 -1
  15. package/dist/cache-pins.d.ts +1 -1
  16. package/dist/cache-pins.js +2 -2
  17. package/dist/cache-pins.js.map +1 -1
  18. package/dist/cli-artifacts.d.ts +32 -0
  19. package/dist/cli-artifacts.d.ts.map +1 -0
  20. package/dist/cli-artifacts.js +49 -0
  21. package/dist/cli-artifacts.js.map +1 -0
  22. package/dist/cli-install-method.d.ts +9 -1
  23. package/dist/cli-install-method.d.ts.map +1 -1
  24. package/dist/cli-install-method.js +22 -4
  25. package/dist/cli-install-method.js.map +1 -1
  26. package/dist/cli-package-version.d.ts +1 -1
  27. package/dist/cli-package-version.d.ts.map +1 -1
  28. package/dist/cli-package-version.js +6 -1
  29. package/dist/cli-package-version.js.map +1 -1
  30. package/dist/cli-standalone.d.ts +13 -4
  31. package/dist/cli-standalone.d.ts.map +1 -1
  32. package/dist/cli-standalone.js +86 -31
  33. package/dist/cli-standalone.js.map +1 -1
  34. package/dist/cli-version-embedded.d.ts +10 -0
  35. package/dist/cli-version-embedded.d.ts.map +1 -0
  36. package/dist/cli-version-embedded.js +13 -0
  37. package/dist/cli-version-embedded.js.map +1 -0
  38. package/dist/cli.js +1 -1
  39. package/dist/cli.js.map +1 -1
  40. package/dist/commands/add.js +1 -1
  41. package/dist/commands/add.js.map +1 -1
  42. package/dist/commands/admin.js +6 -6
  43. package/dist/commands/admin.js.map +1 -1
  44. package/dist/commands/adopt.js +1 -1
  45. package/dist/commands/adopt.js.map +1 -1
  46. package/dist/commands/app.js +2 -2
  47. package/dist/commands/app.js.map +1 -1
  48. package/dist/commands/cache.d.ts +1 -1
  49. package/dist/commands/cache.js +3 -3
  50. package/dist/commands/cache.js.map +1 -1
  51. package/dist/commands/db.d.ts +3 -3
  52. package/dist/commands/db.js +9 -9
  53. package/dist/commands/db.js.map +1 -1
  54. package/dist/commands/deploy.d.ts +9 -9
  55. package/dist/commands/deploy.js +12 -12
  56. package/dist/commands/deploy.js.map +1 -1
  57. package/dist/commands/dev.d.ts +3 -3
  58. package/dist/commands/dev.js +17 -17
  59. package/dist/commands/dev.js.map +1 -1
  60. package/dist/commands/doctor.d.ts +1 -1
  61. package/dist/commands/doctor.js +3 -3
  62. package/dist/commands/doctor.js.map +1 -1
  63. package/dist/commands/engine.d.ts +1 -1
  64. package/dist/commands/engine.js +1 -1
  65. package/dist/commands/functions.js +5 -5
  66. package/dist/commands/functions.js.map +1 -1
  67. package/dist/commands/hooks.d.ts +2 -2
  68. package/dist/commands/hooks.js +4 -4
  69. package/dist/commands/hooks.js.map +1 -1
  70. package/dist/commands/init.js +28 -28
  71. package/dist/commands/init.js.map +1 -1
  72. package/dist/commands/login.d.ts +1 -1
  73. package/dist/commands/login.js +1 -1
  74. package/dist/commands/login.js.map +1 -1
  75. package/dist/commands/logs.d.ts +1 -1
  76. package/dist/commands/migrate.js +5 -5
  77. package/dist/commands/migrate.js.map +1 -1
  78. package/dist/commands/pg.d.ts +1 -1
  79. package/dist/commands/pg.js +1 -1
  80. package/dist/commands/plugins.js +1 -1
  81. package/dist/commands/plugins.js.map +1 -1
  82. package/dist/commands/pull.js +2 -2
  83. package/dist/commands/pull.js.map +1 -1
  84. package/dist/commands/push.js +3 -3
  85. package/dist/commands/push.js.map +1 -1
  86. package/dist/commands/self-host.d.ts +1 -1
  87. package/dist/commands/self-host.js +1 -1
  88. package/dist/commands/self-update.d.ts +2 -8
  89. package/dist/commands/self-update.d.ts.map +1 -1
  90. package/dist/commands/self-update.js +20 -12
  91. package/dist/commands/self-update.js.map +1 -1
  92. package/dist/commands/status.d.ts +1 -1
  93. package/dist/commands/update.d.ts +1 -1
  94. package/dist/commands/update.js +1 -1
  95. package/dist/config.d.ts +1 -1
  96. package/dist/config.d.ts.map +1 -1
  97. package/dist/config.js +3 -3
  98. package/dist/config.js.map +1 -1
  99. package/dist/db-preflight.d.ts +4 -4
  100. package/dist/db-preflight.js +14 -14
  101. package/dist/db-preflight.js.map +1 -1
  102. package/dist/dev-compose.d.ts +3 -3
  103. package/dist/dev-compose.js +27 -27
  104. package/dist/dev-compose.js.map +1 -1
  105. package/dist/dev-log-filter.d.ts +1 -1
  106. package/dist/dev-log-filter.d.ts.map +1 -1
  107. package/dist/dev-log-filter.js +1 -1
  108. package/dist/dev-log-filter.js.map +1 -1
  109. package/dist/dev-ports.d.ts +2 -2
  110. package/dist/dev-ports.d.ts.map +1 -1
  111. package/dist/dev-ports.js +2 -2
  112. package/dist/dev-ports.js.map +1 -1
  113. package/dist/dev-session.d.ts +5 -5
  114. package/dist/dev-session.d.ts.map +1 -1
  115. package/dist/dev-session.js +6 -6
  116. package/dist/dev-session.js.map +1 -1
  117. package/dist/dev-shutdown.d.ts +5 -5
  118. package/dist/dev-shutdown.d.ts.map +1 -1
  119. package/dist/dev-shutdown.js +7 -7
  120. package/dist/dev-shutdown.js.map +1 -1
  121. package/dist/dev-task-colors.d.ts +1 -1
  122. package/dist/dev-task-colors.d.ts.map +1 -1
  123. package/dist/dev-task-colors.js +1 -1
  124. package/dist/dev-task-colors.js.map +1 -1
  125. package/dist/docker-postgres.d.ts +5 -5
  126. package/dist/docker-postgres.d.ts.map +1 -1
  127. package/dist/docker-postgres.js +5 -5
  128. package/dist/docker-postgres.js.map +1 -1
  129. package/dist/docker-runtime.d.ts +2 -2
  130. package/dist/docker-runtime.d.ts.map +1 -1
  131. package/dist/docker-runtime.js +5 -5
  132. package/dist/docker-runtime.js.map +1 -1
  133. package/dist/engine-client.d.ts +1 -1
  134. package/dist/engine-client.js +3 -3
  135. package/dist/engine-client.js.map +1 -1
  136. package/dist/engine-push-output.js +1 -1
  137. package/dist/engine-push-output.js.map +1 -1
  138. package/dist/ensure-binary.d.ts.map +1 -1
  139. package/dist/ensure-binary.js +17 -0
  140. package/dist/ensure-binary.js.map +1 -1
  141. package/dist/ensure-component-binaries.js +1 -1
  142. package/dist/ensure-component-binaries.js.map +1 -1
  143. package/dist/env-file.d.ts +2 -2
  144. package/dist/env-file.d.ts.map +1 -1
  145. package/dist/env-file.js +1 -1
  146. package/dist/env-file.js.map +1 -1
  147. package/dist/field-masking-tier.d.ts +5 -5
  148. package/dist/field-masking-tier.d.ts.map +1 -1
  149. package/dist/field-masking-tier.js +6 -6
  150. package/dist/field-masking-tier.js.map +1 -1
  151. package/dist/functions-deno-types.d.ts +1 -1
  152. package/dist/functions-deno-types.d.ts.map +1 -1
  153. package/dist/functions-deno-types.js +3 -3
  154. package/dist/functions-deno-types.js.map +1 -1
  155. package/dist/functions-router-gen.js +1 -1
  156. package/dist/gitignore.d.ts +2 -2
  157. package/dist/gitignore.d.ts.map +1 -1
  158. package/dist/gitignore.js +3 -3
  159. package/dist/gitignore.js.map +1 -1
  160. package/dist/hook-upload.d.ts +1 -1
  161. package/dist/hook-upload.js +3 -3
  162. package/dist/hooks-generator.d.ts +1 -1
  163. package/dist/hooks-generator.js +9 -9
  164. package/dist/index.d.ts +1 -1
  165. package/dist/index.js +1 -1
  166. package/dist/init-project-detect.d.ts +1 -1
  167. package/dist/init-project-detect.d.ts.map +1 -1
  168. package/dist/init-project-detect.js +1 -1
  169. package/dist/init-project-detect.js.map +1 -1
  170. package/dist/link.d.ts +1 -1
  171. package/dist/link.d.ts.map +1 -1
  172. package/dist/local-secrets.d.ts +5 -5
  173. package/dist/local-secrets.js +5 -5
  174. package/dist/main.d.ts +2 -0
  175. package/dist/main.d.ts.map +1 -0
  176. package/dist/main.js +20 -0
  177. package/dist/main.js.map +1 -0
  178. package/dist/model-hooks.d.ts +3 -3
  179. package/dist/model-hooks.js +4 -4
  180. package/dist/pgbouncer-userlist.d.ts +1 -1
  181. package/dist/pgbouncer-userlist.d.ts.map +1 -1
  182. package/dist/pgbouncer-userlist.js +2 -2
  183. package/dist/pgbouncer-userlist.js.map +1 -1
  184. package/dist/postgres-ctl.d.ts +1 -1
  185. package/dist/postgres-ctl.js +4 -4
  186. package/dist/postgres-ctl.js.map +1 -1
  187. package/dist/process-manager.d.ts +2 -2
  188. package/dist/process-manager.d.ts.map +1 -1
  189. package/dist/process-manager.js +4 -4
  190. package/dist/process-manager.js.map +1 -1
  191. package/dist/project-config.d.ts +12 -12
  192. package/dist/project-config.d.ts.map +1 -1
  193. package/dist/project-config.js +9 -9
  194. package/dist/project-config.js.map +1 -1
  195. package/dist/pull-utils.d.ts +2 -2
  196. package/dist/pull-utils.d.ts.map +1 -1
  197. package/dist/pull-utils.js +4 -4
  198. package/dist/pull-utils.js.map +1 -1
  199. package/dist/realtime-launch.js +1 -1
  200. package/dist/realtime-launch.js.map +1 -1
  201. package/dist/release-pins.d.ts +1 -1
  202. package/dist/release-pins.js +2 -2
  203. package/dist/release-pins.js.map +1 -1
  204. package/dist/resolve-api-url.js +1 -1
  205. package/dist/resolve-api-url.js.map +1 -1
  206. package/dist/resolve-target.d.ts +1 -1
  207. package/dist/resolve-target.d.ts.map +1 -1
  208. package/dist/rest-cache-admin.js +2 -2
  209. package/dist/rest-cache-admin.js.map +1 -1
  210. package/dist/runtime-routes.d.ts +1 -1
  211. package/dist/runtime-routes.js +1 -1
  212. package/dist/schema-ast-v2.d.ts +3 -3
  213. package/dist/schema-ast-v2.d.ts.map +1 -1
  214. package/dist/schema-ast-v2.js +2 -2
  215. package/dist/schema-ast-v2.js.map +1 -1
  216. package/dist/schema-push-lock.js +3 -3
  217. package/dist/schema-push-lock.js.map +1 -1
  218. package/dist/scripts/postinstall.d.ts +1 -1
  219. package/dist/scripts/postinstall.js +1 -1
  220. package/dist/self-host-compose.d.ts +5 -5
  221. package/dist/self-host-compose.d.ts.map +1 -1
  222. package/dist/self-host-compose.js +24 -24
  223. package/dist/self-host-compose.js.map +1 -1
  224. package/dist/service-role-check.js +3 -3
  225. package/dist/service-role-check.js.map +1 -1
  226. package/dist/storage-provision.d.ts +1 -1
  227. package/dist/storage-provision.js +3 -3
  228. package/dist/storage-provision.js.map +1 -1
  229. package/dist/studio-dev-server.d.ts +1 -1
  230. package/dist/studio-dev-server.d.ts.map +1 -1
  231. package/dist/systemd.d.ts +1 -1
  232. package/dist/systemd.js +1 -1
  233. package/dist/target-client.js +1 -1
  234. package/dist/target-client.js.map +1 -1
  235. package/dist/tsx-runner.js +1 -1
  236. package/dist/tsx-runner.js.map +1 -1
  237. package/dist/type-extractor.js +27 -27
  238. package/dist/type-extractor.js.map +1 -1
  239. package/dist/type-resolver.js +1 -1
  240. package/dist/type-resolver.js.map +1 -1
  241. package/dist/ui/brand.d.ts +1 -1
  242. package/dist/ui/brand.js +1 -1
  243. package/dist/ui/components/LogoWordmark.d.ts +1 -1
  244. package/dist/ui/components/LogoWordmark.d.ts.map +1 -1
  245. package/dist/ui/components/LogoWordmark.js +1 -1
  246. package/dist/ui/components/LogoWordmark.js.map +1 -1
  247. package/dist/ui/components/SelectField.js +1 -1
  248. package/dist/ui/components/SelectField.js.map +1 -1
  249. package/dist/ui/confirm.d.ts +1 -1
  250. package/dist/ui/confirm.js +1 -1
  251. package/dist/ui/fatal.d.ts +1 -1
  252. package/dist/ui/fatal.d.ts.map +1 -1
  253. package/dist/ui/fatal.js +1 -1
  254. package/dist/ui/fatal.js.map +1 -1
  255. package/dist/ui/flows/prompt-fields.js +1 -1
  256. package/dist/ui/flows/prompt-fields.js.map +1 -1
  257. package/dist/ui/interactive.d.ts +1 -1
  258. package/dist/ui/interactive.d.ts.map +1 -1
  259. package/dist/ui/interactive.js +1 -1
  260. package/dist/ui/interactive.js.map +1 -1
  261. package/dist/ui/progress.d.ts +1 -1
  262. package/dist/ui/progress.js +1 -1
  263. package/dist/ui/runtime/command-chrome.js +1 -1
  264. package/dist/ui/runtime/command-chrome.js.map +1 -1
  265. package/dist/ui/runtime/run-clack-flow.js +1 -1
  266. package/dist/ui/runtime/run-clack-flow.js.map +1 -1
  267. package/dist/ui/runtime/stdin-after-ink.js +1 -1
  268. package/dist/ui/runtime/stdin-after-ink.js.map +1 -1
  269. package/dist/ui/theme.d.ts +1 -1
  270. package/dist/ui/theme.js +1 -1
  271. package/dist/valkey-sidecar.d.ts +1 -1
  272. package/dist/valkey-sidecar.d.ts.map +1 -1
  273. package/dist/valkey-sidecar.js +2 -2
  274. package/dist/valkey-sidecar.js.map +1 -1
  275. package/package.json +3 -2
  276. package/scripts/build-release-artifacts.sh +112 -0
  277. package/scripts/generate-homebrew-formula.mjs +47 -45
  278. package/scripts/mirror-deno-release.sh +1 -1
  279. package/src/TYPE-RESOLUTION.md +31 -31
  280. package/src/app/framework.ts +1 -1
  281. package/src/augmentation-generator.ts +3 -3
  282. package/src/binary-cache.ts +51 -36
  283. package/src/cache-pins.ts +2 -2
  284. package/src/cli-artifacts.ts +65 -0
  285. package/src/cli-install-method.ts +24 -4
  286. package/src/cli-package-version.ts +5 -1
  287. package/src/cli-standalone.ts +116 -34
  288. package/src/cli-version-embedded.ts +12 -0
  289. package/src/cli.ts +1 -1
  290. package/src/commands/add.ts +1 -1
  291. package/src/commands/admin.ts +6 -6
  292. package/src/commands/adopt.ts +1 -1
  293. package/src/commands/app.ts +2 -2
  294. package/src/commands/cache.ts +3 -3
  295. package/src/commands/db.ts +9 -9
  296. package/src/commands/deploy.ts +12 -12
  297. package/src/commands/dev.ts +19 -19
  298. package/src/commands/doctor.ts +3 -3
  299. package/src/commands/engine.ts +1 -1
  300. package/src/commands/functions.ts +5 -5
  301. package/src/commands/hooks.ts +6 -6
  302. package/src/commands/init.ts +28 -28
  303. package/src/commands/login.ts +2 -2
  304. package/src/commands/logs.ts +1 -1
  305. package/src/commands/migrate.ts +5 -5
  306. package/src/commands/pg.ts +1 -1
  307. package/src/commands/plugins.ts +1 -1
  308. package/src/commands/pull.ts +2 -2
  309. package/src/commands/push.ts +3 -3
  310. package/src/commands/self-host.ts +1 -1
  311. package/src/commands/self-update.ts +23 -73
  312. package/src/commands/status.ts +1 -1
  313. package/src/commands/update.ts +1 -1
  314. package/src/config.ts +3 -3
  315. package/src/db-preflight.ts +15 -15
  316. package/src/dev-compose.ts +27 -27
  317. package/src/dev-log-filter.ts +1 -1
  318. package/src/dev-ports.ts +3 -3
  319. package/src/dev-session.ts +6 -6
  320. package/src/dev-shutdown.ts +8 -8
  321. package/src/dev-task-colors.ts +1 -1
  322. package/src/docker-postgres.ts +6 -6
  323. package/src/docker-runtime.ts +5 -5
  324. package/src/engine-client.ts +3 -3
  325. package/src/engine-push-output.ts +1 -1
  326. package/src/ensure-binary.ts +20 -0
  327. package/src/ensure-component-binaries.ts +1 -1
  328. package/src/env-file.ts +2 -2
  329. package/src/field-masking-tier.ts +6 -6
  330. package/src/functions-deno-types.ts +3 -3
  331. package/src/functions-router-gen.ts +1 -1
  332. package/src/gitignore.ts +3 -3
  333. package/src/hook-upload.ts +3 -3
  334. package/src/hooks-generator.ts +9 -9
  335. package/src/index.ts +1 -1
  336. package/src/init-project-detect.ts +1 -1
  337. package/src/link.ts +1 -1
  338. package/src/local-secrets.ts +5 -5
  339. package/src/main.ts +20 -0
  340. package/src/model-hooks.ts +4 -4
  341. package/src/pgbouncer-userlist.ts +2 -2
  342. package/src/postgres-ctl.ts +4 -4
  343. package/src/process-manager.ts +4 -4
  344. package/src/project-config.ts +16 -16
  345. package/src/pull-utils.ts +4 -4
  346. package/src/realtime-launch.ts +1 -1
  347. package/src/release-pins.ts +2 -2
  348. package/src/resolve-api-url.ts +1 -1
  349. package/src/resolve-target.ts +1 -1
  350. package/src/rest-cache-admin.ts +2 -2
  351. package/src/runtime-routes.ts +2 -2
  352. package/src/schema-ast-v2.ts +4 -4
  353. package/src/schema-push-lock.ts +3 -3
  354. package/src/scripts/postinstall.ts +1 -1
  355. package/src/self-host-compose.ts +25 -25
  356. package/src/service-role-check.ts +3 -3
  357. package/src/storage-provision.ts +3 -3
  358. package/src/studio-dev-server.ts +1 -1
  359. package/src/systemd.ts +1 -1
  360. package/src/target-client.ts +1 -1
  361. package/src/tsx-runner.ts +1 -1
  362. package/src/type-extractor.ts +27 -27
  363. package/src/type-resolver.ts +1 -1
  364. package/src/ui/README.md +1 -1
  365. package/src/ui/brand.ts +1 -1
  366. package/src/ui/components/LogoWordmark.tsx +1 -1
  367. package/src/ui/components/SelectField.tsx +1 -1
  368. package/src/ui/confirm.ts +1 -1
  369. package/src/ui/fatal.ts +1 -1
  370. package/src/ui/flows/prompt-fields.tsx +1 -1
  371. package/src/ui/interactive.ts +1 -1
  372. package/src/ui/progress.ts +1 -1
  373. package/src/ui/runtime/command-chrome.ts +1 -1
  374. package/src/ui/runtime/run-clack-flow.tsx +1 -1
  375. package/src/ui/runtime/stdin-after-ink.ts +1 -1
  376. package/src/ui/theme.ts +1 -1
  377. package/src/valkey-sidecar.ts +2 -2
  378. package/tests/access-composition.test.ts +6 -6
  379. package/tests/admin-studio-membership.test.ts +1 -1
  380. package/tests/api-schemas.test.ts +1 -1
  381. package/tests/archive-name-alias.test.ts +1 -1
  382. package/tests/cli-help.test.ts +8 -2
  383. package/tests/db-preflight.test.ts +1 -1
  384. package/tests/doctor-render.test.ts +3 -3
  385. package/tests/doctor-service-role.test.ts +2 -2
  386. package/tests/engine-push-output.test.ts +1 -1
  387. package/tests/env-file.test.ts +3 -3
  388. package/tests/external-database-compose.test.ts +5 -5
  389. package/tests/external-database-config.test.ts +2 -2
  390. package/tests/field-masking-tier.test.ts +1 -1
  391. package/tests/homebrew-formula.test.ts +68 -26
  392. package/tests/hook-upload.test.ts +1 -1
  393. package/tests/hooks-generator.test.ts +1 -1
  394. package/tests/init.test.ts +2 -2
  395. package/tests/keys.test.ts +8 -2
  396. package/tests/local-secrets.test.ts +3 -3
  397. package/tests/model-hooks.test.ts +6 -6
  398. package/tests/runtime-contract.test.ts +2 -2
  399. package/tests/service-role-check.test.ts +3 -3
  400. package/tests/storage-provision.test.ts +1 -1
  401. package/tests/type-extractor.test.ts +2 -2
  402. package/tsconfig.tsbuildinfo +1 -1
  403. package/vitest.config.ts +7 -1
  404. package/scripts/build-release-bundle.mjs +0 -27
@@ -20,7 +20,7 @@ import { apiSchemaList, validateProjectConfig, type SupatypeProjectConfig } from
20
20
  *
21
21
  * The rule is deliberately **not** "is the database external". A native `supatype dev` has no
22
22
  * extension either, and calling that tier 1 would point PostgREST at a schema whose tables the API
23
- * roles no longer hold privileges on every request denied.
23
+ * roles no longer hold privileges on, every request denied.
24
24
  */
25
25
  const project = (database: unknown, rest: Record<string, unknown> = {}): SupatypeProjectConfig =>
26
26
  validateProjectConfig(
@@ -1,4 +1,5 @@
1
1
  import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs"
2
+ import { createHash } from "node:crypto"
2
3
  import { join } from "node:path"
3
4
  import { tmpdir } from "node:os"
4
5
  import { spawnSync } from "node:child_process"
@@ -7,19 +8,36 @@ import { afterEach, beforeEach, describe, expect, it } from "vitest"
7
8
  let counter = 0
8
9
  let tmpDir: string
9
10
 
10
- const PLATFORMS = [
11
- "supatype-cli-darwin-arm64",
12
- "supatype-cli-darwin-amd64",
13
- "supatype-cli-linux-arm64",
14
- "supatype-cli-linux-amd64",
11
+ // The published artefacts: one archive per platform, plus the musl variants Homebrew does not
12
+ // use, since Homebrew on Linux is glibc.
13
+ const ARCHIVES = [
14
+ "supatype-cli-darwin-arm64.tar.gz",
15
+ "supatype-cli-darwin-amd64.tar.gz",
16
+ "supatype-cli-linux-arm64.tar.gz",
17
+ "supatype-cli-linux-amd64.tar.gz",
18
+ "supatype-cli-linux-amd64-musl.tar.gz",
19
+ "supatype-cli-windows-amd64.zip",
15
20
  ]
16
21
 
22
+ const script = () => join(import.meta.dirname, "../scripts/generate-homebrew-formula.mjs")
23
+
24
+ /** Write stub archives and the checksums manifest that build-release-artifacts.sh produces. */
25
+ function writeArtifacts(names: string[]): Record<string, string> {
26
+ const hashes: Record<string, string> = {}
27
+ const lines: string[] = []
28
+ for (const name of names) {
29
+ const body = `stub-${name}\n`
30
+ writeFileSync(join(tmpDir, name), body, "utf8")
31
+ hashes[name] = createHash("sha256").update(body).digest("hex")
32
+ lines.push(`${hashes[name]} ${name}`)
33
+ }
34
+ writeFileSync(join(tmpDir, "checksums.sha256"), lines.join("\n") + "\n", "utf8")
35
+ return hashes
36
+ }
37
+
17
38
  beforeEach(() => {
18
39
  tmpDir = join(tmpdir(), `homebrew-formula-${Date.now()}-${++counter}`)
19
40
  mkdirSync(tmpDir, { recursive: true })
20
- for (const name of PLATFORMS) {
21
- writeFileSync(join(tmpDir, name), `stub-${name}\n`, "utf8")
22
- }
23
41
  })
24
42
 
25
43
  afterEach(() => {
@@ -27,32 +45,56 @@ afterEach(() => {
27
45
  })
28
46
 
29
47
  describe("generate-homebrew-formula.mjs", () => {
30
- it("writes a Formula with versioned CDN URLs and sha256 blocks", () => {
48
+ it("points at the published archives, with the hashes from the manifest", () => {
49
+ const hashes = writeArtifacts(ARCHIVES)
31
50
  const outPath = join(tmpDir, "supatype.rb")
32
- const script = join(import.meta.dirname, "../scripts/generate-homebrew-formula.mjs")
33
- const result = spawnSync(
34
- process.execPath,
35
- [script, "9.9.9", tmpDir],
36
- {
37
- encoding: "utf8",
38
- env: { ...process.env, HOMEBREW_FORMULA_OUT: outPath },
39
- },
40
- )
51
+ const result = spawnSync(process.execPath, [script(), "9.9.9", tmpDir], {
52
+ encoding: "utf8",
53
+ env: { ...process.env, HOMEBREW_FORMULA_OUT: outPath },
54
+ })
41
55
 
42
56
  expect(result.status, result.stderr).toBe(0)
43
57
  const formula = readFileSync(outPath, "utf8")
58
+
44
59
  expect(formula).toContain('version "9.9.9"')
45
- expect(formula).toContain("https://releases.supatype.com/cli/v9.9.9/supatype-cli-darwin-arm64")
46
- expect(formula).toMatch(/sha256 "[a-f0-9]{64}"/)
60
+ expect(formula).toContain('license "Apache-2.0"')
61
+ expect(formula).toContain(
62
+ "https://releases.supatype.com/cli/v9.9.9/supatype-cli-darwin-arm64.tar.gz",
63
+ )
64
+ // The hash has to be the manifest's, not one the generator computed for itself: the manifest
65
+ // is the signed record of what was published.
66
+ expect(formula).toContain(`sha256 "${hashes["supatype-cli-darwin-arm64.tar.gz"]}"`)
67
+ // Every archive holds one executable called `supatype`, so there is no per-platform rename.
68
+ expect(formula).toContain('bin.install "supatype"')
47
69
  expect(formula).toContain('system bin/"supatype", "_postinstall"')
48
- expect(formula).toContain('bin.install "supatype-cli-#{arch}" => "supatype"')
49
70
  })
50
71
 
51
- it("fails when an artifact is missing", () => {
52
- rmSync(join(tmpDir, "supatype-cli-linux-amd64"))
53
- const script = join(import.meta.dirname, "../scripts/generate-homebrew-formula.mjs")
54
- const result = spawnSync(process.execPath, [script, "1.0.0", tmpDir], { encoding: "utf8" })
72
+ it("does not reference the musl or windows artefacts", () => {
73
+ writeArtifacts(ARCHIVES)
74
+ const outPath = join(tmpDir, "supatype.rb")
75
+ const result = spawnSync(process.execPath, [script(), "9.9.9", tmpDir], {
76
+ encoding: "utf8",
77
+ env: { ...process.env, HOMEBREW_FORMULA_OUT: outPath },
78
+ })
79
+
80
+ expect(result.status, result.stderr).toBe(0)
81
+ const formula = readFileSync(outPath, "utf8")
82
+ expect(formula).not.toContain("musl")
83
+ expect(formula).not.toContain("windows")
84
+ })
85
+
86
+ it("fails when the manifest is missing, rather than hashing the files itself", () => {
87
+ writeArtifacts(ARCHIVES)
88
+ rmSync(join(tmpDir, "checksums.sha256"))
89
+ const result = spawnSync(process.execPath, [script(), "1.0.0", tmpDir], { encoding: "utf8" })
90
+ expect(result.status).not.toBe(0)
91
+ expect(result.stderr).toContain("checksums.sha256")
92
+ })
93
+
94
+ it("fails when the manifest omits a platform it needs", () => {
95
+ writeArtifacts(ARCHIVES.filter((n) => n !== "supatype-cli-linux-amd64.tar.gz"))
96
+ const result = spawnSync(process.execPath, [script(), "1.0.0", tmpDir], { encoding: "utf8" })
55
97
  expect(result.status).not.toBe(0)
56
- expect(result.stderr).toContain("Missing artifact")
98
+ expect(result.stderr).toContain("No checksum for supatype-cli-linux-amd64.tar.gz")
57
99
  })
58
100
  })
@@ -86,7 +86,7 @@ describe("readHookUpload", () => {
86
86
  })
87
87
 
88
88
  it("refuses a hook with a second file rather than dropping it", () => {
89
- // Silent truncation would deploy successfully and fail at import which reads to the caller as
89
+ // Silent truncation would deploy successfully and fail at import, which reads to the caller as
90
90
  // that table's writes being broken for no visible reason.
91
91
  const { cwd, hooks } = project()
92
92
  writeHook(hooks, "moderate-post", HANDLER, { "helpers.ts": "export const x = 1\n" })
@@ -71,7 +71,7 @@ export type Post = Model<{ id: UUID }, { tableName: "posts" }>
71
71
  describe("the generated module compiles", () => {
72
72
  /**
73
73
  * The generator emits TypeScript, so the only test that really proves it works is a compiler.
74
- * A missing brace or a type that does not resolve would otherwise reach a user's editor and this
74
+ * A missing brace or a type that does not resolve would otherwise reach a user's editor, and this
75
75
  * file is imported by their hook, so a broken emit breaks their function rather than our build.
76
76
  */
77
77
  it("typechecks under strict mode, together with a handler that uses it", () => {
@@ -329,7 +329,7 @@ describe("scaffold()", () => {
329
329
  expect(config).toContain('provider: "local"')
330
330
  expect(config).toContain("Production storage: external S3")
331
331
  const env = readFileSync(join(tmpRoot, ".env"), "utf8")
332
- expect(env).toContain("local development MinIO")
333
- expect(env).toContain("production external bucket")
332
+ expect(env).toContain("local development, MinIO")
333
+ expect(env).toContain("production, external bucket")
334
334
  })
335
335
  })
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Tests for `supatype keys` JWT generation command.
2
+ * Tests for `supatype keys`, JWT generation command.
3
3
  * Uses subprocess tests (requires built dist/) for the CLI integration,
4
4
  * plus direct module tests for the signing logic.
5
5
  */
@@ -20,10 +20,16 @@ function runCli(
20
20
  ): { stdout: string; stderr: string; exitCode: number } {
21
21
  const result = spawnSync(process.execPath, [CLI_BIN, ...args], {
22
22
  encoding: "utf8",
23
- timeout: 10_000,
23
+ timeout: 60_000,
24
24
  cwd: opts.cwd,
25
25
  env: { ...process.env, ...opts.env },
26
26
  })
27
+ if (result.signal) {
28
+ throw new Error(
29
+ `CLI subprocess killed by ${result.signal} after the spawn timeout. `
30
+ + `Args: ${args.join(" ")}. This is usually machine contention, not a CLI fault.`,
31
+ )
32
+ }
27
33
  return {
28
34
  stdout: String(result.stdout ?? ""),
29
35
  stderr: String(result.stderr ?? ""),
@@ -14,7 +14,7 @@ import {
14
14
  import { upsertEnvFile } from "../src/env-file.js"
15
15
 
16
16
  // The bug these exist to prevent: `supatype dev` used to pin POSTGRES_PASSWORD and JWT_SECRET
17
- // to published constants in `.env` on every run the same `.env` a self-host deployment reads.
17
+ // to published constants in `.env` on every run, the same `.env` a self-host deployment reads.
18
18
  // A generated secret survived until the developer's next `dev`, then reverted silently, and the
19
19
  // deployment went out with a secret anyone can look up.
20
20
 
@@ -32,7 +32,7 @@ describe("resolving local secrets", () => {
32
32
  expect(devAuthenticatorPassword(dir)).toBe("auth-mine")
33
33
  })
34
34
 
35
- // A project with no `.env` still has to start, so the constants remain as fallbacks only.
35
+ // A project with no `.env` still has to start, so the constants remain, as fallbacks only.
36
36
  it("falls back when the project has none", () => {
37
37
  const dir = project()
38
38
  expect(devJwtSecret(dir)).toBe(FALLBACK_JWT_SECRET)
@@ -43,7 +43,7 @@ describe("resolving local secrets", () => {
43
43
 
44
44
  describe("the dev env write does not clobber secrets", () => {
45
45
  // This is the regression. `upsertEnvFile` replaces any key handed to it, so the guarantee has
46
- // to be that the dev path never hands it these asserted here at the level that matters:
46
+ // to be that the dev path never hands it these, asserted here at the level that matters:
47
47
  // write what dev writes, then check the secrets are byte-identical.
48
48
  it("leaves generated secrets untouched across repeated writes", () => {
49
49
  const dir = project(
@@ -33,7 +33,7 @@ function addFunction(dir: string, name: string): void {
33
33
  writeFileSync(join(dir, "functions", name, "index.ts"), "export default () => new Response()", "utf8")
34
34
  }
35
35
 
36
- describe("model hooks declaration", () => {
36
+ describe("model hooks: declaration", () => {
37
37
  it("extracts both the shorthand and the options form", () => {
38
38
  const { ast } = project(`
39
39
  import type { Model, UUID } from "@supatype/types"
@@ -84,7 +84,7 @@ export type Post = Model<{ id: UUID }, {
84
84
  })
85
85
  })
86
86
 
87
- describe("model hooks push-time validation", () => {
87
+ describe("model hooks: push-time validation", () => {
88
88
  const schema = `
89
89
  import type { Model, UUID } from "@supatype/types"
90
90
 
@@ -142,7 +142,7 @@ export type Post = Model<{ id: UUID }, { tableName: "posts" }>
142
142
  })
143
143
  })
144
144
 
145
- describe("model hooks manifest map", () => {
145
+ describe("model hooks: manifest map", () => {
146
146
  const schema = `
147
147
  import type { Model, UUID } from "@supatype/types"
148
148
 
@@ -193,7 +193,7 @@ export type Post = Model<{ id: UUID }, {
193
193
 
194
194
  it("never creates a manifest from scratch", () => {
195
195
  // `functions_enabled` is a plain bool on the server's side, so a manifest carrying only hooks
196
- // would read as functions *disabled* the defect fixed one commit earlier, by another door.
196
+ // would read as functions *disabled*, the defect fixed one commit earlier, by another door.
197
197
  const { dir, ast } = project(schema)
198
198
  expect(syncManifestHooks(dir, ast)).toBe(false)
199
199
  expect(existsSync(join(dir, ".supatype", "manifest.json"))).toBe(false)
@@ -220,7 +220,7 @@ export type Post = Model<{ id: UUID }, { tableName: "posts" }>
220
220
  })
221
221
  })
222
222
 
223
- describe("model hooks generated module on disk", () => {
223
+ describe("model hooks: generated module on disk", () => {
224
224
  it("removes a stale module when the last hook is deleted", () => {
225
225
  // Otherwise a typed module sits there claiming tables are hooked, and a handler importing it
226
226
  // keeps compiling while never running.
@@ -250,7 +250,7 @@ export type Post = Model<{ id: UUID }, { tableName: "posts"; hooks: { beforeChan
250
250
  })
251
251
  })
252
252
 
253
- describe("model hooks doctor report", () => {
253
+ describe("model hooks: doctor report", () => {
254
254
  const schema = `
255
255
  import type { Model, UUID } from "@supatype/types"
256
256
 
@@ -130,7 +130,7 @@ describe("runtime contract", () => {
130
130
 
131
131
  // PostgREST must connect as `authenticator`, never as POSTGRES_USER. POSTGRES_USER is
132
132
  // `supatype_admin`, a superuser, and a superuser session may SET ROLE to any role in the
133
- // cluster so a request whose JWT named one got it. Verified against a live stack: a
133
+ // cluster: so a request whose JWT named one got it. Verified against a live stack: a
134
134
  // token with `role: "supatype_admin"` returned every row of an RLS-protected table.
135
135
  it("self-host compose connects PostgREST as authenticator, not the superuser", () => {
136
136
  const compose = renderSelfHostCompose(baseConfig)
@@ -149,7 +149,7 @@ describe("runtime contract", () => {
149
149
  })
150
150
 
151
151
  // `supatype dev --provider docker` renders *this* file, so a `${VAR:?}` with no default
152
- // takes local dev down before anything starts `docker compose` refuses to interpolate and
152
+ // takes local dev down before anything starts, `docker compose` refuses to interpolate and
153
153
  // exits 1. Adding one therefore means wiring it into `upsertDevComposeEnv` as well. This
154
154
  // list is the reminder; if it fails, do that rather than just updating the list.
155
155
  it("requires only variables the dev path also sets", () => {
@@ -66,7 +66,7 @@ describe("checkServiceRoleRoutes", () => {
66
66
  })
67
67
 
68
68
  it("warns rather than fails on a hook entry", () => {
69
- // It was the documented form once, and the worker grants hooks whatever the list says so it is
69
+ // It was the documented form once, and the worker grants hooks whatever the list says, so it is
70
70
  // harmless, and worth saying because a reader would assume the line is what grants.
71
71
  const problems = checkServiceRoleRoutes(config(["hooks/moderate-post"]), projectWith([]))
72
72
  expect(problems.errors).toEqual([])
@@ -89,7 +89,7 @@ describe("serviceRoleProblemLines", () => {
89
89
 
90
90
  it("lists what could have been named instead", () => {
91
91
  const lines = serviceRoleProblemLines({
92
- errors: [' "x" no functions/x/index.ts'],
92
+ errors: [' "x": no functions/x/index.ts'],
93
93
  missing: ["x"],
94
94
  warnings: [],
95
95
  available: ["audit", "send-email"],
@@ -99,7 +99,7 @@ describe("serviceRoleProblemLines", () => {
99
99
 
100
100
  it("says so when there are no functions at all", () => {
101
101
  const lines = serviceRoleProblemLines({
102
- errors: [' "x" nope'],
102
+ errors: [' "x": nope'],
103
103
  missing: ["x"],
104
104
  warnings: [],
105
105
  available: [],
@@ -80,7 +80,7 @@ describe("provisionBuckets", () => {
80
80
 
81
81
  await provisionBuckets("http://localhost:54321/storage/v1", "key", [{ id: "photos", public: false }])
82
82
 
83
- expect(warn).toHaveBeenCalledWith('[storage] Storage API unreachable skipped bucket "photos"')
83
+ expect(warn).toHaveBeenCalledWith('[storage] Storage API unreachable, skipped bucket "photos"')
84
84
  })
85
85
  })
86
86
 
@@ -1255,8 +1255,8 @@ export type Invoice = Model<{
1255
1255
 
1256
1256
  it("extracts Code and Currency as JSONB carrying their declared shape", () => {
1257
1257
  // Both were exported from `@supatype/types` and rejected by the extractor, so a schema using
1258
- // either failed the push with "unknown type". Each carries two values a language with its
1259
- // source, an amount with its currency so JSONB is the column that does not drop one.
1258
+ // either failed the push with "unknown type". Each carries two values, a language with its
1259
+ // source, an amount with its currency, so JSONB is the column that does not drop one.
1260
1260
  const dir = mkdtempSync(join(tmpdir(), "supatype-code-currency-"))
1261
1261
  dirs.push(dir)
1262
1262
  const schemaPath = join(dir, "schema.ts")