@supacloud/lite 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/LICENSES/BUN-1.3.14-RUNTIME-NOTICES.txt +78 -0
  3. package/LICENSES/CHOWNR-BLUEOAK-1.0.0.txt +63 -0
  4. package/LICENSES/FS-MINIPASS-ISC.txt +15 -0
  5. package/LICENSES/MINIPASS-BLUEOAK-1.0.0.txt +55 -0
  6. package/LICENSES/MINIZLIB-MIT.txt +26 -0
  7. package/LICENSES/NODE-TAR-BLUEOAK-1.0.0.txt +55 -0
  8. package/LICENSES/YALLIST-BLUEOAK-1.0.0.txt +63 -0
  9. package/README.md +74 -4
  10. package/RELEASING.md +14 -1
  11. package/THIRD_PARTY_NOTICES.md +38 -2
  12. package/dist/cli.js +487 -85
  13. package/dist/index.d.ts +1 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +477 -78
  16. package/dist/launcher.cjs +22 -0
  17. package/dist/standalone-assets-protocol.d.ts +13 -0
  18. package/dist/standalone-assets-protocol.d.ts.map +1 -0
  19. package/dist/vendor/tinbase/auth/handler.d.ts +4 -0
  20. package/dist/vendor/tinbase/auth/handler.d.ts.map +1 -1
  21. package/dist/vendor/tinbase/db/database.d.ts +5 -1
  22. package/dist/vendor/tinbase/db/database.d.ts.map +1 -1
  23. package/dist/vendor/tinbase/db/emulated.d.ts +1 -1
  24. package/dist/vendor/tinbase/db/emulated.d.ts.map +1 -1
  25. package/dist/vendor/tinbase/db/pglite-engine.d.ts.map +1 -1
  26. package/dist/vendor/tinbase/functions/handler.d.ts +3 -1
  27. package/dist/vendor/tinbase/functions/handler.d.ts.map +1 -1
  28. package/dist/vendor/tinbase/functions/pgredis.d.ts +26 -0
  29. package/dist/vendor/tinbase/functions/pgredis.d.ts.map +1 -0
  30. package/dist/vendor/tinbase/index.d.ts +1 -0
  31. package/dist/vendor/tinbase/index.d.ts.map +1 -1
  32. package/dist/vendor/tinbase/retention/service.d.ts.map +1 -1
  33. package/package.json +11 -4
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+ 'use strict'
3
+
4
+ const { spawn } = require('node:child_process')
5
+ const { join } = require('node:path')
6
+
7
+ const cliPath = join(__dirname, 'cli.js')
8
+ const bunProcess = spawn('bun', [cliPath, ...process.argv.slice(2)], { shell: false, stdio: 'inherit' })
9
+
10
+ bunProcess.once('error', (error) => {
11
+ if (error.code === 'ENOENT') {
12
+ console.error('Bun executable not found on PATH. Install Bun 1.3.14 or newer, then retry.')
13
+ } else {
14
+ console.error(`Unable to start Bun: ${error.message}`)
15
+ }
16
+ process.exitCode = 1
17
+ })
18
+
19
+ bunProcess.once('exit', (exitCode, signal) => {
20
+ if (signal) process.kill(process.pid, signal)
21
+ else process.exitCode = exitCode ?? 1
22
+ })
@@ -0,0 +1,13 @@
1
+ export declare const STANDALONE_PGLITE_ASSETS: unique symbol;
2
+ export type StandaloneExtensionName = 'uuid_ossp' | 'pgcrypto' | 'citext' | 'pg_trgm' | 'ltree' | 'hstore' | 'fuzzystrmatch';
3
+ export interface PreparedExtensionBundles {
4
+ bundles: Record<StandaloneExtensionName, URL>;
5
+ cleanup: () => Promise<void>;
6
+ }
7
+ export interface StandalonePgliteAssets {
8
+ pgliteWasmModule: WebAssembly.Module;
9
+ initdbWasmModule: WebAssembly.Module;
10
+ fsBundle: Blob | File;
11
+ prepareExtensionBundles: () => Promise<PreparedExtensionBundles>;
12
+ }
13
+ //# sourceMappingURL=standalone-assets-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standalone-assets-protocol.d.ts","sourceRoot":"","sources":["../src/standalone-assets-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,eAAwD,CAAA;AAE7F,MAAM,MAAM,uBAAuB,GAC/B,WAAW,GACX,UAAU,GACV,QAAQ,GACR,SAAS,GACT,OAAO,GACP,QAAQ,GACR,eAAe,CAAA;AAEnB,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAA;IAC7C,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7B;AAED,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAA;IACpC,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAA;IACpC,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAA;IACrB,uBAAuB,EAAE,MAAM,OAAO,CAAC,wBAAwB,CAAC,CAAA;CACjE"}
@@ -128,6 +128,10 @@ export declare class AuthHandler {
128
128
  private getUserFactors;
129
129
  /** GoTrue-shaped identities for a user (linked providers), from auth.identities. */
130
130
  private getUserIdentities;
131
+ private rotateRefreshToken;
132
+ private claimRefreshToken;
133
+ private refreshSessionStartedAt;
134
+ private refreshExpiryError;
131
135
  private userFromBearer;
132
136
  private claimsFromBearer;
133
137
  /** Shape a user row into the GoTrue user object supabase-js expects. */
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/vendor/tinbase/auth/handler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEzD,OAAO,EAAgB,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAGnE,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAExE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG7C,wDAAwD;AACxD,MAAM,WAAW,UAAU;IACzB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAA;IACjB,2FAA2F;IAC3F,MAAM,EAAE,MAAM,CAAA;IACd,uDAAuD;IACvD,OAAO,EAAE,MAAM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AAM,CAAC,QAAQ,CAAC,gBAAgB,CAAI;YAE9B,MAAM;YAqCN,WAAW;YAaX,UAAU;YAuBV,KAAK;IA2FnB;;;OAGG;YACW,KAAK;IAqBnB;;;;;OAKG;YACW,UAAU;IA2CxB;;;;;;;;;OASG;YACW,SAAS;YAqBT,YAAY;YAyDZ,eAAe;YAqBf,YAAY;YAyCZ,cAAc;YAWd,cAAc;IAmB5B,oFAAoF;YACtE,iBAAiB;YAuBjB,kBAAkB;YAqBlB,iBAAiB;YAUjB,uBAAuB;IASrC,OAAO,CAAC,kBAAkB;YAoBZ,cAAc;YAOd,gBAAgB;IAM9B,wEAAwE;IACxE,QAAQ,CACN,CAAC,EAAE,OAAO,EACV,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAO,EACvC,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAO,GACzC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAoB1B,+EAA+E;YACjE,gBAAgB;YAUhB,UAAU;CAqDzB"}
@@ -56,7 +56,9 @@ export interface SchemaInfo {
56
56
  foreignKeys: ForeignKey[];
57
57
  }
58
58
  /** A function that runs a parameterized query, e.g. one bound to a transaction. */
59
- export type Querier = (sql: string, params?: unknown[]) => Promise<EngineResults>;
59
+ export interface Querier {
60
+ <T = any>(sql: string, params?: unknown[]): Promise<EngineResults<T>>;
61
+ }
60
62
  /**
61
63
  * A change-data-capture event for one row, shaped like Supabase Realtime's
62
64
  * `postgres_changes` payload. Emitted by the SQL trigger on the real engines
@@ -93,6 +95,8 @@ export declare class Database {
93
95
  query<T = any>(sql: string, params?: unknown[]): Promise<EngineResults<T>>;
94
96
  /** Run one or more SQL statements with no params (superuser). */
95
97
  exec(sql: string): Promise<unknown>;
98
+ /** Expose only the bound querier so a caller cannot accidentally escape the transaction. */
99
+ transaction<T>(fn: (q: Querier) => Promise<T>): Promise<T>;
96
100
  /**
97
101
  * Run `fn` inside a transaction with the request's Postgres role and JWT
98
102
  * claims applied via SET LOCAL - this is what makes RLS behave exactly
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../../src/vendor/tinbase/db/database.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAY,MAAM,aAAa,CAAA;AACpE,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,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB;AAED,uEAAuE;AACvE,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB;;;;;OAKG;IACH,UAAU,EAAE,MAAM,EAAE,EAAE,CAAA;CACvB;AAED,2CAA2C;AAC3C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED,mEAAmE;AACnE,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,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EAAE,CAyBjE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG/C;AAED,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD"}
@@ -13,7 +13,7 @@
13
13
  * `a_<name>` tables plus create/send/read/pop/delete/archive/etc functions,
14
14
  * matching pgmq's signatures. No C extension, no background worker needed.
15
15
  */
16
- export declare const PGMQ_SQL = "\ncreate schema if not exists pgmq;\ngrant usage on schema pgmq to anon, authenticated, service_role;\n\ndo $$ begin\n if not exists (select 1 from pg_type t join pg_namespace n on n.oid = t.typnamespace\n where t.typname = 'message_record' and n.nspname = 'pgmq') then\n create type pgmq.message_record as (\n msg_id bigint, read_ct integer, enqueued_at timestamptz, vt timestamptz, message jsonb\n );\n end if;\nend $$;\n\ncreate or replace function pgmq.create(queue_name text) returns void language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\nbegin\n execute format('create table if not exists pgmq.%I (\n msg_id bigint generated always as identity primary key,\n read_ct integer not null default 0,\n enqueued_at timestamptz not null default now(),\n vt timestamptz not null default now(),\n message jsonb)', 'q_' || queue_name);\n execute format('create table if not exists pgmq.%I (\n msg_id bigint primary key, read_ct integer not null default 0,\n enqueued_at timestamptz not null, archived_at timestamptz not null default now(),\n vt timestamptz, message jsonb)', 'a_' || queue_name);\nend $pgmq$;\n\ncreate or replace function pgmq.send(queue_name text, msg jsonb, delay integer default 0)\nreturns bigint language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\ndeclare id bigint;\nbegin\n perform pgmq.create(queue_name);\n execute format('insert into pgmq.%I (vt, message) values (now() + make_interval(secs => $1), $2) returning msg_id', 'q_' || queue_name)\n into id using delay, msg;\n return id;\nend $pgmq$;\n\ncreate or replace function pgmq.read(queue_name text, vt integer, qty integer)\nreturns setof pgmq.message_record language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\nbegin\n return query execute format($fmt$\n with cte as (\n select msg_id from pgmq.%I where vt <= now() order by msg_id limit $1 for update skip locked\n )\n update pgmq.%I m set vt = now() + make_interval(secs => $2), read_ct = read_ct + 1\n from cte where m.msg_id = cte.msg_id\n returning m.msg_id, m.read_ct, m.enqueued_at, m.vt, m.message\n $fmt$, 'q_' || queue_name, 'q_' || queue_name) using qty, vt;\nend $pgmq$;\n\ncreate or replace function pgmq.pop(queue_name text)\nreturns setof pgmq.message_record language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\nbegin\n return query execute format($fmt$\n with cte as (select msg_id from pgmq.%I where vt <= now() order by msg_id limit 1 for update skip locked)\n delete from pgmq.%I m using cte where m.msg_id = cte.msg_id\n returning m.msg_id, m.read_ct, m.enqueued_at, m.vt, m.message\n $fmt$, 'q_' || queue_name, 'q_' || queue_name);\nend $pgmq$;\n\ncreate or replace function pgmq.delete(queue_name text, msg_id bigint)\nreturns boolean language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\ndeclare n integer;\nbegin\n execute format('delete from pgmq.%I where msg_id = $1', 'q_' || queue_name) using msg_id;\n get diagnostics n = row_count;\n return n > 0;\nend $pgmq$;\n\ncreate or replace function pgmq.archive(queue_name text, msg_id bigint)\nreturns boolean language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\ndeclare n integer;\nbegin\n execute format($fmt$\n with del as (delete from pgmq.%I where msg_id = $1 returning *)\n insert into pgmq.%I (msg_id, read_ct, enqueued_at, vt, message)\n select msg_id, read_ct, enqueued_at, vt, message from del\n $fmt$, 'q_' || queue_name, 'a_' || queue_name) using msg_id;\n get diagnostics n = row_count;\n return n > 0;\nend $pgmq$;\n\ncreate or replace function pgmq.drop_queue(queue_name text) returns boolean language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\nbegin\n execute format('drop table if exists pgmq.%I', 'q_' || queue_name);\n execute format('drop table if exists pgmq.%I', 'a_' || queue_name);\n return true;\nend $pgmq$;\n\ncreate or replace function pgmq.purge_queue(queue_name text) returns bigint language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\ndeclare n bigint;\nbegin\n execute format('delete from pgmq.%I', 'q_' || queue_name);\n get diagnostics n = row_count;\n return n;\nend $pgmq$;\n\ncreate or replace function pgmq.list_queues()\nreturns table(queue_name text, is_partitioned boolean, is_unlogged boolean, created_at timestamptz)\nlanguage sql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\n select substring(tablename from 3), false, false, now()\n from pg_tables where schemaname = 'pgmq' and left(tablename, 2) = 'q_';\n$pgmq$;\n\ngrant execute on all functions in schema pgmq to anon, authenticated, service_role;\n";
16
+ export declare const PGMQ_SQL = "\ncreate schema if not exists pgmq;\nrevoke all on schema pgmq from public, anon, authenticated;\ngrant usage on schema pgmq to service_role;\n\ncreate table if not exists pgmq.meta (\n queue_name text primary key,\n physical_name text not null unique,\n is_partitioned boolean not null default false,\n is_unlogged boolean not null default false,\n created_at timestamptz not null default now()\n);\n\n-- Preserve queues created by older Lite versions. Their physical names were\n-- the queue names, so only the already-truncated identifier can be recovered.\ninsert into pgmq.meta (queue_name, physical_name)\nselect substring(tablename from 3), substring(tablename from 3)\nfrom pg_tables\nwhere schemaname = 'pgmq' and left(tablename, 2) = 'q_'\non conflict do nothing;\n\ndo $$ begin\n if not exists (select 1 from pg_type t join pg_namespace n on n.oid = t.typnamespace\n where t.typname = 'message_record' and n.nspname = 'pgmq') then\n create type pgmq.message_record as (\n msg_id bigint, read_ct integer, enqueued_at timestamptz, vt timestamptz, message jsonb\n );\n end if;\nend $$;\n\ncreate or replace function pgmq._normalize_queue_name(queue_name text)\nreturns text language plpgsql immutable set search_path = pgmq, pg_catalog, public as $pgmq$\ndeclare normalized text := btrim(queue_name);\nbegin\n if normalized is null or normalized !~ '^[a-z0-9][a-z0-9_-]{0,127}$' then\n raise exception 'invalid queue name: must match ^[a-z0-9][a-z0-9_-]{0,127}$'\n using errcode = '22023';\n end if;\n return normalized;\nend $pgmq$;\n\n-- PostgreSQL identifiers are limited to 63 bytes. Keep the conventional table\n-- name for short queues and add a deterministic hash for valid 62-128 byte\n-- public names so truncation can never merge two queues.\ncreate or replace function pgmq._physical_queue_name(queue_name text)\nreturns text language sql immutable set search_path = pgmq, pg_catalog, public as $pgmq$\n select case when length(normalized) <= 61 then normalized\n else left(normalized, 28) || '_' || md5(normalized) end\n from (select pgmq._normalize_queue_name(queue_name) as normalized) names;\n$pgmq$;\n\ncreate or replace function pgmq._resolve_queue(queue_name text)\nreturns text language plpgsql stable security definer set search_path = pgmq, pg_catalog, public as $pgmq$\ndeclare normalized text := pgmq._normalize_queue_name(queue_name); physical text;\nbegin\n select physical_name into physical from pgmq.meta where pgmq.meta.queue_name = normalized;\n if physical is null then\n raise exception 'queue \"%\" does not exist', normalized using errcode = '42P01';\n end if;\n return physical;\nend $pgmq$;\n\ncreate or replace function pgmq.create(queue_name text) returns void language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\ndeclare normalized text := pgmq._normalize_queue_name(queue_name); physical text := pgmq._physical_queue_name(queue_name);\nbegin\n insert into pgmq.meta (queue_name, physical_name) values (normalized, physical)\n on conflict do nothing;\n select physical_name into physical from pgmq.meta where pgmq.meta.queue_name = normalized;\n execute format('create table if not exists pgmq.%I (\n msg_id bigint generated always as identity primary key,\n read_ct integer not null default 0,\n enqueued_at timestamptz not null default now(),\n vt timestamptz not null default now(),\n message jsonb)', 'q_' || physical);\n execute format('create table if not exists pgmq.%I (\n msg_id bigint primary key, read_ct integer not null default 0,\n enqueued_at timestamptz not null, archived_at timestamptz not null default now(),\n vt timestamptz, message jsonb)', 'a_' || physical);\nend $pgmq$;\n\ncreate or replace function pgmq.send(queue_name text, msg jsonb, delay integer default 0)\nreturns bigint language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\ndeclare id bigint; physical text := pgmq._resolve_queue(queue_name);\nbegin\n execute format('insert into pgmq.%I (vt, message) values (now() + make_interval(secs => $1), $2) returning msg_id', 'q_' || physical)\n into id using delay, msg;\n return id;\nend $pgmq$;\n\ncreate or replace function pgmq.send_batch(queue_name text, msgs jsonb[], delay integer default 0)\nreturns setof bigint language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\ndeclare queue_message jsonb;\nbegin\n perform pgmq._resolve_queue(queue_name);\n foreach queue_message in array msgs loop\n return next pgmq.send(queue_name, queue_message, delay);\n end loop;\nend $pgmq$;\n\ncreate or replace function pgmq.read(queue_name text, vt integer, qty integer)\nreturns setof pgmq.message_record language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\ndeclare physical text := pgmq._resolve_queue(queue_name);\nbegin\n return query execute format($fmt$\n with cte as (\n select msg_id from pgmq.%I where vt <= now() order by msg_id limit $1 for update skip locked\n )\n update pgmq.%I m set vt = now() + make_interval(secs => $2), read_ct = read_ct + 1\n from cte where m.msg_id = cte.msg_id\n returning m.msg_id, m.read_ct, m.enqueued_at, m.vt, m.message\n $fmt$, 'q_' || physical, 'q_' || physical) using qty, vt;\nend $pgmq$;\n\ncreate or replace function pgmq.pop(queue_name text)\nreturns setof pgmq.message_record language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\ndeclare physical text := pgmq._resolve_queue(queue_name);\nbegin\n return query execute format($fmt$\n with cte as (select msg_id from pgmq.%I where vt <= now() order by msg_id limit 1 for update skip locked)\n delete from pgmq.%I m using cte where m.msg_id = cte.msg_id\n returning m.msg_id, m.read_ct, m.enqueued_at, m.vt, m.message\n $fmt$, 'q_' || physical, 'q_' || physical);\nend $pgmq$;\n\ncreate or replace function pgmq.set_vt(queue_name text, msg_id bigint, vt_offset integer)\nreturns setof pgmq.message_record language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\ndeclare physical text := pgmq._resolve_queue(queue_name);\nbegin\n return query execute format($fmt$\n update pgmq.%I m set vt = now() + make_interval(secs => $1)\n where m.msg_id = $2\n returning m.msg_id, m.read_ct, m.enqueued_at, m.vt, m.message\n $fmt$, 'q_' || physical) using vt_offset, msg_id;\nend $pgmq$;\n\ncreate or replace function pgmq.delete(queue_name text, msg_id bigint)\nreturns boolean language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\ndeclare n integer; physical text := pgmq._resolve_queue(queue_name);\nbegin\n execute format('delete from pgmq.%I where msg_id = $1', 'q_' || physical) using msg_id;\n get diagnostics n = row_count;\n return n > 0;\nend $pgmq$;\n\ncreate or replace function pgmq.archive(queue_name text, msg_id bigint)\nreturns boolean language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\ndeclare n integer; physical text := pgmq._resolve_queue(queue_name);\nbegin\n execute format($fmt$\n with del as (delete from pgmq.%I where msg_id = $1 returning *)\n insert into pgmq.%I (msg_id, read_ct, enqueued_at, vt, message)\n select msg_id, read_ct, enqueued_at, vt, message from del\n $fmt$, 'q_' || physical, 'a_' || physical) using msg_id;\n get diagnostics n = row_count;\n return n > 0;\nend $pgmq$;\n\ncreate or replace function pgmq.drop_queue(queue_name text) returns boolean language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\ndeclare normalized text := pgmq._normalize_queue_name(queue_name); physical text;\nbegin\n select physical_name into physical from pgmq.meta where pgmq.meta.queue_name = normalized;\n if physical is null then return false; end if;\n execute format('drop table if exists pgmq.%I', 'q_' || physical);\n execute format('drop table if exists pgmq.%I', 'a_' || physical);\n delete from pgmq.meta where pgmq.meta.queue_name = normalized;\n return true;\nend $pgmq$;\n\ncreate or replace function pgmq.purge_queue(queue_name text) returns bigint language plpgsql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\ndeclare n bigint; physical text := pgmq._resolve_queue(queue_name);\nbegin\n execute format('delete from pgmq.%I', 'q_' || physical);\n get diagnostics n = row_count;\n return n;\nend $pgmq$;\n\ncreate or replace function pgmq.list_queues()\nreturns table(queue_name text, is_partitioned boolean, is_unlogged boolean, created_at timestamptz)\nlanguage sql security definer set search_path = pgmq, pg_catalog, public as $pgmq$\n select queue_name, is_partitioned, is_unlogged, created_at from pgmq.meta;\n$pgmq$;\n\nrevoke all on all functions in schema pgmq from public, anon, authenticated;\ngrant execute on all functions in schema pgmq to service_role;\n\ncreate schema if not exists pgmq_public;\ngrant usage on schema pgmq_public to anon, authenticated, service_role;\n\ncreate or replace function pgmq_public.send(queue_name text, message jsonb, sleep_seconds integer default 0)\nreturns setof bigint language sql volatile security definer set search_path = pgmq, pg_catalog, public as $pgmq_public$\n select * from pgmq.send(queue_name, message, sleep_seconds);\n$pgmq_public$;\n\ncreate or replace function pgmq_public.send_batch(queue_name text, messages jsonb[], sleep_seconds integer default 0)\nreturns setof bigint language sql volatile security definer set search_path = pgmq, pg_catalog, public as $pgmq_public$\n select * from pgmq.send_batch(queue_name, messages, sleep_seconds);\n$pgmq_public$;\n\ncreate or replace function pgmq_public.read(queue_name text, sleep_seconds integer, n integer)\nreturns setof pgmq.message_record language sql volatile security definer set search_path = pgmq, pg_catalog, public as $pgmq_public$\n select * from pgmq.read(queue_name, sleep_seconds, n);\n$pgmq_public$;\n\ncreate or replace function pgmq_public.pop(queue_name text)\nreturns setof pgmq.message_record language sql volatile security definer set search_path = pgmq, pg_catalog, public as $pgmq_public$\n select * from pgmq.pop(queue_name);\n$pgmq_public$;\n\ncreate or replace function pgmq_public.archive(queue_name text, message_id bigint)\nreturns boolean language sql volatile security definer set search_path = pgmq, pg_catalog, public as $pgmq_public$\n select pgmq.archive(queue_name, message_id);\n$pgmq_public$;\n\ncreate or replace function pgmq_public.\"delete\"(queue_name text, message_id bigint)\nreturns boolean language sql volatile security definer set search_path = pgmq, pg_catalog, public as $pgmq_public$\n select pgmq.delete(queue_name, message_id);\n$pgmq_public$;\n\nrevoke all on all functions in schema pgmq_public from public;\ngrant execute on all functions in schema pgmq_public to anon, authenticated, service_role;\n";
17
17
  /**
18
18
  * pg_cron emulation: the `cron.job` / `cron.job_run_details` tables and
19
19
  * schedule/unschedule functions. This only records jobs; the in-process
@@ -1 +1 @@
1
- {"version":3,"file":"emulated.d.ts","sourceRoot":"","sources":["../../../../src/vendor/tinbase/db/emulated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;;GAIG;AACH,eAAO,MAAM,QAAQ,ixJAyGpB,CAAA;AAID;;;;GAIG;AACH,eAAO,MAAM,QAAQ,uyEA6DpB,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,82GA0EnB,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,ulBAqB1B,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,SAAS,m/FAoErB,CAAA"}
1
+ {"version":3,"file":"emulated.d.ts","sourceRoot":"","sources":["../../../../src/vendor/tinbase/db/emulated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;;GAIG;AACH,eAAO,MAAM,QAAQ,8tVA4NpB,CAAA;AAID;;;;GAIG;AACH,eAAO,MAAM,QAAQ,uyEA6DpB,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,82GA0EnB,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,ulBAqB1B,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,SAAS,m/FAoErB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"pglite-engine.d.ts","sourceRoot":"","sources":["../../../../src/vendor/tinbase/db/pglite-engine.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAA2B,MAAM,aAAa,CAAA;AAEpE;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkE5E"}
1
+ {"version":3,"file":"pglite-engine.d.ts","sourceRoot":"","sources":["../../../../src/vendor/tinbase/db/pglite-engine.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAA2B,MAAM,aAAa,CAAA;AAMpE;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAmG5E"}
@@ -7,6 +7,7 @@
7
7
  * modules that `export default` a fetch handler.
8
8
  */
9
9
  import type { RequestContext } from '../types.js';
10
+ import { type PgredisCache } from './pgredis.js';
10
11
  /** An edge function: a fetch handler invoked with the resolved request context. */
11
12
  export type EdgeFunction = (req: Request, ctx: FunctionContext) => Response | Promise<Response>;
12
13
  /** Second argument passed to every {@link EdgeFunction} invocation. */
@@ -25,7 +26,8 @@ export interface FunctionContext {
25
26
  export declare class FunctionsHandler {
26
27
  private functions;
27
28
  private env;
28
- constructor(functions: Map<string, EdgeFunction>, env: FunctionContext['env']);
29
+ private pgredis;
30
+ constructor(functions: Map<string, EdgeFunction>, env: FunctionContext['env'], pgredis: PgredisCache);
29
31
  /** Register (or replace) a function under `name`, served at /functions/v1/<name>. */
30
32
  register(name: string, fn: EdgeFunction): void;
31
33
  /** Names of all registered functions. */
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/vendor/tinbase/functions/handler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGjD,mFAAmF;AACnF,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;AAE/F,uEAAuE;AACvE,MAAM,WAAW,eAAe;IAC9B,0EAA0E;IAC1E,IAAI,EAAE,cAAc,CAAA;IACpB,4HAA4H;IAC5H,GAAG,EAAE;QACH,YAAY,EAAE,MAAM,CAAA;QACpB,iBAAiB,EAAE,MAAM,CAAA;QACzB,yBAAyB,EAAE,MAAM,CAAA;QACjC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KACtB,CAAA;CACF;AAED,uFAAuF;AACvF,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,SAAS;IACjB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AC,EAC3B,OAAO,EAAE,YAAY;IAG/B,qFAAqF;IACrF,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,GAAG,IAAI;IAI9C,yCAAyC;IACzC,IAAI,IAAI,MAAM,EAAE;IAIhB,wJAAwJ;IAClJ,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;CAwB7E"}
@@ -0,0 +1,26 @@
1
+ import type { Database } from '../db/database.js';
2
+ /** Persistent, single-project implementation of the Edge Runtime pgredis contract. */
3
+ export declare class PgredisCache {
4
+ private db;
5
+ private constructor();
6
+ static create(db: Database): Promise<PgredisCache>;
7
+ get<T = unknown>(key: string): Promise<T | null>;
8
+ set<T = unknown>(key: string, cacheValue: T, ttlMs?: number | null): Promise<boolean>;
9
+ delete(key: string): Promise<boolean>;
10
+ ttl(key: string): Promise<number | null>;
11
+ getset<T = unknown>(key: string, cacheValue: T): Promise<T | null>;
12
+ getdel<T = unknown>(key: string): Promise<T | null>;
13
+ }
14
+ export interface PgredisCacheBinding {
15
+ get<T = unknown>(key: string): Promise<T | null>;
16
+ set<T = unknown>(key: string, cacheValue: T, ttlMs?: number | null): Promise<boolean>;
17
+ delete(key: string): Promise<boolean>;
18
+ ttl(key: string): Promise<number | null>;
19
+ getset<T = unknown>(key: string, cacheValue: T): Promise<T | null>;
20
+ getdel<T = unknown>(key: string): Promise<T | null>;
21
+ }
22
+ /** Install the immutable global binding used by SupaCloud Edge Functions. */
23
+ export declare function installPgredisShim(): void;
24
+ /** Bind one function invocation to its project's cache and revoke it when the response settles. */
25
+ export declare function runWithPgredisCache<T>(cache: PgredisCache, operation: () => Promise<T>): Promise<T>;
26
+ //# sourceMappingURL=pgredis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pgredis.d.ts","sourceRoot":"","sources":["../../../../src/vendor/tinbase/functions/pgredis.ts"],"names":[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AC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IACxC,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;IAClE,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;CACpD;AAmBD,6EAA6E;AAC7E,wBAAgB,kBAAkB,IAAI,IAAI,CAYzC;AAED,mGAAmG;AACnG,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CASnG"}
@@ -17,6 +17,7 @@ export { LogBuffer, type LogEntry, type LogLevel } from './log-buffer.js';
17
17
  export { RealtimeEngine, type RealtimeSocketLike } from './realtime/engine.js';
18
18
  export { signJwt, verifyJwt, decodeJwt } from './jwt.js';
19
19
  export { FunctionsHandler, type EdgeFunction, type FunctionContext } from './functions/handler.js';
20
+ export { type PgredisCacheBinding } from './functions/pgredis.js';
20
21
  export { generateTypes } from './gen-types.js';
21
22
  export { installDenoShim } from './functions/deno-shim.js';
22
23
  export { WebhooksService, type WebhookConfig, type WebhookDelivery } from './webhooks/service.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vendor/tinbase/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAqB,MAAM,wBAAwB,CAAA;AAE5E,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,sB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,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAC7E,gGAAgG;IAChG,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3B;AAWD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CAAC,MAAM,GAAE,aAAkB,GAAG,OAAO,CAAC,cAAc,CAAC,CAqWvF"}
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/vendor/tinbase/retention/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAEjD,qFAAqF;AACrF,MAAM,WAAW,eAAe;IAC9B,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yFAAyF;IACzF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,8FAA8F;IAC9F,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAID,wFAAwF;AACxF,qBAAa,gBAAgB;IAYzB,OAAO,CAAC,EAAE;IAEV,OAAO,CAAC,GAAG;IAbb,OAAO,CAAC,KAAK,CAA8C;IAK3D,OAAO,CAAC,QAAQ,CAAmC;IACnD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAQ;IACrC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAQ;gBAG/B,EAAE,EAAE,QAAQ,EACpB,MAAM,GAAE,eAAoB,EACpB,GAAG,GAAE,MAAM,IAAuB;IAO5C,qFAAqF;IACrF,KAAK,IAAI,IAAI;IAUb;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B,qEAAqE;IAC/D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAed,GAAG;CAOlB"}
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/vendor/tinbase/retention/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAEjD,qFAAqF;AACrF,MAAM,WAAW,eAAe;IAC9B,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yFAAyF;IACzF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,8FAA8F;IAC9F,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAID,wFAAwF;AACxF,qBAAa,gBAAgB;IAYzB,OAAO,CAAC,EAAE;IAEV,OAAO,CAAC,GAAG;IAbb,OAAO,CAAC,KAAK,CAA8C;IAK3D,OAAO,CAAC,QAAQ,CAAmC;IACnD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAQ;IACrC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAQ;gBAG/B,EAAE,EAAE,QAAQ,EACpB,MAAM,GAAE,eAAoB,EACpB,GAAG,GAAE,MAAM,IAAuB;IAO5C,qFAAqF;IACrF,KAAK,IAAI,IAAI;IAUb;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B,qEAAqE;IAC/D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAgBd,GAAG;CAOlB"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@supacloud/lite",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Bun-native, single-project Supabase-compatible backend powered by PGlite",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "bin": {
8
- "supacloud-lite": "dist/cli.js"
8
+ "supacloud-lite": "dist/launcher.cjs"
9
9
  },
10
10
  "exports": {
11
11
  ".": {
@@ -16,6 +16,7 @@
16
16
  },
17
17
  "files": [
18
18
  "dist",
19
+ "!dist/standalone",
19
20
  "README.md",
20
21
  "CHANGELOG.md",
21
22
  "RELEASING.md",
@@ -24,13 +25,19 @@
24
25
  ],
25
26
  "scripts": {
26
27
  "build": "bun run build:js && bun run build:types",
27
- "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",
28
+ "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",
29
+ "build:standalone:host": "bun run scripts/build-standalone.ts host",
30
+ "build:standalone:linux": "bun run scripts/build-standalone.ts linux-x64 linux-arm64",
31
+ "build:standalone:macos": "bun run scripts/build-standalone.ts macos-x64 macos-arm64",
32
+ "build:standalone:windows": "bun run scripts/build-standalone.ts windows-x64",
33
+ "build:standalone:release": "bun run scripts/build-standalone.ts linux-x64 linux-arm64 macos-x64 macos-arm64 windows-x64",
28
34
  "build:types": "bun x tsc --emitDeclarationOnly -p tsconfig.build.json",
29
- "check": "bun run typecheck && bun run test && bun run build && bun run test:package",
35
+ "check": "bun run typecheck && bun run test && bun run build && bun run test:package && bun run build:standalone:host && bun run test:standalone",
30
36
  "dev": "bun run src/cli.ts start",
31
37
  "start": "bun run src/cli.ts start",
32
38
  "test": "bun test --timeout 20000",
33
39
  "test:package": "bun run scripts/package-smoke.ts",
40
+ "test:standalone": "bun run scripts/standalone-smoke.ts",
34
41
  "prepack": "bun run build",
35
42
  "typecheck": "bun x tsc --noEmit -p tsconfig.json"
36
43
  },