@supatype/cli 0.1.6 → 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 (477) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-test.log +152 -102
  3. package/.turbo/turbo-typecheck.log +1 -1
  4. package/LICENSE +202 -0
  5. package/deno.d.ts +52 -0
  6. package/dist/app/framework.js +1 -1
  7. package/dist/app/framework.js.map +1 -1
  8. package/dist/augmentation-generator.d.ts +22 -0
  9. package/dist/augmentation-generator.d.ts.map +1 -1
  10. package/dist/augmentation-generator.js +19 -5
  11. package/dist/augmentation-generator.js.map +1 -1
  12. package/dist/binary-cache.d.ts +42 -6
  13. package/dist/binary-cache.d.ts.map +1 -1
  14. package/dist/binary-cache.js +76 -44
  15. package/dist/binary-cache.js.map +1 -1
  16. package/dist/cache-clean.d.ts +15 -0
  17. package/dist/cache-clean.d.ts.map +1 -0
  18. package/dist/cache-clean.js +76 -0
  19. package/dist/cache-clean.js.map +1 -0
  20. package/dist/cache-pins.d.ts +51 -0
  21. package/dist/cache-pins.d.ts.map +1 -0
  22. package/dist/cache-pins.js +184 -0
  23. package/dist/cache-pins.js.map +1 -0
  24. package/dist/cli-artifacts.d.ts +32 -0
  25. package/dist/cli-artifacts.d.ts.map +1 -0
  26. package/dist/cli-artifacts.js +49 -0
  27. package/dist/cli-artifacts.js.map +1 -0
  28. package/dist/cli-install-method.d.ts +27 -0
  29. package/dist/cli-install-method.d.ts.map +1 -0
  30. package/dist/cli-install-method.js +78 -0
  31. package/dist/cli-install-method.js.map +1 -0
  32. package/dist/cli-package-version.d.ts +1 -1
  33. package/dist/cli-package-version.d.ts.map +1 -1
  34. package/dist/cli-package-version.js +6 -1
  35. package/dist/cli-package-version.js.map +1 -1
  36. package/dist/cli-standalone.d.ts +13 -4
  37. package/dist/cli-standalone.d.ts.map +1 -1
  38. package/dist/cli-standalone.js +86 -31
  39. package/dist/cli-standalone.js.map +1 -1
  40. package/dist/cli-version-embedded.d.ts +10 -0
  41. package/dist/cli-version-embedded.d.ts.map +1 -0
  42. package/dist/cli-version-embedded.js +13 -0
  43. package/dist/cli-version-embedded.js.map +1 -0
  44. package/dist/cli.d.ts.map +1 -1
  45. package/dist/cli.js +7 -1
  46. package/dist/cli.js.map +1 -1
  47. package/dist/cloud-credentials.d.ts +34 -0
  48. package/dist/cloud-credentials.d.ts.map +1 -0
  49. package/dist/cloud-credentials.js +139 -0
  50. package/dist/cloud-credentials.js.map +1 -0
  51. package/dist/commands/add.js +1 -1
  52. package/dist/commands/add.js.map +1 -1
  53. package/dist/commands/admin.d.ts +11 -0
  54. package/dist/commands/admin.d.ts.map +1 -1
  55. package/dist/commands/admin.js +123 -21
  56. package/dist/commands/admin.js.map +1 -1
  57. package/dist/commands/adopt.js +1 -1
  58. package/dist/commands/adopt.js.map +1 -1
  59. package/dist/commands/app.js +2 -2
  60. package/dist/commands/app.js.map +1 -1
  61. package/dist/commands/cache.d.ts +1 -1
  62. package/dist/commands/cache.d.ts.map +1 -1
  63. package/dist/commands/cache.js +69 -73
  64. package/dist/commands/cache.js.map +1 -1
  65. package/dist/commands/cloud.d.ts.map +1 -1
  66. package/dist/commands/cloud.js +32 -8
  67. package/dist/commands/cloud.js.map +1 -1
  68. package/dist/commands/db.d.ts +3 -2
  69. package/dist/commands/db.d.ts.map +1 -1
  70. package/dist/commands/db.js +149 -3
  71. package/dist/commands/db.js.map +1 -1
  72. package/dist/commands/deploy.d.ts +9 -9
  73. package/dist/commands/deploy.js +12 -12
  74. package/dist/commands/deploy.js.map +1 -1
  75. package/dist/commands/dev.d.ts +3 -3
  76. package/dist/commands/dev.d.ts.map +1 -1
  77. package/dist/commands/dev.js +63 -23
  78. package/dist/commands/dev.js.map +1 -1
  79. package/dist/commands/doctor.d.ts +28 -0
  80. package/dist/commands/doctor.d.ts.map +1 -1
  81. package/dist/commands/doctor.js +60 -3
  82. package/dist/commands/doctor.js.map +1 -1
  83. package/dist/commands/engine.d.ts +1 -1
  84. package/dist/commands/engine.js +1 -1
  85. package/dist/commands/functions.d.ts +7 -0
  86. package/dist/commands/functions.d.ts.map +1 -1
  87. package/dist/commands/functions.js +45 -11
  88. package/dist/commands/functions.js.map +1 -1
  89. package/dist/commands/generate.d.ts.map +1 -1
  90. package/dist/commands/generate.js +5 -1
  91. package/dist/commands/generate.js.map +1 -1
  92. package/dist/commands/hooks.d.ts +12 -0
  93. package/dist/commands/hooks.d.ts.map +1 -0
  94. package/dist/commands/hooks.js +118 -0
  95. package/dist/commands/hooks.js.map +1 -0
  96. package/dist/commands/init.d.ts.map +1 -1
  97. package/dist/commands/init.js +64 -30
  98. package/dist/commands/init.js.map +1 -1
  99. package/dist/commands/internal.d.ts +6 -0
  100. package/dist/commands/internal.d.ts.map +1 -0
  101. package/dist/commands/internal.js +22 -0
  102. package/dist/commands/internal.js.map +1 -0
  103. package/dist/commands/link-helpers.d.ts.map +1 -1
  104. package/dist/commands/link-helpers.js +8 -2
  105. package/dist/commands/link-helpers.js.map +1 -1
  106. package/dist/commands/login.d.ts +7 -0
  107. package/dist/commands/login.d.ts.map +1 -0
  108. package/dist/commands/login.js +110 -0
  109. package/dist/commands/login.js.map +1 -0
  110. package/dist/commands/logs.d.ts +1 -1
  111. package/dist/commands/migrate.js +5 -5
  112. package/dist/commands/migrate.js.map +1 -1
  113. package/dist/commands/pg.d.ts +1 -1
  114. package/dist/commands/pg.js +1 -1
  115. package/dist/commands/plugins.js +1 -1
  116. package/dist/commands/plugins.js.map +1 -1
  117. package/dist/commands/pull.js +2 -2
  118. package/dist/commands/pull.js.map +1 -1
  119. package/dist/commands/push.d.ts.map +1 -1
  120. package/dist/commands/push.js +110 -7
  121. package/dist/commands/push.js.map +1 -1
  122. package/dist/commands/self-host.d.ts +1 -1
  123. package/dist/commands/self-host.js +1 -1
  124. package/dist/commands/self-update.d.ts +3 -2
  125. package/dist/commands/self-update.d.ts.map +1 -1
  126. package/dist/commands/self-update.js +31 -16
  127. package/dist/commands/self-update.js.map +1 -1
  128. package/dist/commands/status.d.ts +1 -1
  129. package/dist/commands/update.d.ts +1 -1
  130. package/dist/commands/update.js +1 -1
  131. package/dist/config.d.ts +1 -1
  132. package/dist/config.d.ts.map +1 -1
  133. package/dist/config.js +19 -4
  134. package/dist/config.js.map +1 -1
  135. package/dist/db-preflight.d.ts +78 -0
  136. package/dist/db-preflight.d.ts.map +1 -0
  137. package/dist/db-preflight.js +452 -0
  138. package/dist/db-preflight.js.map +1 -0
  139. package/dist/dev-compose.d.ts +4 -4
  140. package/dist/dev-compose.d.ts.map +1 -1
  141. package/dist/dev-compose.js +143 -88
  142. package/dist/dev-compose.js.map +1 -1
  143. package/dist/dev-log-filter.d.ts +1 -1
  144. package/dist/dev-log-filter.d.ts.map +1 -1
  145. package/dist/dev-log-filter.js +1 -1
  146. package/dist/dev-log-filter.js.map +1 -1
  147. package/dist/dev-ports.d.ts +2 -2
  148. package/dist/dev-ports.d.ts.map +1 -1
  149. package/dist/dev-ports.js +2 -2
  150. package/dist/dev-ports.js.map +1 -1
  151. package/dist/dev-session.d.ts +5 -5
  152. package/dist/dev-session.d.ts.map +1 -1
  153. package/dist/dev-session.js +6 -6
  154. package/dist/dev-session.js.map +1 -1
  155. package/dist/dev-shutdown.d.ts +5 -5
  156. package/dist/dev-shutdown.d.ts.map +1 -1
  157. package/dist/dev-shutdown.js +7 -7
  158. package/dist/dev-shutdown.js.map +1 -1
  159. package/dist/dev-task-colors.d.ts +1 -1
  160. package/dist/dev-task-colors.d.ts.map +1 -1
  161. package/dist/dev-task-colors.js +1 -1
  162. package/dist/dev-task-colors.js.map +1 -1
  163. package/dist/docker-postgres.d.ts +5 -5
  164. package/dist/docker-postgres.d.ts.map +1 -1
  165. package/dist/docker-postgres.js +5 -5
  166. package/dist/docker-postgres.js.map +1 -1
  167. package/dist/docker-runtime.d.ts +2 -2
  168. package/dist/docker-runtime.d.ts.map +1 -1
  169. package/dist/docker-runtime.js +5 -5
  170. package/dist/docker-runtime.js.map +1 -1
  171. package/dist/engine-client.d.ts +1 -1
  172. package/dist/engine-client.js +3 -3
  173. package/dist/engine-client.js.map +1 -1
  174. package/dist/engine-push-output.js +1 -1
  175. package/dist/engine-push-output.js.map +1 -1
  176. package/dist/ensure-binary.d.ts.map +1 -1
  177. package/dist/ensure-binary.js +17 -0
  178. package/dist/ensure-binary.js.map +1 -1
  179. package/dist/ensure-component-binaries.js +1 -1
  180. package/dist/ensure-component-binaries.js.map +1 -1
  181. package/dist/env-file.d.ts +40 -2
  182. package/dist/env-file.d.ts.map +1 -1
  183. package/dist/env-file.js +132 -11
  184. package/dist/env-file.js.map +1 -1
  185. package/dist/field-masking-tier.d.ts +50 -0
  186. package/dist/field-masking-tier.d.ts.map +1 -0
  187. package/dist/field-masking-tier.js +91 -0
  188. package/dist/field-masking-tier.js.map +1 -0
  189. package/dist/functions-deno-types.d.ts +24 -0
  190. package/dist/functions-deno-types.d.ts.map +1 -0
  191. package/dist/functions-deno-types.js +155 -0
  192. package/dist/functions-deno-types.js.map +1 -0
  193. package/dist/functions-router-gen.js +1 -1
  194. package/dist/gitignore.d.ts +2 -2
  195. package/dist/gitignore.d.ts.map +1 -1
  196. package/dist/gitignore.js +3 -3
  197. package/dist/gitignore.js.map +1 -1
  198. package/dist/hook-upload.d.ts +30 -0
  199. package/dist/hook-upload.d.ts.map +1 -0
  200. package/dist/hook-upload.js +86 -0
  201. package/dist/hook-upload.js.map +1 -0
  202. package/dist/hooks-generator.d.ts +8 -0
  203. package/dist/hooks-generator.d.ts.map +1 -0
  204. package/dist/hooks-generator.js +332 -0
  205. package/dist/hooks-generator.js.map +1 -0
  206. package/dist/index.d.ts +1 -1
  207. package/dist/index.js +1 -1
  208. package/dist/init-project-detect.d.ts +1 -1
  209. package/dist/init-project-detect.d.ts.map +1 -1
  210. package/dist/init-project-detect.js +1 -1
  211. package/dist/init-project-detect.js.map +1 -1
  212. package/dist/link.d.ts +4 -0
  213. package/dist/link.d.ts.map +1 -1
  214. package/dist/link.js +2 -0
  215. package/dist/link.js.map +1 -1
  216. package/dist/local-secrets.d.ts +71 -0
  217. package/dist/local-secrets.d.ts.map +1 -0
  218. package/dist/local-secrets.js +100 -0
  219. package/dist/local-secrets.js.map +1 -0
  220. package/dist/main.d.ts +2 -0
  221. package/dist/main.d.ts.map +1 -0
  222. package/dist/main.js +20 -0
  223. package/dist/main.js.map +1 -0
  224. package/dist/model-hooks.d.ts +73 -0
  225. package/dist/model-hooks.d.ts.map +1 -0
  226. package/dist/model-hooks.js +211 -0
  227. package/dist/model-hooks.js.map +1 -0
  228. package/dist/pgbouncer-userlist.d.ts +1 -1
  229. package/dist/pgbouncer-userlist.d.ts.map +1 -1
  230. package/dist/pgbouncer-userlist.js +2 -2
  231. package/dist/pgbouncer-userlist.js.map +1 -1
  232. package/dist/postgres-ctl.d.ts +12 -1
  233. package/dist/postgres-ctl.d.ts.map +1 -1
  234. package/dist/postgres-ctl.js +28 -5
  235. package/dist/postgres-ctl.js.map +1 -1
  236. package/dist/process-manager.d.ts +2 -2
  237. package/dist/process-manager.d.ts.map +1 -1
  238. package/dist/process-manager.js +4 -4
  239. package/dist/process-manager.js.map +1 -1
  240. package/dist/project-config.d.ts +122 -2
  241. package/dist/project-config.d.ts.map +1 -1
  242. package/dist/project-config.js +150 -1
  243. package/dist/project-config.js.map +1 -1
  244. package/dist/pull-utils.d.ts +2 -2
  245. package/dist/pull-utils.d.ts.map +1 -1
  246. package/dist/pull-utils.js +4 -4
  247. package/dist/pull-utils.js.map +1 -1
  248. package/dist/realtime-launch.js +1 -1
  249. package/dist/realtime-launch.js.map +1 -1
  250. package/dist/release-pins.d.ts +1 -1
  251. package/dist/release-pins.js +2 -2
  252. package/dist/release-pins.js.map +1 -1
  253. package/dist/resolve-api-url.js +1 -1
  254. package/dist/resolve-api-url.js.map +1 -1
  255. package/dist/resolve-target.d.ts +4 -0
  256. package/dist/resolve-target.d.ts.map +1 -1
  257. package/dist/resolve-target.js +69 -73
  258. package/dist/resolve-target.js.map +1 -1
  259. package/dist/rest-cache-admin.js +2 -2
  260. package/dist/rest-cache-admin.js.map +1 -1
  261. package/dist/runtime-routes.d.ts +1 -1
  262. package/dist/runtime-routes.js +1 -1
  263. package/dist/schema-ast-v2.d.ts +5 -4
  264. package/dist/schema-ast-v2.d.ts.map +1 -1
  265. package/dist/schema-ast-v2.js +5 -3
  266. package/dist/schema-ast-v2.js.map +1 -1
  267. package/dist/schema-push-lock.d.ts.map +1 -1
  268. package/dist/schema-push-lock.js +43 -16
  269. package/dist/schema-push-lock.js.map +1 -1
  270. package/dist/scripts/postinstall.d.ts +1 -1
  271. package/dist/scripts/postinstall.js +1 -1
  272. package/dist/self-host-compose.d.ts +26 -2
  273. package/dist/self-host-compose.d.ts.map +1 -1
  274. package/dist/self-host-compose.js +305 -73
  275. package/dist/self-host-compose.js.map +1 -1
  276. package/dist/service-role-check.d.ts +21 -0
  277. package/dist/service-role-check.d.ts.map +1 -0
  278. package/dist/service-role-check.js +85 -0
  279. package/dist/service-role-check.js.map +1 -0
  280. package/dist/storage-provision.d.ts +1 -1
  281. package/dist/storage-provision.js +3 -3
  282. package/dist/storage-provision.js.map +1 -1
  283. package/dist/studio-dev-server.d.ts +1 -1
  284. package/dist/studio-dev-server.d.ts.map +1 -1
  285. package/dist/systemd.d.ts +1 -1
  286. package/dist/systemd.js +1 -1
  287. package/dist/target-client.d.ts +17 -0
  288. package/dist/target-client.d.ts.map +1 -1
  289. package/dist/target-client.js +69 -17
  290. package/dist/target-client.js.map +1 -1
  291. package/dist/tsx-runner.js +1 -1
  292. package/dist/tsx-runner.js.map +1 -1
  293. package/dist/type-extractor.d.ts.map +1 -1
  294. package/dist/type-extractor.js +738 -34
  295. package/dist/type-extractor.js.map +1 -1
  296. package/dist/type-resolver.js +1 -1
  297. package/dist/type-resolver.js.map +1 -1
  298. package/dist/ui/brand.d.ts +1 -1
  299. package/dist/ui/brand.js +1 -1
  300. package/dist/ui/components/LogoWordmark.d.ts +1 -1
  301. package/dist/ui/components/LogoWordmark.d.ts.map +1 -1
  302. package/dist/ui/components/LogoWordmark.js +1 -1
  303. package/dist/ui/components/LogoWordmark.js.map +1 -1
  304. package/dist/ui/components/SelectField.js +1 -1
  305. package/dist/ui/components/SelectField.js.map +1 -1
  306. package/dist/ui/confirm.d.ts +1 -1
  307. package/dist/ui/confirm.js +1 -1
  308. package/dist/ui/fatal.d.ts +1 -1
  309. package/dist/ui/fatal.d.ts.map +1 -1
  310. package/dist/ui/fatal.js +1 -1
  311. package/dist/ui/fatal.js.map +1 -1
  312. package/dist/ui/flows/prompt-fields.js +1 -1
  313. package/dist/ui/flows/prompt-fields.js.map +1 -1
  314. package/dist/ui/interactive.d.ts +1 -1
  315. package/dist/ui/interactive.d.ts.map +1 -1
  316. package/dist/ui/interactive.js +1 -1
  317. package/dist/ui/interactive.js.map +1 -1
  318. package/dist/ui/progress.d.ts +1 -1
  319. package/dist/ui/progress.js +1 -1
  320. package/dist/ui/runtime/command-chrome.js +2 -2
  321. package/dist/ui/runtime/command-chrome.js.map +1 -1
  322. package/dist/ui/runtime/run-clack-flow.js +1 -1
  323. package/dist/ui/runtime/run-clack-flow.js.map +1 -1
  324. package/dist/ui/runtime/stdin-after-ink.d.ts.map +1 -1
  325. package/dist/ui/runtime/stdin-after-ink.js +4 -2
  326. package/dist/ui/runtime/stdin-after-ink.js.map +1 -1
  327. package/dist/ui/theme.d.ts +1 -1
  328. package/dist/ui/theme.js +1 -1
  329. package/dist/valkey-sidecar.d.ts +1 -1
  330. package/dist/valkey-sidecar.d.ts.map +1 -1
  331. package/dist/valkey-sidecar.js +2 -2
  332. package/dist/valkey-sidecar.js.map +1 -1
  333. package/package.json +6 -2
  334. package/scripts/build-release-artifacts.sh +112 -0
  335. package/scripts/generate-homebrew-formula.mjs +123 -0
  336. package/scripts/mirror-deno-release.sh +1 -1
  337. package/src/TYPE-RESOLUTION.md +31 -31
  338. package/src/app/framework.ts +1 -1
  339. package/src/augmentation-generator.ts +19 -6
  340. package/src/binary-cache.ts +94 -47
  341. package/src/cache-clean.ts +81 -0
  342. package/src/cache-pins.ts +243 -0
  343. package/src/cli-artifacts.ts +65 -0
  344. package/src/cli-install-method.ts +87 -0
  345. package/src/cli-package-version.ts +5 -1
  346. package/src/cli-standalone.ts +116 -34
  347. package/src/cli-version-embedded.ts +12 -0
  348. package/src/cli.ts +7 -1
  349. package/src/cloud-credentials.ts +183 -0
  350. package/src/commands/add.ts +1 -1
  351. package/src/commands/admin.ts +142 -27
  352. package/src/commands/adopt.ts +1 -1
  353. package/src/commands/app.ts +2 -2
  354. package/src/commands/cache.ts +92 -77
  355. package/src/commands/cloud.ts +32 -8
  356. package/src/commands/db.ts +164 -3
  357. package/src/commands/deploy.ts +12 -12
  358. package/src/commands/dev.ts +72 -23
  359. package/src/commands/doctor.ts +69 -3
  360. package/src/commands/engine.ts +1 -1
  361. package/src/commands/functions.ts +47 -10
  362. package/src/commands/generate.ts +5 -1
  363. package/src/commands/hooks.ts +138 -0
  364. package/src/commands/init.ts +65 -31
  365. package/src/commands/internal.ts +23 -0
  366. package/src/commands/link-helpers.ts +9 -2
  367. package/src/commands/login.ts +127 -0
  368. package/src/commands/logs.ts +1 -1
  369. package/src/commands/migrate.ts +5 -5
  370. package/src/commands/pg.ts +1 -1
  371. package/src/commands/plugins.ts +1 -1
  372. package/src/commands/pull.ts +2 -2
  373. package/src/commands/push.ts +124 -7
  374. package/src/commands/self-host.ts +1 -1
  375. package/src/commands/self-update.ts +41 -19
  376. package/src/commands/status.ts +1 -1
  377. package/src/commands/update.ts +1 -1
  378. package/src/config.ts +23 -4
  379. package/src/db-preflight.ts +575 -0
  380. package/src/dev-compose.ts +158 -89
  381. package/src/dev-log-filter.ts +1 -1
  382. package/src/dev-ports.ts +3 -3
  383. package/src/dev-session.ts +6 -6
  384. package/src/dev-shutdown.ts +8 -8
  385. package/src/dev-task-colors.ts +1 -1
  386. package/src/docker-postgres.ts +6 -6
  387. package/src/docker-runtime.ts +5 -5
  388. package/src/engine-client.ts +3 -3
  389. package/src/engine-push-output.ts +1 -1
  390. package/src/ensure-binary.ts +20 -0
  391. package/src/ensure-component-binaries.ts +1 -1
  392. package/src/env-file.ts +157 -11
  393. package/src/field-masking-tier.ts +107 -0
  394. package/src/functions-deno-types.ts +188 -0
  395. package/src/functions-router-gen.ts +1 -1
  396. package/src/gitignore.ts +3 -3
  397. package/src/hook-upload.ts +107 -0
  398. package/src/hooks-generator.ts +352 -0
  399. package/src/index.ts +1 -1
  400. package/src/init-project-detect.ts +1 -1
  401. package/src/link.ts +7 -0
  402. package/src/local-secrets.ts +104 -0
  403. package/src/main.ts +20 -0
  404. package/src/model-hooks.ts +260 -0
  405. package/src/pgbouncer-userlist.ts +2 -2
  406. package/src/postgres-ctl.ts +32 -5
  407. package/src/process-manager.ts +4 -4
  408. package/src/project-config.ts +237 -3
  409. package/src/pull-utils.ts +4 -4
  410. package/src/realtime-launch.ts +1 -1
  411. package/src/release-pins.ts +2 -2
  412. package/src/resolve-api-url.ts +1 -1
  413. package/src/resolve-target.ts +113 -68
  414. package/src/rest-cache-admin.ts +2 -2
  415. package/src/runtime-routes.ts +2 -2
  416. package/src/schema-ast-v2.ts +8 -5
  417. package/src/schema-push-lock.ts +56 -17
  418. package/src/scripts/postinstall.ts +1 -1
  419. package/src/self-host-compose.ts +348 -72
  420. package/src/service-role-check.ts +111 -0
  421. package/src/storage-provision.ts +3 -3
  422. package/src/studio-dev-server.ts +1 -1
  423. package/src/systemd.ts +1 -1
  424. package/src/target-client.ts +105 -18
  425. package/src/tsx-runner.ts +1 -1
  426. package/src/type-extractor.ts +885 -30
  427. package/src/type-resolver.ts +1 -1
  428. package/src/ui/README.md +1 -1
  429. package/src/ui/brand.ts +1 -1
  430. package/src/ui/components/LogoWordmark.tsx +1 -1
  431. package/src/ui/components/SelectField.tsx +1 -1
  432. package/src/ui/confirm.ts +1 -1
  433. package/src/ui/fatal.ts +1 -1
  434. package/src/ui/flows/prompt-fields.tsx +1 -1
  435. package/src/ui/interactive.ts +1 -1
  436. package/src/ui/progress.ts +1 -1
  437. package/src/ui/runtime/command-chrome.ts +2 -2
  438. package/src/ui/runtime/run-clack-flow.tsx +1 -1
  439. package/src/ui/runtime/stdin-after-ink.ts +4 -2
  440. package/src/ui/theme.ts +1 -1
  441. package/src/valkey-sidecar.ts +2 -2
  442. package/tests/access-composition.test.ts +667 -0
  443. package/tests/admin-studio-membership.test.ts +121 -0
  444. package/tests/api-schemas.test.ts +83 -0
  445. package/tests/archive-name-alias.test.ts +42 -0
  446. package/tests/augmentation-generator.test.ts +28 -0
  447. package/tests/cache-clean.test.ts +206 -0
  448. package/tests/cli-help.test.ts +11 -2
  449. package/tests/cli-install-method.test.ts +66 -0
  450. package/tests/command-chrome-coverage.test.ts +31 -26
  451. package/tests/command-chrome-wrap.test.ts +1 -0
  452. package/tests/db-preflight.test.ts +72 -0
  453. package/tests/doctor-render.test.ts +62 -0
  454. package/tests/doctor-service-role.test.ts +55 -0
  455. package/tests/engine-push-output.test.ts +1 -1
  456. package/tests/env-file.test.ts +121 -0
  457. package/tests/external-database-compose.test.ts +184 -0
  458. package/tests/external-database-config.test.ts +154 -0
  459. package/tests/field-masking-tier.test.ts +184 -0
  460. package/tests/functions-deno-types.test.ts +197 -0
  461. package/tests/homebrew-formula.test.ts +100 -0
  462. package/tests/hook-upload.test.ts +125 -0
  463. package/tests/hooks-generator.test.ts +212 -0
  464. package/tests/init.test.ts +5 -2
  465. package/tests/keys.test.ts +8 -2
  466. package/tests/local-secrets.test.ts +92 -0
  467. package/tests/model-hooks.test.ts +322 -0
  468. package/tests/runtime-contract.test.ts +113 -1
  469. package/tests/service-role-check.test.ts +109 -0
  470. package/tests/service-role-routes.test.ts +51 -0
  471. package/tests/storage-provision.test.ts +1 -1
  472. package/tests/target-client-refresh.test.ts +94 -0
  473. package/tests/type-extractor.test.ts +187 -0
  474. package/tsconfig.tsbuildinfo +1 -1
  475. package/vitest.config.ts +7 -1
  476. package/scripts/build-release-bundle.mjs +0 -27
  477. package/tests/engine-distribution.test.ts +0 -418
@@ -0,0 +1,332 @@
1
+ /**
2
+ * Generate `functions/_supatype/hooks.ts`: the typed handler surface for model hooks.
3
+ *
4
+ * Generated into the project rather than shipped as a package, for two reasons: a Deno function
5
+ * resolves a relative `.ts` import with no npm involved, and the types then move in lockstep with the
6
+ * schema they came from instead of with a release.
7
+ *
8
+ * The `hook()` adapter is why the functions worker needs no change at all: it wraps a typed handler
9
+ * into the `(req: Request) => Response` contract the worker already discovers and serves.
10
+ */
11
+ import { generateInsertType, generateRowType, generateUpdateType, resolveTableName, } from "./augmentation-generator.js";
12
+ /** Tables that declare at least one hook, sorted for a stable file. */
13
+ function hookedModels(ast) {
14
+ const models = ast?.models;
15
+ if (!Array.isArray(models))
16
+ return [];
17
+ return models
18
+ .filter((model) => {
19
+ const hooks = model.annotations
20
+ ?.platform?.hooks;
21
+ return typeof hooks === "object" && hooks !== null && Object.keys(hooks).length > 0;
22
+ })
23
+ .map((model) => ({ table: resolveTableName(model), fields: model.fields }))
24
+ .sort((a, b) => a.table.localeCompare(b.table));
25
+ }
26
+ /**
27
+ * The module source, or `null` when no model declares a hook.
28
+ *
29
+ * Returning null rather than an empty module keeps a `_supatype/hooks.ts` from appearing in projects
30
+ * that have no hooks, a generated file nobody imports is a file somebody eventually edits.
31
+ */
32
+ export function generateHooksModule(ast) {
33
+ const models = hookedModels(ast);
34
+ if (models.length === 0)
35
+ return null;
36
+ const tableEntries = models
37
+ .map((model) => ` ${JSON.stringify(model.table)}: {
38
+ Row: ${indent(denoSafe(generateRowType(model.fields)), 4)}
39
+ Insert: ${indent(denoSafe(generateInsertType(model.fields)), 4)}
40
+ Update: ${indent(denoSafe(generateUpdateType(model.fields)), 4)}
41
+ }`)
42
+ .join("\n");
43
+ return `// Generated by supatype CLI, do not edit manually.
44
+ //
45
+ // Typed handlers for the models that declare \`hooks\`. Import from a function beside it:
46
+ //
47
+ // import { hook, type BeforeChange } from "../_supatype/hooks.ts"
48
+ //
49
+ // const moderate: BeforeChange<"posts"> = async (ctx) => {
50
+ // if (ctx.operation === "insert") return { rows: ctx.rows }
51
+ // return {}
52
+ // }
53
+ //
54
+ // export default hook(moderate)
55
+ //
56
+ // One function can serve a model's whole lifecycle instead, since the worker takes one default
57
+ // export per directory:
58
+ //
59
+ // export default hooks({
60
+ // beforeChange: moderate,
61
+ // afterChange: reindex,
62
+ // })
63
+
64
+ /**
65
+ * Lexical editor state as JSON, or the plain string accepted for seeds and defaults.
66
+ *
67
+ * Structural rather than imported: the precise \`SerializedEditorState\` lives in
68
+ * \`@supatype/types/lexical\`, which a Deno function has no way to resolve.
69
+ */
70
+ export type RichTextValue = { readonly root: { readonly children: readonly unknown[] } } | string
71
+
72
+ export interface HookTables {
73
+ ${tableEntries}
74
+ }
75
+
76
+ /** Only the tables that declare a hook, so \`BeforeChange<"unhooked">\` is a compile error. */
77
+ export type HookedTable = keyof HookTables & string
78
+
79
+ interface HookBase {
80
+ readonly table: string
81
+ /** Claims from the JWT the server already verified. \`null\` for an anonymous caller. */
82
+ readonly user: { readonly sub: string; readonly role: string; readonly email?: string } | null
83
+ /** Correlates this hook with the request in server logs. */
84
+ readonly requestId: string
85
+ }
86
+
87
+ /**
88
+ * The rows this request is about to overwrite, fetched only if you ask.
89
+ *
90
+ * Resolved by the server from the in-flight request's own filter, as the caller's own role, so it
91
+ * cannot show you rows the caller could not read, and you cannot widen the filter. Capped:
92
+ * \`truncated\` is true when there were more, in which case acting on what you got means acting on a
93
+ * prefix you did not choose.
94
+ */
95
+ export type PreviousRows<T extends HookedTable> = () => Promise<{
96
+ rows: HookTables[T]["Row"][]
97
+ truncated: boolean
98
+ }>
99
+
100
+ export type BeforeChangeContext<T extends HookedTable> =
101
+ | (HookBase & { readonly operation: "insert"; readonly rows: HookTables[T]["Insert"][] })
102
+ | (HookBase & {
103
+ readonly operation: "update"
104
+ readonly patch: HookTables[T]["Update"]
105
+ /** PostgREST filter from the request, e.g. \`status=eq.draft\`. Not rewritable. */
106
+ readonly filter: string
107
+ readonly previous: PreviousRows<T>
108
+ })
109
+
110
+ export type BeforeDeleteContext<T extends HookedTable> = HookBase & {
111
+ readonly operation: "delete"
112
+ readonly filter: string
113
+ readonly previous: PreviousRows<T>
114
+ }
115
+
116
+ export type AfterChangeContext<T extends HookedTable> = HookBase & {
117
+ readonly operation: "insert" | "update"
118
+ /** Written rows: present only when the caller sent \`Prefer: return=representation\`. */
119
+ readonly rows?: HookTables[T]["Row"][]
120
+ }
121
+
122
+ export type AfterDeleteContext<T extends HookedTable> = HookBase & {
123
+ readonly operation: "delete"
124
+ readonly filter: string
125
+ }
126
+
127
+ /** Reject with a message, or with a status of your choosing. */
128
+ export interface HookRejection {
129
+ readonly reject: string | { readonly message: string; readonly status?: number; readonly code?: string }
130
+ }
131
+
132
+ export type BeforeChangeVerdict<T extends HookedTable> =
133
+ | Record<string, never>
134
+ | { readonly rows: HookTables[T]["Insert"][] }
135
+ | { readonly patch: HookTables[T]["Update"] }
136
+ | HookRejection
137
+
138
+ export type BeforeDeleteVerdict = Record<string, never> | HookRejection
139
+
140
+ export type BeforeChange<T extends HookedTable> = (
141
+ ctx: BeforeChangeContext<T>,
142
+ ) => BeforeChangeVerdict<T> | Promise<BeforeChangeVerdict<T>>
143
+
144
+ export type BeforeDelete<T extends HookedTable> = (
145
+ ctx: BeforeDeleteContext<T>,
146
+ ) => BeforeDeleteVerdict | Promise<BeforeDeleteVerdict>
147
+
148
+ export type AfterChange<T extends HookedTable> = (
149
+ ctx: AfterChangeContext<T>,
150
+ ) => void | Promise<void>
151
+
152
+ export type AfterDelete<T extends HookedTable> = (
153
+ ctx: AfterDeleteContext<T>,
154
+ ) => void | Promise<void>
155
+
156
+ /** Every handler a single function may serve, when one function covers a model's whole lifecycle. */
157
+ export interface HookHandlers<T extends HookedTable> {
158
+ readonly beforeChange?: BeforeChange<T>
159
+ readonly beforeDelete?: BeforeDelete<T>
160
+ readonly afterChange?: AfterChange<T>
161
+ readonly afterDelete?: AfterDelete<T>
162
+ }
163
+
164
+ type AnyHandler = (ctx: never) => unknown
165
+
166
+ interface WireContext {
167
+ table?: string
168
+ operation?: string
169
+ user?: unknown
170
+ requestId?: string
171
+ rows?: unknown[]
172
+ patch?: unknown
173
+ filter?: string
174
+ /**
175
+ * Server callback **path** for pre-write rows; absent when there are none to fetch.
176
+ *
177
+ * A path rather than a URL because the server does not know its own in-network address, while this
178
+ * worker is already told how to reach the stack.
179
+ */
180
+ previousPath?: string
181
+ }
182
+
183
+ /**
184
+ * Wrap a typed handler as the request handler the worker expects.
185
+ *
186
+ * The outcome travels as the **HTTP status**: 200 for proceed, 4xx for a rejection. That keeps the
187
+ * contract in the transport rather than in a second envelope inside the body, so a hook written by
188
+ * hand: or in another language, needs to know nothing about this file.
189
+ */
190
+ export function hook(handler: AnyHandler): (req: Request) => Promise<Response> {
191
+ return async (req: Request): Promise<Response> => {
192
+ if (req.method !== "POST") {
193
+ return json({ message: "A hook is invoked with POST" }, 405)
194
+ }
195
+
196
+ let wire: WireContext
197
+ try {
198
+ wire = (await req.json()) as WireContext
199
+ } catch {
200
+ // A 400 rather than a 500: the payload was wrong, the handler never ran.
201
+ return json({ message: "Hook payload was not JSON" }, 400)
202
+ }
203
+
204
+ const signature = req.headers.get("webhook-signature")
205
+ const ctx = {
206
+ table: wire.table ?? "",
207
+ operation: wire.operation ?? "",
208
+ user: wire.user ?? null,
209
+ requestId: wire.requestId ?? "",
210
+ ...(wire.rows !== undefined && { rows: wire.rows }),
211
+ ...(wire.patch !== undefined && { patch: wire.patch }),
212
+ ...(wire.filter !== undefined && { filter: wire.filter }),
213
+ ...(wire.previousPath !== undefined && {
214
+ previous: () => fetchPrevious(wire.previousPath as string, signature),
215
+ }),
216
+ }
217
+
218
+ let verdict: unknown
219
+ try {
220
+ verdict = await handler(ctx as never)
221
+ } catch (err) {
222
+ // An exception is not a rejection: the hook broke, so the server's onUnavailable policy should
223
+ // decide, and that is what a 500 asks for.
224
+ return json({ message: err instanceof Error ? err.message : "Hook threw" }, 500)
225
+ }
226
+
227
+ if (verdict === undefined || verdict === null) return json({}, 200)
228
+
229
+ const rejection = (verdict as HookRejection).reject
230
+ if (rejection !== undefined) {
231
+ const detail = typeof rejection === "string" ? { message: rejection } : rejection
232
+ const status = typeof detail.status === "number" ? detail.status : 422
233
+ return json(
234
+ { message: detail.message, ...(detail.code !== undefined && { code: detail.code }) },
235
+ // A rejection must be a 4xx: a hook that answered 500 would be read as unavailable and
236
+ // handed to onUnavailable, which is a different decision from "no".
237
+ status >= 400 && status < 500 ? status : 422,
238
+ )
239
+ }
240
+
241
+ return json(verdict as Record<string, unknown>, 200)
242
+ }
243
+ }
244
+
245
+ /**
246
+ * Serve several of a model's hooks from one function, dispatched on \`X-Supatype-Hook\`.
247
+ *
248
+ * The worker takes **one default export per function directory**, so \`hook(single)\` is one hook per
249
+ * directory. That is fine for a single moderation rule and tedious for a model whose whole lifecycle
250
+ * you want in one place, hence this. Point every event at the same function name in the schema:
251
+ *
252
+ * hooks: { beforeChange: "post-hooks", afterChange: "post-hooks" }
253
+ *
254
+ * An event arriving with no handler is a 200, not an error: the schema and this file can be out of
255
+ * step for one deploy, and failing a write because the *other* half has not shipped yet would be the
256
+ * wrong way round.
257
+ */
258
+ export function hooks(handlers: Record<string, AnyHandler | undefined>): (req: Request) => Promise<Response> {
259
+ return async (req: Request): Promise<Response> => {
260
+ const event = req.headers.get("x-supatype-hook") ?? ""
261
+ const handler = handlers[event]
262
+ if (handler === undefined) return json({}, 200)
263
+ return hook(handler)(req)
264
+ }
265
+ }
266
+
267
+ /**
268
+ * The stack's address from this worker's point of view.
269
+ *
270
+ * \`SUPATYPE_INTERNAL_URL\` in Compose is the in-network gateway; \`SUPATYPE_URL\` is the same value
271
+ * there. Never a public or host URL, \`localhost\` inside this container is this container.
272
+ */
273
+ function stackBaseUrl(): string {
274
+ const base =
275
+ Deno.env.get("SUPATYPE_INTERNAL_URL") ??
276
+ Deno.env.get("SUPATYPE_URL") ??
277
+ ""
278
+ if (base === "") {
279
+ throw new Error(
280
+ "ctx.previous() needs SUPATYPE_INTERNAL_URL or SUPATYPE_URL to reach the API from this function",
281
+ )
282
+ }
283
+ // No regex: a backslash in a template literal is one escape away from emitting broken code, and a
284
+ // generator's output has to be right the first time.
285
+ return base.endsWith("/") ? base.slice(0, -1) : base
286
+ }
287
+
288
+ async function fetchPrevious(
289
+ path: string,
290
+ signature: string | null,
291
+ ): Promise<{ rows: unknown[]; truncated: boolean }> {
292
+ const url = stackBaseUrl() + path
293
+ const res = await fetch(url, {
294
+ method: "POST",
295
+ headers: signature !== null ? { "webhook-signature": signature } : {},
296
+ })
297
+ if (!res.ok) {
298
+ throw new Error(\`Could not read the rows this write affects (\${res.status})\`)
299
+ }
300
+ const body = (await res.json()) as { rows?: unknown[]; truncated?: boolean }
301
+ return { rows: body.rows ?? [], truncated: body.truncated === true }
302
+ }
303
+
304
+ function json(body: unknown, status: number): Response {
305
+ return new Response(JSON.stringify(body), {
306
+ status,
307
+ headers: { "Content-Type": "application/json" },
308
+ })
309
+ }
310
+ `;
311
+ }
312
+ /**
313
+ * Replace cross-package type imports the client types use but a hook cannot resolve.
314
+ *
315
+ * `RichText` normally generates `import("@supatype/types/lexical").SerializedEditorState`. That works
316
+ * in an app, where the package is installed, but this file lives in `functions/`, is imported by a
317
+ * Deno handler, and has no node_modules to reach into. Left alone, any hooked model with a rich-text
318
+ * column emitted a module that failed to compile in the user's editor. Caught by compiling the
319
+ * generated file in a test rather than by a reader reporting it.
320
+ */
321
+ function denoSafe(source) {
322
+ return source.replaceAll('import("@supatype/types/lexical").SerializedEditorState', "RichTextValue");
323
+ }
324
+ /** Re-indent a generated type literal so the emitted file reads as if it were written by hand. */
325
+ function indent(source, spaces) {
326
+ const pad = " ".repeat(spaces);
327
+ return source
328
+ .split("\n")
329
+ .map((line, i) => (i === 0 ? line : `${pad}${line}`))
330
+ .join("\n");
331
+ }
332
+ //# sourceMappingURL=hooks-generator.js.map
@@ -0,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AACf,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @supatype/cli programmatic API for invoking the engine.
2
+ * @supatype/cli: programmatic API for invoking the engine.
3
3
  *
4
4
  * For CLI usage: use the `supatype` binary.
5
5
  */
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @supatype/cli programmatic API for invoking the engine.
2
+ * @supatype/cli: programmatic API for invoking the engine.
3
3
  *
4
4
  * For CLI usage: use the `supatype` binary.
5
5
  */
@@ -9,6 +9,6 @@ export interface DetectedProjectSetup {
9
9
  /** Human-readable bullets for the init wizard. */
10
10
  summaryLines: string[];
11
11
  }
12
- /** Inspect `cwd` before init prompts Vite, static dir, existing Supatype config. */
12
+ /** Inspect `cwd` before init prompts, Vite, static dir, existing Supatype config. */
13
13
  export declare function detectProjectSetup(cwd: string): DetectedProjectSetup;
14
14
  //# sourceMappingURL=init-project-detect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init-project-detect.d.ts","sourceRoot":"","sources":["../src/init-project-detect.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,gBAAgB,EAAE,OAAO,CAAA;IACzB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,OAAO,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,kDAAkD;IAClD,YAAY,EAAE,MAAM,EAAE,CAAA;CACvB;AAsCD,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAiCpE"}
1
+ {"version":3,"file":"init-project-detect.d.ts","sourceRoot":"","sources":["../src/init-project-detect.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,gBAAgB,EAAE,OAAO,CAAA;IACzB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,OAAO,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,kDAAkD;IAClD,YAAY,EAAE,MAAM,EAAE,CAAA;CACvB;AAsCD,qFAAqF;AACrF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAiCpE"}
@@ -49,7 +49,7 @@ function detectStaticDir(cwd) {
49
49
  return "./public";
50
50
  return "./public";
51
51
  }
52
- /** Inspect `cwd` before init prompts Vite, static dir, existing Supatype config. */
52
+ /** Inspect `cwd` before init prompts, Vite, static dir, existing Supatype config. */
53
53
  export function detectProjectSetup(cwd) {
54
54
  let entries = [];
55
55
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"init-project-detect.js","sourceRoot":"","sources":["../src/init-project-detect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,iBAAiB,GAAG;IACxB,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;CACT,CAAA;AAEV,MAAM,qBAAqB,GAAG;IAC5B,oBAAoB;IACpB,oBAAoB;IACpB,qBAAqB;CACb,CAAA;AAcV,SAAS,cAAc,CAAC,GAAW;IACjC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAA;IACzC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,KAAK,CAAA;IACtC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAGnD,CAAA;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,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L,gBAAgB;QAChB,iBAAiB;QACjB,OAAO;QACP,aAAa;QACb,UAAU;QACV,SAAS;QACT,YAAY;KACb,CAAA;AACH,CAAC"}
package/dist/link.d.ts CHANGED
@@ -14,7 +14,10 @@ export interface ProjectLink {
14
14
  kind: ProjectLinkKind;
15
15
  projectRef: string;
16
16
  defaultEnvironment: string;
17
+ /** Access token (cloud user JWT) or self-host SERVICE_ROLE_KEY. */
17
18
  token?: string;
19
+ /** Cloud GoTrue refresh token, used to renew short-lived access JWTs. */
20
+ refreshToken?: string;
18
21
  orgId?: string | undefined;
19
22
  cloudApiUrl?: string;
20
23
  linkedAt: string;
@@ -56,6 +59,7 @@ export declare function createCloudLink(params: {
56
59
  projectRef: string;
57
60
  cloudApiUrl: string;
58
61
  token: string;
62
+ refreshToken?: string;
59
63
  orgId?: string | undefined;
60
64
  environments?: Array<{
61
65
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,EAAG,CAAU,CAAA;AACtC,eAAO,MAAM,SAAS,wBAAwB,CAAA;AAC9C,eAAO,MAAM,iBAAiB,yBAAyB,CAAA;AACvD,eAAO,MAAM,kBAAkB,0BAA0B,CAAA;AAEzD,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,WAAW,GAAG,OAAO,CAAA;AAE7D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,YAAY,CAAA;IAC5B,IAAI,EAAE,eAAe,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MA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;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGpD;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAGlF;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAEjG;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAErG;AAID,iEAAiE;AACjE,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAwDxD;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACzC,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;CAC9B,GAAG,WAAW,CAiCd;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE;IACtC,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACtD,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;CAC9B,GAAG,WAAW,CA+Bd"}
package/dist/link.js CHANGED
@@ -143,6 +143,7 @@ export function createCloudLink(params) {
143
143
  linkedAt: now,
144
144
  };
145
145
  }
146
+ const refreshToken = params.refreshToken ?? params.existing?.refreshToken;
146
147
  return {
147
148
  version: LINK_VERSION,
148
149
  kind: "cloud",
@@ -155,6 +156,7 @@ export function createCloudLink(params) {
155
156
  ? { ...params.existing.environments, ...envMap }
156
157
  : envMap,
157
158
  ...(params.orgId !== undefined ? { orgId: params.orgId } : {}),
159
+ ...(refreshToken !== undefined ? { refreshToken } : {}),
158
160
  };
159
161
  }
160
162
  //# sourceMappingURL=link.js.map
package/dist/link.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"link.js","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAEvC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAU,CAAA;AACtC,MAAM,CAAC,MAAM,SAAS,GAAG,qBAAqB,CAAA;AAC9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,sBAAsB,CAAA;AACvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,uBAAuB,CAAA;AAmDzD,MAAM,UAAU,qBAAqB,CAAC,GAAW,EAAE,GAAqB;IACtE,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IACrC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IACnC,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,kBAAkB,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;AAC9F,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,4BAA4B,CAAC,CAAA;IACvD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;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,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxD,CAAA;AACH,CAAC"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * The secrets the local stack runs with.
3
+ *
4
+ * **Read from `.env`, never pinned back into it.** These used to be hardcoded constants that
5
+ * `supatype dev` wrote to `.env` on every run, which meant a project could not hold its own
6
+ * secrets: whatever `supatype init` or the developer put there was replaced by the published
7
+ * defaults on the next `dev`, and the same `.env` then went to a server. Resolving instead of
8
+ * pinning is what lets a generated secret survive to production.
9
+ *
10
+ * The constants remain as *fallbacks* so a project without `.env` still starts, and so the
11
+ * behaviour of an existing project is unchanged.
12
+ */
13
+ /**
14
+ * Fallback JWT signing secret for a project that has none.
15
+ *
16
+ * Published, therefore worthless as a secret, anyone can mint a token for a stack still using
17
+ * it. That is precisely why `init` generates one instead of relying on this.
18
+ */
19
+ export declare const FALLBACK_JWT_SECRET = "super-secret-jwt-token-with-at-least-32-characters-long";
20
+ /** Fallback Postgres superuser password for a project that has none. */
21
+ export declare const FALLBACK_POSTGRES_PASSWORD = "postgres";
22
+ /** Fallback password for the role PostgREST connects as. */
23
+ export declare const FALLBACK_AUTHENTICATOR_PASSWORD = "authenticator-local";
24
+ /** The secret the local stack signs and validates tokens with. */
25
+ export declare function devJwtSecret(cwd: string): string;
26
+ /** The password for the Postgres superuser the engine and server connect as. */
27
+ export declare function devPostgresPassword(cwd: string): string;
28
+ /**
29
+ * The password for `authenticator`, the role PostgREST connects as.
30
+ *
31
+ * Separate from {@link devPostgresPassword} for the same reason the deployed paths keep them
32
+ * apart: rotating the operator's database password must not take the REST API down.
33
+ */
34
+ export declare function devAuthenticatorPassword(cwd: string): string;
35
+ /**
36
+ * The secrets that are missing from `.env` and must be written so the stack can start.
37
+ *
38
+ * The compose template requires these with `${VAR:?}` rather than defaulting them, because a
39
+ * default is how a published constant ends up signing a real deployment's tokens. That only
40
+ * works if something guarantees presence, this does, for any project that predates
41
+ * `supatype init` writing them.
42
+ *
43
+ * **Fills with the fallback, does not generate.** Preserving the value such a project has been
44
+ * running with is the point: generating a new `JWT_SECRET` would invalidate tokens already
45
+ * issued, and a new `POSTGRES_PASSWORD` would not match the password baked into an existing
46
+ * Postgres volume, which `initdb` only sets once. New projects get generated values from
47
+ * `init`; existing ones keep working and are no worse off than before.
48
+ */
49
+ export declare function seedMissingLocalSecrets(cwd: string): Record<string, string>;
50
+ /**
51
+ * The database identity the local stack connects with, seeded, never overwritten.
52
+ *
53
+ * `POSTGRES_DB` in particular is *project configuration*: `supatype init` sets it to the
54
+ * project name, and the running container's database was created from it. Rewriting it to a
55
+ * default afterwards points every tool at a database that does not exist, observed as
56
+ * `supatype push` failing with `FATAL: database "supatype" does not exist` on a project called
57
+ * something else, because the push path rewrote `.env` after `self-host compose up` had already
58
+ * created the database under its real name.
59
+ *
60
+ * Seeded values match the compose file's own `${VAR:-default}`, so an absent key behaves
61
+ * exactly as it did before.
62
+ */
63
+ export declare function seedMissingDatabaseIdentity(cwd: string): Record<string, string>;
64
+ /**
65
+ * A short, non-reversible tag for a secret, safe to print.
66
+ *
67
+ * The ready panel used to echo the JWT secret in full, which was harmless while it was a
68
+ * published constant and is not once it is the project's own.
69
+ */
70
+ export declare function secretFingerprint(secret: string): string;
71
+ //# sourceMappingURL=local-secrets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-secrets.d.ts","sourceRoot":"","sources":["../src/local-secrets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,4DAA4D,CAAA;AAE5F,wEAAwE;AACxE,eAAO,MAAM,0BAA0B,aAAa,CAAA;AAEpD,4DAA4D;AAC5D,eAAO,MAAM,+BAA+B,wBAAwB,CAAA;AAEpE,kEAAkE;AAClE,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,gFAAgF;AAChF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQ3E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAK/E;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIxD"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * The secrets the local stack runs with.
3
+ *
4
+ * **Read from `.env`, never pinned back into it.** These used to be hardcoded constants that
5
+ * `supatype dev` wrote to `.env` on every run, which meant a project could not hold its own
6
+ * secrets: whatever `supatype init` or the developer put there was replaced by the published
7
+ * defaults on the next `dev`, and the same `.env` then went to a server. Resolving instead of
8
+ * pinning is what lets a generated secret survive to production.
9
+ *
10
+ * The constants remain as *fallbacks* so a project without `.env` still starts, and so the
11
+ * behaviour of an existing project is unchanged.
12
+ */
13
+ import { hasEnvValue, readEnvValue } from "./env-file.js";
14
+ /**
15
+ * Fallback JWT signing secret for a project that has none.
16
+ *
17
+ * Published, therefore worthless as a secret, anyone can mint a token for a stack still using
18
+ * it. That is precisely why `init` generates one instead of relying on this.
19
+ */
20
+ export const FALLBACK_JWT_SECRET = "super-secret-jwt-token-with-at-least-32-characters-long";
21
+ /** Fallback Postgres superuser password for a project that has none. */
22
+ export const FALLBACK_POSTGRES_PASSWORD = "postgres";
23
+ /** Fallback password for the role PostgREST connects as. */
24
+ export const FALLBACK_AUTHENTICATOR_PASSWORD = "authenticator-local";
25
+ /** The secret the local stack signs and validates tokens with. */
26
+ export function devJwtSecret(cwd) {
27
+ return readEnvValue(cwd, "JWT_SECRET", FALLBACK_JWT_SECRET);
28
+ }
29
+ /** The password for the Postgres superuser the engine and server connect as. */
30
+ export function devPostgresPassword(cwd) {
31
+ return readEnvValue(cwd, "POSTGRES_PASSWORD", FALLBACK_POSTGRES_PASSWORD);
32
+ }
33
+ /**
34
+ * The password for `authenticator`, the role PostgREST connects as.
35
+ *
36
+ * Separate from {@link devPostgresPassword} for the same reason the deployed paths keep them
37
+ * apart: rotating the operator's database password must not take the REST API down.
38
+ */
39
+ export function devAuthenticatorPassword(cwd) {
40
+ return readEnvValue(cwd, "AUTHENTICATOR_PASSWORD", FALLBACK_AUTHENTICATOR_PASSWORD);
41
+ }
42
+ /**
43
+ * The secrets that are missing from `.env` and must be written so the stack can start.
44
+ *
45
+ * The compose template requires these with `${VAR:?}` rather than defaulting them, because a
46
+ * default is how a published constant ends up signing a real deployment's tokens. That only
47
+ * works if something guarantees presence, this does, for any project that predates
48
+ * `supatype init` writing them.
49
+ *
50
+ * **Fills with the fallback, does not generate.** Preserving the value such a project has been
51
+ * running with is the point: generating a new `JWT_SECRET` would invalidate tokens already
52
+ * issued, and a new `POSTGRES_PASSWORD` would not match the password baked into an existing
53
+ * Postgres volume, which `initdb` only sets once. New projects get generated values from
54
+ * `init`; existing ones keep working and are no worse off than before.
55
+ */
56
+ export function seedMissingLocalSecrets(cwd) {
57
+ const out = {};
58
+ if (!hasEnvValue(cwd, "JWT_SECRET"))
59
+ out.JWT_SECRET = FALLBACK_JWT_SECRET;
60
+ if (!hasEnvValue(cwd, "POSTGRES_PASSWORD"))
61
+ out.POSTGRES_PASSWORD = FALLBACK_POSTGRES_PASSWORD;
62
+ if (!hasEnvValue(cwd, "AUTHENTICATOR_PASSWORD")) {
63
+ out.AUTHENTICATOR_PASSWORD = FALLBACK_AUTHENTICATOR_PASSWORD;
64
+ }
65
+ return out;
66
+ }
67
+ /**
68
+ * The database identity the local stack connects with, seeded, never overwritten.
69
+ *
70
+ * `POSTGRES_DB` in particular is *project configuration*: `supatype init` sets it to the
71
+ * project name, and the running container's database was created from it. Rewriting it to a
72
+ * default afterwards points every tool at a database that does not exist, observed as
73
+ * `supatype push` failing with `FATAL: database "supatype" does not exist` on a project called
74
+ * something else, because the push path rewrote `.env` after `self-host compose up` had already
75
+ * created the database under its real name.
76
+ *
77
+ * Seeded values match the compose file's own `${VAR:-default}`, so an absent key behaves
78
+ * exactly as it did before.
79
+ */
80
+ export function seedMissingDatabaseIdentity(cwd) {
81
+ const out = {};
82
+ if (!hasEnvValue(cwd, "POSTGRES_USER"))
83
+ out.POSTGRES_USER = "supatype_admin";
84
+ if (!hasEnvValue(cwd, "POSTGRES_DB"))
85
+ out.POSTGRES_DB = "supatype";
86
+ return out;
87
+ }
88
+ /**
89
+ * A short, non-reversible tag for a secret, safe to print.
90
+ *
91
+ * The ready panel used to echo the JWT secret in full, which was harmless while it was a
92
+ * published constant and is not once it is the project's own.
93
+ */
94
+ export function secretFingerprint(secret) {
95
+ let hash = 5381;
96
+ for (let i = 0; i < secret.length; i++)
97
+ hash = ((hash << 5) + hash + secret.charCodeAt(i)) | 0;
98
+ return (hash >>> 0).toString(16).padStart(8, "0");
99
+ }
100
+ //# sourceMappingURL=local-secrets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-secrets.js","sourceRoot":"","sources":["../src/local-secrets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,yDAAyD,CAAA;AAE5F,wEAAwE;AACxE,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAA;AAEpD,4DAA4D;AAC5D,MAAM,CAAC,MAAM,+BAA+B,GAAG,qBAAqB,CAAA;AAEpE,kEAAkE;AA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