@supacloud/lite 0.25.0 → 0.26.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.
package/dist/index.js CHANGED
@@ -88,7 +88,7 @@ function randomToken(bytes = 32) {
88
88
  // package.json
89
89
  var package_default = {
90
90
  name: "@supacloud/lite",
91
- version: "0.25.0",
91
+ version: "0.26.0",
92
92
  description: "Bun-native, single-project Supabase-compatible backend powered by PGlite or native PostgreSQL",
93
93
  type: "module",
94
94
  license: "Apache-2.0",
@@ -115,7 +115,7 @@ var package_default = {
115
115
  ],
116
116
  scripts: {
117
117
  build: "bun run build:js && bun run build:types",
118
- "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",
118
+ "build:js": "bun run clean && bun build src/index.ts --target=bun --format=esm --outdir=dist --external @electric-sql/pglite --external @electric-sql/pglite-pgvector --external @electric-sql/pglite-postgis --external @electric-sql/pglite-pg_textsearch --external @electric-sql/pglite-pgmq --external tar && bun build src/cli.ts --target=bun --format=esm --outdir=dist --external @electric-sql/pglite --external @electric-sql/pglite-pgvector --external @electric-sql/pglite-postgis --external @electric-sql/pglite-pg_textsearch --external @electric-sql/pglite-pgmq --external tar && bun run scripts/build-launcher.ts",
119
119
  "build:standalone:host": "bun run scripts/build-standalone.ts host",
120
120
  "build:standalone:linux-x64": "bun run scripts/build-standalone.ts linux-x64",
121
121
  "build:standalone:linux": "bun run scripts/build-standalone.ts linux-x64 linux-arm64",
@@ -143,10 +143,14 @@ var package_default = {
143
143
  },
144
144
  dependencies: {
145
145
  "@electric-sql/pglite": "0.5.8",
146
+ "@electric-sql/pglite-pg_textsearch": "0.0.10",
147
+ "@electric-sql/pglite-pgmq": "0.0.6",
148
+ "@electric-sql/pglite-pgvector": "0.0.9",
149
+ "@electric-sql/pglite-postgis": "0.2.8",
146
150
  "@supacloud/db": "^0.6.0",
147
151
  "exact-mirror": "1.2.6",
148
152
  tar: "^7.5.22",
149
- typebox: "1.3.34"
153
+ typebox: "1.3.36"
150
154
  },
151
155
  devDependencies: {
152
156
  "@supacloud/app": "file:../app",
@@ -156,7 +160,7 @@ var package_default = {
156
160
  "@types/bun": "^1.4.2",
157
161
  effect: "4.0.2",
158
162
  elysia: "2.0.0-beta.21",
159
- jose: "^6.2.11",
163
+ jose: "^6.2.12",
160
164
  typescript: "^7.0.2"
161
165
  },
162
166
  overrides: {
@@ -3258,7 +3262,10 @@ create schema if not exists extensions;
3258
3262
  do $$
3259
3263
  declare ext text;
3260
3264
  begin
3261
- foreach ext in array array['uuid-ossp','pgcrypto','citext','pg_trgm','ltree','hstore','fuzzystrmatch'] loop
3265
+ foreach ext in array array[
3266
+ 'uuid-ossp','pgcrypto','citext','pg_trgm','ltree','hstore','fuzzystrmatch',
3267
+ 'vector','postgis','pg_textsearch'
3268
+ ] loop
3262
3269
  begin
3263
3270
  execute format('create extension if not exists %I with schema extensions', ext);
3264
3271
  exception when others then
@@ -3267,6 +3274,19 @@ begin
3267
3274
  end loop;
3268
3275
  end $$;
3269
3276
 
3277
+ -- The official pgmq extension owns its required pgmq schema. PGlite and
3278
+ -- native PostgreSQL builds that do not provide it simply continue to Lite's
3279
+ -- SQL fallback during database initialization.
3280
+ create schema if not exists pgmq;
3281
+ do $$
3282
+ begin
3283
+ begin
3284
+ create extension if not exists pgmq with schema pgmq;
3285
+ exception when others then
3286
+ null;
3287
+ end;
3288
+ end $$;
3289
+
3270
3290
  -- uuid-ossp isn't in every Postgres build (it needs an external UUID lib at
3271
3291
  -- build time - e.g. the theseus Linux binaries omit it). uuid_generate_v4() is
3272
3292
  -- the single most-used function from it, so shim it onto core gen_random_uuid()
@@ -3769,7 +3789,7 @@ grant execute on function realtime.send(jsonb, text, text, boolean) to anon, aut
3769
3789
  `;
3770
3790
 
3771
3791
  // src/runtime/db/emulated.ts
3772
- var PGMQ_SQL = `
3792
+ var PGMQ_CORE_SQL = `
3773
3793
  create schema if not exists pgmq;
3774
3794
  revoke all on schema pgmq from public, anon, authenticated;
3775
3795
  grant usage on schema pgmq to service_role;
@@ -3954,6 +3974,8 @@ $pgmq$;
3954
3974
  revoke all on all functions in schema pgmq from public, anon, authenticated;
3955
3975
  grant execute on all functions in schema pgmq to service_role;
3956
3976
 
3977
+ `;
3978
+ var PGMQ_PUBLIC_SQL = `
3957
3979
  -- supacloud:sql-module:pgmq-public:start
3958
3980
  DO $pgmq_extension$
3959
3981
  BEGIN
@@ -4260,6 +4282,8 @@ GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA pgmq_public TO anon, authenticated, ser
4260
4282
  NOTIFY pgrst, 'reload schema';
4261
4283
  -- supacloud:sql-module:pgmq-public:end
4262
4284
  `;
4285
+ var PGMQ_SQL = `${PGMQ_CORE_SQL}
4286
+ ${PGMQ_PUBLIC_SQL}`;
4263
4287
  var WORKFLOWS_SQL = `
4264
4288
  -- supacloud:sql-module:workflows-public:start
4265
4289
  DO $pgmq_extension$
@@ -6336,16 +6360,44 @@ async function createPgliteEngine(dataDir, options = {}) {
6336
6360
  let cleanupStandaloneBundles = async () => {};
6337
6361
  try {
6338
6362
  ({ PGlite } = await import("@electric-sql/pglite"));
6339
- const [uuid_ossp, pgcrypto, citext, pg_trgm, ltree, hstore, fuzzystrmatch] = await Promise.all([
6363
+ const [
6364
+ uuid_ossp,
6365
+ pgcrypto,
6366
+ citext,
6367
+ pg_trgm,
6368
+ ltree,
6369
+ hstore,
6370
+ fuzzystrmatch,
6371
+ vector,
6372
+ postgis,
6373
+ pg_textsearch,
6374
+ pgmq
6375
+ ] = await Promise.all([
6340
6376
  import("@electric-sql/pglite/contrib/uuid_ossp").then((m) => m.uuid_ossp),
6341
6377
  import("@electric-sql/pglite/contrib/pgcrypto").then((m) => m.pgcrypto),
6342
6378
  import("@electric-sql/pglite/contrib/citext").then((m) => m.citext),
6343
6379
  import("@electric-sql/pglite/contrib/pg_trgm").then((m) => m.pg_trgm),
6344
6380
  import("@electric-sql/pglite/contrib/ltree").then((m) => m.ltree),
6345
6381
  import("@electric-sql/pglite/contrib/hstore").then((m) => m.hstore),
6346
- import("@electric-sql/pglite/contrib/fuzzystrmatch").then((m) => m.fuzzystrmatch)
6382
+ import("@electric-sql/pglite/contrib/fuzzystrmatch").then((m) => m.fuzzystrmatch),
6383
+ import("@electric-sql/pglite-pgvector").then((m) => m.vector),
6384
+ import("@electric-sql/pglite-postgis").then((m) => m.postgis),
6385
+ import("@electric-sql/pglite-pg_textsearch").then((m) => m.pg_textsearch),
6386
+ import("@electric-sql/pglite-pgmq").then((m) => m.pgmq)
6347
6387
  ]);
6348
- extensions = { uuid_ossp, pgcrypto, citext, pg_trgm, ltree, hstore, fuzzystrmatch };
6388
+ extensions = {
6389
+ uuid_ossp,
6390
+ pgcrypto,
6391
+ citext,
6392
+ pg_trgm,
6393
+ ltree,
6394
+ hstore,
6395
+ fuzzystrmatch,
6396
+ vector,
6397
+ postgis,
6398
+ pg_textsearch,
6399
+ pgmq
6400
+ };
6349
6401
  } catch (error) {
6350
6402
  await releaseLock();
6351
6403
  if (error instanceof Error && /wasm/.test(error.message))
@@ -6363,7 +6415,11 @@ async function createPgliteEngine(dataDir, options = {}) {
6363
6415
  pg_trgm: withEmbeddedBundle(extensions.pg_trgm, standaloneBundles.bundles.pg_trgm),
6364
6416
  ltree: withEmbeddedBundle(extensions.ltree, standaloneBundles.bundles.ltree),
6365
6417
  hstore: withEmbeddedBundle(extensions.hstore, standaloneBundles.bundles.hstore),
6366
- fuzzystrmatch: withEmbeddedBundle(extensions.fuzzystrmatch, standaloneBundles.bundles.fuzzystrmatch)
6418
+ fuzzystrmatch: withEmbeddedBundle(extensions.fuzzystrmatch, standaloneBundles.bundles.fuzzystrmatch),
6419
+ vector: withEmbeddedBundle(extensions.vector, standaloneBundles.bundles.vector),
6420
+ postgis: withEmbeddedBundle(extensions.postgis, standaloneBundles.bundles.postgis),
6421
+ pg_textsearch: withEmbeddedBundle(extensions.pg_textsearch, standaloneBundles.bundles.pg_textsearch),
6422
+ pgmq: withEmbeddedBundle(extensions.pgmq, standaloneBundles.bundles.pgmq)
6367
6423
  };
6368
6424
  } catch (error) {
6369
6425
  await removePreparedBundles(cleanupStandaloneBundles);
@@ -6509,7 +6565,8 @@ class Database {
6509
6565
  await engine.exec(MINIMAL_BOOTSTRAP_SQL);
6510
6566
  } else {
6511
6567
  await engine.exec(BOOTSTRAP_SQL);
6512
- await engine.exec(PGMQ_SQL);
6568
+ const pgmqExtension = await engine.query(`select extname from pg_extension where extname = 'pgmq' limit 1`);
6569
+ await engine.exec(pgmqExtension.rows.length > 0 ? PGMQ_PUBLIC_SQL : PGMQ_SQL);
6513
6570
  await engine.exec(WORKFLOWS_SQL);
6514
6571
  await engine.exec(CRON_SQL);
6515
6572
  await engine.exec(NET_SQL);
@@ -12876,12 +12933,21 @@ function removeStalePidFile(pidPath) {
12876
12933
  }
12877
12934
  // src/runtime/node/native/readiness.ts
12878
12935
  function liteCapabilities(engine, replicationProfile) {
12936
+ const extensionSource = engine === "native" ? "native-postgresql" : "pglite-bundled";
12879
12937
  const common = {
12880
12938
  graphql: { status: "unverified", extension: "pg_graphql", reason: "DATABASE_NOT_INSPECTED" },
12881
12939
  runtime_mode: "development",
12882
12940
  identity: { mode: "local", verification: "built-in" },
12883
12941
  migrations: { formats: ["flat-sql", "timestamp-folder"], content_check: "supported", target_bindings: "supported" },
12884
- project_release_manifests: "unsupported"
12942
+ project_release_manifests: "unsupported",
12943
+ postgres_extensions: {
12944
+ engine,
12945
+ source: extensionSource,
12946
+ status: "unavailable",
12947
+ available: [],
12948
+ installed: [],
12949
+ reason: "DATABASE_NOT_INSPECTED"
12950
+ }
12885
12951
  };
12886
12952
  if (engine === "pglite") {
12887
12953
  return {
@@ -13112,6 +13178,37 @@ function normalizeCatalogTable(value) {
13112
13178
  function sameStrings(left, right) {
13113
13179
  return left.length === right.length && left.every((value, index) => value === right[index]);
13114
13180
  }
13181
+ // src/runtime/node/native/extensions.ts
13182
+ async function inspectPostgresExtensions(engine, source) {
13183
+ try {
13184
+ const [available, installed] = await Promise.all([
13185
+ engine.query(`
13186
+ SELECT name, default_version, installed_version, comment
13187
+ FROM pg_available_extensions
13188
+ ORDER BY name
13189
+ `),
13190
+ engine.query(`
13191
+ SELECT extname AS name, extversion AS version
13192
+ FROM pg_extension
13193
+ ORDER BY extname
13194
+ `)
13195
+ ]);
13196
+ return {
13197
+ source,
13198
+ status: "inspected",
13199
+ available: available.rows,
13200
+ installed: installed.rows
13201
+ };
13202
+ } catch (error) {
13203
+ return {
13204
+ source,
13205
+ status: "unavailable",
13206
+ available: [],
13207
+ installed: [],
13208
+ reason: error instanceof Error ? error.message : String(error)
13209
+ };
13210
+ }
13211
+ }
13115
13212
  // src/project-runtime.ts
13116
13213
  import { chmod, link, lstat as lstat2, mkdir as mkdir4, readFile as readFile6, realpath as realpath2, unlink as unlink2, writeFile as writeFile4 } from "fs/promises";
13117
13214
  import { dirname as dirname4, isAbsolute, join as join7, parse, relative, resolve as resolve3 } from "path";
@@ -14820,6 +14917,7 @@ export {
14820
14917
  generateTypes,
14821
14918
  inspectDb,
14822
14919
  inspectGraphql,
14920
+ inspectPostgresExtensions,
14823
14921
  inspectPowerSyncReadiness,
14824
14922
  isNativeEngineSupported,
14825
14923
  liteCapabilities,
@@ -17,5 +17,5 @@ export declare const MINIMAL_BOOTSTRAP_SQL = "\ncreate schema if not exists auth
17
17
  * schema, storage schema with default RLS policies, migration bookkeeping, and
18
18
  * the realtime CDC + broadcast plumbing.
19
19
  */
20
- export declare const BOOTSTRAP_SQL = "\n-- \u2500\u2500 Extensions \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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n-- Supabase enables these by default and migrations lean on them\n-- (uuid_generate_v4(), crypt(), citext, pg_trgm, \u2026). Each is created into the\n-- 'extensions' schema like hosted Supabase; any not available in this engine\n-- build is skipped rather than aborting the whole bootstrap.\ncreate schema if not exists extensions;\ndo $$\ndeclare ext text;\nbegin\n foreach ext in array array['uuid-ossp','pgcrypto','citext','pg_trgm','ltree','hstore','fuzzystrmatch'] loop\n begin\n execute format('create extension if not exists %I with schema extensions', ext);\n exception when others then\n -- extension not bundled in this engine build; continue\n end;\n end loop;\nend $$;\n\n-- uuid-ossp isn't in every Postgres build (it needs an external UUID lib at\n-- build time - e.g. the theseus Linux binaries omit it). uuid_generate_v4() is\n-- the single most-used function from it, so shim it onto core gen_random_uuid()\n-- (also a v4 UUID) whenever the real extension isn't present, so migrations\n-- that call it work identically on every engine and platform.\ndo $$\nbegin\n if not exists (\n select 1 from pg_proc p join pg_namespace n on n.oid = p.pronamespace\n where p.proname = 'uuid_generate_v4' and n.nspname in ('public', 'extensions')\n ) then\n create function extensions.uuid_generate_v4() returns uuid\n language sql volatile as 'select gen_random_uuid()';\n end if;\nend $$;\n\n-- Make extension functions resolvable unqualified (uuid_generate_v4(), \u2026) on\n-- the current session (migrations run here) and for future connections.\ndo $$\nbegin\n execute 'alter database ' || quote_ident(current_database()) ||\n ' set search_path to \"$user\", public, extensions';\nexception when others then\n -- some engines disallow altering the current database; session SET below still applies\nend $$;\nset search_path to \"$user\", public, extensions;\n\n-- \u2500\u2500 Roles \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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\ndo $$\nbegin\n if not exists (select from pg_roles where rolname = 'anon') then\n create role anon nologin noinherit;\n end if;\n if not exists (select from pg_roles where rolname = 'authenticated') then\n create role authenticated nologin noinherit;\n end if;\n if not exists (select from pg_roles where rolname = 'service_role') then\n create role service_role nologin noinherit bypassrls;\n end if;\nend $$;\n\ngrant usage on schema extensions to anon, authenticated, service_role;\nalter role anon set search_path to \"$user\", public, extensions;\nalter role authenticated set search_path to \"$user\", public, extensions;\nalter role service_role set search_path to \"$user\", public, extensions;\n\n-- Initialize defaults once. Restart/maintenance must not undo application ACLs.\ndo $$\nbegin\n if to_regclass('supabase_migrations.schema_migrations') is null then\n grant usage on schema public to anon, authenticated, service_role;\n alter default privileges in schema public\n grant all on tables to anon, authenticated, service_role;\n alter default privileges in schema public\n grant all on sequences to anon, authenticated, service_role;\n end if;\nend $$;\n\n-- PostgreSQL already grants EXECUTE on new functions to PUBLIC. Keep that\n-- default so project migrations can revoke PUBLIC and grant only selected\n-- roles without hidden direct grants from Lite. Existing ACLs are left intact.\n\n-- \u2500\u2500 Auth schema (GoTrue-compatible subset) \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\ncreate schema if not exists auth;\n\ncreate table if not exists auth.users (\n instance_id uuid default '00000000-0000-0000-0000-000000000000',\n id uuid primary key default gen_random_uuid(),\n aud text default 'authenticated',\n role text default 'authenticated',\n email text unique,\n encrypted_password text,\n email_confirmed_at timestamptz,\n invited_at timestamptz,\n confirmation_token text default '',\n confirmation_sent_at timestamptz,\n recovery_token text default '',\n recovery_sent_at timestamptz,\n email_change_token_new text default '',\n email_change text default '',\n email_change_sent_at timestamptz,\n email_change_token_current text default '',\n email_change_confirm_status smallint default 0,\n last_sign_in_at timestamptz,\n raw_app_meta_data jsonb default '{}'::jsonb,\n raw_user_meta_data jsonb default '{}'::jsonb,\n is_super_admin boolean default false,\n created_at timestamptz default now(),\n updated_at timestamptz default now(),\n phone text unique,\n phone_confirmed_at timestamptz,\n phone_change text default '',\n phone_change_token text default '',\n phone_change_sent_at timestamptz,\n reauthentication_token text default '',\n reauthentication_sent_at timestamptz,\n banned_until timestamptz,\n deleted_at timestamptz,\n is_anonymous boolean default false\n);\n\ncreate table if not exists auth.refresh_tokens (\n id bigint generated by default as identity primary key,\n token text unique not null,\n user_id uuid not null references auth.users(id) on delete cascade,\n parent text,\n session_id uuid,\n revoked boolean default false,\n created_at timestamptz default now(),\n updated_at timestamptz default now()\n);\n\ncreate index if not exists refresh_tokens_user_id_idx on auth.refresh_tokens(user_id);\n\ncreate table if not exists auth.one_time_tokens (\n id uuid primary key default gen_random_uuid(),\n user_id uuid references auth.users(id) on delete cascade,\n email text,\n phone text,\n token_type text not null, -- otp | magiclink | recovery | sms\n token text not null,\n attempts int not null default 0,\n created_at timestamptz default now(),\n expires_at timestamptz not null,\n constraint one_time_tokens_contact_check check (\n (email is not null and phone is null) or (email is null and phone is not null)\n )\n);\n\n-- Upgrade databases created by Lite <=0.5.9 without touching existing email tokens.\nalter table auth.one_time_tokens add column if not exists phone text;\nalter table auth.one_time_tokens alter column email drop not null;\ndo $phone_otp_contact_constraint$\nbegin\n if not exists (\n select 1 from pg_constraint\n where conrelid = 'auth.one_time_tokens'::regclass\n and conname = 'one_time_tokens_contact_check'\n ) then\n alter table auth.one_time_tokens add constraint one_time_tokens_contact_check check (\n (email is not null and phone is null) or (email is null and phone is not null)\n );\n end if;\nend $phone_otp_contact_constraint$;\n\ncreate unique index if not exists one_time_tokens_phone_type_idx\n on auth.one_time_tokens(phone, token_type) where phone is not null;\n\n-- Only a keyed phone fingerprint is persisted for cooldown enforcement; the\n-- normalized phone number never enters this table.\ncreate table if not exists auth.phone_otp_cooldowns (\n phone_fingerprint text primary key,\n issuance_id uuid not null,\n last_sent_at timestamptz not null default now()\n);\n\ncreate table if not exists auth.identities (\n id uuid primary key default gen_random_uuid(),\n user_id uuid not null references auth.users(id) on delete cascade,\n provider text not null,\n provider_id text not null,\n identity_data jsonb default '{}'::jsonb,\n last_sign_in_at timestamptz default now(),\n created_at timestamptz default now(),\n updated_at timestamptz default now(),\n unique (provider, provider_id)\n);\n\n-- OAuth / PKCE flow state, bridging /authorize \u2192 provider \u2192 /callback \u2192 exchange\ncreate table if not exists auth.flow_state (\n id uuid primary key default gen_random_uuid(),\n provider text not null,\n provider_state text not null unique,\n redirect_to text,\n code_challenge text,\n code_challenge_method text,\n auth_code text unique,\n user_id uuid references auth.users(id) on delete cascade,\n created_at timestamptz default now(),\n expires_at timestamptz not null\n);\n\ncreate table if not exists auth.mfa_factors (\n id uuid primary key default gen_random_uuid(),\n user_id uuid not null references auth.users(id) on delete cascade,\n friendly_name text,\n factor_type text not null default 'totp',\n status text not null default 'unverified', -- unverified | verified\n secret text,\n created_at timestamptz default now(),\n updated_at timestamptz default now()\n);\n\ncreate table if not exists auth.mfa_challenges (\n id uuid primary key default gen_random_uuid(),\n factor_id uuid not null references auth.mfa_factors(id) on delete cascade,\n verified_at timestamptz,\n created_at timestamptz default now(),\n expires_at timestamptz not null\n);\n\n-- append-only security audit trail (GoTrue-compatible shape)\ncreate table if not exists auth.audit_log_entries (\n instance_id uuid default '00000000-0000-0000-0000-000000000000',\n id uuid primary key default gen_random_uuid(),\n payload jsonb,\n created_at timestamptz default now(),\n ip_address varchar(64) not null default ''\n);\ncreate index if not exists audit_logs_instance_id_idx on auth.audit_log_entries(created_at);\n\n-- runtime-mutable instance settings (Studio auth toggles)\ncreate table if not exists auth.config (\n key text primary key,\n value jsonb not null,\n updated_at timestamptz default now()\n);\n\ngrant usage on schema auth to anon, authenticated, service_role;\n\ncreate or replace function auth.jwt() returns jsonb\nlanguage sql stable as $$\n select coalesce(\n nullif(current_setting('request.jwt.claims', true), ''),\n '{}'\n )::jsonb\n$$;\n\ncreate or replace function auth.uid() returns uuid\nlanguage sql stable as $$\n select nullif(auth.jwt() ->> 'sub', '')::uuid\n$$;\n\ncreate or replace function auth.role() returns text\nlanguage sql stable as $$\n select coalesce(auth.jwt() ->> 'role', 'anon')\n$$;\n\ncreate or replace function auth.email() returns text\nlanguage sql stable as $$\n select auth.jwt() ->> 'email'\n$$;\n\ngrant execute on function auth.jwt(), auth.uid(), auth.role(), auth.email()\n to anon, authenticated, service_role;\n\n-- \u2500\u2500 Storage schema (storage-api-compatible subset) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\ncreate schema if not exists storage;\n\ncreate table if not exists storage.buckets (\n id text primary key,\n name text not null unique,\n owner uuid,\n owner_id text,\n public boolean default false,\n file_size_limit bigint,\n allowed_mime_types text[],\n created_at timestamptz default now(),\n updated_at timestamptz default now()\n);\n\nalter table storage.buckets add column if not exists owner_id text;\nupdate storage.buckets\nset owner_id = owner::text\nwhere owner_id is null and owner is not null;\n\ncreate table if not exists storage.objects (\n id uuid primary key default gen_random_uuid(),\n bucket_id text not null references storage.buckets(id),\n name text not null,\n owner uuid,\n owner_id text,\n version text,\n metadata jsonb default '{}'::jsonb,\n created_at timestamptz default now(),\n updated_at timestamptz default now(),\n last_accessed_at timestamptz default now(),\n unique (bucket_id, name)\n);\n\n-- storage-api keeps the legacy UUID owner and the current text owner_id in\n-- parallel. Re-running bootstrap upgrades existing Lite databases and retains\n-- object ownership for rows created before owner_id support was added.\nalter table storage.objects add column if not exists owner_id text;\nupdate storage.objects\nset owner_id = owner::text\nwhere owner_id is null and owner is not null;\n\ncreate index if not exists objects_bucket_name_idx on storage.objects(bucket_id, name);\n\ngrant usage on schema storage to anon, authenticated, service_role;\ngrant select on storage.buckets to anon, authenticated, service_role;\ngrant all on storage.buckets to service_role;\ngrant all on storage.objects to anon, authenticated, service_role;\n\ncreate or replace function storage.foldername(name text) returns text[]\nlanguage sql immutable as $$\n select (string_to_array(name, '/'))[1 : array_length(string_to_array(name, '/'), 1) - 1]\n$$;\n\ncreate or replace function storage.filename(name text) returns text\nlanguage sql immutable as $$\n select (string_to_array(name, '/'))[array_length(string_to_array(name, '/'), 1)]\n$$;\n\ncreate or replace function storage.extension(name text) returns text\nlanguage sql immutable as $$\n select reverse(split_part(reverse(storage.filename(name)), '.', 1))\n$$;\n\nalter table storage.objects enable row level security;\n\ndrop policy if exists supacloud_lite_authenticated_all on storage.objects;\ndrop policy if exists supacloud_lite_public_read on storage.objects;\n\ndo $legacy_policy_cleanup$\ndeclare\n legacy_prefix constant text := 'tin' || 'base';\nbegin\n execute format(\n 'drop policy if exists %I on storage.objects',\n legacy_prefix || '_authenticated_all'\n );\n execute format(\n 'drop policy if exists %I on storage.objects',\n legacy_prefix || '_public_read'\n );\nend $legacy_policy_cleanup$;\n\n-- \u2500\u2500 Migration bookkeeping (same table the Supabase CLI uses) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\ncreate schema if not exists supabase_migrations;\n\ncreate table if not exists supabase_migrations.schema_migrations (\n version text primary key,\n name text,\n statements text[],\n applied_at timestamptz default now()\n);\n\ncreate table if not exists supabase_migrations.seed_files (\n path text primary key,\n hash text,\n applied_at timestamptz default now()\n);\n\n-- \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\ndo $legacy_schema_upgrade$\ndeclare\n legacy_schema constant text := 'tin' || 'base';\nbegin\n if exists (select 1 from pg_namespace where nspname = legacy_schema)\n and not exists (select 1 from pg_namespace where nspname = 'supacloud_lite') then\n execute format('alter schema %I rename to supacloud_lite', legacy_schema);\n end if;\nend $legacy_schema_upgrade$;\n\ncreate schema if not exists supacloud_lite;\n\ncreate or replace function supacloud_lite.cdc_notify() returns trigger\nlanguage plpgsql security definer as $$\ndeclare\n payload text;\nbegin\n payload := json_build_object(\n 'schema', TG_TABLE_SCHEMA,\n 'table', TG_TABLE_NAME,\n 'type', TG_OP,\n 'commit_timestamp', to_char(now() at time zone 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"'),\n 'record', case when TG_OP in ('INSERT', 'UPDATE') then row_to_json(NEW) else null end,\n 'old_record', case when TG_OP in ('UPDATE', 'DELETE') then row_to_json(OLD) else null end\n )::text;\n -- pg_notify payloads are capped at ~8kB; degrade like Supabase does.\n if octet_length(payload) > 7500 then\n payload := json_build_object(\n 'schema', TG_TABLE_SCHEMA,\n 'table', TG_TABLE_NAME,\n 'type', TG_OP,\n 'commit_timestamp', to_char(now() at time zone 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"'),\n 'record', null,\n 'old_record', null,\n 'errors', json_build_array('Payload too large')\n )::text;\n end if;\n perform pg_notify('supacloud_lite_cdc', payload);\n return coalesce(NEW, OLD);\nend $$;\n\ndo $legacy_trigger_upgrade$\ndeclare\n legacy_schema constant text := 'tin' || 'base';\n legacy_trigger constant text := ('tin' || 'base') || '_cdc';\n trigger_record record;\n target_exists boolean;\nbegin\n for trigger_record in\n select c.oid as relation_oid, n.nspname as schema_name, c.relname as table_name\n from pg_trigger tg\n join pg_class c on c.oid = tg.tgrelid\n join pg_namespace n on n.oid = c.relnamespace\n join pg_proc p on p.oid = tg.tgfoid\n join pg_namespace pn on pn.oid = p.pronamespace\n where not tg.tgisinternal\n and tg.tgname = legacy_trigger\n and p.proname = 'cdc_notify'\n and pn.nspname in (legacy_schema, 'supacloud_lite')\n loop\n select exists (\n select 1\n from pg_trigger\n where not tgisinternal\n and tgrelid = trigger_record.relation_oid\n and tgname = 'supacloud_lite_cdc'\n ) into target_exists;\n\n execute format(\n 'drop trigger %I on %I.%I',\n legacy_trigger,\n trigger_record.schema_name,\n trigger_record.table_name\n );\n\n if not target_exists then\n execute format(\n 'create trigger supacloud_lite_cdc after insert or update or delete on %I.%I for each row execute function supacloud_lite.cdc_notify()',\n trigger_record.schema_name,\n trigger_record.table_name\n );\n end if;\n end loop;\nend $legacy_trigger_upgrade$;\n\ndo $legacy_schema_cleanup$\ndeclare\n legacy_schema constant text := 'tin' || 'base';\nbegin\n if exists (\n select 1\n from pg_proc p\n join pg_namespace n on n.oid = p.pronamespace\n where n.nspname = legacy_schema\n and p.proname = 'cdc_notify'\n and p.pronargs = 0\n ) then\n execute format('drop function %I.cdc_notify()', legacy_schema);\n end if;\n\n if exists (select 1 from pg_namespace where nspname = legacy_schema) then\n begin\n execute format('drop schema %I', legacy_schema);\n exception when dependent_objects_still_exist then\n raise notice 'SupaCloud Lite: retained non-empty legacy runtime schema';\n end;\n end if;\nend $legacy_schema_cleanup$;\n\n-- \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\n-- Mirrors Supabase Realtime: developers write RLS policies on\n-- realtime.messages using realtime.topic(); a SELECT policy grants a private\n-- channel's subscribers the right to *receive*, an INSERT policy the right to\n-- *broadcast*. realtime.send() lets the database push a broadcast to a topic.\ncreate schema if not exists realtime;\n\ncreate table if not exists realtime.messages (\n id uuid not null default gen_random_uuid(),\n topic text not null,\n extension text not null,\n event text,\n payload jsonb,\n private boolean default false,\n inserted_at timestamptz not null default now(),\n updated_at timestamptz not null default now(),\n primary key (id)\n);\nalter table realtime.messages enable row level security;\n\ngrant usage on schema realtime to anon, authenticated, service_role;\ngrant all on realtime.messages to anon, authenticated, service_role;\n\n-- the topic currently being authorized/broadcast (set per operation)\ncreate or replace function realtime.topic() returns text\n language sql stable as $$ select nullif(current_setting('realtime.topic', true), '') $$;\n\n-- push a broadcast message to all subscribers of <topic> from SQL / triggers.\n-- Delivered over the websocket by the in-process realtime engine, which listens\n-- on the 'supacloud_lite_realtime_broadcast' channel.\ncreate or replace function realtime.send(payload jsonb, event text, topic text, private boolean default true)\n returns void language plpgsql security definer as $$\nbegin\n perform pg_notify(\n 'supacloud_lite_realtime_broadcast',\n json_build_object('topic', topic, 'event', event, 'payload', payload, 'private', private)::text\n );\nexception when others then\n -- never let a notify failure abort the caller's transaction\n null;\nend $$;\n\ngrant execute on function realtime.topic() to anon, authenticated, service_role;\ngrant execute on function realtime.send(jsonb, text, text, boolean) to anon, authenticated, service_role;\n";
20
+ export declare const BOOTSTRAP_SQL = "\n-- \u2500\u2500 Extensions \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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n-- Supabase enables these by default and migrations lean on them\n-- (uuid_generate_v4(), crypt(), citext, pg_trgm, \u2026). Each is created into the\n-- 'extensions' schema like hosted Supabase; any not available in this engine\n-- build is skipped rather than aborting the whole bootstrap.\ncreate schema if not exists extensions;\ndo $$\ndeclare ext text;\nbegin\n foreach ext in array array[\n 'uuid-ossp','pgcrypto','citext','pg_trgm','ltree','hstore','fuzzystrmatch',\n 'vector','postgis','pg_textsearch'\n ] loop\n begin\n execute format('create extension if not exists %I with schema extensions', ext);\n exception when others then\n -- extension not bundled in this engine build; continue\n end;\n end loop;\nend $$;\n\n-- The official pgmq extension owns its required pgmq schema. PGlite and\n-- native PostgreSQL builds that do not provide it simply continue to Lite's\n-- SQL fallback during database initialization.\ncreate schema if not exists pgmq;\ndo $$\nbegin\n begin\n create extension if not exists pgmq with schema pgmq;\n exception when others then\n null;\n end;\nend $$;\n\n-- uuid-ossp isn't in every Postgres build (it needs an external UUID lib at\n-- build time - e.g. the theseus Linux binaries omit it). uuid_generate_v4() is\n-- the single most-used function from it, so shim it onto core gen_random_uuid()\n-- (also a v4 UUID) whenever the real extension isn't present, so migrations\n-- that call it work identically on every engine and platform.\ndo $$\nbegin\n if not exists (\n select 1 from pg_proc p join pg_namespace n on n.oid = p.pronamespace\n where p.proname = 'uuid_generate_v4' and n.nspname in ('public', 'extensions')\n ) then\n create function extensions.uuid_generate_v4() returns uuid\n language sql volatile as 'select gen_random_uuid()';\n end if;\nend $$;\n\n-- Make extension functions resolvable unqualified (uuid_generate_v4(), \u2026) on\n-- the current session (migrations run here) and for future connections.\ndo $$\nbegin\n execute 'alter database ' || quote_ident(current_database()) ||\n ' set search_path to \"$user\", public, extensions';\nexception when others then\n -- some engines disallow altering the current database; session SET below still applies\nend $$;\nset search_path to \"$user\", public, extensions;\n\n-- \u2500\u2500 Roles \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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\ndo $$\nbegin\n if not exists (select from pg_roles where rolname = 'anon') then\n create role anon nologin noinherit;\n end if;\n if not exists (select from pg_roles where rolname = 'authenticated') then\n create role authenticated nologin noinherit;\n end if;\n if not exists (select from pg_roles where rolname = 'service_role') then\n create role service_role nologin noinherit bypassrls;\n end if;\nend $$;\n\ngrant usage on schema extensions to anon, authenticated, service_role;\nalter role anon set search_path to \"$user\", public, extensions;\nalter role authenticated set search_path to \"$user\", public, extensions;\nalter role service_role set search_path to \"$user\", public, extensions;\n\n-- Initialize defaults once. Restart/maintenance must not undo application ACLs.\ndo $$\nbegin\n if to_regclass('supabase_migrations.schema_migrations') is null then\n grant usage on schema public to anon, authenticated, service_role;\n alter default privileges in schema public\n grant all on tables to anon, authenticated, service_role;\n alter default privileges in schema public\n grant all on sequences to anon, authenticated, service_role;\n end if;\nend $$;\n\n-- PostgreSQL already grants EXECUTE on new functions to PUBLIC. Keep that\n-- default so project migrations can revoke PUBLIC and grant only selected\n-- roles without hidden direct grants from Lite. Existing ACLs are left intact.\n\n-- \u2500\u2500 Auth schema (GoTrue-compatible subset) \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\ncreate schema if not exists auth;\n\ncreate table if not exists auth.users (\n instance_id uuid default '00000000-0000-0000-0000-000000000000',\n id uuid primary key default gen_random_uuid(),\n aud text default 'authenticated',\n role text default 'authenticated',\n email text unique,\n encrypted_password text,\n email_confirmed_at timestamptz,\n invited_at timestamptz,\n confirmation_token text default '',\n confirmation_sent_at timestamptz,\n recovery_token text default '',\n recovery_sent_at timestamptz,\n email_change_token_new text default '',\n email_change text default '',\n email_change_sent_at timestamptz,\n email_change_token_current text default '',\n email_change_confirm_status smallint default 0,\n last_sign_in_at timestamptz,\n raw_app_meta_data jsonb default '{}'::jsonb,\n raw_user_meta_data jsonb default '{}'::jsonb,\n is_super_admin boolean default false,\n created_at timestamptz default now(),\n updated_at timestamptz default now(),\n phone text unique,\n phone_confirmed_at timestamptz,\n phone_change text default '',\n phone_change_token text default '',\n phone_change_sent_at timestamptz,\n reauthentication_token text default '',\n reauthentication_sent_at timestamptz,\n banned_until timestamptz,\n deleted_at timestamptz,\n is_anonymous boolean default false\n);\n\ncreate table if not exists auth.refresh_tokens (\n id bigint generated by default as identity primary key,\n token text unique not null,\n user_id uuid not null references auth.users(id) on delete cascade,\n parent text,\n session_id uuid,\n revoked boolean default false,\n created_at timestamptz default now(),\n updated_at timestamptz default now()\n);\n\ncreate index if not exists refresh_tokens_user_id_idx on auth.refresh_tokens(user_id);\n\ncreate table if not exists auth.one_time_tokens (\n id uuid primary key default gen_random_uuid(),\n user_id uuid references auth.users(id) on delete cascade,\n email text,\n phone text,\n token_type text not null, -- otp | magiclink | recovery | sms\n token text not null,\n attempts int not null default 0,\n created_at timestamptz default now(),\n expires_at timestamptz not null,\n constraint one_time_tokens_contact_check check (\n (email is not null and phone is null) or (email is null and phone is not null)\n )\n);\n\n-- Upgrade databases created by Lite <=0.5.9 without touching existing email tokens.\nalter table auth.one_time_tokens add column if not exists phone text;\nalter table auth.one_time_tokens alter column email drop not null;\ndo $phone_otp_contact_constraint$\nbegin\n if not exists (\n select 1 from pg_constraint\n where conrelid = 'auth.one_time_tokens'::regclass\n and conname = 'one_time_tokens_contact_check'\n ) then\n alter table auth.one_time_tokens add constraint one_time_tokens_contact_check check (\n (email is not null and phone is null) or (email is null and phone is not null)\n );\n end if;\nend $phone_otp_contact_constraint$;\n\ncreate unique index if not exists one_time_tokens_phone_type_idx\n on auth.one_time_tokens(phone, token_type) where phone is not null;\n\n-- Only a keyed phone fingerprint is persisted for cooldown enforcement; the\n-- normalized phone number never enters this table.\ncreate table if not exists auth.phone_otp_cooldowns (\n phone_fingerprint text primary key,\n issuance_id uuid not null,\n last_sent_at timestamptz not null default now()\n);\n\ncreate table if not exists auth.identities (\n id uuid primary key default gen_random_uuid(),\n user_id uuid not null references auth.users(id) on delete cascade,\n provider text not null,\n provider_id text not null,\n identity_data jsonb default '{}'::jsonb,\n last_sign_in_at timestamptz default now(),\n created_at timestamptz default now(),\n updated_at timestamptz default now(),\n unique (provider, provider_id)\n);\n\n-- OAuth / PKCE flow state, bridging /authorize \u2192 provider \u2192 /callback \u2192 exchange\ncreate table if not exists auth.flow_state (\n id uuid primary key default gen_random_uuid(),\n provider text not null,\n provider_state text not null unique,\n redirect_to text,\n code_challenge text,\n code_challenge_method text,\n auth_code text unique,\n user_id uuid references auth.users(id) on delete cascade,\n created_at timestamptz default now(),\n expires_at timestamptz not null\n);\n\ncreate table if not exists auth.mfa_factors (\n id uuid primary key default gen_random_uuid(),\n user_id uuid not null references auth.users(id) on delete cascade,\n friendly_name text,\n factor_type text not null default 'totp',\n status text not null default 'unverified', -- unverified | verified\n secret text,\n created_at timestamptz default now(),\n updated_at timestamptz default now()\n);\n\ncreate table if not exists auth.mfa_challenges (\n id uuid primary key default gen_random_uuid(),\n factor_id uuid not null references auth.mfa_factors(id) on delete cascade,\n verified_at timestamptz,\n created_at timestamptz default now(),\n expires_at timestamptz not null\n);\n\n-- append-only security audit trail (GoTrue-compatible shape)\ncreate table if not exists auth.audit_log_entries (\n instance_id uuid default '00000000-0000-0000-0000-000000000000',\n id uuid primary key default gen_random_uuid(),\n payload jsonb,\n created_at timestamptz default now(),\n ip_address varchar(64) not null default ''\n);\ncreate index if not exists audit_logs_instance_id_idx on auth.audit_log_entries(created_at);\n\n-- runtime-mutable instance settings (Studio auth toggles)\ncreate table if not exists auth.config (\n key text primary key,\n value jsonb not null,\n updated_at timestamptz default now()\n);\n\ngrant usage on schema auth to anon, authenticated, service_role;\n\ncreate or replace function auth.jwt() returns jsonb\nlanguage sql stable as $$\n select coalesce(\n nullif(current_setting('request.jwt.claims', true), ''),\n '{}'\n )::jsonb\n$$;\n\ncreate or replace function auth.uid() returns uuid\nlanguage sql stable as $$\n select nullif(auth.jwt() ->> 'sub', '')::uuid\n$$;\n\ncreate or replace function auth.role() returns text\nlanguage sql stable as $$\n select coalesce(auth.jwt() ->> 'role', 'anon')\n$$;\n\ncreate or replace function auth.email() returns text\nlanguage sql stable as $$\n select auth.jwt() ->> 'email'\n$$;\n\ngrant execute on function auth.jwt(), auth.uid(), auth.role(), auth.email()\n to anon, authenticated, service_role;\n\n-- \u2500\u2500 Storage schema (storage-api-compatible subset) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\ncreate schema if not exists storage;\n\ncreate table if not exists storage.buckets (\n id text primary key,\n name text not null unique,\n owner uuid,\n owner_id text,\n public boolean default false,\n file_size_limit bigint,\n allowed_mime_types text[],\n created_at timestamptz default now(),\n updated_at timestamptz default now()\n);\n\nalter table storage.buckets add column if not exists owner_id text;\nupdate storage.buckets\nset owner_id = owner::text\nwhere owner_id is null and owner is not null;\n\ncreate table if not exists storage.objects (\n id uuid primary key default gen_random_uuid(),\n bucket_id text not null references storage.buckets(id),\n name text not null,\n owner uuid,\n owner_id text,\n version text,\n metadata jsonb default '{}'::jsonb,\n created_at timestamptz default now(),\n updated_at timestamptz default now(),\n last_accessed_at timestamptz default now(),\n unique (bucket_id, name)\n);\n\n-- storage-api keeps the legacy UUID owner and the current text owner_id in\n-- parallel. Re-running bootstrap upgrades existing Lite databases and retains\n-- object ownership for rows created before owner_id support was added.\nalter table storage.objects add column if not exists owner_id text;\nupdate storage.objects\nset owner_id = owner::text\nwhere owner_id is null and owner is not null;\n\ncreate index if not exists objects_bucket_name_idx on storage.objects(bucket_id, name);\n\ngrant usage on schema storage to anon, authenticated, service_role;\ngrant select on storage.buckets to anon, authenticated, service_role;\ngrant all on storage.buckets to service_role;\ngrant all on storage.objects to anon, authenticated, service_role;\n\ncreate or replace function storage.foldername(name text) returns text[]\nlanguage sql immutable as $$\n select (string_to_array(name, '/'))[1 : array_length(string_to_array(name, '/'), 1) - 1]\n$$;\n\ncreate or replace function storage.filename(name text) returns text\nlanguage sql immutable as $$\n select (string_to_array(name, '/'))[array_length(string_to_array(name, '/'), 1)]\n$$;\n\ncreate or replace function storage.extension(name text) returns text\nlanguage sql immutable as $$\n select reverse(split_part(reverse(storage.filename(name)), '.', 1))\n$$;\n\nalter table storage.objects enable row level security;\n\ndrop policy if exists supacloud_lite_authenticated_all on storage.objects;\ndrop policy if exists supacloud_lite_public_read on storage.objects;\n\ndo $legacy_policy_cleanup$\ndeclare\n legacy_prefix constant text := 'tin' || 'base';\nbegin\n execute format(\n 'drop policy if exists %I on storage.objects',\n legacy_prefix || '_authenticated_all'\n );\n execute format(\n 'drop policy if exists %I on storage.objects',\n legacy_prefix || '_public_read'\n );\nend $legacy_policy_cleanup$;\n\n-- \u2500\u2500 Migration bookkeeping (same table the Supabase CLI uses) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\ncreate schema if not exists supabase_migrations;\n\ncreate table if not exists supabase_migrations.schema_migrations (\n version text primary key,\n name text,\n statements text[],\n applied_at timestamptz default now()\n);\n\ncreate table if not exists supabase_migrations.seed_files (\n path text primary key,\n hash text,\n applied_at timestamptz default now()\n);\n\n-- \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\ndo $legacy_schema_upgrade$\ndeclare\n legacy_schema constant text := 'tin' || 'base';\nbegin\n if exists (select 1 from pg_namespace where nspname = legacy_schema)\n and not exists (select 1 from pg_namespace where nspname = 'supacloud_lite') then\n execute format('alter schema %I rename to supacloud_lite', legacy_schema);\n end if;\nend $legacy_schema_upgrade$;\n\ncreate schema if not exists supacloud_lite;\n\ncreate or replace function supacloud_lite.cdc_notify() returns trigger\nlanguage plpgsql security definer as $$\ndeclare\n payload text;\nbegin\n payload := json_build_object(\n 'schema', TG_TABLE_SCHEMA,\n 'table', TG_TABLE_NAME,\n 'type', TG_OP,\n 'commit_timestamp', to_char(now() at time zone 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"'),\n 'record', case when TG_OP in ('INSERT', 'UPDATE') then row_to_json(NEW) else null end,\n 'old_record', case when TG_OP in ('UPDATE', 'DELETE') then row_to_json(OLD) else null end\n )::text;\n -- pg_notify payloads are capped at ~8kB; degrade like Supabase does.\n if octet_length(payload) > 7500 then\n payload := json_build_object(\n 'schema', TG_TABLE_SCHEMA,\n 'table', TG_TABLE_NAME,\n 'type', TG_OP,\n 'commit_timestamp', to_char(now() at time zone 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"'),\n 'record', null,\n 'old_record', null,\n 'errors', json_build_array('Payload too large')\n )::text;\n end if;\n perform pg_notify('supacloud_lite_cdc', payload);\n return coalesce(NEW, OLD);\nend $$;\n\ndo $legacy_trigger_upgrade$\ndeclare\n legacy_schema constant text := 'tin' || 'base';\n legacy_trigger constant text := ('tin' || 'base') || '_cdc';\n trigger_record record;\n target_exists boolean;\nbegin\n for trigger_record in\n select c.oid as relation_oid, n.nspname as schema_name, c.relname as table_name\n from pg_trigger tg\n join pg_class c on c.oid = tg.tgrelid\n join pg_namespace n on n.oid = c.relnamespace\n join pg_proc p on p.oid = tg.tgfoid\n join pg_namespace pn on pn.oid = p.pronamespace\n where not tg.tgisinternal\n and tg.tgname = legacy_trigger\n and p.proname = 'cdc_notify'\n and pn.nspname in (legacy_schema, 'supacloud_lite')\n loop\n select exists (\n select 1\n from pg_trigger\n where not tgisinternal\n and tgrelid = trigger_record.relation_oid\n and tgname = 'supacloud_lite_cdc'\n ) into target_exists;\n\n execute format(\n 'drop trigger %I on %I.%I',\n legacy_trigger,\n trigger_record.schema_name,\n trigger_record.table_name\n );\n\n if not target_exists then\n execute format(\n 'create trigger supacloud_lite_cdc after insert or update or delete on %I.%I for each row execute function supacloud_lite.cdc_notify()',\n trigger_record.schema_name,\n trigger_record.table_name\n );\n end if;\n end loop;\nend $legacy_trigger_upgrade$;\n\ndo $legacy_schema_cleanup$\ndeclare\n legacy_schema constant text := 'tin' || 'base';\nbegin\n if exists (\n select 1\n from pg_proc p\n join pg_namespace n on n.oid = p.pronamespace\n where n.nspname = legacy_schema\n and p.proname = 'cdc_notify'\n and p.pronargs = 0\n ) then\n execute format('drop function %I.cdc_notify()', legacy_schema);\n end if;\n\n if exists (select 1 from pg_namespace where nspname = legacy_schema) then\n begin\n execute format('drop schema %I', legacy_schema);\n exception when dependent_objects_still_exist then\n raise notice 'SupaCloud Lite: retained non-empty legacy runtime schema';\n end;\n end if;\nend $legacy_schema_cleanup$;\n\n-- \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\n-- Mirrors Supabase Realtime: developers write RLS policies on\n-- realtime.messages using realtime.topic(); a SELECT policy grants a private\n-- channel's subscribers the right to *receive*, an INSERT policy the right to\n-- *broadcast*. realtime.send() lets the database push a broadcast to a topic.\ncreate schema if not exists realtime;\n\ncreate table if not exists realtime.messages (\n id uuid not null default gen_random_uuid(),\n topic text not null,\n extension text not null,\n event text,\n payload jsonb,\n private boolean default false,\n inserted_at timestamptz not null default now(),\n updated_at timestamptz not null default now(),\n primary key (id)\n);\nalter table realtime.messages enable row level security;\n\ngrant usage on schema realtime to anon, authenticated, service_role;\ngrant all on realtime.messages to anon, authenticated, service_role;\n\n-- the topic currently being authorized/broadcast (set per operation)\ncreate or replace function realtime.topic() returns text\n language sql stable as $$ select nullif(current_setting('realtime.topic', true), '') $$;\n\n-- push a broadcast message to all subscribers of <topic> from SQL / triggers.\n-- Delivered over the websocket by the in-process realtime engine, which listens\n-- on the 'supacloud_lite_realtime_broadcast' channel.\ncreate or replace function realtime.send(payload jsonb, event text, topic text, private boolean default true)\n returns void language plpgsql security definer as $$\nbegin\n perform pg_notify(\n 'supacloud_lite_realtime_broadcast',\n json_build_object('topic', topic, 'event', event, 'payload', payload, 'private', private)::text\n );\nexception when others then\n -- never let a notify failure abort the caller's transaction\n null;\nend $$;\n\ngrant execute on function realtime.topic() to anon, authenticated, service_role;\ngrant execute on function realtime.send(jsonb, text, text, boolean) to anon, authenticated, service_role;\n";
21
21
  //# sourceMappingURL=bootstrap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../src/runtime/db/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,66KA+KjC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,6toBAsgBzB,CAAA"}
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../src/runtime/db/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,66KA+KjC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,0opBAshBzB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../src/runtime/db/database.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAA+B,MAAM,aAAa,CAAA;AAGvF,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEhE,2CAA2C;AAC3C,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;IACnB,YAAY,EAAE,OAAO,CAAA;CACtB;AAED,mFAAmF;AACnF,MAAM,WAAW,UAAU;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,EAAE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