cloudflare-next-intl 0.9.63 → 0.10.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/README.md +15 -0
- package/dist/src/db/context.d.ts +1 -0
- package/dist/src/db/context.js +5 -1
- package/dist/src/db/index.d.ts +1 -1
- package/dist/src/db/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -807,6 +807,21 @@ export default setIntlConfig({
|
|
|
807
807
|
- `disconnectTimeoutMs` — **deprecated, ignored since 0.8.23.** Client
|
|
808
808
|
teardown is awaited or deferred to `ctx.waitUntil` without a timeout.
|
|
809
809
|
|
|
810
|
+
#### Service role (`withServiceDb`)
|
|
811
|
+
|
|
812
|
+
`withServiceDb` runs a query as the **service role** — it bypasses RLS
|
|
813
|
+
entirely (`db.supabase.serviceRoleKey` in Supabase mode; no role downgrade in
|
|
814
|
+
connection-string mode) and adds no auth wiring, since the service role isn't
|
|
815
|
+
a signed-in user. Use it only on trusted server-side paths a request/user
|
|
816
|
+
can't influence — admin actions, cron jobs, webhooks — never behind an
|
|
817
|
+
ordinary request handler:
|
|
818
|
+
|
|
819
|
+
```typescript
|
|
820
|
+
import { withServiceDb } from "cloudflare-next-intl/db";
|
|
821
|
+
|
|
822
|
+
const rows = await withServiceDb((db) => db.select().from(profiles));
|
|
823
|
+
```
|
|
824
|
+
|
|
810
825
|
#### Choosing a transport
|
|
811
826
|
|
|
812
827
|
`db` reaches Postgres one of two ways, decided by which fields you set. The
|
package/dist/src/db/context.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ import type { DbRoutingConfig, DrizzleDb, TransactionResult, UserDbCredentials }
|
|
|
2
2
|
export type { DrizzleDb, TransactionResult, UserDbCredentials };
|
|
3
3
|
export declare function withPublicDb<T>(fn: (db: DrizzleDb) => Promise<T>, dbOverride?: DbRoutingConfig): Promise<T>;
|
|
4
4
|
export declare function withUserDb<T>(fn: (db: DrizzleDb) => Promise<T>, auth?: string | null | UserDbCredentials, dbOverride?: DbRoutingConfig): Promise<T>;
|
|
5
|
+
export declare function withServiceDb<T>(fn: (db: DrizzleDb) => Promise<T>, dbOverride?: DbRoutingConfig): Promise<T>;
|
|
5
6
|
export declare function resolveUserDbCredentials(dbOverride?: DbRoutingConfig): Promise<UserDbCredentials>;
|
package/dist/src/db/context.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { withPublicDb as withPublicDbImpl, withUserDb as withUserDbImpl, resolveUserDbCredentials as resolveUserDbCredentialsImpl, } from 'cloudflare-next-intl-db';
|
|
1
|
+
import { withPublicDb as withPublicDbImpl, withUserDb as withUserDbImpl, withServiceDb as withServiceDbImpl, resolveUserDbCredentials as resolveUserDbCredentialsImpl, } from 'cloudflare-next-intl-db';
|
|
2
2
|
import resolveDbConfig from './resolve_db_config.js';
|
|
3
3
|
export async function withPublicDb(fn, dbOverride) {
|
|
4
4
|
const config = await resolveDbConfig(dbOverride);
|
|
@@ -8,6 +8,10 @@ export async function withUserDb(fn, auth, dbOverride) {
|
|
|
8
8
|
const config = await resolveDbConfig(dbOverride);
|
|
9
9
|
return withUserDbImpl(fn, auth, config);
|
|
10
10
|
}
|
|
11
|
+
export async function withServiceDb(fn, dbOverride) {
|
|
12
|
+
const config = await resolveDbConfig(dbOverride);
|
|
13
|
+
return withServiceDbImpl(fn, config);
|
|
14
|
+
}
|
|
11
15
|
export async function resolveUserDbCredentials(dbOverride) {
|
|
12
16
|
const config = await resolveDbConfig(dbOverride);
|
|
13
17
|
return resolveUserDbCredentialsImpl(config);
|
package/dist/src/db/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { withPublicDb, withUserDb, resolveUserDbCredentials } from './context.js';
|
|
1
|
+
export { withPublicDb, withUserDb, withServiceDb, resolveUserDbCredentials } from './context.js';
|
|
2
2
|
export type { UserDbCredentials } from './context.js';
|
|
3
3
|
export type { DrizzleDb, TransactionResult } from './context.js';
|
|
4
4
|
export { withDbClient, connectToPostgres, disconnectPostgres, resetConnectionState } from './connection.js';
|
package/dist/src/db/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { withPublicDb, withUserDb, resolveUserDbCredentials } from './context.js';
|
|
1
|
+
export { withPublicDb, withUserDb, withServiceDb, resolveUserDbCredentials } from './context.js';
|
|
2
2
|
export { withDbClient, connectToPostgres, disconnectPostgres, resetConnectionState } from './connection.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudflare-next-intl",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
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",
|
|
@@ -358,7 +358,7 @@
|
|
|
358
358
|
"homepage": "https://github.com/demian-ilnytskyi/cloudflare-next-intl#readme",
|
|
359
359
|
"dependencies": {
|
|
360
360
|
"@microsoft/clarity": "^1.0.2",
|
|
361
|
-
"cloudflare-next-intl-db": "^0.1.
|
|
361
|
+
"cloudflare-next-intl-db": "^0.1.1",
|
|
362
362
|
"jose": "^6.2.8",
|
|
363
363
|
"sharp": "^0.34.5 || ^0.35.0"
|
|
364
364
|
},
|