@supacloud/lite 0.29.2 → 0.29.4
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.4](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.29.3...supacloud-lite-v0.29.4) (2026-10-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **lite:** classify PL/pgSQL failures as server errors ([#1986](https://github.com/vibeunion/supacloud/issues/1986)) ([27c5e29](https://github.com/vibeunion/supacloud/commit/27c5e29b351e2b6bc0d3da55a1ccb6607e4e06a5))
|
|
9
|
+
|
|
10
|
+
## [0.29.3](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.29.2...supacloud-lite-v0.29.3) (2026-10-16)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **lite:** preserve single-column table RPC responses ([#1971](https://github.com/vibeunion/supacloud/issues/1971)) ([63edb93](https://github.com/vibeunion/supacloud/commit/63edb937322130796260a1284c09cc895735214e))
|
|
16
|
+
|
|
3
17
|
## [0.29.2](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.29.1...supacloud-lite-v0.29.2) (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.
|
|
11
|
+
version: "0.29.4",
|
|
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",
|
|
@@ -6820,6 +6820,7 @@ class Database {
|
|
|
6820
6820
|
if (cached)
|
|
6821
6821
|
return cached;
|
|
6822
6822
|
const res = await this.engine.query(`select p.proname as name, p.proretset as returns_set,
|
|
6823
|
+
coalesce('t' = any(p.proargmodes), false) as returns_table,
|
|
6823
6824
|
t.typname as return_type, t.typtype as return_typtype,
|
|
6824
6825
|
p.provolatile as volatility,
|
|
6825
6826
|
p.pronargs - p.pronargdefaults as required_arg_count,
|
|
@@ -6841,6 +6842,7 @@ class Database {
|
|
|
6841
6842
|
schema,
|
|
6842
6843
|
name: r.name,
|
|
6843
6844
|
returnsSet: r.returns_set,
|
|
6845
|
+
returnsTable: r.returns_table,
|
|
6844
6846
|
returnType: r.return_type,
|
|
6845
6847
|
returnTypType: r.return_typtype,
|
|
6846
6848
|
volatility: r.volatility,
|
|
@@ -8377,6 +8379,9 @@ function renderFilter(f, alias) {
|
|
|
8377
8379
|
|
|
8378
8380
|
// src/runtime/rest/errors.ts
|
|
8379
8381
|
function statusForSqlState(code, authenticated = true) {
|
|
8382
|
+
if (code.startsWith("PT")) {
|
|
8383
|
+
return /^PT[2-5][0-9]{2}$/.test(code) ? Number(code.slice(2)) : 500;
|
|
8384
|
+
}
|
|
8380
8385
|
switch (code) {
|
|
8381
8386
|
case "42501":
|
|
8382
8387
|
return authenticated ? 403 : 401;
|
|
@@ -8393,10 +8398,56 @@ function statusForSqlState(code, authenticated = true) {
|
|
|
8393
8398
|
return 409;
|
|
8394
8399
|
case "57014":
|
|
8395
8400
|
return 408;
|
|
8401
|
+
case "57P01":
|
|
8402
|
+
return 503;
|
|
8403
|
+
case "53400":
|
|
8404
|
+
return 500;
|
|
8405
|
+
case "P0001":
|
|
8406
|
+
return 400;
|
|
8396
8407
|
default:
|
|
8408
|
+
if (code.startsWith("08") || code.startsWith("53"))
|
|
8409
|
+
return 503;
|
|
8410
|
+
if (code.startsWith("P0"))
|
|
8411
|
+
return 500;
|
|
8397
8412
|
return 400;
|
|
8398
8413
|
}
|
|
8399
8414
|
}
|
|
8415
|
+
function invalidPgrstResponse(part) {
|
|
8416
|
+
return jsonResponse(500, {
|
|
8417
|
+
code: "PGRST121",
|
|
8418
|
+
message: `Could not parse JSON in the "RAISE SQLSTATE 'PGRST'" error`,
|
|
8419
|
+
details: `Invalid JSON value or fields for ${part}`,
|
|
8420
|
+
hint: part === "MESSAGE" ? "MESSAGE must contain string 'code' and 'message'; optional 'details' and 'hint' must be strings or null." : "DETAIL must contain integer 'status' (200-599), string-valued 'headers', and optional string 'status_text'."
|
|
8421
|
+
});
|
|
8422
|
+
}
|
|
8423
|
+
function pgrstErrorToResponse(pg) {
|
|
8424
|
+
let part = "MESSAGE";
|
|
8425
|
+
try {
|
|
8426
|
+
const body = JSON.parse(pg.message);
|
|
8427
|
+
if (!isRecord(body) || typeof body.code !== "string" || typeof body.message !== "string" || body.details != null && typeof body.details !== "string" || body.hint != null && typeof body.hint !== "string") {
|
|
8428
|
+
return invalidPgrstResponse(part);
|
|
8429
|
+
}
|
|
8430
|
+
part = "DETAIL";
|
|
8431
|
+
const detail = JSON.parse(pg.detail ?? "");
|
|
8432
|
+
if (!isRecord(detail) || typeof detail.status !== "number" || !Number.isInteger(detail.status) || detail.status < 200 || detail.status > 599 || !isRecord(detail.headers) || detail.status_text != null && (typeof detail.status_text !== "string" || !/^[\t\x20-\x7e\x80-\xff]*$/.test(detail.status_text))) {
|
|
8433
|
+
return invalidPgrstResponse(part);
|
|
8434
|
+
}
|
|
8435
|
+
const headers = new Headers;
|
|
8436
|
+
for (const [name, value] of Object.entries(detail.headers)) {
|
|
8437
|
+
if (typeof value !== "string")
|
|
8438
|
+
return invalidPgrstResponse(part);
|
|
8439
|
+
headers.set(name, value);
|
|
8440
|
+
}
|
|
8441
|
+
return jsonResponse(detail.status, {
|
|
8442
|
+
code: body.code,
|
|
8443
|
+
message: body.message,
|
|
8444
|
+
details: body.details ?? null,
|
|
8445
|
+
hint: body.hint ?? null
|
|
8446
|
+
}, Object.fromEntries(headers), typeof detail.status_text === "string" ? detail.status_text : undefined);
|
|
8447
|
+
} catch {
|
|
8448
|
+
return invalidPgrstResponse(part);
|
|
8449
|
+
}
|
|
8450
|
+
}
|
|
8400
8451
|
function errorToResponse(e, authenticated = true) {
|
|
8401
8452
|
if (e instanceof ApiError) {
|
|
8402
8453
|
return jsonResponse(e.status, e.body);
|
|
@@ -8406,6 +8457,8 @@ function errorToResponse(e, authenticated = true) {
|
|
|
8406
8457
|
}
|
|
8407
8458
|
const pg = e;
|
|
8408
8459
|
if (pg && typeof pg.code === "string" && /^[0-9A-Z]{5}$/.test(pg.code)) {
|
|
8460
|
+
if (pg.code === "PGRST")
|
|
8461
|
+
return pgrstErrorToResponse(pg);
|
|
8409
8462
|
return jsonResponse(statusForSqlState(pg.code, authenticated), {
|
|
8410
8463
|
code: pg.code,
|
|
8411
8464
|
message: pg.message,
|
|
@@ -8416,9 +8469,11 @@ function errorToResponse(e, authenticated = true) {
|
|
|
8416
8469
|
const message = e instanceof Error ? e.message : String(e);
|
|
8417
8470
|
return jsonResponse(500, { code: "PGRST500", message, details: null, hint: null });
|
|
8418
8471
|
}
|
|
8419
|
-
function jsonResponse(status, body, headers = {}) {
|
|
8420
|
-
|
|
8472
|
+
function jsonResponse(status, body, headers = {}, statusText) {
|
|
8473
|
+
const bodyless = status === 204 || status === 205 || status === 304;
|
|
8474
|
+
return new Response(bodyless ? null : JSON.stringify(body), {
|
|
8421
8475
|
status,
|
|
8476
|
+
...statusText === undefined ? {} : { statusText },
|
|
8422
8477
|
headers: { "content-type": "application/json; charset=utf-8", ...headers }
|
|
8423
8478
|
});
|
|
8424
8479
|
}
|
|
@@ -8753,7 +8808,7 @@ class RestHandler {
|
|
|
8753
8808
|
const value = res.rows[0].result;
|
|
8754
8809
|
return jsonResponse(200, value);
|
|
8755
8810
|
}
|
|
8756
|
-
if (fn.returnsSet && ["b", "d", "e"].includes(fn.returnTypType)) {
|
|
8811
|
+
if (fn.returnsSet && !fn.returnsTable && ["b", "d", "e"].includes(fn.returnTypType)) {
|
|
8757
8812
|
const res = await withRpcContext((query) => query(`select coalesce(json_agg(_v), '[]'::json) as body from ${call} as _t(_v)`, []));
|
|
8758
8813
|
return jsonResponse(200, res.rows[0].body);
|
|
8759
8814
|
}
|
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.
|
|
91
|
+
version: "0.29.4",
|
|
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",
|
|
@@ -6814,6 +6814,7 @@ class Database {
|
|
|
6814
6814
|
if (cached)
|
|
6815
6815
|
return cached;
|
|
6816
6816
|
const res = await this.engine.query(`select p.proname as name, p.proretset as returns_set,
|
|
6817
|
+
coalesce('t' = any(p.proargmodes), false) as returns_table,
|
|
6817
6818
|
t.typname as return_type, t.typtype as return_typtype,
|
|
6818
6819
|
p.provolatile as volatility,
|
|
6819
6820
|
p.pronargs - p.pronargdefaults as required_arg_count,
|
|
@@ -6835,6 +6836,7 @@ class Database {
|
|
|
6835
6836
|
schema,
|
|
6836
6837
|
name: r.name,
|
|
6837
6838
|
returnsSet: r.returns_set,
|
|
6839
|
+
returnsTable: r.returns_table,
|
|
6838
6840
|
returnType: r.return_type,
|
|
6839
6841
|
returnTypType: r.return_typtype,
|
|
6840
6842
|
volatility: r.volatility,
|
|
@@ -8371,6 +8373,9 @@ function renderFilter(f, alias) {
|
|
|
8371
8373
|
|
|
8372
8374
|
// src/runtime/rest/errors.ts
|
|
8373
8375
|
function statusForSqlState(code, authenticated = true) {
|
|
8376
|
+
if (code.startsWith("PT")) {
|
|
8377
|
+
return /^PT[2-5][0-9]{2}$/.test(code) ? Number(code.slice(2)) : 500;
|
|
8378
|
+
}
|
|
8374
8379
|
switch (code) {
|
|
8375
8380
|
case "42501":
|
|
8376
8381
|
return authenticated ? 403 : 401;
|
|
@@ -8387,10 +8392,56 @@ function statusForSqlState(code, authenticated = true) {
|
|
|
8387
8392
|
return 409;
|
|
8388
8393
|
case "57014":
|
|
8389
8394
|
return 408;
|
|
8395
|
+
case "57P01":
|
|
8396
|
+
return 503;
|
|
8397
|
+
case "53400":
|
|
8398
|
+
return 500;
|
|
8399
|
+
case "P0001":
|
|
8400
|
+
return 400;
|
|
8390
8401
|
default:
|
|
8402
|
+
if (code.startsWith("08") || code.startsWith("53"))
|
|
8403
|
+
return 503;
|
|
8404
|
+
if (code.startsWith("P0"))
|
|
8405
|
+
return 500;
|
|
8391
8406
|
return 400;
|
|
8392
8407
|
}
|
|
8393
8408
|
}
|
|
8409
|
+
function invalidPgrstResponse(part) {
|
|
8410
|
+
return jsonResponse(500, {
|
|
8411
|
+
code: "PGRST121",
|
|
8412
|
+
message: `Could not parse JSON in the "RAISE SQLSTATE 'PGRST'" error`,
|
|
8413
|
+
details: `Invalid JSON value or fields for ${part}`,
|
|
8414
|
+
hint: part === "MESSAGE" ? "MESSAGE must contain string 'code' and 'message'; optional 'details' and 'hint' must be strings or null." : "DETAIL must contain integer 'status' (200-599), string-valued 'headers', and optional string 'status_text'."
|
|
8415
|
+
});
|
|
8416
|
+
}
|
|
8417
|
+
function pgrstErrorToResponse(pg) {
|
|
8418
|
+
let part = "MESSAGE";
|
|
8419
|
+
try {
|
|
8420
|
+
const body = JSON.parse(pg.message);
|
|
8421
|
+
if (!isRecord(body) || typeof body.code !== "string" || typeof body.message !== "string" || body.details != null && typeof body.details !== "string" || body.hint != null && typeof body.hint !== "string") {
|
|
8422
|
+
return invalidPgrstResponse(part);
|
|
8423
|
+
}
|
|
8424
|
+
part = "DETAIL";
|
|
8425
|
+
const detail = JSON.parse(pg.detail ?? "");
|
|
8426
|
+
if (!isRecord(detail) || typeof detail.status !== "number" || !Number.isInteger(detail.status) || detail.status < 200 || detail.status > 599 || !isRecord(detail.headers) || detail.status_text != null && (typeof detail.status_text !== "string" || !/^[\t\x20-\x7e\x80-\xff]*$/.test(detail.status_text))) {
|
|
8427
|
+
return invalidPgrstResponse(part);
|
|
8428
|
+
}
|
|
8429
|
+
const headers = new Headers;
|
|
8430
|
+
for (const [name, value] of Object.entries(detail.headers)) {
|
|
8431
|
+
if (typeof value !== "string")
|
|
8432
|
+
return invalidPgrstResponse(part);
|
|
8433
|
+
headers.set(name, value);
|
|
8434
|
+
}
|
|
8435
|
+
return jsonResponse(detail.status, {
|
|
8436
|
+
code: body.code,
|
|
8437
|
+
message: body.message,
|
|
8438
|
+
details: body.details ?? null,
|
|
8439
|
+
hint: body.hint ?? null
|
|
8440
|
+
}, Object.fromEntries(headers), typeof detail.status_text === "string" ? detail.status_text : undefined);
|
|
8441
|
+
} catch {
|
|
8442
|
+
return invalidPgrstResponse(part);
|
|
8443
|
+
}
|
|
8444
|
+
}
|
|
8394
8445
|
function errorToResponse(e, authenticated = true) {
|
|
8395
8446
|
if (e instanceof ApiError) {
|
|
8396
8447
|
return jsonResponse(e.status, e.body);
|
|
@@ -8400,6 +8451,8 @@ function errorToResponse(e, authenticated = true) {
|
|
|
8400
8451
|
}
|
|
8401
8452
|
const pg = e;
|
|
8402
8453
|
if (pg && typeof pg.code === "string" && /^[0-9A-Z]{5}$/.test(pg.code)) {
|
|
8454
|
+
if (pg.code === "PGRST")
|
|
8455
|
+
return pgrstErrorToResponse(pg);
|
|
8403
8456
|
return jsonResponse(statusForSqlState(pg.code, authenticated), {
|
|
8404
8457
|
code: pg.code,
|
|
8405
8458
|
message: pg.message,
|
|
@@ -8410,9 +8463,11 @@ function errorToResponse(e, authenticated = true) {
|
|
|
8410
8463
|
const message = e instanceof Error ? e.message : String(e);
|
|
8411
8464
|
return jsonResponse(500, { code: "PGRST500", message, details: null, hint: null });
|
|
8412
8465
|
}
|
|
8413
|
-
function jsonResponse(status, body, headers = {}) {
|
|
8414
|
-
|
|
8466
|
+
function jsonResponse(status, body, headers = {}, statusText) {
|
|
8467
|
+
const bodyless = status === 204 || status === 205 || status === 304;
|
|
8468
|
+
return new Response(bodyless ? null : JSON.stringify(body), {
|
|
8415
8469
|
status,
|
|
8470
|
+
...statusText === undefined ? {} : { statusText },
|
|
8416
8471
|
headers: { "content-type": "application/json; charset=utf-8", ...headers }
|
|
8417
8472
|
});
|
|
8418
8473
|
}
|
|
@@ -8747,7 +8802,7 @@ class RestHandler {
|
|
|
8747
8802
|
const value = res.rows[0].result;
|
|
8748
8803
|
return jsonResponse(200, value);
|
|
8749
8804
|
}
|
|
8750
|
-
if (fn.returnsSet && ["b", "d", "e"].includes(fn.returnTypType)) {
|
|
8805
|
+
if (fn.returnsSet && !fn.returnsTable && ["b", "d", "e"].includes(fn.returnTypType)) {
|
|
8751
8806
|
const res = await withRpcContext((query) => query(`select coalesce(json_agg(_v), '[]'::json) as body from ${call} as _t(_v)`, []));
|
|
8752
8807
|
return jsonResponse(200, res.rows[0].body);
|
|
8753
8808
|
}
|
|
@@ -43,6 +43,8 @@ export interface FunctionInfo {
|
|
|
43
43
|
schema: string;
|
|
44
44
|
name: string;
|
|
45
45
|
returnsSet: boolean;
|
|
46
|
+
/** Explicit RETURNS TABLE outputs, including a single base/domain/enum column. */
|
|
47
|
+
returnsTable: boolean;
|
|
46
48
|
returnType: string;
|
|
47
49
|
/** pg_type.typtype: b=base, c=composite, p=pseudo, d=domain, e=enum */
|
|
48
50
|
returnTypType: string;
|
|
@@ -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,CAA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C,YAAY,EAAE,CAAC;IAoDzE,iFAAiF;IAC3E,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBpE;;;OAGG;IACG,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;YAc3D,gBAAgB;YAYhB,iBAAiB;YAWjB,eAAe;IAa7B;;;;;OAKG;IACH,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED;;;;;;;;OAQG;IACH,OAAO,CACL,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;KAAE,EAC/D,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,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
2
|
export declare function statusForSqlState(code: string, authenticated?: boolean): number;
|
|
3
3
|
/**
|
|
4
|
-
* Normalize
|
|
5
|
-
*
|
|
6
|
-
* {@link statusForSqlState}
|
|
4
|
+
* Normalize thrown errors: ApiError/ParseError keep their status, PGRST
|
|
5
|
+
* exceptions supply structured response metadata, and other 5-char SQLSTATEs
|
|
6
|
+
* use {@link statusForSqlState}. Everything else becomes a 500.
|
|
7
7
|
*/
|
|
8
8
|
export declare function errorToResponse(e: unknown, authenticated?: boolean): Response;
|
|
9
|
-
/** JSON Response helper;
|
|
10
|
-
export declare function jsonResponse(status: number, body: unknown, headers?: Record<string, string
|
|
9
|
+
/** JSON Response helper; null-body HTTP statuses never serialize a payload. */
|
|
10
|
+
export declare function jsonResponse(status: number, body: unknown, headers?: Record<string, string>, statusText?: 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":"
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/runtime/rest/errors.ts"],"names":[],"mappings":"AASA,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,UAAO,GAAG,MAAM,CAiC5E;AAuDD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,UAAO,GAAG,QAAQ,CAmB1E;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,QAAQ,CAOV"}
|