@supatype/cli 0.1.0-alpha.6 → 0.1.0-alpha.7

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 (309) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-test.log +203 -1
  3. package/.turbo/turbo-typecheck.log +1 -1
  4. package/dist/app-config.d.ts +7 -0
  5. package/dist/app-config.d.ts.map +1 -0
  6. package/dist/app-config.js +113 -0
  7. package/dist/app-config.js.map +1 -0
  8. package/dist/augmentation-generator.d.ts +2 -0
  9. package/dist/augmentation-generator.d.ts.map +1 -0
  10. package/dist/augmentation-generator.js +111 -0
  11. package/dist/augmentation-generator.js.map +1 -0
  12. package/dist/binary-cache.d.ts +89 -0
  13. package/dist/binary-cache.d.ts.map +1 -0
  14. package/dist/binary-cache.js +656 -0
  15. package/dist/binary-cache.js.map +1 -0
  16. package/dist/cli.d.ts.map +1 -1
  17. package/dist/cli.js +13 -7
  18. package/dist/cli.js.map +1 -1
  19. package/dist/commands/admin.d.ts.map +1 -1
  20. package/dist/commands/admin.js +4 -3
  21. package/dist/commands/admin.js.map +1 -1
  22. package/dist/commands/app.d.ts.map +1 -1
  23. package/dist/commands/app.js +56 -209
  24. package/dist/commands/app.js.map +1 -1
  25. package/dist/commands/cache.d.ts +6 -0
  26. package/dist/commands/cache.d.ts.map +1 -0
  27. package/dist/commands/cache.js +105 -0
  28. package/dist/commands/cache.js.map +1 -0
  29. package/dist/commands/cloud.d.ts +12 -0
  30. package/dist/commands/cloud.d.ts.map +1 -1
  31. package/dist/commands/cloud.js +36 -46
  32. package/dist/commands/cloud.js.map +1 -1
  33. package/dist/commands/db.d.ts.map +1 -1
  34. package/dist/commands/db.js +47 -54
  35. package/dist/commands/db.js.map +1 -1
  36. package/dist/commands/deploy.d.ts +2 -1
  37. package/dist/commands/deploy.d.ts.map +1 -1
  38. package/dist/commands/deploy.js +92 -51
  39. package/dist/commands/deploy.js.map +1 -1
  40. package/dist/commands/dev.d.ts +11 -0
  41. package/dist/commands/dev.d.ts.map +1 -1
  42. package/dist/commands/dev.js +751 -384
  43. package/dist/commands/dev.js.map +1 -1
  44. package/dist/commands/diff.d.ts.map +1 -1
  45. package/dist/commands/diff.js +20 -15
  46. package/dist/commands/diff.js.map +1 -1
  47. package/dist/commands/engine.d.ts +1 -3
  48. package/dist/commands/engine.d.ts.map +1 -1
  49. package/dist/commands/engine.js +13 -85
  50. package/dist/commands/engine.js.map +1 -1
  51. package/dist/commands/functions.d.ts.map +1 -1
  52. package/dist/commands/functions.js +92 -105
  53. package/dist/commands/functions.js.map +1 -1
  54. package/dist/commands/generate.d.ts.map +1 -1
  55. package/dist/commands/generate.js +22 -12
  56. package/dist/commands/generate.js.map +1 -1
  57. package/dist/commands/init.d.ts +1 -1
  58. package/dist/commands/init.d.ts.map +1 -1
  59. package/dist/commands/init.js +124 -410
  60. package/dist/commands/init.js.map +1 -1
  61. package/dist/commands/migrate-from-v1.d.ts +5 -0
  62. package/dist/commands/migrate-from-v1.d.ts.map +1 -0
  63. package/dist/commands/migrate-from-v1.js +125 -0
  64. package/dist/commands/migrate-from-v1.js.map +1 -0
  65. package/dist/commands/migrate.d.ts.map +1 -1
  66. package/dist/commands/migrate.js +27 -23
  67. package/dist/commands/migrate.js.map +1 -1
  68. package/dist/commands/pg.d.ts +8 -0
  69. package/dist/commands/pg.d.ts.map +1 -0
  70. package/dist/commands/pg.js +102 -0
  71. package/dist/commands/pg.js.map +1 -0
  72. package/dist/commands/pull.d.ts.map +1 -1
  73. package/dist/commands/pull.js +5 -66
  74. package/dist/commands/pull.js.map +1 -1
  75. package/dist/commands/push.d.ts.map +1 -1
  76. package/dist/commands/push.js +99 -39
  77. package/dist/commands/push.js.map +1 -1
  78. package/dist/commands/seed.d.ts +2 -0
  79. package/dist/commands/seed.d.ts.map +1 -1
  80. package/dist/commands/seed.js +44 -11
  81. package/dist/commands/seed.js.map +1 -1
  82. package/dist/commands/self-host.d.ts +7 -1
  83. package/dist/commands/self-host.d.ts.map +1 -1
  84. package/dist/commands/self-host.js +272 -758
  85. package/dist/commands/self-host.js.map +1 -1
  86. package/dist/commands/self-update.d.ts +9 -0
  87. package/dist/commands/self-update.d.ts.map +1 -0
  88. package/dist/commands/self-update.js +33 -0
  89. package/dist/commands/self-update.js.map +1 -0
  90. package/dist/commands/status.d.ts.map +1 -1
  91. package/dist/commands/status.js +4 -3
  92. package/dist/commands/status.js.map +1 -1
  93. package/dist/commands/types.d.ts +3 -0
  94. package/dist/commands/types.d.ts.map +1 -0
  95. package/dist/commands/types.js +62 -0
  96. package/dist/commands/types.js.map +1 -0
  97. package/dist/commands/update.d.ts +7 -0
  98. package/dist/commands/update.d.ts.map +1 -0
  99. package/dist/commands/update.js +77 -0
  100. package/dist/commands/update.js.map +1 -0
  101. package/dist/components.d.ts +5 -0
  102. package/dist/components.d.ts.map +1 -0
  103. package/dist/components.js +3 -0
  104. package/dist/components.js.map +1 -0
  105. package/dist/config.d.ts +10 -51
  106. package/dist/config.d.ts.map +1 -1
  107. package/dist/config.js +101 -33
  108. package/dist/config.js.map +1 -1
  109. package/dist/docker-postgres.d.ts +39 -0
  110. package/dist/docker-postgres.d.ts.map +1 -0
  111. package/dist/docker-postgres.js +96 -0
  112. package/dist/docker-postgres.js.map +1 -0
  113. package/dist/engine-client.d.ts +67 -0
  114. package/dist/engine-client.d.ts.map +1 -0
  115. package/dist/engine-client.js +156 -0
  116. package/dist/engine-client.js.map +1 -0
  117. package/dist/ensure-binary.d.ts +7 -0
  118. package/dist/ensure-binary.d.ts.map +1 -0
  119. package/dist/ensure-binary.js +17 -0
  120. package/dist/ensure-binary.js.map +1 -0
  121. package/dist/functions-router-gen.d.ts +14 -0
  122. package/dist/functions-router-gen.d.ts.map +1 -0
  123. package/dist/functions-router-gen.js +199 -0
  124. package/dist/functions-router-gen.js.map +1 -0
  125. package/dist/index.d.ts +4 -5
  126. package/dist/index.d.ts.map +1 -1
  127. package/dist/index.js +2 -3
  128. package/dist/index.js.map +1 -1
  129. package/dist/kong-config.d.ts +21 -0
  130. package/dist/kong-config.d.ts.map +1 -0
  131. package/dist/kong-config.js +60 -0
  132. package/dist/kong-config.js.map +1 -0
  133. package/dist/local-gateway.d.ts +7 -0
  134. package/dist/local-gateway.d.ts.map +1 -0
  135. package/dist/local-gateway.js +9 -0
  136. package/dist/local-gateway.js.map +1 -0
  137. package/dist/local-storage.d.ts +8 -0
  138. package/dist/local-storage.d.ts.map +1 -0
  139. package/dist/local-storage.js +14 -0
  140. package/dist/local-storage.js.map +1 -0
  141. package/dist/pgbouncer-userlist.d.ts +5 -0
  142. package/dist/pgbouncer-userlist.d.ts.map +1 -0
  143. package/dist/pgbouncer-userlist.js +14 -0
  144. package/dist/pgbouncer-userlist.js.map +1 -0
  145. package/dist/postgres-ctl.d.ts +44 -0
  146. package/dist/postgres-ctl.d.ts.map +1 -0
  147. package/dist/postgres-ctl.js +137 -0
  148. package/dist/postgres-ctl.js.map +1 -0
  149. package/dist/process-manager.d.ts +41 -0
  150. package/dist/process-manager.d.ts.map +1 -0
  151. package/dist/process-manager.js +120 -0
  152. package/dist/process-manager.js.map +1 -0
  153. package/dist/project-config.d.ts +215 -0
  154. package/dist/project-config.d.ts.map +1 -0
  155. package/dist/project-config.js +145 -0
  156. package/dist/project-config.js.map +1 -0
  157. package/dist/pull-utils.d.ts +15 -0
  158. package/dist/pull-utils.d.ts.map +1 -1
  159. package/dist/pull-utils.js +12 -0
  160. package/dist/pull-utils.js.map +1 -1
  161. package/dist/release-pins.d.ts +7 -0
  162. package/dist/release-pins.d.ts.map +1 -0
  163. package/dist/release-pins.js +27 -0
  164. package/dist/release-pins.js.map +1 -0
  165. package/dist/release-public-key.d.ts +8 -0
  166. package/dist/release-public-key.d.ts.map +1 -0
  167. package/dist/release-public-key.js +13 -0
  168. package/dist/release-public-key.js.map +1 -0
  169. package/dist/runtime-routes.d.ts +25 -0
  170. package/dist/runtime-routes.d.ts.map +1 -0
  171. package/dist/runtime-routes.js +189 -0
  172. package/dist/runtime-routes.js.map +1 -0
  173. package/dist/scripts/postinstall.d.ts +5 -6
  174. package/dist/scripts/postinstall.d.ts.map +1 -1
  175. package/dist/scripts/postinstall.js +36 -20
  176. package/dist/scripts/postinstall.js.map +1 -1
  177. package/dist/self-host-compose.d.ts +14 -0
  178. package/dist/self-host-compose.d.ts.map +1 -0
  179. package/dist/self-host-compose.js +236 -0
  180. package/dist/self-host-compose.js.map +1 -0
  181. package/dist/storage-provision.d.ts +24 -0
  182. package/dist/storage-provision.d.ts.map +1 -0
  183. package/dist/storage-provision.js +44 -0
  184. package/dist/storage-provision.js.map +1 -0
  185. package/dist/systemd.d.ts +26 -0
  186. package/dist/systemd.d.ts.map +1 -0
  187. package/dist/systemd.js +102 -0
  188. package/dist/systemd.js.map +1 -0
  189. package/dist/tsx-runner.d.ts.map +1 -1
  190. package/dist/tsx-runner.js +9 -2
  191. package/dist/tsx-runner.js.map +1 -1
  192. package/dist/type-extractor.d.ts +31 -0
  193. package/dist/type-extractor.d.ts.map +1 -0
  194. package/dist/type-extractor.js +876 -0
  195. package/dist/type-extractor.js.map +1 -0
  196. package/package.json +4 -3
  197. package/releases/deno/VERSION +1 -0
  198. package/scripts/mirror-deno-release.sh +76 -0
  199. package/src/app-config.ts +128 -0
  200. package/src/augmentation-generator.ts +126 -0
  201. package/src/binary-cache.ts +802 -0
  202. package/src/cli.ts +13 -8
  203. package/src/commands/admin.ts +4 -3
  204. package/src/commands/app.ts +67 -231
  205. package/src/commands/cache.ts +117 -0
  206. package/src/commands/cloud.ts +46 -57
  207. package/src/commands/db.ts +54 -63
  208. package/src/commands/deploy.ts +110 -61
  209. package/src/commands/dev.ts +930 -405
  210. package/src/commands/diff.ts +21 -29
  211. package/src/commands/engine.ts +13 -116
  212. package/src/commands/functions.ts +97 -115
  213. package/src/commands/generate.ts +23 -10
  214. package/src/commands/init.ts +136 -414
  215. package/src/commands/migrate-from-v1.ts +131 -0
  216. package/src/commands/migrate.ts +27 -23
  217. package/src/commands/pg.ts +133 -0
  218. package/src/commands/pull.ts +6 -85
  219. package/src/commands/push.ts +128 -59
  220. package/src/commands/seed.ts +54 -12
  221. package/src/commands/self-host.ts +312 -880
  222. package/src/commands/self-update.ts +45 -0
  223. package/src/commands/status.ts +4 -3
  224. package/src/commands/types.ts +76 -0
  225. package/src/commands/update.ts +92 -0
  226. package/src/components.ts +6 -0
  227. package/src/config.ts +127 -94
  228. package/src/docker-postgres.ts +138 -0
  229. package/src/engine-client.ts +231 -0
  230. package/src/ensure-binary.ts +28 -0
  231. package/src/functions-router-gen.ts +224 -0
  232. package/src/index.ts +4 -12
  233. package/src/kong-config.ts +78 -0
  234. package/src/local-gateway.ts +9 -0
  235. package/src/local-storage.ts +14 -0
  236. package/src/pgbouncer-userlist.ts +15 -0
  237. package/src/postgres-ctl.ts +171 -0
  238. package/src/process-manager.ts +151 -0
  239. package/src/project-config.ts +353 -0
  240. package/src/pull-utils.ts +24 -0
  241. package/src/release-pins.ts +31 -0
  242. package/src/release-public-key.ts +12 -0
  243. package/src/runtime-routes.ts +216 -0
  244. package/src/scripts/postinstall.ts +36 -25
  245. package/src/self-host-compose.ts +257 -0
  246. package/src/storage-provision.ts +58 -0
  247. package/src/systemd.ts +137 -0
  248. package/src/tsx-runner.ts +11 -1
  249. package/src/type-extractor.ts +1016 -0
  250. package/tests/app-command.test.ts +54 -0
  251. package/tests/augmentation-generator.test.ts +59 -0
  252. package/tests/binary-cache-cloud-overrides.test.ts +123 -0
  253. package/tests/cached-artifact-format.test.ts +84 -0
  254. package/tests/cli-help.test.ts +40 -14
  255. package/tests/config.test.ts +140 -37
  256. package/tests/engine-distribution.test.ts +3 -3
  257. package/tests/ensure-binary.test.ts +59 -0
  258. package/tests/init.test.ts +28 -86
  259. package/tests/migrate-from-v1.test.ts +29 -0
  260. package/tests/pg-spawn-env.test.ts +18 -0
  261. package/tests/postgres-archive-tag.test.ts +9 -0
  262. package/tests/pull-utils.test.ts +36 -1
  263. package/tests/release-pins.test.ts +28 -0
  264. package/tests/runtime-contract.test.ts +236 -0
  265. package/tests/seed-discover.test.ts +31 -0
  266. package/tests/tsconfig.json +9 -0
  267. package/tests/type-extractor.test.ts +401 -0
  268. package/tsconfig.tsbuildinfo +1 -1
  269. package/vitest.config.ts +12 -0
  270. package/dist/engine/cache.d.ts +0 -37
  271. package/dist/engine/cache.d.ts.map +0 -1
  272. package/dist/engine/cache.js +0 -121
  273. package/dist/engine/cache.js.map +0 -1
  274. package/dist/engine/download.d.ts +0 -19
  275. package/dist/engine/download.d.ts.map +0 -1
  276. package/dist/engine/download.js +0 -108
  277. package/dist/engine/download.js.map +0 -1
  278. package/dist/engine/platform.d.ts +0 -24
  279. package/dist/engine/platform.d.ts.map +0 -1
  280. package/dist/engine/platform.js +0 -50
  281. package/dist/engine/platform.js.map +0 -1
  282. package/dist/engine/resolve.d.ts +0 -37
  283. package/dist/engine/resolve.d.ts.map +0 -1
  284. package/dist/engine/resolve.js +0 -133
  285. package/dist/engine/resolve.js.map +0 -1
  286. package/dist/engine/update-notify.d.ts +0 -11
  287. package/dist/engine/update-notify.d.ts.map +0 -1
  288. package/dist/engine/update-notify.js +0 -43
  289. package/dist/engine/update-notify.js.map +0 -1
  290. package/dist/engine/verify.d.ts +0 -50
  291. package/dist/engine/verify.d.ts.map +0 -1
  292. package/dist/engine/verify.js +0 -161
  293. package/dist/engine/verify.js.map +0 -1
  294. package/dist/engine-version.d.ts +0 -35
  295. package/dist/engine-version.d.ts.map +0 -1
  296. package/dist/engine-version.js +0 -35
  297. package/dist/engine-version.js.map +0 -1
  298. package/dist/engine.d.ts +0 -34
  299. package/dist/engine.d.ts.map +0 -1
  300. package/dist/engine.js +0 -76
  301. package/dist/engine.js.map +0 -1
  302. package/src/engine/cache.ts +0 -135
  303. package/src/engine/download.ts +0 -143
  304. package/src/engine/platform.ts +0 -66
  305. package/src/engine/resolve.ts +0 -197
  306. package/src/engine/update-notify.ts +0 -50
  307. package/src/engine/verify.ts +0 -206
  308. package/src/engine-version.ts +0 -39
  309. package/src/engine.ts +0 -99
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Generates a Deno router entrypoint so `deno run` (optionally `deno run --watch` in dev)
3
+ * can serve multiple handlers (same routing contract as `supatype functions serve`).
4
+ */
5
+ import { basename, join, relative, dirname, resolve as pathResolve, } from "node:path";
6
+ import { existsSync, readdirSync, statSync, mkdirSync, writeFileSync } from "node:fs";
7
+ /** Discover *.ts handlers and `{name}/index.ts` dirs; skips `_shared`, dotfiles. */
8
+ export function discoverTsFunctionsInDir(functionsDir) {
9
+ if (!existsSync(functionsDir))
10
+ return [];
11
+ const entries = readdirSync(functionsDir);
12
+ const out = [];
13
+ for (const entry of entries) {
14
+ if (entry.startsWith("_") || entry.startsWith("."))
15
+ continue;
16
+ const fullPath = join(functionsDir, entry);
17
+ const st = statSync(fullPath);
18
+ if (st.isDirectory()) {
19
+ const indexTs = join(fullPath, "index.ts");
20
+ if (existsSync(indexTs))
21
+ out.push({ name: entry, entrypoint: indexTs });
22
+ }
23
+ else if (entry.endsWith(".ts") && !entry.endsWith(".d.ts")) {
24
+ const name = basename(entry, ".ts");
25
+ out.push({ name, entrypoint: fullPath });
26
+ }
27
+ }
28
+ return out.sort((a, b) => a.name.localeCompare(b.name));
29
+ }
30
+ function importSpecFromRouter(routerFilePath, entrypoint) {
31
+ const rel = relative(dirname(routerFilePath), entrypoint).replace(/\\/g, "/");
32
+ if (!rel.startsWith("."))
33
+ return `./${rel}`;
34
+ return rel;
35
+ }
36
+ /** Router source rooted at routerFilePath (defines import paths). */
37
+ export function generateFunctionsRouterSource(routerFilePath, fns) {
38
+ const imports = fns.map((fn, i) => `import handler_${i} from "${importSpecFromRouter(routerFilePath, fn.entrypoint)}"`);
39
+ const routes = fns.map((fn, i) => ` "${fn.name}": handler_${i},`);
40
+ return `// Auto-generated — do not edit (regenerated by supatype dev / functions serve)
41
+ ${imports.join("\n")}
42
+
43
+ const handlers: Record<string, (req: Request) => Response | Promise<Response>> = {
44
+ ${routes.join("\n")}
45
+ }
46
+
47
+ const port = parseInt(Deno.env.get("PORT") ?? "8001", 10)
48
+ const functionsDir = Deno.env.get("SUPATYPE_DENO_FUNCTIONS_DIR") ?? ""
49
+ const normalizedFunctionsDir = functionsDir.endsWith("/") ? functionsDir.slice(0, -1) : functionsDir
50
+ const sharedEnvPath = Deno.env.get("SUPATYPE_SHARED_ENV_FILE")
51
+ ?? (normalizedFunctionsDir ? normalizedFunctionsDir + "/.env.local" : "")
52
+
53
+ let envLock: Promise<void> = Promise.resolve()
54
+
55
+ async function withEnvLock<T>(run: () => Promise<T>): Promise<T> {
56
+ const prev = envLock
57
+ let release: () => void = () => {}
58
+ envLock = new Promise<void>(resolve => { release = resolve })
59
+ await prev
60
+ try {
61
+ return await run()
62
+ } finally {
63
+ release()
64
+ }
65
+ }
66
+
67
+ async function readEnvFile(path: string): Promise<Record<string, string>> {
68
+ if (!path) return {}
69
+ try {
70
+ const text = await Deno.readTextFile(path)
71
+ const out: Record<string, string> = {}
72
+ for (const line of text.split("\\n")) {
73
+ const trimmed = line.trim()
74
+ if (!trimmed || trimmed.startsWith("#")) continue
75
+ const eq = trimmed.indexOf("=")
76
+ if (eq <= 0) continue
77
+ out[trimmed.slice(0, eq)] = trimmed.slice(eq + 1)
78
+ }
79
+ return out
80
+ } catch {
81
+ return {}
82
+ }
83
+ }
84
+
85
+ async function scopedEnvForFunction(fnName: string): Promise<Record<string, string>> {
86
+ const shared = await readEnvFile(sharedEnvPath)
87
+ if (!normalizedFunctionsDir) return shared
88
+ const fnPath = normalizedFunctionsDir + "/.env." + fnName + ".local"
89
+ const fnVars = await readEnvFile(fnPath)
90
+ return { ...shared, ...fnVars }
91
+ }
92
+
93
+ async function runWithScopedEnv<T>(fnName: string, run: () => Promise<T>): Promise<T> {
94
+ return withEnvLock(async () => {
95
+ const scoped = await scopedEnvForFunction(fnName)
96
+ const prev = new Map<string, string | undefined>()
97
+ for (const [k, v] of Object.entries(scoped)) {
98
+ prev.set(k, Deno.env.get(k))
99
+ Deno.env.set(k, v)
100
+ }
101
+ try {
102
+ return await run()
103
+ } finally {
104
+ for (const k of Object.keys(scoped)) {
105
+ const old = prev.get(k)
106
+ if (old === undefined) Deno.env.delete(k)
107
+ else Deno.env.set(k, old)
108
+ }
109
+ }
110
+ })
111
+ }
112
+
113
+ Deno.serve({ port }, async (req: Request): Promise<Response> => {
114
+ const url = new URL(req.url)
115
+ const pathParts = url.pathname
116
+ .replace(/^\\/functions\\/v1\\/?/, "")
117
+ .split("/")
118
+ .filter(Boolean)
119
+ const fnName = pathParts[0] ?? ""
120
+
121
+ if (!fnName || !handlers[fnName]) {
122
+ return new Response(JSON.stringify({
123
+ error: "not_found",
124
+ message: fnName ? \`Function "\${fnName}" not found\` : "No function specified",
125
+ available: Object.keys(handlers),
126
+ }), { status: 404, headers: { "Content-Type": "application/json" } })
127
+ }
128
+
129
+ try {
130
+ const start = performance.now()
131
+ const response = await runWithScopedEnv(fnName, async () => {
132
+ const prev = new Map<string, string | undefined>()
133
+ const setScoped = (key: string, value: string | undefined) => {
134
+ if (value === undefined || value.length === 0) return
135
+ prev.set(key, Deno.env.get(key))
136
+ Deno.env.set(key, value)
137
+ }
138
+
139
+ // Supatype runtime defaults available to every invocation.
140
+ const supatypeUrl = Deno.env.get("SUPATYPE_URL")
141
+ const supatypeAnon = Deno.env.get("SUPATYPE_ANON_KEY")
142
+ const supatypeServiceRole = Deno.env.get("SUPATYPE_SERVICE_ROLE_KEY")
143
+ const supatypeDbUrl = Deno.env.get("SUPATYPE_DB_URL") ?? Deno.env.get("DATABASE_URL")
144
+ const supatypeJwks = Deno.env.get("SUPATYPE_JWKS")
145
+
146
+ setScoped("SUPATYPE_URL", supatypeUrl)
147
+ setScoped("SUPATYPE_ANON_KEY", supatypeAnon)
148
+ setScoped("SUPATYPE_SERVICE_ROLE_KEY", supatypeServiceRole)
149
+ setScoped("SUPATYPE_DB_URL", supatypeDbUrl)
150
+ setScoped("SUPATYPE_JWKS", supatypeJwks)
151
+ if (!Deno.env.get("SUPATYPE_PUBLISHABLE_KEYS") && supatypeAnon) {
152
+ setScoped("SUPATYPE_PUBLISHABLE_KEYS", JSON.stringify({ anon: supatypeAnon }))
153
+ }
154
+ if (!Deno.env.get("SUPATYPE_SECRET_KEYS") && supatypeServiceRole) {
155
+ setScoped("SUPATYPE_SECRET_KEYS", JSON.stringify({ service_role: supatypeServiceRole }))
156
+ }
157
+
158
+ setScoped("SUPATYPE_REGION", Deno.env.get("SUPATYPE_REGION") ?? "local")
159
+ setScoped("SUPATYPE_EXECUTION_ID", crypto.randomUUID())
160
+ setScoped("DENO_DEPLOYMENT_ID", Deno.env.get("DENO_DEPLOYMENT_ID") ?? "local-dev")
161
+
162
+ try {
163
+ return await handlers[fnName]!(req)
164
+ } finally {
165
+ for (const [key, old] of prev.entries()) {
166
+ if (old === undefined) Deno.env.delete(key)
167
+ else Deno.env.set(key, old)
168
+ }
169
+ }
170
+ })
171
+ const duration = (performance.now() - start).toFixed(1)
172
+ console.log(\`\${req.method} /functions/v1/\${fnName} → \${response.status} (\${duration}ms)\`)
173
+ return response
174
+ } catch (err) {
175
+ console.error(\`Error in function "\${fnName}":\`, err)
176
+ return new Response(JSON.stringify({
177
+ error: "function_error",
178
+ message: err instanceof Error ? err.message : "Unknown error",
179
+ }), { status: 500, headers: { "Content-Type": "application/json" } })
180
+ }
181
+ })
182
+ `;
183
+ }
184
+ /**
185
+ * Writes `.supatype/functions-router.ts` under project cwd. Returns absolute path or null if no handlers.
186
+ * Pass `routes` when callers already scanned the dir to avoid duplicate I/O.
187
+ */
188
+ export function writeDevFunctionsRouter(cwd, functionsDir, routes) {
189
+ const fns = routes ?? discoverTsFunctionsInDir(functionsDir);
190
+ if (fns.length === 0)
191
+ return null;
192
+ const supatypeDir = pathResolve(cwd, ".supatype");
193
+ mkdirSync(supatypeDir, { recursive: true });
194
+ const routerPath = join(supatypeDir, "functions-router.ts");
195
+ const src = generateFunctionsRouterSource(routerPath, fns);
196
+ writeFileSync(routerPath, src, "utf8");
197
+ return routerPath;
198
+ }
199
+ //# sourceMappingURL=functions-router-gen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions-router-gen.js","sourceRoot":"","sources":["../src/functions-router-gen.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,OAAO,IAAI,WAAW,GACvB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAOrF,oFAAoF;AACpF,MAAM,UAAU,wBAAwB,CAAC,YAAoB;IAC3D,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;QAAE,OAAO,EAAE,CAAA;IAExC,MAAM,OAAO,GAAG,WAAW,CAAC,YAAY,CAAC,CAAA;IACzC,MAAM,GAAG,GAA8B,EAAE,CAAA;IAEzC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAQ;QAE5D,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,CAAA;QAC1C,MAAM,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAA;QAE7B,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;YACrB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;YAC1C,IAAI,UAAU,CAAC,OAAO,CAAC;gBAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAA;QACzE,CAAC;aAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0IlB,CAAA;AACD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,GAAW,EACX,YAAoB,EACpB,MAAkC;IAElC,MAAM,GAAG,GAAG,MAAM,IAAI,wBAAwB,CAAC,YAAY,CAAC,CAAA;IAC5D,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAEjC,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IACjD,SAAS,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAA;IAC3D,MAAM,GAAG,GAAG,6BAA6B,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;IAC1D,aAAa,CAAC,UAAU,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;IACtC,OAAO,UAAU,CAAA;AACnB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3,10 +3,9 @@
3
3
  *
4
4
  * For CLI usage: use the `supatype` binary.
5
5
  */
6
- export { invokeEngine, getEnginePath, ensureEngine, getEnginePathAsync } from "./engine.js";
7
- export { ENGINE_VERSION, ENGINE_REPO, ENGINE_DOWNLOAD_BASE, CDN_BASE_URL, ENGINE_RELEASES_REPO, GITHUB_RELEASES_FALLBACK_URL, } from "./engine-version.js";
6
+ export { ensureEngine, engineRequest, engineHealth, EngineError } from "./engine-client.js";
7
+ export type { EngineResult, DiffResult, Operation, IntrospectResult } from "./engine-client.js";
8
8
  export { defineConfig, loadConfig, loadSchemaAst } from "./config.js";
9
- export type { SupatypeConfig } from "./config.js";
10
- export { detectPlatform } from "./engine/platform.js";
11
- export type { PlatformInfo } from "./engine/platform.js";
9
+ export type { SupatypeConfig, SupatypeProjectConfig } from "./config.js";
10
+ export { schemaPathFromProject, localDSN, connectionString, serverBaseUrl } from "./project-config.js";
12
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAC3F,OAAO,EACL,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACrE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAC3F,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC/F,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACrE,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA"}
package/dist/index.js CHANGED
@@ -3,8 +3,7 @@
3
3
  *
4
4
  * For CLI usage: use the `supatype` binary.
5
5
  */
6
- export { invokeEngine, getEnginePath, ensureEngine, getEnginePathAsync } from "./engine.js";
7
- export { ENGINE_VERSION, ENGINE_REPO, ENGINE_DOWNLOAD_BASE, CDN_BASE_URL, ENGINE_RELEASES_REPO, GITHUB_RELEASES_FALLBACK_URL, } from "./engine-version.js";
6
+ export { ensureEngine, engineRequest, engineHealth, EngineError } from "./engine-client.js";
8
7
  export { defineConfig, loadConfig, loadSchemaAst } from "./config.js";
9
- export { detectPlatform } from "./engine/platform.js";
8
+ export { schemaPathFromProject, localDSN, connectionString, serverBaseUrl } from "./project-config.js";
10
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAC3F,OAAO,EACL,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAErE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAE3F,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAErE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Kong declarative config for local dev and self-hosted production.
3
+ * When `engineGatewayKey` is set, `/studio-config` and `/sql` require `apikey` (key-auth).
4
+ */
5
+ export interface KongDeclarativeOptions {
6
+ /**
7
+ * When non-empty, Kong `key-auth` is enabled on engine routes; clients must send
8
+ * header `apikey: <key>` (same convention as PostgREST). Omit for open local dev.
9
+ */
10
+ engineGatewayKey?: string | undefined;
11
+ appUpstream?: string | undefined;
12
+ staticAppServiceUrl?: string | undefined;
13
+ functionsServiceUrl?: string | undefined;
14
+ /** Self-host: route API paths through supatype-server (see runtime-routes). */
15
+ unifiedGateway?: boolean | undefined;
16
+ }
17
+ /**
18
+ * Build full `kong.yml` content. Single source of truth for CLI `dev` and `self-host setup`.
19
+ */
20
+ export declare function buildKongDeclarative(opts?: KongDeclarativeOptions): string;
21
+ //# sourceMappingURL=kong-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kong-config.d.ts","sourceRoot":"","sources":["../src/kong-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACxC,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACxC,+EAA+E;IAC/E,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACrC;AASD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,sBAA2B,GAAG,MAAM,CAiD9E"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Kong declarative config for local dev and self-hosted production.
3
+ * When `engineGatewayKey` is set, `/studio-config` and `/sql` require `apikey` (key-auth).
4
+ */
5
+ /** Escape a string for use inside YAML double quotes. */
6
+ function yamlQuotedString(s) {
7
+ return JSON.stringify(s);
8
+ }
9
+ import { runtimeRouteSpec } from "./runtime-routes.js";
10
+ /**
11
+ * Build full `kong.yml` content. Single source of truth for CLI `dev` and `self-host setup`.
12
+ */
13
+ export function buildKongDeclarative(opts = {}) {
14
+ const gatewayKey = opts.engineGatewayKey?.trim();
15
+ const secured = Boolean(gatewayKey);
16
+ const routes = runtimeRouteSpec({
17
+ ...(opts.unifiedGateway === true && { unifiedGateway: true }),
18
+ ...(opts.unifiedGateway !== true && opts.appUpstream !== undefined && { appUpstream: opts.appUpstream }),
19
+ ...(opts.unifiedGateway !== true &&
20
+ opts.staticAppServiceUrl !== undefined && { staticAppServiceUrl: opts.staticAppServiceUrl }),
21
+ ...(opts.functionsServiceUrl !== undefined && { functionsServiceUrl: opts.functionsServiceUrl }),
22
+ });
23
+ const consumersBlock = secured
24
+ ? `
25
+ consumers:
26
+ - username: studio-engine-gateway
27
+ keyauth_credentials:
28
+ - key: ${yamlQuotedString(gatewayKey)}
29
+ `
30
+ : "";
31
+ const servicesBlock = routes.map((route) => {
32
+ const routePlugins = route.engineProtected && secured
33
+ ? ` plugins:
34
+ - name: key-auth
35
+ config:
36
+ key_names:
37
+ - apikey
38
+ hide_credentials: true
39
+ `
40
+ : "";
41
+ const protocols = route.protocols && route.protocols.length > 0
42
+ ? ` protocols:\n${route.protocols.map((p) => ` - ${p}`).join("\n")}\n`
43
+ : "";
44
+ const stripPath = route.stripPath ?? false;
45
+ return ` - name: ${route.serviceName}
46
+ url: ${route.serviceUrl}
47
+ routes:
48
+ - name: ${route.name}
49
+ strip_path: ${stripPath}
50
+ paths:
51
+ ${route.paths.map((path) => ` - ${path}`).join("\n")}
52
+ ${protocols}${routePlugins}`;
53
+ }).join("\n");
54
+ return `_format_version: "3.0"
55
+ ${consumersBlock}
56
+ services:
57
+ ${servicesBlock}
58
+ `;
59
+ }
60
+ //# sourceMappingURL=kong-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kong-config.js","sourceRoot":"","sources":["../src/kong-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,yDAAyD;AACzD,SAAS,gBAAgB,CAAC,CAAS;IACjC,OAAO,IAAI,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AAC,CAAC,uBAAuB,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YACtF,CAAC,CAAC,EAAE,CAAA;QACN,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,KAAK,CAAA;QAC1C,OAAO,aAAa,KAAK,CAAC,WAAW;WAC9B,KAAK,CAAC,UAAU;;gBAEX,KAAK,CAAC,IAAI;sBACJ,SAAS;;EAE7B,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;EAC3D,SAAS,GAAG,YAAY,EAAE,CAAA;IAC1B,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAEb,OAAO;EACP,cAAc;;EAEd,aAAa;CACd,CAAA;AACD,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Host port published for Kong in local Docker Compose. Kong still listens on
3
+ * 8000 inside the container; this avoids clashing with other tools on :8000.
4
+ */
5
+ export declare const LOCAL_KONG_HOST_PORT = 18473;
6
+ export declare function localKongBaseUrl(): string;
7
+ //# sourceMappingURL=local-gateway.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-gateway.d.ts","sourceRoot":"","sources":["../src/local-gateway.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAAQ,CAAA;AAEzC,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Host port published for Kong in local Docker Compose. Kong still listens on
3
+ * 8000 inside the container; this avoids clashing with other tools on :8000.
4
+ */
5
+ export const LOCAL_KONG_HOST_PORT = 18473;
6
+ export function localKongBaseUrl() {
7
+ return `http://localhost:${LOCAL_KONG_HOST_PORT}`;
8
+ }
9
+ //# sourceMappingURL=local-gateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-gateway.js","sourceRoot":"","sources":["../src/local-gateway.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAA;AAEzC,MAAM,UAAU,gBAAgB;IAC9B,OAAO,oBAAoB,oBAAoB,EAAE,CAAA;AACnD,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Returns env vars that configure supatype-server to use local-disk storage.
3
+ * Spread into the server process env when config.storage?.provider !== "s3".
4
+ *
5
+ * @param stateDir Per-project state directory (e.g. ~/.supatype/projects/{name}/)
6
+ */
7
+ export declare function localStorageEnv(stateDir: string): Record<string, string>;
8
+ //# sourceMappingURL=local-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-storage.d.ts","sourceRoot":"","sources":["../src/local-storage.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKxE"}
@@ -0,0 +1,14 @@
1
+ import { join } from "node:path";
2
+ /**
3
+ * Returns env vars that configure supatype-server to use local-disk storage.
4
+ * Spread into the server process env when config.storage?.provider !== "s3".
5
+ *
6
+ * @param stateDir Per-project state directory (e.g. ~/.supatype/projects/{name}/)
7
+ */
8
+ export function localStorageEnv(stateDir) {
9
+ return {
10
+ STORAGE_PROVIDER: "local",
11
+ STORAGE_PATH: join(stateDir, "storage"),
12
+ };
13
+ }
14
+ //# sourceMappingURL=local-storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-storage.js","sourceRoot":"","sources":["../src/local-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,OAAO;QACL,gBAAgB,EAAE,OAAO;QACzB,YAAY,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC;KACxC,CAAA;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** PgBouncer md5 auth: "md5" + md5(password + username) — same as supatype-cloud / self-host. */
2
+ export declare function pgbouncerMd5Hash(password: string, username: string): string;
3
+ /** Two roles used by local compose: superuser pools (GoTrue, engine) and PostgREST. */
4
+ export declare function pgbouncerUserlistContent(pgPassword: string): string;
5
+ //# sourceMappingURL=pgbouncer-userlist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pgbouncer-userlist.d.ts","sourceRoot":"","sources":["../src/pgbouncer-userlist.ts"],"names":[],"mappings":"AAEA,iGAAiG;AACjG,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED,uFAAuF;AACvF,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAMnE"}
@@ -0,0 +1,14 @@
1
+ import { createHash } from "node:crypto";
2
+ /** PgBouncer md5 auth: "md5" + md5(password + username) — same as supatype-cloud / self-host. */
3
+ export function pgbouncerMd5Hash(password, username) {
4
+ return "md5" + createHash("md5").update(password + username).digest("hex");
5
+ }
6
+ /** Two roles used by local compose: superuser pools (GoTrue, engine) and PostgREST. */
7
+ export function pgbouncerUserlistContent(pgPassword) {
8
+ return `# PgBouncer md5 userlist — matches supatype-cloud transaction pool (auth_type = md5).
9
+ # Regenerated by supatype dev --local / init from POSTGRES_PASSWORD.
10
+ "supatype_admin" "${pgbouncerMd5Hash(pgPassword, "supatype_admin")}"
11
+ "authenticator" "${pgbouncerMd5Hash(pgPassword, "authenticator")}"
12
+ `;
13
+ }
14
+ //# sourceMappingURL=pgbouncer-userlist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pgbouncer-userlist.js","sourceRoot":"","sources":["../src/pgbouncer-userlist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,iGAAiG;AACjG,MAAM,UAAU,gBAAgB,CAAC,QAAgB,EAAE,QAAgB;IACjE,OAAO,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC5E,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,wBAAwB,CAAC,UAAkB;IACzD,OAAO;;oBAEW,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,CAAC;mBAC/C,gBAAgB,CAAC,UAAU,EAAE,eAAe,CAAC;CAC/D,CAAA;AACD,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * postgres-ctl — wrappers around pg_ctl, initdb, and pg_isready for managing
3
+ * a native Postgres installation.
4
+ */
5
+ export interface PgOptions {
6
+ /** Absolute path to the directory containing pg_ctl, initdb, psql, etc. */
7
+ pgBinDir: string;
8
+ /** Absolute path to the Postgres data directory (PGDATA). */
9
+ dataDir: string;
10
+ /** Port Postgres should listen on. */
11
+ port: number;
12
+ /** Path to write the postgres log file. */
13
+ logPath?: string;
14
+ }
15
+ /**
16
+ * Native Postgres bundles are built with prefix /usr/local/supatype-pg; dyld/ld
17
+ * must load libpq and friends from the extracted lib/ next to bin/.
18
+ */
19
+ export declare function pgSpawnEnv(pgBinDir: string, platform?: NodeJS.Platform): NodeJS.ProcessEnv;
20
+ /**
21
+ * Initialise a Postgres data directory.
22
+ * Does nothing if the data directory already contains a PG_VERSION file.
23
+ */
24
+ export declare function initdb(opts: PgOptions): void;
25
+ /**
26
+ * Start Postgres using pg_ctl.
27
+ * Returns immediately once pg_ctl has handed off to the server process.
28
+ */
29
+ export declare function start(opts: PgOptions): void;
30
+ /**
31
+ * Stop Postgres using pg_ctl (fast mode).
32
+ */
33
+ export declare function stop(opts: PgOptions): void;
34
+ /**
35
+ * Wait until Postgres is accepting connections.
36
+ * Polls pg_isready every 200ms up to timeoutMs.
37
+ * Throws if the timeout is exceeded.
38
+ */
39
+ export declare function waitReady(opts: PgOptions, timeoutMs?: number): Promise<void>;
40
+ /**
41
+ * Returns true if a TCP listener is already bound to port on 127.0.0.1.
42
+ */
43
+ export declare function isPortInUse(port: number): Promise<boolean>;
44
+ //# sourceMappingURL=postgres-ctl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgres-ctl.d.ts","sourceRoot":"","sources":["../src/postgres-ctl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,SAAS;IACxB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAA;IAChB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAA;IACf,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAA;IACZ,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAC3C,MAAM,CAAC,UAAU,CAWnB;AAMD;;;GAGG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAgB5C;AAMD;;;GAGG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAoB3C;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAS1C;AAMD;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBlF;AAMD;;GAEG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAYhE"}
@@ -0,0 +1,137 @@
1
+ /**
2
+ * postgres-ctl — wrappers around pg_ctl, initdb, and pg_isready for managing
3
+ * a native Postgres installation.
4
+ */
5
+ import { spawnSync } from "node:child_process";
6
+ import { existsSync, mkdirSync } from "node:fs";
7
+ import { dirname, join } from "node:path";
8
+ /**
9
+ * Native Postgres bundles are built with prefix /usr/local/supatype-pg; dyld/ld
10
+ * must load libpq and friends from the extracted lib/ next to bin/.
11
+ */
12
+ export function pgSpawnEnv(pgBinDir, platform = process.platform) {
13
+ const libDir = join(dirname(pgBinDir), "lib");
14
+ const env = { ...process.env };
15
+ if (platform === "darwin") {
16
+ const prev = env.DYLD_LIBRARY_PATH ?? "";
17
+ env.DYLD_LIBRARY_PATH = prev ? `${libDir}:${prev}` : libDir;
18
+ }
19
+ else if (platform === "linux") {
20
+ const prev = env.LD_LIBRARY_PATH ?? "";
21
+ env.LD_LIBRARY_PATH = prev ? `${libDir}:${prev}` : libDir;
22
+ }
23
+ return env;
24
+ }
25
+ // ---------------------------------------------------------------------------
26
+ // initdb
27
+ // ---------------------------------------------------------------------------
28
+ /**
29
+ * Initialise a Postgres data directory.
30
+ * Does nothing if the data directory already contains a PG_VERSION file.
31
+ */
32
+ export function initdb(opts) {
33
+ const pgVersionFile = join(opts.dataDir, "PG_VERSION");
34
+ if (existsSync(pgVersionFile))
35
+ return; // Already initialised.
36
+ mkdirSync(opts.dataDir, { recursive: true });
37
+ const bin = pgBin(opts.pgBinDir, "initdb");
38
+ const result = spawnSync(bin, ["-D", opts.dataDir, "--username", "postgres", "--auth", "trust"], {
39
+ stdio: "inherit",
40
+ encoding: "utf8",
41
+ env: pgSpawnEnv(opts.pgBinDir),
42
+ });
43
+ if (result.status !== 0) {
44
+ throw new Error(`initdb failed (exit ${result.status})`);
45
+ }
46
+ }
47
+ // ---------------------------------------------------------------------------
48
+ // start / stop
49
+ // ---------------------------------------------------------------------------
50
+ /**
51
+ * Start Postgres using pg_ctl.
52
+ * Returns immediately once pg_ctl has handed off to the server process.
53
+ */
54
+ export function start(opts) {
55
+ const bin = pgBin(opts.pgBinDir, "pg_ctl");
56
+ const logPath = opts.logPath ?? join(opts.dataDir, "postgres.log");
57
+ const args = [
58
+ "start",
59
+ "-D", opts.dataDir,
60
+ "-l", logPath,
61
+ "-o", `-p ${opts.port}`,
62
+ "--wait",
63
+ ];
64
+ const result = spawnSync(bin, args, {
65
+ stdio: "inherit",
66
+ encoding: "utf8",
67
+ env: pgSpawnEnv(opts.pgBinDir),
68
+ });
69
+ if (result.status !== 0) {
70
+ throw new Error(`pg_ctl start failed (exit ${result.status})`);
71
+ }
72
+ }
73
+ /**
74
+ * Stop Postgres using pg_ctl (fast mode).
75
+ */
76
+ export function stop(opts) {
77
+ const bin = pgBin(opts.pgBinDir, "pg_ctl");
78
+ const result = spawnSync(bin, ["stop", "-D", opts.dataDir, "-m", "fast", "--wait"], {
79
+ stdio: "inherit",
80
+ encoding: "utf8",
81
+ env: pgSpawnEnv(opts.pgBinDir),
82
+ });
83
+ // Ignore exit code — Postgres may already be stopped.
84
+ void result;
85
+ }
86
+ // ---------------------------------------------------------------------------
87
+ // waitReady
88
+ // ---------------------------------------------------------------------------
89
+ /**
90
+ * Wait until Postgres is accepting connections.
91
+ * Polls pg_isready every 200ms up to timeoutMs.
92
+ * Throws if the timeout is exceeded.
93
+ */
94
+ export async function waitReady(opts, timeoutMs = 10_000) {
95
+ const bin = pgBin(opts.pgBinDir, "pg_isready");
96
+ const deadline = Date.now() + timeoutMs;
97
+ while (Date.now() < deadline) {
98
+ const result = spawnSync(bin, ["-p", String(opts.port), "-q"], {
99
+ encoding: "utf8",
100
+ env: pgSpawnEnv(opts.pgBinDir),
101
+ });
102
+ if (result.status === 0)
103
+ return;
104
+ await sleep(200);
105
+ }
106
+ throw new Error(`Postgres did not become ready within ${timeoutMs}ms on port ${opts.port}`);
107
+ }
108
+ // ---------------------------------------------------------------------------
109
+ // Port check
110
+ // ---------------------------------------------------------------------------
111
+ /**
112
+ * Returns true if a TCP listener is already bound to port on 127.0.0.1.
113
+ */
114
+ export async function isPortInUse(port) {
115
+ const { createServer } = await import("node:net");
116
+ return new Promise((resolve) => {
117
+ const server = createServer();
118
+ server.once("error", (err) => {
119
+ resolve(err.code === "EADDRINUSE");
120
+ });
121
+ server.once("listening", () => {
122
+ server.close(() => resolve(false));
123
+ });
124
+ server.listen(port, "127.0.0.1");
125
+ });
126
+ }
127
+ // ---------------------------------------------------------------------------
128
+ // Helpers
129
+ // ---------------------------------------------------------------------------
130
+ function sleep(ms) {
131
+ return new Promise((resolve) => setTimeout(resolve, ms));
132
+ }
133
+ /** Returns the full path to a Postgres binary, appending .exe on Windows. */
134
+ function pgBin(binDir, name) {
135
+ return join(binDir, process.platform === "win32" ? `${name}.exe` : name);
136
+ }
137
+ //# sourceMappingURL=postgres-ctl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgres-ctl.js","sourceRoot":"","sources":["../src/postgres-ctl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAazC;;;GAGG;AACH,MAAM,UAAU,UAAU,CACxB,QAAgB,EAChB,WAA4B,OAAO,CAAC,QAAQ;IAE5C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAA;IAC7C,MAAM,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAuB,CAAA;IACnD,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAA;QACxC,GAAG,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAA;IAC7D,CAAC;SAAM,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QAChC,MAAM,IAAI,GAAG,GAAG,CA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