@usebetterdev/tenant 0.5.0-beta.1 → 0.5.1
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 +3 -1
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ npx @usebetterdev/tenant-cli migrate -o ./migrations
|
|
|
39
39
|
psql $DATABASE_URL -f ./migrations/*_better_tenant.sql
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
This creates the `tenants` table, RLS policies
|
|
42
|
+
This creates RLS policies for the `tenants` lookup table (open SELECT, writes require `bypass_rls`) and adds RLS policies and triggers for each tenant-scoped table listed in `tenantTables`.
|
|
43
43
|
|
|
44
44
|
### 3. Verify setup
|
|
45
45
|
|
|
@@ -261,6 +261,8 @@ await tenant.runAsSystem(async (db) => {
|
|
|
261
261
|
4. Your handler runs — every query is automatically filtered to the current tenant
|
|
262
262
|
5. Transaction commits, `SET LOCAL` auto-clears (safe for connection pooling)
|
|
263
263
|
|
|
264
|
+
The `tenants` table has its own RLS policies: SELECT is open (needed for tenant resolution and listing), while INSERT/UPDATE/DELETE require `bypass_rls` (set by `runAsSystem`). See [Under the Hood](../docs/UNDER-THE-HOOD.md) for details.
|
|
265
|
+
|
|
264
266
|
## Telemetry
|
|
265
267
|
|
|
266
268
|
Anonymous telemetry is on by default. Opt out with `BETTER_TENANT_TELEMETRY=0` or `telemetry: { enabled: false }` in config.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usebetterdev/tenant",
|
|
3
3
|
"description": "Multi-tenancy for Postgres in minutes. RLS-based tenant isolation, framework adapters (Hono, Express, Next.js), Drizzle and Prisma ORM support.",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.1",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"multi-tenancy",
|
|
7
7
|
"postgres",
|
|
@@ -67,12 +67,12 @@
|
|
|
67
67
|
"README.md"
|
|
68
68
|
],
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@usebetterdev/tenant-
|
|
71
|
-
"@usebetterdev/tenant-
|
|
72
|
-
"@usebetterdev/tenant-express": "0.5.
|
|
73
|
-
"@usebetterdev/tenant-
|
|
74
|
-
"@usebetterdev/tenant-
|
|
75
|
-
"@usebetterdev/tenant-prisma": "0.5.
|
|
70
|
+
"@usebetterdev/tenant-core": "0.5.1",
|
|
71
|
+
"@usebetterdev/tenant-drizzle": "0.5.1",
|
|
72
|
+
"@usebetterdev/tenant-express": "0.5.1",
|
|
73
|
+
"@usebetterdev/tenant-next": "0.5.1",
|
|
74
|
+
"@usebetterdev/tenant-hono": "0.5.1",
|
|
75
|
+
"@usebetterdev/tenant-prisma": "0.5.1"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"tsup": "^8.3.5",
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
},
|
|
85
85
|
"scripts": {
|
|
86
86
|
"build": "tsup",
|
|
87
|
+
"build:types": "tsc --build tsconfig.build.json",
|
|
87
88
|
"lint": "oxlint",
|
|
88
89
|
"test": "vitest run",
|
|
89
90
|
"typecheck": "tsc --noEmit"
|