@supacloud/lite 0.29.5 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cli.js +177 -50
- package/dist/index.js +177 -50
- package/dist/project-runtime.d.ts.map +1 -1
- package/dist/runtime/auth/handler.d.ts +1 -0
- package/dist/runtime/auth/handler.d.ts.map +1 -1
- package/dist/runtime/auth/oauth.d.ts +6 -0
- package/dist/runtime/auth/oauth.d.ts.map +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/node/load-config.d.ts +3 -0
- package/dist/runtime/node/load-config.d.ts.map +1 -1
- package/dist/runtime/storage/handler.d.ts +3 -0
- package/dist/runtime/storage/handler.d.ts.map +1 -1
- package/dist/runtime/storage/image-transform.d.ts +7 -1
- package/dist/runtime/storage/image-transform.d.ts.map +1 -1
- package/dist/runtime/types.d.ts +2 -0
- package/dist/runtime/types.d.ts.map +1 -1
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.30.0](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.29.5...supacloud-lite-v0.30.0) (2026-10-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add configurable image-transformation input and output limits with a 500 MiB default and maximum ([#2027](https://github.com/vibeunion/supacloud/issues/2027)) ([5c07903](https://github.com/vibeunion/supacloud/commit/5c07903f20bfb069229cf3a829886fe96c78c288))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* enforce account eligibility consistently for bearer, email, OAuth and refresh authentication ([#2027](https://github.com/vibeunion/supacloud/issues/2027)) ([5c07903](https://github.com/vibeunion/supacloud/commit/5c07903f20bfb069229cf3a829886fe96c78c288))
|
|
14
|
+
* prepare isolated package artifacts against the current database dependency ([#2027](https://github.com/vibeunion/supacloud/issues/2027)) ([5c07903](https://github.com/vibeunion/supacloud/commit/5c07903f20bfb069229cf3a829886fe96c78c288))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Dependencies
|
|
18
|
+
|
|
19
|
+
* align the published @supacloud/db dependency to 0.18.1.
|
|
20
|
+
|
|
3
21
|
## [0.29.5](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.29.4...supacloud-lite-v0.29.5) (2026-10-16)
|
|
4
22
|
|
|
5
23
|
|
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.
|
|
11
|
+
version: "0.30.0",
|
|
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",
|
|
@@ -67,16 +67,16 @@ var package_default = {
|
|
|
67
67
|
"@electric-sql/pglite-pgmq": "0.0.8",
|
|
68
68
|
"@electric-sql/pglite-pgvector": "0.0.11",
|
|
69
69
|
"@electric-sql/pglite-postgis": "0.2.10",
|
|
70
|
-
"@supacloud/db": "
|
|
70
|
+
"@supacloud/db": "0.18.1",
|
|
71
71
|
"exact-mirror": "1.2.6",
|
|
72
72
|
tar: "^7.5.22",
|
|
73
73
|
typebox: "1.3.37"
|
|
74
74
|
},
|
|
75
75
|
devDependencies: {
|
|
76
|
-
"@supacloud/app": "
|
|
77
|
-
"@supacloud/contracts": "
|
|
78
|
-
"@supacloud/compiler": "
|
|
79
|
-
"@supacloud/elysia": "
|
|
76
|
+
"@supacloud/app": "0.27.2",
|
|
77
|
+
"@supacloud/contracts": "0.11.2",
|
|
78
|
+
"@supacloud/compiler": "0.46.7",
|
|
79
|
+
"@supacloud/elysia": "0.33.2",
|
|
80
80
|
"@supabase/supabase-js": "^2.117.3",
|
|
81
81
|
"@types/bun": "^1.4.3",
|
|
82
82
|
effect: "4.0.5",
|
|
@@ -85,13 +85,13 @@ var package_default = {
|
|
|
85
85
|
typescript: "^7.0.2"
|
|
86
86
|
},
|
|
87
87
|
overrides: {
|
|
88
|
-
"@supacloud/db": "
|
|
89
|
-
"@supacloud/app": "
|
|
90
|
-
"@supacloud/compiler": "
|
|
91
|
-
"@supacloud/elysia": "
|
|
92
|
-
"@supacloud/contracts": "
|
|
93
|
-
"@supacloud/commands": "
|
|
94
|
-
"@supacloud/delivery": "
|
|
88
|
+
"@supacloud/db": "0.18.1",
|
|
89
|
+
"@supacloud/app": "0.27.2",
|
|
90
|
+
"@supacloud/compiler": "0.46.7",
|
|
91
|
+
"@supacloud/elysia": "0.33.2",
|
|
92
|
+
"@supacloud/contracts": "0.11.2",
|
|
93
|
+
"@supacloud/commands": "0.9.4",
|
|
94
|
+
"@supacloud/delivery": "0.19.1",
|
|
95
95
|
"@graphql-tools/utils": "^12.0.4"
|
|
96
96
|
},
|
|
97
97
|
engines: {
|
|
@@ -242,6 +242,13 @@ function isAllowedRedirect(requested, siteUrl, allowList = []) {
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
// src/runtime/auth/oauth.ts
|
|
245
|
+
class OAuthAccountIneligibleError extends Error {
|
|
246
|
+
code;
|
|
247
|
+
constructor(code) {
|
|
248
|
+
super(code);
|
|
249
|
+
this.code = code;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
245
252
|
var PRESETS = {
|
|
246
253
|
google: {
|
|
247
254
|
authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth",
|
|
@@ -364,14 +371,30 @@ class OAuthService {
|
|
|
364
371
|
const msg = encodeURIComponent(e instanceof Error ? e.message : "oauth_error");
|
|
365
372
|
return redirect(`${flow.redirect_to}#error=server_error&error_description=${msg}`);
|
|
366
373
|
}
|
|
367
|
-
|
|
374
|
+
let userId;
|
|
375
|
+
try {
|
|
376
|
+
userId = await this.upsertUser(provider.name, profile);
|
|
377
|
+
} catch (e) {
|
|
378
|
+
if (e instanceof OAuthAccountIneligibleError) {
|
|
379
|
+
return redirect(`${flow.redirect_to}#error=access_denied&error_code=${e.code}`);
|
|
380
|
+
}
|
|
381
|
+
throw e;
|
|
382
|
+
}
|
|
368
383
|
if (flow.code_challenge) {
|
|
369
384
|
const authCode = randomToken(24);
|
|
370
385
|
await this.db.query(`insert into auth.flow_state (provider, provider_state, redirect_to, code_challenge, code_challenge_method, auth_code, user_id, expires_at)
|
|
371
386
|
values ($1, $2, $3, $4, $5, $6, $7, now() + interval '5 minutes')`, [flow.provider, randomToken(16), flow.redirect_to, flow.code_challenge, flow.code_challenge_method, authCode, userId]);
|
|
372
387
|
return redirect(`${flow.redirect_to}?code=${authCode}`);
|
|
373
388
|
}
|
|
374
|
-
|
|
389
|
+
let session;
|
|
390
|
+
try {
|
|
391
|
+
session = await createSession(userId);
|
|
392
|
+
} catch (e) {
|
|
393
|
+
if (e instanceof OAuthAccountIneligibleError) {
|
|
394
|
+
return redirect(`${flow.redirect_to}#error=access_denied&error_code=${e.code}`);
|
|
395
|
+
}
|
|
396
|
+
throw e;
|
|
397
|
+
}
|
|
375
398
|
const hash = `#access_token=${session.access_token}&refresh_token=${session.refresh_token}&expires_in=${session.expires_in}&token_type=bearer&provider_token=`;
|
|
376
399
|
return redirect(`${flow.redirect_to}${hash}`);
|
|
377
400
|
}
|
|
@@ -422,31 +445,37 @@ class OAuthService {
|
|
|
422
445
|
return profile;
|
|
423
446
|
}
|
|
424
447
|
async upsertUser(provider, profile) {
|
|
425
|
-
|
|
448
|
+
return this.db.transaction((query) => this.upsertUserInTransaction(query, provider, profile));
|
|
449
|
+
}
|
|
450
|
+
async upsertUserInTransaction(query, provider, profile) {
|
|
451
|
+
const existing = await query(`select user_id from auth.identities where provider = $1 and provider_id = $2`, [provider, profile.id]);
|
|
426
452
|
if (existing.rows[0]) {
|
|
427
|
-
await this.
|
|
453
|
+
await this.assertUserEligible(query, existing.rows[0].user_id);
|
|
454
|
+
await query(`update auth.identities set last_sign_in_at = now(), identity_data = $3 where provider = $1 and provider_id = $2`, [
|
|
428
455
|
provider,
|
|
429
456
|
profile.id,
|
|
430
457
|
JSON.stringify({ sub: profile.id, email: profile.email, ...profile.metadata })
|
|
431
458
|
]);
|
|
432
|
-
await
|
|
459
|
+
await query(`update auth.users set last_sign_in_at = now() where id = $1`, [existing.rows[0].user_id]);
|
|
433
460
|
return existing.rows[0].user_id;
|
|
434
461
|
}
|
|
435
462
|
let userId;
|
|
436
463
|
const email = profile.email?.toLowerCase() ?? null;
|
|
437
464
|
const verified = !!profile.email && profile.emailVerified === true;
|
|
438
465
|
if (email && verified) {
|
|
439
|
-
const byEmail = await
|
|
466
|
+
const byEmail = await query(`select id from auth.users where email = $1`, [email]);
|
|
440
467
|
userId = byEmail.rows[0]?.id;
|
|
468
|
+
if (userId)
|
|
469
|
+
await this.assertUserEligible(query, userId);
|
|
441
470
|
}
|
|
442
471
|
if (!userId) {
|
|
443
472
|
let userEmail = verified ? email : null;
|
|
444
473
|
if (userEmail) {
|
|
445
|
-
const taken = await
|
|
474
|
+
const taken = await query(`select 1 from auth.users where email = $1`, [userEmail]);
|
|
446
475
|
if (taken.rows.length > 0)
|
|
447
476
|
userEmail = null;
|
|
448
477
|
}
|
|
449
|
-
const created = await
|
|
478
|
+
const created = await query(`insert into auth.users (aud, role, email, email_confirmed_at, last_sign_in_at, raw_app_meta_data, raw_user_meta_data)
|
|
450
479
|
values ('authenticated','authenticated',$1, $2, now(),
|
|
451
480
|
$3::jsonb, $4::jsonb) returning id`, [
|
|
452
481
|
userEmail,
|
|
@@ -459,12 +488,22 @@ class OAuthService {
|
|
|
459
488
|
throw new Error("OAuth user creation returned no row");
|
|
460
489
|
userId = user.id;
|
|
461
490
|
}
|
|
462
|
-
await
|
|
491
|
+
await query(`insert into auth.identities (user_id, provider, provider_id, identity_data)
|
|
463
492
|
values ($1, $2, $3, $4::jsonb)`, [userId, provider, profile.id, JSON.stringify({ sub: profile.id, email: profile.email, ...profile.metadata })]);
|
|
464
493
|
if (!userId)
|
|
465
494
|
throw new Error("OAuth identity has no user ID");
|
|
466
495
|
return userId;
|
|
467
496
|
}
|
|
497
|
+
async assertUserEligible(query, userId) {
|
|
498
|
+
const users = await query(`select deleted_at is not null as is_deleted,
|
|
499
|
+
coalesce(banned_until > now(), false) as is_banned
|
|
500
|
+
from auth.users where id = $1 for update`, [userId]);
|
|
501
|
+
const user = users.rows[0];
|
|
502
|
+
if (!user || user.is_deleted)
|
|
503
|
+
throw new OAuthAccountIneligibleError("user_not_found");
|
|
504
|
+
if (user.is_banned)
|
|
505
|
+
throw new OAuthAccountIneligibleError("user_banned");
|
|
506
|
+
}
|
|
468
507
|
}
|
|
469
508
|
function redirect(location) {
|
|
470
509
|
return new Response(null, { status: 303, headers: { location } });
|
|
@@ -1350,6 +1389,8 @@ class AuthHandler {
|
|
|
1350
1389
|
return await this.admin(req, ctx, path, method);
|
|
1351
1390
|
return authError(404, "not_found", `unknown auth endpoint: ${path}`);
|
|
1352
1391
|
} catch (e) {
|
|
1392
|
+
if (e instanceof OAuthAccountIneligibleError)
|
|
1393
|
+
return authError(400, e.code, e.message);
|
|
1353
1394
|
const msg = e instanceof Error ? e.message : String(e);
|
|
1354
1395
|
return authError(500, "unexpected_failure", msg);
|
|
1355
1396
|
}
|
|
@@ -1444,8 +1485,7 @@ class AuthHandler {
|
|
|
1444
1485
|
const userId = await this.oauth.exchangePkce(authCode, verifier);
|
|
1445
1486
|
if (!userId)
|
|
1446
1487
|
return authError(403, "flow_state_not_found", "invalid or expired auth code");
|
|
1447
|
-
|
|
1448
|
-
return json(200, await this.sessionForOAuth(ures.rows[0]));
|
|
1488
|
+
return json(200, await this.sessionForOAuth(userId));
|
|
1449
1489
|
}
|
|
1450
1490
|
return authError(400, "invalid_grant", `unsupported grant_type: ${grantType}`);
|
|
1451
1491
|
}
|
|
@@ -1740,7 +1780,10 @@ Or sign in with this link: ${link}`
|
|
|
1740
1780
|
tokenTypes: `{${types.join(",")}}`,
|
|
1741
1781
|
email: email?.toLowerCase().trim() ?? null
|
|
1742
1782
|
};
|
|
1743
|
-
return this.db.transaction((query) =>
|
|
1783
|
+
return this.db.transaction(async (query) => {
|
|
1784
|
+
const user = await this.claimEmailToken(query, redemption);
|
|
1785
|
+
return user ? this.sessionFor(user, undefined, undefined, query) : null;
|
|
1786
|
+
});
|
|
1744
1787
|
}
|
|
1745
1788
|
async claimEmailToken(query, redemption) {
|
|
1746
1789
|
const candidate = await this.findEmailTokenCandidate(query, redemption);
|
|
@@ -1752,7 +1795,10 @@ Or sign in with this link: ${link}`
|
|
|
1752
1795
|
return claimedToken ? this.confirmEmailTokenUser(query, claimedToken) : null;
|
|
1753
1796
|
}
|
|
1754
1797
|
async lockAndDeleteEmailToken(query, candidate, redemption) {
|
|
1755
|
-
await query(`select id from auth.users where id = $1
|
|
1798
|
+
const eligible = await query(`select id from auth.users where id = $1 and deleted_at is null
|
|
1799
|
+
and (banned_until is null or banned_until <= now()) for update`, [candidate.user_id]);
|
|
1800
|
+
if (eligible.rows.length === 0)
|
|
1801
|
+
return null;
|
|
1756
1802
|
const claimedTokens = await query(`delete from auth.one_time_tokens
|
|
1757
1803
|
where id = $1 and token = $2 and token_type = any($3::text[])
|
|
1758
1804
|
and expires_at > now() and attempts < $4
|
|
@@ -1805,10 +1851,10 @@ Or sign in with this link: ${link}`
|
|
|
1805
1851
|
return json(200, session);
|
|
1806
1852
|
}
|
|
1807
1853
|
const types = body.type === "recovery" ? ["recovery"] : body.type === "magiclink" ? ["magiclink"] : ["otp", "magiclink"];
|
|
1808
|
-
const
|
|
1809
|
-
if (!
|
|
1854
|
+
const session = await this.redeem(token, types, body.email);
|
|
1855
|
+
if (!session)
|
|
1810
1856
|
return authError(403, "otp_expired", "Token has expired or is invalid");
|
|
1811
|
-
return json(200,
|
|
1857
|
+
return json(200, session);
|
|
1812
1858
|
}
|
|
1813
1859
|
async redeemPhoneOtp(phone, code) {
|
|
1814
1860
|
const tokenDigest = `hmac-sha256:v1:${await keyedDigest(this.config.jwtSecret, "supacloud-lite:phone-otp:v1", `${phone}\x00${code}`)}`;
|
|
@@ -1849,11 +1895,10 @@ Or sign in with this link: ${link}`
|
|
|
1849
1895
|
const token = url.searchParams.get("token") ?? "";
|
|
1850
1896
|
const type = url.searchParams.get("type") ?? "magiclink";
|
|
1851
1897
|
const redirectTo = resolveRedirect(url.searchParams.get("redirect_to"), this.config.siteUrl, this.config.uriAllowList, this.config.enforceRedirectAllowList);
|
|
1852
|
-
const
|
|
1853
|
-
if (!
|
|
1898
|
+
const session = await this.redeem(token, [type]);
|
|
1899
|
+
if (!session) {
|
|
1854
1900
|
return new Response(null, { status: 303, headers: { location: `${redirectTo}#error=access_denied&error_code=otp_expired` } });
|
|
1855
1901
|
}
|
|
1856
|
-
const session = await this.sessionFor(user);
|
|
1857
1902
|
const hash = `#access_token=${session.access_token}&refresh_token=${session.refresh_token}&expires_in=${session.expires_in}&token_type=bearer&type=${type}`;
|
|
1858
1903
|
return new Response(null, { status: 303, headers: { location: `${redirectTo}${hash}` } });
|
|
1859
1904
|
}
|
|
@@ -2154,6 +2199,11 @@ Or sign in with this link: ${link}`
|
|
|
2154
2199
|
return authError(422, "mfa_verification_failed", "Invalid TOTP code entered");
|
|
2155
2200
|
}
|
|
2156
2201
|
const session = await this.db.transaction(async (query) => {
|
|
2202
|
+
const currentUsers = await query(`select * from auth.users where id = $1 and deleted_at is null
|
|
2203
|
+
and (banned_until is null or banned_until <= now()) for update`, [user.id]);
|
|
2204
|
+
const currentUser = currentUsers.rows[0];
|
|
2205
|
+
if (!currentUser)
|
|
2206
|
+
return null;
|
|
2157
2207
|
const claimed = await query(`update auth.mfa_challenges set verified_at = now()
|
|
2158
2208
|
where id = $1 and factor_id = $2 and verified_at is null and expires_at >= now()
|
|
2159
2209
|
returning id`, [challenge.id, factorId]);
|
|
@@ -2162,7 +2212,7 @@ Or sign in with this link: ${link}`
|
|
|
2162
2212
|
if (factor.status !== "verified") {
|
|
2163
2213
|
await query(`update auth.mfa_factors set status = 'verified', updated_at = now() where id = $1`, [factorId]);
|
|
2164
2214
|
}
|
|
2165
|
-
return this.sessionFor(
|
|
2215
|
+
return this.sessionFor(currentUser, undefined, {
|
|
2166
2216
|
aal: "aal2",
|
|
2167
2217
|
amr: [
|
|
2168
2218
|
{ method: "password", timestamp: Math.floor(Date.now() / 1000) },
|
|
@@ -2223,6 +2273,18 @@ Or sign in with this link: ${link}`
|
|
|
2223
2273
|
}
|
|
2224
2274
|
async rotateRefreshToken(token) {
|
|
2225
2275
|
return this.db.transaction(async (query) => {
|
|
2276
|
+
const availableToken = await this.findAvailableRefreshToken(query, token);
|
|
2277
|
+
if (!availableToken)
|
|
2278
|
+
return authError(400, "refresh_token_not_found", "Invalid Refresh Token: Refresh Token Not Found");
|
|
2279
|
+
const userResult = await query(`select *, coalesce(banned_until > now(), false) as is_banned
|
|
2280
|
+
from auth.users where id = $1 for update`, [availableToken.user_id]);
|
|
2281
|
+
const user = userResult.rows[0];
|
|
2282
|
+
if (!user || user.deleted_at !== null) {
|
|
2283
|
+
return authError(400, "refresh_token_not_found", "Invalid Refresh Token: Refresh Token Not Found");
|
|
2284
|
+
}
|
|
2285
|
+
if (user.is_banned) {
|
|
2286
|
+
return authError(400, "user_banned", "Invalid Refresh Token: User Banned");
|
|
2287
|
+
}
|
|
2226
2288
|
const claimedToken = await this.claimRefreshToken(query, token);
|
|
2227
2289
|
if (!claimedToken)
|
|
2228
2290
|
return authError(400, "refresh_token_not_found", "Invalid Refresh Token: Refresh Token Not Found");
|
|
@@ -2230,14 +2292,19 @@ Or sign in with this link: ${link}`
|
|
|
2230
2292
|
const expiryError = this.refreshExpiryError(claimedToken, sessionStartedAt);
|
|
2231
2293
|
if (expiryError)
|
|
2232
2294
|
return expiryError;
|
|
2233
|
-
const
|
|
2234
|
-
const session = await this.sessionFor(userResult.rows[0], token, {
|
|
2295
|
+
const session = await this.sessionFor(user, token, {
|
|
2235
2296
|
sessionId: claimedToken.session_id ?? undefined,
|
|
2236
2297
|
sessionStartedAt: sessionStartedAt === null ? undefined : Math.floor(sessionStartedAt / 1000)
|
|
2237
2298
|
}, query);
|
|
2238
2299
|
return json(200, session);
|
|
2239
2300
|
});
|
|
2240
2301
|
}
|
|
2302
|
+
async findAvailableRefreshToken(query, token) {
|
|
2303
|
+
const available = await query(`select user_id, session_id, created_at
|
|
2304
|
+
from auth.refresh_tokens
|
|
2305
|
+
where token = $1 and revoked is not true`, [token]);
|
|
2306
|
+
return available.rows[0];
|
|
2307
|
+
}
|
|
2241
2308
|
async claimRefreshToken(query, token) {
|
|
2242
2309
|
const claimed = await query(`update auth.refresh_tokens set revoked = true, updated_at = now()
|
|
2243
2310
|
where token = $1 and revoked is not true
|
|
@@ -2265,7 +2332,8 @@ Or sign in with this link: ${link}`
|
|
|
2265
2332
|
const claims = await this.claimsFromBearer(req);
|
|
2266
2333
|
if (!claims?.sub)
|
|
2267
2334
|
return null;
|
|
2268
|
-
const res = await this.db.query(`select * from auth.users where id = $1
|
|
2335
|
+
const res = await this.db.query(`select * from auth.users where id = $1 and deleted_at is null
|
|
2336
|
+
and (banned_until is null or banned_until <= now())`, [claims.sub]);
|
|
2269
2337
|
return res.rows[0] ?? null;
|
|
2270
2338
|
}
|
|
2271
2339
|
async claimsFromBearer(req) {
|
|
@@ -2294,14 +2362,22 @@ Or sign in with this link: ${link}`
|
|
|
2294
2362
|
is_anonymous: u.is_anonymous ?? false
|
|
2295
2363
|
};
|
|
2296
2364
|
}
|
|
2297
|
-
sessionForOAuth(
|
|
2298
|
-
return this.
|
|
2299
|
-
|
|
2365
|
+
sessionForOAuth(userId) {
|
|
2366
|
+
return this.db.transaction(async (query) => {
|
|
2367
|
+
const res = await query(`select *, coalesce(banned_until > now(), false) as is_banned
|
|
2368
|
+
from auth.users where id = $1 for update`, [userId]);
|
|
2369
|
+
const user = res.rows[0];
|
|
2370
|
+
if (!user || user.deleted_at !== null)
|
|
2371
|
+
throw new OAuthAccountIneligibleError("user_not_found");
|
|
2372
|
+
if (user.is_banned)
|
|
2373
|
+
throw new OAuthAccountIneligibleError("user_banned");
|
|
2374
|
+
return this.sessionFor(user, undefined, {
|
|
2375
|
+
amr: [{ method: "oauth", timestamp: Math.floor(Date.now() / 1000) }]
|
|
2376
|
+
}, query);
|
|
2300
2377
|
});
|
|
2301
2378
|
}
|
|
2302
2379
|
async oauthSessionTokensFor(userId) {
|
|
2303
|
-
const
|
|
2304
|
-
const session = await this.sessionForOAuth(res.rows[0]);
|
|
2380
|
+
const session = await this.sessionForOAuth(userId);
|
|
2305
2381
|
return { access_token: session.access_token, refresh_token: session.refresh_token, expires_in: session.expires_in };
|
|
2306
2382
|
}
|
|
2307
2383
|
async sessionFor(user, parentToken, opts, query = (sql, params) => this.db.query(sql, params)) {
|
|
@@ -8978,8 +9054,18 @@ var IMAGE_FORMAT_CONTENT_TYPES = {
|
|
|
8978
9054
|
gif: "image/gif"
|
|
8979
9055
|
};
|
|
8980
9056
|
var MAX_TRANSFORM_DIMENSION = 2500;
|
|
8981
|
-
var MAX_TRANSFORM_BYTES =
|
|
9057
|
+
var MAX_TRANSFORM_BYTES = 500 * 1024 * 1024;
|
|
8982
9058
|
var MAX_TRANSFORM_PIXELS = 50000000;
|
|
9059
|
+
function resolveImageTransformLimits(options = {}) {
|
|
9060
|
+
const maxInputBytes = options.maxInputBytes === undefined ? MAX_TRANSFORM_BYTES : options.maxInputBytes;
|
|
9061
|
+
const maxOutputBytes = options.maxOutputBytes === undefined ? MAX_TRANSFORM_BYTES : options.maxOutputBytes;
|
|
9062
|
+
for (const [name, value] of Object.entries({ maxInputBytes, maxOutputBytes })) {
|
|
9063
|
+
if (!Number.isSafeInteger(value) || value < 1 || value > MAX_TRANSFORM_BYTES) {
|
|
9064
|
+
throw new Error(`Invalid image transformation ${name}: expected 1..${MAX_TRANSFORM_BYTES} bytes`);
|
|
9065
|
+
}
|
|
9066
|
+
}
|
|
9067
|
+
return { maxInputBytes, maxOutputBytes };
|
|
9068
|
+
}
|
|
8983
9069
|
function invalid(message) {
|
|
8984
9070
|
return { ok: false, status: 400, error: "InvalidTransformation", message };
|
|
8985
9071
|
}
|
|
@@ -9037,7 +9123,16 @@ function parseImageTransform(query) {
|
|
|
9037
9123
|
if (quality !== undefined && format === "png") {
|
|
9038
9124
|
return invalid("quality is supported only for jpeg and webp output");
|
|
9039
9125
|
}
|
|
9040
|
-
return {
|
|
9126
|
+
return {
|
|
9127
|
+
ok: true,
|
|
9128
|
+
value: {
|
|
9129
|
+
resize,
|
|
9130
|
+
format,
|
|
9131
|
+
...width === undefined ? {} : { width },
|
|
9132
|
+
...height === undefined ? {} : { height },
|
|
9133
|
+
...quality === undefined ? {} : { quality }
|
|
9134
|
+
}
|
|
9135
|
+
};
|
|
9041
9136
|
}
|
|
9042
9137
|
function imageTransformToSearchParams(options) {
|
|
9043
9138
|
const query = new URLSearchParams;
|
|
@@ -9111,15 +9206,16 @@ function applyResize(image, metadata, options) {
|
|
|
9111
9206
|
const proportionalWidth = Math.max(1, Math.round(metadata.width * height / metadata.height));
|
|
9112
9207
|
image.resize(proportionalWidth);
|
|
9113
9208
|
}
|
|
9114
|
-
async function transformImage(source, options, knownSourceSize) {
|
|
9209
|
+
async function transformImage(source, options, knownSourceSize, configuredLimits = {}) {
|
|
9210
|
+
const limits = resolveImageTransformLimits(configuredLimits);
|
|
9115
9211
|
const actualSourceSize = source instanceof Uint8Array ? source.byteLength : await Promise.resolve(source.size);
|
|
9116
9212
|
const sourceSize = Math.max(knownSourceSize ?? 0, actualSourceSize);
|
|
9117
|
-
if (sourceSize >
|
|
9213
|
+
if (sourceSize > limits.maxInputBytes) {
|
|
9118
9214
|
return {
|
|
9119
9215
|
ok: false,
|
|
9120
9216
|
status: 413,
|
|
9121
9217
|
error: "ImageTooLarge",
|
|
9122
|
-
message:
|
|
9218
|
+
message: `The source image exceeds the transformation limit (${limits.maxInputBytes} bytes)`
|
|
9123
9219
|
};
|
|
9124
9220
|
}
|
|
9125
9221
|
const image = new Bun.Image(source, { maxPixels: MAX_TRANSFORM_PIXELS });
|
|
@@ -9152,12 +9248,12 @@ async function transformImage(source, options, knownSourceSize) {
|
|
|
9152
9248
|
}
|
|
9153
9249
|
try {
|
|
9154
9250
|
const bytes = await image.bytes();
|
|
9155
|
-
if (bytes.byteLength >
|
|
9251
|
+
if (bytes.byteLength > limits.maxOutputBytes) {
|
|
9156
9252
|
return {
|
|
9157
9253
|
ok: false,
|
|
9158
9254
|
status: 413,
|
|
9159
9255
|
error: "ImageTooLarge",
|
|
9160
|
-
message:
|
|
9256
|
+
message: `The transformed image exceeds the transformation limit (${limits.maxOutputBytes} bytes)`
|
|
9161
9257
|
};
|
|
9162
9258
|
}
|
|
9163
9259
|
return { ok: true, bytes, contentType };
|
|
@@ -9360,10 +9456,12 @@ class StorageHandler {
|
|
|
9360
9456
|
tusUploads = new Map;
|
|
9361
9457
|
mutationTail = Promise.resolve();
|
|
9362
9458
|
imageTransforms = new ImageTransformCache;
|
|
9459
|
+
transformLimits;
|
|
9363
9460
|
constructor(db, driver, config) {
|
|
9364
9461
|
this.db = db;
|
|
9365
9462
|
this.driver = driver;
|
|
9366
9463
|
this.config = config;
|
|
9464
|
+
this.transformLimits = resolveImageTransformLimits(config.imageTransformLimits);
|
|
9367
9465
|
}
|
|
9368
9466
|
async ensureBuckets(buckets) {
|
|
9369
9467
|
for (const b of buckets) {
|
|
@@ -9639,7 +9737,7 @@ class StorageHandler {
|
|
|
9639
9737
|
const source = await this.readObjectSource(row);
|
|
9640
9738
|
if (source === null)
|
|
9641
9739
|
throw new StorageObjectMissingError;
|
|
9642
|
-
return transformImage(source, parsed.value, objectSize(row));
|
|
9740
|
+
return transformImage(source, parsed.value, objectSize(row), this.transformLimits);
|
|
9643
9741
|
});
|
|
9644
9742
|
} catch (error) {
|
|
9645
9743
|
if (error instanceof StorageObjectMissingError) {
|
|
@@ -11735,6 +11833,7 @@ ${msg.text}` : `[mail] to=${msg.to} subject="${msg.subject}"`));
|
|
|
11735
11833
|
const storage = new StorageHandler(db, config.storageDriver ?? new MemoryStorageDriver, {
|
|
11736
11834
|
jwtSecret,
|
|
11737
11835
|
defaultFileSizeLimit: config.storageFileSizeLimit,
|
|
11836
|
+
imageTransformLimits: config.storageImageTransformLimits,
|
|
11738
11837
|
log
|
|
11739
11838
|
});
|
|
11740
11839
|
if (config.buckets?.length) {
|
|
@@ -13274,8 +13373,22 @@ import { readFile as readFile2, stat } from "fs/promises";
|
|
|
13274
13373
|
import { dirname as dirname3, resolve as resolve3 } from "path";
|
|
13275
13374
|
import { pathToFileURL } from "url";
|
|
13276
13375
|
|
|
13277
|
-
//
|
|
13376
|
+
// ../db/dist/index.js
|
|
13278
13377
|
import { createHash as createHash3 } from "crypto";
|
|
13378
|
+
|
|
13379
|
+
// ../contracts/dist/index.mjs
|
|
13380
|
+
var commandErrorBrand = Symbol.for("@supacloud/contracts/CommandError/v1");
|
|
13381
|
+
var commandErrorCodes = new Set([
|
|
13382
|
+
"COMMAND_INPUT_INVALID",
|
|
13383
|
+
"COMMAND_REJECTED",
|
|
13384
|
+
"COMMAND_UNAVAILABLE",
|
|
13385
|
+
"COMMAND_IDEMPOTENCY_CONFLICT",
|
|
13386
|
+
"COMMAND_RECEIPT_INVALID",
|
|
13387
|
+
"COMMAND_OUTCOME_UNKNOWN",
|
|
13388
|
+
"COMMAND_INPUT_EXPIRED"
|
|
13389
|
+
]);
|
|
13390
|
+
|
|
13391
|
+
// ../db/dist/index.js
|
|
13279
13392
|
var TABLES_SQL = `
|
|
13280
13393
|
SELECT n.nspname AS schema,
|
|
13281
13394
|
c.relname AS name,
|
|
@@ -14684,6 +14797,19 @@ function readStorage(root) {
|
|
|
14684
14797
|
const limit = getByteSize(storage, "file_size_limit");
|
|
14685
14798
|
if (limit !== undefined)
|
|
14686
14799
|
out.fileSizeLimit = limit;
|
|
14800
|
+
const image = tableAt(root, "storage.image_transformation");
|
|
14801
|
+
if (image) {
|
|
14802
|
+
const limits = {};
|
|
14803
|
+
for (const [key, field] of [["max_input_bytes", "maxInputBytes"], ["max_output_bytes", "maxOutputBytes"]]) {
|
|
14804
|
+
if (!image.values.has(key))
|
|
14805
|
+
continue;
|
|
14806
|
+
const value = getByteSize(image, key);
|
|
14807
|
+
if (value === undefined)
|
|
14808
|
+
throw new Error(`Invalid image transformation ${key}`);
|
|
14809
|
+
limits[field] = value;
|
|
14810
|
+
}
|
|
14811
|
+
out.imageTransformLimits = resolveImageTransformLimits(limits);
|
|
14812
|
+
}
|
|
14687
14813
|
const buckets = tableAt(root, "storage.buckets");
|
|
14688
14814
|
if (buckets && buckets.children.size > 0) {
|
|
14689
14815
|
out.buckets = [...buckets.children].map(([id, t]) => ({
|
|
@@ -15521,6 +15647,7 @@ async function createProjectBackend(options = {}) {
|
|
|
15521
15647
|
dbSchemas: config.api.schemas,
|
|
15522
15648
|
maxRows: config.api.maxRows,
|
|
15523
15649
|
storageFileSizeLimit: config.storage.fileSizeLimit,
|
|
15650
|
+
storageImageTransformLimits: config.storage.imageTransformLimits,
|
|
15524
15651
|
buckets: config.storage.buckets,
|
|
15525
15652
|
migrations: options.applyMigrations === false ? [] : project.migrations,
|
|
15526
15653
|
seedSql: options.applyMigrations === false || options.includeSeed === false ? undefined : project.seedSql,
|
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.
|
|
91
|
+
version: "0.30.0",
|
|
92
92
|
description: "Bun-native, single-project Supabase-compatible backend powered by PGlite or native PostgreSQL",
|
|
93
93
|
type: "module",
|
|
94
94
|
license: "Apache-2.0",
|
|
@@ -147,16 +147,16 @@ var package_default = {
|
|
|
147
147
|
"@electric-sql/pglite-pgmq": "0.0.8",
|
|
148
148
|
"@electric-sql/pglite-pgvector": "0.0.11",
|
|
149
149
|
"@electric-sql/pglite-postgis": "0.2.10",
|
|
150
|
-
"@supacloud/db": "
|
|
150
|
+
"@supacloud/db": "0.18.1",
|
|
151
151
|
"exact-mirror": "1.2.6",
|
|
152
152
|
tar: "^7.5.22",
|
|
153
153
|
typebox: "1.3.37"
|
|
154
154
|
},
|
|
155
155
|
devDependencies: {
|
|
156
|
-
"@supacloud/app": "
|
|
157
|
-
"@supacloud/contracts": "
|
|
158
|
-
"@supacloud/compiler": "
|
|
159
|
-
"@supacloud/elysia": "
|
|
156
|
+
"@supacloud/app": "0.27.2",
|
|
157
|
+
"@supacloud/contracts": "0.11.2",
|
|
158
|
+
"@supacloud/compiler": "0.46.7",
|
|
159
|
+
"@supacloud/elysia": "0.33.2",
|
|
160
160
|
"@supabase/supabase-js": "^2.117.3",
|
|
161
161
|
"@types/bun": "^1.4.3",
|
|
162
162
|
effect: "4.0.5",
|
|
@@ -165,13 +165,13 @@ var package_default = {
|
|
|
165
165
|
typescript: "^7.0.2"
|
|
166
166
|
},
|
|
167
167
|
overrides: {
|
|
168
|
-
"@supacloud/db": "
|
|
169
|
-
"@supacloud/app": "
|
|
170
|
-
"@supacloud/compiler": "
|
|
171
|
-
"@supacloud/elysia": "
|
|
172
|
-
"@supacloud/contracts": "
|
|
173
|
-
"@supacloud/commands": "
|
|
174
|
-
"@supacloud/delivery": "
|
|
168
|
+
"@supacloud/db": "0.18.1",
|
|
169
|
+
"@supacloud/app": "0.27.2",
|
|
170
|
+
"@supacloud/compiler": "0.46.7",
|
|
171
|
+
"@supacloud/elysia": "0.33.2",
|
|
172
|
+
"@supacloud/contracts": "0.11.2",
|
|
173
|
+
"@supacloud/commands": "0.9.4",
|
|
174
|
+
"@supacloud/delivery": "0.19.1",
|
|
175
175
|
"@graphql-tools/utils": "^12.0.4"
|
|
176
176
|
},
|
|
177
177
|
engines: {
|
|
@@ -248,6 +248,13 @@ function isAllowedRedirect(requested, siteUrl, allowList = []) {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
// src/runtime/auth/oauth.ts
|
|
251
|
+
class OAuthAccountIneligibleError extends Error {
|
|
252
|
+
code;
|
|
253
|
+
constructor(code) {
|
|
254
|
+
super(code);
|
|
255
|
+
this.code = code;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
251
258
|
var PRESETS = {
|
|
252
259
|
google: {
|
|
253
260
|
authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth",
|
|
@@ -370,14 +377,30 @@ class OAuthService {
|
|
|
370
377
|
const msg = encodeURIComponent(e instanceof Error ? e.message : "oauth_error");
|
|
371
378
|
return redirect(`${flow.redirect_to}#error=server_error&error_description=${msg}`);
|
|
372
379
|
}
|
|
373
|
-
|
|
380
|
+
let userId;
|
|
381
|
+
try {
|
|
382
|
+
userId = await this.upsertUser(provider.name, profile);
|
|
383
|
+
} catch (e) {
|
|
384
|
+
if (e instanceof OAuthAccountIneligibleError) {
|
|
385
|
+
return redirect(`${flow.redirect_to}#error=access_denied&error_code=${e.code}`);
|
|
386
|
+
}
|
|
387
|
+
throw e;
|
|
388
|
+
}
|
|
374
389
|
if (flow.code_challenge) {
|
|
375
390
|
const authCode = randomToken(24);
|
|
376
391
|
await this.db.query(`insert into auth.flow_state (provider, provider_state, redirect_to, code_challenge, code_challenge_method, auth_code, user_id, expires_at)
|
|
377
392
|
values ($1, $2, $3, $4, $5, $6, $7, now() + interval '5 minutes')`, [flow.provider, randomToken(16), flow.redirect_to, flow.code_challenge, flow.code_challenge_method, authCode, userId]);
|
|
378
393
|
return redirect(`${flow.redirect_to}?code=${authCode}`);
|
|
379
394
|
}
|
|
380
|
-
|
|
395
|
+
let session;
|
|
396
|
+
try {
|
|
397
|
+
session = await createSession(userId);
|
|
398
|
+
} catch (e) {
|
|
399
|
+
if (e instanceof OAuthAccountIneligibleError) {
|
|
400
|
+
return redirect(`${flow.redirect_to}#error=access_denied&error_code=${e.code}`);
|
|
401
|
+
}
|
|
402
|
+
throw e;
|
|
403
|
+
}
|
|
381
404
|
const hash = `#access_token=${session.access_token}&refresh_token=${session.refresh_token}&expires_in=${session.expires_in}&token_type=bearer&provider_token=`;
|
|
382
405
|
return redirect(`${flow.redirect_to}${hash}`);
|
|
383
406
|
}
|
|
@@ -428,31 +451,37 @@ class OAuthService {
|
|
|
428
451
|
return profile;
|
|
429
452
|
}
|
|
430
453
|
async upsertUser(provider, profile) {
|
|
431
|
-
|
|
454
|
+
return this.db.transaction((query) => this.upsertUserInTransaction(query, provider, profile));
|
|
455
|
+
}
|
|
456
|
+
async upsertUserInTransaction(query, provider, profile) {
|
|
457
|
+
const existing = await query(`select user_id from auth.identities where provider = $1 and provider_id = $2`, [provider, profile.id]);
|
|
432
458
|
if (existing.rows[0]) {
|
|
433
|
-
await this.
|
|
459
|
+
await this.assertUserEligible(query, existing.rows[0].user_id);
|
|
460
|
+
await query(`update auth.identities set last_sign_in_at = now(), identity_data = $3 where provider = $1 and provider_id = $2`, [
|
|
434
461
|
provider,
|
|
435
462
|
profile.id,
|
|
436
463
|
JSON.stringify({ sub: profile.id, email: profile.email, ...profile.metadata })
|
|
437
464
|
]);
|
|
438
|
-
await
|
|
465
|
+
await query(`update auth.users set last_sign_in_at = now() where id = $1`, [existing.rows[0].user_id]);
|
|
439
466
|
return existing.rows[0].user_id;
|
|
440
467
|
}
|
|
441
468
|
let userId;
|
|
442
469
|
const email = profile.email?.toLowerCase() ?? null;
|
|
443
470
|
const verified = !!profile.email && profile.emailVerified === true;
|
|
444
471
|
if (email && verified) {
|
|
445
|
-
const byEmail = await
|
|
472
|
+
const byEmail = await query(`select id from auth.users where email = $1`, [email]);
|
|
446
473
|
userId = byEmail.rows[0]?.id;
|
|
474
|
+
if (userId)
|
|
475
|
+
await this.assertUserEligible(query, userId);
|
|
447
476
|
}
|
|
448
477
|
if (!userId) {
|
|
449
478
|
let userEmail = verified ? email : null;
|
|
450
479
|
if (userEmail) {
|
|
451
|
-
const taken = await
|
|
480
|
+
const taken = await query(`select 1 from auth.users where email = $1`, [userEmail]);
|
|
452
481
|
if (taken.rows.length > 0)
|
|
453
482
|
userEmail = null;
|
|
454
483
|
}
|
|
455
|
-
const created = await
|
|
484
|
+
const created = await query(`insert into auth.users (aud, role, email, email_confirmed_at, last_sign_in_at, raw_app_meta_data, raw_user_meta_data)
|
|
456
485
|
values ('authenticated','authenticated',$1, $2, now(),
|
|
457
486
|
$3::jsonb, $4::jsonb) returning id`, [
|
|
458
487
|
userEmail,
|
|
@@ -465,12 +494,22 @@ class OAuthService {
|
|
|
465
494
|
throw new Error("OAuth user creation returned no row");
|
|
466
495
|
userId = user.id;
|
|
467
496
|
}
|
|
468
|
-
await
|
|
497
|
+
await query(`insert into auth.identities (user_id, provider, provider_id, identity_data)
|
|
469
498
|
values ($1, $2, $3, $4::jsonb)`, [userId, provider, profile.id, JSON.stringify({ sub: profile.id, email: profile.email, ...profile.metadata })]);
|
|
470
499
|
if (!userId)
|
|
471
500
|
throw new Error("OAuth identity has no user ID");
|
|
472
501
|
return userId;
|
|
473
502
|
}
|
|
503
|
+
async assertUserEligible(query, userId) {
|
|
504
|
+
const users = await query(`select deleted_at is not null as is_deleted,
|
|
505
|
+
coalesce(banned_until > now(), false) as is_banned
|
|
506
|
+
from auth.users where id = $1 for update`, [userId]);
|
|
507
|
+
const user = users.rows[0];
|
|
508
|
+
if (!user || user.is_deleted)
|
|
509
|
+
throw new OAuthAccountIneligibleError("user_not_found");
|
|
510
|
+
if (user.is_banned)
|
|
511
|
+
throw new OAuthAccountIneligibleError("user_banned");
|
|
512
|
+
}
|
|
474
513
|
}
|
|
475
514
|
function redirect(location) {
|
|
476
515
|
return new Response(null, { status: 303, headers: { location } });
|
|
@@ -1356,6 +1395,8 @@ class AuthHandler {
|
|
|
1356
1395
|
return await this.admin(req, ctx, path, method);
|
|
1357
1396
|
return authError(404, "not_found", `unknown auth endpoint: ${path}`);
|
|
1358
1397
|
} catch (e) {
|
|
1398
|
+
if (e instanceof OAuthAccountIneligibleError)
|
|
1399
|
+
return authError(400, e.code, e.message);
|
|
1359
1400
|
const msg = e instanceof Error ? e.message : String(e);
|
|
1360
1401
|
return authError(500, "unexpected_failure", msg);
|
|
1361
1402
|
}
|
|
@@ -1450,8 +1491,7 @@ class AuthHandler {
|
|
|
1450
1491
|
const userId = await this.oauth.exchangePkce(authCode, verifier);
|
|
1451
1492
|
if (!userId)
|
|
1452
1493
|
return authError(403, "flow_state_not_found", "invalid or expired auth code");
|
|
1453
|
-
|
|
1454
|
-
return json(200, await this.sessionForOAuth(ures.rows[0]));
|
|
1494
|
+
return json(200, await this.sessionForOAuth(userId));
|
|
1455
1495
|
}
|
|
1456
1496
|
return authError(400, "invalid_grant", `unsupported grant_type: ${grantType}`);
|
|
1457
1497
|
}
|
|
@@ -1746,7 +1786,10 @@ Or sign in with this link: ${link}`
|
|
|
1746
1786
|
tokenTypes: `{${types.join(",")}}`,
|
|
1747
1787
|
email: email?.toLowerCase().trim() ?? null
|
|
1748
1788
|
};
|
|
1749
|
-
return this.db.transaction((query) =>
|
|
1789
|
+
return this.db.transaction(async (query) => {
|
|
1790
|
+
const user = await this.claimEmailToken(query, redemption);
|
|
1791
|
+
return user ? this.sessionFor(user, undefined, undefined, query) : null;
|
|
1792
|
+
});
|
|
1750
1793
|
}
|
|
1751
1794
|
async claimEmailToken(query, redemption) {
|
|
1752
1795
|
const candidate = await this.findEmailTokenCandidate(query, redemption);
|
|
@@ -1758,7 +1801,10 @@ Or sign in with this link: ${link}`
|
|
|
1758
1801
|
return claimedToken ? this.confirmEmailTokenUser(query, claimedToken) : null;
|
|
1759
1802
|
}
|
|
1760
1803
|
async lockAndDeleteEmailToken(query, candidate, redemption) {
|
|
1761
|
-
await query(`select id from auth.users where id = $1
|
|
1804
|
+
const eligible = await query(`select id from auth.users where id = $1 and deleted_at is null
|
|
1805
|
+
and (banned_until is null or banned_until <= now()) for update`, [candidate.user_id]);
|
|
1806
|
+
if (eligible.rows.length === 0)
|
|
1807
|
+
return null;
|
|
1762
1808
|
const claimedTokens = await query(`delete from auth.one_time_tokens
|
|
1763
1809
|
where id = $1 and token = $2 and token_type = any($3::text[])
|
|
1764
1810
|
and expires_at > now() and attempts < $4
|
|
@@ -1811,10 +1857,10 @@ Or sign in with this link: ${link}`
|
|
|
1811
1857
|
return json(200, session);
|
|
1812
1858
|
}
|
|
1813
1859
|
const types = body.type === "recovery" ? ["recovery"] : body.type === "magiclink" ? ["magiclink"] : ["otp", "magiclink"];
|
|
1814
|
-
const
|
|
1815
|
-
if (!
|
|
1860
|
+
const session = await this.redeem(token, types, body.email);
|
|
1861
|
+
if (!session)
|
|
1816
1862
|
return authError(403, "otp_expired", "Token has expired or is invalid");
|
|
1817
|
-
return json(200,
|
|
1863
|
+
return json(200, session);
|
|
1818
1864
|
}
|
|
1819
1865
|
async redeemPhoneOtp(phone, code) {
|
|
1820
1866
|
const tokenDigest = `hmac-sha256:v1:${await keyedDigest(this.config.jwtSecret, "supacloud-lite:phone-otp:v1", `${phone}\x00${code}`)}`;
|
|
@@ -1855,11 +1901,10 @@ Or sign in with this link: ${link}`
|
|
|
1855
1901
|
const token = url.searchParams.get("token") ?? "";
|
|
1856
1902
|
const type = url.searchParams.get("type") ?? "magiclink";
|
|
1857
1903
|
const redirectTo = resolveRedirect(url.searchParams.get("redirect_to"), this.config.siteUrl, this.config.uriAllowList, this.config.enforceRedirectAllowList);
|
|
1858
|
-
const
|
|
1859
|
-
if (!
|
|
1904
|
+
const session = await this.redeem(token, [type]);
|
|
1905
|
+
if (!session) {
|
|
1860
1906
|
return new Response(null, { status: 303, headers: { location: `${redirectTo}#error=access_denied&error_code=otp_expired` } });
|
|
1861
1907
|
}
|
|
1862
|
-
const session = await this.sessionFor(user);
|
|
1863
1908
|
const hash = `#access_token=${session.access_token}&refresh_token=${session.refresh_token}&expires_in=${session.expires_in}&token_type=bearer&type=${type}`;
|
|
1864
1909
|
return new Response(null, { status: 303, headers: { location: `${redirectTo}${hash}` } });
|
|
1865
1910
|
}
|
|
@@ -2160,6 +2205,11 @@ Or sign in with this link: ${link}`
|
|
|
2160
2205
|
return authError(422, "mfa_verification_failed", "Invalid TOTP code entered");
|
|
2161
2206
|
}
|
|
2162
2207
|
const session = await this.db.transaction(async (query) => {
|
|
2208
|
+
const currentUsers = await query(`select * from auth.users where id = $1 and deleted_at is null
|
|
2209
|
+
and (banned_until is null or banned_until <= now()) for update`, [user.id]);
|
|
2210
|
+
const currentUser = currentUsers.rows[0];
|
|
2211
|
+
if (!currentUser)
|
|
2212
|
+
return null;
|
|
2163
2213
|
const claimed = await query(`update auth.mfa_challenges set verified_at = now()
|
|
2164
2214
|
where id = $1 and factor_id = $2 and verified_at is null and expires_at >= now()
|
|
2165
2215
|
returning id`, [challenge.id, factorId]);
|
|
@@ -2168,7 +2218,7 @@ Or sign in with this link: ${link}`
|
|
|
2168
2218
|
if (factor.status !== "verified") {
|
|
2169
2219
|
await query(`update auth.mfa_factors set status = 'verified', updated_at = now() where id = $1`, [factorId]);
|
|
2170
2220
|
}
|
|
2171
|
-
return this.sessionFor(
|
|
2221
|
+
return this.sessionFor(currentUser, undefined, {
|
|
2172
2222
|
aal: "aal2",
|
|
2173
2223
|
amr: [
|
|
2174
2224
|
{ method: "password", timestamp: Math.floor(Date.now() / 1000) },
|
|
@@ -2229,6 +2279,18 @@ Or sign in with this link: ${link}`
|
|
|
2229
2279
|
}
|
|
2230
2280
|
async rotateRefreshToken(token) {
|
|
2231
2281
|
return this.db.transaction(async (query) => {
|
|
2282
|
+
const availableToken = await this.findAvailableRefreshToken(query, token);
|
|
2283
|
+
if (!availableToken)
|
|
2284
|
+
return authError(400, "refresh_token_not_found", "Invalid Refresh Token: Refresh Token Not Found");
|
|
2285
|
+
const userResult = await query(`select *, coalesce(banned_until > now(), false) as is_banned
|
|
2286
|
+
from auth.users where id = $1 for update`, [availableToken.user_id]);
|
|
2287
|
+
const user = userResult.rows[0];
|
|
2288
|
+
if (!user || user.deleted_at !== null) {
|
|
2289
|
+
return authError(400, "refresh_token_not_found", "Invalid Refresh Token: Refresh Token Not Found");
|
|
2290
|
+
}
|
|
2291
|
+
if (user.is_banned) {
|
|
2292
|
+
return authError(400, "user_banned", "Invalid Refresh Token: User Banned");
|
|
2293
|
+
}
|
|
2232
2294
|
const claimedToken = await this.claimRefreshToken(query, token);
|
|
2233
2295
|
if (!claimedToken)
|
|
2234
2296
|
return authError(400, "refresh_token_not_found", "Invalid Refresh Token: Refresh Token Not Found");
|
|
@@ -2236,14 +2298,19 @@ Or sign in with this link: ${link}`
|
|
|
2236
2298
|
const expiryError = this.refreshExpiryError(claimedToken, sessionStartedAt);
|
|
2237
2299
|
if (expiryError)
|
|
2238
2300
|
return expiryError;
|
|
2239
|
-
const
|
|
2240
|
-
const session = await this.sessionFor(userResult.rows[0], token, {
|
|
2301
|
+
const session = await this.sessionFor(user, token, {
|
|
2241
2302
|
sessionId: claimedToken.session_id ?? undefined,
|
|
2242
2303
|
sessionStartedAt: sessionStartedAt === null ? undefined : Math.floor(sessionStartedAt / 1000)
|
|
2243
2304
|
}, query);
|
|
2244
2305
|
return json(200, session);
|
|
2245
2306
|
});
|
|
2246
2307
|
}
|
|
2308
|
+
async findAvailableRefreshToken(query, token) {
|
|
2309
|
+
const available = await query(`select user_id, session_id, created_at
|
|
2310
|
+
from auth.refresh_tokens
|
|
2311
|
+
where token = $1 and revoked is not true`, [token]);
|
|
2312
|
+
return available.rows[0];
|
|
2313
|
+
}
|
|
2247
2314
|
async claimRefreshToken(query, token) {
|
|
2248
2315
|
const claimed = await query(`update auth.refresh_tokens set revoked = true, updated_at = now()
|
|
2249
2316
|
where token = $1 and revoked is not true
|
|
@@ -2271,7 +2338,8 @@ Or sign in with this link: ${link}`
|
|
|
2271
2338
|
const claims = await this.claimsFromBearer(req);
|
|
2272
2339
|
if (!claims?.sub)
|
|
2273
2340
|
return null;
|
|
2274
|
-
const res = await this.db.query(`select * from auth.users where id = $1
|
|
2341
|
+
const res = await this.db.query(`select * from auth.users where id = $1 and deleted_at is null
|
|
2342
|
+
and (banned_until is null or banned_until <= now())`, [claims.sub]);
|
|
2275
2343
|
return res.rows[0] ?? null;
|
|
2276
2344
|
}
|
|
2277
2345
|
async claimsFromBearer(req) {
|
|
@@ -2300,14 +2368,22 @@ Or sign in with this link: ${link}`
|
|
|
2300
2368
|
is_anonymous: u.is_anonymous ?? false
|
|
2301
2369
|
};
|
|
2302
2370
|
}
|
|
2303
|
-
sessionForOAuth(
|
|
2304
|
-
return this.
|
|
2305
|
-
|
|
2371
|
+
sessionForOAuth(userId) {
|
|
2372
|
+
return this.db.transaction(async (query) => {
|
|
2373
|
+
const res = await query(`select *, coalesce(banned_until > now(), false) as is_banned
|
|
2374
|
+
from auth.users where id = $1 for update`, [userId]);
|
|
2375
|
+
const user = res.rows[0];
|
|
2376
|
+
if (!user || user.deleted_at !== null)
|
|
2377
|
+
throw new OAuthAccountIneligibleError("user_not_found");
|
|
2378
|
+
if (user.is_banned)
|
|
2379
|
+
throw new OAuthAccountIneligibleError("user_banned");
|
|
2380
|
+
return this.sessionFor(user, undefined, {
|
|
2381
|
+
amr: [{ method: "oauth", timestamp: Math.floor(Date.now() / 1000) }]
|
|
2382
|
+
}, query);
|
|
2306
2383
|
});
|
|
2307
2384
|
}
|
|
2308
2385
|
async oauthSessionTokensFor(userId) {
|
|
2309
|
-
const
|
|
2310
|
-
const session = await this.sessionForOAuth(res.rows[0]);
|
|
2386
|
+
const session = await this.sessionForOAuth(userId);
|
|
2311
2387
|
return { access_token: session.access_token, refresh_token: session.refresh_token, expires_in: session.expires_in };
|
|
2312
2388
|
}
|
|
2313
2389
|
async sessionFor(user, parentToken, opts, query = (sql, params) => this.db.query(sql, params)) {
|
|
@@ -8972,8 +9048,18 @@ var IMAGE_FORMAT_CONTENT_TYPES = {
|
|
|
8972
9048
|
gif: "image/gif"
|
|
8973
9049
|
};
|
|
8974
9050
|
var MAX_TRANSFORM_DIMENSION = 2500;
|
|
8975
|
-
var MAX_TRANSFORM_BYTES =
|
|
9051
|
+
var MAX_TRANSFORM_BYTES = 500 * 1024 * 1024;
|
|
8976
9052
|
var MAX_TRANSFORM_PIXELS = 50000000;
|
|
9053
|
+
function resolveImageTransformLimits(options = {}) {
|
|
9054
|
+
const maxInputBytes = options.maxInputBytes === undefined ? MAX_TRANSFORM_BYTES : options.maxInputBytes;
|
|
9055
|
+
const maxOutputBytes = options.maxOutputBytes === undefined ? MAX_TRANSFORM_BYTES : options.maxOutputBytes;
|
|
9056
|
+
for (const [name, value] of Object.entries({ maxInputBytes, maxOutputBytes })) {
|
|
9057
|
+
if (!Number.isSafeInteger(value) || value < 1 || value > MAX_TRANSFORM_BYTES) {
|
|
9058
|
+
throw new Error(`Invalid image transformation ${name}: expected 1..${MAX_TRANSFORM_BYTES} bytes`);
|
|
9059
|
+
}
|
|
9060
|
+
}
|
|
9061
|
+
return { maxInputBytes, maxOutputBytes };
|
|
9062
|
+
}
|
|
8977
9063
|
function invalid(message) {
|
|
8978
9064
|
return { ok: false, status: 400, error: "InvalidTransformation", message };
|
|
8979
9065
|
}
|
|
@@ -9031,7 +9117,16 @@ function parseImageTransform(query) {
|
|
|
9031
9117
|
if (quality !== undefined && format === "png") {
|
|
9032
9118
|
return invalid("quality is supported only for jpeg and webp output");
|
|
9033
9119
|
}
|
|
9034
|
-
return {
|
|
9120
|
+
return {
|
|
9121
|
+
ok: true,
|
|
9122
|
+
value: {
|
|
9123
|
+
resize,
|
|
9124
|
+
format,
|
|
9125
|
+
...width === undefined ? {} : { width },
|
|
9126
|
+
...height === undefined ? {} : { height },
|
|
9127
|
+
...quality === undefined ? {} : { quality }
|
|
9128
|
+
}
|
|
9129
|
+
};
|
|
9035
9130
|
}
|
|
9036
9131
|
function imageTransformToSearchParams(options) {
|
|
9037
9132
|
const query = new URLSearchParams;
|
|
@@ -9105,15 +9200,16 @@ function applyResize(image, metadata, options) {
|
|
|
9105
9200
|
const proportionalWidth = Math.max(1, Math.round(metadata.width * height / metadata.height));
|
|
9106
9201
|
image.resize(proportionalWidth);
|
|
9107
9202
|
}
|
|
9108
|
-
async function transformImage(source, options, knownSourceSize) {
|
|
9203
|
+
async function transformImage(source, options, knownSourceSize, configuredLimits = {}) {
|
|
9204
|
+
const limits = resolveImageTransformLimits(configuredLimits);
|
|
9109
9205
|
const actualSourceSize = source instanceof Uint8Array ? source.byteLength : await Promise.resolve(source.size);
|
|
9110
9206
|
const sourceSize = Math.max(knownSourceSize ?? 0, actualSourceSize);
|
|
9111
|
-
if (sourceSize >
|
|
9207
|
+
if (sourceSize > limits.maxInputBytes) {
|
|
9112
9208
|
return {
|
|
9113
9209
|
ok: false,
|
|
9114
9210
|
status: 413,
|
|
9115
9211
|
error: "ImageTooLarge",
|
|
9116
|
-
message:
|
|
9212
|
+
message: `The source image exceeds the transformation limit (${limits.maxInputBytes} bytes)`
|
|
9117
9213
|
};
|
|
9118
9214
|
}
|
|
9119
9215
|
const image = new Bun.Image(source, { maxPixels: MAX_TRANSFORM_PIXELS });
|
|
@@ -9146,12 +9242,12 @@ async function transformImage(source, options, knownSourceSize) {
|
|
|
9146
9242
|
}
|
|
9147
9243
|
try {
|
|
9148
9244
|
const bytes = await image.bytes();
|
|
9149
|
-
if (bytes.byteLength >
|
|
9245
|
+
if (bytes.byteLength > limits.maxOutputBytes) {
|
|
9150
9246
|
return {
|
|
9151
9247
|
ok: false,
|
|
9152
9248
|
status: 413,
|
|
9153
9249
|
error: "ImageTooLarge",
|
|
9154
|
-
message:
|
|
9250
|
+
message: `The transformed image exceeds the transformation limit (${limits.maxOutputBytes} bytes)`
|
|
9155
9251
|
};
|
|
9156
9252
|
}
|
|
9157
9253
|
return { ok: true, bytes, contentType };
|
|
@@ -9354,10 +9450,12 @@ class StorageHandler {
|
|
|
9354
9450
|
tusUploads = new Map;
|
|
9355
9451
|
mutationTail = Promise.resolve();
|
|
9356
9452
|
imageTransforms = new ImageTransformCache;
|
|
9453
|
+
transformLimits;
|
|
9357
9454
|
constructor(db, driver, config) {
|
|
9358
9455
|
this.db = db;
|
|
9359
9456
|
this.driver = driver;
|
|
9360
9457
|
this.config = config;
|
|
9458
|
+
this.transformLimits = resolveImageTransformLimits(config.imageTransformLimits);
|
|
9361
9459
|
}
|
|
9362
9460
|
async ensureBuckets(buckets) {
|
|
9363
9461
|
for (const b of buckets) {
|
|
@@ -9633,7 +9731,7 @@ class StorageHandler {
|
|
|
9633
9731
|
const source = await this.readObjectSource(row);
|
|
9634
9732
|
if (source === null)
|
|
9635
9733
|
throw new StorageObjectMissingError;
|
|
9636
|
-
return transformImage(source, parsed.value, objectSize(row));
|
|
9734
|
+
return transformImage(source, parsed.value, objectSize(row), this.transformLimits);
|
|
9637
9735
|
});
|
|
9638
9736
|
} catch (error) {
|
|
9639
9737
|
if (error instanceof StorageObjectMissingError) {
|
|
@@ -11480,6 +11578,7 @@ ${msg.text}` : `[mail] to=${msg.to} subject="${msg.subject}"`));
|
|
|
11480
11578
|
const storage = new StorageHandler(db, config.storageDriver ?? new MemoryStorageDriver, {
|
|
11481
11579
|
jwtSecret,
|
|
11482
11580
|
defaultFileSizeLimit: config.storageFileSizeLimit,
|
|
11581
|
+
imageTransformLimits: config.storageImageTransformLimits,
|
|
11483
11582
|
log
|
|
11484
11583
|
});
|
|
11485
11584
|
if (config.buckets?.length) {
|
|
@@ -13701,6 +13800,19 @@ function readStorage(root) {
|
|
|
13701
13800
|
const limit = getByteSize(storage, "file_size_limit");
|
|
13702
13801
|
if (limit !== undefined)
|
|
13703
13802
|
out.fileSizeLimit = limit;
|
|
13803
|
+
const image = tableAt(root, "storage.image_transformation");
|
|
13804
|
+
if (image) {
|
|
13805
|
+
const limits = {};
|
|
13806
|
+
for (const [key, field] of [["max_input_bytes", "maxInputBytes"], ["max_output_bytes", "maxOutputBytes"]]) {
|
|
13807
|
+
if (!image.values.has(key))
|
|
13808
|
+
continue;
|
|
13809
|
+
const value = getByteSize(image, key);
|
|
13810
|
+
if (value === undefined)
|
|
13811
|
+
throw new Error(`Invalid image transformation ${key}`);
|
|
13812
|
+
limits[field] = value;
|
|
13813
|
+
}
|
|
13814
|
+
out.imageTransformLimits = resolveImageTransformLimits(limits);
|
|
13815
|
+
}
|
|
13704
13816
|
const buckets = tableAt(root, "storage.buckets");
|
|
13705
13817
|
if (buckets && buckets.children.size > 0) {
|
|
13706
13818
|
out.buckets = [...buckets.children].map(([id, t]) => ({
|
|
@@ -14041,8 +14153,22 @@ async function loadFunctionsUnlocked(projectDir, options, mode) {
|
|
|
14041
14153
|
import { lstat, readdir as readdir2, readFile as readFile5 } from "fs/promises";
|
|
14042
14154
|
import { join as join6 } from "path";
|
|
14043
14155
|
|
|
14044
|
-
//
|
|
14156
|
+
// ../db/dist/index.js
|
|
14045
14157
|
import { createHash as createHash4 } from "crypto";
|
|
14158
|
+
|
|
14159
|
+
// ../contracts/dist/index.mjs
|
|
14160
|
+
var commandErrorBrand = Symbol.for("@supacloud/contracts/CommandError/v1");
|
|
14161
|
+
var commandErrorCodes = new Set([
|
|
14162
|
+
"COMMAND_INPUT_INVALID",
|
|
14163
|
+
"COMMAND_REJECTED",
|
|
14164
|
+
"COMMAND_UNAVAILABLE",
|
|
14165
|
+
"COMMAND_IDEMPOTENCY_CONFLICT",
|
|
14166
|
+
"COMMAND_RECEIPT_INVALID",
|
|
14167
|
+
"COMMAND_OUTCOME_UNKNOWN",
|
|
14168
|
+
"COMMAND_INPUT_EXPIRED"
|
|
14169
|
+
]);
|
|
14170
|
+
|
|
14171
|
+
// ../db/dist/index.js
|
|
14046
14172
|
var TOKEN = /__[A-Z][A-Z0-9_]*__/g;
|
|
14047
14173
|
var RESERVED_TOKEN = /__SC_BINDING_[A-Z0-9_]+__/;
|
|
14048
14174
|
var HASH = /^[a-f0-9]{64}$/;
|
|
@@ -14586,6 +14712,7 @@ async function createProjectBackend(options = {}) {
|
|
|
14586
14712
|
dbSchemas: config.api.schemas,
|
|
14587
14713
|
maxRows: config.api.maxRows,
|
|
14588
14714
|
storageFileSizeLimit: config.storage.fileSizeLimit,
|
|
14715
|
+
storageImageTransformLimits: config.storage.imageTransformLimits,
|
|
14589
14716
|
buckets: config.storage.buckets,
|
|
14590
14717
|
migrations: options.applyMigrations === false ? [] : project.migrations,
|
|
14591
14718
|
seedSql: options.applyMigrations === false || options.includeSeed === false ? undefined : project.seedSql,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-runtime.d.ts","sourceRoot":"","sources":["../src/project-runtime.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAG7E,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAE3E,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAGrF,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAE/D,OAAO,EAAmB,KAAK,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAC7F,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClE,OAAO,EAAkC,KAAK,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAGrG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAK5D,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,cAAc,CAAA;C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wBAAgB,mBAAmB,CAAC,OAAO,GAAE,qBAA0B,GAAG,YAAY,CAsBrF;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA6B7E;AAqED,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAqCvF;AAED,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC,CAE7G;AAED,wBAAsB,oBAAoB,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,cAAc,CAAC,CAgHvG;AAED,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CASrH;AAeD,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,qBAAqB,EAC9B,cAAc,iBAAwD,GACrE,wBAAwB,GAAG,SAAS,CAyBtC;AAED,wBAAgB,qBAAqB,CAAC,KAAK,CAAC,EAAE,cAAc,EAAE,MAAM,UAAQ,GAAG,cAAc,CAa5F;AAED,wBAAgB,qBAAqB,CAAC,KAAK,CAAC,EAAE,wBAAwB,GAAG,wBAAwB,CAIhG;AAiBD,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAiC3G"}
|
|
@@ -163,6 +163,7 @@ export declare class AuthHandler {
|
|
|
163
163
|
private ensureEmailIdentity;
|
|
164
164
|
private userJsonWithRelations;
|
|
165
165
|
private rotateRefreshToken;
|
|
166
|
+
private findAvailableRefreshToken;
|
|
166
167
|
private claimRefreshToken;
|
|
167
168
|
private refreshSessionStartedAt;
|
|
168
169
|
private refreshExpiryError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/runtime/auth/handler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAW,MAAM,mBAAmB,CAAA;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAc,SAAS,EAAE,MAAM,aAAa,CAAA;AAEhF,OAAO,
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/runtime/auth/handler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAW,MAAM,mBAAmB,CAAA;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAc,SAAS,EAAE,MAAM,aAAa,CAAA;AAEhF,OAAO,EAA6C,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAGhG,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAExE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG7C,wDAAwD;AACxD,MAAM,WAAW,UAAU;IACzB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAA;IACjB,2FAA2F;IAC3F,MAAM,EAAE,MAAM,CAAA;IACd,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAA;IACf,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAA;IACjB,yGAAyG;IACzG,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,uEAAuE;IACvE,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAA;IACd,+DAA+D;IAC/D,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;IAC5B,oFAAoF;IACpF,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;IACpD,gFAA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ASG;YACW,SAAS;YAqBT,YAAY;YAyDZ,eAAe;YAqBf,YAAY;YA0DZ,cAAc;YAWd,cAAc;IAmB5B,oFAAoF;YACtE,iBAAiB;YAqBjB,mBAAmB;YAcnB,qBAAqB;YAarB,kBAAkB;YAmClB,yBAAyB;YAUzB,iBAAiB;YAUjB,uBAAuB;IASrC,OAAO,CAAC,kBAAkB;YAoBZ,cAAc;YAWd,gBAAgB;IAM9B,wEAAwE;IACxE,QAAQ,CACN,CAAC,EAAE,OAAO,EACV,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAO,EACvC,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAO,GACzC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAqB1B,OAAO,CAAC,eAAe;YAgBT,qBAAqB;YAWrB,UAAU;CAqDzB"}
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import type { Database } from '../db/database.js';
|
|
14
14
|
type OAuthRawProfile = Record<string, unknown>;
|
|
15
|
+
export declare class OAuthAccountIneligibleError extends Error {
|
|
16
|
+
readonly code: 'user_banned' | 'user_not_found';
|
|
17
|
+
constructor(code: 'user_banned' | 'user_not_found');
|
|
18
|
+
}
|
|
15
19
|
/** Operator-supplied config for one OAuth provider. Endpoint URLs are optional for presets (google, github). */
|
|
16
20
|
export interface OAuthProviderConfig {
|
|
17
21
|
/** OAuth client id issued by the provider */
|
|
@@ -75,6 +79,8 @@ export declare class OAuthService {
|
|
|
75
79
|
private exchangeCode;
|
|
76
80
|
private fetchProfile;
|
|
77
81
|
private upsertUser;
|
|
82
|
+
private upsertUserInTransaction;
|
|
83
|
+
private assertUserEligible;
|
|
78
84
|
}
|
|
79
85
|
/** The minimal session the callback puts in the redirect fragment for the implicit flow. */
|
|
80
86
|
export interface OAuthSession {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../src/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D,GAAG,EAAE,UAAU,CAAA;IACf,6EAA6E;IAC7E,SAAS,EAAE,gBAAgB,CAAA;IAC3B,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAA;IACf,+CAA+C;IAC/C,cAAc,EAAE,MAAM,CAAA;IACtB,oFAAoF;IACpF,SAAS,EAAE,MAAM,CAAA;IACjB,kEAAkE;IAClE,IAAI,EAAE,SAAS,CAAA;IACf,4FAA4F;IAC5F,KAAK,EAAE,WAAW,GAAG,IAAI,CAAA;IACzB,gHAAgH;IAChH,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;IACzB,8CAA8C;IAC9C,OAAO,EAAE,CAAC,UAAU,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAC7E,gGAAgG;IAChG,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3B;AAWD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CAAC,MAAM,GAAE,aAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAyZ7F"}
|
|
@@ -12,6 +12,7 @@ import type { AuthSettings } from '../auth/settings.js';
|
|
|
12
12
|
import type { OAuthProviderConfig } from '../auth/oauth.js';
|
|
13
13
|
import type { RateLimitRule } from '../auth/rate-limit.js';
|
|
14
14
|
import type { BucketSeed } from '../types.js';
|
|
15
|
+
import { type ImageTransformLimits } from '../storage/image-transform.js';
|
|
15
16
|
import { type RuntimeMode } from '../functions/profile.js';
|
|
16
17
|
import type { GraphqlOptions } from '../graphql.js';
|
|
17
18
|
import { type Environment } from './config-toml.js';
|
|
@@ -70,6 +71,8 @@ export interface ApiConfig {
|
|
|
70
71
|
export interface StorageConfig {
|
|
71
72
|
/** [storage].file_size_limit: default per-bucket byte limit */
|
|
72
73
|
fileSizeLimit?: number;
|
|
74
|
+
/** [storage.image_transformation].max_input_bytes / max_output_bytes */
|
|
75
|
+
imageTransformLimits?: ImageTransformLimits;
|
|
73
76
|
/** [storage.buckets.*]: buckets to create at boot */
|
|
74
77
|
buckets?: BucketSeed[];
|
|
75
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-config.d.ts","sourceRoot":"","sources":["../../../src/runtime/node/load-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAUL,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAA;AAEzB,oFAAoF;AACpF,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE;QACJ,WAAW,EAAE,WAAW,CAAA;QACxB,OAAO,EAAE,cAAc,CAAA;QACvB,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,iBAAiB,CAAC,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,CAAA;KAClF,CAAA;IACD,0EAA0E;IAC1E,IAAI,EAAE,UAAU,CAAA;IAChB,mDAAmD;IACnD,GAAG,EAAE,SAAS,CAAA;IACd,kEAAkE;IAClE,OAAO,EAAE,aAAa,CAAA;IACtB,gDAAgD;IAChD,IAAI,EAAE,UAAU,CAAA;IAChB,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CAC3C;AAED,yFAAyF;AACzF,MAAM,WAAW,UAAU;IACzB,uDAAuD;IAC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,CAAC,EAAE,MAAM,CAAA;IACtB,wEAAwE;IACxE,oBAAoB,CAAC,EAAE,oBAAoB,CAAA;IAC3C,qDAAqD;IACrD,OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;CACvB;AAED,4CAA4C;AAC5C,MAAM,WAAW,UAAU;IACzB,wBAAwB;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;CACjB;AAED,iDAAiD;AACjD,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,oCAAoC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,yBAAyB,EAAE,iBAAiB,CAAA;IAC/D,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6FAA6F;IAC7F,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,+FAA+F;IAC/F,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,2FAA2F;IAC3F,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,yGAAyG;IACzG,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,uGAAuG;IACvG,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,8HAA8H;IAC9H,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,GAAE,WAAyB,EAAE,YAAY,CAAC,EAAE,WAAW,GAAG,aAAa,CAW/H"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* through the request role); bytes live behind a StorageDriver.
|
|
5
5
|
*/
|
|
6
6
|
import type { Database } from '../db/database.js';
|
|
7
|
+
import { type ImageTransformLimits } from './image-transform.js';
|
|
7
8
|
import type { BucketSeed, RequestContext, StorageDriver } from '../types.js';
|
|
8
9
|
/** Construction options for {@link StorageHandler}. */
|
|
9
10
|
export interface StorageConfig {
|
|
@@ -11,6 +12,7 @@ export interface StorageConfig {
|
|
|
11
12
|
jwtSecret: string;
|
|
12
13
|
/** default per-bucket byte limit applied when a bucket sets none (config.toml storage.file_size_limit) */
|
|
13
14
|
defaultFileSizeLimit?: number;
|
|
15
|
+
imageTransformLimits?: ImageTransformLimits;
|
|
14
16
|
/** sink for progress/warning lines (e.g. image-transform no-op); no-op when omitted */
|
|
15
17
|
log?: (message: string) => void;
|
|
16
18
|
}
|
|
@@ -22,6 +24,7 @@ export declare class StorageHandler {
|
|
|
22
24
|
private tusUploads;
|
|
23
25
|
private mutationTail;
|
|
24
26
|
private imageTransforms;
|
|
27
|
+
private readonly transformLimits;
|
|
25
28
|
constructor(db: Database, driver: StorageDriver, config: StorageConfig);
|
|
26
29
|
/** Create the given buckets if they don't already exist (config.toml storage.buckets.*). */
|
|
27
30
|
ensureBuckets(buckets: BucketSeed[]): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/runtime/storage/handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/runtime/storage/handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAKL,KAAK,oBAAoB,EAG1B,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE5E,uDAAuD;AACvD,MAAM,WAAW,aAAa;IAC5B,uEAAuE;IACvE,SAAS,EAAE,MAA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AAU;YAyBV,OAAO;YAmBP,QAAQ;YAiBR,eAAe;YAMf,gBAAgB;YAehB,aAAa;YAab,kBAAkB;IAehC,OAAO,CAAC,aAAa;CAUtB;AA6ID,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,UAAU,CAAA;CACjB;AAED,+FAA+F;AAC/F,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,aAAa,EAAE,CAqCnF"}
|
|
@@ -29,10 +29,16 @@ export type ImageTransformResult = {
|
|
|
29
29
|
bytes: Uint8Array;
|
|
30
30
|
contentType: string;
|
|
31
31
|
} | ImageTransformError;
|
|
32
|
+
export interface ImageTransformLimits {
|
|
33
|
+
maxInputBytes?: number;
|
|
34
|
+
maxOutputBytes?: number;
|
|
35
|
+
}
|
|
36
|
+
/** Operator-owned limits, never taken from image URL parameters. */
|
|
37
|
+
export declare function resolveImageTransformLimits(options?: ImageTransformLimits): Required<ImageTransformLimits>;
|
|
32
38
|
/** Parse Supabase Storage image query parameters without decoding the source. */
|
|
33
39
|
export declare function parseImageTransform(query: URLSearchParams): ImageTransformParseResult;
|
|
34
40
|
/** Encode a transform object into the query shape used by render/image URLs. */
|
|
35
41
|
export declare function imageTransformToSearchParams(options?: ImageTransformRequestOptions): URLSearchParams;
|
|
36
42
|
/** Decode, resize, and encode an image using the Bun.Image-compatible subset. */
|
|
37
|
-
export declare function transformImage(source: Uint8Array | Blob, options: ImageTransformOptions, knownSourceSize?: number): Promise<ImageTransformResult>;
|
|
43
|
+
export declare function transformImage(source: Uint8Array | Blob, options: ImageTransformOptions, knownSourceSize?: number, configuredLimits?: ImageTransformLimits): Promise<ImageTransformResult>;
|
|
38
44
|
//# sourceMappingURL=image-transform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-transform.d.ts","sourceRoot":"","sources":["../../../src/runtime/storage/image-transform.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,MAAM,CAAA;AACrD,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;AAErE,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,oBAAoB,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,oBAAoB,CAAA;CAC7B;AAED,MAAM,WAAW,4BAA4B;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAA;IACvC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,oBAAoB,CAAA;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,KAAK,CAAA;IACT,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,yBAAyB,GACjC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,qBAAqB,CAAA;CAAE,GAC1C,mBAAmB,CAAA;AAEvB,MAAM,MAAM,oBAAoB,GAC5B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GACpD,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"image-transform.d.ts","sourceRoot":"","sources":["../../../src/runtime/storage/image-transform.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG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AAmB,CAAC,KAAK,EAAE,eAAe,GAAG,yBAAyB,CAsCrF;AAED,gFAAgF;AAChF,wBAAgB,4BAA4B,CAAC,OAAO,CAAC,EAAE,4BAA4B,GAAG,eAAe,CASpG;AA0DD,iFAAiF;AACjF,wBAAsB,cAAc,CAClC,MAAM,EAAE,UAAU,GAAG,IAAI,EACzB,OAAO,EAAE,qBAAqB,EAC9B,eAAe,CAAC,EAAE,MAAM,EACxB,gBAAgB,GAAE,oBAAyB,GAC1C,OAAO,CAAC,oBAAoB,CAAC,CA2D/B"}
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -113,6 +113,8 @@ export interface BackendConfig {
|
|
|
113
113
|
maxRows?: number;
|
|
114
114
|
/** Default per-bucket file size limit in bytes (config.toml storage.file_size_limit). */
|
|
115
115
|
storageFileSizeLimit?: number;
|
|
116
|
+
/** Operator-owned image conversion input/output limits; default and maximum 500 MiB each. */
|
|
117
|
+
storageImageTransformLimits?: import('./storage/image-transform.js').ImageTransformLimits;
|
|
116
118
|
/** Buckets to create at boot if absent (config.toml storage.buckets.*). */
|
|
117
119
|
buckets?: BucketSeed[];
|
|
118
120
|
/** Force sign-out after this many seconds regardless of activity (config.toml auth.sessions.timebox). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEzC,yFAAyF;AACzF,MAAM,WAAW,aAAa;IAC5B,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAA;IACZ,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAA;CACZ;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,OAAO,wBAAwB,EAAE,WAAW,CAAA;IAC1D,OAAO,CAAC,EAAE,OAAO,cAAc,EAAE,cAAc,CAAA;IAC/C,8FAA8F;IA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;IAExB,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBAD7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAIvC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/lite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
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",
|
|
@@ -59,16 +59,16 @@
|
|
|
59
59
|
"@electric-sql/pglite-pgmq": "0.0.8",
|
|
60
60
|
"@electric-sql/pglite-pgvector": "0.0.11",
|
|
61
61
|
"@electric-sql/pglite-postgis": "0.2.10",
|
|
62
|
-
"@supacloud/db": "
|
|
62
|
+
"@supacloud/db": "0.18.1",
|
|
63
63
|
"exact-mirror": "1.2.6",
|
|
64
64
|
"tar": "^7.5.22",
|
|
65
65
|
"typebox": "1.3.37"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@supacloud/app": "
|
|
69
|
-
"@supacloud/contracts": "
|
|
70
|
-
"@supacloud/compiler": "
|
|
71
|
-
"@supacloud/elysia": "
|
|
68
|
+
"@supacloud/app": "0.27.2",
|
|
69
|
+
"@supacloud/contracts": "0.11.2",
|
|
70
|
+
"@supacloud/compiler": "0.46.7",
|
|
71
|
+
"@supacloud/elysia": "0.33.2",
|
|
72
72
|
"@supabase/supabase-js": "^2.117.3",
|
|
73
73
|
"@types/bun": "^1.4.3",
|
|
74
74
|
"effect": "4.0.5",
|
|
@@ -77,13 +77,13 @@
|
|
|
77
77
|
"typescript": "^7.0.2"
|
|
78
78
|
},
|
|
79
79
|
"overrides": {
|
|
80
|
-
"@supacloud/db": "
|
|
81
|
-
"@supacloud/app": "
|
|
82
|
-
"@supacloud/compiler": "
|
|
83
|
-
"@supacloud/elysia": "
|
|
84
|
-
"@supacloud/contracts": "
|
|
85
|
-
"@supacloud/commands": "
|
|
86
|
-
"@supacloud/delivery": "
|
|
80
|
+
"@supacloud/db": "0.18.1",
|
|
81
|
+
"@supacloud/app": "0.27.2",
|
|
82
|
+
"@supacloud/compiler": "0.46.7",
|
|
83
|
+
"@supacloud/elysia": "0.33.2",
|
|
84
|
+
"@supacloud/contracts": "0.11.2",
|
|
85
|
+
"@supacloud/commands": "0.9.4",
|
|
86
|
+
"@supacloud/delivery": "0.19.1",
|
|
87
87
|
"@graphql-tools/utils": "^12.0.4"
|
|
88
88
|
},
|
|
89
89
|
"engines": {
|