@saasicat/adapter-prisma 1.0.0-rc.2 → 1.0.0-rc.20

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
@@ -1,5 +1,7 @@
1
1
  # @saasicat/adapter-prisma
2
2
 
3
+ ## What this is
4
+
3
5
  The Prisma + PostgreSQL persistence adapter for SaaSiCat. Targets the
4
6
  canonical schema from `@saasicat/spec` (`prisma-fragments/` +
5
7
  `sql/constraints.postgres.sql`) and passes the executable persistence
@@ -9,6 +11,16 @@ transaction rollback and atomic promo claims are verified, not asserted.
9
11
  > Renamed from `@saasicat/prisma` (deprecated). Same ports, superset of the
10
12
  > old exports.
11
13
 
14
+ ## What this is not
15
+
16
+ Not a Prisma schema. It targets the canonical tables from `@saasicat/spec`;
17
+ `saasicat schema apply` puts them into your `schema.prisma`, and Prisma
18
+ migrates them. This package reads and writes them.
19
+
20
+ Not a place for domain rules. An adapter translates a port to a store — which
21
+ rows, which order, which lock — and every decision above that lives in
22
+ `@saasicat/nest`, so the two adapters stay interchangeable.
23
+
12
24
  ## Quickstart — the bundle
13
25
 
14
26
  ```ts
@@ -41,10 +53,10 @@ Options:
41
53
  for schemas that differ from the 0.6 canonical layout.
42
54
 
43
55
  The bundle also ships `planCatalogReadSink` for DB hydration. To use it,
44
- omit `planCatalog` and pass the identity the database cannot provide:
45
- `SaaSiCatModule.forRoot({ persistence, dbCatalog: { projectKey,
46
- currency, vatRate } })` — without `dbCatalog` the module refuses to boot
47
- (the sink would otherwise load an empty catalog for project key `''`).
56
+ omit `planCatalog` and name the file the settings come from:
57
+ `SaaSiCatModule.forRoot({ persistence, dbCatalog: { path: 'config/saas.yaml' } })`
58
+ — without `dbCatalog` the module refuses to boot, because branding, currency,
59
+ VAT and the commercial settings cannot come from the database.
48
60
 
49
61
  Slices the mega module does not wire (promo) spread into the domain module:
50
62
 
@@ -85,6 +97,7 @@ PromoCodesModule.forRoot({
85
97
  | `PrismaMarketingSettingsRepository` | `MarketingSettingsRepository` | `marketing_settings` |
86
98
  | `PrismaPromotionRepository` | `PromotionRepository` | `promotions` |
87
99
  | `PrismaSubscriptionContractRepository` | `SubscriptionContractRepository` | `subscription_contracts`, `contract_line_items` |
100
+ | `PrismaAppliedSettingsRepository` | `AppliedSettingsPort` | `applied_settings`, `settings_changes` |
88
101
 
89
102
  Not shipped (custom adapters stay yours): registration persistence,
90
103
  consumer-specific payment/invoice integrations, and `FirstTimeCustomerCheck`.
@@ -131,10 +144,7 @@ outputs still use the semantic key:
131
144
 
132
145
  ```ts
133
146
  const schema = {
134
- planBinding: {
135
- mode: 'normalized-plan-id',
136
- projectKey: 'my-app',
137
- },
147
+ planBinding: { mode: 'normalized-plan-id' },
138
148
  planVersionFields: {
139
149
  validityWindows: true,
140
150
  endsAt: true,
@@ -260,3 +270,10 @@ generates a client from the composed fragments and executes the
260
270
  `@saasicat/persistence-testing` contract — CI does the same against a
261
271
  postgres service. **The database is disposable: the harness drops and
262
272
  recreates its `public` schema.**
273
+
274
+ ## Next
275
+
276
+ - [Quickstart](../../docs/quickstart.md) — from an existing backend to an enforced feature
277
+ - [Data model](../../docs/explanation/data-model.md) — the canonical tables, and who owns which
278
+ - [Ports and adapters](../../docs/explanation/adr/0007-ports-and-adapters.md) — why an adapter never
279
+ decides
package/dist/.build-stamp CHANGED
@@ -1 +1 @@
1
- 179dbac7b9329674978a2e97b612b3514fe39b12c1bf83f6ed41a2cafc2f65bd
1
+ a8ca1e45f5b6b53037503d71af99807b4182cce18d42b446d97a8a2b02849c87