@supatype/cli 0.7.0 → 0.8.0

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 (587) hide show
  1. package/CHANGELOG.md +259 -0
  2. package/bin/supatype.js +25 -4
  3. package/deno.d.ts +1 -1
  4. package/dist/admin-prompt-state.d.ts +13 -0
  5. package/dist/admin-prompt-state.d.ts.map +1 -0
  6. package/dist/admin-prompt-state.js +30 -0
  7. package/dist/admin-prompt-state.js.map +1 -0
  8. package/dist/adopt-columns.d.ts.map +1 -1
  9. package/dist/adopt-columns.js +13 -17
  10. package/dist/adopt-columns.js.map +1 -1
  11. package/dist/app-config.d.ts +1 -1
  12. package/dist/app-config.d.ts.map +1 -1
  13. package/dist/app-config.js +103 -144
  14. package/dist/app-config.js.map +1 -1
  15. package/dist/applied-ast-artifacts.d.ts +16 -0
  16. package/dist/applied-ast-artifacts.d.ts.map +1 -0
  17. package/dist/applied-ast-artifacts.js +37 -0
  18. package/dist/applied-ast-artifacts.js.map +1 -0
  19. package/dist/archive-extract.d.ts +3 -0
  20. package/dist/archive-extract.d.ts.map +1 -0
  21. package/dist/archive-extract.js +19 -0
  22. package/dist/archive-extract.js.map +1 -0
  23. package/dist/binary-cache.d.ts +25 -2
  24. package/dist/binary-cache.d.ts.map +1 -1
  25. package/dist/binary-cache.js +115 -81
  26. package/dist/binary-cache.js.map +1 -1
  27. package/dist/binary-download-lock.d.ts.map +1 -1
  28. package/dist/binary-download-lock.js +1 -3
  29. package/dist/binary-download-lock.js.map +1 -1
  30. package/dist/byo-preflight.d.ts.map +1 -1
  31. package/dist/byo-preflight.js +2 -10
  32. package/dist/byo-preflight.js.map +1 -1
  33. package/dist/cache-pins.d.ts.map +1 -1
  34. package/dist/cache-pins.js +2 -2
  35. package/dist/cache-pins.js.map +1 -1
  36. package/dist/cli-version-embedded.js +1 -1
  37. package/dist/cloud-credentials.d.ts +6 -0
  38. package/dist/cloud-credentials.d.ts.map +1 -1
  39. package/dist/cloud-credentials.js +13 -0
  40. package/dist/cloud-credentials.js.map +1 -1
  41. package/dist/commands/admin.d.ts.map +1 -1
  42. package/dist/commands/admin.js +18 -18
  43. package/dist/commands/admin.js.map +1 -1
  44. package/dist/commands/app.d.ts.map +1 -1
  45. package/dist/commands/app.js +27 -8
  46. package/dist/commands/app.js.map +1 -1
  47. package/dist/commands/cache.d.ts.map +1 -1
  48. package/dist/commands/cache.js +5 -4
  49. package/dist/commands/cache.js.map +1 -1
  50. package/dist/commands/cloud.js +2 -4
  51. package/dist/commands/cloud.js.map +1 -1
  52. package/dist/commands/db.d.ts.map +1 -1
  53. package/dist/commands/db.js +116 -106
  54. package/dist/commands/db.js.map +1 -1
  55. package/dist/commands/deploy.d.ts.map +1 -1
  56. package/dist/commands/deploy.js +2 -2
  57. package/dist/commands/deploy.js.map +1 -1
  58. package/dist/commands/dev.d.ts +50 -4
  59. package/dist/commands/dev.d.ts.map +1 -1
  60. package/dist/commands/dev.js +262 -266
  61. package/dist/commands/dev.js.map +1 -1
  62. package/dist/commands/functions.d.ts +30 -0
  63. package/dist/commands/functions.d.ts.map +1 -1
  64. package/dist/commands/functions.js +503 -507
  65. package/dist/commands/functions.js.map +1 -1
  66. package/dist/commands/generate.d.ts.map +1 -1
  67. package/dist/commands/generate.js +11 -8
  68. package/dist/commands/generate.js.map +1 -1
  69. package/dist/commands/hooks.js +26 -11
  70. package/dist/commands/hooks.js.map +1 -1
  71. package/dist/commands/init.d.ts +16 -2
  72. package/dist/commands/init.d.ts.map +1 -1
  73. package/dist/commands/init.js +237 -143
  74. package/dist/commands/init.js.map +1 -1
  75. package/dist/commands/internal.d.ts.map +1 -1
  76. package/dist/commands/internal.js +2 -1
  77. package/dist/commands/internal.js.map +1 -1
  78. package/dist/commands/keys.d.ts +36 -10
  79. package/dist/commands/keys.d.ts.map +1 -1
  80. package/dist/commands/keys.js +168 -128
  81. package/dist/commands/keys.js.map +1 -1
  82. package/dist/commands/link-helpers.d.ts.map +1 -1
  83. package/dist/commands/link-helpers.js +30 -9
  84. package/dist/commands/link-helpers.js.map +1 -1
  85. package/dist/commands/logs.d.ts.map +1 -1
  86. package/dist/commands/logs.js +5 -4
  87. package/dist/commands/logs.js.map +1 -1
  88. package/dist/commands/migrate.js +1 -1
  89. package/dist/commands/migrate.js.map +1 -1
  90. package/dist/commands/pg.js +2 -0
  91. package/dist/commands/pg.js.map +1 -1
  92. package/dist/commands/plugins.d.ts.map +1 -1
  93. package/dist/commands/plugins.js +17 -7
  94. package/dist/commands/plugins.js.map +1 -1
  95. package/dist/commands/push.d.ts +37 -0
  96. package/dist/commands/push.d.ts.map +1 -1
  97. package/dist/commands/push.js +188 -73
  98. package/dist/commands/push.js.map +1 -1
  99. package/dist/commands/seed.d.ts +35 -0
  100. package/dist/commands/seed.d.ts.map +1 -1
  101. package/dist/commands/seed.js +72 -38
  102. package/dist/commands/seed.js.map +1 -1
  103. package/dist/commands/self-host.d.ts.map +1 -1
  104. package/dist/commands/self-host.js +61 -29
  105. package/dist/commands/self-host.js.map +1 -1
  106. package/dist/commands/status.js +5 -5
  107. package/dist/commands/status.js.map +1 -1
  108. package/dist/commands/types.js +2 -5
  109. package/dist/commands/types.js.map +1 -1
  110. package/dist/commands/update.d.ts.map +1 -1
  111. package/dist/commands/update.js +212 -101
  112. package/dist/commands/update.js.map +1 -1
  113. package/dist/component-launch.d.ts +11 -0
  114. package/dist/component-launch.d.ts.map +1 -0
  115. package/dist/component-launch.js +35 -0
  116. package/dist/component-launch.js.map +1 -0
  117. package/dist/components.d.ts +7 -2
  118. package/dist/components.d.ts.map +1 -1
  119. package/dist/components.js +7 -2
  120. package/dist/components.js.map +1 -1
  121. package/dist/compose-db-roles.d.ts.map +1 -1
  122. package/dist/compose-db-roles.js +5 -14
  123. package/dist/compose-db-roles.js.map +1 -1
  124. package/dist/compose-engine-run.d.ts +6 -5
  125. package/dist/compose-engine-run.d.ts.map +1 -1
  126. package/dist/compose-engine-run.js +44 -37
  127. package/dist/compose-engine-run.js.map +1 -1
  128. package/dist/compose-engine-service.d.ts +10 -0
  129. package/dist/compose-engine-service.d.ts.map +1 -0
  130. package/dist/compose-engine-service.js +16 -0
  131. package/dist/compose-engine-service.js.map +1 -0
  132. package/dist/compose-host-path.d.ts +14 -0
  133. package/dist/compose-host-path.d.ts.map +1 -0
  134. package/dist/compose-host-path.js +18 -0
  135. package/dist/compose-host-path.js.map +1 -0
  136. package/dist/compose-image-pull.d.ts +43 -0
  137. package/dist/compose-image-pull.d.ts.map +1 -0
  138. package/dist/compose-image-pull.js +27 -0
  139. package/dist/compose-image-pull.js.map +1 -0
  140. package/dist/compose-kong.d.ts.map +1 -1
  141. package/dist/compose-kong.js +10 -6
  142. package/dist/compose-kong.js.map +1 -1
  143. package/dist/compose-local-server-image.d.ts.map +1 -1
  144. package/dist/compose-local-server-image.js +7 -3
  145. package/dist/compose-local-server-image.js.map +1 -1
  146. package/dist/compose-render-mode.d.ts.map +1 -1
  147. package/dist/compose-render-mode.js +7 -4
  148. package/dist/compose-render-mode.js.map +1 -1
  149. package/dist/compose-services.d.ts +12 -2
  150. package/dist/compose-services.d.ts.map +1 -1
  151. package/dist/compose-services.js +27 -12
  152. package/dist/compose-services.js.map +1 -1
  153. package/dist/config-snapshot.d.ts +6 -0
  154. package/dist/config-snapshot.d.ts.map +1 -0
  155. package/dist/config-snapshot.js +23 -0
  156. package/dist/config-snapshot.js.map +1 -0
  157. package/dist/config.d.ts +2 -0
  158. package/dist/config.d.ts.map +1 -1
  159. package/dist/config.js +2 -0
  160. package/dist/config.js.map +1 -1
  161. package/dist/database-url-owner.d.ts +57 -0
  162. package/dist/database-url-owner.d.ts.map +1 -0
  163. package/dist/database-url-owner.js +130 -0
  164. package/dist/database-url-owner.js.map +1 -0
  165. package/dist/db-port-offer.d.ts +18 -0
  166. package/dist/db-port-offer.d.ts.map +1 -0
  167. package/dist/db-port-offer.js +68 -0
  168. package/dist/db-port-offer.js.map +1 -0
  169. package/dist/db-port.d.ts +40 -18
  170. package/dist/db-port.d.ts.map +1 -1
  171. package/dist/db-port.js +33 -31
  172. package/dist/db-port.js.map +1 -1
  173. package/dist/db-preflight.d.ts +8 -0
  174. package/dist/db-preflight.d.ts.map +1 -1
  175. package/dist/db-preflight.js +18 -1
  176. package/dist/db-preflight.js.map +1 -1
  177. package/dist/db-rows.d.ts +11 -0
  178. package/dist/db-rows.d.ts.map +1 -1
  179. package/dist/db-rows.js +27 -0
  180. package/dist/db-rows.js.map +1 -1
  181. package/dist/debounce.d.ts +11 -0
  182. package/dist/debounce.d.ts.map +1 -0
  183. package/dist/debounce.js +23 -0
  184. package/dist/debounce.js.map +1 -0
  185. package/dist/dev-api-keys.d.ts +12 -2
  186. package/dist/dev-api-keys.d.ts.map +1 -1
  187. package/dist/dev-api-keys.js +33 -17
  188. package/dist/dev-api-keys.js.map +1 -1
  189. package/dist/dev-compose.d.ts +5 -12
  190. package/dist/dev-compose.d.ts.map +1 -1
  191. package/dist/dev-compose.js +153 -245
  192. package/dist/dev-compose.js.map +1 -1
  193. package/dist/dev-db-ready.d.ts.map +1 -1
  194. package/dist/dev-db-ready.js +2 -1
  195. package/dist/dev-db-ready.js.map +1 -1
  196. package/dist/dev-db-reset.d.ts.map +1 -1
  197. package/dist/dev-db-reset.js +5 -4
  198. package/dist/dev-db-reset.js.map +1 -1
  199. package/dist/dev-functions-watch.d.ts.map +1 -1
  200. package/dist/dev-functions-watch.js +5 -16
  201. package/dist/dev-functions-watch.js.map +1 -1
  202. package/dist/dev-ports.d.ts +22 -7
  203. package/dist/dev-ports.d.ts.map +1 -1
  204. package/dist/dev-ports.js +61 -38
  205. package/dist/dev-ports.js.map +1 -1
  206. package/dist/dev-schema-watch.d.ts.map +1 -1
  207. package/dist/dev-schema-watch.js +7 -12
  208. package/dist/dev-schema-watch.js.map +1 -1
  209. package/dist/dev-session-lock.js +4 -3
  210. package/dist/dev-session-lock.js.map +1 -1
  211. package/dist/dev-session.d.ts.map +1 -1
  212. package/dist/dev-session.js +3 -0
  213. package/dist/dev-session.js.map +1 -1
  214. package/dist/dev-shutdown.d.ts +45 -0
  215. package/dist/dev-shutdown.d.ts.map +1 -1
  216. package/dist/dev-shutdown.js +206 -31
  217. package/dist/dev-shutdown.js.map +1 -1
  218. package/dist/docker-address-pool.d.ts +23 -0
  219. package/dist/docker-address-pool.d.ts.map +1 -0
  220. package/dist/docker-address-pool.js +56 -0
  221. package/dist/docker-address-pool.js.map +1 -0
  222. package/dist/docker-exec.d.ts +92 -0
  223. package/dist/docker-exec.d.ts.map +1 -0
  224. package/dist/docker-exec.js +139 -0
  225. package/dist/docker-exec.js.map +1 -0
  226. package/dist/docker-postgres.d.ts +1 -6
  227. package/dist/docker-postgres.d.ts.map +1 -1
  228. package/dist/docker-postgres.js +67 -85
  229. package/dist/docker-postgres.js.map +1 -1
  230. package/dist/docker-runtime.d.ts +12 -1
  231. package/dist/docker-runtime.d.ts.map +1 -1
  232. package/dist/docker-runtime.js +48 -23
  233. package/dist/docker-runtime.js.map +1 -1
  234. package/dist/dotenv-parse.d.ts +22 -0
  235. package/dist/dotenv-parse.d.ts.map +1 -0
  236. package/dist/dotenv-parse.js +63 -0
  237. package/dist/dotenv-parse.js.map +1 -0
  238. package/dist/engine-answers.d.ts +0 -2
  239. package/dist/engine-answers.d.ts.map +1 -1
  240. package/dist/engine-answers.js +4 -3
  241. package/dist/engine-answers.js.map +1 -1
  242. package/dist/engine-client.d.ts.map +1 -1
  243. package/dist/engine-client.js +10 -12
  244. package/dist/engine-client.js.map +1 -1
  245. package/dist/engine-floor.d.ts +29 -0
  246. package/dist/engine-floor.d.ts.map +1 -1
  247. package/dist/engine-floor.js +56 -0
  248. package/dist/engine-floor.js.map +1 -1
  249. package/dist/engine-ownership-gate.d.ts +10 -0
  250. package/dist/engine-ownership-gate.d.ts.map +1 -1
  251. package/dist/engine-ownership-gate.js +31 -6
  252. package/dist/engine-ownership-gate.js.map +1 -1
  253. package/dist/ensure-binary.d.ts +9 -0
  254. package/dist/ensure-binary.d.ts.map +1 -1
  255. package/dist/ensure-binary.js +38 -5
  256. package/dist/ensure-binary.js.map +1 -1
  257. package/dist/ensure-component-binaries.d.ts.map +1 -1
  258. package/dist/ensure-component-binaries.js +2 -1
  259. package/dist/ensure-component-binaries.js.map +1 -1
  260. package/dist/env-file.d.ts +28 -8
  261. package/dist/env-file.d.ts.map +1 -1
  262. package/dist/env-file.js +80 -53
  263. package/dist/env-file.js.map +1 -1
  264. package/dist/env-lines.d.ts +11 -0
  265. package/dist/env-lines.d.ts.map +1 -0
  266. package/dist/env-lines.js +36 -0
  267. package/dist/env-lines.js.map +1 -0
  268. package/dist/error-message.d.ts +34 -1
  269. package/dist/error-message.d.ts.map +1 -1
  270. package/dist/error-message.js +102 -2
  271. package/dist/error-message.js.map +1 -1
  272. package/dist/fetch-within.d.ts +10 -0
  273. package/dist/fetch-within.d.ts.map +1 -0
  274. package/dist/fetch-within.js +12 -0
  275. package/dist/fetch-within.js.map +1 -0
  276. package/dist/field-masking-tier.d.ts.map +1 -1
  277. package/dist/field-masking-tier.js +7 -5
  278. package/dist/field-masking-tier.js.map +1 -1
  279. package/dist/functions-context-refresh.d.ts +6 -2
  280. package/dist/functions-context-refresh.d.ts.map +1 -1
  281. package/dist/functions-context-refresh.js +11 -3
  282. package/dist/functions-context-refresh.js.map +1 -1
  283. package/dist/functions-deno-types.d.ts.map +1 -1
  284. package/dist/functions-deno-types.js +9 -2
  285. package/dist/functions-deno-types.js.map +1 -1
  286. package/dist/{functions-router-gen.d.ts → functions-discovery.d.ts} +8 -10
  287. package/dist/functions-discovery.d.ts.map +1 -0
  288. package/dist/functions-discovery.js +87 -0
  289. package/dist/functions-discovery.js.map +1 -0
  290. package/dist/functions-template.d.ts.map +1 -1
  291. package/dist/functions-template.js +20 -12
  292. package/dist/functions-template.js.map +1 -1
  293. package/dist/functions-worker-files.d.ts +55 -0
  294. package/dist/functions-worker-files.d.ts.map +1 -0
  295. package/dist/functions-worker-files.js +149 -0
  296. package/dist/functions-worker-files.js.map +1 -0
  297. package/dist/generated/functions-worker-source.d.ts +2 -0
  298. package/dist/generated/functions-worker-source.d.ts.map +1 -0
  299. package/dist/generated/functions-worker-source.js +12 -0
  300. package/dist/generated/functions-worker-source.js.map +1 -0
  301. package/dist/generated/release-images.d.ts +18 -0
  302. package/dist/generated/release-images.d.ts.map +1 -0
  303. package/dist/generated/release-images.js +8 -0
  304. package/dist/generated/release-images.js.map +1 -0
  305. package/dist/generated-files-engine.d.ts +33 -0
  306. package/dist/generated-files-engine.d.ts.map +1 -0
  307. package/dist/generated-files-engine.js +45 -0
  308. package/dist/generated-files-engine.js.map +1 -0
  309. package/dist/hook-upload.d.ts +29 -15
  310. package/dist/hook-upload.d.ts.map +1 -1
  311. package/dist/hook-upload.js +88 -59
  312. package/dist/hook-upload.js.map +1 -1
  313. package/dist/hooks-generator.d.ts +5 -0
  314. package/dist/hooks-generator.d.ts.map +1 -1
  315. package/dist/hooks-generator.js +7 -2
  316. package/dist/hooks-generator.js.map +1 -1
  317. package/dist/host-database.d.ts.map +1 -1
  318. package/dist/host-database.js +31 -4
  319. package/dist/host-database.js.map +1 -1
  320. package/dist/init-dependency-versions.d.ts +3 -1
  321. package/dist/init-dependency-versions.d.ts.map +1 -1
  322. package/dist/init-dependency-versions.js +22 -6
  323. package/dist/init-dependency-versions.js.map +1 -1
  324. package/dist/init-example.d.ts +48 -0
  325. package/dist/init-example.d.ts.map +1 -0
  326. package/dist/init-example.js +110 -0
  327. package/dist/init-example.js.map +1 -0
  328. package/dist/init-package-json.d.ts.map +1 -1
  329. package/dist/init-package-json.js +2 -0
  330. package/dist/init-package-json.js.map +1 -1
  331. package/dist/init-setup-steps.d.ts +37 -0
  332. package/dist/init-setup-steps.d.ts.map +1 -0
  333. package/dist/init-setup-steps.js +118 -0
  334. package/dist/init-setup-steps.js.map +1 -0
  335. package/dist/jwt-secret-length.d.ts +5 -13
  336. package/dist/jwt-secret-length.d.ts.map +1 -1
  337. package/dist/jwt-secret-length.js +7 -22
  338. package/dist/jwt-secret-length.js.map +1 -1
  339. package/dist/jwt-secret-rules.d.ts +24 -0
  340. package/dist/jwt-secret-rules.d.ts.map +1 -0
  341. package/dist/jwt-secret-rules.js +46 -0
  342. package/dist/jwt-secret-rules.js.map +1 -0
  343. package/dist/local-gateway.d.ts +3 -6
  344. package/dist/local-gateway.d.ts.map +1 -1
  345. package/dist/local-gateway.js +7 -9
  346. package/dist/local-gateway.js.map +1 -1
  347. package/dist/local-secrets.d.ts +95 -11
  348. package/dist/local-secrets.d.ts.map +1 -1
  349. package/dist/local-secrets.js +153 -18
  350. package/dist/local-secrets.js.map +1 -1
  351. package/dist/local-stack.d.ts.map +1 -1
  352. package/dist/local-stack.js +2 -7
  353. package/dist/local-stack.js.map +1 -1
  354. package/dist/local-storage.d.ts +7 -2
  355. package/dist/local-storage.d.ts.map +1 -1
  356. package/dist/local-storage.js +11 -3
  357. package/dist/local-storage.js.map +1 -1
  358. package/dist/mailer-env.d.ts +37 -0
  359. package/dist/mailer-env.d.ts.map +1 -0
  360. package/dist/mailer-env.js +98 -0
  361. package/dist/mailer-env.js.map +1 -0
  362. package/dist/model-cache.d.ts +4 -8
  363. package/dist/model-cache.d.ts.map +1 -1
  364. package/dist/model-cache.js.map +1 -1
  365. package/dist/model-hooks.d.ts +17 -7
  366. package/dist/model-hooks.d.ts.map +1 -1
  367. package/dist/model-hooks.js +52 -39
  368. package/dist/model-hooks.js.map +1 -1
  369. package/dist/native-dev-env.d.ts +37 -1
  370. package/dist/native-dev-env.d.ts.map +1 -1
  371. package/dist/native-dev-env.js +64 -2
  372. package/dist/native-dev-env.js.map +1 -1
  373. package/dist/native-functions-watch.d.ts +56 -5
  374. package/dist/native-functions-watch.d.ts.map +1 -1
  375. package/dist/native-functions-watch.js +119 -38
  376. package/dist/native-functions-watch.js.map +1 -1
  377. package/dist/native-keyspace.d.ts.map +1 -1
  378. package/dist/native-keyspace.js +2 -2
  379. package/dist/native-keyspace.js.map +1 -1
  380. package/dist/native-realtime.d.ts +11 -3
  381. package/dist/native-realtime.d.ts.map +1 -1
  382. package/dist/native-realtime.js +162 -10
  383. package/dist/native-realtime.js.map +1 -1
  384. package/dist/native-roles-sql.d.ts +14 -0
  385. package/dist/native-roles-sql.d.ts.map +1 -1
  386. package/dist/native-roles-sql.js +82 -1
  387. package/dist/native-roles-sql.js.map +1 -1
  388. package/dist/native-storage-import.d.ts +19 -0
  389. package/dist/native-storage-import.d.ts.map +1 -0
  390. package/dist/native-storage-import.js +327 -0
  391. package/dist/native-storage-import.js.map +1 -0
  392. package/dist/native-storage.d.ts +45 -0
  393. package/dist/native-storage.d.ts.map +1 -0
  394. package/dist/native-storage.js +140 -0
  395. package/dist/native-storage.js.map +1 -0
  396. package/dist/native-worker.d.ts +26 -0
  397. package/dist/native-worker.d.ts.map +1 -0
  398. package/dist/native-worker.js +63 -0
  399. package/dist/native-worker.js.map +1 -0
  400. package/dist/owner-default.d.ts +9 -1
  401. package/dist/owner-default.d.ts.map +1 -1
  402. package/dist/owner-default.js +17 -4
  403. package/dist/owner-default.js.map +1 -1
  404. package/dist/post-apply.d.ts +3 -0
  405. package/dist/post-apply.d.ts.map +1 -0
  406. package/dist/post-apply.js +17 -0
  407. package/dist/post-apply.js.map +1 -0
  408. package/dist/postgres-ctl.d.ts +98 -7
  409. package/dist/postgres-ctl.d.ts.map +1 -1
  410. package/dist/postgres-ctl.js +273 -40
  411. package/dist/postgres-ctl.js.map +1 -1
  412. package/dist/postgres-image.d.ts +15 -3
  413. package/dist/postgres-image.d.ts.map +1 -1
  414. package/dist/postgres-image.js +18 -15
  415. package/dist/postgres-image.js.map +1 -1
  416. package/dist/postgrest-release.d.ts +9 -0
  417. package/dist/postgrest-release.d.ts.map +1 -1
  418. package/dist/postgrest-release.js +23 -0
  419. package/dist/postgrest-release.js.map +1 -1
  420. package/dist/process-manager.d.ts.map +1 -1
  421. package/dist/process-manager.js +3 -1
  422. package/dist/process-manager.js.map +1 -1
  423. package/dist/project-config.d.ts +40 -7
  424. package/dist/project-config.d.ts.map +1 -1
  425. package/dist/project-config.js +42 -4
  426. package/dist/project-config.js.map +1 -1
  427. package/dist/pull-utils.d.ts +15 -0
  428. package/dist/pull-utils.d.ts.map +1 -1
  429. package/dist/pull-utils.js +149 -23
  430. package/dist/pull-utils.js.map +1 -1
  431. package/dist/push-refusal.d.ts.map +1 -1
  432. package/dist/push-refusal.js +3 -2
  433. package/dist/push-refusal.js.map +1 -1
  434. package/dist/realtime-launch.d.ts +2 -5
  435. package/dist/realtime-launch.d.ts.map +1 -1
  436. package/dist/realtime-launch.js +6 -23
  437. package/dist/realtime-launch.js.map +1 -1
  438. package/dist/recorded-field-masking-tier.d.ts.map +1 -1
  439. package/dist/recorded-field-masking-tier.js +4 -3
  440. package/dist/recorded-field-masking-tier.js.map +1 -1
  441. package/dist/release-images.d.ts +31 -0
  442. package/dist/release-images.d.ts.map +1 -0
  443. package/dist/release-images.js +90 -0
  444. package/dist/release-images.js.map +1 -0
  445. package/dist/required-host-components.d.ts.map +1 -1
  446. package/dist/required-host-components.js +4 -0
  447. package/dist/required-host-components.js.map +1 -1
  448. package/dist/resolve-api-url.d.ts +17 -3
  449. package/dist/resolve-api-url.d.ts.map +1 -1
  450. package/dist/resolve-api-url.js +71 -30
  451. package/dist/resolve-api-url.js.map +1 -1
  452. package/dist/resolve-target.d.ts +62 -0
  453. package/dist/resolve-target.d.ts.map +1 -1
  454. package/dist/resolve-target.js +68 -23
  455. package/dist/resolve-target.js.map +1 -1
  456. package/dist/rest-ready.d.ts.map +1 -1
  457. package/dist/rest-ready.js +2 -1
  458. package/dist/rest-ready.js.map +1 -1
  459. package/dist/route-manifest.d.ts +25 -2
  460. package/dist/route-manifest.d.ts.map +1 -1
  461. package/dist/route-manifest.js +48 -4
  462. package/dist/route-manifest.js.map +1 -1
  463. package/dist/run-until-stopped.d.ts +12 -0
  464. package/dist/run-until-stopped.d.ts.map +1 -0
  465. package/dist/run-until-stopped.js +42 -0
  466. package/dist/run-until-stopped.js.map +1 -0
  467. package/dist/schema-ast-v2.d.ts +2 -1
  468. package/dist/schema-ast-v2.d.ts.map +1 -1
  469. package/dist/schema-ast-v2.js.map +1 -1
  470. package/dist/schema-push-lock.d.ts.map +1 -1
  471. package/dist/schema-push-lock.js +59 -46
  472. package/dist/schema-push-lock.js.map +1 -1
  473. package/dist/schema-sources.d.ts +19 -4
  474. package/dist/schema-sources.d.ts.map +1 -1
  475. package/dist/schema-sources.js +56 -35
  476. package/dist/schema-sources.js.map +1 -1
  477. package/dist/seed-auth-connect.d.ts +14 -0
  478. package/dist/seed-auth-connect.d.ts.map +1 -0
  479. package/dist/seed-auth-connect.js +97 -0
  480. package/dist/seed-auth-connect.js.map +1 -0
  481. package/dist/seed-runner.d.ts.map +1 -1
  482. package/dist/seed-runner.js +22 -1
  483. package/dist/seed-runner.js.map +1 -1
  484. package/dist/seed.d.ts +6 -3
  485. package/dist/seed.d.ts.map +1 -1
  486. package/dist/self-host-compose.d.ts +32 -30
  487. package/dist/self-host-compose.d.ts.map +1 -1
  488. package/dist/self-host-compose.js +252 -152
  489. package/dist/self-host-compose.js.map +1 -1
  490. package/dist/service-role-key-file.d.ts +32 -0
  491. package/dist/service-role-key-file.d.ts.map +1 -0
  492. package/dist/service-role-key-file.js +90 -0
  493. package/dist/service-role-key-file.js.map +1 -0
  494. package/dist/shell-ports.d.ts +13 -2
  495. package/dist/shell-ports.d.ts.map +1 -1
  496. package/dist/shell-ports.js +18 -7
  497. package/dist/shell-ports.js.map +1 -1
  498. package/dist/stop-signals.d.ts +7 -0
  499. package/dist/stop-signals.d.ts.map +1 -0
  500. package/dist/stop-signals.js +12 -0
  501. package/dist/stop-signals.js.map +1 -0
  502. package/dist/storage-launch.d.ts +11 -0
  503. package/dist/storage-launch.d.ts.map +1 -0
  504. package/dist/storage-launch.js +41 -0
  505. package/dist/storage-launch.js.map +1 -0
  506. package/dist/storage-provision.d.ts +50 -5
  507. package/dist/storage-provision.d.ts.map +1 -1
  508. package/dist/storage-provision.js +101 -33
  509. package/dist/storage-provision.js.map +1 -1
  510. package/dist/systemd.d.ts +1 -1
  511. package/dist/systemd.d.ts.map +1 -1
  512. package/dist/systemd.js +26 -11
  513. package/dist/systemd.js.map +1 -1
  514. package/dist/tar-reader.d.ts +29 -0
  515. package/dist/tar-reader.d.ts.map +1 -0
  516. package/dist/tar-reader.js +99 -0
  517. package/dist/tar-reader.js.map +1 -0
  518. package/dist/target-client.d.ts +14 -1
  519. package/dist/target-client.d.ts.map +1 -1
  520. package/dist/target-client.js +134 -23
  521. package/dist/target-client.js.map +1 -1
  522. package/dist/target-request.d.ts +25 -0
  523. package/dist/target-request.d.ts.map +1 -0
  524. package/dist/target-request.js +33 -0
  525. package/dist/target-request.js.map +1 -0
  526. package/dist/target-warning.d.ts +7 -0
  527. package/dist/target-warning.d.ts.map +1 -0
  528. package/dist/target-warning.js +12 -0
  529. package/dist/target-warning.js.map +1 -0
  530. package/dist/type-extractor.d.ts +6 -0
  531. package/dist/type-extractor.d.ts.map +1 -1
  532. package/dist/type-extractor.js +118 -59
  533. package/dist/type-extractor.js.map +1 -1
  534. package/dist/ui/clack.d.ts.map +1 -1
  535. package/dist/ui/clack.js +11 -1
  536. package/dist/ui/clack.js.map +1 -1
  537. package/dist/ui/dev/DevDashboard.d.ts.map +1 -1
  538. package/dist/ui/dev/DevDashboard.js +4 -2
  539. package/dist/ui/dev/DevDashboard.js.map +1 -1
  540. package/dist/ui/fatal.d.ts.map +1 -1
  541. package/dist/ui/fatal.js +6 -7
  542. package/dist/ui/fatal.js.map +1 -1
  543. package/dist/ui/flows/FlowApp.d.ts.map +1 -1
  544. package/dist/ui/flows/FlowApp.js +16 -1
  545. package/dist/ui/flows/FlowApp.js.map +1 -1
  546. package/dist/ui/flows/prompt-fields.d.ts +5 -0
  547. package/dist/ui/flows/prompt-fields.d.ts.map +1 -1
  548. package/dist/ui/flows/prompt-fields.js +8 -1
  549. package/dist/ui/flows/prompt-fields.js.map +1 -1
  550. package/dist/ui/messages.d.ts +6 -0
  551. package/dist/ui/messages.d.ts.map +1 -1
  552. package/dist/ui/messages.js +17 -0
  553. package/dist/ui/messages.js.map +1 -1
  554. package/dist/ui/progress.d.ts +7 -0
  555. package/dist/ui/progress.d.ts.map +1 -1
  556. package/dist/ui/progress.js +22 -8
  557. package/dist/ui/progress.js.map +1 -1
  558. package/dist/ui/runtime/command-chrome.d.ts.map +1 -1
  559. package/dist/ui/runtime/command-chrome.js +2 -0
  560. package/dist/ui/runtime/command-chrome.js.map +1 -1
  561. package/dist/ui/runtime/prompt-interrupt.d.ts +10 -0
  562. package/dist/ui/runtime/prompt-interrupt.d.ts.map +1 -0
  563. package/dist/ui/runtime/prompt-interrupt.js +24 -0
  564. package/dist/ui/runtime/prompt-interrupt.js.map +1 -0
  565. package/dist/ui/runtime/run-clack-flow.d.ts.map +1 -1
  566. package/dist/ui/runtime/run-clack-flow.js +5 -2
  567. package/dist/ui/runtime/run-clack-flow.js.map +1 -1
  568. package/dist/ui/runtime/stdin-after-ink.d.ts +14 -1
  569. package/dist/ui/runtime/stdin-after-ink.d.ts.map +1 -1
  570. package/dist/ui/runtime/stdin-after-ink.js +44 -3
  571. package/dist/ui/runtime/stdin-after-ink.js.map +1 -1
  572. package/dist/url-safe-passwords.d.ts +25 -0
  573. package/dist/url-safe-passwords.d.ts.map +1 -0
  574. package/dist/url-safe-passwords.js +70 -0
  575. package/dist/url-safe-passwords.js.map +1 -0
  576. package/dist/valkey-sidecar.d.ts +33 -6
  577. package/dist/valkey-sidecar.d.ts.map +1 -1
  578. package/dist/valkey-sidecar.js +90 -61
  579. package/dist/valkey-sidecar.js.map +1 -1
  580. package/dist/worker-module-files.d.ts +3 -0
  581. package/dist/worker-module-files.d.ts.map +1 -0
  582. package/dist/worker-module-files.js +18 -0
  583. package/dist/worker-module-files.js.map +1 -0
  584. package/package.json +9 -6
  585. package/dist/functions-router-gen.d.ts.map +0 -1
  586. package/dist/functions-router-gen.js +0 -302
  587. package/dist/functions-router-gen.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,264 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ### Breaking Changes
6
+
7
+ * **schema:** a `?` on a model field (`due?: string`) is refused, naming `Model.field` and saying to
8
+ write `Optional<>`. It read as nullable but compiled to a `NOT NULL` column.
9
+ * **generate:** `supatype generate --connection` is refused as an unknown option. Generate writes the
10
+ types from the schema file and never opened a database, so the option was accepted and ignored.
11
+ * **seed:** a seed file's `export const config = { transaction: ... }` is refused, and `transaction`
12
+ is gone from `SeedConfig`. It was validated and never sent: every seed file runs in a transaction
13
+ of its own (all of them in one with `--atomic`), and the engine cannot run one outside it. Any
14
+ other key `config` does not have (a misspelt `runonce`, say) is refused too, rather than ignored.
15
+ * **realtime:** the service's process entry is `dist/main.js`; `dist/index.js` only exports and no
16
+ longer starts a server, so an `overrides.realtime` naming `packages/realtime/dist/index.js` exits
17
+ at once. Point it at `packages/realtime/dist/main.js`.
18
+
19
+ ### Features
20
+
21
+ * **init:** `supatype init <dir> --example <name>` starts from `examples/<name>` of the release
22
+ matching the CLI (`v<version>` on GitHub), with every `workspace:` dependency pinned to
23
+ `^<version>`. An unknown name is refused with the list of examples in that release, and so is an
24
+ example holding a file named with `..`, a backslash, a NUL, a leading drive (`C:`) or an absolute
25
+ path, or one that resolves outside the directory; nothing is written then. A colon anywhere in a
26
+ name is refused too, since on Windows `docs/a:b.md` writes a hidden stream of a file `docs/a`.
27
+ Such a name elsewhere in the repository does not stop an example. Schema snapshots are restored
28
+ with the same checks, and `push` refuses a schema file named in a way restore would refuse.
29
+ `supatype dev` warns instead and pushes without a snapshot, so it does not stop on every save.
30
+ * **seed:** `authUser: { connect: { id } }` on a relation to the auth user (`RelatedTo<SupatypeAuthUser>`)
31
+ writes the relation's key column. It failed with "`supatype:user` is not a model in this schema".
32
+ The generated `...Create` type still offers the key column (`auth_user_id`) rather than `authUser`;
33
+ that comes from the engine.
34
+ * **schema:** `Geo<"polygon">` and `Geo<"linestring">` compile to `GEOGRAPHY(POLYGON, 4326)` and
35
+ `GEOGRAPHY(LINESTRING, 4326)`. Every `Geo` field was a point whatever it said; a bare `Geo` still is.
36
+ * **keys:** `supatype keys` writes into `.env` when there is one, filling only the blank keys, as
37
+ `--write` did. `--print` only prints. `--write` still works, so scripts and docs written for 0.7.0
38
+ keep running. With no `.env` the keys are printed, with a line saying how to have them written.
39
+ `--print` with no secret anywhere exits 1 rather than printing keys signed with one it made up and
40
+ kept nowhere. `--print` checks the secret as writing does, since printed keys end up in a `.env`
41
+ all the same: at least 32 characters, and for a given one, no whitespace, `#` or quotes.
42
+ * **keys, self-host, init, dev:** one rule for the `JWT_SECRET` keys are signed with. `.env`'s always
43
+ wins. A shell `JWT_SECRET` is used only when `.env` has none, and is then written into `.env`; one
44
+ that differs from `.env`'s gets a single warning line saying `.env`'s is used, and is never
45
+ refused. Only a `keys --secret` that differs from `.env`'s is refused. Docker Compose reads the
46
+ shell ahead of `.env`, so every compose command now runs without the shell's `JWT_SECRET`,
47
+ `ANON_KEY` and `SERVICE_ROLE_KEY` when `.env` defines that name, and without a shell key the stack
48
+ would not accept under `.env`'s `JWT_SECRET` (another secret, another role, or expired):
49
+ `supatype dev` on docker with a different shell `JWT_SECRET` started services that refused every
50
+ key with 401. A shell key the stack accepts still fills a blank one. `push`, `status` and the
51
+ other commands calling the local stack follow the same rule, and send `.env`'s `SERVICE_ROLE_KEY`,
52
+ the name the stack is started with, and never a `SUPATYPE_SERVICE_ROLE_KEY` there. When a
53
+ `JWT_SECRET` is newly written into `.env` (given or generated), `keys` and `self-host compose up`
54
+ sign both keys again and say so, since keys already there cannot verify against it. A secret is
55
+ checked before anything is written: at least 32 characters, and for one written into `.env`, no
56
+ whitespace, `#` or quotes. `compose up` used to write keys signed with a short secret and then
57
+ refuse it, leaving keys that were never re-signed once the secret was fixed. `init` warns and
58
+ generates a secret when the shell's is unusable, and never exits mid-wizard over the keys.
59
+ * **keys, dev:** `NEXT_PUBLIC_SUPATYPE_ANON_KEY` is written beside the `VITE_`, `PUBLIC_` and
60
+ `EXPO_PUBLIC_` copies, and `NEXT_PUBLIC_SUPATYPE_URL` wherever the other URL copies are.
61
+
62
+ ### Bug Fixes
63
+
64
+ * **functions serve:** a project with `functions/.env.local` serves again. The file was handed to
65
+ Deno as `--env-file <path>`, two arguments, and Deno takes the value only after `=`, so it ran
66
+ `.env.local` as the script and served nothing. `functions new` creates that file, so every project
67
+ that had made a function with it was affected.
68
+ * **dev:** native dev's port-in-use message says which port to move ("Move this project's database
69
+ port with ..."). It read "Move this project's with ...".
70
+ * **dev, functions serve, functions worker:** a function that fails to load answers its own route
71
+ with a 500, `function_load_failed` and why, and every other function keeps serving. A module that
72
+ threw on import, did not parse, or exported no handler stopped the router (or the deployed
73
+ worker) starting, so every function answered 502.
74
+ * **dev:** native dev writes a bucket declared `custom` as not public in the object store's
75
+ `buckets.json`. It copied `public: true` from the declaration, so the store listed a custom
76
+ bucket as public, which the store and the storage service never do.
77
+ * **hooks:** the `beforeChange` scaffold from `supatype hooks new` no longer says the service role
78
+ bypasses hooks. The server fires them for every write through the API, service-role key included;
79
+ only direct SQL, seeds and migrations skip them.
80
+ * **dev:** a blank mailer setting in `.env` no longer erases the one `email` in `supatype.config.ts`
81
+ sets. `init` scaffolds `SUPATYPE_SMTP_HOST=`, `SUPATYPE_RESEND_API_KEY=` and the rest blank, and
82
+ native `dev` applied `.env` over the config, so a project with its SMTP host or Resend key in the
83
+ config got the noop mailer and sent nothing. A value in `.env` still wins over the config.
84
+
85
+ * **app, status, functions serve:** the local gateway address follows `.env`. `app add` printed the
86
+ app URL, `status` the API URL, and `functions serve` gave functions `SUPATYPE_URL`, all on the
87
+ default port 18473 whatever `SUPATYPE_KONG_PORT` said, so after `dev` moved Kong to another port
88
+ they pointed at whichever stack held 18473. They now use `.env`'s `API_EXTERNAL_URL`, else
89
+ `SUPATYPE_KONG_PORT`, as `ctx.publicUrl` already did.
90
+
91
+ * **pull:** a uuid `id` column is drafted as `UUID`. Every one was drafted as `SupatypeAuthUserId`,
92
+ which declares the key to be an auth user's id; telling the two apart needs the schema of a foreign
93
+ key's table, which the engine does not report yet. A drafted model also names its table
94
+ (`tableName`) when its model name would not map back to it, as `HTTPLog` or `Orders` do, so a push
95
+ of the draft does not create a second, empty table.
96
+
97
+ * **plugins:** `plugins add` and `plugins list` no longer claim a plugin is in use. `add` said
98
+ "installed and registered" and `list` showed every compatible plugin as "active", but nothing in
99
+ Supatype loads plugins yet. Both now say the plugin is installed and that it is not loaded.
100
+
101
+ * **functions:** the scaffolded `functions/_shared/context.ts` says where `ctx.env` comes from: the
102
+ functions directory's `.env.local` (or `SUPATYPE_SHARED_ENV_FILE`), then `.env.<function>.local`,
103
+ which wins. It said `.env`, which is never read for it.
104
+
105
+ * **dev, functions serve:** the local functions router loads and guards handlers as the deployed
106
+ worker does. It accepted only `export default`, so a function exporting a named `handler`, which the
107
+ worker serves, failed to load locally; a module with neither answers its own route with an error
108
+ naming it. It also gave every function the service-role key, in `ctx.serviceRoleKey` and in `Deno.env`, where the
109
+ worker takes the key out of the environment before importing any handler and grants it only to the
110
+ routes `functions.serviceRole` lists, and to hooks. The router now does the same, so a function that
111
+ relies on the key without being listed fails locally rather than once deployed. The key is still
112
+ granted after `--watch` reloads the router on a change, however the run before it ended: a function
113
+ that failed to load, an unhandled rejection or a crash no longer leaves every later reload without
114
+ the key until `dev` restarts. The router reads it from a file in `.supatype/`, readable by its owner
115
+ only, rather than from the environment it takes the key out of. The file is removed when `dev` or
116
+ `functions serve` stops, Ctrl+C included, and each `functions serve` has a file of its own.
117
+
118
+ * **dev, functions serve:** native `dev` and `functions serve` run the functions worker the deployed
119
+ image runs (packages/functions-worker), not a router the CLI generated to copy its rules, so the
120
+ two can no longer drift: the copy had already differed on which exports it took, who got the
121
+ service-role key and which env files it read. The CLI carries the worker's source and writes it to
122
+ `~/.supatype/cache/functions-worker/`. Native `dev` now also serves model hooks from `hooks/`, as
123
+ the compose stack does, including in a project with hooks and no functions, and picks up a hook
124
+ added while it runs; `functions serve` picks up a function added while it runs.
125
+
126
+ * **functions:** `ctx.env` reads `.env.local` and `.env.<function>.local` with the CLI's own dotenv
127
+ parser, so `KEY="value"` is `value`, an inline ` # comment` is dropped and `export KEY=` is read,
128
+ as the CLI and compose read a `.env`. The worker kept the quotes and the comment.
129
+
130
+ * **dev (native):** runs the storage service (packages/storage) on this machine instead of the
131
+ server's built-in object store, so bucket rules, `maxSize`, `accept`, `access_mode`, caller rules
132
+ and image transforms are the ones a deployment enforces. Its objects live under
133
+ `~/.supatype/projects/<project>/storage-service/`; the first start imports the buckets and objects
134
+ the server's store held, and each later start imports what changed there since, so what the
135
+ server's store took while the service was down reaches it and an object deleted in the service
136
+ stays deleted. An object the service refuses is skipped and named once. The old files stay for
137
+ one release: the next CLI release removes them and says which, keeping and naming the objects the
138
+ service refused. The service comes
139
+ from a per-platform archive on the CDN (`storage/v<version>/`, signed like every component), or
140
+ `overrides.storage`; its port is `SUPATYPE_STORAGE_PORT` (default 8002). When it cannot start, dev
141
+ says so and the server's store answers as before.
142
+
143
+ * **self-host:** the compose stack serves functions from `functions.path`. The functions worker, the
144
+ server and the control plane were all told `/project/functions` whatever the config said, so a
145
+ project keeping its functions elsewhere had every one answer 404; hooks were likewise fixed at
146
+ `/project/hooks` rather than following `supatype.root`. A `functions.path` or `supatype.root`
147
+ outside the project directory is refused with a message saying why, since the stack mounts only
148
+ the project. `functions deploy` names the real directory instead of a fixed `functions/`.
149
+
150
+ * **dev, self-host, init:** Resend and SES settings reach the auth server. Native `dev` sent them as
151
+ `RESEND_API_KEY`, `RESEND_FROM` and `SES_FROM`, which the server does not read, docker `dev` sent
152
+ none of them, and the self-host compose file had no way to pass them, so `email.provider: "resend"`
153
+ or `"ses"` fell back to the noop mailer and sent nothing. All three now use
154
+ `SUPATYPE_RESEND_API_KEY`, `SUPATYPE_RESEND_FROM` and `SUPATYPE_SES_FROM`, and the compose file
155
+ passes them through from `.env`. `init` scaffolds the email settings under those names too, and
156
+ SMTP's as `SUPATYPE_SMTP_*`; the unprefixed `SMTP_HOST` and the rest it used to write were never
157
+ read either. Rename any of these already in a project's `.env`.
158
+
159
+ * **dev:** magic-link, confirmation, invite and recovery links in native `dev` open the auth
160
+ server's verify endpoint. They pointed at `http://localhost:<port>/verify` and 404'd: the external
161
+ URL ends in `/auth/v1`, and the server's default `/verify` replaced that path rather than adding to
162
+ it. Native `dev` now sets the same `/auth/v1/verify` paths the compose file does.
163
+
164
+ * **migrate:** restoring a migration's schema sources refuses a file that lands beside the project
165
+ under a path starting with the project's own (`/srv/app2/x.ts` for `/srv/app`). The check compared
166
+ string prefixes, so it took that file for one inside the project. The snapshot is now read by the
167
+ same tar reader as `init --example`, so a name with a backslash, a NUL, a leading drive or an
168
+ absolute path is refused too (a backslash was read as a separator), an entry naming the project
169
+ root itself (`./`) is refused rather than failing on write, and a name that only starts with two
170
+ dots (`..notes/x.ts`) is restored rather than refused. The backup taken before a restore copies
171
+ the files the snapshot overwrites, not the paths its manifest lists, which were never checked.
172
+
173
+ * **schema:** an `id: SupatypeAuthUserId` primary key under `create: Owner<"id">` (also inside `Any`
174
+ or `All`) no longer gets a `gen_random_uuid()` default. A random id names no user, and the default
175
+ kept the engine from defaulting the column to the caller, so an insert leaving `id` out was
176
+ refused. Under any other create rule the key keeps its random default, as nothing else fills it.
177
+ The generated `Insert` type leaves `id` optional either way, since the database fills it.
178
+ * **self-host:** `self-host native backup`, `serve`, `reload`, `status`, `logs` and `install-service`
179
+ run their own action with their own options. They were declared as executable subcommands, so
180
+ their options and actions landed on `self-host native` and `self-host`.
181
+ * **seed:** a seed file in a project without `"type": "module"` (a Next.js app) can import
182
+ `@supatype/cli/seed`. The export map had only an `import` condition, and a CommonJS seed failed
183
+ with `ERR_PACKAGE_PATH_NOT_EXPORTED`.
184
+ * **seed:** a failure whose message already carries its remedy (a column the database does not have)
185
+ prints the remedy once, not twice.
186
+ * **init:** a new project depends on `@supatype/client`, pinned like the other packages; the
187
+ generated `supatype/generated/client.ts` imports it.
188
+ * **init:** the wizard does not ask the project name `init <name>` already gave, does not ask for
189
+ production storage when production is decided later, and shows a yes/no prompt's default as `Y/n`
190
+ or `y/N`. `init --mode standalone` leads its next steps with the self-host steps, then local
191
+ development.
192
+ * **app:** `supatype app add` and `app remove` rewrite `supatype.config.ts` at its own indentation and
193
+ keep it valid TypeScript (they wrote `mode: "proxy",,` against init's config, and a comma in a
194
+ comment after the last entry was taken for its separator), and the same for the `server` block
195
+ `supatype add domain` writes. In a dev project they say to restart `supatype dev`, which keeps
196
+ serving the old app until it restarts; in a self-hosted one, to run `self-host compose up -d`, which
197
+ renders the compose file itself.
198
+ * **dev:** "Create an admin user now?" is asked once per project. A "no" is kept in
199
+ `.supatype/admin-prompt.json`, so later starts neither ask nor wait; a run that is not interactive
200
+ was never asked.
201
+ * **security:** a project with no `JWT_SECRET` gets one in `.env` from `dev` or `keys`: the shell's
202
+ when usable, else a generated one. Before, it signed with a published fallback, and the docker dev
203
+ path wrote that fallback into the `.env` a self-host deployment reads. A secret already in `.env`
204
+ is kept, whatever it is. A native dev project that never had one signs with the new secret, so its
205
+ existing sessions sign out once.
206
+ * **push:** on a native dev stack, the service-role key push uses to create storage buckets is the
207
+ project's, from `.env`, as on docker. It was signed with the published dev secret, which a stack
208
+ running with its own `JWT_SECRET` refused with 401.
209
+ * **env:** `.env` is read the way Docker Compose reads it, through one parser: `KEY=x # note` is
210
+ `x`, a quoted value keeps its `#`, `export KEY=` is understood, and the last assignment of a key
211
+ wins. The CLI kept ` # note` in the value and read the first of two assignments, so it could sign
212
+ keys with a secret, or wait on a port, that the stack did not have (F14:
213
+ `SUPATYPE_DEV_DB_PORT` appended a second time was ignored). Updating a key assigned twice leaves
214
+ one line for it.
215
+ * **dev, self-host:** database passwords are encoded in every connection URL the CLI builds. The
216
+ compose file cannot encode them, so the commands that start or recreate containers (`dev` at
217
+ startup, and `self-host compose up`, `render` and `restart`) refuse a `POSTGRES_PASSWORD`,
218
+ `AUTHENTICATOR_PASSWORD` or `SUPATYPE_SQL_EDITOR_PASSWORD` holding a character that breaks a URL,
219
+ naming the variable and how to generate a safe one. Writing the compose file does not check, so
220
+ `update` and the dev watcher never exit over a password an older stack runs with. `push`, `diff`
221
+ and dev's database recovery, which start only the database, print the same message as a warning.
222
+ `self-host compose down`, `status` and `logs` run against the compose file already on disk rather
223
+ than rewriting it from the current config, so such a stack can still be stopped and inspected.
224
+ With no compose file on disk yet they render one, without the check.
225
+ * **self-host:** `self-host compose logs --service <name>` shows that service. The option was
226
+ taken by the hidden native `logs` command, declared in a way that attached its options to
227
+ `self-host` itself, so every service was shown. The other native commands had the same fault.
228
+ * **dev, self-host:** `compose up` failing with "all predefined address pools have been fully
229
+ subnetted" says Docker is out of network addresses, how many Supatype networks there are, and that
230
+ `docker network prune` frees the unused ones.
231
+ * **cli:** running the CLI from a monorepo checkout that has not been built says to run
232
+ `pnpm install && pnpm build` at the repository root, rather than a bare "Cannot find module".
233
+ * **self-host, dev:** storage has no quota and no per-file limit unless `.env` sets one.
234
+ `STORAGE_QUOTA`, `TIER_MAX_UPLOAD_SIZE`, `MAX_UPLOAD_SIZE` (bytes, `-1` for unlimited, the
235
+ default) and `PROJECT_TIER` now reach the storage service, which on its own applied the free
236
+ tier's 1 GiB quota and 50 MB file limit to every self-hosted and local project.
237
+ * **dev, push, self-host:** `DATABASE_URL` follows a database port exported in the shell
238
+ (`SUPATYPE_DEV_DB_PORT`, or `SUPATYPE_DB_PORT` for a self-host stack). Compose binds the shell's
239
+ port, and the URL was reconciled against `.env` alone, so seeds and host-side commands reached a
240
+ port nothing listened on. The shell's port is the run's: the URL changes for that run and `.env`
241
+ keeps its own.
242
+ * **dev, self-host:** a project moved from native dev to Docker routes realtime and functions to the
243
+ stack's own services. The compose render left native's `realtime_url` (a host port) in
244
+ `.supatype/manifest.json`, so every realtime request answered 502.
245
+ * **dev:** native dev routes functions to the Deno the server runs. It kept the
246
+ `functions-worker:8001` URL `init` writes for the compose stack, so every function answered 502
247
+ with "lookup functions-worker: no such host".
248
+ * **dev:** native dev checks the port functions run on (8001, or `SUPATYPE_DENO_PORT`) before it
249
+ starts, as it does Postgres, the server, PostgREST and realtime, and stops naming the variable
250
+ that moves it. With the port taken, Deno failed after the stack was up and every function
251
+ answered 502. The port checked is the port the server gets: an exported `SUPATYPE_DENO_PORT`,
252
+ else the one in `.env.local` or `.env`, else 8001. A blank `SUPATYPE_DENO_PORT=` in `.env` leaves
253
+ 8001 rather than reaching the server as an empty port.
254
+ * **update:** `supatype update` exits 1 naming each component it could not fetch. A run where every
255
+ download failed ended on "All components are up to date." with exit 0, and a pinned version was
256
+ written into `supatype.config.ts` even when its download had failed.
257
+ * **init:** `supatype init` uses an exported `SUPATYPE_KONG_PORT` as the project's gateway port, in
258
+ `.env` and in what it prints, and the wizard does not ask for one. It chose its own port, so `.env`
259
+ and the "API on" line named a port the stack, which binds the shell's, never listened on.
260
+
261
+
3
262
  ## 0.7.0
4
263
 
5
264
  Highlights: `adopt` takes what a push refuses, with `--key`, `--release` and `--reclaim`, and
package/bin/supatype.js CHANGED
@@ -1,5 +1,26 @@
1
1
  #!/usr/bin/env node
2
- import("../dist/cli.js").then((m) => m.run()).catch((e) => {
3
- console.error(e?.message ?? e)
4
- process.exit(1)
5
- })
2
+ import { existsSync } from "node:fs"
3
+ import { fileURLToPath } from "node:url"
4
+
5
+ const cli = new URL("../dist/cli.js", import.meta.url)
6
+
7
+ // A fresh clone of the monorepo has no dist until its first build. Only that case gets the hint:
8
+ // a module missing from inside a built dist is reported as it is.
9
+ function unbuilt(e) {
10
+ return e?.code === "ERR_MODULE_NOT_FOUND" && !existsSync(fileURLToPath(cli))
11
+ }
12
+
13
+ import(cli.href)
14
+ .catch((e) => {
15
+ if (!unbuilt(e)) throw e
16
+ console.error(
17
+ "The Supatype CLI has not been built: dist/cli.js is missing.\n" +
18
+ "Run `pnpm install && pnpm build` at the repository root, then try again.",
19
+ )
20
+ process.exit(1)
21
+ })
22
+ .then((m) => m.run())
23
+ .catch((e) => {
24
+ console.error(e?.message ?? e)
25
+ process.exit(1)
26
+ })
package/deno.d.ts CHANGED
@@ -52,7 +52,7 @@ declare namespace Deno {
52
52
  }
53
53
 
54
54
  /**
55
- * The slice of Node's async_hooks the functions router uses. Deno provides the module at runtime;
55
+ * The slice of Node's async_hooks a function may use. Deno provides the module at runtime;
56
56
  * a functions tsconfig loads no Node types, so without it the import resolves to nothing.
57
57
  */
58
58
  declare module "node:async_hooks" {
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Whether this project has already been asked to create its first admin.
3
+ *
4
+ * `supatype dev` asks "Create an admin user now?" when a project has no admin, and it asked on every
5
+ * start of a project whose owner had said no, waiting each time. The answer is kept in the project's
6
+ * `.supatype/` directory (gitignored, so it is one developer's answer, not the team's), and a "no"
7
+ * is not asked again. `supatype admin create-user` creates one at any time.
8
+ */
9
+ /** True when the first-admin prompt was answered "no" in this project. */
10
+ export declare function adminPromptDeclined(cwd: string): boolean;
11
+ /** Keep the "no", so the prompt is not asked again. Best effort: failing to write only means it asks again. */
12
+ export declare function recordAdminPromptDeclined(cwd: string): void;
13
+ //# sourceMappingURL=admin-prompt-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-prompt-state.d.ts","sourceRoot":"","sources":["../src/admin-prompt-state.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,+GAA+G;AAC/G,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAQ3D"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Whether this project has already been asked to create its first admin.
3
+ *
4
+ * `supatype dev` asks "Create an admin user now?" when a project has no admin, and it asked on every
5
+ * start of a project whose owner had said no, waiting each time. The answer is kept in the project's
6
+ * `.supatype/` directory (gitignored, so it is one developer's answer, not the team's), and a "no"
7
+ * is not asked again. `supatype admin create-user` creates one at any time.
8
+ */
9
+ import { mkdirSync, writeFileSync } from "node:fs";
10
+ import { dirname, join } from "node:path";
11
+ import { readJsonObjectFile } from "./json-file.js";
12
+ function statePath(cwd) {
13
+ return join(cwd, ".supatype", "admin-prompt.json");
14
+ }
15
+ /** True when the first-admin prompt was answered "no" in this project. */
16
+ export function adminPromptDeclined(cwd) {
17
+ return readJsonObjectFile(statePath(cwd))?.["declined"] === true;
18
+ }
19
+ /** Keep the "no", so the prompt is not asked again. Best effort: failing to write only means it asks again. */
20
+ export function recordAdminPromptDeclined(cwd) {
21
+ const path = statePath(cwd);
22
+ try {
23
+ mkdirSync(dirname(path), { recursive: true });
24
+ writeFileSync(path, `${JSON.stringify({ declined: true })}\n`);
25
+ }
26
+ catch {
27
+ // Not worth failing a dev start over: the cost is one more question.
28
+ }
29
+ }
30
+ //# sourceMappingURL=admin-prompt-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-prompt-state.js","sourceRoot":"","sources":["../src/admin-prompt-state.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAEnD,SAAS,SAAS,CAAC,GAAW;IAC5B,OAAO,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,mBAAmB,CAAC,CAAA;AACpD,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,OAAO,kBAAkB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,IAAI,CAAA;AAClE,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,yBAAyB,CAAC,GAAW;IACnD,MAAM,IAAI,GAAG,SAAS,CAA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AI,CAAA;KAAE,CAAA;CAC1F;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,SAAS,aAAa,EAAE,EACjC,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAuD9B"}
@@ -16,12 +16,13 @@
16
16
  * CLI did not leave as it wrote it is never put back: an edit made meanwhile is the person's.
17
17
  */
18
18
  import { readFileSync, writeFileSync } from "node:fs";
19
- import { isAbsolute, normalize, relative, sep } from "node:path";
19
+ import { normalize, relative } from "node:path";
20
20
  import { Node, Project, ts } from "ts-morph";
21
21
  import { extractSchemaAstFromTypes, walkSchemaSourceAbsPaths } from "./type-extractor.js";
22
- import { isJsonObject, keptName } from "@supatype/shared";
22
+ import { isJsonObject, keptName, pathInside, toPosixPath } from "@supatype/shared";
23
23
  import { objectAt } from "./ast-read.js";
24
24
  import { isDbColumnState } from "./engine-answers.js";
25
+ import { errorMessage } from "./error-message.js";
25
26
  const TYPES_MODULE = "@supatype/types";
26
27
  /** Why a column the database fills cannot be declared as one where the engine cannot read it. */
27
28
  const NO_IDENTITY_COLUMNS = "this engine does not support identity and generated columns; update it, or declare the column by hand";
@@ -213,8 +214,8 @@ export function planColumnDeclaration(input) {
213
214
  }
214
215
  catch (err) {
215
216
  if (input.live === undefined)
216
- return manual(`the schema could not be read (${messageOf(err)})`);
217
- return withCanonicalLine(manual(`the schema could not be read (${messageOf(err)})`), input.live, input.identityColumns);
217
+ return manual(`the schema could not be read (${errorMessage(err)})`);
218
+ return withCanonicalLine(manual(`the schema could not be read (${errorMessage(err)})`), input.live, input.identityColumns);
218
219
  }
219
220
  // Declared already (adopting a table hands over its declared columns too): nothing to add.
220
221
  const declaring = modelsWithTable(ast, table).filter((m) => declaresColumn(m, column));
@@ -323,7 +324,7 @@ export function applyColumnDeclaration(plan, entryPath, cwd) {
323
324
  }
324
325
  catch (err) {
325
326
  // Nothing of ours is known to be in it: a failed write is not undone over whatever is there.
326
- return manual(`the file could not be written (${messageOf(err)})`);
327
+ return manual(`the file could not be written (${errorMessage(err)})`);
327
328
  }
328
329
  const problem = verify(plan, entryPath, cwd);
329
330
  return problem === undefined ? plan : undo(`the edited schema did not read back as planned (${problem})`);
@@ -340,7 +341,7 @@ function verify(plan, entryPath, cwd) {
340
341
  ast = extractSchemaAstFromTypes(entryPath, cwd);
341
342
  }
342
343
  catch (err) {
343
- return messageOf(err);
344
+ return errorMessage(err);
344
345
  }
345
346
  const models = modelsWithTable(ast, plan.table);
346
347
  if (models.length !== 1 || models[0].name !== plan.model)
@@ -355,7 +356,7 @@ const DUPLICATE_CODES = new Set([2300, 2440, 2395]);
355
356
  /** The first "duplicate identifier" kind of error in `text`, checked as one file on its own. */
356
357
  function duplicateIdentifier(path, text) {
357
358
  // The compiler host asks for files by forward-slash names on every platform.
358
- const fileName = path.split(sep).join("/");
359
+ const fileName = toPosixPath(path);
359
360
  const options = { noLib: true, noResolve: true, types: [], noEmit: true };
360
361
  const host = ts.createCompilerHost(options);
361
362
  const source = ts.createSourceFile(fileName, text, ts.ScriptTarget.Latest, true);
@@ -405,7 +406,7 @@ function findModelDeclaration(entryPath, modelName) {
405
406
  paths = walkSchemaSourceAbsPaths(entryPath);
406
407
  }
407
408
  catch (err) {
408
- return { reason: `the schema files could not be read (${messageOf(err)})` };
409
+ return { reason: `the schema files could not be read (${errorMessage(err)})` };
409
410
  }
410
411
  const project = new Project({ useInMemoryFileSystem: false, skipAddingFilesFromTsConfig: true });
411
412
  const declarations = [];
@@ -585,9 +586,6 @@ function declaredLocally(sourceFile, name) {
585
586
  function relativeName(sourceFile) {
586
587
  return relative(process.cwd(), sourceFile.getFilePath()) || sourceFile.getFilePath();
587
588
  }
588
- function messageOf(err) {
589
- return err instanceof Error ? err.message : String(err);
590
- }
591
589
  // ─── Before adopt ──────────────────────────────────────────────────────────────
592
590
  /** `column:<table>.<name>`, as `--key` names a column; undefined for any other key. */
593
591
  export function parseColumnKey(key) {
@@ -618,7 +616,7 @@ export async function previewKeyedColumns(keys, shown, opts, deps) {
618
616
  live = liveColumns(await deps.introspect());
619
617
  }
620
618
  catch (err) {
621
- unread = messageOf(err);
619
+ unread = errorMessage(err);
622
620
  }
623
621
  return columns.map(({ table, column }) => {
624
622
  const head = `column ${table}.${column}: record as managed by Supatype`;
@@ -665,7 +663,7 @@ export async function declareAdoptedColumns(adopted, opts, deps) {
665
663
  live = liveColumns(await deps.introspect());
666
664
  }
667
665
  catch (err) {
668
- deps.say.warn(`Could not read the adopted column(s) from the database: ${messageOf(err)}`);
666
+ deps.say.warn(`Could not read the adopted column(s) from the database: ${errorMessage(err)}`);
669
667
  }
670
668
  const results = [];
671
669
  for (const item of columns) {
@@ -702,7 +700,7 @@ export async function declareAdoptedColumns(adopted, opts, deps) {
702
700
  deps.say.info(message);
703
701
  }
704
702
  catch (err) {
705
- deps.say.warn(`Types were not regenerated (${messageOf(err)}); run \`supatype generate\`.`);
703
+ deps.say.warn(`Types were not regenerated (${errorMessage(err)}); run \`supatype generate\`.`);
706
704
  }
707
705
  const names = declared.map((d) => `${d.table}.${d.column}`).join(", ");
708
706
  deps.say.plain(`The next \`supatype push\` treats ${names} as declared field(s).`);
@@ -782,8 +780,6 @@ function liveColumns(state) {
782
780
  * a schema import names it; otherwise the platform's own absolute path.
783
781
  */
784
782
  function displayPath(file, cwd) {
785
- const rel = relative(cwd, file);
786
- // On another drive `relative` answers the absolute path itself.
787
- return rel === "" || rel.startsWith("..") || isAbsolute(rel) ? file : rel.split(sep).join("/");
783
+ return pathInside(cwd, file) ? toPosixPath(relative(cwd, file)) : file;
788
784
  }
789
785
  //# sourceMappingURL=adopt-columns.js.map