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 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 anonymous role: a pooled
944
- connection with no transaction/role switch in connection-string mode, or the
945
- anon key as the PostgREST bearer token in Supabase mode. No user id is
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
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudflare-next-intl",
3
- "version": "0.9.10",
3
+ "version": "0.9.11",
4
4
  "description": "Optimized Next Intl Package Special for App Router and Cloudflare",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",