@saasicat/adapter-drizzle 1.0.0-rc.22 → 1.0.0-rc.24
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 +25 -6
- package/dist/.build-stamp +1 -1
- package/dist/index.cjs +1188 -827
- package/dist/index.d.cts +764 -283
- package/dist/index.d.ts +764 -283
- package/dist/index.js +1131 -774
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -25,6 +25,7 @@ Drizzle schema declares them. It does not create or migrate anything.
|
|
|
25
25
|
import { Pool } from 'pg';
|
|
26
26
|
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
27
27
|
import { drizzlePersistence } from '@saasicat/adapter-drizzle';
|
|
28
|
+
import { aesGcmSecretSealer } from '@saasicat/nest/platform';
|
|
28
29
|
|
|
29
30
|
const db = drizzle(new Pool({ connectionString: process.env.DATABASE_URL }));
|
|
30
31
|
|
|
@@ -33,6 +34,8 @@ SaaSiCatModule.forRoot({
|
|
|
33
34
|
controller: { guards: [JwtAuthGuard] },
|
|
34
35
|
imports: [AuthModule],
|
|
35
36
|
persistence: drizzlePersistence({ db }),
|
|
37
|
+
// Not the bundle's to supply: the key that seals the SuperAdmin's second factor.
|
|
38
|
+
adapters: { secretSealer: aesGcmSecretSealer(process.env.SECRET_SEALER_KEY) },
|
|
36
39
|
entitlement: {},
|
|
37
40
|
});
|
|
38
41
|
```
|
|
@@ -40,9 +43,24 @@ SaaSiCatModule.forRoot({
|
|
|
40
43
|
`drizzlePersistence({ db })` accepts a ready Drizzle database (any pg
|
|
41
44
|
driver — node-postgres, postgres.js) or an injection token, and returns the
|
|
42
45
|
same `SaaSiCatPersistenceAdapter` bundle shape as `prismaPersistence()`.
|
|
43
|
-
Options: `passwordHasher` (enables `core.superAdminProvisioning`)
|
|
44
|
-
`rlsIntegration` (declares the `rowLevelSecurity` capability
|
|
45
|
-
|
|
46
|
+
Options: `passwordHasher` (enables `core.superAdminProvisioning`),
|
|
47
|
+
`rlsIntegration` (declares the `rowLevelSecurity` capability — this bundle
|
|
48
|
+
does not lift a row policy itself, unlike the Prisma one; with row policies,
|
|
49
|
+
bind an `RlsBypassPort` of your own in `adapters` that sets the setting your
|
|
50
|
+
policies read inside one transaction), `notAdopted` (the canonical models your schema
|
|
51
|
+
leaves out, as `saasicat schema check` prints them; the bundle leaves out what
|
|
52
|
+
needs them) and `transactions`.
|
|
53
|
+
|
|
54
|
+
`transactions: { maxConcurrent }` bounds how many of the platform's
|
|
55
|
+
transactions are open at once; the rest wait in arrival order before they
|
|
56
|
+
open. Set it below your pool's `max` — the pool size minus five is a sound
|
|
57
|
+
start — so that the reads a transaction waits on can still get a
|
|
58
|
+
connection. Why, and what is counted, is the same as for
|
|
59
|
+
[`@saasicat/adapter-prisma`](../adapter-prisma/README.md#transactions-under-load).
|
|
60
|
+
How long a transaction or a connection wait may take is the pool's own
|
|
61
|
+
setting (`connectionTimeoutMillis`, `statement_timeout`); the wait for a place
|
|
62
|
+
has none. Every runner on one database handle shares the bound; wired by hand,
|
|
63
|
+
provide the options as `DRIZZLE_TRANSACTION_OPTIONS_TOKEN`.
|
|
46
64
|
|
|
47
65
|
## Schema
|
|
48
66
|
|
|
@@ -79,9 +97,10 @@ atomic `claimSlot`/`releaseSlot`/`markExhaustedIfFull` and the slots held for
|
|
|
79
97
|
checkouts, audit
|
|
80
98
|
write/query/stats, MFA, RLS bypass, SuperAdmin bootstrap
|
|
81
99
|
(`PASSWORD_HASHER_TOKEN`), plan-catalog read/import sinks, the record of the
|
|
82
|
-
applied settings,
|
|
83
|
-
|
|
84
|
-
`FirstTimeCustomerCheck` — same as the
|
|
100
|
+
applied settings, the maintenance windows, the record of what each subscriber
|
|
101
|
+
was told, and the `ZeroPromoRevenueDeductionAggregator` default.
|
|
102
|
+
Not shipped: registration persistence and `FirstTimeCustomerCheck` — same as the
|
|
103
|
+
Prisma adapter.
|
|
85
104
|
|
|
86
105
|
Manual wiring binds the db via `DRIZZLE_DB_TOKEN`.
|
|
87
106
|
|
package/dist/.build-stamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
7afee47e5b9050bf7f38beec6f0dac14ddb3fe43cbac6c28d15d7619dc94419a
|