@supacloud/lite 0.5.6 → 0.5.8

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 (155) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +2 -2
  3. package/THIRD_PARTY_NOTICES.md +3 -4
  4. package/dist/cli.js +195 -67
  5. package/dist/index.d.ts +10 -10
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +193 -65
  8. package/dist/project-runtime.d.ts +6 -6
  9. package/dist/project-runtime.d.ts.map +1 -1
  10. package/dist/runtime/auth/handler.d.ts.map +1 -0
  11. package/dist/{vendor/tinbase → runtime}/auth/inbox.d.ts +1 -1
  12. package/dist/runtime/auth/inbox.d.ts.map +1 -0
  13. package/dist/runtime/auth/oauth.d.ts.map +1 -0
  14. package/dist/runtime/auth/password.d.ts.map +1 -0
  15. package/dist/runtime/auth/qr.d.ts.map +1 -0
  16. package/dist/{vendor/tinbase → runtime}/auth/rate-limit.d.ts +1 -1
  17. package/dist/runtime/auth/rate-limit.d.ts.map +1 -0
  18. package/dist/runtime/auth/redirect.d.ts.map +1 -0
  19. package/dist/runtime/auth/settings.d.ts.map +1 -0
  20. package/dist/runtime/auth/totp.d.ts.map +1 -0
  21. package/dist/runtime/cron/service.d.ts.map +1 -0
  22. package/dist/{vendor/tinbase → runtime}/db/bootstrap.d.ts +1 -1
  23. package/dist/runtime/db/bootstrap.d.ts.map +1 -0
  24. package/dist/runtime/db/data-dir-lock.d.ts.map +1 -0
  25. package/dist/{vendor/tinbase → runtime}/db/database.d.ts +1 -1
  26. package/dist/runtime/db/database.d.ts.map +1 -0
  27. package/dist/runtime/db/emulated.d.ts.map +1 -0
  28. package/dist/{vendor/tinbase → runtime}/db/engine.d.ts +2 -2
  29. package/dist/runtime/db/engine.d.ts.map +1 -0
  30. package/dist/{vendor/tinbase → runtime}/db/inspect.d.ts +1 -1
  31. package/dist/runtime/db/inspect.d.ts.map +1 -0
  32. package/dist/runtime/db/pglite-engine.d.ts.map +1 -0
  33. package/dist/runtime/db/schema-diff.d.ts.map +1 -0
  34. package/dist/{vendor/tinbase → runtime}/db/sql-compat.d.ts +2 -2
  35. package/dist/runtime/db/sql-compat.d.ts.map +1 -0
  36. package/dist/runtime/functions/deno-shim.d.ts.map +1 -0
  37. package/dist/runtime/functions/handler.d.ts.map +1 -0
  38. package/dist/runtime/functions/pgredis.d.ts.map +1 -0
  39. package/dist/runtime/gen-types.d.ts.map +1 -0
  40. package/dist/{vendor/tinbase → runtime}/index.d.ts +6 -6
  41. package/dist/runtime/index.d.ts.map +1 -0
  42. package/dist/runtime/jwt.d.ts.map +1 -0
  43. package/dist/runtime/log-buffer.d.ts.map +1 -0
  44. package/dist/runtime/net/service.d.ts.map +1 -0
  45. package/dist/runtime/node/bun-server.d.ts.map +1 -0
  46. package/dist/runtime/node/bundle-function.d.ts.map +1 -0
  47. package/dist/runtime/node/config-toml.d.ts.map +1 -0
  48. package/dist/runtime/node/fs-driver.d.ts.map +1 -0
  49. package/dist/{vendor/tinbase → runtime}/node/load-config.d.ts +4 -4
  50. package/dist/runtime/node/load-config.d.ts.map +1 -0
  51. package/dist/runtime/node/load-functions.d.ts.map +1 -0
  52. package/dist/runtime/node/project.d.ts.map +1 -0
  53. package/dist/runtime/node/server-shared.d.ts.map +1 -0
  54. package/dist/runtime/realtime/engine.d.ts.map +1 -0
  55. package/dist/runtime/rest/build.d.ts.map +1 -0
  56. package/dist/runtime/rest/errors.d.ts.map +1 -0
  57. package/dist/runtime/rest/handler.d.ts.map +1 -0
  58. package/dist/runtime/rest/parse.d.ts.map +1 -0
  59. package/dist/runtime/retention/service.d.ts.map +1 -0
  60. package/dist/runtime/security.d.ts.map +1 -0
  61. package/dist/runtime/storage/driver.d.ts.map +1 -0
  62. package/dist/runtime/storage/handler.d.ts.map +1 -0
  63. package/dist/runtime/storage/image-transform.d.ts.map +1 -0
  64. package/dist/runtime/storage/s3-driver.d.ts.map +1 -0
  65. package/dist/{vendor/tinbase → runtime}/types.d.ts +2 -2
  66. package/dist/runtime/types.d.ts.map +1 -0
  67. package/dist/{vendor/tinbase → runtime}/webhooks/service.d.ts +1 -1
  68. package/dist/runtime/webhooks/service.d.ts.map +1 -0
  69. package/package.json +3 -2
  70. package/dist/vendor/tinbase/auth/handler.d.ts.map +0 -1
  71. package/dist/vendor/tinbase/auth/inbox.d.ts.map +0 -1
  72. package/dist/vendor/tinbase/auth/oauth.d.ts.map +0 -1
  73. package/dist/vendor/tinbase/auth/password.d.ts.map +0 -1
  74. package/dist/vendor/tinbase/auth/qr.d.ts.map +0 -1
  75. package/dist/vendor/tinbase/auth/rate-limit.d.ts.map +0 -1
  76. package/dist/vendor/tinbase/auth/redirect.d.ts.map +0 -1
  77. package/dist/vendor/tinbase/auth/settings.d.ts.map +0 -1
  78. package/dist/vendor/tinbase/auth/totp.d.ts.map +0 -1
  79. package/dist/vendor/tinbase/cron/service.d.ts.map +0 -1
  80. package/dist/vendor/tinbase/db/bootstrap.d.ts.map +0 -1
  81. package/dist/vendor/tinbase/db/data-dir-lock.d.ts.map +0 -1
  82. package/dist/vendor/tinbase/db/database.d.ts.map +0 -1
  83. package/dist/vendor/tinbase/db/emulated.d.ts.map +0 -1
  84. package/dist/vendor/tinbase/db/engine.d.ts.map +0 -1
  85. package/dist/vendor/tinbase/db/inspect.d.ts.map +0 -1
  86. package/dist/vendor/tinbase/db/pglite-engine.d.ts.map +0 -1
  87. package/dist/vendor/tinbase/db/schema-diff.d.ts.map +0 -1
  88. package/dist/vendor/tinbase/db/sql-compat.d.ts.map +0 -1
  89. package/dist/vendor/tinbase/functions/deno-shim.d.ts.map +0 -1
  90. package/dist/vendor/tinbase/functions/handler.d.ts.map +0 -1
  91. package/dist/vendor/tinbase/functions/pgredis.d.ts.map +0 -1
  92. package/dist/vendor/tinbase/gen-types.d.ts.map +0 -1
  93. package/dist/vendor/tinbase/index.d.ts.map +0 -1
  94. package/dist/vendor/tinbase/jwt.d.ts.map +0 -1
  95. package/dist/vendor/tinbase/log-buffer.d.ts.map +0 -1
  96. package/dist/vendor/tinbase/net/service.d.ts.map +0 -1
  97. package/dist/vendor/tinbase/node/bun-server.d.ts.map +0 -1
  98. package/dist/vendor/tinbase/node/bundle-function.d.ts.map +0 -1
  99. package/dist/vendor/tinbase/node/config-toml.d.ts.map +0 -1
  100. package/dist/vendor/tinbase/node/fs-driver.d.ts.map +0 -1
  101. package/dist/vendor/tinbase/node/load-config.d.ts.map +0 -1
  102. package/dist/vendor/tinbase/node/load-functions.d.ts.map +0 -1
  103. package/dist/vendor/tinbase/node/project.d.ts.map +0 -1
  104. package/dist/vendor/tinbase/node/server-shared.d.ts.map +0 -1
  105. package/dist/vendor/tinbase/realtime/engine.d.ts.map +0 -1
  106. package/dist/vendor/tinbase/rest/build.d.ts.map +0 -1
  107. package/dist/vendor/tinbase/rest/errors.d.ts.map +0 -1
  108. package/dist/vendor/tinbase/rest/handler.d.ts.map +0 -1
  109. package/dist/vendor/tinbase/rest/parse.d.ts.map +0 -1
  110. package/dist/vendor/tinbase/retention/service.d.ts.map +0 -1
  111. package/dist/vendor/tinbase/security.d.ts.map +0 -1
  112. package/dist/vendor/tinbase/storage/driver.d.ts.map +0 -1
  113. package/dist/vendor/tinbase/storage/handler.d.ts.map +0 -1
  114. package/dist/vendor/tinbase/storage/image-transform.d.ts.map +0 -1
  115. package/dist/vendor/tinbase/storage/s3-driver.d.ts.map +0 -1
  116. package/dist/vendor/tinbase/types.d.ts.map +0 -1
  117. package/dist/vendor/tinbase/webhooks/service.d.ts.map +0 -1
  118. /package/LICENSES/{TINBASE-MIT.txt → UPSTREAM-PROTOCOL-MIT.txt} +0 -0
  119. /package/dist/{vendor/tinbase → runtime}/auth/handler.d.ts +0 -0
  120. /package/dist/{vendor/tinbase → runtime}/auth/oauth.d.ts +0 -0
  121. /package/dist/{vendor/tinbase → runtime}/auth/password.d.ts +0 -0
  122. /package/dist/{vendor/tinbase → runtime}/auth/qr.d.ts +0 -0
  123. /package/dist/{vendor/tinbase → runtime}/auth/redirect.d.ts +0 -0
  124. /package/dist/{vendor/tinbase → runtime}/auth/settings.d.ts +0 -0
  125. /package/dist/{vendor/tinbase → runtime}/auth/totp.d.ts +0 -0
  126. /package/dist/{vendor/tinbase → runtime}/cron/service.d.ts +0 -0
  127. /package/dist/{vendor/tinbase → runtime}/db/data-dir-lock.d.ts +0 -0
  128. /package/dist/{vendor/tinbase → runtime}/db/emulated.d.ts +0 -0
  129. /package/dist/{vendor/tinbase → runtime}/db/pglite-engine.d.ts +0 -0
  130. /package/dist/{vendor/tinbase → runtime}/db/schema-diff.d.ts +0 -0
  131. /package/dist/{vendor/tinbase → runtime}/functions/deno-shim.d.ts +0 -0
  132. /package/dist/{vendor/tinbase → runtime}/functions/handler.d.ts +0 -0
  133. /package/dist/{vendor/tinbase → runtime}/functions/pgredis.d.ts +0 -0
  134. /package/dist/{vendor/tinbase → runtime}/gen-types.d.ts +0 -0
  135. /package/dist/{vendor/tinbase → runtime}/jwt.d.ts +0 -0
  136. /package/dist/{vendor/tinbase → runtime}/log-buffer.d.ts +0 -0
  137. /package/dist/{vendor/tinbase → runtime}/net/service.d.ts +0 -0
  138. /package/dist/{vendor/tinbase → runtime}/node/bun-server.d.ts +0 -0
  139. /package/dist/{vendor/tinbase → runtime}/node/bundle-function.d.ts +0 -0
  140. /package/dist/{vendor/tinbase → runtime}/node/config-toml.d.ts +0 -0
  141. /package/dist/{vendor/tinbase → runtime}/node/fs-driver.d.ts +0 -0
  142. /package/dist/{vendor/tinbase → runtime}/node/load-functions.d.ts +0 -0
  143. /package/dist/{vendor/tinbase → runtime}/node/project.d.ts +0 -0
  144. /package/dist/{vendor/tinbase → runtime}/node/server-shared.d.ts +0 -0
  145. /package/dist/{vendor/tinbase → runtime}/realtime/engine.d.ts +0 -0
  146. /package/dist/{vendor/tinbase → runtime}/rest/build.d.ts +0 -0
  147. /package/dist/{vendor/tinbase → runtime}/rest/errors.d.ts +0 -0
  148. /package/dist/{vendor/tinbase → runtime}/rest/handler.d.ts +0 -0
  149. /package/dist/{vendor/tinbase → runtime}/rest/parse.d.ts +0 -0
  150. /package/dist/{vendor/tinbase → runtime}/retention/service.d.ts +0 -0
  151. /package/dist/{vendor/tinbase → runtime}/security.d.ts +0 -0
  152. /package/dist/{vendor/tinbase → runtime}/storage/driver.d.ts +0 -0
  153. /package/dist/{vendor/tinbase → runtime}/storage/handler.d.ts +0 -0
  154. /package/dist/{vendor/tinbase → runtime}/storage/image-transform.d.ts +0 -0
  155. /package/dist/{vendor/tinbase → runtime}/storage/s3-driver.d.ts +0 -0
package/dist/cli.js CHANGED
@@ -8,7 +8,7 @@ import { dirname as dirname5, join as join9, resolve as resolve4 } from "path";
8
8
  // package.json
9
9
  var package_default = {
10
10
  name: "@supacloud/lite",
11
- version: "0.5.6",
11
+ version: "0.5.8",
12
12
  description: "Bun-native, single-project Supabase-compatible backend powered by PGlite",
13
13
  type: "module",
14
14
  license: "Apache-2.0",
@@ -33,7 +33,7 @@ var package_default = {
33
33
  ],
34
34
  scripts: {
35
35
  build: "bun run build:js && bun run build:types",
36
- "build:js": "bun build src/index.ts --target=bun --format=esm --outdir=dist --external @electric-sql/pglite --external tar && bun build src/cli.ts --target=bun --format=esm --outdir=dist --external @electric-sql/pglite --external tar && bun run scripts/build-launcher.ts",
36
+ "build:js": "bun run clean && bun build src/index.ts --target=bun --format=esm --outdir=dist --external @electric-sql/pglite --external tar && bun build src/cli.ts --target=bun --format=esm --outdir=dist --external @electric-sql/pglite --external tar && bun run scripts/build-launcher.ts",
37
37
  "build:standalone:host": "bun run scripts/build-standalone.ts host",
38
38
  "build:standalone:linux": "bun run scripts/build-standalone.ts linux-x64 linux-arm64",
39
39
  "build:standalone:macos": "bun run scripts/build-standalone.ts macos-x64 macos-arm64",
@@ -41,6 +41,7 @@ var package_default = {
41
41
  "build:standalone:release": "bun run scripts/build-standalone.ts linux-x64 linux-arm64 macos-x64 macos-arm64 windows-x64",
42
42
  "build:types": "bun x tsc --emitDeclarationOnly -p tsconfig.build.json",
43
43
  check: "bun run typecheck && bun run test && bun run build && bun run test:package && bun run build:standalone:host && bun run test:standalone",
44
+ clean: `bun -e "import { rmSync } from 'node:fs'; rmSync('dist', { recursive: true, force: true })"`,
44
45
  dev: "bun run src/cli.ts start",
45
46
  start: "bun run src/cli.ts start",
46
47
  test: "bun test --timeout 20000",
@@ -79,7 +80,7 @@ var package_default = {
79
80
  ]
80
81
  };
81
82
 
82
- // src/vendor/tinbase/jwt.ts
83
+ // src/runtime/jwt.ts
83
84
  var encoder = new TextEncoder;
84
85
  var decoder = new TextDecoder;
85
86
  function bytesToBase64Url(bytes) {
@@ -140,7 +141,7 @@ function randomToken(bytes = 32) {
140
141
  // src/version.ts
141
142
  var SUPACLOUD_LITE_VERSION = package_default.version;
142
143
 
143
- // src/vendor/tinbase/auth/redirect.ts
144
+ // src/runtime/auth/redirect.ts
144
145
  function globToRegExp(pattern) {
145
146
  let out = "";
146
147
  for (let i = 0;i < pattern.length; i++) {
@@ -189,7 +190,7 @@ function isAllowedRedirect(requested, siteUrl, allowList = []) {
189
190
  return allowList.some((entry) => globToRegExp(entry).test(requested));
190
191
  }
191
192
 
192
- // src/vendor/tinbase/auth/oauth.ts
193
+ // src/runtime/auth/oauth.ts
193
194
  var PRESETS = {
194
195
  google: {
195
196
  authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth",
@@ -410,7 +411,7 @@ function base64url(bytes) {
410
411
  return btoa(bin).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
411
412
  }
412
413
 
413
- // src/vendor/tinbase/auth/password.ts
414
+ // src/runtime/auth/password.ts
414
415
  function toHex(bytes) {
415
416
  return [...bytes].map((b) => b.toString(16).padStart(2, "0")).join("");
416
417
  }
@@ -465,7 +466,7 @@ async function verifyPassword(password, stored) {
465
466
  return diff === 0;
466
467
  }
467
468
 
468
- // src/vendor/tinbase/auth/qr.ts
469
+ // src/runtime/auth/qr.ts
469
470
  var ECC_M = { ordinal: 0, formatBits: 0 };
470
471
  var ECC_CODEWORDS_PER_BLOCK = [
471
472
  -1,
@@ -900,7 +901,7 @@ function qrSvgDataUri(text) {
900
901
  return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;
901
902
  }
902
903
 
903
- // src/vendor/tinbase/auth/settings.ts
904
+ // src/runtime/auth/settings.ts
904
905
  var DEFAULT_AUTH_SETTINGS = {
905
906
  disableSignup: false,
906
907
  anonymousUsers: true,
@@ -953,7 +954,7 @@ async function loadAuthSettings(db, defaults = {}) {
953
954
  }
954
955
  }
955
956
 
956
- // src/vendor/tinbase/auth/rate-limit.ts
957
+ // src/runtime/auth/rate-limit.ts
957
958
  var DEFAULT_AUTH_RATE_LIMITS = {
958
959
  token: { limit: 30, windowMs: 5 * 60 * 1000 },
959
960
  signup: { limit: 30, windowMs: 60 * 60 * 1000 },
@@ -998,7 +999,7 @@ class RateLimiter {
998
999
  }
999
1000
  }
1000
1001
 
1001
- // src/vendor/tinbase/auth/totp.ts
1002
+ // src/runtime/auth/totp.ts
1002
1003
  var B32_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
1003
1004
  function base32Encode(bytes) {
1004
1005
  let bits = 0;
@@ -1076,7 +1077,7 @@ async function verifyTotp(secretBase32, code, window = 1, atMs = Date.now()) {
1076
1077
  return false;
1077
1078
  }
1078
1079
 
1079
- // src/vendor/tinbase/auth/handler.ts
1080
+ // src/runtime/auth/handler.ts
1080
1081
  function authError(status, errorCode, msg) {
1081
1082
  return json(status, { code: status, error_code: errorCode, msg });
1082
1083
  }
@@ -1828,7 +1829,7 @@ Or sign in with this link: ${link}`
1828
1829
  }
1829
1830
  }
1830
1831
 
1831
- // src/vendor/tinbase/auth/inbox.ts
1832
+ // src/runtime/auth/inbox.ts
1832
1833
  var CAP = 200;
1833
1834
 
1834
1835
  class InboxMailer {
@@ -1940,7 +1941,7 @@ var INBOX_HTML = `<!doctype html>
1940
1941
  </body>
1941
1942
  </html>`;
1942
1943
 
1943
- // src/vendor/tinbase/log-buffer.ts
1944
+ // src/runtime/log-buffer.ts
1944
1945
  class LogBuffer {
1945
1946
  cap;
1946
1947
  entries = [];
@@ -1960,7 +1961,7 @@ class LogBuffer {
1960
1961
  }
1961
1962
  }
1962
1963
 
1963
- // src/vendor/tinbase/functions/deno-shim.ts
1964
+ // src/runtime/functions/deno-shim.ts
1964
1965
  import { AsyncLocalStorage } from "async_hooks";
1965
1966
  var captured = {};
1966
1967
  var envStore = new AsyncLocalStorage;
@@ -1969,11 +1970,11 @@ function runWithDenoEnv(env, fn) {
1969
1970
  }
1970
1971
  function installDenoShim() {
1971
1972
  const g = globalThis;
1972
- if (g.__tinbaseDeno)
1973
+ if (g.__supacloudLiteDeno)
1973
1974
  return;
1974
1975
  if (g.Deno && typeof g.Deno.serve === "function")
1975
1976
  return;
1976
- g.__tinbaseDeno = true;
1977
+ g.__supacloudLiteDeno = true;
1977
1978
  g.Deno = {
1978
1979
  serve(arg1, arg2) {
1979
1980
  captured.handler = typeof arg1 === "function" ? arg1 : arg2;
@@ -2009,7 +2010,7 @@ function resetCapturedHandler() {
2009
2010
  captured.handler = undefined;
2010
2011
  }
2011
2012
 
2012
- // src/vendor/tinbase/functions/pgredis.ts
2013
+ // src/runtime/functions/pgredis.ts
2013
2014
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
2014
2015
  var CACHE_NAMESPACE = "supacloud-edge-runtime";
2015
2016
  var CACHE_TABLE = "public.supacloud_pgredis_kv";
@@ -2176,7 +2177,7 @@ async function upsertWithoutTtl(query, key, serializedValue) {
2176
2177
  on conflict (namespace, key) do update set value = excluded.value, expires_at = null, updated_at = now()`, [CACHE_NAMESPACE, key, serializedValue]);
2177
2178
  }
2178
2179
 
2179
- // src/vendor/tinbase/functions/handler.ts
2180
+ // src/runtime/functions/handler.ts
2180
2181
  class FunctionsHandler {
2181
2182
  functions;
2182
2183
  env;
@@ -2221,7 +2222,7 @@ function json2(status, body) {
2221
2222
  });
2222
2223
  }
2223
2224
 
2224
- // src/vendor/tinbase/db/bootstrap.ts
2225
+ // src/runtime/db/bootstrap.ts
2225
2226
  var MINIMAL_BOOTSTRAP_SQL = `
2226
2227
  create schema if not exists auth;
2227
2228
  create schema if not exists storage;
@@ -2645,8 +2646,22 @@ $$;
2645
2646
 
2646
2647
  alter table storage.objects enable row level security;
2647
2648
 
2648
- drop policy if exists tinbase_authenticated_all on storage.objects;
2649
- drop policy if exists tinbase_public_read on storage.objects;
2649
+ drop policy if exists supacloud_lite_authenticated_all on storage.objects;
2650
+ drop policy if exists supacloud_lite_public_read on storage.objects;
2651
+
2652
+ do $legacy_policy_cleanup$
2653
+ declare
2654
+ legacy_prefix constant text := 'tin' || 'base';
2655
+ begin
2656
+ execute format(
2657
+ 'drop policy if exists %I on storage.objects',
2658
+ legacy_prefix || '_authenticated_all'
2659
+ );
2660
+ execute format(
2661
+ 'drop policy if exists %I on storage.objects',
2662
+ legacy_prefix || '_public_read'
2663
+ );
2664
+ end $legacy_policy_cleanup$;
2650
2665
 
2651
2666
  -- \u2500\u2500 Migration bookkeeping (same table the Supabase CLI uses) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
2652
2667
  create schema if not exists supabase_migrations;
@@ -2665,9 +2680,19 @@ create table if not exists supabase_migrations.seed_files (
2665
2680
  );
2666
2681
 
2667
2682
  -- \u2500\u2500 Realtime CDC plumbing \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
2668
- create schema if not exists tinbase;
2683
+ do $legacy_schema_upgrade$
2684
+ declare
2685
+ legacy_schema constant text := 'tin' || 'base';
2686
+ begin
2687
+ if exists (select 1 from pg_namespace where nspname = legacy_schema)
2688
+ and not exists (select 1 from pg_namespace where nspname = 'supacloud_lite') then
2689
+ execute format('alter schema %I rename to supacloud_lite', legacy_schema);
2690
+ end if;
2691
+ end $legacy_schema_upgrade$;
2692
+
2693
+ create schema if not exists supacloud_lite;
2669
2694
 
2670
- create or replace function tinbase.cdc_notify() returns trigger
2695
+ create or replace function supacloud_lite.cdc_notify() returns trigger
2671
2696
  language plpgsql security definer as $$
2672
2697
  declare
2673
2698
  payload text;
@@ -2692,10 +2717,78 @@ begin
2692
2717
  'errors', json_build_array('Payload too large')
2693
2718
  )::text;
2694
2719
  end if;
2695
- perform pg_notify('tinbase_cdc', payload);
2720
+ perform pg_notify('supacloud_lite_cdc', payload);
2696
2721
  return coalesce(NEW, OLD);
2697
2722
  end $$;
2698
2723
 
2724
+ do $legacy_trigger_upgrade$
2725
+ declare
2726
+ legacy_schema constant text := 'tin' || 'base';
2727
+ legacy_trigger constant text := ('tin' || 'base') || '_cdc';
2728
+ trigger_record record;
2729
+ target_exists boolean;
2730
+ begin
2731
+ for trigger_record in
2732
+ select c.oid as relation_oid, n.nspname as schema_name, c.relname as table_name
2733
+ from pg_trigger tg
2734
+ join pg_class c on c.oid = tg.tgrelid
2735
+ join pg_namespace n on n.oid = c.relnamespace
2736
+ join pg_proc p on p.oid = tg.tgfoid
2737
+ join pg_namespace pn on pn.oid = p.pronamespace
2738
+ where not tg.tgisinternal
2739
+ and tg.tgname = legacy_trigger
2740
+ and p.proname = 'cdc_notify'
2741
+ and pn.nspname in (legacy_schema, 'supacloud_lite')
2742
+ loop
2743
+ select exists (
2744
+ select 1
2745
+ from pg_trigger
2746
+ where not tgisinternal
2747
+ and tgrelid = trigger_record.relation_oid
2748
+ and tgname = 'supacloud_lite_cdc'
2749
+ ) into target_exists;
2750
+
2751
+ execute format(
2752
+ 'drop trigger %I on %I.%I',
2753
+ legacy_trigger,
2754
+ trigger_record.schema_name,
2755
+ trigger_record.table_name
2756
+ );
2757
+
2758
+ if not target_exists then
2759
+ execute format(
2760
+ 'create trigger supacloud_lite_cdc after insert or update or delete on %I.%I for each row execute function supacloud_lite.cdc_notify()',
2761
+ trigger_record.schema_name,
2762
+ trigger_record.table_name
2763
+ );
2764
+ end if;
2765
+ end loop;
2766
+ end $legacy_trigger_upgrade$;
2767
+
2768
+ do $legacy_schema_cleanup$
2769
+ declare
2770
+ legacy_schema constant text := 'tin' || 'base';
2771
+ begin
2772
+ if exists (
2773
+ select 1
2774
+ from pg_proc p
2775
+ join pg_namespace n on n.oid = p.pronamespace
2776
+ where n.nspname = legacy_schema
2777
+ and p.proname = 'cdc_notify'
2778
+ and p.pronargs = 0
2779
+ ) then
2780
+ execute format('drop function %I.cdc_notify()', legacy_schema);
2781
+ end if;
2782
+
2783
+ if exists (select 1 from pg_namespace where nspname = legacy_schema) then
2784
+ begin
2785
+ execute format('drop schema %I', legacy_schema);
2786
+ exception when dependent_objects_still_exist then
2787
+ raise notice 'SupaCloud Lite: retained non-empty legacy runtime schema';
2788
+ end;
2789
+ end if;
2790
+ end $legacy_schema_cleanup$;
2791
+
2699
2792
  -- \u2500\u2500 Realtime Authorization + broadcast-from-database \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
2700
2793
  -- Mirrors Supabase Realtime: developers write RLS policies on
2701
2794
  -- realtime.messages using realtime.topic(); a SELECT policy grants a private
@@ -2725,12 +2818,12 @@ create or replace function realtime.topic() returns text
2725
2818
 
2726
2819
  -- push a broadcast message to all subscribers of <topic> from SQL / triggers.
2727
2820
  -- Delivered over the websocket by the in-process realtime engine, which listens
2728
- -- on the 'tinbase_realtime_broadcast' channel.
2821
+ -- on the 'supacloud_lite_realtime_broadcast' channel.
2729
2822
  create or replace function realtime.send(payload jsonb, event text, topic text, private boolean default true)
2730
2823
  returns void language plpgsql security definer as $$
2731
2824
  begin
2732
2825
  perform pg_notify(
2733
- 'tinbase_realtime_broadcast',
2826
+ 'supacloud_lite_realtime_broadcast',
2734
2827
  json_build_object('topic', topic, 'event', event, 'payload', payload, 'private', private)::text
2735
2828
  );
2736
2829
  exception when others then
@@ -2742,7 +2835,7 @@ grant execute on function realtime.topic() to anon, authenticated, service_role;
2742
2835
  grant execute on function realtime.send(jsonb, text, text, boolean) to anon, authenticated, service_role;
2743
2836
  `;
2744
2837
 
2745
- // src/vendor/tinbase/db/emulated.ts
2838
+ // src/runtime/db/emulated.ts
2746
2839
  var PGMQ_SQL = `
2747
2840
  create schema if not exists pgmq;
2748
2841
  revoke all on schema pgmq from public, anon, authenticated;
@@ -3193,7 +3286,7 @@ end $vault$;
3193
3286
  grant execute on function vault.create_secret(text,text,text,uuid), vault.update_secret(uuid,text,text,text,uuid) to service_role;
3194
3287
  `;
3195
3288
 
3196
- // src/vendor/tinbase/db/sql-compat.ts
3289
+ // src/runtime/db/sql-compat.ts
3197
3290
  function rewriteMigrationSql(sql) {
3198
3291
  const out = [];
3199
3292
  const n = sql.length;
@@ -3274,7 +3367,7 @@ function rewriteStatement(stmt) {
3274
3367
  return stmt;
3275
3368
  const inner = pickTag(bare, "tb_ext_stmt");
3276
3369
  const outer = pickTag(bare, "tb_ext");
3277
- return `${trivia}DO ${outer} BEGIN EXECUTE ${inner}${bare}${inner}; ` + `EXCEPTION WHEN OTHERS THEN RAISE NOTICE 'tinbase: skipped extension statement (%)', SQLERRM; END ${outer};`;
3370
+ return `${trivia}DO ${outer} BEGIN EXECUTE ${inner}${bare}${inner}; ` + `EXCEPTION WHEN OTHERS THEN RAISE NOTICE 'SupaCloud Lite: skipped extension statement (%)', SQLERRM; END ${outer};`;
3278
3371
  }
3279
3372
  if (/^(?:create\s+(?:unique\s+)?index|drop\s+index|reindex)\b/i.test(rest)) {
3280
3373
  return trivia + rest.replace(/\s+concurrently\b/i, " ");
@@ -3289,11 +3382,11 @@ function pickTag(text, base) {
3289
3382
  return tag;
3290
3383
  }
3291
3384
 
3292
- // src/vendor/tinbase/db/pglite-engine.ts
3385
+ // src/runtime/db/pglite-engine.ts
3293
3386
  import { mkdir, open, unlink as unlink2 } from "fs/promises";
3294
3387
  import { dirname, resolve } from "path";
3295
3388
 
3296
- // src/vendor/tinbase/db/data-dir-lock.ts
3389
+ // src/runtime/db/data-dir-lock.ts
3297
3390
  import { readFile, unlink } from "fs/promises";
3298
3391
  async function recoverStaleDataDirLock(lockPath) {
3299
3392
  const lockState = await inspectDataDirLock(lockPath);
@@ -3344,7 +3437,7 @@ function isProcessAlive(pid) {
3344
3437
  // src/standalone-assets-protocol.ts
3345
3438
  var STANDALONE_PGLITE_ASSETS = Symbol.for("supacloud-lite.pglite-standalone-assets");
3346
3439
 
3347
- // src/vendor/tinbase/db/pglite-engine.ts
3440
+ // src/runtime/db/pglite-engine.ts
3348
3441
  async function createPgliteEngine(dataDir) {
3349
3442
  const releaseLock = await acquireDataDirLock(dataDir);
3350
3443
  let PGlite, extensions;
@@ -3519,7 +3612,7 @@ function unreadableLockError(lockPath) {
3519
3612
  return new Error(`PGlite data directory has an unreadable lock: ${lockPath}. Confirm no SupaCloud Lite process is using it, then remove the lock manually.`);
3520
3613
  }
3521
3614
 
3522
- // src/vendor/tinbase/db/database.ts
3615
+ // src/runtime/db/database.ts
3523
3616
  var DEFAULT_SEARCH_PATH_SQL = `set search_path to "$user", public, extensions`;
3524
3617
 
3525
3618
  class Database {
@@ -3763,13 +3856,13 @@ class Database {
3763
3856
  select from pg_trigger tg
3764
3857
  join pg_class c on c.oid = tg.tgrelid
3765
3858
  join pg_namespace n on n.oid = c.relnamespace
3766
- where tg.tgname = 'tinbase_cdc'
3859
+ where tg.tgname = 'supacloud_lite_cdc'
3767
3860
  and n.nspname = ${quoteLiteral(schema)}
3768
3861
  and c.relname = ${quoteLiteral(table)}
3769
3862
  ) then
3770
- create trigger tinbase_cdc
3863
+ create trigger supacloud_lite_cdc
3771
3864
  after insert or update or delete on ${s}.${t}
3772
- for each row execute function tinbase.cdc_notify();
3865
+ for each row execute function supacloud_lite.cdc_notify();
3773
3866
  end if;
3774
3867
  end $$;
3775
3868
  `);
@@ -3803,7 +3896,7 @@ class Database {
3803
3896
  }
3804
3897
  }
3805
3898
  async attachCdcListener() {
3806
- this.cdcUnsubscribe = await this.engine.listen("tinbase_cdc", (payload) => {
3899
+ this.cdcUnsubscribe = await this.engine.listen("supacloud_lite_cdc", (payload) => {
3807
3900
  try {
3808
3901
  const event = JSON.parse(payload);
3809
3902
  for (const listener of this.cdcListeners)
@@ -3891,7 +3984,7 @@ async function sha256Hex(text) {
3891
3984
  return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("");
3892
3985
  }
3893
3986
 
3894
- // src/vendor/tinbase/realtime/engine.ts
3987
+ // src/runtime/realtime/engine.ts
3895
3988
  class RealtimeEngine {
3896
3989
  db;
3897
3990
  jwtSecret;
@@ -3956,7 +4049,7 @@ class RealtimeEngine {
3956
4049
  if (this.stopCdc)
3957
4050
  return;
3958
4051
  this.stopCdc = await this.db.onCdcEvent((e) => this.dispatchCdc(e));
3959
- this.stopDbBroadcast = await this.db.engine.listen("tinbase_realtime_broadcast", (payload) => {
4052
+ this.stopDbBroadcast = await this.db.engine.listen("supacloud_lite_realtime_broadcast", (payload) => {
3960
4053
  try {
3961
4054
  this.dispatchDbBroadcast(JSON.parse(payload));
3962
4055
  } catch {}
@@ -4428,7 +4521,7 @@ function encodeUserBroadcast(topic, event, payload) {
4428
4521
  return out;
4429
4522
  }
4430
4523
 
4431
- // src/vendor/tinbase/types.ts
4524
+ // src/runtime/types.ts
4432
4525
  var DEFAULT_JWT_SECRET = "";
4433
4526
 
4434
4527
  class ApiError extends Error {
@@ -4441,7 +4534,7 @@ class ApiError extends Error {
4441
4534
  }
4442
4535
  }
4443
4536
 
4444
- // src/vendor/tinbase/rest/parse.ts
4537
+ // src/runtime/rest/parse.ts
4445
4538
  class ParseError extends Error {
4446
4539
  }
4447
4540
  var RESERVED = new Set(["select", "order", "limit", "offset", "on_conflict", "columns"]);
@@ -4715,7 +4808,7 @@ function findAliasColon(item) {
4715
4808
  return -1;
4716
4809
  }
4717
4810
 
4718
- // src/vendor/tinbase/rest/build.ts
4811
+ // src/runtime/rest/build.ts
4719
4812
  var AGG_EMPTY = `'[]'::json`;
4720
4813
 
4721
4814
  class QueryBuilder {
@@ -5223,7 +5316,7 @@ function renderFilter(f, alias) {
5223
5316
  return f.negated ? `not (${expr})` : expr;
5224
5317
  }
5225
5318
 
5226
- // src/vendor/tinbase/rest/errors.ts
5319
+ // src/runtime/rest/errors.ts
5227
5320
  function statusForSqlState(code) {
5228
5321
  switch (code) {
5229
5322
  case "42501":
@@ -5269,7 +5362,7 @@ function jsonResponse(status, body, headers = {}) {
5269
5362
  });
5270
5363
  }
5271
5364
 
5272
- // src/vendor/tinbase/rest/handler.ts
5365
+ // src/runtime/rest/handler.ts
5273
5366
  function parsePrefer(header) {
5274
5367
  const prefer = {};
5275
5368
  if (!header)
@@ -5679,7 +5772,7 @@ async function readJsonBody(req) {
5679
5772
  }
5680
5773
  }
5681
5774
 
5682
- // src/vendor/tinbase/storage/driver.ts
5775
+ // src/runtime/storage/driver.ts
5683
5776
  class MemoryStorageDriver {
5684
5777
  files = new Map;
5685
5778
  async put(key, data) {
@@ -5697,7 +5790,7 @@ class MemoryStorageDriver {
5697
5790
  }
5698
5791
  }
5699
5792
 
5700
- // src/vendor/tinbase/storage/image-transform.ts
5793
+ // src/runtime/storage/image-transform.ts
5701
5794
  var IMAGE_FORMAT_CONTENT_TYPES = {
5702
5795
  jpeg: "image/jpeg",
5703
5796
  png: "image/png",
@@ -5883,7 +5976,7 @@ async function transformImage(bytes, options) {
5883
5976
  }
5884
5977
  }
5885
5978
 
5886
- // src/vendor/tinbase/storage/handler.ts
5979
+ // src/runtime/storage/handler.ts
5887
5980
  var MAX_SIGNED_URL_EXPIRY = 7 * 24 * 60 * 60;
5888
5981
  function clampExpiry(expiresIn) {
5889
5982
  if (!Number.isFinite(expiresIn) || expiresIn <= 0)
@@ -5909,6 +6002,29 @@ function invalidObjectKey(key) {
5909
6002
  function storageError(status, error, message) {
5910
6003
  return json3(status, { statusCode: String(status), error, message });
5911
6004
  }
6005
+ var RLS_POLICY_HINT = "Upload denied by storage.objects RLS. Create a policy in supabase/migrations, e.g. " + "`create policy \"objects insert\" on storage.objects for insert to authenticated with check (bucket_id = '<bucket>');`. " + "Without a policy, RLS blocks every write by default.";
6006
+
6007
+ class RlsPolicyError extends Error {
6008
+ cause;
6009
+ constructor(cause) {
6010
+ super("storage.objects row-level security policy denied the write");
6011
+ this.cause = cause;
6012
+ this.name = "RlsPolicyError";
6013
+ }
6014
+ }
6015
+ function rlsDeniedResponse() {
6016
+ return storageError(403, "Unauthorized", RLS_POLICY_HINT);
6017
+ }
6018
+ function isRlsDenied(error) {
6019
+ if (!error)
6020
+ return false;
6021
+ const pg = error;
6022
+ if (pg.code === "42501")
6023
+ return true;
6024
+ if (error instanceof Error && /row-level security|permission denied/i.test(error.message))
6025
+ return true;
6026
+ return false;
6027
+ }
5912
6028
  function json3(status, body) {
5913
6029
  return new Response(JSON.stringify(body), {
5914
6030
  status,
@@ -6194,6 +6310,8 @@ class StorageHandler {
6194
6310
  const id = await this.persistObject(ctx, bucketId, key, bytes, contentType, cacheControl, upsert);
6195
6311
  return json3(200, { Key: `${bucketId}/${key}`, Id: id });
6196
6312
  } catch (e) {
6313
+ if (e instanceof RlsPolicyError)
6314
+ return rlsDeniedResponse();
6197
6315
  const pg = e;
6198
6316
  if (pg.code === "23505") {
6199
6317
  return storageError(409, "Duplicate", "The resource already exists");
@@ -6231,6 +6349,12 @@ class StorageHandler {
6231
6349
  values ($1, $2, $3, $4, $5::jsonb, $6) ${conflictClause} returning *`, [objectId, bucketId, key, ctx.claims?.sub ?? null, JSON.stringify(metadata), version]));
6232
6350
  inserted = result.rows[0];
6233
6351
  } catch (error) {
6352
+ if (isRlsDenied(error)) {
6353
+ try {
6354
+ await this.driver.delete(stagedKey);
6355
+ } catch {}
6356
+ throw new RlsPolicyError(error);
6357
+ }
6234
6358
  await this.discardStagedBytes(stagedKey, error);
6235
6359
  }
6236
6360
  if (!inserted)
@@ -6288,6 +6412,8 @@ class StorageHandler {
6288
6412
  try {
6289
6413
  await this.persistObject(ctx, bucketId, key, new Uint8Array, contentType, meta.cacheControl ?? "no-cache", upsert);
6290
6414
  } catch (error) {
6415
+ if (error instanceof RlsPolicyError)
6416
+ return rlsDeniedResponse();
6291
6417
  const pg = error;
6292
6418
  if (pg.code === "23505")
6293
6419
  return storageError(409, "Duplicate", "The resource already exists");
@@ -6418,6 +6544,8 @@ class StorageHandler {
6418
6544
  await this.persistObject(upload.ctx, upload.bucketId, upload.key, data, upload.contentType, upload.cacheControl, upload.upsert);
6419
6545
  } catch (e) {
6420
6546
  this.tusUploads.delete(id);
6547
+ if (e instanceof RlsPolicyError)
6548
+ return rlsDeniedResponse();
6421
6549
  const pg = e;
6422
6550
  if (pg.code === "23505")
6423
6551
  return storageError(409, "Duplicate", "The resource already exists");
@@ -6463,7 +6591,7 @@ class StorageHandler {
6463
6591
  if (pg.code === "23505")
6464
6592
  return storageError(409, "Duplicate", "The resource already exists");
6465
6593
  if (pg.code === "42501" || error instanceof Error && /row-level security|permission denied/i.test(error.message)) {
6466
- return storageError(403, "Unauthorized", "new row violates row-level security policy");
6594
+ return rlsDeniedResponse();
6467
6595
  }
6468
6596
  throw error;
6469
6597
  }
@@ -6930,7 +7058,7 @@ function parseTusMetadata(header) {
6930
7058
  return out;
6931
7059
  }
6932
7060
 
6933
- // src/vendor/tinbase/net/service.ts
7061
+ // src/runtime/net/service.ts
6934
7062
  var MAX_RESPONSE_BYTES = 10 * 1024 * 1024;
6935
7063
  var MAX_REDIRECTS = 5;
6936
7064
  function blockedNetTarget(rawUrl) {
@@ -7127,7 +7255,7 @@ async function readCapped(res, maxBytes) {
7127
7255
  return new TextDecoder().decode(merged);
7128
7256
  }
7129
7257
 
7130
- // src/vendor/tinbase/webhooks/service.ts
7258
+ // src/runtime/webhooks/service.ts
7131
7259
  class WebhooksService {
7132
7260
  db;
7133
7261
  fetchImpl;
@@ -7215,7 +7343,7 @@ class WebhooksService {
7215
7343
  }
7216
7344
  }
7217
7345
 
7218
- // src/vendor/tinbase/cron/service.ts
7346
+ // src/runtime/cron/service.ts
7219
7347
  class CronService {
7220
7348
  db;
7221
7349
  tickMs;
@@ -7360,7 +7488,7 @@ function matchPart(part, value, min, max) {
7360
7488
  return (value - lo) % step === 0;
7361
7489
  }
7362
7490
 
7363
- // src/vendor/tinbase/retention/service.ts
7491
+ // src/runtime/retention/service.ts
7364
7492
  var DAY_MS = 24 * 60 * 60 * 1000;
7365
7493
 
7366
7494
  class RetentionService {
@@ -7434,7 +7562,7 @@ class RetentionService {
7434
7562
  }
7435
7563
  }
7436
7564
 
7437
- // src/vendor/tinbase/security.ts
7565
+ // src/runtime/security.ts
7438
7566
  var LOOPBACK_HOSTS = new Set(["127.0.0.1", "localhost", "::1", "", undefined]);
7439
7567
  function isNetworkExposed(host) {
7440
7568
  return !LOOPBACK_HOSTS.has(host);
@@ -7458,7 +7586,7 @@ function assertSecretsSafe(input) {
7458
7586
  warn("\u26A0 Vault key derived from the JWT secret - set an independent vaultKey before exposing this server.");
7459
7587
  }
7460
7588
  }
7461
- // src/vendor/tinbase/gen-types.ts
7589
+ // src/runtime/gen-types.ts
7462
7590
  var JSON_TYPE = "Json";
7463
7591
  async function generateTypes(db, schema = "public") {
7464
7592
  const enums = await loadEnums(db, schema);
@@ -7684,7 +7812,7 @@ async function loadFunctions(db, schema) {
7684
7812
  args_json: parseIdentityArgs(r.identity_args)
7685
7813
  }));
7686
7814
  }
7687
- // src/vendor/tinbase/db/schema-diff.ts
7815
+ // src/runtime/db/schema-diff.ts
7688
7816
  async function snapshotSchema(db, schema = "public") {
7689
7817
  const cols = await db.query(`select c.relname as table, a.attname as column,
7690
7818
  format_type(a.atttypid, a.atttypmod) as type,
@@ -7845,7 +7973,7 @@ function diffNamed(from, to, ops) {
7845
7973
  }
7846
7974
  }
7847
7975
  }
7848
- // src/vendor/tinbase/db/inspect.ts
7976
+ // src/runtime/db/inspect.ts
7849
7977
  async function inspectDb(db, schema = "public") {
7850
7978
  const tables = await db.query(`select c.relname as table,
7851
7979
  pg_size_pretty(pg_total_relation_size(c.oid)) as size
@@ -7861,7 +7989,7 @@ async function inspectDb(db, schema = "public") {
7861
7989
  return out;
7862
7990
  }
7863
7991
 
7864
- // src/vendor/tinbase/index.ts
7992
+ // src/runtime/index.ts
7865
7993
  var CORS_HEADERS = {
7866
7994
  "access-control-allow-origin": "*",
7867
7995
  "access-control-allow-methods": "GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD",
@@ -8148,7 +8276,7 @@ function withCors(res) {
8148
8276
  return res;
8149
8277
  }
8150
8278
 
8151
- // src/vendor/tinbase/node/db-diff.ts
8279
+ // src/runtime/node/db-diff.ts
8152
8280
  import { mkdir as mkdir2, writeFile } from "fs/promises";
8153
8281
  import { join } from "path";
8154
8282
  async function computeDbDiff(opts) {
@@ -8235,7 +8363,7 @@ async function closeBackends(...backends) {
8235
8363
  throw failed.reason;
8236
8364
  }
8237
8365
 
8238
- // src/vendor/tinbase/node/project.ts
8366
+ // src/runtime/node/project.ts
8239
8367
  import { readdir, readFile as readFile2 } from "fs/promises";
8240
8368
  import { join as join2 } from "path";
8241
8369
  async function loadSupabaseProject(projectDir, seed = {}) {
@@ -8284,7 +8412,7 @@ function isNotFound(error) {
8284
8412
  import { chmod, link, lstat, mkdir as mkdir5, readFile as readFile6, realpath as realpath2, unlink as unlink3, writeFile as writeFile4 } from "fs/promises";
8285
8413
  import { dirname as dirname3, isAbsolute, join as join7, parse, relative, resolve as resolve2 } from "path";
8286
8414
 
8287
- // src/vendor/tinbase/node/bun-server.ts
8415
+ // src/runtime/node/bun-server.ts
8288
8416
  async function serveBun(backend, opts = {}) {
8289
8417
  const host = opts.host ?? "127.0.0.1";
8290
8418
  const server = Bun.serve({
@@ -8331,7 +8459,7 @@ async function serveBun(backend, opts = {}) {
8331
8459
  };
8332
8460
  }
8333
8461
 
8334
- // src/vendor/tinbase/node/fs-driver.ts
8462
+ // src/runtime/node/fs-driver.ts
8335
8463
  import { mkdir as mkdir3, readFile as readFile3, rename, rm, writeFile as writeFile2 } from "fs/promises";
8336
8464
  import { dirname as dirname2, join as join3, normalize, sep } from "path";
8337
8465
 
@@ -8377,7 +8505,7 @@ class FsStorageDriver {
8377
8505
  }
8378
8506
  }
8379
8507
 
8380
- // src/vendor/tinbase/node/config-toml.ts
8508
+ // src/runtime/node/config-toml.ts
8381
8509
  import { readFileSync } from "fs";
8382
8510
  import { join as join4 } from "path";
8383
8511
  function emptyTable() {
@@ -8523,7 +8651,7 @@ function getByteSize(table, key) {
8523
8651
  return Math.round(n * (mult[unit] ?? 1));
8524
8652
  }
8525
8653
 
8526
- // src/vendor/tinbase/node/load-config.ts
8654
+ // src/runtime/node/load-config.ts
8527
8655
  function loadProjectConfig(projectDir, env = process.env) {
8528
8656
  const root = loadConfigToml(projectDir, env);
8529
8657
  return {
@@ -8734,12 +8862,12 @@ function readFunctions(root) {
8734
8862
  return out;
8735
8863
  }
8736
8864
 
8737
- // src/vendor/tinbase/node/load-functions.ts
8865
+ // src/runtime/node/load-functions.ts
8738
8866
  import { readdir as readdir2, readFile as readFile5, realpath, rm as rm2, stat } from "fs/promises";
8739
8867
  import { join as join6 } from "path";
8740
8868
  import { pathToFileURL } from "url";
8741
8869
 
8742
- // src/vendor/tinbase/node/bundle-function.ts
8870
+ // src/runtime/node/bundle-function.ts
8743
8871
  import { createHash } from "crypto";
8744
8872
  import { mkdir as mkdir4, readFile as readFile4, writeFile as writeFile3 } from "fs/promises";
8745
8873
  import { existsSync } from "fs";
@@ -8803,7 +8931,7 @@ async function bundleFunction(entryPath, name) {
8803
8931
  return result.outputs[0].path;
8804
8932
  }
8805
8933
 
8806
- // src/vendor/tinbase/node/load-functions.ts
8934
+ // src/runtime/node/load-functions.ts
8807
8935
  async function loadFunctionEnv(projectDir) {
8808
8936
  let text;
8809
8937
  try {
@@ -8906,7 +9034,7 @@ async function loadFunctionsUnlocked(projectDir, options) {
8906
9034
  return functions;
8907
9035
  }
8908
9036
 
8909
- // src/vendor/tinbase/storage/s3-driver.ts
9037
+ // src/runtime/storage/s3-driver.ts
8910
9038
  function normalizePath(value, label, allowEmpty) {
8911
9039
  if (value.includes("\x00")) {
8912
9040
  throw new TypeError(`${label} must not contain null bytes`);