@supatype/cli 0.9.2 → 0.10.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 (525) hide show
  1. package/CHANGELOG.md +196 -0
  2. package/dist/api-config-cache.d.ts +22 -8
  3. package/dist/api-config-cache.d.ts.map +1 -1
  4. package/dist/api-config-cache.js +82 -19
  5. package/dist/api-config-cache.js.map +1 -1
  6. package/dist/api-config-stack.d.ts +23 -0
  7. package/dist/api-config-stack.d.ts.map +1 -0
  8. package/dist/api-config-stack.js +63 -0
  9. package/dist/api-config-stack.js.map +1 -0
  10. package/dist/api-url.d.ts +12 -0
  11. package/dist/api-url.d.ts.map +1 -0
  12. package/dist/api-url.js +17 -0
  13. package/dist/api-url.js.map +1 -0
  14. package/dist/app/framework.d.ts +18 -2
  15. package/dist/app/framework.d.ts.map +1 -1
  16. package/dist/app/framework.js +26 -3
  17. package/dist/app/framework.js.map +1 -1
  18. package/dist/app/proxy-dev-app.d.ts +7 -1
  19. package/dist/app/proxy-dev-app.d.ts.map +1 -1
  20. package/dist/app/proxy-dev-app.js +20 -4
  21. package/dist/app/proxy-dev-app.js.map +1 -1
  22. package/dist/app/vite-dev-args.d.ts +14 -1
  23. package/dist/app/vite-dev-args.d.ts.map +1 -1
  24. package/dist/app/vite-dev-args.js +40 -15
  25. package/dist/app/vite-dev-args.js.map +1 -1
  26. package/dist/applied-ast-artifacts.d.ts +7 -2
  27. package/dist/applied-ast-artifacts.d.ts.map +1 -1
  28. package/dist/applied-ast-artifacts.js +8 -3
  29. package/dist/applied-ast-artifacts.js.map +1 -1
  30. package/dist/archive-extract.d.ts +21 -2
  31. package/dist/archive-extract.d.ts.map +1 -1
  32. package/dist/archive-extract.js +30 -11
  33. package/dist/archive-extract.js.map +1 -1
  34. package/dist/augmentation-generator.d.ts +7 -0
  35. package/dist/augmentation-generator.d.ts.map +1 -1
  36. package/dist/augmentation-generator.js +68 -5
  37. package/dist/augmentation-generator.js.map +1 -1
  38. package/dist/auth-answer.d.ts +1 -1
  39. package/dist/auth-answer.js +1 -1
  40. package/dist/auth-config-validate.d.ts +3 -0
  41. package/dist/auth-config-validate.d.ts.map +1 -0
  42. package/dist/auth-config-validate.js +85 -0
  43. package/dist/auth-config-validate.js.map +1 -0
  44. package/dist/auth-groups-env.d.ts +14 -0
  45. package/dist/auth-groups-env.d.ts.map +1 -0
  46. package/dist/auth-groups-env.js +53 -0
  47. package/dist/auth-groups-env.js.map +1 -0
  48. package/dist/auth-providers.d.ts +6 -14
  49. package/dist/auth-providers.d.ts.map +1 -1
  50. package/dist/auth-providers.js +6 -36
  51. package/dist/auth-providers.js.map +1 -1
  52. package/dist/auth-settings-push.d.ts +29 -0
  53. package/dist/auth-settings-push.d.ts.map +1 -0
  54. package/dist/auth-settings-push.js +176 -0
  55. package/dist/auth-settings-push.js.map +1 -0
  56. package/dist/binary-cache.d.ts +4 -1
  57. package/dist/binary-cache.d.ts.map +1 -1
  58. package/dist/binary-cache.js +33 -63
  59. package/dist/binary-cache.js.map +1 -1
  60. package/dist/browser-login.d.ts +42 -0
  61. package/dist/browser-login.d.ts.map +1 -0
  62. package/dist/browser-login.js +111 -0
  63. package/dist/browser-login.js.map +1 -0
  64. package/dist/build-public-env.d.ts +29 -0
  65. package/dist/build-public-env.d.ts.map +1 -0
  66. package/dist/build-public-env.js +97 -0
  67. package/dist/build-public-env.js.map +1 -0
  68. package/dist/build-refused.d.ts +9 -0
  69. package/dist/build-refused.d.ts.map +1 -0
  70. package/dist/build-refused.js +9 -0
  71. package/dist/build-refused.js.map +1 -0
  72. package/dist/cdn-fetch.d.ts +36 -0
  73. package/dist/cdn-fetch.d.ts.map +1 -0
  74. package/dist/cdn-fetch.js +175 -0
  75. package/dist/cdn-fetch.js.map +1 -0
  76. package/dist/channel-extractor.d.ts +51 -0
  77. package/dist/channel-extractor.d.ts.map +1 -0
  78. package/dist/channel-extractor.js +485 -0
  79. package/dist/channel-extractor.js.map +1 -0
  80. package/dist/cli-launcher.d.ts.map +1 -1
  81. package/dist/cli-launcher.js +3 -2
  82. package/dist/cli-launcher.js.map +1 -1
  83. package/dist/cli-release-check.d.ts +34 -0
  84. package/dist/cli-release-check.d.ts.map +1 -0
  85. package/dist/cli-release-check.js +79 -0
  86. package/dist/cli-release-check.js.map +1 -0
  87. package/dist/cli-standalone.d.ts +16 -0
  88. package/dist/cli-standalone.d.ts.map +1 -1
  89. package/dist/cli-standalone.js +92 -47
  90. package/dist/cli-standalone.js.map +1 -1
  91. package/dist/cli-version-embedded.d.ts.map +1 -1
  92. package/dist/cli-version-embedded.js +1 -1
  93. package/dist/cli-version-embedded.js.map +1 -1
  94. package/dist/cli.d.ts.map +1 -1
  95. package/dist/cli.js +2 -0
  96. package/dist/cli.js.map +1 -1
  97. package/dist/client-generator.d.ts.map +1 -1
  98. package/dist/client-generator.js +9 -3
  99. package/dist/client-generator.js.map +1 -1
  100. package/dist/cloud-admin.d.ts +55 -0
  101. package/dist/cloud-admin.d.ts.map +1 -0
  102. package/dist/cloud-admin.js +99 -0
  103. package/dist/cloud-admin.js.map +1 -0
  104. package/dist/cloud-credentials.d.ts +24 -9
  105. package/dist/cloud-credentials.d.ts.map +1 -1
  106. package/dist/cloud-credentials.js +57 -47
  107. package/dist/cloud-credentials.js.map +1 -1
  108. package/dist/cloud-saml-key.d.ts +9 -0
  109. package/dist/cloud-saml-key.d.ts.map +1 -0
  110. package/dist/cloud-saml-key.js +44 -0
  111. package/dist/cloud-saml-key.js.map +1 -0
  112. package/dist/commands/admin.d.ts.map +1 -1
  113. package/dist/commands/admin.js +74 -13
  114. package/dist/commands/admin.js.map +1 -1
  115. package/dist/commands/build.d.ts +3 -2
  116. package/dist/commands/build.d.ts.map +1 -1
  117. package/dist/commands/build.js +10 -13
  118. package/dist/commands/build.js.map +1 -1
  119. package/dist/commands/cache.d.ts.map +1 -1
  120. package/dist/commands/cache.js +16 -5
  121. package/dist/commands/cache.js.map +1 -1
  122. package/dist/commands/cloud.d.ts +2 -0
  123. package/dist/commands/cloud.d.ts.map +1 -1
  124. package/dist/commands/cloud.js +96 -23
  125. package/dist/commands/cloud.js.map +1 -1
  126. package/dist/commands/db.d.ts.map +1 -1
  127. package/dist/commands/db.js +2 -1
  128. package/dist/commands/db.js.map +1 -1
  129. package/dist/commands/deploy.d.ts +21 -2
  130. package/dist/commands/deploy.d.ts.map +1 -1
  131. package/dist/commands/deploy.js +97 -97
  132. package/dist/commands/deploy.js.map +1 -1
  133. package/dist/commands/dev.d.ts +10 -0
  134. package/dist/commands/dev.d.ts.map +1 -1
  135. package/dist/commands/dev.js +44 -14
  136. package/dist/commands/dev.js.map +1 -1
  137. package/dist/commands/diff.d.ts.map +1 -1
  138. package/dist/commands/diff.js +16 -4
  139. package/dist/commands/diff.js.map +1 -1
  140. package/dist/commands/functions.d.ts.map +1 -1
  141. package/dist/commands/functions.js +163 -54
  142. package/dist/commands/functions.js.map +1 -1
  143. package/dist/commands/hooks.d.ts.map +1 -1
  144. package/dist/commands/hooks.js +40 -9
  145. package/dist/commands/hooks.js.map +1 -1
  146. package/dist/commands/init.d.ts +14 -0
  147. package/dist/commands/init.d.ts.map +1 -1
  148. package/dist/commands/init.js +169 -27
  149. package/dist/commands/init.js.map +1 -1
  150. package/dist/commands/keys.d.ts +6 -0
  151. package/dist/commands/keys.d.ts.map +1 -1
  152. package/dist/commands/keys.js +17 -10
  153. package/dist/commands/keys.js.map +1 -1
  154. package/dist/commands/link-helpers.d.ts +4 -1
  155. package/dist/commands/link-helpers.d.ts.map +1 -1
  156. package/dist/commands/link-helpers.js +64 -12
  157. package/dist/commands/link-helpers.js.map +1 -1
  158. package/dist/commands/login.d.ts +3 -2
  159. package/dist/commands/login.d.ts.map +1 -1
  160. package/dist/commands/login.js +99 -57
  161. package/dist/commands/login.js.map +1 -1
  162. package/dist/commands/migrate.d.ts +17 -0
  163. package/dist/commands/migrate.d.ts.map +1 -1
  164. package/dist/commands/migrate.js +22 -4
  165. package/dist/commands/migrate.js.map +1 -1
  166. package/dist/commands/push.d.ts +35 -1
  167. package/dist/commands/push.d.ts.map +1 -1
  168. package/dist/commands/push.js +114 -20
  169. package/dist/commands/push.js.map +1 -1
  170. package/dist/commands/seed.d.ts +31 -45
  171. package/dist/commands/seed.d.ts.map +1 -1
  172. package/dist/commands/seed.js +93 -215
  173. package/dist/commands/seed.js.map +1 -1
  174. package/dist/commands/self-host.d.ts.map +1 -1
  175. package/dist/commands/self-host.js +22 -3
  176. package/dist/commands/self-host.js.map +1 -1
  177. package/dist/commands/site.d.ts +42 -0
  178. package/dist/commands/site.d.ts.map +1 -0
  179. package/dist/commands/site.js +100 -0
  180. package/dist/commands/site.js.map +1 -0
  181. package/dist/commands/sso.d.ts +13 -3
  182. package/dist/commands/sso.d.ts.map +1 -1
  183. package/dist/commands/sso.js +58 -16
  184. package/dist/commands/sso.js.map +1 -1
  185. package/dist/commands/update.d.ts.map +1 -1
  186. package/dist/commands/update.js +5 -5
  187. package/dist/commands/update.js.map +1 -1
  188. package/dist/compose-auth-settings.d.ts +12 -0
  189. package/dist/compose-auth-settings.d.ts.map +1 -0
  190. package/dist/compose-auth-settings.js +39 -0
  191. package/dist/compose-auth-settings.js.map +1 -0
  192. package/dist/compose-db-roles.d.ts.map +1 -1
  193. package/dist/compose-db-roles.js +3 -0
  194. package/dist/compose-db-roles.js.map +1 -1
  195. package/dist/compose-kong.d.ts +5 -1
  196. package/dist/compose-kong.d.ts.map +1 -1
  197. package/dist/compose-kong.js +8 -4
  198. package/dist/compose-kong.js.map +1 -1
  199. package/dist/compose-render-mode.d.ts.map +1 -1
  200. package/dist/compose-render-mode.js +9 -8
  201. package/dist/compose-render-mode.js.map +1 -1
  202. package/dist/config-mailer-env.js +2 -2
  203. package/dist/config-mailer-env.js.map +1 -1
  204. package/dist/config.d.ts +1 -1
  205. package/dist/config.d.ts.map +1 -1
  206. package/dist/cors-origins-push.d.ts +16 -0
  207. package/dist/cors-origins-push.d.ts.map +1 -0
  208. package/dist/cors-origins-push.js +37 -0
  209. package/dist/cors-origins-push.js.map +1 -0
  210. package/dist/database-url-owner.d.ts.map +1 -1
  211. package/dist/database-url-owner.js +2 -1
  212. package/dist/database-url-owner.js.map +1 -1
  213. package/dist/db-port.d.ts +3 -1
  214. package/dist/db-port.d.ts.map +1 -1
  215. package/dist/db-port.js +1 -1
  216. package/dist/db-port.js.map +1 -1
  217. package/dist/destructive-consent.d.ts.map +1 -1
  218. package/dist/destructive-consent.js +23 -1
  219. package/dist/destructive-consent.js.map +1 -1
  220. package/dist/dev-compose.d.ts.map +1 -1
  221. package/dist/dev-compose.js +25 -18
  222. package/dist/dev-compose.js.map +1 -1
  223. package/dist/dev-functions-watch.d.ts +25 -4
  224. package/dist/dev-functions-watch.d.ts.map +1 -1
  225. package/dist/dev-functions-watch.js +78 -13
  226. package/dist/dev-functions-watch.js.map +1 -1
  227. package/dist/dev-schema-watch.d.ts +6 -0
  228. package/dist/dev-schema-watch.d.ts.map +1 -1
  229. package/dist/dev-schema-watch.js +9 -0
  230. package/dist/dev-schema-watch.js.map +1 -1
  231. package/dist/dev-session-lock.d.ts +6 -1
  232. package/dist/dev-session-lock.d.ts.map +1 -1
  233. package/dist/dev-session-lock.js +1 -0
  234. package/dist/dev-session-lock.js.map +1 -1
  235. package/dist/diff-access.d.ts.map +1 -1
  236. package/dist/diff-access.js +17 -1
  237. package/dist/diff-access.js.map +1 -1
  238. package/dist/diff-channels.d.ts +14 -0
  239. package/dist/diff-channels.d.ts.map +1 -0
  240. package/dist/diff-channels.js +38 -0
  241. package/dist/diff-channels.js.map +1 -0
  242. package/dist/docker-exec.d.ts +25 -4
  243. package/dist/docker-exec.d.ts.map +1 -1
  244. package/dist/docker-exec.js +88 -8
  245. package/dist/docker-exec.js.map +1 -1
  246. package/dist/docker-postgres.d.ts +11 -0
  247. package/dist/docker-postgres.d.ts.map +1 -1
  248. package/dist/docker-postgres.js +9 -1
  249. package/dist/docker-postgres.js.map +1 -1
  250. package/dist/engine-answers.d.ts.map +1 -1
  251. package/dist/engine-answers.js +2 -1
  252. package/dist/engine-answers.js.map +1 -1
  253. package/dist/engine-client.d.ts +28 -0
  254. package/dist/engine-client.d.ts.map +1 -1
  255. package/dist/engine-client.js +4 -4
  256. package/dist/engine-client.js.map +1 -1
  257. package/dist/engine-floor.d.ts +35 -0
  258. package/dist/engine-floor.d.ts.map +1 -1
  259. package/dist/engine-floor.js +67 -0
  260. package/dist/engine-floor.js.map +1 -1
  261. package/dist/engine-ownership-gate.d.ts +11 -1
  262. package/dist/engine-ownership-gate.d.ts.map +1 -1
  263. package/dist/engine-ownership-gate.js +32 -0
  264. package/dist/engine-ownership-gate.js.map +1 -1
  265. package/dist/engine-push-output.d.ts +12 -4
  266. package/dist/engine-push-output.d.ts.map +1 -1
  267. package/dist/engine-push-output.js.map +1 -1
  268. package/dist/env-file.d.ts +18 -0
  269. package/dist/env-file.d.ts.map +1 -1
  270. package/dist/env-file.js +59 -4
  271. package/dist/env-file.js.map +1 -1
  272. package/dist/env-lines.d.ts +5 -2
  273. package/dist/env-lines.d.ts.map +1 -1
  274. package/dist/env-lines.js +18 -3
  275. package/dist/env-lines.js.map +1 -1
  276. package/dist/env-managed-record.d.ts +20 -0
  277. package/dist/env-managed-record.d.ts.map +1 -0
  278. package/dist/env-managed-record.js +56 -0
  279. package/dist/env-managed-record.js.map +1 -0
  280. package/dist/error-message.d.ts.map +1 -1
  281. package/dist/error-message.js +7 -3
  282. package/dist/error-message.js.map +1 -1
  283. package/dist/frontend-env.d.ts.map +1 -1
  284. package/dist/frontend-env.js +3 -4
  285. package/dist/frontend-env.js.map +1 -1
  286. package/dist/frontend-values-linked.d.ts +3 -0
  287. package/dist/frontend-values-linked.d.ts.map +1 -1
  288. package/dist/frontend-values-linked.js +3 -2
  289. package/dist/frontend-values-linked.js.map +1 -1
  290. package/dist/frontend-values.d.ts +2 -1
  291. package/dist/frontend-values.d.ts.map +1 -1
  292. package/dist/frontend-values.js +2 -1
  293. package/dist/frontend-values.js.map +1 -1
  294. package/dist/functions-context-refresh.d.ts.map +1 -1
  295. package/dist/functions-context-refresh.js +5 -2
  296. package/dist/functions-context-refresh.js.map +1 -1
  297. package/dist/functions-deno-types.d.ts +6 -0
  298. package/dist/functions-deno-types.d.ts.map +1 -1
  299. package/dist/functions-deno-types.js +38 -30
  300. package/dist/functions-deno-types.js.map +1 -1
  301. package/dist/functions-env-local.d.ts +7 -2
  302. package/dist/functions-env-local.d.ts.map +1 -1
  303. package/dist/functions-env-local.js +8 -3
  304. package/dist/functions-env-local.js.map +1 -1
  305. package/dist/generated/functions-worker-source.d.ts.map +1 -1
  306. package/dist/generated/functions-worker-source.js +6 -3
  307. package/dist/generated/functions-worker-source.js.map +1 -1
  308. package/dist/generated/release-images.d.ts +6 -6
  309. package/dist/generated/release-images.js +3 -3
  310. package/dist/generated-files-engine.d.ts +9 -0
  311. package/dist/generated-files-engine.d.ts.map +1 -1
  312. package/dist/generated-files-engine.js +23 -0
  313. package/dist/generated-files-engine.js.map +1 -1
  314. package/dist/hooks-generator.d.ts.map +1 -1
  315. package/dist/hooks-generator.js +28 -8
  316. package/dist/hooks-generator.js.map +1 -1
  317. package/dist/hooks-worker-reload.d.ts +18 -0
  318. package/dist/hooks-worker-reload.d.ts.map +1 -0
  319. package/dist/hooks-worker-reload.js +19 -0
  320. package/dist/hooks-worker-reload.js.map +1 -0
  321. package/dist/index.d.ts +1 -0
  322. package/dist/index.d.ts.map +1 -1
  323. package/dist/index.js.map +1 -1
  324. package/dist/init-package-json.d.ts +1 -0
  325. package/dist/init-package-json.d.ts.map +1 -1
  326. package/dist/init-package-json.js +15 -2
  327. package/dist/init-package-json.js.map +1 -1
  328. package/dist/init-setup-steps.d.ts +32 -4
  329. package/dist/init-setup-steps.d.ts.map +1 -1
  330. package/dist/init-setup-steps.js +114 -18
  331. package/dist/init-setup-steps.js.map +1 -1
  332. package/dist/keyspace-port.d.ts +14 -0
  333. package/dist/keyspace-port.d.ts.map +1 -0
  334. package/dist/keyspace-port.js +35 -0
  335. package/dist/keyspace-port.js.map +1 -0
  336. package/dist/kong-config.d.ts +5 -0
  337. package/dist/kong-config.d.ts.map +1 -1
  338. package/dist/kong-config.js +61 -6
  339. package/dist/kong-config.js.map +1 -1
  340. package/dist/link.d.ts +30 -0
  341. package/dist/link.d.ts.map +1 -1
  342. package/dist/link.js +70 -16
  343. package/dist/link.js.map +1 -1
  344. package/dist/local-secrets.d.ts +12 -0
  345. package/dist/local-secrets.d.ts.map +1 -1
  346. package/dist/local-secrets.js +16 -0
  347. package/dist/local-secrets.js.map +1 -1
  348. package/dist/local-stack-guard.d.ts +8 -0
  349. package/dist/local-stack-guard.d.ts.map +1 -1
  350. package/dist/local-stack-guard.js +41 -1
  351. package/dist/local-stack-guard.js.map +1 -1
  352. package/dist/local-stack.d.ts +2 -0
  353. package/dist/local-stack.d.ts.map +1 -1
  354. package/dist/local-stack.js +7 -2
  355. package/dist/local-stack.js.map +1 -1
  356. package/dist/mailer-env.d.ts +8 -1
  357. package/dist/mailer-env.d.ts.map +1 -1
  358. package/dist/mailer-env.js +52 -8
  359. package/dist/mailer-env.js.map +1 -1
  360. package/dist/model-hooks.d.ts +2 -0
  361. package/dist/model-hooks.d.ts.map +1 -1
  362. package/dist/model-hooks.js +1 -1
  363. package/dist/model-hooks.js.map +1 -1
  364. package/dist/model-versioning.d.ts +6 -0
  365. package/dist/model-versioning.d.ts.map +1 -1
  366. package/dist/model-versioning.js +12 -0
  367. package/dist/model-versioning.js.map +1 -1
  368. package/dist/native-dev-env.d.ts +16 -4
  369. package/dist/native-dev-env.d.ts.map +1 -1
  370. package/dist/native-dev-env.js +63 -7
  371. package/dist/native-dev-env.js.map +1 -1
  372. package/dist/native-keyspace.d.ts +10 -0
  373. package/dist/native-keyspace.d.ts.map +1 -1
  374. package/dist/native-keyspace.js +24 -8
  375. package/dist/native-keyspace.js.map +1 -1
  376. package/dist/native-stale-session.d.ts +17 -0
  377. package/dist/native-stale-session.d.ts.map +1 -0
  378. package/dist/native-stale-session.js +42 -0
  379. package/dist/native-stale-session.js.map +1 -0
  380. package/dist/native-worker.d.ts +15 -0
  381. package/dist/native-worker.d.ts.map +1 -1
  382. package/dist/native-worker.js +26 -0
  383. package/dist/native-worker.js.map +1 -1
  384. package/dist/open-browser.d.ts +7 -0
  385. package/dist/open-browser.d.ts.map +1 -0
  386. package/dist/open-browser.js +26 -0
  387. package/dist/open-browser.js.map +1 -0
  388. package/dist/personal-access-token.d.ts +7 -0
  389. package/dist/personal-access-token.d.ts.map +1 -0
  390. package/dist/personal-access-token.js +11 -0
  391. package/dist/personal-access-token.js.map +1 -0
  392. package/dist/plan-sql.d.ts +30 -0
  393. package/dist/plan-sql.d.ts.map +1 -0
  394. package/dist/plan-sql.js +65 -0
  395. package/dist/plan-sql.js.map +1 -0
  396. package/dist/platform-settings-push.d.ts +15 -0
  397. package/dist/platform-settings-push.d.ts.map +1 -0
  398. package/dist/platform-settings-push.js +100 -0
  399. package/dist/platform-settings-push.js.map +1 -0
  400. package/dist/platform-settings.d.ts +81 -0
  401. package/dist/platform-settings.d.ts.map +1 -0
  402. package/dist/platform-settings.js +164 -0
  403. package/dist/platform-settings.js.map +1 -0
  404. package/dist/postgres-ctl.d.ts +14 -0
  405. package/dist/postgres-ctl.d.ts.map +1 -1
  406. package/dist/postgres-ctl.js +10 -10
  407. package/dist/postgres-ctl.js.map +1 -1
  408. package/dist/postgres-image.d.ts +11 -2
  409. package/dist/postgres-image.d.ts.map +1 -1
  410. package/dist/postgres-image.js +24 -2
  411. package/dist/postgres-image.js.map +1 -1
  412. package/dist/postgrest-release.d.ts +1 -1
  413. package/dist/postgrest-release.d.ts.map +1 -1
  414. package/dist/postgrest-release.js +3 -1
  415. package/dist/postgrest-release.js.map +1 -1
  416. package/dist/process-manager.d.ts +5 -0
  417. package/dist/process-manager.d.ts.map +1 -1
  418. package/dist/process-manager.js +7 -1
  419. package/dist/process-manager.js.map +1 -1
  420. package/dist/project-config.d.ts +88 -6
  421. package/dist/project-config.d.ts.map +1 -1
  422. package/dist/project-config.js +57 -0
  423. package/dist/project-config.js.map +1 -1
  424. package/dist/release-images.d.ts +21 -0
  425. package/dist/release-images.d.ts.map +1 -1
  426. package/dist/release-images.js +24 -0
  427. package/dist/release-images.js.map +1 -1
  428. package/dist/resolve-target.d.ts +42 -2
  429. package/dist/resolve-target.d.ts.map +1 -1
  430. package/dist/resolve-target.js +115 -21
  431. package/dist/resolve-target.js.map +1 -1
  432. package/dist/rest-cache-admin.d.ts +13 -0
  433. package/dist/rest-cache-admin.d.ts.map +1 -1
  434. package/dist/rest-cache-admin.js +36 -1
  435. package/dist/rest-cache-admin.js.map +1 -1
  436. package/dist/rest-ready.d.ts +6 -0
  437. package/dist/rest-ready.d.ts.map +1 -1
  438. package/dist/rest-ready.js +18 -2
  439. package/dist/rest-ready.js.map +1 -1
  440. package/dist/runtime-routes.d.ts.map +1 -1
  441. package/dist/runtime-routes.js +5 -4
  442. package/dist/runtime-routes.js.map +1 -1
  443. package/dist/schema-ast-v2.d.ts +38 -0
  444. package/dist/schema-ast-v2.d.ts.map +1 -1
  445. package/dist/schema-ast-v2.js +2 -0
  446. package/dist/schema-ast-v2.js.map +1 -1
  447. package/dist/schema-reset.d.ts.map +1 -1
  448. package/dist/schema-reset.js +2 -0
  449. package/dist/schema-reset.js.map +1 -1
  450. package/dist/seed-default-export.d.ts +12 -0
  451. package/dist/seed-default-export.d.ts.map +1 -0
  452. package/dist/seed-default-export.js +44 -0
  453. package/dist/seed-default-export.js.map +1 -0
  454. package/dist/seed-prepare.d.ts +60 -0
  455. package/dist/seed-prepare.d.ts.map +1 -0
  456. package/dist/seed-prepare.js +115 -0
  457. package/dist/seed-prepare.js.map +1 -0
  458. package/dist/seed-remote.d.ts +22 -0
  459. package/dist/seed-remote.d.ts.map +1 -0
  460. package/dist/seed-remote.js +203 -0
  461. package/dist/seed-remote.js.map +1 -0
  462. package/dist/seed-report.d.ts +65 -0
  463. package/dist/seed-report.d.ts.map +1 -0
  464. package/dist/seed-report.js +98 -0
  465. package/dist/seed-report.js.map +1 -0
  466. package/dist/self-host-compose.d.ts +6 -0
  467. package/dist/self-host-compose.d.ts.map +1 -1
  468. package/dist/self-host-compose.js +135 -29
  469. package/dist/self-host-compose.js.map +1 -1
  470. package/dist/site-build-env.d.ts +31 -0
  471. package/dist/site-build-env.d.ts.map +1 -0
  472. package/dist/site-build-env.js +29 -0
  473. package/dist/site-build-env.js.map +1 -0
  474. package/dist/site-deploy.d.ts +52 -0
  475. package/dist/site-deploy.d.ts.map +1 -0
  476. package/dist/site-deploy.js +230 -0
  477. package/dist/site-deploy.js.map +1 -0
  478. package/dist/site-public-env.d.ts +67 -0
  479. package/dist/site-public-env.d.ts.map +1 -0
  480. package/dist/site-public-env.js +124 -0
  481. package/dist/site-public-env.js.map +1 -0
  482. package/dist/sso-admin.d.ts +15 -0
  483. package/dist/sso-admin.d.ts.map +1 -1
  484. package/dist/sso-admin.js +32 -9
  485. package/dist/sso-admin.js.map +1 -1
  486. package/dist/stack-running.d.ts +13 -0
  487. package/dist/stack-running.d.ts.map +1 -0
  488. package/dist/stack-running.js +44 -0
  489. package/dist/stack-running.js.map +1 -0
  490. package/dist/stack-setting-warnings.d.ts +6 -0
  491. package/dist/stack-setting-warnings.d.ts.map +1 -1
  492. package/dist/stack-setting-warnings.js +15 -0
  493. package/dist/stack-setting-warnings.js.map +1 -1
  494. package/dist/studio-admin-roles.d.ts +4 -4
  495. package/dist/studio-admin-roles.d.ts.map +1 -1
  496. package/dist/studio-admin-roles.js +6 -4
  497. package/dist/studio-admin-roles.js.map +1 -1
  498. package/dist/target-client.d.ts +13 -1
  499. package/dist/target-client.d.ts.map +1 -1
  500. package/dist/target-client.js +83 -17
  501. package/dist/target-client.js.map +1 -1
  502. package/dist/target-request.d.ts +5 -0
  503. package/dist/target-request.d.ts.map +1 -1
  504. package/dist/target-request.js +11 -2
  505. package/dist/target-request.js.map +1 -1
  506. package/dist/type-extractor.d.ts.map +1 -1
  507. package/dist/type-extractor.js +75 -7
  508. package/dist/type-extractor.js.map +1 -1
  509. package/dist/ui/clack-api.d.ts +2 -1
  510. package/dist/ui/clack-api.d.ts.map +1 -1
  511. package/dist/ui/clack-api.js +4 -4
  512. package/dist/ui/clack-api.js.map +1 -1
  513. package/dist/ui/clack.d.ts.map +1 -1
  514. package/dist/ui/clack.js +5 -2
  515. package/dist/ui/clack.js.map +1 -1
  516. package/dist/valkey-sidecar.d.ts +10 -2
  517. package/dist/valkey-sidecar.d.ts.map +1 -1
  518. package/dist/valkey-sidecar.js +24 -18
  519. package/dist/valkey-sidecar.js.map +1 -1
  520. package/package.json +4 -4
  521. package/releases/deno/VERSION +1 -1
  522. package/dist/commands/deploy-types.d.ts +0 -14
  523. package/dist/commands/deploy-types.d.ts.map +0 -1
  524. package/dist/commands/deploy-types.js +0 -38
  525. package/dist/commands/deploy-types.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,201 @@
1
1
  # Changelog
2
2
 
3
+ There is no 0.4, 0.5 or 0.6 release: this package went from 0.3.6 straight to 0.7.0, on npm and as git tags, so
4
+ no entries are missing from this file.
5
+
6
+ ## 0.9.3
7
+
8
+ ### Features
9
+
10
+ * **push, diff:** `supatype push --dry-run` and `supatype diff --sql` print the full SQL a push would
11
+ apply, after the change list, from the same engine call `supatype migrate` uses. A dry run applies
12
+ nothing, asks nothing, records no rename, deploys no hooks and exits 0, and shows destructive changes
13
+ with their risk comments without `--yes`. Supatype Cloud and a linked self-host server have no
14
+ endpoint that writes SQL without applying it, so there they print the change list and say so.
15
+ * **storage:** the extractor reads `Folder<N>` as a bucket-rule operand and refuses it in a model's
16
+ `access`, or with a position that is not a whole number from 1.
17
+ * **push, diff:** the access summary lists what each role can reach under the rules (new `effective`
18
+ field, printed by `diff` and `dev`), so a `Private` model no longer reads as full CRUD. `after`
19
+ is unchanged for `--json`.
20
+ * **push:** a warning names any field stored as jsonb because its TypeScript type has no column type
21
+ (a single string literal, say). The mapping is unchanged.
22
+ * **generate:** the generated client declares the schema's channels as `SupatypeChannels`, keyed by
23
+ pattern with each parameter's type (`"lot:{id}": { params: { id: string } }`), so
24
+ `realtime.channel()` autocompletes `lot:${string}` and `lobby:${string}`. Names that match no
25
+ declaration still type-check, since an `open` server admits them. Nothing is emitted when the
26
+ schema declares no channel.
27
+ * **realtime:** declare private channels in the schema. `export type LotChannel = Channel<"lot:{id}",
28
+ { params: { id: UUID }, access: { join, send, track } }>` takes the same rules as a model, with the
29
+ channel's parameters standing where a model has columns (`In<"id", MyLots>`, and `Param<"id">`
30
+ inside a `Rows<>` filter). `send` can also hold `Event<"bid">` and `Payload<"amount", { kind:
31
+ "number"; min: 1 }>` inside `All<[...]>`, which the realtime server checks per message. A
32
+ pattern's last segment can be `*`. A declaration is refused at extract time when its pattern and
33
+ `params` disagree, when two declarations can match one topic, when `Param<>`, `Event<>` or
34
+ `Payload<>` appear anywhere but a channel's rules, or when a rule names something that is not a
35
+ parameter. Declaring a channel enforces its pattern for every client at once.
36
+ * **config:** `realtime.channels` is `"open"` (the default, so an existing project is unchanged) or
37
+ `"declared"`, which refuses broadcast and presence on a topic no declaration matches. It reaches
38
+ the database through push. `supatype init` writes `"declared"` for a new project.
39
+ * **diff, push:** list channel changes (added, removed, which operation's rule changed) and warn
40
+ when removing a declaration or turning `declared` on takes broadcast and presence away. The lines
41
+ appear once the engine reports them; an older engine says nothing.
42
+ * **push:** refuses a schema that declares channels, or sets `realtime.channels`, against a pinned
43
+ engine older than 0.11.0 (`ENGINE_MIN_FOR_CHANNELS`). An older engine drops both keys, so the push
44
+ would succeed with nothing enforcing the channels.
45
+ * **push, diff, doctor, adopt, dev, deploy:** a schema that declares channels or sets
46
+ `realtime.channels` is sent only to an engine or server that lists `private_channels` in its
47
+ capabilities, as identity columns already are with `identity_columns`. This is checked on its
48
+ own, apart from the version floor above, so an older engine can never drop the channels in
49
+ silence.
50
+ * **dev:** runs the same engine floor check as `supatype push` before applying a schema, native and
51
+ Docker alike. It skipped it, so a pinned older engine took channels and enforced nothing.
52
+ * **push, diff:** warn when a channel's `send` rule tests only `Event<>` or `Payload<>` and nothing
53
+ about the caller. Those nodes are checked by the realtime server and compile to TRUE in the
54
+ database, so `send: Event<"bid">` admits every caller, anon included. The warning names the channel
55
+ and suggests `send: All<[LoggedIn, Event<"bid">]>`. It is a warning, not an error, and is carried
56
+ to the engine in the schema's `warnings`.
57
+ * **deploy:** a Cloud deploy's create call sends the site's manifest, each file's NFC path, size and
58
+ sha256, and the app's `spa` flag (`build.spa`, or the framework's default), so the server can say
59
+ which files it already holds. This is the first of four steps toward hosting the site on the
60
+ project's own domain; until the server side lands, `deploy --app-only` against Cloud still ends
61
+ without a live site.
62
+ * **deploy:** a Cloud deploy uploads only the files the server says it lacks (`missing`), each to
63
+ `<uploadUrl>/<sha256>`, six at a time, so an unchanged build uploads nothing. Every call carries
64
+ `Authorization`, `X-Org-Id` and `X-Supatype-Environment`, every upload's status is checked, and a 5xx
65
+ or a dropped connection is retried three times. Any other refusal stops the deploy, naming the file
66
+ and the server's reason, before finalize. Uploads used to go by path and their answers were never read.
67
+ * **deploy:** a Cloud deploy checks finalize and prints the site's own address (`https://<ref>.<domain>`)
68
+ from its answer, not the control plane's API URL. A 502 `pointer_not_pushed` (the version is recorded
69
+ but the project's server was not told) is retried three times, since finalize is idempotent, and then
70
+ reported as "uploaded but not live". Any other refusal, such as `blobs_missing`, stops with the
71
+ server's reason. Finalize's answer was never read before, so a failed finalize looked like success.
72
+ * **deploy:** Cloud's own tier limit decides how large a site may be. The CLI no longer stops a Cloud
73
+ deploy at a fixed 500 MB; the server answers 413 and the deploy prints its reason (the site's size,
74
+ and the limit for the project's tier). `deploy --local` and a self-hosted link keep the 500 MB check,
75
+ since no server applies a limit there. The unused `commands/deploy-types.ts` tier table, which had no
76
+ `growth` tier and was never read, is deleted.
77
+ * **deploy:** `deploy --preview` against a Cloud link is refused before the config is read or anything
78
+ is built: "Previews are not available on Supatype Cloud yet". Deploy without `--preview` to publish to
79
+ production. `--schema-only`, `--local` and self-hosted links are unchanged.
80
+ * **deploy:** a site over its plan's size is a soft limit and still goes live. When Cloud's create
81
+ answer carries a `site_over_plan` warning, the deploy prints the site's size and the plan's in MB
82
+ and "Upgrade your plan before <date> to avoid overage charges", on every deploy while over. Other
83
+ warning codes print their message. Only a site over the tier's hard cap is refused (413
84
+ `site_too_large`, with the server's reason).
85
+ * **deploy:** `deploy status` prints the site's address first, then the live version, when it went
86
+ live, and the size against the plan ("80 MB of 50 MB plan"); when Cloud says the site is over
87
+ plan it adds the date to upgrade before. `deploy rollback` prints the address as well as the
88
+ version it went back to. Each line appears only when the server sends the field.
89
+
90
+ ### Features
91
+
92
+ * **login:** `supatype login` signs in through the browser. It opens the accounts site (which the
93
+ control plane names at `/api/v1/cli/login/config`, or `SUPATYPE_ACCOUNTS_URL`) and always prints the URL; after you approve, type the
94
+ code the page shows into the terminal and the CLI stores the personal access token (`spt_...`)
95
+ the control plane sealed to this CLI's key. `--name` names the token, `--no-browser` only prints
96
+ the URL, and `--token <spt_...>` (or `SUPATYPE_ACCESS_TOKEN`) stores a token made in your account,
97
+ for CI. A personal access token is never renewed through `/auth/refresh`, and a refusal of one
98
+ says it was revoked or expired.
99
+
100
+ ### Breaking Changes
101
+
102
+ * **login:** password login is gone. Sign-in on the platform now needs a Cloudflare Turnstile token a
103
+ terminal cannot give, so `supatype login --email --password` failed with `Login failed (400)`.
104
+ `--email`, `--password`, `SUPATYPE_EMAIL` and `SUPATYPE_PASSWORD` are no longer read. A session
105
+ an older CLI stored keeps working until it expires.
106
+
107
+ ### Features
108
+
109
+ * **functions:** `functions env list`, `set` and `unset` take `--function <name>` to work on one
110
+ function's own values, which override a shared one. A linked self-hosted server serves them at
111
+ `/admin/v1/functions/<name>/env`, Supatype Cloud at `/projects/<ref>/functions/<name>/env`, and a
112
+ project that is not linked keeps them in `functions/.env.<name>.local`.
113
+
114
+ ### Bug Fixes
115
+
116
+ * **push, generate:** the generated client registers array columns of exact values (`"bigint[]"`
117
+ and `"numeric[]"`, from the array's element type, `NUMERIC(19,4)` included), and types them as
118
+ the single values are: `bigint[]` for BIGINT elements and `string[]` for NUMERIC, DECIMAL and
119
+ MONEY. They were `number[]`, which a double rounds. Run `supatype push` to regenerate.
120
+ * **deploy:** the build step puts the app directory's `node_modules/.bin`, and every one above it, on PATH,
121
+ as `npm run` does, so the framework defaults (`vite build`, `astro build`, `next build`) and a bare
122
+ `buildCommand` find their binary. They failed with "'vite' is not recognized" before. The
123
+ `build.outputDirectory` doc now says it is relative to `build.directory` (`"dist"`, not `"web/dist"`).
124
+ * **dev (native):** a Valkey named in `SUPATYPE_VALKEY_ADDR` logs in with `SUPATYPE_VALKEY_PASSWORD` (and
125
+ `SUPATYPE_VALKEY_USERNAME`), or with no password, never the keyspace's. `init` writes a keyspace password
126
+ into every `.env`, and a Valkey with no password refused the server with WRONGPASS. A named Valkey that
127
+ used `SUPATYPE_KEYSPACE_PASSWORD` as its password now needs it as `SUPATYPE_VALKEY_PASSWORD`.
128
+ * **push:** a refused push names one `supatype rename <from> <new name>` line for a dropped table or column
129
+ with more than three possible new names. One table dropped beside eight added printed eight lines
130
+ naming it eight ways.
131
+ * **dev, generate (Docker):** a project that names its engine image in `SUPATYPE_ENGINE_IMAGE` writes its
132
+ types, seed builder and admin config with that image, the one it pushes with. The cached host engine
133
+ wrote them, and when it was older than the image it refused a schema the image had just pushed, three
134
+ times, while push still said "Schema pushed." The line the CLI writes from `versions.engine` does not
135
+ count: the host engine at that pin already matches it.
136
+ * **dev (native):** dev warns, with Deno's own error, when Deno cannot start in the project folder. A
137
+ `deno.lock` written by a newer Deno made the worker exit at once, and every function answered 502 with
138
+ an empty body and nothing in dev's output.
139
+ * **self-host:** `compose restart functions-worker` says to run `compose up` when `SUPATYPE_FUNCTIONS_DB_URL`
140
+ names `db` but db is not on the functions network yet. Only `up` recreates db onto it, and until
141
+ then every function using `ctx.dbUrl` failed with `getaddrinfo ENOTFOUND db`.
142
+ * **self-host:** `compose restart <service>` refuses a stack that is not running and names `compose up`.
143
+ It recreated the one service alone, with a database volume and networks for a stack that did not
144
+ exist, so a folder sharing a stopped stack's name got a stray container holding its own mount.
145
+ * **push (native):** no Studio link after a push or `admin create-user` on a native project. Native dev
146
+ runs no Studio, and the printed `/studio/` link answered 404.
147
+ * **dev (native):** functions get `ctx.dbUrl` only from `SUPATYPE_FUNCTIONS_DB_URL`, as on Docker. Native
148
+ dev handed every function the auth service's admin `DATABASE_URL`, a connection that skips row rules
149
+ and masking, and ignored `SUPATYPE_FUNCTIONS_DB_URL`.
150
+ * **self-host, dev:** the compose file passes `SUPATYPE_EXTERNAL_ANONYMOUS_USERS_ENABLED`, `REALTIME_CHANNELS`
151
+ and `REALTIME_CHANNEL_RECHECK_S` from `.env`. The docs turn anonymous sign-in on and tune channel
152
+ re-checks with them, and none reached a container, so `signInAnonymously()` stayed refused.
153
+ * **downloads:** a retried download says each failure in one sentence. The line read
154
+ `...; try again.. Retrying in 1s...`, a doubled full stop after every CDN message.
155
+ * **storage:** a bucket rule that cannot be rendered on `storage.objects` (one naming a model
156
+ column, `In`, `Exists`, `Matches`) is refused at push, naming the bucket and the operation. It
157
+ used to become `FALSE` with nothing said, so a documented registered-only rule on a bucket denied
158
+ everyone. `BucketOwner` on `create` does not bind the path: see the storage docs.
159
+ * **self-update, install, component downloads:** a stalled CDN no longer hangs the CLI. A request
160
+ fails only when no bytes have arrived for 60 s (`SUPATYPE_FETCH_TIMEOUT_MS` sets the window), with
161
+ no limit on total time, so a slow link still finishes. It is retried up to three times, an archive
162
+ retry resumes with an HTTP Range request from the bytes already received (a 200 answer restarts
163
+ from zero), checksums and signatures are checked on the complete file, and a failure names the URL
164
+ and says to try again. Archives show `Downloading supatype 0.9.2: 18 / 46 MB` in place on a
165
+ terminal, and a start and end line otherwise.
166
+ * **push, dev:** a model's `cache` block now switches the server cache on. The CLI wrote the allowlist
167
+ only into an `.supatype/api-config.json` that nothing created, so it did nothing and said nothing.
168
+ It now PATCHes `/admin/v1/config/rest` on the running stack (adding only newly declared tables) and
169
+ falls back to creating the file from the server's default shape. The `cache_max_ttl is 0` note
170
+ prints whenever a table declares a cache and the TTL is 0.
171
+ * **hooks:** the generated `hook()` and `hooks()` now pass the worker's function context through, so
172
+ `ctx.serviceRoleKey`, `ctx.url`, `ctx.anonKey`, `ctx.dbUrl` and `ctx.env` are typed and present on
173
+ every hook. A write a hook makes fires hooks again, bounded by the hook-depth header.
174
+ * **dev:** the functions watcher restarts the worker for a folder copied in or deleted (names with no
175
+ extension were dropped), and reports "restarted" only once the worker answers through the gateway.
176
+ * **admin:** when it removes `SUPATYPE_ADMIN_PASSWORD` from `.env` it now prints a line saying so.
177
+ * **functions:** `npm:postgres` 3.4.6 and later failed in the functions worker with
178
+ `Not implemented: LibuvStreamWrap.prototype.useUserBuffer`. The Deno pin moves from 2.2.0 to 2.9.8
179
+ (worker image, the CLI's `releases/deno/VERSION`, the `init` template comment, the hook-adapter
180
+ script and the example configs); Deno fixed the call in 2.8.0. The release mirror workflow must run
181
+ for `v2.9.8` before the CLI can download it. `npm:postgres` (latest), `npm:postgres@3.4.5` and
182
+ `npm:pg` all answered a query from a function on the new worker.
183
+ * **docs:** `ctx.dbUrl` no longer said to bypass row rules and field masking. They apply for the role the URL names, and only a superuser or `BYPASSRLS` role skips them. The `FunctionContext` JSDoc, the docs, the self-host example and the skill references now say so and say which database the URL ends in (`POSTGRES_DB`). Also documents `global()`, `meta.cacheStatus`, `pg_safeupdate`, presence echo, server logic in a Postgres function and a versions page, stamps every package changelog with the version it shipped in, and fails the release when one still says Unreleased.
184
+ * **functions:** `functions env unset` on a project that is not linked removes every line of
185
+ `.env.local` whose name is the key, even one that breaks the secret name rule (`OLD-NAME=x`), and
186
+ says how many it removed. It used to say the key was not set and leave the line.
187
+ * **dev:** on Linux the app URL (`http://localhost:18473/`) answered 502 for a Vite app. `supatype
188
+ dev` started Vite on `127.0.0.1`, and Docker Engine on Linux reaches the host through the docker0
189
+ bridge, not the loopback, so the gateway found nothing listening. On Linux Vite now listens on
190
+ every interface (`--host 0.0.0.0`), so other machines on the network can reach the dev server, as
191
+ they already reach Studio's. Docker Desktop on macOS and Windows forwards to the loopback, so
192
+ nothing changes there.
193
+ * **dev, init:** `supatype dev` sets `SUPATYPE_DEV_APP_HOST` on the app it starts, to the address
194
+ the app should listen on: `0.0.0.0` on Linux, `127.0.0.1` elsewhere. The `vite.config.ts` init
195
+ writes reads it, so a start script dev cannot add `--host` to (one that needs a shell, such as
196
+ `vite && ...`) reaches the gateway too. On Linux, when dev cannot set the address itself, the app
197
+ pane says to point the dev server's host at `SUPATYPE_DEV_APP_HOST`.
198
+
3
199
  ## 0.9.2 (2026-11-12)
4
200
 
5
201
  ### Breaking Changes
@@ -1,3 +1,4 @@
1
+ import type { CacheReport } from "./engine-push-output.js";
1
2
  export interface CacheSeedResult {
2
3
  /** Tables switched on by this push because the schema had just started declaring them. */
3
4
  seeded: string[];
@@ -9,9 +10,10 @@ export interface CacheSeedResult {
9
10
  /**
10
11
  * Bring the local allowlist in line with new declarations, and report what is still in the way.
11
12
  *
12
- * Returns null when there is no file to seed: a cloud-only project, or a stack that has never
13
- * been started. A missing file is not an error here: the file is the local server's, and `dev`
14
- * creates it.
13
+ * A missing file is created from the server's default shape, because nothing else ever creates it
14
+ * for a user project: the server answers defaults without one and writes it only when something
15
+ * PATCHes. Returns null only for a file this cannot safely edit (malformed, or no `rest` section),
16
+ * and when nothing is declared and there is no file, so a project without a cache gets no new file.
15
17
  */
16
18
  export declare function seedApiConfigCache(cwd: string, ast: unknown): CacheSeedResult | null;
17
19
  /**
@@ -22,6 +24,13 @@ export declare function seedApiConfigCache(cwd: string, ast: unknown): CacheSeed
22
24
  * refused it where the read rule varies by caller. Defaulting it off would make the declaration
23
25
  * mean nothing until someone ticked a box that the schema had already justified.
24
26
  */
27
+ /**
28
+ * What a push says when the schema declares a cache and the server it just pushed to has no
29
+ * keyspace to serve it from: a declaration that looks accepted and answers BYPASS on every read.
30
+ * The server is asked (`/admin/v1/cache`), so this holds for Valkey and pg_keyspace alike. Nothing
31
+ * is said when no table declares a cache, or when the server cannot say.
32
+ */
33
+ export declare function cacheKeyspaceNotes(cwd: string, ast: unknown, connected?: (cwd: string) => Promise<boolean | null>): Promise<string[]>;
25
34
  /**
26
35
  * What a push or a dev boot should say about cache seeding, as lines to print.
27
36
  *
@@ -33,7 +42,7 @@ export declare function seedApiConfigCache(cwd: string, ast: unknown): CacheSeed
33
42
  *
34
43
  * Never an error, and never a rewrite of an entry that already exists. See `seedApiConfigCache`.
35
44
  */
36
- export declare function cacheSeedingNotes(cwd: string, ast: unknown): string[];
45
+ export declare function cacheSeedingNotes(cwd: string, ast: unknown): Promise<string[]>;
37
46
  /**
38
47
  * §13.4's note, in the words of the project that will read it, or null when there is nothing to
39
48
  * say.
@@ -47,8 +56,13 @@ export declare function cacheSeedingNotes(cwd: string, ast: unknown): string[];
47
56
  * a correct declaration, not a mistake (the tier decides what runs, not what a schema may say),
48
57
  * and a push that failed over it would be punishing someone for writing down their intent.
49
58
  */
50
- export declare function freeTierCacheNote(report: {
51
- tables?: string[];
52
- honoured?: boolean;
53
- } | undefined): string | null;
59
+ export declare function freeTierCacheNote(report: CacheReport | undefined): string | null;
60
+ /**
61
+ * The lines a Cloud push prints about the cache: the tables the server confirmed as switched on,
62
+ * in the words a self-host push uses, then the free-tier note when the tier does not honour it.
63
+ * A control plane that predates `enabled` sends none, so it prints the free-tier note alone. While the
64
+ * project-wide TTL it reports (`cacheMaxTtl`) is 0 it says nothing is cached, as a self-host push does,
65
+ * and never sets it.
66
+ */
67
+ export declare function cloudCacheNotes(report: CacheReport | undefined): string[];
54
68
  //# sourceMappingURL=api-config-cache.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-config-cache.d.ts","sourceRoot":"","sources":["../src/api-config-cache.ts"],"names":[],"mappings":"AAkCA,MAAM,WAAW,eAAe;IAC9B,0FAA0F;IAC1F,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,y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;;GAUG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAiBpF;AA2BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAWhF;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,EAAE,CAQzE"}
@@ -25,22 +25,37 @@ import { dirname, join } from "node:path";
25
25
  import { manifestCache } from "./model-cache.js";
26
26
  import { readJsonObjectFile } from "./json-file.js";
27
27
  import { isJsonObject } from "@supatype/shared";
28
+ import { seedThroughStack, tableEntryFor } from "./api-config-stack.js";
29
+ import { keyspaceConnected } from "./rest-cache-admin.js";
30
+ /** The server's own default configuration (apiconfig.DefaultApiConfig), for a stack that has never written one. */
31
+ function defaultApiConfig() {
32
+ return {
33
+ rest: { schema: "public", max_rows: 1000, cache_max_ttl: 0, cache_tables: {} },
34
+ graphql: { introspection: true, max_query_depth: 10, max_rows: 1000 },
35
+ };
36
+ }
37
+ /** The tables the schema declares a cache for, unless it declares it off, sorted. */
38
+ function declaredCacheTables(ast) {
39
+ const declared = manifestCache(ast);
40
+ return Object.keys(declared).filter((t) => declared[t]?.enabled !== false).sort();
41
+ }
28
42
  /**
29
43
  * Bring the local allowlist in line with new declarations, and report what is still in the way.
30
44
  *
31
- * Returns null when there is no file to seed: a cloud-only project, or a stack that has never
32
- * been started. A missing file is not an error here: the file is the local server's, and `dev`
33
- * creates it.
45
+ * A missing file is created from the server's default shape, because nothing else ever creates it
46
+ * for a user project: the server answers defaults without one and writes it only when something
47
+ * PATCHes. Returns null only for a file this cannot safely edit (malformed, or no `rest` section),
48
+ * and when nothing is declared and there is no file, so a project without a cache gets no new file.
34
49
  */
35
50
  export function seedApiConfigCache(cwd, ast) {
36
51
  const declared = manifestCache(ast);
37
- const declaredTables = Object.keys(declared).filter((t) => declared[t]?.enabled !== false).sort();
52
+ const declaredTables = declaredCacheTables(ast);
38
53
  const path = join(cwd, ".supatype", "api-config.json");
39
- if (!existsSync(path))
54
+ if (!existsSync(path) && declaredTables.length === 0)
40
55
  return null;
41
56
  // Malformed: the server reports this far more clearly than a push can, and rewriting it here
42
57
  // would destroy whatever the author was in the middle of.
43
- const parsed = readJsonObjectFile(path);
58
+ const parsed = existsSync(path) ? readJsonObjectFile(path) : defaultApiConfig();
44
59
  if (parsed === undefined)
45
60
  return null;
46
61
  const rest = asRecord(parsed["rest"]);
@@ -51,10 +66,10 @@ export function seedApiConfigCache(cwd, ast) {
51
66
  for (const table of declaredTables) {
52
67
  if (table in tables)
53
68
  continue;
54
- tables[table] = seedEntry(declared[table]);
69
+ tables[table] = tableEntryFor(declared[table]);
55
70
  seeded.push(table);
56
71
  }
57
- if (seeded.length > 0) {
72
+ if (seeded.length > 0 || !existsSync(path)) {
58
73
  rest["cache_tables"] = tables;
59
74
  parsed["rest"] = rest;
60
75
  mkdirSync(dirname(path), { recursive: true });
@@ -78,6 +93,21 @@ export function seedApiConfigCache(cwd, ast) {
78
93
  * refused it where the read rule varies by caller. Defaulting it off would make the declaration
79
94
  * mean nothing until someone ticked a box that the schema had already justified.
80
95
  */
96
+ /**
97
+ * What a push says when the schema declares a cache and the server it just pushed to has no
98
+ * keyspace to serve it from: a declaration that looks accepted and answers BYPASS on every read.
99
+ * The server is asked (`/admin/v1/cache`), so this holds for Valkey and pg_keyspace alike. Nothing
100
+ * is said when no table declares a cache, or when the server cannot say.
101
+ */
102
+ export async function cacheKeyspaceNotes(cwd, ast, connected = keyspaceConnected) {
103
+ const declared = declaredCacheTables(ast);
104
+ if (declared.length === 0 || (await connected(cwd)) !== false)
105
+ return [];
106
+ return [
107
+ `No keyspace is connected to the server, so the cache declared for ${declared.join(", ")} is never served: ` +
108
+ "every read bypasses it. `supatype dev` starts one; on a self-hosted stack, check the `db` or `valkey` service.",
109
+ ];
110
+ }
81
111
  /**
82
112
  * What a push or a dev boot should say about cache seeding, as lines to print.
83
113
  *
@@ -89,25 +119,42 @@ export function seedApiConfigCache(cwd, ast) {
89
119
  *
90
120
  * Never an error, and never a rewrite of an entry that already exists. See `seedApiConfigCache`.
91
121
  */
92
- export function cacheSeedingNotes(cwd, ast) {
93
- const result = seedApiConfigCache(cwd, ast);
94
- if (result === null)
122
+ export async function cacheSeedingNotes(cwd, ast) {
123
+ const declared = manifestCache(ast);
124
+ const tables = Object.keys(declared).filter((t) => declared[t]?.enabled !== false).sort();
125
+ if (tables.length === 0)
126
+ return [];
127
+ // Through the running stack first, because that is the writer every mode shares. The file is
128
+ // for a stack that is not answering yet.
129
+ const stack = await seedThroughStack(cwd, declared, tables);
130
+ if (stack.kind === "unavailable")
95
131
  return [];
132
+ if (stack.kind === "seeded") {
133
+ return seedNotes(stack.seeded, tables.length, stack.cacheMaxTtl <= 0, "through the running stack");
134
+ }
135
+ const result = seedApiConfigCache(cwd, ast);
136
+ if (result === null) {
137
+ return [`Could not enable the server cache for ${tables.join(", ")}: .supatype/api-config.json could not be updated and the stack did not answer (${stack.reason}).`];
138
+ }
139
+ return seedNotes(result.seeded, tables.length, result.ttlIsOff, "in .supatype/api-config.json");
140
+ }
141
+ /** Where a TTL of 0 is set: a Cloud project has no api-config.json to edit. */
142
+ const CLOUD_TTL_PLACE = "under API > REST > Settings in Studio.";
143
+ const SELF_HOST_TTL_PLACE = "under API > REST > Settings or in .supatype/api-config.json.";
144
+ /** The lines for one seeding: what was switched on, and always the TTL note while the TTL is 0. */
145
+ function seedNotes(seeded, declaredCount, ttlIsOff, where, ttlPlace = SELF_HOST_TTL_PLACE) {
96
146
  const notes = [];
97
- if (result.seeded.length > 0) {
98
- notes.push(`Server cache enabled for ${result.seeded.join(", ")} in .supatype/api-config.json`);
147
+ if (seeded.length > 0) {
148
+ notes.push(`Server cache enabled for ${seeded.join(", ")} ${where}`);
99
149
  }
100
- if (result.ttlIsOff) {
150
+ if (ttlIsOff) {
101
151
  // A note rather than a fix. Zero is an off switch someone may have chosen, and a push that
102
152
  // turned caching on project-wide would be overriding a decision rather than filling in a blank.
103
- notes.push(`${result.declared.length} table(s) declare a cache, but cache_max_ttl is 0, so nothing ` +
104
- `is cached until it is set, under API > REST > Settings or in .supatype/api-config.json.`);
153
+ notes.push(`${declaredCount} table(s) declare a cache, but cache_max_ttl is 0, so nothing ` +
154
+ `is cached until it is set, ${ttlPlace}`);
105
155
  }
106
156
  return notes;
107
157
  }
108
- function seedEntry(entry) {
109
- return { enabled: true, allow_public: entry.public === true };
110
- }
111
158
  function asRecord(value) {
112
159
  return isJsonObject(value) ? value : null;
113
160
  }
@@ -135,6 +182,22 @@ export function freeTierCacheNote(report) {
135
182
  return (`${listed(tables)} declare a cache in your schema. On the free tier these are served from ` +
136
183
  `PostgREST on every request; the declaration is stored and takes effect on a paid plan.`);
137
184
  }
185
+ /**
186
+ * The lines a Cloud push prints about the cache: the tables the server confirmed as switched on,
187
+ * in the words a self-host push uses, then the free-tier note when the tier does not honour it.
188
+ * A control plane that predates `enabled` sends none, so it prints the free-tier note alone. While the
189
+ * project-wide TTL it reports (`cacheMaxTtl`) is 0 it says nothing is cached, as a self-host push does,
190
+ * and never sets it.
191
+ */
192
+ export function cloudCacheNotes(report) {
193
+ const enabled = (report?.enabled ?? []).filter((t) => t.length > 0);
194
+ const declared = report?.tables?.length ?? 0;
195
+ // Absent is a control plane that does not say, and silence is the honest answer to that.
196
+ const ttlIsOff = declared > 0 && report?.cacheMaxTtl !== undefined && report.cacheMaxTtl <= 0;
197
+ const notes = seedNotes(enabled, declared, ttlIsOff, "on Supatype Cloud", CLOUD_TTL_PLACE);
198
+ const freeTier = freeTierCacheNote(report);
199
+ return freeTier === null ? notes : [...notes, freeTier];
200
+ }
138
201
  /** "posts", "posts and profiles", "posts, profiles and tags". */
139
202
  function listed(tables) {
140
203
  if (tables.length === 1)
@@ -1 +1 @@
1
- {"version":3,"file":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AE,MAAM,EAAE,MAAM,IAAI,CAAC,CAAA;IAC5C,yFAAyF;IACzF,MAAM,QAAQ,GAAG,QAAQ,GAAG,CAAC,IAAI,MAAM,EAAE,WAAW,KAAK,SAAS,IAAI,MAAM,CAAC,WAAW,IAAI,CAAC,CAAA;IAC7F,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,mBAAmB,EAAE,eAAe,CAAC,CAAA;IAC1F,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAA;IAC1C,OAAO,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,QAAQ,CAAC,CAAA;AACzD,CAAC;AAED,iEAAiE;AACjE,SAAS,MAAM,CAAC,MAAgB;IAC9B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,CAAC,CAAE,CAAA;IAC1C,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAE,EAAE,CAAA;AAC9E,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { ManifestCacheEntry } from "./model-cache.js";
2
+ export interface TableCacheEntry {
3
+ enabled: boolean;
4
+ allow_public: boolean;
5
+ }
6
+ export type StackSeed = {
7
+ kind: "seeded";
8
+ seeded: string[];
9
+ cacheMaxTtl: number;
10
+ }
11
+ /** The server refuses the cache here (a free Cloud plan), so nothing is wrong and nothing to seed. */
12
+ | {
13
+ kind: "unavailable";
14
+ }
15
+ /** Not answering, or answering something this cannot use. The caller falls back to the file. */
16
+ | {
17
+ kind: "unreachable";
18
+ reason: string;
19
+ };
20
+ /** What a newly declared table is switched on as. `allow_public` follows the declaration. */
21
+ export declare function tableEntryFor(entry: ManifestCacheEntry): TableCacheEntry;
22
+ export declare function seedThroughStack(cwd: string, declared: Record<string, ManifestCacheEntry>, tables: string[]): Promise<StackSeed>;
23
+ //# sourceMappingURL=api-config-stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-config-stack.d.ts","sourceRoot":"","sources":["../src/api-config-stack.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAI1D,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;CACtB;AAUD,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE;AAC3D,sGAAsG;GACpG;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE;AACzB,gGAAgG;GAC9F;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3C,6FAA6F;AAC7F,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,eAAe,CAExE;AAED,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAC5C,MAAM,EAAE,MAAM,EAAE,GACf,OAAO,CAAC,SAAS,CAAC,CAyBpB"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Switch on newly declared cache tables through the running stack's admin API.
3
+ *
4
+ * `PATCH /admin/v1/config/rest` is the one writer every stack agrees on, so it works whatever the
5
+ * server stores its configuration in, and it creates what is missing. The file seeding in
6
+ * api-config-cache.ts is the fallback for a stack that is not answering.
7
+ *
8
+ * The PATCH replaces `cache_tables` as a whole, so the current map is read first and only
9
+ * missing tables are added. An entry that already exists is never rewritten: see
10
+ * api-config-cache.ts for why.
11
+ */
12
+ import { isBoolean, isNumber, isRecordOf, isShape, nullable, optional, readJson } from "@supatype/shared";
13
+ import { adminHeaders } from "./rest-cache-admin.js";
14
+ import { resolveProjectApiUrl } from "./resolve-api-url.js";
15
+ const REQUEST_TIMEOUT_MS = 5_000;
16
+ const isTableEntry = isShape({ enabled: isBoolean, allow_public: isBoolean });
17
+ /** The parts of `GET` and `PATCH /admin/v1/config/rest` this reads. */
18
+ const isRestConfig = isShape({
19
+ cache_max_ttl: optional(isNumber),
20
+ cache_tables: optional(nullable(isRecordOf(isTableEntry))),
21
+ });
22
+ /** What a newly declared table is switched on as. `allow_public` follows the declaration. */
23
+ export function tableEntryFor(entry) {
24
+ return { enabled: true, allow_public: entry.public === true };
25
+ }
26
+ export async function seedThroughStack(cwd, declared, tables) {
27
+ try {
28
+ const url = `${resolveProjectApiUrl(cwd)}/admin/v1/config/rest`;
29
+ const headers = adminHeaders(cwd);
30
+ const current = await readJson(await fetchOk(url, { headers }), isRestConfig);
31
+ const existing = current.cache_tables ?? {};
32
+ const missing = tables.filter((t) => !(t in existing));
33
+ if (missing.length === 0)
34
+ return { kind: "seeded", seeded: [], cacheMaxTtl: current.cache_max_ttl ?? 0 };
35
+ const cacheTables = { ...existing };
36
+ for (const t of missing)
37
+ cacheTables[t] = tableEntryFor(declared[t]);
38
+ const res = await fetch(url, {
39
+ method: "PATCH",
40
+ headers,
41
+ body: JSON.stringify({ cache_tables: cacheTables }),
42
+ signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
43
+ });
44
+ if (res.status === 403)
45
+ return { kind: "unavailable" };
46
+ const after = await readJson(await ensureOk(res), isRestConfig);
47
+ // The schema's ceiling can refuse a table the CLI asked for, so report what is actually on.
48
+ const on = missing.filter((t) => after.cache_tables?.[t]?.enabled === true);
49
+ return { kind: "seeded", seeded: on, cacheMaxTtl: after.cache_max_ttl ?? 0 };
50
+ }
51
+ catch (err) {
52
+ return { kind: "unreachable", reason: err instanceof Error ? err.message : String(err) };
53
+ }
54
+ }
55
+ async function fetchOk(url, init) {
56
+ return ensureOk(await fetch(url, { ...init, signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS) }));
57
+ }
58
+ async function ensureOk(res) {
59
+ if (!res.ok)
60
+ throw new Error(`HTTP ${res.status} from ${res.url}`);
61
+ return res;
62
+ }
63
+ //# sourceMappingURL=api-config-stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-config-stack.js","sourceRoot":"","sources":["../src/api-config-stack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACzG,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAG3D,MAAM,kBAAkB,GAAG,KAAK,CAAA;AAOhC,MAAM,YAAY,GAAG,OAAO,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAAA;AAE7E,uEAAuE;AACvE,MAAM,YAAY,GAAG,OAAO,CAAC;IAC3B,aAAa,EAAE,QAAQ,CAAC,QAAQ,CAAC;IACjC,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;CAC3D,CAAC,CAAA;AASF,6FAA6F;AAC7F,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,MAAM,KAAK,IAAI,EAAE,CAAA;AAC/D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,GAAW,EACX,QAA4C,EAC5C,MAAgB;IAEhB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,GAAG,oBAAoB,CAAC,GAAG,CAAC,uBAAuB,CAAA;QAC/D,MAAM,OAAO,GAAG,YA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AC,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC,CAAA;QAC3E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,aAAa,IAAI,CAAC,EAAE,CAAA;IAC9E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAA;IAC1F,CAAC;AACH,CAAC;AAED,KAAK,UAAU,OAAO,CAAC,GAAW,EAAE,IAAyC;IAC3E,OAAO,QAAQ,CAAC,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAA;AACjG,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,GAAa;IACnC,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,GAAG,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,CAAC,CAAA;IAClE,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,12 @@
1
+ /** The Supatype Cloud control plane, where a command goes when nothing names another. */
2
+ export declare const DEFAULT_API_URL = "https://api.supatype.com";
3
+ /** `url` without the slashes that end it, so a path can be appended with one of its own. */
4
+ export declare function trimApiUrl(url: string): string;
5
+ /**
6
+ * The Cloud control plane a command asks: the first of `candidates`, in the order given, that
7
+ * names one, else {@link DEFAULT_API_URL}. A blank value names none. Each command lists its own
8
+ * sources (a flag, `SUPATYPE_API_URL`, what `login` stored), so they differ in what they read but
9
+ * not in how a missing or blank one is skipped and the slashes trimmed.
10
+ */
11
+ export declare function pickApiUrl(...candidates: ReadonlyArray<string | undefined>): string;
12
+ //# sourceMappingURL=api-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-url.d.ts","sourceRoot":"","sources":["../src/api-url.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,eAAO,MAAM,eAAe,6BAA6B,CAAA;AAEzD,4FAA4F;AAC5F,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,UAAU,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,CAGnF"}
@@ -0,0 +1,17 @@
1
+ /** The Supatype Cloud control plane, where a command goes when nothing names another. */
2
+ export const DEFAULT_API_URL = "https://api.supatype.com";
3
+ /** `url` without the slashes that end it, so a path can be appended with one of its own. */
4
+ export function trimApiUrl(url) {
5
+ return url.replace(/\/+$/, "");
6
+ }
7
+ /**
8
+ * The Cloud control plane a command asks: the first of `candidates`, in the order given, that
9
+ * names one, else {@link DEFAULT_API_URL}. A blank value names none. Each command lists its own
10
+ * sources (a flag, `SUPATYPE_API_URL`, what `login` stored), so they differ in what they read but
11
+ * not in how a missing or blank one is skipped and the slashes trimmed.
12
+ */
13
+ export function pickApiUrl(...candidates) {
14
+ const named = candidates.map((candidate) => candidate?.trim() ?? "").find((candidate) => candidate !== "");
15
+ return trimApiUrl(named ?? DEFAULT_API_URL);
16
+ }
17
+ //# sourceMappingURL=api-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-url.js","sourceRoot":"","sources":["../src/api-url.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,MAAM,CAAC,MAAM,eAAe,GAAG,0BAA0B,CAAA;AAEzD,4FAA4F;AAC5F,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AAChC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,GAAG,UAA6C;IACzE,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,EAAE,CAAC,CAAA;IAC1G,OAAO,UAAU,CAAC,KAAK,IAAI,eAAe,CAAC,CAAA;AAC7C,CAAC"}
@@ -28,6 +28,21 @@ export declare function detectMonorepo(cwd: string): {
28
28
  * Detect package manager from lockfiles.
29
29
  */
30
30
  export declare function detectPackageManager(dir: string): "npm" | "pnpm" | "yarn";
31
+ /**
32
+ * Whether a missing page serves index.html: `build.spa` when the config sets it, else the detected
33
+ * (or named) framework's default, else on. The one answer `supatype deploy` sends to Cloud and a
34
+ * self-host compose gives the gateway, so both hosts agree for every framework.
35
+ */
36
+ export declare function resolveSpaFallback(build: {
37
+ framework?: AppFramework;
38
+ directory?: string;
39
+ spa?: boolean;
40
+ } | undefined, cwd: string): boolean;
41
+ /**
42
+ * The refusal for a deploy whose fallback is on but whose build has no root index.html: Cloud would
43
+ * reject the upload, and a self-host site would answer a missing page with nothing. Null when fine.
44
+ */
45
+ export declare function spaIndexError(outputDir: string, spa: boolean): string | null;
31
46
  /**
32
47
  * Resolve the full app configuration from user config + auto-detection.
33
48
  */
@@ -38,7 +53,8 @@ export declare function resolveAppConfig(appConfig: AppConfig | undefined, cwd:
38
53
  */
39
54
  export declare function validateStaticMode(framework: AppFramework, appDir: string): string | null;
40
55
  /**
41
- * Validate the build output.
56
+ * Validate the build output. `maxSizeMb` is a limit this machine knows of; with none given the size is
57
+ * not checked, as when a server applies its own tier limit.
42
58
  */
43
- export declare function validateBuildOutput(outputDir: string, maxSizeMb: number): string | null;
59
+ export declare function validateBuildOutput(outputDir: string, maxSizeMb?: number): string | null;
44
60
  //# sourceMappingURL=framework.d.ts.map