@supacloud/lite 0.29.0 → 0.29.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.29.2](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.29.1...supacloud-lite-v0.29.2) (2026-10-15)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **lite:** resolve RPC overloads using required arguments ([#1967](https://github.com/vibeunion/supacloud/issues/1967)) ([e00ffaf](https://github.com/vibeunion/supacloud/commit/e00ffafd41aa52c8f14c2e81f3bb8a8914b336c8))
9
+
10
+ ## [0.29.1](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.29.0...supacloud-lite-v0.29.1) (2026-10-15)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **lite:** enforce read-only table and view requests ([#1941](https://github.com/vibeunion/supacloud/issues/1941)) ([d726716](https://github.com/vibeunion/supacloud/commit/d726716a1492a5a581f99a1aa40f15a1125a23aa))
16
+
3
17
  ## [0.29.0](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.28.3...supacloud-lite-v0.29.0) (2026-10-15)
4
18
 
5
19
 
package/dist/cli.js CHANGED
@@ -8,7 +8,7 @@ import { dirname as dirname8, join as join10, resolve as resolve6 } from "path";
8
8
  // package.json
9
9
  var package_default = {
10
10
  name: "@supacloud/lite",
11
- version: "0.29.0",
11
+ version: "0.29.2",
12
12
  description: "Bun-native, single-project Supabase-compatible backend powered by PGlite or native PostgreSQL",
13
13
  type: "module",
14
14
  license: "Apache-2.0",
@@ -6822,7 +6822,17 @@ class Database {
6822
6822
  const res = await this.engine.query(`select p.proname as name, p.proretset as returns_set,
6823
6823
  t.typname as return_type, t.typtype as return_typtype,
6824
6824
  p.provolatile as volatility,
6825
- pg_get_function_identity_arguments(p.oid) as identity_args
6825
+ p.pronargs - p.pronargdefaults as required_arg_count,
6826
+ coalesce((
6827
+ select json_agg(json_build_object(
6828
+ 'name', coalesce(a.name, ''),
6829
+ 'type', format_type(a.type, null)
6830
+ ) order by a.ordinal)
6831
+ from unnest(coalesce(p.proallargtypes, p.proargtypes::oid[]),
6832
+ p.proargnames, p.proargmodes)
6833
+ with ordinality as a(type, name, mode, ordinal)
6834
+ where a.mode is null or a.mode in ('i', 'b', 'v')
6835
+ ), '[]'::json) as input_args
6826
6836
  from pg_proc p
6827
6837
  join pg_namespace n on n.oid = p.pronamespace
6828
6838
  join pg_type t on t.oid = p.prorettype
@@ -6834,7 +6844,8 @@ class Database {
6834
6844
  returnType: r.return_type,
6835
6845
  returnTypType: r.return_typtype,
6836
6846
  volatility: r.volatility,
6837
- args: parseIdentityArgs(r.identity_args)
6847
+ requiredArgCount: r.required_arg_count,
6848
+ args: r.input_args
6838
6849
  }));
6839
6850
  this.fnCache.set(key, fns);
6840
6851
  return fns;
@@ -8365,10 +8376,10 @@ function renderFilter(f, alias) {
8365
8376
  }
8366
8377
 
8367
8378
  // src/runtime/rest/errors.ts
8368
- function statusForSqlState(code) {
8379
+ function statusForSqlState(code, authenticated = true) {
8369
8380
  switch (code) {
8370
8381
  case "42501":
8371
- return 403;
8382
+ return authenticated ? 403 : 401;
8372
8383
  case "25006":
8373
8384
  return 405;
8374
8385
  case "23503":
@@ -8386,7 +8397,7 @@ function statusForSqlState(code) {
8386
8397
  return 400;
8387
8398
  }
8388
8399
  }
8389
- function errorToResponse(e) {
8400
+ function errorToResponse(e, authenticated = true) {
8390
8401
  if (e instanceof ApiError) {
8391
8402
  return jsonResponse(e.status, e.body);
8392
8403
  }
@@ -8395,7 +8406,7 @@ function errorToResponse(e) {
8395
8406
  }
8396
8407
  const pg = e;
8397
8408
  if (pg && typeof pg.code === "string" && /^[0-9A-Z]{5}$/.test(pg.code)) {
8398
- return jsonResponse(statusForSqlState(pg.code), {
8409
+ return jsonResponse(statusForSqlState(pg.code, authenticated), {
8399
8410
  code: pg.code,
8400
8411
  message: pg.message,
8401
8412
  details: pg.detail ?? null,
@@ -8515,7 +8526,7 @@ class RestHandler {
8515
8526
  }
8516
8527
  return await this.handleTable(req, ctx, url, schema, decodeURIComponent(rest));
8517
8528
  } catch (e) {
8518
- return errorToResponse(e);
8529
+ return errorToResponse(e, ctx.role !== "anon");
8519
8530
  }
8520
8531
  }
8521
8532
  async handleTable(req, ctx, url, schema, table) {
@@ -8543,7 +8554,10 @@ class RestHandler {
8543
8554
  ...explain.options.map((o) => o.toUpperCase()),
8544
8555
  `FORMAT ${explain.format}`
8545
8556
  ].join(", ");
8546
- const res = await this.db.withContext(ctx, (query) => query(`explain (${explainOpts}) ${plan.sql}`, plan.params));
8557
+ const res = await this.db.withContext(ctx, async (query) => {
8558
+ await query("set transaction read only");
8559
+ return query(`explain (${explainOpts}) ${plan.sql}`, plan.params);
8560
+ });
8547
8561
  const cell = res.rows[0]["QUERY PLAN"];
8548
8562
  if (explain.format === "JSON") {
8549
8563
  const body = typeof cell === "string" ? cell : JSON.stringify(cell);
@@ -8561,6 +8575,7 @@ class RestHandler {
8561
8575
  }
8562
8576
  const built = builder.buildSelect(table, { count: prefer.count !== undefined });
8563
8577
  const { rows, count } = await this.db.withContext(ctx, async (query) => {
8578
+ await query("set transaction read only");
8564
8579
  const res = await query(built.sql, built.params);
8565
8580
  let count = null;
8566
8581
  if (built.countSql) {
@@ -8713,9 +8728,11 @@ class RestHandler {
8713
8728
  }
8714
8729
  }
8715
8730
  }
8716
- const fn = pickOverload(fns, Object.keys(args));
8731
+ const fn = pickOverload(schema, fnName, fns, Object.keys(args));
8717
8732
  const call = renderCall(schema, fn, args);
8718
8733
  const q = parseQuery(searchParams);
8734
+ if (method === "GET" || method === "HEAD")
8735
+ applyRequestRange(q, req);
8719
8736
  if (fn.volatility === "v") {
8720
8737
  return await this.runRpc(ctx, fn, call, q, prefer, wantsObject, wantsCsv, schema, method).finally(() => this.db.invalidateSchemaCache());
8721
8738
  }
@@ -8740,6 +8757,10 @@ class RestHandler {
8740
8757
  const res = await withRpcContext((query) => query(`select coalesce(json_agg(_v), '[]'::json) as body from ${call} as _t(_v)`, []));
8741
8758
  return jsonResponse(200, res.rows[0].body);
8742
8759
  }
8760
+ if (this.maxRows !== undefined) {
8761
+ const requested = q.limits.get("");
8762
+ q.limits.set("", requested === undefined ? this.maxRows : Math.min(requested, this.maxRows));
8763
+ }
8743
8764
  const alias = "_f";
8744
8765
  const exprs = [];
8745
8766
  for (const item of q.select) {
@@ -8793,20 +8814,31 @@ function assertObjectCardinality(rows) {
8793
8814
  });
8794
8815
  }
8795
8816
  }
8796
- function pickOverload(fns, providedNames) {
8817
+ function pickOverload(schema, name, fns, providedNames) {
8797
8818
  const provided = new Set(providedNames);
8798
- let best = null;
8799
- for (const fn of fns) {
8819
+ const matches = fns.filter((fn) => {
8800
8820
  const names = new Set(fn.args.map((a) => a.name));
8801
- const allProvidedKnown = [...provided].every((p) => names.has(p));
8802
- if (!allProvidedKnown)
8803
- continue;
8804
- if (fn.args.length === provided.size)
8805
- return fn;
8806
- if (!best)
8807
- best = fn;
8821
+ return [...provided].every((p) => names.has(p)) && fn.args.slice(0, fn.requiredArgCount).every((arg) => provided.has(arg.name));
8822
+ });
8823
+ if (matches.length > 1) {
8824
+ const candidates = matches.map((fn) => `${fn.schema}.${fn.name}(${fn.args.map((arg) => `${arg.name} => ${arg.type}`).join(", ")})`);
8825
+ throw new ApiError(300, {
8826
+ code: "PGRST203",
8827
+ message: `Could not choose the best candidate function between: ${candidates.join(", ")}`,
8828
+ details: null,
8829
+ hint: "Try renaming the parameters or the function itself in the database so function overloading can be resolved"
8830
+ });
8831
+ }
8832
+ const match = matches[0];
8833
+ if (!match) {
8834
+ throw new ApiError(404, {
8835
+ code: "PGRST202",
8836
+ message: `Could not find the function ${schema}.${name}(${[...provided].sort().join(", ")}) in the schema cache`,
8837
+ details: null,
8838
+ hint: null
8839
+ });
8808
8840
  }
8809
- return best ?? fns[0];
8841
+ return match;
8810
8842
  }
8811
8843
  function renderCall(schema, fn, args) {
8812
8844
  const parts = [];
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.29.0",
91
+ version: "0.29.2",
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",
@@ -6816,7 +6816,17 @@ class Database {
6816
6816
  const res = await this.engine.query(`select p.proname as name, p.proretset as returns_set,
6817
6817
  t.typname as return_type, t.typtype as return_typtype,
6818
6818
  p.provolatile as volatility,
6819
- pg_get_function_identity_arguments(p.oid) as identity_args
6819
+ p.pronargs - p.pronargdefaults as required_arg_count,
6820
+ coalesce((
6821
+ select json_agg(json_build_object(
6822
+ 'name', coalesce(a.name, ''),
6823
+ 'type', format_type(a.type, null)
6824
+ ) order by a.ordinal)
6825
+ from unnest(coalesce(p.proallargtypes, p.proargtypes::oid[]),
6826
+ p.proargnames, p.proargmodes)
6827
+ with ordinality as a(type, name, mode, ordinal)
6828
+ where a.mode is null or a.mode in ('i', 'b', 'v')
6829
+ ), '[]'::json) as input_args
6820
6830
  from pg_proc p
6821
6831
  join pg_namespace n on n.oid = p.pronamespace
6822
6832
  join pg_type t on t.oid = p.prorettype
@@ -6828,7 +6838,8 @@ class Database {
6828
6838
  returnType: r.return_type,
6829
6839
  returnTypType: r.return_typtype,
6830
6840
  volatility: r.volatility,
6831
- args: parseIdentityArgs(r.identity_args)
6841
+ requiredArgCount: r.required_arg_count,
6842
+ args: r.input_args
6832
6843
  }));
6833
6844
  this.fnCache.set(key, fns);
6834
6845
  return fns;
@@ -8359,10 +8370,10 @@ function renderFilter(f, alias) {
8359
8370
  }
8360
8371
 
8361
8372
  // src/runtime/rest/errors.ts
8362
- function statusForSqlState(code) {
8373
+ function statusForSqlState(code, authenticated = true) {
8363
8374
  switch (code) {
8364
8375
  case "42501":
8365
- return 403;
8376
+ return authenticated ? 403 : 401;
8366
8377
  case "25006":
8367
8378
  return 405;
8368
8379
  case "23503":
@@ -8380,7 +8391,7 @@ function statusForSqlState(code) {
8380
8391
  return 400;
8381
8392
  }
8382
8393
  }
8383
- function errorToResponse(e) {
8394
+ function errorToResponse(e, authenticated = true) {
8384
8395
  if (e instanceof ApiError) {
8385
8396
  return jsonResponse(e.status, e.body);
8386
8397
  }
@@ -8389,7 +8400,7 @@ function errorToResponse(e) {
8389
8400
  }
8390
8401
  const pg = e;
8391
8402
  if (pg && typeof pg.code === "string" && /^[0-9A-Z]{5}$/.test(pg.code)) {
8392
- return jsonResponse(statusForSqlState(pg.code), {
8403
+ return jsonResponse(statusForSqlState(pg.code, authenticated), {
8393
8404
  code: pg.code,
8394
8405
  message: pg.message,
8395
8406
  details: pg.detail ?? null,
@@ -8509,7 +8520,7 @@ class RestHandler {
8509
8520
  }
8510
8521
  return await this.handleTable(req, ctx, url, schema, decodeURIComponent(rest));
8511
8522
  } catch (e) {
8512
- return errorToResponse(e);
8523
+ return errorToResponse(e, ctx.role !== "anon");
8513
8524
  }
8514
8525
  }
8515
8526
  async handleTable(req, ctx, url, schema, table) {
@@ -8537,7 +8548,10 @@ class RestHandler {
8537
8548
  ...explain.options.map((o) => o.toUpperCase()),
8538
8549
  `FORMAT ${explain.format}`
8539
8550
  ].join(", ");
8540
- const res = await this.db.withContext(ctx, (query) => query(`explain (${explainOpts}) ${plan.sql}`, plan.params));
8551
+ const res = await this.db.withContext(ctx, async (query) => {
8552
+ await query("set transaction read only");
8553
+ return query(`explain (${explainOpts}) ${plan.sql}`, plan.params);
8554
+ });
8541
8555
  const cell = res.rows[0]["QUERY PLAN"];
8542
8556
  if (explain.format === "JSON") {
8543
8557
  const body = typeof cell === "string" ? cell : JSON.stringify(cell);
@@ -8555,6 +8569,7 @@ class RestHandler {
8555
8569
  }
8556
8570
  const built = builder.buildSelect(table, { count: prefer.count !== undefined });
8557
8571
  const { rows, count } = await this.db.withContext(ctx, async (query) => {
8572
+ await query("set transaction read only");
8558
8573
  const res = await query(built.sql, built.params);
8559
8574
  let count = null;
8560
8575
  if (built.countSql) {
@@ -8707,9 +8722,11 @@ class RestHandler {
8707
8722
  }
8708
8723
  }
8709
8724
  }
8710
- const fn = pickOverload(fns, Object.keys(args));
8725
+ const fn = pickOverload(schema, fnName, fns, Object.keys(args));
8711
8726
  const call = renderCall(schema, fn, args);
8712
8727
  const q = parseQuery(searchParams);
8728
+ if (method === "GET" || method === "HEAD")
8729
+ applyRequestRange(q, req);
8713
8730
  if (fn.volatility === "v") {
8714
8731
  return await this.runRpc(ctx, fn, call, q, prefer, wantsObject, wantsCsv, schema, method).finally(() => this.db.invalidateSchemaCache());
8715
8732
  }
@@ -8734,6 +8751,10 @@ class RestHandler {
8734
8751
  const res = await withRpcContext((query) => query(`select coalesce(json_agg(_v), '[]'::json) as body from ${call} as _t(_v)`, []));
8735
8752
  return jsonResponse(200, res.rows[0].body);
8736
8753
  }
8754
+ if (this.maxRows !== undefined) {
8755
+ const requested = q.limits.get("");
8756
+ q.limits.set("", requested === undefined ? this.maxRows : Math.min(requested, this.maxRows));
8757
+ }
8737
8758
  const alias = "_f";
8738
8759
  const exprs = [];
8739
8760
  for (const item of q.select) {
@@ -8787,20 +8808,31 @@ function assertObjectCardinality(rows) {
8787
8808
  });
8788
8809
  }
8789
8810
  }
8790
- function pickOverload(fns, providedNames) {
8811
+ function pickOverload(schema, name, fns, providedNames) {
8791
8812
  const provided = new Set(providedNames);
8792
- let best = null;
8793
- for (const fn of fns) {
8813
+ const matches = fns.filter((fn) => {
8794
8814
  const names = new Set(fn.args.map((a) => a.name));
8795
- const allProvidedKnown = [...provided].every((p) => names.has(p));
8796
- if (!allProvidedKnown)
8797
- continue;
8798
- if (fn.args.length === provided.size)
8799
- return fn;
8800
- if (!best)
8801
- best = fn;
8815
+ return [...provided].every((p) => names.has(p)) && fn.args.slice(0, fn.requiredArgCount).every((arg) => provided.has(arg.name));
8816
+ });
8817
+ if (matches.length > 1) {
8818
+ const candidates = matches.map((fn) => `${fn.schema}.${fn.name}(${fn.args.map((arg) => `${arg.name} => ${arg.type}`).join(", ")})`);
8819
+ throw new ApiError(300, {
8820
+ code: "PGRST203",
8821
+ message: `Could not choose the best candidate function between: ${candidates.join(", ")}`,
8822
+ details: null,
8823
+ hint: "Try renaming the parameters or the function itself in the database so function overloading can be resolved"
8824
+ });
8825
+ }
8826
+ const match = matches[0];
8827
+ if (!match) {
8828
+ throw new ApiError(404, {
8829
+ code: "PGRST202",
8830
+ message: `Could not find the function ${schema}.${name}(${[...provided].sort().join(", ")}) in the schema cache`,
8831
+ details: null,
8832
+ hint: null
8833
+ });
8802
8834
  }
8803
- return best ?? fns[0];
8835
+ return match;
8804
8836
  }
8805
8837
  function renderCall(schema, fn, args) {
8806
8838
  const parts = [];
@@ -48,6 +48,8 @@ export interface FunctionInfo {
48
48
  returnTypType: string;
49
49
  /** pg_proc.provolatile: v=volatile, s=stable, i=immutable. Volatile calls may run DDL. */
50
50
  volatility: string;
51
+ /** Leading input arguments without a PostgreSQL default. */
52
+ requiredArgCount: number;
51
53
  args: FunctionArg[];
52
54
  }
53
55
  /** Introspected shape of one schema: tables keyed by name, plus its foreign keys. */
@@ -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,cAA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AE,GAC9B,IAAI;IAeP,sDAAsD;IAChD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE,CA2BjE;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"}
@@ -1,11 +1,11 @@
1
1
  /** HTTP status for a Postgres SQLSTATE, following PostgREST's mapping. */
2
- export declare function statusForSqlState(code: string): number;
2
+ export declare function statusForSqlState(code: string, authenticated?: boolean): number;
3
3
  /**
4
4
  * Normalize any thrown value into a JSON Response: ApiError/ParseError keep
5
5
  * their status; anything with a 5-char SQLSTATE is mapped via
6
6
  * {@link statusForSqlState}; everything else becomes a 500.
7
7
  */
8
- export declare function errorToResponse(e: unknown): Response;
8
+ export declare function errorToResponse(e: unknown, authenticated?: boolean): Response;
9
9
  /** JSON Response helper; status 204 sends no body. */
10
10
  export declare function jsonResponse(status: number, body: unknown, headers?: Record<string, string>): Response;
11
11
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/runtime/rest/errors.ts"],"names":[],"mappings":"AAQA,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoBtD;AAUD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,GAAG,QAAQ,CAkBpD;AAED,sDAAsD;AACtD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACnC,QAAQ,CAKV"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/runtime/rest/errors.ts"],"names":[],"mappings":"AAQA,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,UAAO,GAAG,MAAM,CAoB5E;AAUD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,UAAO,GAAG,QAAQ,CAkB1E;AAED,sDAAsD;AACtD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACnC,QAAQ,CAKV"}
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/runtime/rest/handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAA4B,KAAK,QAAQ,EAAmC,MAAM,mBAAmB,CAAA;AAC5G,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AAyF3D,oFAAoF;AACpF,qBAAa,WAAW;IAOpB,OAAO,CAAC,EAAE;IANZ,8FAA8F;IAC9F,OAAO,CAAC,cAAc,CAAU;IAChC,8EAA8E;IAC9E,OAAO,CAAC,OAAO,CAAC,CAAQ;gBAGd,EAAE,EAAE,QAAQ,EACpB,IAAI,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAMxD,4FAA4F;IACtF,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;YAmC9D,WAAW;YAsHX,WAAW;IAgDzB,OAAO,CAAC,YAAY;YAqCN,SAAS;YAqET,MAAM;CA4FrB"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/runtime/rest/handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAA4B,KAAK,QAAQ,EAAmC,MAAM,mBAAmB,CAAA;AAC5G,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AAyF3D,oFAAoF;AACpF,qBAAa,WAAW;IAOpB,OAAO,CAAC,EAAE;IANZ,8FAA8F;IAC9F,OAAO,CAAC,cAAc,CAAU;IAChC,8EAA8E;IAC9E,OAAO,CAAC,OAAO,CAAC,CAAQ;gBAGd,EAAE,EAAE,QAAQ,EACpB,IAAI,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAMxD,4FAA4F;IACtF,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;YAmC9D,WAAW;YAyHX,WAAW;IAgDzB,OAAO,CAAC,YAAY;YAqCN,SAAS;YAsET,MAAM;CAgGrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/lite",
3
- "version": "0.29.0",
3
+ "version": "0.29.2",
4
4
  "description": "Bun-native, single-project Supabase-compatible backend powered by PGlite or native PostgreSQL",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",