tinbase 0.9.0 → 0.10.1

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 (162) hide show
  1. package/README.md +10 -9
  2. package/dist/admin/api.d.ts +62 -1
  3. package/dist/admin/api.js +209 -10
  4. package/dist/admin/api.js.map +1 -1
  5. package/dist/admin/ui.d.ts +1 -1
  6. package/dist/admin/ui.js +1548 -16
  7. package/dist/admin/ui.js.map +1 -1
  8. package/dist/auth/handler.d.ts +52 -5
  9. package/dist/auth/handler.js +147 -36
  10. package/dist/auth/handler.js.map +1 -1
  11. package/dist/auth/inbox.d.ts +4 -2
  12. package/dist/auth/inbox.js +1 -0
  13. package/dist/auth/inbox.js.map +1 -1
  14. package/dist/auth/oauth.d.ts +30 -4
  15. package/dist/auth/oauth.js +22 -6
  16. package/dist/auth/oauth.js.map +1 -1
  17. package/dist/auth/password.d.ts +5 -0
  18. package/dist/auth/password.js +7 -0
  19. package/dist/auth/password.js.map +1 -1
  20. package/dist/auth/qr.d.ts +1 -1
  21. package/dist/auth/qr.js +1 -1
  22. package/dist/auth/rate-limit.d.ts +33 -0
  23. package/dist/auth/rate-limit.js +63 -0
  24. package/dist/auth/rate-limit.js.map +1 -0
  25. package/dist/auth/redirect.d.ts +20 -0
  26. package/dist/auth/redirect.js +79 -0
  27. package/dist/auth/redirect.js.map +1 -0
  28. package/dist/auth/settings.d.ts +55 -0
  29. package/dist/auth/settings.js +116 -0
  30. package/dist/auth/settings.js.map +1 -0
  31. package/dist/auth/totp.js +1 -1
  32. package/dist/cli.js +66 -30
  33. package/dist/cli.js.map +1 -1
  34. package/dist/cron/service.d.ts +15 -2
  35. package/dist/cron/service.js +19 -2
  36. package/dist/cron/service.js.map +1 -1
  37. package/dist/db/bootstrap.d.ts +13 -6
  38. package/dist/db/bootstrap.js +26 -5
  39. package/dist/db/bootstrap.js.map +1 -1
  40. package/dist/db/database.d.ts +61 -3
  41. package/dist/db/database.js +72 -9
  42. package/dist/db/database.js.map +1 -1
  43. package/dist/db/emulated.d.ts +39 -2
  44. package/dist/db/emulated.js +39 -23
  45. package/dist/db/emulated.js.map +1 -1
  46. package/dist/db/engine.d.ts +19 -5
  47. package/dist/db/engine.js +4 -2
  48. package/dist/db/engine.js.map +1 -1
  49. package/dist/db/inspect.d.ts +6 -1
  50. package/dist/db/inspect.js +2 -1
  51. package/dist/db/inspect.js.map +1 -1
  52. package/dist/db/pglite-engine.d.ts +7 -1
  53. package/dist/db/pglite-engine.js +7 -1
  54. package/dist/db/pglite-engine.js.map +1 -1
  55. package/dist/db/pgmem-engine.d.ts +9 -3
  56. package/dist/db/pgmem-engine.js +13 -7
  57. package/dist/db/pgmem-engine.js.map +1 -1
  58. package/dist/db/schema-diff.d.ts +9 -1
  59. package/dist/db/schema-diff.js +19 -5
  60. package/dist/db/schema-diff.js.map +1 -1
  61. package/dist/db/sql-compat.d.ts +2 -2
  62. package/dist/db/sql-compat.js +2 -2
  63. package/dist/functions/deno-shim.d.ts +6 -17
  64. package/dist/functions/deno-shim.js +42 -10
  65. package/dist/functions/deno-shim.js.map +1 -1
  66. package/dist/functions/handler.d.ts +9 -4
  67. package/dist/functions/handler.js +9 -1
  68. package/dist/functions/handler.js.map +1 -1
  69. package/dist/gen-types.d.ts +6 -1
  70. package/dist/gen-types.js +53 -41
  71. package/dist/gen-types.js.map +1 -1
  72. package/dist/index.d.ts +33 -3
  73. package/dist/index.js +170 -30
  74. package/dist/index.js.map +1 -1
  75. package/dist/jwt.d.ts +4 -1
  76. package/dist/jwt.js +4 -2
  77. package/dist/jwt.js.map +1 -1
  78. package/dist/log-buffer.d.ts +7 -1
  79. package/dist/log-buffer.js +3 -0
  80. package/dist/log-buffer.js.map +1 -1
  81. package/dist/net/service.d.ts +35 -6
  82. package/dist/net/service.js +72 -17
  83. package/dist/net/service.js.map +1 -1
  84. package/dist/node/bun-server.d.ts +2 -1
  85. package/dist/node/bun-server.js +11 -1
  86. package/dist/node/bun-server.js.map +1 -1
  87. package/dist/node/bundle-function.d.ts +1 -1
  88. package/dist/node/bundle-function.js +1 -1
  89. package/dist/node/config-toml.d.ts +31 -0
  90. package/dist/node/config-toml.js +186 -0
  91. package/dist/node/config-toml.js.map +1 -0
  92. package/dist/node/db-diff.d.ts +13 -1
  93. package/dist/node/db-diff.js +3 -1
  94. package/dist/node/db-diff.js.map +1 -1
  95. package/dist/node/fs-driver.d.ts +16 -1
  96. package/dist/node/fs-driver.js +20 -1
  97. package/dist/node/fs-driver.js.map +1 -1
  98. package/dist/node/index.d.ts +2 -2
  99. package/dist/node/index.js +1 -1
  100. package/dist/node/index.js.map +1 -1
  101. package/dist/node/load-config.d.ts +80 -0
  102. package/dist/node/load-config.js +230 -0
  103. package/dist/node/load-config.js.map +1 -0
  104. package/dist/node/load-functions.d.ts +17 -2
  105. package/dist/node/load-functions.js +17 -4
  106. package/dist/node/load-functions.js.map +1 -1
  107. package/dist/node/native/database-url.d.ts +25 -0
  108. package/dist/node/native/database-url.js +38 -0
  109. package/dist/node/native/database-url.js.map +1 -0
  110. package/dist/node/native/engine.d.ts +7 -0
  111. package/dist/node/native/engine.js +63 -85
  112. package/dist/node/native/engine.js.map +1 -1
  113. package/dist/node/native/wire-engine.d.ts +16 -0
  114. package/dist/node/native/wire-engine.js +83 -0
  115. package/dist/node/native/wire-engine.js.map +1 -0
  116. package/dist/node/native/wire.d.ts +25 -8
  117. package/dist/node/native/wire.js +130 -15
  118. package/dist/node/native/wire.js.map +1 -1
  119. package/dist/node/project.d.ts +15 -1
  120. package/dist/node/project.js +19 -7
  121. package/dist/node/project.js.map +1 -1
  122. package/dist/node/server-shared.d.ts +4 -1
  123. package/dist/node/server.d.ts +11 -0
  124. package/dist/node/server.js +11 -0
  125. package/dist/node/server.js.map +1 -1
  126. package/dist/node/ws.d.ts +26 -1
  127. package/dist/node/ws.js +26 -3
  128. package/dist/node/ws.js.map +1 -1
  129. package/dist/realtime/engine.d.ts +6 -0
  130. package/dist/realtime/engine.js +45 -34
  131. package/dist/realtime/engine.js.map +1 -1
  132. package/dist/rest/build.d.ts +44 -1
  133. package/dist/rest/build.js +96 -10
  134. package/dist/rest/build.js.map +1 -1
  135. package/dist/rest/errors.d.ts +8 -0
  136. package/dist/rest/errors.js +12 -1
  137. package/dist/rest/errors.js.map +1 -1
  138. package/dist/rest/handler.d.ts +17 -1
  139. package/dist/rest/handler.js +125 -10
  140. package/dist/rest/handler.js.map +1 -1
  141. package/dist/rest/parse.d.ts +26 -1
  142. package/dist/rest/parse.js +29 -2
  143. package/dist/rest/parse.js.map +1 -1
  144. package/dist/retention/service.d.ts +3 -0
  145. package/dist/retention/service.js +3 -1
  146. package/dist/retention/service.js.map +1 -1
  147. package/dist/security.d.ts +22 -0
  148. package/dist/security.js +47 -0
  149. package/dist/security.js.map +1 -0
  150. package/dist/storage/driver.d.ts +8 -1
  151. package/dist/storage/driver.js +4 -1
  152. package/dist/storage/driver.js.map +1 -1
  153. package/dist/storage/handler.d.ts +20 -1
  154. package/dist/storage/handler.js +272 -16
  155. package/dist/storage/handler.js.map +1 -1
  156. package/dist/types.d.ts +84 -1
  157. package/dist/types.js +10 -0
  158. package/dist/types.js.map +1 -1
  159. package/dist/webhooks/service.d.ts +25 -2
  160. package/dist/webhooks/service.js +21 -3
  161. package/dist/webhooks/service.js.map +1 -1
  162. package/package.json +5 -3
@@ -1,3 +1,10 @@
1
+ /**
2
+ * The Database facade over a DbEngine: bootstraps a fresh database into a
3
+ * Supabase-shaped project, applies migrations/seeds the way the Supabase CLI
4
+ * does, introspects schema/functions (with caching), and drives the realtime
5
+ * CDC pipeline. Everything above the engine (REST, auth, storage, realtime)
6
+ * goes through this class.
7
+ */
1
8
  import { BOOTSTRAP_SQL, MINIMAL_BOOTSTRAP_SQL } from './bootstrap.js';
2
9
  import { PGMQ_SQL, CRON_SQL, NET_SQL, EXT_COMPAT_SQL, VAULT_SQL } from './emulated.js';
3
10
  import { rewriteMigrationSql } from './sql-compat.js';
@@ -6,6 +13,10 @@ import { rewriteMigrationSql } from './sql-compat.js';
6
13
  // migration's own `SET search_path` can't leak across our single connection.
7
14
  const DEFAULT_SEARCH_PATH_SQL = `set search_path to "$user", public, extensions`;
8
15
  import { createPgliteEngine } from './pglite-engine.js';
16
+ /**
17
+ * The database facade: wraps a {@link DbEngine} with bootstrap, migration
18
+ * application, schema introspection (cached), and the realtime CDC pipeline.
19
+ */
9
20
  export class Database {
10
21
  engine;
11
22
  schemaCache = new Map();
@@ -26,7 +37,7 @@ export class Database {
26
37
  }
27
38
  else {
28
39
  await engine.exec(BOOTSTRAP_SQL);
29
- // emulated extensions (pgmq queues, cron, pg_net) — pure SQL, so
40
+ // emulated extensions (pgmq queues, cron, pg_net) - pure SQL, so
30
41
  // pgmq.*/cron.*/net.* work with no C extension on either engine
31
42
  await engine.exec(PGMQ_SQL);
32
43
  await engine.exec(CRON_SQL);
@@ -41,16 +52,17 @@ export class Database {
41
52
  }
42
53
  return new Database(engine);
43
54
  }
44
- /** Superuser query — used by auth/storage internals and introspection. */
55
+ /** Superuser query - used by auth/storage internals and introspection. */
45
56
  query(sql, params) {
46
57
  return this.engine.query(sql, params);
47
58
  }
59
+ /** Run one or more SQL statements with no params (superuser). */
48
60
  exec(sql) {
49
61
  return this.engine.exec(sql);
50
62
  }
51
63
  /**
52
64
  * Run `fn` inside a transaction with the request's Postgres role and JWT
53
- * claims applied via SET LOCAL — this is what makes RLS behave exactly
65
+ * claims applied via SET LOCAL - this is what makes RLS behave exactly
54
66
  * like hosted Supabase.
55
67
  */
56
68
  async withContext(ctx, fn) {
@@ -61,9 +73,20 @@ export class Database {
61
73
  });
62
74
  }
63
75
  // ── Migrations (Supabase CLI conventions) ────────────────────────────
76
+ /**
77
+ * Apply any not-yet-recorded migrations (in lexicographic version order) and
78
+ * an optional seed, each in its own transaction, then invalidate the schema
79
+ * cache. Returns the names of what was applied this run.
80
+ *
81
+ * @throws whatever a migration throws, except on the pg-mem engine where an
82
+ * unsupported migration is skipped with a warning instead of aborting.
83
+ */
64
84
  async runMigrations(migrations, seedSql) {
65
85
  const applied = [];
66
- const sorted = [...migrations].sort((a, b) => a.name.localeCompare(b.name));
86
+ // Plain code-unit comparison (not localeCompare, which is locale-dependent
87
+ // and can reorder `_`/digits) so migrations apply in the same order on every
88
+ // machine, matching the Supabase CLI's lexicographic version ordering.
89
+ const sorted = [...migrations].sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
67
90
  for (const m of sorted) {
68
91
  const version = m.name.match(/^(\d+)/)?.[1] ?? m.name;
69
92
  const seen = await this.engine.query(`select 1 from supabase_migrations.schema_migrations where version = $1`, [version]);
@@ -73,7 +96,7 @@ export class Database {
73
96
  // The Supabase CLI applies each migration on a fresh connection, so a
74
97
  // top-level `SET search_path TO ''` in one file never leaks to the next.
75
98
  // tinbase runs every migration on one connection, so reset to the
76
- // default first — otherwise a hardened migration's search_path change
99
+ // default first - otherwise a hardened migration's search_path change
77
100
  // breaks unqualified calls (e.g. gen_random_bytes) in later files.
78
101
  await tx.exec(DEFAULT_SEARCH_PATH_SQL);
79
102
  await tx.exec(rewriteMigrationSql(m.sql));
@@ -109,18 +132,20 @@ export class Database {
109
132
  }
110
133
  }
111
134
  if (applied.length > 0) {
112
- // a migration/seed may have left the session search_path at '' — restore
135
+ // a migration/seed may have left the session search_path at '' - restore
113
136
  // the default so runtime queries resolve extension functions unqualified
114
137
  await this.engine.exec(DEFAULT_SEARCH_PATH_SQL);
115
138
  this.invalidateSchemaCache();
116
139
  }
117
140
  return applied;
118
141
  }
142
+ /** Every migration recorded as applied, oldest version first. */
119
143
  async listAppliedMigrations() {
120
144
  const res = await this.engine.query(`select version, name from supabase_migrations.schema_migrations order by version`);
121
145
  return res.rows;
122
146
  }
123
147
  // ── Introspection ────────────────────────────────────────────────────
148
+ /** Drop all cached introspection; call after any DDL changes the schema. */
124
149
  invalidateSchemaCache() {
125
150
  this.schemaCache.clear();
126
151
  this.fnCache.clear();
@@ -139,6 +164,7 @@ export class Database {
139
164
  this.rlsCache.set(schema, set);
140
165
  return set;
141
166
  }
167
+ /** Introspect a schema's tables, columns, PKs, and FKs. Cached per schema. */
142
168
  async getSchemaInfo(schema) {
143
169
  const cached = this.schemaCache.get(schema);
144
170
  if (cached)
@@ -154,6 +180,25 @@ export class Database {
154
180
  on kcu.constraint_name = tc.constraint_name
155
181
  and kcu.constraint_schema = tc.constraint_schema
156
182
  where tc.constraint_type = 'PRIMARY KEY' and tc.table_schema = $1`, [schema]);
183
+ // PRIMARY KEY + UNIQUE constraints, grouped per constraint (in column order)
184
+ // so embed cardinality can tell one-to-one from one-to-many.
185
+ const uniq = await this.engine.query(`select kcu.table_name, kcu.constraint_name, kcu.column_name, kcu.ordinal_position as ordinal
186
+ from information_schema.table_constraints tc
187
+ join information_schema.key_column_usage kcu
188
+ on kcu.constraint_name = tc.constraint_name
189
+ and kcu.constraint_schema = tc.constraint_schema
190
+ where tc.constraint_type in ('PRIMARY KEY', 'UNIQUE') and tc.table_schema = $1
191
+ order by kcu.constraint_name, kcu.ordinal_position`, [schema]);
192
+ // table -> constraint -> ordered column list
193
+ const uniqByTable = new Map();
194
+ for (const u of uniq.rows) {
195
+ if (!uniqByTable.has(u.table_name))
196
+ uniqByTable.set(u.table_name, new Map());
197
+ const byConstraint = uniqByTable.get(u.table_name);
198
+ if (!byConstraint.has(u.constraint_name))
199
+ byConstraint.set(u.constraint_name, []);
200
+ byConstraint.get(u.constraint_name).push(u.column_name);
201
+ }
157
202
  const fks = await this.engine.query(`select
158
203
  tc.constraint_name,
159
204
  tc.table_schema as src_schema, tc.table_name as src_table,
@@ -185,6 +230,7 @@ export class Database {
185
230
  name: c.table_name,
186
231
  columns: [],
187
232
  primaryKey: [...(pkSet.get(c.table_name) ?? [])],
233
+ uniqueKeys: [...(uniqByTable.get(c.table_name)?.values() ?? [])],
188
234
  });
189
235
  }
190
236
  tables.get(c.table_name).columns.push({
@@ -219,6 +265,10 @@ export class Database {
219
265
  this.schemaCache.set(schema, info);
220
266
  return info;
221
267
  }
268
+ /**
269
+ * All overloads of a function by schema + name (cached). Multiple rows mean
270
+ * the name is overloaded on argument types.
271
+ */
222
272
  async getFunctions(schema, name) {
223
273
  const key = `${schema}.${name}`;
224
274
  const cached = this.fnCache.get(key);
@@ -226,6 +276,7 @@ export class Database {
226
276
  return cached;
227
277
  const res = await this.engine.query(`select p.proname as name, p.proretset as returns_set,
228
278
  t.typname as return_type, t.typtype as return_typtype,
279
+ p.provolatile as volatility,
229
280
  pg_get_function_identity_arguments(p.oid) as identity_args
230
281
  from pg_proc p
231
282
  join pg_namespace n on n.oid = p.pronamespace
@@ -237,12 +288,14 @@ export class Database {
237
288
  returnsSet: r.returns_set,
238
289
  returnType: r.return_type,
239
290
  returnTypType: r.return_typtype,
291
+ volatility: r.volatility,
240
292
  args: parseIdentityArgs(r.identity_args),
241
293
  }));
242
294
  this.fnCache.set(key, fns);
243
295
  return fns;
244
296
  }
245
297
  // ── Realtime CDC ─────────────────────────────────────────────────────
298
+ /** Idempotently attach the CDC notify trigger to a table (real engines only). */
246
299
  async ensureCdcTrigger(schema, table) {
247
300
  const s = quoteIdent(schema);
248
301
  const t = quoteIdent(table);
@@ -263,6 +316,10 @@ export class Database {
263
316
  end $$;
264
317
  `);
265
318
  }
319
+ /**
320
+ * Register a CDC listener; the first call starts the single LISTEN on the
321
+ * shared `tinbase_cdc` channel. Returns an unsubscribe fn.
322
+ */
266
323
  async onCdcEvent(cb) {
267
324
  this.cdcListeners.add(cb);
268
325
  if (!this.cdcStarted) {
@@ -274,7 +331,7 @@ export class Database {
274
331
  listener(event);
275
332
  }
276
333
  catch {
277
- // malformed payload — drop
334
+ // malformed payload - drop
278
335
  }
279
336
  });
280
337
  }
@@ -295,7 +352,7 @@ export class Database {
295
352
  * triggers/NOTIFY (pg-mem). Called by the REST handler after a committed
296
353
  * mutation, one event per affected row.
297
354
  *
298
- * NOTE: these engines have no RLS, so events are delivered unfiltered — the
355
+ * NOTE: these engines have no RLS, so events are delivered unfiltered - the
299
356
  * per-subscriber row check in the realtime layer is a no-op here.
300
357
  */
301
358
  emitCdc(meta, rows) {
@@ -314,12 +371,13 @@ export class Database {
314
371
  listener(event);
315
372
  }
316
373
  }
374
+ /** Close the underlying engine and its connection. */
317
375
  async close() {
318
376
  await this.engine.close();
319
377
  }
320
378
  }
321
379
  /** Parse pg_get_function_identity_arguments output: "a integer, b text[]". */
322
- function parseIdentityArgs(identity) {
380
+ export function parseIdentityArgs(identity) {
323
381
  if (!identity.trim())
324
382
  return [];
325
383
  const parts = [];
@@ -351,11 +409,16 @@ function parseIdentityArgs(identity) {
351
409
  return { name, type: tokens.slice(1).join(' ') };
352
410
  });
353
411
  }
412
+ /**
413
+ * Double-quote an identifier for safe interpolation into SQL.
414
+ * @throws if the name contains a NUL, which Postgres identifiers can't hold.
415
+ */
354
416
  export function quoteIdent(name) {
355
417
  if (name.includes('\0'))
356
418
  throw new Error('invalid identifier');
357
419
  return `"${name.replaceAll('"', '""')}"`;
358
420
  }
421
+ /** Single-quote a string literal for safe interpolation into SQL. */
359
422
  export function quoteLiteral(value) {
360
423
  return `'${value.replaceAll("'", "''")}'`;
361
424
  }
@@ -1 +1 @@
1
- {"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,MAAM,uBAAuB,GAAG,gDAAgD,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AA6DvD,MAAM,OAAO,QAAQ;IAMQ;IALnB,WAAW,GAAG,IAAI,GAAG,EAAsB,CAAA;IA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O,CAAC,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACzF,CAAC"}
@@ -8,8 +8,45 @@
8
8
  * `pgmq.send(...)`, `pgmq.read(...)`, `select cron.schedule(...)` etc. behave
9
9
  * the same from the client's and a migration's point of view.
10
10
  */
11
+ /**
12
+ * Self-contained SQL emulation of the pgmq extension: per-queue `q_<name>` /
13
+ * `a_<name>` tables plus create/send/read/pop/delete/archive/etc functions,
14
+ * matching pgmq's signatures. No C extension, no background worker needed.
15
+ */
11
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";
12
- export declare const CRON_SQL = "\ncreate schema if not exists cron;\n-- cron.schedule executes arbitrary SQL as the (superuser) function owner, so it\n-- must stay restricted to service_role \u2014 matching hosted Supabase, where\n-- authenticated cannot schedule jobs.\ngrant usage on schema cron to service_role;\n\ncreate table if not exists cron.job (\n jobid bigint generated always as identity primary key,\n schedule text not null,\n command text not null,\n jobname text unique,\n active boolean not null default true,\n created_at timestamptz not null default now()\n);\n\ncreate table if not exists cron.job_run_details (\n runid bigint generated always as identity primary key,\n jobid bigint,\n command text,\n status text,\n return_message text,\n start_time timestamptz,\n end_time timestamptz\n);\n\ncreate or replace function cron.schedule(job_name text, schedule text, command text)\nreturns bigint language plpgsql security definer set search_path = cron, pg_catalog, public as $cron$\ndeclare id bigint;\nbegin\n insert into cron.job (jobname, schedule, command) values (job_name, schedule, command)\n on conflict (jobname) do update set schedule = excluded.schedule, command = excluded.command, active = true\n returning jobid into id;\n return id;\nend $cron$;\n\ncreate or replace function cron.schedule(schedule text, command text)\nreturns bigint language plpgsql security definer set search_path = cron, pg_catalog, public as $cron$\nbegin\n return cron.schedule('job_' || floor(extract(epoch from clock_timestamp()) * 1000)::bigint::text, schedule, command);\nend $cron$;\n\ncreate or replace function cron.unschedule(job_name text)\nreturns boolean language plpgsql security definer set search_path = cron, pg_catalog, public as $cron$\ndeclare n integer;\nbegin\n delete from cron.job where jobname = job_name;\n get diagnostics n = row_count;\n return n > 0;\nend $cron$;\n\ncreate or replace function cron.unschedule(job_id bigint)\nreturns boolean language plpgsql security definer set search_path = cron, pg_catalog, public as $cron$\ndeclare n integer;\nbegin\n delete from cron.job where jobid = job_id;\n get diagnostics n = row_count;\n return n > 0;\nend $cron$;\n\ngrant execute on function cron.schedule(text,text,text), cron.schedule(text,text), cron.unschedule(text), cron.unschedule(bigint) to service_role;\n";
13
- export declare const NET_SQL = "\ncreate schema if not exists net;\n-- net.http_* can reach arbitrary URLs from the server (SSRF surface), so keep it\n-- restricted to service_role like hosted Supabase \u2014 not authenticated.\ngrant usage on schema net to service_role;\n\ncreate table if not exists net.http_request_queue (\n id bigint generated always as identity primary key,\n method text not null,\n url text not null,\n headers jsonb not null default '{}'::jsonb,\n body text,\n timeout_milliseconds int not null default 5000,\n created timestamptz not null default now()\n);\n\ncreate table if not exists net._http_response (\n id bigint primary key,\n status_code int,\n content_type text,\n headers jsonb,\n content text,\n timed_out boolean,\n error_msg text,\n created timestamptz not null default now()\n);\ngrant select on net._http_response to service_role;\n\n-- fold a jsonb param object into the URL as a query string (pg_net semantics)\ncreate or replace function net._merge_params(url text, params jsonb)\nreturns text language sql immutable as $net$\n select case\n when params is null or params = '{}'::jsonb then url\n else url || (case when position('?' in url) > 0 then '&' else '?' end) ||\n (select string_agg(key || '=' || (value #>> '{}'), '&') from jsonb_each(params))\n end;\n$net$;\n\ncreate or replace function net.http_get(url text, params jsonb default '{}'::jsonb, headers jsonb default '{}'::jsonb, timeout_milliseconds int default 5000)\nreturns bigint language plpgsql security definer set search_path = net, pg_catalog, public as $net$\ndeclare req_id bigint;\nbegin\n insert into net.http_request_queue (method, url, headers, body, timeout_milliseconds)\n values ('GET', net._merge_params(url, params), coalesce(headers, '{}'::jsonb), null, timeout_milliseconds)\n returning id into req_id;\n return req_id;\nend $net$;\n\ncreate or replace function net.http_post(url text, body jsonb default '{}'::jsonb, params jsonb default '{}'::jsonb, headers jsonb default '{}'::jsonb, timeout_milliseconds int default 5000)\nreturns bigint language plpgsql security definer set search_path = net, pg_catalog, public as $net$\ndeclare req_id bigint; hdrs jsonb;\nbegin\n hdrs := coalesce(headers, '{}'::jsonb);\n -- default the content type to JSON, matching pg_net, unless the caller set one\n if not (hdrs ? 'Content-Type' or hdrs ? 'content-type') then\n hdrs := hdrs || jsonb_build_object('Content-Type', 'application/json');\n end if;\n insert into net.http_request_queue (method, url, headers, body, timeout_milliseconds)\n values ('POST', net._merge_params(url, params), hdrs, body::text, timeout_milliseconds)\n returning id into req_id;\n return req_id;\nend $net$;\n\ncreate or replace function net.http_delete(url text, params jsonb default '{}'::jsonb, headers jsonb default '{}'::jsonb, timeout_milliseconds int default 5000)\nreturns bigint language plpgsql security definer set search_path = net, pg_catalog, public as $net$\ndeclare req_id bigint;\nbegin\n insert into net.http_request_queue (method, url, headers, body, timeout_milliseconds)\n values ('DELETE', net._merge_params(url, params), coalesce(headers, '{}'::jsonb), null, timeout_milliseconds)\n returning id into req_id;\n return req_id;\nend $net$;\n\ngrant execute on function net.http_get(text,jsonb,jsonb,int), net.http_post(text,jsonb,jsonb,jsonb,int), net.http_delete(text,jsonb,jsonb,int) to service_role;\n";
17
+ /**
18
+ * pg_cron emulation: the `cron.job` / `cron.job_run_details` tables and
19
+ * schedule/unschedule functions. This only records jobs; the in-process
20
+ * CronService (src/cron/service.ts) reads the table and runs them.
21
+ */
22
+ export declare const CRON_SQL = "\ncreate schema if not exists cron;\n-- cron.schedule executes arbitrary SQL as the (superuser) function owner, so it\n-- must stay restricted to service_role - matching hosted Supabase, where\n-- authenticated cannot schedule jobs.\ngrant usage on schema cron to service_role;\n\ncreate table if not exists cron.job (\n jobid bigint generated always as identity primary key,\n schedule text not null,\n command text not null,\n jobname text unique,\n active boolean not null default true,\n created_at timestamptz not null default now()\n);\n\ncreate table if not exists cron.job_run_details (\n runid bigint generated always as identity primary key,\n jobid bigint,\n command text,\n status text,\n return_message text,\n start_time timestamptz,\n end_time timestamptz\n);\n\ncreate or replace function cron.schedule(job_name text, schedule text, command text)\nreturns bigint language plpgsql security definer set search_path = cron, pg_catalog, public as $cron$\ndeclare id bigint;\nbegin\n insert into cron.job (jobname, schedule, command) values (job_name, schedule, command)\n on conflict (jobname) do update set schedule = excluded.schedule, command = excluded.command, active = true\n returning jobid into id;\n return id;\nend $cron$;\n\ncreate or replace function cron.schedule(schedule text, command text)\nreturns bigint language plpgsql security definer set search_path = cron, pg_catalog, public as $cron$\nbegin\n return cron.schedule('job_' || floor(extract(epoch from clock_timestamp()) * 1000)::bigint::text, schedule, command);\nend $cron$;\n\ncreate or replace function cron.unschedule(job_name text)\nreturns boolean language plpgsql security definer set search_path = cron, pg_catalog, public as $cron$\ndeclare n integer;\nbegin\n delete from cron.job where jobname = job_name;\n get diagnostics n = row_count;\n return n > 0;\nend $cron$;\n\ncreate or replace function cron.unschedule(job_id bigint)\nreturns boolean language plpgsql security definer set search_path = cron, pg_catalog, public as $cron$\ndeclare n integer;\nbegin\n delete from cron.job where jobid = job_id;\n get diagnostics n = row_count;\n return n > 0;\nend $cron$;\n\ngrant execute on function cron.schedule(text,text,text), cron.schedule(text,text), cron.unschedule(text), cron.unschedule(bigint) to service_role;\n";
23
+ /**
24
+ * pg_net emulation - the `net.http_get/post/delete` SQL surface. The functions
25
+ * only enqueue into net.http_request_queue; the in-process NetService
26
+ * (src/net/service.ts) performs the HTTP and records the reply in
27
+ * net._http_response, exactly like pg_net's background worker. This lets the
28
+ * common Supabase pattern - a cron job that calls net.http_post to hit an Edge
29
+ * Function - run unchanged, with no C extension on either engine.
30
+ */
31
+ export declare const NET_SQL = "\ncreate schema if not exists net;\n-- net.http_* can reach arbitrary URLs from the server (SSRF surface), so keep it\n-- restricted to service_role like hosted Supabase - not authenticated.\ngrant usage on schema net to service_role;\n\ncreate table if not exists net.http_request_queue (\n id bigint generated always as identity primary key,\n method text not null,\n url text not null,\n headers jsonb not null default '{}'::jsonb,\n body text,\n timeout_milliseconds int not null default 5000,\n created timestamptz not null default now()\n);\n\ncreate table if not exists net._http_response (\n id bigint primary key,\n status_code int,\n content_type text,\n headers jsonb,\n content text,\n timed_out boolean,\n error_msg text,\n created timestamptz not null default now()\n);\ngrant select on net._http_response to service_role;\n\n-- fold a jsonb param object into the URL as a query string (pg_net semantics)\ncreate or replace function net._merge_params(url text, params jsonb)\nreturns text language sql immutable as $net$\n select case\n when params is null or params = '{}'::jsonb then url\n else url || (case when position('?' in url) > 0 then '&' else '?' end) ||\n (select string_agg(key || '=' || (value #>> '{}'), '&') from jsonb_each(params))\n end;\n$net$;\n\ncreate or replace function net.http_get(url text, params jsonb default '{}'::jsonb, headers jsonb default '{}'::jsonb, timeout_milliseconds int default 5000)\nreturns bigint language plpgsql security definer set search_path = net, pg_catalog, public as $net$\ndeclare req_id bigint;\nbegin\n insert into net.http_request_queue (method, url, headers, body, timeout_milliseconds)\n values ('GET', net._merge_params(url, params), coalesce(headers, '{}'::jsonb), null, timeout_milliseconds)\n returning id into req_id;\n return req_id;\nend $net$;\n\ncreate or replace function net.http_post(url text, body jsonb default '{}'::jsonb, params jsonb default '{}'::jsonb, headers jsonb default '{}'::jsonb, timeout_milliseconds int default 5000)\nreturns bigint language plpgsql security definer set search_path = net, pg_catalog, public as $net$\ndeclare req_id bigint; hdrs jsonb;\nbegin\n hdrs := coalesce(headers, '{}'::jsonb);\n -- default the content type to JSON, matching pg_net, unless the caller set one\n if not (hdrs ? 'Content-Type' or hdrs ? 'content-type') then\n hdrs := hdrs || jsonb_build_object('Content-Type', 'application/json');\n end if;\n insert into net.http_request_queue (method, url, headers, body, timeout_milliseconds)\n values ('POST', net._merge_params(url, params), hdrs, body::text, timeout_milliseconds)\n returning id into req_id;\n return req_id;\nend $net$;\n\ncreate or replace function net.http_delete(url text, params jsonb default '{}'::jsonb, headers jsonb default '{}'::jsonb, timeout_milliseconds int default 5000)\nreturns bigint language plpgsql security definer set search_path = net, pg_catalog, public as $net$\ndeclare req_id bigint;\nbegin\n insert into net.http_request_queue (method, url, headers, body, timeout_milliseconds)\n values ('DELETE', net._merge_params(url, params), coalesce(headers, '{}'::jsonb), null, timeout_milliseconds)\n returning id into req_id;\n return req_id;\nend $net$;\n\ngrant execute on function net.http_get(text,jsonb,jsonb,int), net.http_post(text,jsonb,jsonb,jsonb,int), net.http_delete(text,jsonb,jsonb,int) to service_role;\n";
32
+ /**
33
+ * Small pure-SQL stand-ins for contrib extensions Supabase migrations lean on
34
+ * but which aren't in the PGlite / native builds. `moddatetime` (a BEFORE
35
+ * UPDATE trigger that stamps a timestamp column) is the common one - projects
36
+ * attach it as the updated_at trigger. Created only if absent, so a real
37
+ * extension (where present) still wins.
38
+ */
14
39
  export declare const EXT_COMPAT_SQL = "\ncreate schema if not exists extensions;\ndo $ensure_moddatetime$\nbegin\n if not exists (\n select 1 from pg_proc p join pg_namespace n on n.oid = p.pronamespace\n where n.nspname = 'extensions' and p.proname = 'moddatetime'\n ) then\n execute $fn$\n create function extensions.moddatetime() returns trigger language plpgsql as $mod$\n begin\n if TG_NARGS >= 1 then\n NEW := jsonb_populate_record(NEW, jsonb_build_object(TG_ARGV[0], now()));\n end if;\n return NEW;\n end\n $mod$\n $fn$;\n end if;\nend\n$ensure_moddatetime$;\n";
40
+ /**
41
+ * Supabase Vault emulation. Real Vault (supabase_vault + pgsodium) encrypts
42
+ * secrets at rest; we can't ship those C extensions. This stand-in keeps the
43
+ * same surface (vault.secrets, vault.decrypted_secrets, vault.create_secret /
44
+ * update_secret) but stores the secret encrypted with pgcrypto's authenticated
45
+ * symmetric encryption (pgp_sym_encrypt) under a key held in the GUC
46
+ * app.settings.vault_key, set at boot and never stored in the database.
47
+ *
48
+ * SECURITY: the stored `secret` column holds ciphertext; decrypted_secrets
49
+ * decrypts on read. If pgcrypto or the key is unavailable the functions raise,
50
+ * rather than silently falling back to cleartext.
51
+ */
15
52
  export declare const VAULT_SQL = "\ncreate schema if not exists vault;\ngrant usage on schema vault to service_role;\n\ncreate table if not exists vault.secrets (\n id uuid primary key default gen_random_uuid(),\n name text unique,\n description text not null default '',\n secret text not null,\n key_id uuid,\n nonce bytea,\n created_at timestamptz not null default now(),\n updated_at timestamptz not null default now()\n);\ngrant select, insert, update, delete on vault.secrets to service_role;\n\n-- the encryption key, from the GUC set at boot (empty string if unset)\ncreate or replace function vault._key() returns text\nlanguage sql stable as $vault$\n select coalesce(nullif(current_setting('app.settings.vault_key', true), ''), '')\n$vault$;\n\ncreate or replace function vault._encrypt(plain text) returns text\nlanguage plpgsql security definer set search_path = vault, extensions, pg_catalog, public as $vault$\ndeclare k text := vault._key();\nbegin\n if plain is null then return null; end if;\n if k = '' then raise exception 'vault key is not configured'; end if;\n return encode(pgp_sym_encrypt(plain, k), 'base64');\nend $vault$;\n\ncreate or replace function vault._decrypt(cipher text) returns text\nlanguage plpgsql security definer set search_path = vault, extensions, pg_catalog, public as $vault$\ndeclare k text := vault._key();\nbegin\n if cipher is null then return null; end if;\n if k = '' then raise exception 'vault key is not configured'; end if;\n return pgp_sym_decrypt(decode(cipher, 'base64'), k);\nend $vault$;\n\ncreate or replace view vault.decrypted_secrets as\n select id, name, description, secret, vault._decrypt(secret) as decrypted_secret, key_id, nonce, created_at, updated_at\n from vault.secrets;\ngrant select on vault.decrypted_secrets to service_role;\n\ncreate or replace function vault.create_secret(new_secret text, new_name text default null, new_description text default '', new_key_id uuid default null)\nreturns uuid language plpgsql security definer set search_path = vault, pg_catalog, public as $vault$\ndeclare rec_id uuid;\nbegin\n insert into vault.secrets (name, description, secret, key_id)\n values (new_name, coalesce(new_description, ''), vault._encrypt(new_secret), new_key_id)\n returning id into rec_id;\n return rec_id;\nend $vault$;\n\ncreate or replace function vault.update_secret(secret_id uuid, new_secret text default null, new_name text default null, new_description text default null, new_key_id uuid default null)\nreturns void language plpgsql security definer set search_path = vault, pg_catalog, public as $vault$\nbegin\n update vault.secrets set\n secret = case when new_secret is null then secret else vault._encrypt(new_secret) end,\n name = coalesce(new_name, name),\n description = coalesce(new_description, description),\n key_id = coalesce(new_key_id, key_id),\n updated_at = now()\n where id = secret_id;\nend $vault$;\n\ngrant execute on function vault.create_secret(text,text,text,uuid), vault.update_secret(uuid,text,text,text,uuid) to service_role;\n";
@@ -9,6 +9,11 @@
9
9
  * the same from the client's and a migration's point of view.
10
10
  */
11
11
  // ── pgmq (message queue) ────────────────────────────────────────────────────
12
+ /**
13
+ * Self-contained SQL emulation of the pgmq extension: per-queue `q_<name>` /
14
+ * `a_<name>` tables plus create/send/read/pop/delete/archive/etc functions,
15
+ * matching pgmq's signatures. No C extension, no background worker needed.
16
+ */
12
17
  export const PGMQ_SQL = `
13
18
  create schema if not exists pgmq;
14
19
  grant usage on schema pgmq to anon, authenticated, service_role;
@@ -116,10 +121,15 @@ $pgmq$;
116
121
  grant execute on all functions in schema pgmq to anon, authenticated, service_role;
117
122
  `;
118
123
  // ── cron (scheduled jobs) ────────────────────────────────────────────────────
124
+ /**
125
+ * pg_cron emulation: the `cron.job` / `cron.job_run_details` tables and
126
+ * schedule/unschedule functions. This only records jobs; the in-process
127
+ * CronService (src/cron/service.ts) reads the table and runs them.
128
+ */
119
129
  export const CRON_SQL = `
120
130
  create schema if not exists cron;
121
131
  -- cron.schedule executes arbitrary SQL as the (superuser) function owner, so it
122
- -- must stay restricted to service_role — matching hosted Supabase, where
132
+ -- must stay restricted to service_role - matching hosted Supabase, where
123
133
  -- authenticated cannot schedule jobs.
124
134
  grant usage on schema cron to service_role;
125
135
 
@@ -178,16 +188,18 @@ end $cron$;
178
188
 
179
189
  grant execute on function cron.schedule(text,text,text), cron.schedule(text,text), cron.unschedule(text), cron.unschedule(bigint) to service_role;
180
190
  `;
181
- // pg_net emulation — the `net.http_get/post/delete` SQL surface. The functions
182
- // only enqueue into net.http_request_queue; the in-process NetService
183
- // (src/net/service.ts) performs the HTTP and records the reply in
184
- // net._http_response, exactly like pg_net's background worker. This lets the
185
- // common Supabase pattern — a cron job that calls net.http_post to hit an Edge
186
- // Function — run unchanged, with no C extension on either engine.
191
+ /**
192
+ * pg_net emulation - the `net.http_get/post/delete` SQL surface. The functions
193
+ * only enqueue into net.http_request_queue; the in-process NetService
194
+ * (src/net/service.ts) performs the HTTP and records the reply in
195
+ * net._http_response, exactly like pg_net's background worker. This lets the
196
+ * common Supabase pattern - a cron job that calls net.http_post to hit an Edge
197
+ * Function - run unchanged, with no C extension on either engine.
198
+ */
187
199
  export const NET_SQL = `
188
200
  create schema if not exists net;
189
201
  -- net.http_* can reach arbitrary URLs from the server (SSRF surface), so keep it
190
- -- restricted to service_role like hosted Supabase — not authenticated.
202
+ -- restricted to service_role like hosted Supabase - not authenticated.
191
203
  grant usage on schema net to service_role;
192
204
 
193
205
  create table if not exists net.http_request_queue (
@@ -259,11 +271,13 @@ end $net$;
259
271
 
260
272
  grant execute on function net.http_get(text,jsonb,jsonb,int), net.http_post(text,jsonb,jsonb,jsonb,int), net.http_delete(text,jsonb,jsonb,int) to service_role;
261
273
  `;
262
- // Small pure-SQL stand-ins for contrib extensions Supabase migrations lean on
263
- // but which aren't in the PGlite / native builds. `moddatetime` (a BEFORE
264
- // UPDATE trigger that stamps a timestamp column) is the common one — projects
265
- // attach it as the updated_at trigger. Created only if absent, so a real
266
- // extension (where present) still wins.
274
+ /**
275
+ * Small pure-SQL stand-ins for contrib extensions Supabase migrations lean on
276
+ * but which aren't in the PGlite / native builds. `moddatetime` (a BEFORE
277
+ * UPDATE trigger that stamps a timestamp column) is the common one - projects
278
+ * attach it as the updated_at trigger. Created only if absent, so a real
279
+ * extension (where present) still wins.
280
+ */
267
281
  export const EXT_COMPAT_SQL = `
268
282
  create schema if not exists extensions;
269
283
  do $ensure_moddatetime$
@@ -286,16 +300,18 @@ begin
286
300
  end
287
301
  $ensure_moddatetime$;
288
302
  `;
289
- // Supabase Vault emulation. Real Vault (supabase_vault + pgsodium) encrypts
290
- // secrets at rest; we can't ship those C extensions. This stand-in keeps the
291
- // same surface (vault.secrets, vault.decrypted_secrets, vault.create_secret /
292
- // update_secret) but stores the secret encrypted with pgcrypto's authenticated
293
- // symmetric encryption (pgp_sym_encrypt) under a key held in the GUC
294
- // app.settings.vault_key — set at boot, never stored in the database.
295
- //
296
- // The stored `secret` column holds ciphertext; decrypted_secrets decrypts on
297
- // read. If pgcrypto or the key is unavailable the functions raise, rather than
298
- // silently falling back to cleartext.
303
+ /**
304
+ * Supabase Vault emulation. Real Vault (supabase_vault + pgsodium) encrypts
305
+ * secrets at rest; we can't ship those C extensions. This stand-in keeps the
306
+ * same surface (vault.secrets, vault.decrypted_secrets, vault.create_secret /
307
+ * update_secret) but stores the secret encrypted with pgcrypto's authenticated
308
+ * symmetric encryption (pgp_sym_encrypt) under a key held in the GUC
309
+ * app.settings.vault_key, set at boot and never stored in the database.
310
+ *
311
+ * SECURITY: the stored `secret` column holds ciphertext; decrypted_secrets
312
+ * decrypts on read. If pgcrypto or the key is unavailable the functions raise,
313
+ * rather than silently falling back to cleartext.
314
+ */
299
315
  export const VAULT_SQL = `
300
316
  create schema if not exists vault;
301
317
  grant usage on schema vault to service_role;
@@ -1 +1 @@
1
- {"version":3,"file":"emulated.js","sourceRoot":"","sources":["../../src/db/emulated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyGvB,CAAA;AAED,gFAAgF;AAChF,MAAM,CAAC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0EtB,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;CAqB7B,CAAA;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoExB,CAAA"}
@@ -1,32 +1,46 @@
1
1
  /**
2
2
  * Database engine abstraction. Two implementations:
3
- * - PGlite (WASM Postgres) — portable, runs in the browser; heavier RAM.
4
- * - Native embedded Postgres (Node only) — PocketBase-class footprint.
3
+ * - PGlite (WASM Postgres): portable, runs in the browser; heavier RAM.
4
+ * - Native embedded Postgres (Node only): PocketBase-class footprint.
5
5
  * The rest of tinbase only talks to this interface.
6
6
  */
7
+ /** Result of a query: returned rows plus, for writes, the affected row count. */
7
8
  export interface EngineResults<T = any> {
9
+ /** result rows, typed as `T` */
8
10
  rows: T[];
11
+ /** rows touched by an INSERT/UPDATE/DELETE; undefined for plain SELECTs */
9
12
  affectedRows?: number;
10
13
  }
14
+ /** Handle passed to a transaction callback; scoped to the open transaction. */
11
15
  export interface EngineTx {
16
+ /** run a parameterized query within the transaction */
12
17
  query<T = any>(sql: string, params?: unknown[]): Promise<EngineResults<T>>;
18
+ /** run one or more statements within the transaction (no params) */
13
19
  exec(sql: string): Promise<void>;
14
20
  }
21
+ /**
22
+ * The single database interface the rest of tinbase talks to, regardless of
23
+ * whether it's backed by PGlite, native embedded Postgres, or the pg-mem subset.
24
+ */
15
25
  export interface DbEngine {
16
26
  /** true for subset engines (pg-mem) that can't run the full plpgsql/RLS bootstrap */
17
27
  minimalBootstrap?: boolean;
28
+ /** run a parameterized query */
18
29
  query<T = any>(sql: string, params?: unknown[]): Promise<EngineResults<T>>;
19
- /** Run multiple SQL statements (no params). */
30
+ /** run multiple SQL statements (no params) */
20
31
  exec(sql: string): Promise<void>;
21
- /** Serialized transaction — implementations must guarantee mutual exclusion. */
32
+ /** serialized transaction; implementations must guarantee mutual exclusion */
22
33
  transaction<T>(fn: (tx: EngineTx) => Promise<T>): Promise<T>;
23
- /** Subscribe to pg_notify on a channel. Returns unsubscribe. */
34
+ /** subscribe to pg_notify on a channel; returns an unsubscribe function */
24
35
  listen(channel: string, cb: (payload: string) => void): Promise<() => void>;
36
+ /** close the underlying connection/instance */
25
37
  close(): Promise<void>;
26
38
  }
27
39
  /** Simple async mutex for engines that serialize over one connection. */
28
40
  export declare class Mutex {
29
41
  private tail;
42
+ /** Acquire the lock; await the returned release fn's turn, then call it to free it. */
30
43
  lock(): Promise<() => void>;
44
+ /** Run `fn` while holding the lock; releases even if `fn` throws. */
31
45
  run<T>(fn: () => Promise<T>): Promise<T>;
32
46
  }
package/dist/db/engine.js CHANGED
@@ -1,12 +1,13 @@
1
1
  /**
2
2
  * Database engine abstraction. Two implementations:
3
- * - PGlite (WASM Postgres) — portable, runs in the browser; heavier RAM.
4
- * - Native embedded Postgres (Node only) — PocketBase-class footprint.
3
+ * - PGlite (WASM Postgres): portable, runs in the browser; heavier RAM.
4
+ * - Native embedded Postgres (Node only): PocketBase-class footprint.
5
5
  * The rest of tinbase only talks to this interface.
6
6
  */
7
7
  /** Simple async mutex for engines that serialize over one connection. */
8
8
  export class Mutex {
9
9
  tail = Promise.resolve();
10
+ /** Acquire the lock; await the returned release fn's turn, then call it to free it. */
10
11
  async lock() {
11
12
  let release;
12
13
  const next = new Promise((r) => (release = r));
@@ -15,6 +16,7 @@ export class Mutex {
15
16
  await prev;
16
17
  return release;
17
18
  }
19
+ /** Run `fn` while holding the lock; releases even if `fn` throws. */
18
20
  async run(fn) {
19
21
  const release = await this.lock();
20
22
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/db/engine.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyBH,yEAAyE;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IAED,qEAAqE;IACrE,KAAK,CAAC,GAAG,CAAI,EAAoB;QAC/B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;QACjC,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,EAAE,CAAA;QACnB,CAAC;gBAAS,CAAC;YACT,OAAO,EAAE,CAAA;QACX,CAAC;IACH,CAAC;CACF"}
@@ -1,13 +1,18 @@
1
1
  /**
2
- * `tinbase inspect` core: a lightweight database report — per-table row counts
2
+ * `tinbase inspect` core: a lightweight database report - per-table row counts
3
3
  * and on-disk size for a schema. Like a tiny `supabase inspect db`, enough to
4
4
  * eyeball what's in a local project. (Uses pg_total_relation_size, so it runs
5
5
  * on the real-Postgres engines, not the pg-mem subset.)
6
6
  */
7
7
  import { type Database } from './database.js';
8
+ /** One row of the inspect report: a table with its row count and on-disk size. */
8
9
  export interface TableInfo {
10
+ /** table name (unqualified) */
9
11
  table: string;
12
+ /** live row count from count(*) */
10
13
  rows: number;
14
+ /** human-readable total relation size (pg_size_pretty) */
11
15
  size: string;
12
16
  }
17
+ /** Report per-table row counts and on-disk sizes for a schema, largest first. */
13
18
  export declare function inspectDb(db: Database, schema?: string): Promise<TableInfo[]>;
@@ -1,10 +1,11 @@
1
1
  /**
2
- * `tinbase inspect` core: a lightweight database report — per-table row counts
2
+ * `tinbase inspect` core: a lightweight database report - per-table row counts
3
3
  * and on-disk size for a schema. Like a tiny `supabase inspect db`, enough to
4
4
  * eyeball what's in a local project. (Uses pg_total_relation_size, so it runs
5
5
  * on the real-Postgres engines, not the pg-mem subset.)
6
6
  */
7
7
  import { quoteIdent } from './database.js';
8
+ /** Report per-table row counts and on-disk sizes for a schema, largest first. */
8
9
  export async function inspectDb(db, schema = 'public') {
9
10
  const tables = await db.query(`select c.relname as table,
10
11
  pg_size_pretty(pg_total_relation_size(c.oid)) as size
@@ -1 +1 @@
1
- {"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../src/db/inspect.ts"],"names":[],"mappings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