cloudflare-next-intl 0.9.10 → 0.9.11
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/README.md +5 -3
- package/dist/src/db/context.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -940,9 +940,11 @@ allowed to see the rows; call `.transaction(...)` on the handle either one
|
|
|
940
940
|
hands your callback when a write needs more than one statement to succeed or
|
|
941
941
|
fail together (see [Multi-statement transactions](#multi-statement-transactions-dbtransaction) above):
|
|
942
942
|
|
|
943
|
-
- `withPublicDb(fn, dbOverride?)` — runs `fn` as the
|
|
944
|
-
connection
|
|
945
|
-
|
|
943
|
+
- `withPublicDb(fn, dbOverride?)` — runs `fn` as the `anon` Postgres role.
|
|
944
|
+
In connection-string mode (Hyperdrive) the connection-string user is
|
|
945
|
+
temporarily downgraded to `anon` via `SET LOCAL ROLE anon` before your
|
|
946
|
+
callback executes, so RLS policies apply identically to the Supabase-mode
|
|
947
|
+
path (where the anon key is the PostgREST bearer token). No user id is
|
|
946
948
|
attached either way, so RLS policies that test `auth.jwt()->>'sub'` will
|
|
947
949
|
deny access — use `withUserDb` for user-owned rows.
|
|
948
950
|
- `withUserDb(fn, uid?, dbOverride?)` — runs `fn` as the signed-in user. In
|
package/dist/src/db/context.js
CHANGED
|
@@ -108,6 +108,7 @@ export async function withPublicDb(fn, dbOverride) {
|
|
|
108
108
|
return await withDbClient(config, async (client) => {
|
|
109
109
|
const { drizzle } = await import('drizzle-orm/node-postgres');
|
|
110
110
|
const drizzleHandle = drizzle(client);
|
|
111
|
+
await client.query(`set local role anon`);
|
|
111
112
|
return await fn(await postgresDb(drizzleHandle, client));
|
|
112
113
|
});
|
|
113
114
|
}
|