@supatype/cli 0.9.0 → 0.9.2

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 (619) hide show
  1. package/CHANGELOG.md +640 -68
  2. package/bin/node-version.js +28 -0
  3. package/bin/supatype.js +8 -4
  4. package/dist/app/port-holder.d.ts +33 -0
  5. package/dist/app/port-holder.d.ts.map +1 -0
  6. package/dist/app/port-holder.js +66 -0
  7. package/dist/app/port-holder.js.map +1 -0
  8. package/dist/app/proxy-dev-app.d.ts +32 -4
  9. package/dist/app/proxy-dev-app.d.ts.map +1 -1
  10. package/dist/app/proxy-dev-app.js +111 -77
  11. package/dist/app/proxy-dev-app.js.map +1 -1
  12. package/dist/app/vite-dev-args.d.ts +20 -0
  13. package/dist/app/vite-dev-args.d.ts.map +1 -0
  14. package/dist/app/vite-dev-args.js +65 -0
  15. package/dist/app/vite-dev-args.js.map +1 -0
  16. package/dist/app-config.d.ts +2 -0
  17. package/dist/app-config.d.ts.map +1 -1
  18. package/dist/app-config.js +27 -8
  19. package/dist/app-config.js.map +1 -1
  20. package/dist/augmentation-generator.d.ts +2 -0
  21. package/dist/augmentation-generator.d.ts.map +1 -1
  22. package/dist/augmentation-generator.js +7 -3
  23. package/dist/augmentation-generator.js.map +1 -1
  24. package/dist/auth-providers.d.ts +5 -4
  25. package/dist/auth-providers.d.ts.map +1 -1
  26. package/dist/auth-providers.js +3 -12
  27. package/dist/auth-providers.js.map +1 -1
  28. package/dist/binary-download-lock.d.ts.map +1 -1
  29. package/dist/binary-download-lock.js +2 -10
  30. package/dist/binary-download-lock.js.map +1 -1
  31. package/dist/build-spawn.d.ts +35 -0
  32. package/dist/build-spawn.d.ts.map +1 -0
  33. package/dist/build-spawn.js +75 -0
  34. package/dist/build-spawn.js.map +1 -0
  35. package/dist/cache-provider.d.ts +17 -2
  36. package/dist/cache-provider.d.ts.map +1 -1
  37. package/dist/cache-provider.js +28 -3
  38. package/dist/cache-provider.js.map +1 -1
  39. package/dist/cli-version-embedded.js +1 -1
  40. package/dist/cli.d.ts +7 -0
  41. package/dist/cli.d.ts.map +1 -1
  42. package/dist/cli.js +14 -1
  43. package/dist/cli.js.map +1 -1
  44. package/dist/cloud-credentials.d.ts.map +1 -1
  45. package/dist/cloud-credentials.js +3 -1
  46. package/dist/cloud-credentials.js.map +1 -1
  47. package/dist/commands/admin.d.ts.map +1 -1
  48. package/dist/commands/admin.js +11 -15
  49. package/dist/commands/admin.js.map +1 -1
  50. package/dist/commands/adopt.js +1 -1
  51. package/dist/commands/adopt.js.map +1 -1
  52. package/dist/commands/app.d.ts.map +1 -1
  53. package/dist/commands/app.js +22 -2
  54. package/dist/commands/app.js.map +1 -1
  55. package/dist/commands/build.d.ts +29 -0
  56. package/dist/commands/build.d.ts.map +1 -0
  57. package/dist/commands/build.js +69 -0
  58. package/dist/commands/build.js.map +1 -0
  59. package/dist/commands/cache.d.ts.map +1 -1
  60. package/dist/commands/cache.js +5 -0
  61. package/dist/commands/cache.js.map +1 -1
  62. package/dist/commands/db.d.ts.map +1 -1
  63. package/dist/commands/db.js +46 -23
  64. package/dist/commands/db.js.map +1 -1
  65. package/dist/commands/deploy.d.ts +14 -0
  66. package/dist/commands/deploy.d.ts.map +1 -1
  67. package/dist/commands/deploy.js +67 -52
  68. package/dist/commands/deploy.js.map +1 -1
  69. package/dist/commands/dev.d.ts +21 -4
  70. package/dist/commands/dev.d.ts.map +1 -1
  71. package/dist/commands/dev.js +244 -86
  72. package/dist/commands/dev.js.map +1 -1
  73. package/dist/commands/diff.d.ts +3 -0
  74. package/dist/commands/diff.d.ts.map +1 -1
  75. package/dist/commands/diff.js +28 -34
  76. package/dist/commands/diff.js.map +1 -1
  77. package/dist/commands/doctor.js +2 -2
  78. package/dist/commands/doctor.js.map +1 -1
  79. package/dist/commands/functions.d.ts.map +1 -1
  80. package/dist/commands/functions.js +21 -16
  81. package/dist/commands/functions.js.map +1 -1
  82. package/dist/commands/generate.d.ts.map +1 -1
  83. package/dist/commands/generate.js +3 -0
  84. package/dist/commands/generate.js.map +1 -1
  85. package/dist/commands/init.d.ts +15 -10
  86. package/dist/commands/init.d.ts.map +1 -1
  87. package/dist/commands/init.js +312 -163
  88. package/dist/commands/init.js.map +1 -1
  89. package/dist/commands/internal.d.ts.map +1 -1
  90. package/dist/commands/internal.js +27 -7
  91. package/dist/commands/internal.js.map +1 -1
  92. package/dist/commands/introspect.d.ts.map +1 -1
  93. package/dist/commands/introspect.js +3 -0
  94. package/dist/commands/introspect.js.map +1 -1
  95. package/dist/commands/keys-print.d.ts +20 -0
  96. package/dist/commands/keys-print.d.ts.map +1 -0
  97. package/dist/commands/keys-print.js +47 -0
  98. package/dist/commands/keys-print.js.map +1 -0
  99. package/dist/commands/keys.d.ts.map +1 -1
  100. package/dist/commands/keys.js +16 -12
  101. package/dist/commands/keys.js.map +1 -1
  102. package/dist/commands/link-helpers.d.ts.map +1 -1
  103. package/dist/commands/link-helpers.js +28 -6
  104. package/dist/commands/link-helpers.js.map +1 -1
  105. package/dist/commands/migrate.d.ts +5 -2
  106. package/dist/commands/migrate.d.ts.map +1 -1
  107. package/dist/commands/migrate.js +34 -36
  108. package/dist/commands/migrate.js.map +1 -1
  109. package/dist/commands/pull.d.ts.map +1 -1
  110. package/dist/commands/pull.js +6 -5
  111. package/dist/commands/pull.js.map +1 -1
  112. package/dist/commands/push.d.ts.map +1 -1
  113. package/dist/commands/push.js +30 -19
  114. package/dist/commands/push.js.map +1 -1
  115. package/dist/commands/rename.js +1 -1
  116. package/dist/commands/rename.js.map +1 -1
  117. package/dist/commands/seed.d.ts +2 -11
  118. package/dist/commands/seed.d.ts.map +1 -1
  119. package/dist/commands/seed.js +11 -38
  120. package/dist/commands/seed.js.map +1 -1
  121. package/dist/commands/self-host.d.ts +3 -3
  122. package/dist/commands/self-host.d.ts.map +1 -1
  123. package/dist/commands/self-host.js +133 -272
  124. package/dist/commands/self-host.js.map +1 -1
  125. package/dist/commands/sso.d.ts +26 -0
  126. package/dist/commands/sso.d.ts.map +1 -0
  127. package/dist/commands/sso.js +362 -0
  128. package/dist/commands/sso.js.map +1 -0
  129. package/dist/commands/status.d.ts.map +1 -1
  130. package/dist/commands/status.js +25 -8
  131. package/dist/commands/status.js.map +1 -1
  132. package/dist/commands/update.d.ts.map +1 -1
  133. package/dist/commands/update.js +156 -63
  134. package/dist/commands/update.js.map +1 -1
  135. package/dist/component-launch.d.ts.map +1 -1
  136. package/dist/component-launch.js +2 -1
  137. package/dist/component-launch.js.map +1 -1
  138. package/dist/compose-db-roles.d.ts +4 -4
  139. package/dist/compose-db-roles.d.ts.map +1 -1
  140. package/dist/compose-db-roles.js +14 -10
  141. package/dist/compose-db-roles.js.map +1 -1
  142. package/dist/compose-engine-run.d.ts +9 -2
  143. package/dist/compose-engine-run.d.ts.map +1 -1
  144. package/dist/compose-engine-run.js +30 -13
  145. package/dist/compose-engine-run.js.map +1 -1
  146. package/dist/compose-rename.d.ts.map +1 -1
  147. package/dist/compose-rename.js +5 -0
  148. package/dist/compose-rename.js.map +1 -1
  149. package/dist/compose-render-mode.d.ts +8 -3
  150. package/dist/compose-render-mode.d.ts.map +1 -1
  151. package/dist/compose-render-mode.js +13 -5
  152. package/dist/compose-render-mode.js.map +1 -1
  153. package/dist/compose-services.d.ts +18 -0
  154. package/dist/compose-services.d.ts.map +1 -1
  155. package/dist/compose-services.js +49 -23
  156. package/dist/compose-services.js.map +1 -1
  157. package/dist/config-mailer-env.d.ts +31 -0
  158. package/dist/config-mailer-env.d.ts.map +1 -0
  159. package/dist/config-mailer-env.js +45 -0
  160. package/dist/config-mailer-env.js.map +1 -0
  161. package/dist/config-version-pin.d.ts +42 -0
  162. package/dist/config-version-pin.d.ts.map +1 -0
  163. package/dist/config-version-pin.js +64 -0
  164. package/dist/config-version-pin.js.map +1 -0
  165. package/dist/config.d.ts +4 -0
  166. package/dist/config.d.ts.map +1 -1
  167. package/dist/config.js +6 -2
  168. package/dist/config.js.map +1 -1
  169. package/dist/db-rows.d.ts +3 -2
  170. package/dist/db-rows.d.ts.map +1 -1
  171. package/dist/db-rows.js +19 -4
  172. package/dist/db-rows.js.map +1 -1
  173. package/dist/dev-compose.d.ts +69 -9
  174. package/dist/dev-compose.d.ts.map +1 -1
  175. package/dist/dev-compose.js +272 -187
  176. package/dist/dev-compose.js.map +1 -1
  177. package/dist/dev-initial-push.d.ts.map +1 -1
  178. package/dist/dev-initial-push.js +6 -0
  179. package/dist/dev-initial-push.js.map +1 -1
  180. package/dist/dev-ports.d.ts +13 -6
  181. package/dist/dev-ports.d.ts.map +1 -1
  182. package/dist/dev-ports.js +124 -68
  183. package/dist/dev-ports.js.map +1 -1
  184. package/dist/dev-ready-panel.d.ts +26 -3
  185. package/dist/dev-ready-panel.d.ts.map +1 -1
  186. package/dist/dev-ready-panel.js +37 -5
  187. package/dist/dev-ready-panel.js.map +1 -1
  188. package/dist/dev-schema-watch.d.ts +8 -2
  189. package/dist/dev-schema-watch.d.ts.map +1 -1
  190. package/dist/dev-schema-watch.js +24 -13
  191. package/dist/dev-schema-watch.js.map +1 -1
  192. package/dist/dev-self-start.d.ts +16 -0
  193. package/dist/dev-self-start.d.ts.map +1 -0
  194. package/dist/dev-self-start.js +31 -0
  195. package/dist/dev-self-start.js.map +1 -0
  196. package/dist/dev-session-lock.d.ts +66 -2
  197. package/dist/dev-session-lock.d.ts.map +1 -1
  198. package/dist/dev-session-lock.js +104 -5
  199. package/dist/dev-session-lock.js.map +1 -1
  200. package/dist/dev-session.d.ts +19 -3
  201. package/dist/dev-session.d.ts.map +1 -1
  202. package/dist/dev-session.js +31 -8
  203. package/dist/dev-session.js.map +1 -1
  204. package/dist/dev-shutdown.d.ts +11 -2
  205. package/dist/dev-shutdown.d.ts.map +1 -1
  206. package/dist/dev-shutdown.js +27 -10
  207. package/dist/dev-shutdown.js.map +1 -1
  208. package/dist/diff-access.d.ts +10 -0
  209. package/dist/diff-access.d.ts.map +1 -0
  210. package/dist/diff-access.js +69 -0
  211. package/dist/diff-access.js.map +1 -0
  212. package/dist/diff-output.d.ts.map +1 -1
  213. package/dist/diff-output.js +2 -1
  214. package/dist/diff-output.js.map +1 -1
  215. package/dist/docker-exec.d.ts.map +1 -1
  216. package/dist/docker-exec.js +4 -4
  217. package/dist/docker-exec.js.map +1 -1
  218. package/dist/docker-runtime.d.ts +34 -4
  219. package/dist/docker-runtime.d.ts.map +1 -1
  220. package/dist/docker-runtime.js +155 -46
  221. package/dist/docker-runtime.js.map +1 -1
  222. package/dist/engine-answers.d.ts +2 -1
  223. package/dist/engine-answers.d.ts.map +1 -1
  224. package/dist/engine-answers.js +11 -0
  225. package/dist/engine-answers.js.map +1 -1
  226. package/dist/engine-client.d.ts +20 -0
  227. package/dist/engine-client.d.ts.map +1 -1
  228. package/dist/engine-client.js +9 -8
  229. package/dist/engine-client.js.map +1 -1
  230. package/dist/engine-columns.d.ts +26 -0
  231. package/dist/engine-columns.d.ts.map +1 -0
  232. package/dist/engine-columns.js +67 -0
  233. package/dist/engine-columns.js.map +1 -0
  234. package/dist/engine-floor.d.ts +3 -2
  235. package/dist/engine-floor.d.ts.map +1 -1
  236. package/dist/engine-floor.js +2 -2
  237. package/dist/engine-floor.js.map +1 -1
  238. package/dist/engine-push-output.d.ts +8 -1
  239. package/dist/engine-push-output.d.ts.map +1 -1
  240. package/dist/engine-push-output.js +8 -1
  241. package/dist/engine-push-output.js.map +1 -1
  242. package/dist/env-file.d.ts +23 -3
  243. package/dist/env-file.d.ts.map +1 -1
  244. package/dist/env-file.js +74 -40
  245. package/dist/env-file.js.map +1 -1
  246. package/dist/env-lines.d.ts +3 -2
  247. package/dist/env-lines.d.ts.map +1 -1
  248. package/dist/env-lines.js +5 -2
  249. package/dist/env-lines.js.map +1 -1
  250. package/dist/env-value.d.ts +15 -0
  251. package/dist/env-value.d.ts.map +1 -0
  252. package/dist/env-value.js +34 -0
  253. package/dist/env-value.js.map +1 -0
  254. package/dist/error-message.d.ts +20 -0
  255. package/dist/error-message.d.ts.map +1 -1
  256. package/dist/error-message.js +42 -0
  257. package/dist/error-message.js.map +1 -1
  258. package/dist/frontend-env.d.ts +13 -4
  259. package/dist/frontend-env.d.ts.map +1 -1
  260. package/dist/frontend-env.js +25 -5
  261. package/dist/frontend-env.js.map +1 -1
  262. package/dist/frontend-values-linked.d.ts +22 -0
  263. package/dist/frontend-values-linked.d.ts.map +1 -0
  264. package/dist/frontend-values-linked.js +143 -0
  265. package/dist/frontend-values-linked.js.map +1 -0
  266. package/dist/frontend-values.d.ts +90 -0
  267. package/dist/frontend-values.d.ts.map +1 -0
  268. package/dist/frontend-values.js +208 -0
  269. package/dist/frontend-values.js.map +1 -0
  270. package/dist/functions-deno-types.d.ts.map +1 -1
  271. package/dist/functions-deno-types.js +5 -5
  272. package/dist/functions-deno-types.js.map +1 -1
  273. package/dist/functions-env-local.d.ts +13 -0
  274. package/dist/functions-env-local.d.ts.map +1 -0
  275. package/dist/functions-env-local.js +20 -0
  276. package/dist/functions-env-local.js.map +1 -0
  277. package/dist/functions-worker-files.d.ts.map +1 -1
  278. package/dist/functions-worker-files.js +2 -13
  279. package/dist/functions-worker-files.js.map +1 -1
  280. package/dist/generated/release-images.d.ts +6 -6
  281. package/dist/generated/release-images.js +3 -3
  282. package/dist/generated/release-images.js.map +1 -1
  283. package/dist/generated/typescript-libs.d.ts +4 -0
  284. package/dist/generated/typescript-libs.d.ts.map +1 -0
  285. package/dist/generated/typescript-libs.js +64 -0
  286. package/dist/generated/typescript-libs.js.map +1 -0
  287. package/dist/gitignore.d.ts +29 -2
  288. package/dist/gitignore.d.ts.map +1 -1
  289. package/dist/gitignore.js +86 -21
  290. package/dist/gitignore.js.map +1 -1
  291. package/dist/hooks-generator.d.ts.map +1 -1
  292. package/dist/hooks-generator.js +4 -2
  293. package/dist/hooks-generator.js.map +1 -1
  294. package/dist/host-database.d.ts +16 -12
  295. package/dist/host-database.d.ts.map +1 -1
  296. package/dist/host-database.js +28 -17
  297. package/dist/host-database.js.map +1 -1
  298. package/dist/init-answers.d.ts +18 -0
  299. package/dist/init-answers.d.ts.map +1 -0
  300. package/dist/init-answers.js +46 -0
  301. package/dist/init-answers.js.map +1 -0
  302. package/dist/init-dependency-versions.d.ts +2 -3
  303. package/dist/init-dependency-versions.d.ts.map +1 -1
  304. package/dist/init-dependency-versions.js +12 -9
  305. package/dist/init-dependency-versions.js.map +1 -1
  306. package/dist/init-example.d.ts.map +1 -1
  307. package/dist/init-example.js +13 -1
  308. package/dist/init-example.js.map +1 -1
  309. package/dist/init-expo-runtime-env.d.ts +25 -0
  310. package/dist/init-expo-runtime-env.d.ts.map +1 -0
  311. package/dist/init-expo-runtime-env.js +112 -0
  312. package/dist/init-expo-runtime-env.js.map +1 -0
  313. package/dist/init-next-runtime-env.d.ts +43 -0
  314. package/dist/init-next-runtime-env.d.ts.map +1 -0
  315. package/dist/init-next-runtime-env.js +261 -0
  316. package/dist/init-next-runtime-env.js.map +1 -0
  317. package/dist/init-package-json.d.ts +11 -3
  318. package/dist/init-package-json.d.ts.map +1 -1
  319. package/dist/init-package-json.js +20 -13
  320. package/dist/init-package-json.js.map +1 -1
  321. package/dist/init-port-registry.d.ts +19 -0
  322. package/dist/init-port-registry.d.ts.map +1 -0
  323. package/dist/init-port-registry.js +57 -0
  324. package/dist/init-port-registry.js.map +1 -0
  325. package/dist/init-project-detect.d.ts +20 -0
  326. package/dist/init-project-detect.d.ts.map +1 -1
  327. package/dist/init-project-detect.js +41 -8
  328. package/dist/init-project-detect.js.map +1 -1
  329. package/dist/init-vite-node.d.ts +21 -0
  330. package/dist/init-vite-node.d.ts.map +1 -0
  331. package/dist/init-vite-node.js +75 -0
  332. package/dist/init-vite-node.js.map +1 -0
  333. package/dist/jsx-first-child.d.ts +18 -0
  334. package/dist/jsx-first-child.d.ts.map +1 -0
  335. package/dist/jsx-first-child.js +53 -0
  336. package/dist/jsx-first-child.js.map +1 -0
  337. package/dist/jwt.d.ts +5 -0
  338. package/dist/jwt.d.ts.map +1 -1
  339. package/dist/jwt.js +16 -0
  340. package/dist/jwt.js.map +1 -1
  341. package/dist/keyspace-password-file.d.ts +46 -0
  342. package/dist/keyspace-password-file.d.ts.map +1 -0
  343. package/dist/keyspace-password-file.js +128 -0
  344. package/dist/keyspace-password-file.js.map +1 -0
  345. package/dist/kong-config.d.ts +1 -0
  346. package/dist/kong-config.d.ts.map +1 -1
  347. package/dist/kong-config.js +64 -20
  348. package/dist/kong-config.js.map +1 -1
  349. package/dist/local-gateway.d.ts +11 -3
  350. package/dist/local-gateway.d.ts.map +1 -1
  351. package/dist/local-gateway.js +16 -7
  352. package/dist/local-gateway.js.map +1 -1
  353. package/dist/local-secrets.d.ts +32 -0
  354. package/dist/local-secrets.d.ts.map +1 -1
  355. package/dist/local-secrets.js +49 -0
  356. package/dist/local-secrets.js.map +1 -1
  357. package/dist/local-stack-guard.d.ts +37 -0
  358. package/dist/local-stack-guard.d.ts.map +1 -0
  359. package/dist/local-stack-guard.js +85 -0
  360. package/dist/local-stack-guard.js.map +1 -0
  361. package/dist/local-stack.d.ts.map +1 -1
  362. package/dist/local-stack.js +7 -6
  363. package/dist/local-stack.js.map +1 -1
  364. package/dist/local-storage.d.ts +3 -5
  365. package/dist/local-storage.d.ts.map +1 -1
  366. package/dist/local-storage.js +10 -10
  367. package/dist/local-storage.js.map +1 -1
  368. package/dist/mailer-autoconfirm.d.ts +29 -24
  369. package/dist/mailer-autoconfirm.d.ts.map +1 -1
  370. package/dist/mailer-autoconfirm.js +47 -43
  371. package/dist/mailer-autoconfirm.js.map +1 -1
  372. package/dist/mailer-env.d.ts +4 -0
  373. package/dist/mailer-env.d.ts.map +1 -1
  374. package/dist/mailer-env.js +12 -1
  375. package/dist/mailer-env.js.map +1 -1
  376. package/dist/model-hooks.d.ts +4 -4
  377. package/dist/model-hooks.d.ts.map +1 -1
  378. package/dist/model-hooks.js +13 -7
  379. package/dist/model-hooks.js.map +1 -1
  380. package/dist/native-dev-env.d.ts +25 -2
  381. package/dist/native-dev-env.d.ts.map +1 -1
  382. package/dist/native-dev-env.js +39 -4
  383. package/dist/native-dev-env.js.map +1 -1
  384. package/dist/native-keyspace.d.ts +21 -6
  385. package/dist/native-keyspace.d.ts.map +1 -1
  386. package/dist/native-keyspace.js +48 -14
  387. package/dist/native-keyspace.js.map +1 -1
  388. package/dist/native-leftover-postgres.d.ts +23 -0
  389. package/dist/native-leftover-postgres.d.ts.map +1 -0
  390. package/dist/native-leftover-postgres.js +55 -0
  391. package/dist/native-leftover-postgres.js.map +1 -0
  392. package/dist/native-leftover-services.d.ts +17 -0
  393. package/dist/native-leftover-services.d.ts.map +1 -0
  394. package/dist/native-leftover-services.js +93 -0
  395. package/dist/native-leftover-services.js.map +1 -0
  396. package/dist/native-pg-auth.d.ts.map +1 -1
  397. package/dist/native-pg-auth.js +2 -1
  398. package/dist/native-pg-auth.js.map +1 -1
  399. package/dist/native-port-lock.d.ts +37 -0
  400. package/dist/native-port-lock.d.ts.map +1 -0
  401. package/dist/native-port-lock.js +78 -0
  402. package/dist/native-port-lock.js.map +1 -0
  403. package/dist/native-realtime.d.ts +6 -3
  404. package/dist/native-realtime.d.ts.map +1 -1
  405. package/dist/native-realtime.js +65 -24
  406. package/dist/native-realtime.js.map +1 -1
  407. package/dist/native-roles-sql.d.ts.map +1 -1
  408. package/dist/native-roles-sql.js +2 -1
  409. package/dist/native-roles-sql.js.map +1 -1
  410. package/dist/native-storage-import.d.ts.map +1 -1
  411. package/dist/native-storage-import.js +6 -5
  412. package/dist/native-storage-import.js.map +1 -1
  413. package/dist/native-storage.d.ts +42 -7
  414. package/dist/native-storage.d.ts.map +1 -1
  415. package/dist/native-storage.js +196 -50
  416. package/dist/native-storage.js.map +1 -1
  417. package/dist/node-executable.d.ts +6 -0
  418. package/dist/node-executable.d.ts.map +1 -0
  419. package/dist/node-executable.js +43 -0
  420. package/dist/node-executable.js.map +1 -0
  421. package/dist/parent-watch.d.ts +8 -3
  422. package/dist/parent-watch.d.ts.map +1 -1
  423. package/dist/parent-watch.js +12 -11
  424. package/dist/parent-watch.js.map +1 -1
  425. package/dist/postgres-ctl.d.ts +33 -5
  426. package/dist/postgres-ctl.d.ts.map +1 -1
  427. package/dist/postgres-ctl.js +60 -16
  428. package/dist/postgres-ctl.js.map +1 -1
  429. package/dist/postgres-image.d.ts +16 -0
  430. package/dist/postgres-image.d.ts.map +1 -1
  431. package/dist/postgres-image.js +34 -11
  432. package/dist/postgres-image.js.map +1 -1
  433. package/dist/process-info.d.ts +14 -0
  434. package/dist/process-info.d.ts.map +1 -0
  435. package/dist/process-info.js +41 -0
  436. package/dist/process-info.js.map +1 -0
  437. package/dist/process-manager.d.ts +110 -9
  438. package/dist/process-manager.d.ts.map +1 -1
  439. package/dist/process-manager.js +242 -104
  440. package/dist/process-manager.js.map +1 -1
  441. package/dist/process-tree.d.ts +48 -0
  442. package/dist/process-tree.d.ts.map +1 -0
  443. package/dist/process-tree.js +141 -0
  444. package/dist/process-tree.js.map +1 -0
  445. package/dist/project-config.d.ts +60 -4
  446. package/dist/project-config.d.ts.map +1 -1
  447. package/dist/project-config.js +23 -1
  448. package/dist/project-config.js.map +1 -1
  449. package/dist/push-audit.d.ts +4 -1
  450. package/dist/push-audit.d.ts.map +1 -1
  451. package/dist/push-audit.js +33 -4
  452. package/dist/push-audit.js.map +1 -1
  453. package/dist/recorded-field-masking-tier.d.ts +2 -2
  454. package/dist/recorded-field-masking-tier.d.ts.map +1 -1
  455. package/dist/recorded-field-masking-tier.js +6 -6
  456. package/dist/recorded-field-masking-tier.js.map +1 -1
  457. package/dist/rename-journal.d.ts +1 -1
  458. package/dist/rename-journal.d.ts.map +1 -1
  459. package/dist/required-host-components.d.ts.map +1 -1
  460. package/dist/required-host-components.js +3 -5
  461. package/dist/required-host-components.js.map +1 -1
  462. package/dist/resolve-api-url.d.ts +2 -0
  463. package/dist/resolve-api-url.d.ts.map +1 -1
  464. package/dist/resolve-api-url.js +5 -1
  465. package/dist/resolve-api-url.js.map +1 -1
  466. package/dist/resolve-target.d.ts +16 -1
  467. package/dist/resolve-target.d.ts.map +1 -1
  468. package/dist/resolve-target.js +20 -11
  469. package/dist/resolve-target.js.map +1 -1
  470. package/dist/route-manifest.d.ts +24 -0
  471. package/dist/route-manifest.d.ts.map +1 -1
  472. package/dist/route-manifest.js +60 -2
  473. package/dist/route-manifest.js.map +1 -1
  474. package/dist/run-captured.d.ts +33 -0
  475. package/dist/run-captured.d.ts.map +1 -0
  476. package/dist/run-captured.js +36 -0
  477. package/dist/run-captured.js.map +1 -0
  478. package/dist/run-until-stopped.d.ts +3 -0
  479. package/dist/run-until-stopped.d.ts.map +1 -1
  480. package/dist/run-until-stopped.js +25 -11
  481. package/dist/run-until-stopped.js.map +1 -1
  482. package/dist/runtime-routes.d.ts +5 -0
  483. package/dist/runtime-routes.d.ts.map +1 -1
  484. package/dist/runtime-routes.js +5 -1
  485. package/dist/runtime-routes.js.map +1 -1
  486. package/dist/saml-config.d.ts +53 -0
  487. package/dist/saml-config.d.ts.map +1 -0
  488. package/dist/saml-config.js +177 -0
  489. package/dist/saml-config.js.map +1 -0
  490. package/dist/saml-key-rotation.d.ts +5 -0
  491. package/dist/saml-key-rotation.d.ts.map +1 -0
  492. package/dist/saml-key-rotation.js +26 -0
  493. package/dist/saml-key-rotation.js.map +1 -0
  494. package/dist/saml-sp-certificate.d.ts +15 -0
  495. package/dist/saml-sp-certificate.d.ts.map +1 -0
  496. package/dist/saml-sp-certificate.js +34 -0
  497. package/dist/saml-sp-certificate.js.map +1 -0
  498. package/dist/schema-reset.d.ts +41 -0
  499. package/dist/schema-reset.d.ts.map +1 -0
  500. package/dist/schema-reset.js +98 -0
  501. package/dist/schema-reset.js.map +1 -0
  502. package/dist/secret-sql.d.ts +13 -0
  503. package/dist/secret-sql.d.ts.map +1 -0
  504. package/dist/secret-sql.js +13 -0
  505. package/dist/secret-sql.js.map +1 -0
  506. package/dist/seed-child.d.ts +25 -0
  507. package/dist/seed-child.d.ts.map +1 -0
  508. package/dist/seed-child.js +61 -0
  509. package/dist/seed-child.js.map +1 -0
  510. package/dist/seed-ir.d.ts +8 -1
  511. package/dist/seed-ir.d.ts.map +1 -1
  512. package/dist/seed-ir.js +92 -6
  513. package/dist/seed-ir.js.map +1 -1
  514. package/dist/seed-runner.d.ts +3 -5
  515. package/dist/seed-runner.d.ts.map +1 -1
  516. package/dist/seed-runner.js +20 -42
  517. package/dist/seed-runner.js.map +1 -1
  518. package/dist/seed.d.ts +15 -2
  519. package/dist/seed.d.ts.map +1 -1
  520. package/dist/self-host-compose.d.ts +24 -2
  521. package/dist/self-host-compose.d.ts.map +1 -1
  522. package/dist/self-host-compose.js +261 -63
  523. package/dist/self-host-compose.js.map +1 -1
  524. package/dist/serial-runs.d.ts +7 -0
  525. package/dist/serial-runs.d.ts.map +1 -0
  526. package/dist/serial-runs.js +29 -0
  527. package/dist/serial-runs.js.map +1 -0
  528. package/dist/sso-admin.d.ts +114 -0
  529. package/dist/sso-admin.d.ts.map +1 -0
  530. package/dist/sso-admin.js +256 -0
  531. package/dist/sso-admin.js.map +1 -0
  532. package/dist/stack-engine.d.ts +28 -0
  533. package/dist/stack-engine.d.ts.map +1 -0
  534. package/dist/stack-engine.js +59 -0
  535. package/dist/stack-engine.js.map +1 -0
  536. package/dist/stack-exit-watch.d.ts +52 -0
  537. package/dist/stack-exit-watch.d.ts.map +1 -0
  538. package/dist/stack-exit-watch.js +98 -0
  539. package/dist/stack-exit-watch.js.map +1 -0
  540. package/dist/stack-folder.d.ts +28 -0
  541. package/dist/stack-folder.d.ts.map +1 -0
  542. package/dist/stack-folder.js +123 -0
  543. package/dist/stack-folder.js.map +1 -0
  544. package/dist/stack-setting-warnings.d.ts +9 -0
  545. package/dist/stack-setting-warnings.d.ts.map +1 -0
  546. package/dist/stack-setting-warnings.js +19 -0
  547. package/dist/stack-setting-warnings.js.map +1 -0
  548. package/dist/storage-provision.d.ts +12 -2
  549. package/dist/storage-provision.d.ts.map +1 -1
  550. package/dist/storage-provision.js +36 -11
  551. package/dist/storage-provision.js.map +1 -1
  552. package/dist/studio-dev-server.d.ts.map +1 -1
  553. package/dist/studio-dev-server.js +2 -1
  554. package/dist/studio-dev-server.js.map +1 -1
  555. package/dist/target-client.d.ts +12 -2
  556. package/dist/target-client.d.ts.map +1 -1
  557. package/dist/target-client.js +14 -1
  558. package/dist/target-client.js.map +1 -1
  559. package/dist/tsx-runner.d.ts +5 -0
  560. package/dist/tsx-runner.d.ts.map +1 -1
  561. package/dist/tsx-runner.js +16 -16
  562. package/dist/tsx-runner.js.map +1 -1
  563. package/dist/type-extractor.d.ts.map +1 -1
  564. package/dist/type-extractor.js +27 -3
  565. package/dist/type-extractor.js.map +1 -1
  566. package/dist/type-generation.d.ts +1 -1
  567. package/dist/type-generation.d.ts.map +1 -1
  568. package/dist/type-generation.js +2 -4
  569. package/dist/type-generation.js.map +1 -1
  570. package/dist/type-resolver.d.ts.map +1 -1
  571. package/dist/type-resolver.js +31 -12
  572. package/dist/type-resolver.js.map +1 -1
  573. package/dist/ui/clack-api.d.ts.map +1 -1
  574. package/dist/ui/clack-api.js +45 -23
  575. package/dist/ui/clack-api.js.map +1 -1
  576. package/dist/ui/components/LineInput.d.ts +26 -0
  577. package/dist/ui/components/LineInput.d.ts.map +1 -0
  578. package/dist/ui/components/LineInput.js +60 -0
  579. package/dist/ui/components/LineInput.js.map +1 -0
  580. package/dist/ui/dev/DevReadyPanelView.js +1 -1
  581. package/dist/ui/dev/DevReadyPanelView.js.map +1 -1
  582. package/dist/ui/flows/FlowApp.d.ts +3 -1
  583. package/dist/ui/flows/FlowApp.d.ts.map +1 -1
  584. package/dist/ui/flows/FlowApp.js +14 -5
  585. package/dist/ui/flows/FlowApp.js.map +1 -1
  586. package/dist/ui/flows/prompt-fields.d.ts +3 -1
  587. package/dist/ui/flows/prompt-fields.d.ts.map +1 -1
  588. package/dist/ui/flows/prompt-fields.js +10 -5
  589. package/dist/ui/flows/prompt-fields.js.map +1 -1
  590. package/dist/ui/flows/types.d.ts +5 -1
  591. package/dist/ui/flows/types.d.ts.map +1 -1
  592. package/dist/ui/runtime/command-chrome.d.ts.map +1 -1
  593. package/dist/ui/runtime/command-chrome.js +2 -0
  594. package/dist/ui/runtime/command-chrome.js.map +1 -1
  595. package/dist/ui/runtime/flow-transcript.d.ts +17 -0
  596. package/dist/ui/runtime/flow-transcript.d.ts.map +1 -0
  597. package/dist/ui/runtime/flow-transcript.js +38 -0
  598. package/dist/ui/runtime/flow-transcript.js.map +1 -0
  599. package/dist/ui/runtime/run-clack-flow.d.ts +7 -0
  600. package/dist/ui/runtime/run-clack-flow.d.ts.map +1 -1
  601. package/dist/ui/runtime/run-clack-flow.js +131 -17
  602. package/dist/ui/runtime/run-clack-flow.js.map +1 -1
  603. package/dist/valkey-sidecar.d.ts +24 -11
  604. package/dist/valkey-sidecar.d.ts.map +1 -1
  605. package/dist/valkey-sidecar.js +45 -25
  606. package/dist/valkey-sidecar.js.map +1 -1
  607. package/dist/windows-processes.d.ts +7 -0
  608. package/dist/windows-processes.d.ts.map +1 -0
  609. package/dist/windows-processes.js +31 -0
  610. package/dist/windows-processes.js.map +1 -0
  611. package/dist/write-if-changed.d.ts +12 -0
  612. package/dist/write-if-changed.d.ts.map +1 -0
  613. package/dist/write-if-changed.js +32 -0
  614. package/dist/write-if-changed.js.map +1 -0
  615. package/package.json +7 -6
  616. package/dist/systemd.d.ts +0 -26
  617. package/dist/systemd.d.ts.map +0 -1
  618. package/dist/systemd.js +0 -117
  619. package/dist/systemd.js.map +0 -1
@@ -6,31 +6,36 @@ import { composeHostPath } from "./compose-host-path.js";
6
6
  export { composeHostPath } from "./compose-host-path.js";
7
7
  import { ENGINE_SERVICE } from "./compose-engine-service.js";
8
8
  import { requireDockerDaemon, requireDockerDaemonAsync } from "./docker-runtime.js";
9
- import { askDocker, askDockerSync, NO_DOCKER_LIMIT, spawnDocker } from "./docker-exec.js";
9
+ import { askDocker, askDockerSync, DOCKER_QUERY_TIMEOUT_MS, NO_DOCKER_LIMIT, spawnDocker, } from "./docker-exec.js";
10
10
  import { fatalError } from "./ui/fatal.js";
11
- import { COMPOSE_DEV_KONG_PORT, defaultAppStaticDir, postgrestSchemaEnv, externalDatabaseUrl, hooksPathFromProject, preferredFunctionsPathFromProject, realtimeEnabled, serviceRoleRoutes, selfHostTlsEnabled, usesExternalDatabase, } from "./project-config.js";
11
+ import { plain } from "./ui/messages.js";
12
+ import { getActiveFlowApi } from "./ui/runtime/flow-session.js";
13
+ import { COMPOSE_DEV_KONG_PORT, defaultAppStaticDir, postgrestSchemaEnv, externalDatabaseUrl, hooksPathFromProject, preferredFunctionsPathFromProject, realtimeEnabled, publicEnvServerEnv, serviceRoleRoutes, selfHostTlsEnabled, usesExternalDatabase, } from "./project-config.js";
12
14
  import { hasStudioOverride, pinnedVersion, VERSION_PIN_LOCAL } from "./binary-cache.js";
13
15
  import { assertEngineVersionSupported, engineImageVersion } from "./engine-floor.js";
14
16
  import { buildKongDeclarative } from "./kong-config.js";
15
- import { keyspaceInPostgres } from "./cache-provider.js";
17
+ import { keyspaceInPostgres, keyspacePasswordRequired } from "./cache-provider.js";
18
+ import { checkedKeyspacePasswordFile, KEYSPACE_PASSWORD_CONTAINER_PATH, KEYSPACE_PASSWORD_FILE_ENV, } from "./keyspace-password-file.js";
16
19
  import { postgresImageFor, runningPostgresImage } from "./postgres-image.js";
17
20
  import { STUDIO_DEV_PORT } from "./studio-dev-server.js";
18
21
  import { readEnvFile, readEnvValue } from "./env-file.js";
22
+ import { OWN_BUCKET_S3_SETTINGS } from "./local-storage.js";
19
23
  import { composeDbPublish, DB_PUBLIC_HOST_ENV, SELF_HOST_BIND } from "./db-port.js";
20
24
  import { upKeepingKongCurrent, upKeepingKongCurrentAsync } from "./compose-kong.js";
21
25
  import { addressPoolExhaustionHint } from "./docker-address-pool.js";
22
26
  import { composeAuthProviderEnv } from "./auth-providers.js";
23
- import { BUNDLED_DB_USER, CONTROL_PLANE_SECRET_ENV, ENV_FILE_OVER_SHELL, SQL_EDITOR_PASSWORD_ENV, ensureControlPlaneSecret, envFileOverridesShell, } from "./local-secrets.js";
27
+ import { composeSamlEnv, ensureSamlPrivateKey } from "./saml-config.js";
28
+ import { BUNDLED_DB_USER, CONTROL_PLANE_SECRET_ENV, ENV_FILE_OVER_SHELL, SQL_EDITOR_PASSWORD_ENV, ensureControlPlaneSecret, ensureKeyspacePassword, ensureObjectStoreCredentials, KEYSPACE_PASSWORD_ENV, envFileOverridesShell, OBJECT_STORE_ACCESS_KEY_ENV, OBJECT_STORE_SECRET_KEY_ENV, } from "./local-secrets.js";
24
29
  import { fieldMaskingTierFromProject } from "./field-masking-tier.js";
25
30
  import { readRecordedTier } from "./recorded-field-masking-tier.js";
26
31
  import { projectHasVersionedModels } from "./model-versioning.js";
27
32
  import { POSTGREST_IMAGE } from "./postgrest-release.js";
28
33
  import { postgrestHookActorEnv } from "./hook-actor.js";
29
34
  import { IN_REPO_IMAGE_ENV, RELEASE_IMAGES, unpinnedImagesNote } from "./release-images.js";
30
- import { configMailerAutoconfirm } from "./mailer-autoconfirm.js";
35
+ import { configEmailEnabled, configMailerAutoconfirm, EMAIL_ENABLED_ENV } from "./mailer-autoconfirm.js";
31
36
  import { MAILER_PASSTHROUGH_ENV, mailerUrlPathsEnv } from "./mailer-env.js";
32
37
  import { studioRuntimeJson } from "./studio-auth-config.js";
33
- import { patchRouteManifest } from "./route-manifest.js";
38
+ import { switchServices } from "./route-manifest.js";
34
39
  /**
35
40
  * The control plane secret as the server and the control plane receive it, and nobody else.
36
41
  *
@@ -38,6 +43,41 @@ import { patchRouteManifest } from "./route-manifest.js";
38
43
  * refuse to start the stack and say which variable is missing.
39
44
  */
40
45
  const CONTROL_PLANE_SECRET_REQUIRED = `${CONTROL_PLANE_SECRET_ENV}: \${${CONTROL_PLANE_SECRET_ENV}:?${CONTROL_PLANE_SECRET_ENV} is missing from .env}`;
46
+ /**
47
+ * The keyspace password as the db, the server and Kong receive it, when the keyspace requires one
48
+ * (`keyspacePasswordRequired`). Required rather than defaulted, like the control plane secret:
49
+ * writeSelfHostCompose generates it first, and a stack started without it would refuse the server.
50
+ */
51
+ const KEYSPACE_PASSWORD_REQUIRED = `${KEYSPACE_PASSWORD_ENV}: \${${KEYSPACE_PASSWORD_ENV}:?${KEYSPACE_PASSWORD_ENV} is missing from .env}`;
52
+ /**
53
+ * The keyspace password line for a service that talks RESP to the keyspace, or nothing when it
54
+ * requires none. Kong is one with TLS on: its ACME plugin keeps certificates there, and kong.yml
55
+ * names this variable through Kong's env vault rather than holding the value. With the password in
56
+ * a file (`passwordFile`, R2-S16), the line names the file where {@link keyspacePasswordMount}
57
+ * puts it; writeSelfHostCompose refuses that beside TLS, since Kong's env vault cannot read a file.
58
+ */
59
+ function keyspacePasswordEnv(config, passwordFile) {
60
+ if (!keyspacePasswordRequired(config))
61
+ return "";
62
+ if (passwordFile === undefined)
63
+ return ` ${KEYSPACE_PASSWORD_REQUIRED}\n`;
64
+ return ` ${KEYSPACE_PASSWORD_FILE_ENV}: ${KEYSPACE_PASSWORD_CONTAINER_PATH}\n`;
65
+ }
66
+ /** The read-only mount of the project's keyspace password file, for a service the line above names it to. */
67
+ function keyspacePasswordMount(config, passwordFile) {
68
+ if (!keyspacePasswordRequired(config) || passwordFile === undefined)
69
+ return "";
70
+ return `${bindMount(passwordFile, KEYSPACE_PASSWORD_CONTAINER_PATH, true)}\n`;
71
+ }
72
+ /**
73
+ * The server's keyspace lines. Besides the environment compose gives it, the server reads the
74
+ * project's .env and .env.local, and refuses to start when it finds the password beside the file,
75
+ * so with a file the password is set blank here, which no dotenv file overrides.
76
+ */
77
+ function keyspaceServerEnv(config, passwordFile) {
78
+ const lines = keyspacePasswordEnv(config, passwordFile);
79
+ return lines !== "" && passwordFile !== undefined ? `${lines} ${KEYSPACE_PASSWORD_ENV}: ""\n` : lines;
80
+ }
41
81
  /** Env keys written when `versions` pins exist in supatype.config.ts. */
42
82
  export const COMPOSE_PINNED_IMAGE_ENV_KEYS = [
43
83
  "SUPATYPE_ENGINE_IMAGE",
@@ -58,9 +98,42 @@ const SEAWEEDFS_IMAGE = "chrislusf/seaweedfs:4.46@sha256:08d516132314207d10c8e37
58
98
  * durable, and a response-cache key beside them did not.
59
99
  */
60
100
  const ACME_KEY_PREFIX = "kong_acme:";
61
- /** Credentials the object store is configured with and the storage service is handed. */
62
- const OBJECT_STORE_ACCESS_KEY = "supatype";
63
- const OBJECT_STORE_SECRET_KEY = "supatype-secret";
101
+ /**
102
+ * The project's object store login as compose reads it from `.env` (issue 71: every stack used to
103
+ * share one pair, written into this file). Required, not defaulted: writeSelfHostCompose generates
104
+ * it before the file is written.
105
+ */
106
+ const OBJECT_STORE_ACCESS_KEY = `\${${OBJECT_STORE_ACCESS_KEY_ENV}:?${OBJECT_STORE_ACCESS_KEY_ENV} is missing from .env}`;
107
+ const OBJECT_STORE_SECRET_KEY = `\${${OBJECT_STORE_SECRET_KEY_ENV}:?${OBJECT_STORE_SECRET_KEY_ENV} is missing from .env}`;
108
+ /**
109
+ * Whether the stack keeps files in the project's own S3 bucket rather than a SeaweedFS of its own:
110
+ * production storage is "s3" (`storage.production`, init's "Production storage?" answer). Never the
111
+ * Docker dev stack, which this generator also writes and which follows the dev setting (0.9.2).
112
+ */
113
+ function keepsFilesInOwnBucket(config, devLocal) {
114
+ return !devLocal && config.storage?.production === "s3";
115
+ }
116
+ /** The project's S3 settings compose hands the storage service from `.env`, blank when unset. */
117
+ const OPTIONAL_OWN_BUCKET_SETTINGS = OWN_BUCKET_S3_SETTINGS.filter((name) => name !== "S3_BUCKET");
118
+ /**
119
+ * The storage service's S3 settings: the stack's SeaweedFS, every one passed so the service needs
120
+ * no defaults, or the project's own bucket in single-bucket mode, which only S3_BUCKET is required for.
121
+ */
122
+ function storageS3Env(ownBucket) {
123
+ if (!ownBucket) {
124
+ return ` S3_ENDPOINT: http://seaweedfs:8333
125
+ S3_REGION: us-east-1
126
+ S3_ACCESS_KEY: ${OBJECT_STORE_ACCESS_KEY}
127
+ S3_SECRET_KEY: ${OBJECT_STORE_SECRET_KEY}
128
+ S3_FORCE_PATH_STYLE: "true"
129
+ `;
130
+ }
131
+ return ` # storage.production is "s3": every bucket is a key prefix in the project's own S3 bucket, and
132
+ # the stack runs no SeaweedFS. A blank setting is read as unset (see the storage docs).
133
+ S3_BUCKET: "\${S3_BUCKET:?S3_BUCKET is missing from .env, and storage.production is s3 in supatype.config.ts}"
134
+ ${OPTIONAL_OWN_BUCKET_SETTINGS.map((name) => ` ${name}: "\${${name}:-}"`).join("\n")}
135
+ `;
136
+ }
64
137
  /**
65
138
  * The compose volume key Postgres keeps its data in. Docker names the volume
66
139
  * `<compose project>_<key>`, and `supatype dev --reset-db` removes it by that name, so the key is
@@ -183,14 +256,12 @@ function supportedEngineImage(image, from) {
183
256
  * world-readable and the per-bucket policy decorative, which is the opposite of what
184
257
  * `applyPublicPolicy` is for: a bucket is public because its policy says so.
185
258
  */
186
- export function renderSeaweedIdentities() {
259
+ export function renderSeaweedIdentities(credentials) {
187
260
  const identities = {
188
261
  identities: [
189
262
  {
190
263
  name: "supatype",
191
- credentials: [
192
- { accessKey: OBJECT_STORE_ACCESS_KEY, secretKey: OBJECT_STORE_SECRET_KEY },
193
- ],
264
+ credentials: [{ accessKey: credentials.accessKey, secretKey: credentials.secretKey }],
194
265
  actions: ["Admin", "Read", "List", "Tagging", "Write"],
195
266
  },
196
267
  ],
@@ -207,6 +278,10 @@ export function selfHostComposePaths(cwd) {
207
278
  s3ConfigPath: join(dir, "s3.json"),
208
279
  };
209
280
  }
281
+ /** The project folder a compose file {@link selfHostComposePaths} names lives in. */
282
+ export function projectRootOfComposePath(composePath) {
283
+ return dirname(dirname(dirname(composePath)));
284
+ }
210
285
  export function appUpstreamForCompose(config) {
211
286
  if (config.app.mode !== "proxy")
212
287
  return undefined;
@@ -411,6 +486,16 @@ function corsOriginsEnv(config) {
411
486
  const fromEnv = "${SUPATYPE_CORS_ALLOW_ORIGINS:-}";
412
487
  return configured.length > 0 ? `${configured.join(",")},${fromEnv}` : fromEnv;
413
488
  }
489
+ /**
490
+ * The server's `SUPATYPE_PUBLIC_ENV` line, ending in a newline, for `server.public_env: false`;
491
+ * empty otherwise, leaving the server's default.
492
+ */
493
+ function publicEnvForCompose(config) {
494
+ const value = publicEnvServerEnv(config)["SUPATYPE_PUBLIC_ENV"];
495
+ if (value === undefined)
496
+ return "";
497
+ return ` # server.public_env: no /supatype-env.json or /supatype-env.js.\n SUPATYPE_PUBLIC_ENV: "${value}"\n`;
498
+ }
414
499
  function serverAppEnvForCompose(config, devLocal) {
415
500
  const mode = config.app.mode ?? "none";
416
501
  const lines = [` SUPATYPE_APP_MODE: ${mode}`];
@@ -446,6 +531,40 @@ function networksClause(networks) {
446
531
  function networksBlock(functionsDb) {
447
532
  return `networks:\n ${FUNCTIONS_NETWORK}: {}\n${functionsDb ? ` ${FUNCTIONS_DB_NETWORK}: {}\n` : ""}`;
448
533
  }
534
+ /**
535
+ * Every container's log, rotated: 0.9.1 release test RB8.
536
+ *
537
+ * With no `logging:` a container writes to the daemon's default driver, and on a Linux server that
538
+ * is `json-file` with no size limit at all. An idle stack's Postgres wrote about 0.8 GB a day there,
539
+ * so the disk of the server the deploy guide describes filled in weeks and the database stopped.
540
+ * Docker Desktop's `local` default rotates, which is why nobody saw it on a laptop.
541
+ *
542
+ * `json-file` rather than `local` because it is what `docker logs` and every log shipper read
543
+ * without configuration. The sizes come from `.env`, as every other knob in this file does: the file
544
+ * is regenerated on every write, so an edit to it would not last.
545
+ */
546
+ const LOGGING_ANCHOR = `x-logging: &default-logging
547
+ driver: json-file
548
+ options:
549
+ max-size: "\${SUPATYPE_LOG_MAX_SIZE:-10m}"
550
+ max-file: "\${SUPATYPE_LOG_MAX_FILE:-5}"
551
+ `;
552
+ /** A service's `logging:` line, pointing at {@link LOGGING_ANCHOR}. */
553
+ const LOGGING = " logging: *default-logging";
554
+ /**
555
+ * A long-running service's restart policy: restarted when it fails, five times at most. Never a
556
+ * one-shot tool (`schema-engine`), which is meant to exit.
557
+ *
558
+ * 0.9.2 release test (N-FF11): only the server had one. A storage service that refused its S3
559
+ * settings exited 1 under policy `no` and stayed down, and so did any service that failed on
560
+ * something transient, a store or database still starting. Bounded, as the server's always was,
561
+ * rather than `unless-stopped`: a real misconfiguration ends exited with its reason in its log, which
562
+ * is what the CLI's watch on a starting stack looks for (stack-exit-watch.ts), instead of
563
+ * restarting for ever.
564
+ */
565
+ const RESTART = " restart: on-failure:5";
566
+ /** A long-running service's {@link LOGGING} and {@link RESTART} lines, which nearly every service has together. */
567
+ const SERVICE_DEFAULTS = `${LOGGING}\n${RESTART}`;
449
568
  /** Whether `url` (functions' direct database URL) names the stack's own `db` service. */
450
569
  export function namesComposeDatabase(url) {
451
570
  try {
@@ -474,6 +593,7 @@ export function renderSelfHostCompose(config, cwd = process.cwd(), options) {
474
593
  const postgrestUrl = postgrestDatabaseUrl(config);
475
594
  const sqlEditorUrl = sqlEditorDatabaseUrl(config);
476
595
  const devLocal = options?.devLocal === true;
596
+ const ownBucket = keepsFilesInOwnBucket(config, devLocal);
477
597
  // An external database is not on any network of this stack.
478
598
  const functionsDb = options?.functionsDatabase === true && !external;
479
599
  const gatewayNetworks = networksClause(["default", FUNCTIONS_NETWORK]);
@@ -489,6 +609,8 @@ export function renderSelfHostCompose(config, cwd = process.cwd(), options) {
489
609
  const publicApiUrl = `\${API_EXTERNAL_URL:-${externalUrlFallback}}`;
490
610
  // OAuth providers hang their default callback off the same public URL the server is told it has.
491
611
  const authProviderEnv = composeAuthProviderEnv(config, publicApiUrl);
612
+ // SAML's service provider sits under the same public URL, at /auth/v1 like the OAuth callback.
613
+ const samlEnv = composeSamlEnv(config, publicApiUrl);
492
614
  const studioHostDev = devLocal && hasStudioOverride(config);
493
615
  const appEnv = serverAppEnvForCompose(config, devLocal);
494
616
  const staticDir = appStaticDir(config);
@@ -504,6 +626,7 @@ export function renderSelfHostCompose(config, cwd = process.cwd(), options) {
504
626
  : `
505
627
  studio:
506
628
  ${studioService}
629
+ ${SERVICE_DEFAULTS}
507
630
  environment:
508
631
  SUPATYPE_CLOUD_JSON: '${studioRuntimeJson(config, publicApiUrl)}'
509
632
  expose:
@@ -551,12 +674,17 @@ ${studioService}
551
674
  `;
552
675
  // One source for the credentials: the server is configured with them and the storage service is
553
676
  // handed them, and a mismatch does not fail at start, it fails at the first upload.
554
- const objectStoreBlock = ` seaweedfs:
677
+ const objectStoreBlock = ownBucket ? "" : ` seaweedfs:
555
678
  # Identities come from a config file rather than env vars, and the anonymous identity is
556
679
  # deliberately absent: a bucket is public because of its policy, never because the server is
557
680
  # open. Written beside this file by the same generator, so the two cannot drift.
558
681
  image: \${SUPATYPE_SEAWEEDFS_IMAGE:-${SEAWEEDFS_IMAGE}}
682
+ ${SERVICE_DEFAULTS}
559
683
  command: server -dir=/data -s3 -s3.port=8333 -s3.config=/etc/seaweedfs/s3.json
684
+ environment:
685
+ # Read by nothing inside. The object store loads s3.json only when it starts, so the login is
686
+ # named here to make compose restart it whenever the login changes, as it does storage.
687
+ SUPATYPE_S3_LOGIN: "${OBJECT_STORE_ACCESS_KEY}:${OBJECT_STORE_SECRET_KEY}"
560
688
  volumes:
561
689
  - storage-data:/data
562
690
  ${mounts.seaweed}
@@ -570,11 +698,17 @@ ${mounts.seaweed}
570
698
  retries: 20
571
699
  start_period: 5s
572
700
  ${seaweedPorts}`;
701
+ // 0.9.2 release test (N-RB2): the keyspace requires the project's password where the image takes
702
+ // one, and everything that talks RESP to it is handed the same value from .env, or the same file
703
+ // (R2-S16).
704
+ const keyspacePasswordFile = options?.keyspacePasswordFile;
705
+ const keyspaceAuthEnv = keyspacePasswordEnv(config, keyspacePasswordFile);
706
+ const keyspaceMount = keyspacePasswordMount(config, keyspacePasswordFile);
573
707
  const kongTlsEnv = tlsEnabled
574
708
  ? ` KONG_PROXY_LISTEN: "0.0.0.0:8000, 0.0.0.0:8443 ssl"
575
709
  KONG_LUA_SSL_TRUSTED_CERTIFICATE: system
576
710
  KONG_LUA_SSL_VERIFY_DEPTH: "2"
577
- `
711
+ ${keyspaceAuthEnv}`
578
712
  : "";
579
713
  const kongPorts = tlsEnabled
580
714
  ? ` - "80:8000"
@@ -592,6 +726,7 @@ ${seaweedPorts}`;
592
726
  : `
593
727
  valkey:
594
728
  image: \${SUPATYPE_VALKEY_IMAGE:-valkey/valkey:8-alpine}
729
+ ${SERVICE_DEFAULTS}
595
730
  command: ["valkey-server", "--appendonly", "yes"]
596
731
  expose:
597
732
  - "6379"
@@ -608,9 +743,8 @@ ${seaweedPorts}`;
608
743
  # then re-run \`supatype self-host compose up -d\`. Kong publishes :80/:443 and provisions certs automatically.
609
744
  `;
610
745
  // An external database is not ours to declare a volume for.
611
- const volumesBlock = `volumes:
612
- ${external ? "" : ` ${DB_VOLUME_KEY}:\n`} storage-data:
613
- ${keyspaceInPg ? "" : " valkey-data:\n"}`;
746
+ const volumes = `${external ? "" : ` ${DB_VOLUME_KEY}:\n`}${ownBucket ? "" : " storage-data:\n"}${keyspaceInPg ? "" : " valkey-data:\n"}`;
747
+ const volumesBlock = volumes === "" ? "" : `volumes:\n${volumes}`;
614
748
  // `depends_on` for the services that talk to Postgres. With an external database there is no
615
749
  // container to wait on, so the clause disappears entirely and each service retries on connect
616
750
  // instead: which is also what covers a database that restarts *after* boot, something no
@@ -631,7 +765,7 @@ ${keyspaceInPg ? "" : " valkey-data:\n"}`;
631
765
  //
632
766
  // A later push succeeds, which is exactly what made it read as an intermittent mystery. It
633
767
  // lands on the first push after a stack comes up, which is the first push a new user ever runs.
634
- const storageDependency = ` depends_on:
768
+ const storageDependency = ownBucket ? dbDependency : ` depends_on:
635
769
  ${dbDependencyClause} seaweedfs:
636
770
  condition: service_healthy
637
771
  `;
@@ -646,6 +780,7 @@ ${dbDependencyClause} seaweedfs:
646
780
  const realtimeBlock = realtime
647
781
  ? ` realtime:
648
782
  image: ${inRepoImage("realtime")}
783
+ ${SERVICE_DEFAULTS}
649
784
  expose:
650
785
  - "4000"
651
786
  - "4001"
@@ -746,7 +881,7 @@ ${dbDependency}`
746
881
  # Named here rather than left to the image because only this file knows both features are in
747
882
  # the same stack.
748
883
  SUPATYPE_KEYSPACE_OUTPUT_PLUGIN_LIBRARIES: "supacache_keys, wal2json"
749
- `
884
+ ${keyspaceAuthEnv}`
750
885
  : "";
751
886
  // Not published to the host: the keyspace is reachable to the compose network
752
887
  // (server, Kong) and nothing else. A RESP port on a public interface is an
@@ -763,6 +898,7 @@ ${dbDependency}`
763
898
  `
764
899
  : ` db:
765
900
  image: \${SUPATYPE_POSTGRES_IMAGE:-${runningPostgresImage(config)}}
901
+ ${SERVICE_DEFAULTS}
766
902
  ${functionsDb ? networksClause(["default", FUNCTIONS_DB_NETWORK]) : ""} environment:
767
903
  POSTGRES_USER: \${POSTGRES_USER:-supatype_admin}
768
904
  POSTGRES_PASSWORD: \${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is missing from .env}
@@ -773,7 +909,7 @@ ${functionsDb ? networksClause(["default", FUNCTIONS_DB_NETWORK]) : ""} envir
773
909
  SUPATYPE_SQL_EDITOR_PASSWORD: \${SUPATYPE_SQL_EDITOR_PASSWORD:?SUPATYPE_SQL_EDITOR_PASSWORD is missing from .env}
774
910
  ${keyspaceDbEnv}${dbPorts}${keyspaceExpose} volumes:
775
911
  - ${DB_VOLUME_KEY}:/var/lib/postgresql/data
776
- healthcheck:
912
+ ${keyspaceMount} healthcheck:
777
913
  # -h 127.0.0.1 forces TCP. Without it \`pg_isready\` uses the Unix socket, which the
778
914
  # entrypoint's temporary init server is already listening on while TCP is still refused,
779
915
  # so the container reported healthy, \`depends_on: service_healthy\` released, and every
@@ -794,9 +930,10 @@ ${keyspaceDbEnv}${dbPorts}${keyspaceExpose} volumes:
794
930
  # Named, so a compose command run by hand reaches this stack instead of starting a second one
795
931
  # under the folder's name. \`supatype self-host compose restart <service>\` saves running one.
796
932
  name: ${composeProject}
797
- services:
933
+ ${LOGGING_ANCHOR}services:
798
934
  ${dbServiceBlock} postgrest:
799
935
  image: ${POSTGREST_IMAGE}
936
+ ${SERVICE_DEFAULTS}
800
937
  expose:
801
938
  - "3000"
802
939
  environment:
@@ -821,18 +958,14 @@ ${dbServiceBlock} postgrest:
821
958
  ${hookActorLines(config)}${dbDependency}
822
959
  storage:
823
960
  image: ${inRepoImage("storage")}
961
+ ${SERVICE_DEFAULTS}
824
962
  expose:
825
963
  - "5000"
826
964
  environment:
827
965
  PORT: 5000
828
966
  DATABASE_URL: "${ownerUrl}"
829
967
  JWT_SECRET: \${JWT_SECRET:?JWT_SECRET is missing from .env}
830
- S3_ENDPOINT: http://seaweedfs:8333
831
- S3_REGION: us-east-1
832
- S3_ACCESS_KEY: ${OBJECT_STORE_ACCESS_KEY}
833
- S3_SECRET_KEY: ${OBJECT_STORE_SECRET_KEY}
834
- S3_FORCE_PATH_STYLE: "true"
835
- # Bytes, -1 for unlimited. A self-hosted project has no plan, so it has no limits until .env
968
+ ${storageS3Env(ownBucket)} # Bytes, -1 for unlimited. A self-hosted project has no plan, so it has no limits until .env
836
969
  # sets one; the service on its own defaults to the free tier's 1 GiB quota and 50 MB files.
837
970
  PROJECT_TIER: \${PROJECT_TIER:-enterprise}
838
971
  STORAGE_QUOTA: \${STORAGE_QUOTA:--1}
@@ -841,6 +974,7 @@ ${hookActorLines(config)}${dbDependency}
841
974
  ${storageDependency}
842
975
  functions-worker:
843
976
  image: ${inRepoImage("functions-worker")}
977
+ ${SERVICE_DEFAULTS}
844
978
  # An init as PID 1 passes the stop signal on: without one the worker ignored SIGTERM, and every
845
979
  # restart a deploy made waited out the whole stop timeout.
846
980
  init: true
@@ -910,6 +1044,7 @@ ${dbDependency}
910
1044
  ${realtimeBlock}
911
1045
  control-plane:
912
1046
  image: ${inRepoImage("control-plane")}
1047
+ ${SERVICE_DEFAULTS}
913
1048
  expose:
914
1049
  - "8080"
915
1050
  volumes:
@@ -935,6 +1070,7 @@ ${mounts.projectWritable}
935
1070
  ${realtimeControlPlaneEnv}${dbDependency}
936
1071
  server:
937
1072
  image: \${SUPATYPE_SERVER_IMAGE:-\${SUPATYPE_AUTH_IMAGE:-${RELEASE_IMAGES.server}}}
1073
+ ${LOGGING}
938
1074
  # host.docker.internal is a Docker Desktop name. On Linux it does not resolve unless it is
939
1075
  # mapped, so a project proxying the site or Studio to something on the host worked on macOS
940
1076
  # and Windows and failed on Linux with nothing reaching the app. host-gateway is Docker's own
@@ -948,7 +1084,7 @@ ${realtimeControlPlaneEnv}${dbDependency}
948
1084
  # on a slow host the gap is wide enough to lose it for good. Bounded
949
1085
  # rather than unlimited, so a real misconfiguration still stops and
950
1086
  # stays visible instead of hiding in a crash loop.
951
- restart: on-failure:5
1087
+ ${RESTART}
952
1088
  ${gatewayNetworks}${serverPorts} volumes:
953
1089
  # The project is read-only: the server reads the schema, the manifest and the functions, and
954
1090
  # has no business editing any of them.
@@ -961,7 +1097,7 @@ ${mounts.projectReadOnly}
961
1097
  # declared and never actually switched on. A narrower bind than making the whole project
962
1098
  # writable, because the rest of the tree keeps the guarantee.
963
1099
  ${mounts.projectState}
964
- working_dir: /project
1100
+ ${keyspaceMount} working_dir: /project
965
1101
  environment:
966
1102
  SUPATYPE_MODE: ${devLocal ? "dev" : "standalone"}
967
1103
  SUPATYPE_MANIFEST_PATH: .supatype/manifest.json
@@ -972,7 +1108,7 @@ ${mounts.projectState}
972
1108
  SUPATYPE_STORAGE_URL: http://storage:5000
973
1109
  SUPATYPE_URL: ${publicApiUrl}
974
1110
  SUPATYPE_ANON_KEY: \${ANON_KEY:-}
975
- SUPATYPE_SERVICE_ROLE_KEY: \${SERVICE_ROLE_KEY:-}
1111
+ ${publicEnvForCompose(config)} SUPATYPE_SERVICE_ROLE_KEY: \${SERVICE_ROLE_KEY:-}
976
1112
  SUPATYPE_SQL_DATABASE_URL: "${ownerUrl}"
977
1113
  # The SQL editor's own login, not a superuser. The owner URL above stays: the server falls
978
1114
  # back to it and uses it for role membership.
@@ -984,7 +1120,7 @@ ${realtimeServerEnv}
984
1120
  SUPATYPE_CONTROL_PLANE_URL: http://control-plane:8080
985
1121
  ${CONTROL_PLANE_SECRET_REQUIRED}
986
1122
  SUPATYPE_VALKEY_ADDR: ${respHost}:6379
987
- ${appEnv}
1123
+ ${keyspaceServerEnv(config, keyspacePasswordFile)}${appEnv}
988
1124
  SUPATYPE_API_HOST: 0.0.0.0
989
1125
  SUPATYPE_API_PORT: 9999
990
1126
  SUPATYPE_API_EXTERNAL_URL: ${publicApiUrl}
@@ -999,8 +1135,10 @@ ${appEnv}
999
1135
  SUPATYPE_JWT_AUD: authenticated
1000
1136
  SUPATYPE_JWT_DEFAULT_GROUP_NAME: authenticated
1001
1137
  SUPATYPE_JWT_ADMIN_ROLES: service_role,supatype_admin
1002
- # auth.email.enableConfirmations decides the fallback; a value in .env wins.
1003
- SUPATYPE_MAILER_AUTOCONFIRM: \${SUPATYPE_MAILER_AUTOCONFIRM:-${configMailerAutoconfirm(config)}}
1138
+ # auth.email.enabled and auth.email.enableConfirmations decide the fallbacks; a value in .env
1139
+ # wins. Unset, a standalone stack sends confirmation links and a dev one confirms at once.
1140
+ ${EMAIL_ENABLED_ENV}: \${${EMAIL_ENABLED_ENV}:-${configEmailEnabled(config)}}
1141
+ SUPATYPE_MAILER_AUTOCONFIRM: \${SUPATYPE_MAILER_AUTOCONFIRM:-${configMailerAutoconfirm(config, devLocal ? "dev" : "standalone")}}
1004
1142
  # Emailed links are SUPATYPE_API_EXTERNAL_URL plus these paths. The external URL is the
1005
1143
  # gateway's root, where / belongs to the app, so the server's default of /verify sent every
1006
1144
  # confirmation, magic-link and recovery link to a 404. The auth routes are under /auth/v1/.
@@ -1025,7 +1163,7 @@ ${composeEnvLines(mailerUrlPathsEnv())}
1025
1163
  # to get them and a resend or ses provider fell back to the noop mailer.
1026
1164
  ${composeEnvLines(Object.fromEntries(MAILER_PASSTHROUGH_ENV.map((name) => [name, `\${${name}:-}`])))}
1027
1165
  SUPATYPE_DISABLE_SIGNUP: \${DISABLE_SIGNUP:-false}
1028
- ${authProviderEnv}
1166
+ ${authProviderEnv}${samlEnv}
1029
1167
  depends_on:
1030
1168
  ${dbDependencyClause}${keyspaceInPg ? "" : " valkey:\n condition: service_started\n"} postgrest:
1031
1169
  condition: service_started
@@ -1039,6 +1177,7 @@ ${realtimeDependency} control-plane:
1039
1177
  ${objectStoreBlock}
1040
1178
  schema-engine:
1041
1179
  image: \${${ENGINE_SERVICE.imageVariable}:-${ENGINE_SERVICE.defaultImage}}
1180
+ ${LOGGING}
1042
1181
  profiles: ["tools"]
1043
1182
  entrypoint: ["${ENGINE_SERVICE.entrypoint}"]
1044
1183
  volumes:
@@ -1046,6 +1185,7 @@ ${mounts.engineProject}
1046
1185
  working_dir: ${ENGINE_SERVICE.projectDir}
1047
1186
  ${dbDependency}${studioBlock}${valkeyBlock}${tlsHintComment} kong:
1048
1187
  image: kong:3.6
1188
+ ${SERVICE_DEFAULTS}
1049
1189
  ${gatewayNetworks} # host.docker.internal is a Docker Desktop name. On Linux it does not resolve unless it is
1050
1190
  # mapped, so a project proxying the site or Studio to something on the host worked on macOS
1051
1191
  # and Windows and failed on Linux with nothing reaching the app. host-gateway is Docker's own
@@ -1097,38 +1237,41 @@ function ensureComposeManifest(cwd, config) {
1097
1237
  // The manifest is generated, not operator-authored, but `push` writes real values into it (the
1098
1238
  // schema, for one), so an existing file keeps every key but the routes below. Malformed, it is
1099
1239
  // left for the server to complain about rather than overwritten here.
1100
- if (existsSync(manifestPath)) {
1101
- patchRouteManifest(manifestPath, composeServiceRoutes(config), { keepMalformed: true });
1102
- return;
1103
- }
1104
- patchRouteManifest(manifestPath, {
1105
- schema: "public",
1106
- postgrest_url: "http://postgrest:3000",
1107
- ...composeServiceRoutes(config),
1108
- });
1240
+ const fresh = existsSync(manifestPath) ? {} : { schema: "public", postgrest_url: "http://postgrest:3000" };
1241
+ switchServices(manifestPath, composeServiceSwitches(config), { ...fresh, ...composeServiceRoutes(config) }, { keepMalformed: true });
1109
1242
  }
1110
1243
  /**
1111
1244
  * Where the server finds each service of this stack, set on every render rather than only into a
1112
1245
  * new file. Native dev shares the manifest and records its own host ports for realtime, functions
1113
1246
  * and storage, so a project moved from native to Docker kept native's URLs and the server proxied
1114
1247
  * every subscription and every /storage/v1 call to a port nothing in the stack listened on (502).
1115
- * An older CLI's `functions_enabled: false` is put right by the same write.
1116
1248
  */
1117
1249
  function composeServiceRoutes(config) {
1118
1250
  return {
1119
1251
  // This file always generates a `storage` service, and native dev records its own storage
1120
1252
  // service on a host port.
1121
1253
  storage_url: "http://storage:5000",
1122
- // Matches the compose file: a manifest advertising a service that was not generated is how
1123
- // the server ends up proxying subscriptions to a host that does not resolve. Undefined drops
1124
- // the key.
1125
- realtime_enabled: realtimeEnabled(config),
1254
+ // Undefined drops the key: no realtime service is generated (composeServiceSwitches).
1126
1255
  realtime_url: realtimeEnabled(config) ? "http://realtime:4000" : undefined,
1256
+ functions_worker_url: COMPOSE_FUNCTIONS_WORKER_URL,
1257
+ };
1258
+ }
1259
+ /**
1260
+ * Which services of this stack are switched on, set on every render with its routes. An older
1261
+ * CLI's `functions_enabled: false` is put right by the same write.
1262
+ */
1263
+ function composeServiceSwitches(config) {
1264
+ return {
1265
+ // The stack's storage is always on, its start value: native dev switches its own storage service
1266
+ // off and on, and a switch it left would switch off the stack's.
1267
+ storage: undefined,
1268
+ // Matches the compose file: a manifest advertising a service that was not generated is how
1269
+ // the server ends up proxying subscriptions to a host that does not resolve.
1270
+ realtime: realtimeEnabled(config),
1127
1271
  // True because this file *always* generates a `functions-worker` service and hands the server
1128
1272
  // `SUPATYPE_FUNCTIONS_WORKER_URL`. It said false, so the server answered 404 for every function
1129
1273
  // in a stack that was running a worker for them, provisioned, then switched off.
1130
- functions_enabled: true,
1131
- functions_worker_url: COMPOSE_FUNCTIONS_WORKER_URL,
1274
+ functions: true,
1132
1275
  };
1133
1276
  }
1134
1277
  /**
@@ -1277,16 +1420,27 @@ function resolveDrafts(cwd, config, options) {
1277
1420
  return options.drafts;
1278
1421
  return projectHasVersionedModels(cwd, config);
1279
1422
  }
1423
+ /**
1424
+ * The host file holding the keyspace password when the project names one (R2-S16), checked before
1425
+ * anything is written: both forms set, a file that is missing or empty, or a file beside HTTPS
1426
+ * (whose Kong cannot read one) stop here with what to change, rather than in a container later.
1427
+ */
1428
+ function composeKeyspacePasswordFile(cwd, config, options) {
1429
+ const use = { required: keyspacePasswordRequired(config), tls: selfHostTlsEnabled(config, options?.devLocal === true) };
1430
+ return checkedKeyspacePasswordFile(cwd, use, { brand: { intro: "Self-host compose" } })?.path;
1431
+ }
1280
1432
  export function writeSelfHostCompose(cwd, config, options) {
1281
1433
  // No URL-unsafe password check here: `supatype update` and the dev watcher write this file too,
1282
1434
  // and start nothing. up, render, restart and dev refuse before they start. push, diff and dev's
1283
1435
  // recovery only start the database, so they warn (startComposeDatabase in dev-compose.ts).
1284
1436
  assertExternalUrlMatchesEnv(cwd, config);
1285
1437
  assertBundledDbUser(cwd, config);
1438
+ const keyspacePasswordFile = composeKeyspacePasswordFile(cwd, config, options);
1286
1439
  const tier = resolveFieldMaskingTier(cwd, config, options);
1287
1440
  const resolved = {
1288
1441
  ...options,
1289
1442
  ...(tier !== undefined && { fieldMaskingTier: tier }),
1443
+ ...(keyspacePasswordFile !== undefined && { keyspacePasswordFile }),
1290
1444
  drafts: resolveDrafts(cwd, config, options),
1291
1445
  functionsDatabase: options?.functionsDatabase ?? namesComposeDatabase(readEnvValue(cwd, "SUPATYPE_FUNCTIONS_DB_URL", "")),
1292
1446
  };
@@ -1295,12 +1449,24 @@ export function writeSelfHostCompose(cwd, config, options) {
1295
1449
  mkdirSync(paths.dir, { recursive: true });
1296
1450
  // Before the file that requires it is written, so no stack is ever rendered without one.
1297
1451
  ensureControlPlaneSecret(cwd);
1452
+ // The keyspace password the same way, where the keyspace requires one (N-RB2) and the project
1453
+ // keeps it in .env. An existing project gets one on its next dev or up, and compose recreates db
1454
+ // and server with it.
1455
+ if (keyspacePasswordRequired(config) && keyspacePasswordFile === undefined)
1456
+ ensureKeyspacePassword(cwd);
1457
+ // The SAML signing key too, once SAML is on: the file requires it, and it must never change.
1458
+ ensureSamlPrivateKey(cwd, config);
1298
1459
  // No functions/ or hooks/ here: the worker mounts the whole project and treats a missing root as
1299
1460
  // nothing to serve, while an empty functions/ made `dev` scaffold function types into projects
1300
1461
  // that have no functions. `functions new` and `init` create it when there is one.
1301
1462
  ensureComposeManifest(cwd, config);
1302
1463
  writeFileSync(paths.composePath, renderSelfHostCompose(config, cwd, resolved), "utf8");
1303
- writeFileSync(paths.s3ConfigPath, renderSeaweedIdentities(), "utf8");
1464
+ // The object store's login, from the same `.env` values the compose file reads, generated first
1465
+ // when the project has none.
1466
+ // Not for a stack on the project's own bucket, which runs no object store.
1467
+ if (!keepsFilesInOwnBucket(config, options?.devLocal === true)) {
1468
+ writeFileSync(paths.s3ConfigPath, renderSeaweedIdentities(ensureObjectStoreCredentials(cwd)), "utf8");
1469
+ }
1304
1470
  const studioHostDev = options?.devLocal === true && hasStudioOverride(config);
1305
1471
  const tlsEnabled = selfHostTlsEnabled(config, options?.devLocal === true);
1306
1472
  const domain = config.server.domain?.trim();
@@ -1321,15 +1487,23 @@ export function writeSelfHostCompose(cwd, config, options) {
1321
1487
  email: acmeEmail,
1322
1488
  domain,
1323
1489
  redisHost: keyspaceInPostgres(config) ? "db" : "valkey",
1490
+ redisAuth: keyspacePasswordRequired(config),
1324
1491
  },
1325
1492
  }
1326
1493
  : {}),
1327
1494
  }), "utf8");
1328
1495
  return paths;
1329
1496
  }
1330
- /** Exit with a friendly compose failure message. */
1497
+ /**
1498
+ * What the last compose run that captured its output said when it failed, and the cause recognised,
1499
+ * or nothing. Each run starts it afresh. Said again in the fatal message: under dev's dashboard it
1500
+ * was printed only into the pane, which froze cut at the window's width, and the screen left after
1501
+ * the dashboard said only "docker compose failed" (0.9.2 round 2, R2-S10).
1502
+ */
1503
+ let lastComposeFailure = [];
1504
+ /** Exit with a friendly compose failure message, carrying the reason the failed run gave. */
1331
1505
  export function exitComposeFailed(status, context, brand) {
1332
- fatalError(`docker compose failed (exit ${status}).`, [context, "Check logs: supatype self-host compose logs"], { ...(brand !== undefined && { brand }), exitCode: status === 0 ? 1 : status });
1506
+ fatalError(`docker compose failed (exit ${status}).`, [...lastComposeFailure, context, "Check logs: supatype self-host compose logs"], { ...(brand !== undefined && { brand }), exitCode: status === 0 ? 1 : status });
1333
1507
  }
1334
1508
  /** The `docker` arguments for `docker compose <args>` on one project's file. */
1335
1509
  function composeInvocation(composePath, args, projectRoot, composeProject, quiet) {
@@ -1352,8 +1526,14 @@ function composeInvocation(composePath, args, projectRoot, composeProject, quiet
1352
1526
  * person watches and can stop, and a quiet run here is one of those too (docker-exec.ts).
1353
1527
  */
1354
1528
  export function runDockerCompose(composePath, args, projectRoot = process.cwd(), composeProject, options) {
1355
- requireDockerDaemon(options?.brand !== undefined ? { brand: options.brand } : undefined);
1356
- const quiet = options?.quiet === true;
1529
+ if (options?.skipDaemonProbe !== true)
1530
+ requireDockerDaemon(options?.brand !== undefined ? { brand: options.brand } : undefined);
1531
+ lastComposeFailure = [];
1532
+ // Inside a command's flow, docker's output is captured and its stdout logged there. Written
1533
+ // straight to the terminal, it landed in the frame the flow redraws, and every line above it
1534
+ // came out twice.
1535
+ const inFlow = getActiveFlowApi() !== null;
1536
+ const quiet = options?.quiet === true || inFlow;
1357
1537
  const runCompose = () => askDockerSync(composeInvocation(composePath, args, projectRoot, composeProject, quiet), {
1358
1538
  stdio: quiet ? "pipe" : "inherit",
1359
1539
  cwd: projectRoot,
@@ -1367,6 +1547,9 @@ export function runDockerCompose(composePath, args, projectRoot = process.cwd(),
1367
1547
  : runCompose();
1368
1548
  if (result.status !== 0)
1369
1549
  reportComposeFailure(args, quiet ? capturedComposeOutput(result) : null);
1550
+ // The flow's log takes the text a line at a time, blank lines dropped.
1551
+ else if (inFlow && options?.quiet !== true)
1552
+ plain(result.stdout.replace(/\r/g, "").trimEnd());
1370
1553
  return result.status ?? 1;
1371
1554
  }
1372
1555
  /**
@@ -1396,6 +1579,7 @@ export async function settleComposeRuns() {
1396
1579
  }
1397
1580
  async function quietComposeRun(composePath, args, projectRoot, composeProject, brand) {
1398
1581
  await requireDockerDaemonAsync(brand !== undefined ? { brand } : undefined);
1582
+ lastComposeFailure = [];
1399
1583
  const runCompose = () => askDockerCompose(composePath, args, projectRoot, composeProject, NO_DOCKER_LIMIT);
1400
1584
  // As in runDockerCompose: a Kong already running is reloaded when `up` moved what it routes to.
1401
1585
  const result = args[0] === "up"
@@ -1466,20 +1650,34 @@ function capturedComposeOutput(result) {
1466
1650
  .trim();
1467
1651
  }
1468
1652
  /**
1469
- * Say what a failed compose run printed, when the CLI captured it, and any cause it recognises.
1470
- * `captured` is null when the output already went to the terminal.
1653
+ * Say what a failed compose run printed, when the CLI captured it, and any cause it recognises,
1654
+ * and keep it for {@link exitComposeFailed}. `captured` is null when the output already went to the
1655
+ * terminal, which then keeps it too.
1471
1656
  */
1472
1657
  function reportComposeFailure(args, captured) {
1473
- if (captured)
1474
- console.error(`[supatype] docker compose: ${captured}`);
1475
- if (args[0] !== "up")
1476
- return;
1477
- for (const line of addressPoolExhaustionHint(captured))
1658
+ const hints = args[0] === "up" ? addressPoolExhaustionHint(captured) : [];
1659
+ const lines = [...(captured ? [`docker compose: ${captured}`] : []), ...hints];
1660
+ for (const line of lines)
1478
1661
  console.error(`[supatype] ${line}`);
1662
+ if (captured !== null)
1663
+ lastComposeFailure = lines;
1479
1664
  }
1480
1665
  /** Compose project name for a Supatype project, isolates docker state per project. */
1481
1666
  export function composeProjectName(projectName) {
1482
1667
  const slug = projectName.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
1483
1668
  return `supatype-${slug || "project"}`;
1484
1669
  }
1670
+ /**
1671
+ * The volumes Docker still holds for the compose project `composeProject`, by compose's own label;
1672
+ * none when Docker cannot say. `down --volumes` removes only those the compose file declares now,
1673
+ * so one a service left the file with (SeaweedFS's, after a switch to S3) is still here.
1674
+ */
1675
+ export function composeProjectVolumes(composeProject) {
1676
+ const listed = askDockerSync(["volume", "ls", "-q", "--filter", `label=com.docker.compose.project=${composeProject}`], {
1677
+ timeoutMs: DOCKER_QUERY_TIMEOUT_MS,
1678
+ });
1679
+ if (listed.status !== 0)
1680
+ return [];
1681
+ return listed.stdout.split(/\r?\n/).map((line) => line.trim()).filter((line) => line !== "");
1682
+ }
1485
1683
  //# sourceMappingURL=self-host-compose.js.map