@saasicat/adapter-drizzle 0.5.0 → 0.6.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/dist/index.cjs CHANGED
@@ -129,7 +129,7 @@ var subscriptions = (0, import_pg_core.pgTable)("subscriptions", {
129
129
  pendingPlan: (0, import_pg_core.text)("pendingPlan"),
130
130
  pendingEffectiveAt: ts("pendingEffectiveAt"),
131
131
  customLimits: (0, import_pg_core.jsonb)("customLimits"),
132
- planVersionId: (0, import_pg_core.text)("planVersionId"),
132
+ planVersionId: (0, import_pg_core.text)("planVersionId").notNull(),
133
133
  pendingPlanVersionId: (0, import_pg_core.text)("pendingPlanVersionId"),
134
134
  isPilot: (0, import_pg_core.boolean)("isPilot").notNull().default(false),
135
135
  startedAt: ts("startedAt"),
@@ -1272,9 +1272,6 @@ var DrizzleSubscriptionRepository = class {
1272
1272
  return this.toRecord(db, row);
1273
1273
  }
1274
1274
  async toRecord(db, row) {
1275
- if (!row.planVersionId) {
1276
- throw new Error(`Subscription ${row.id} binds no planVersionId (businessType-only composition). The shipped @saasicat/adapter-drizzle SubscriptionRepository does not support BusinessType aggregation \u2014 provide a custom SubscriptionRepository adapter.`);
1277
- }
1278
1275
  const versionRows = await db.select().from(planVersions).where((0, import_drizzle_orm11.eq)(planVersions.id, row.planVersionId)).limit(1);
1279
1276
  const planVersion = versionRows[0];
1280
1277
  if (!planVersion) {
package/dist/index.d.cts CHANGED
@@ -228,7 +228,7 @@ declare const subscriptions: drizzle_orm_pg_core.PgTableWithColumns<{
228
228
  columnType: "PgText";
229
229
  data: string;
230
230
  driverParam: string;
231
- notNull: false;
231
+ notNull: true;
232
232
  hasDefault: false;
233
233
  isPrimaryKey: false;
234
234
  isAutoincrement: false;
@@ -2600,9 +2600,8 @@ declare class AsyncLocalRlsBypassAdapter implements RlsBypassPort {
2600
2600
 
2601
2601
  /**
2602
2602
  * `SubscriptionRepository` against the canonical `subscriptions` +
2603
- * `plan_versions` tables. Same limitations as the Prisma adapter:
2604
- * businessType-only subscriptions raise a descriptive error, and
2605
- * `countByBundleVersionId` is not implemented (fail-closed).
2603
+ * `plan_versions` tables. `countByBundleVersionId` is not implemented
2604
+ * (fail-closed).
2606
2605
  */
2607
2606
  declare class DrizzleSubscriptionRepository implements SubscriptionRepository {
2608
2607
  private readonly db;
package/dist/index.d.ts CHANGED
@@ -228,7 +228,7 @@ declare const subscriptions: drizzle_orm_pg_core.PgTableWithColumns<{
228
228
  columnType: "PgText";
229
229
  data: string;
230
230
  driverParam: string;
231
- notNull: false;
231
+ notNull: true;
232
232
  hasDefault: false;
233
233
  isPrimaryKey: false;
234
234
  isAutoincrement: false;
@@ -2600,9 +2600,8 @@ declare class AsyncLocalRlsBypassAdapter implements RlsBypassPort {
2600
2600
 
2601
2601
  /**
2602
2602
  * `SubscriptionRepository` against the canonical `subscriptions` +
2603
- * `plan_versions` tables. Same limitations as the Prisma adapter:
2604
- * businessType-only subscriptions raise a descriptive error, and
2605
- * `countByBundleVersionId` is not implemented (fail-closed).
2603
+ * `plan_versions` tables. `countByBundleVersionId` is not implemented
2604
+ * (fail-closed).
2606
2605
  */
2607
2606
  declare class DrizzleSubscriptionRepository implements SubscriptionRepository {
2608
2607
  private readonly db;
package/dist/index.js CHANGED
@@ -89,7 +89,7 @@ var subscriptions = pgTable("subscriptions", {
89
89
  pendingPlan: text("pendingPlan"),
90
90
  pendingEffectiveAt: ts("pendingEffectiveAt"),
91
91
  customLimits: jsonb("customLimits"),
92
- planVersionId: text("planVersionId"),
92
+ planVersionId: text("planVersionId").notNull(),
93
93
  pendingPlanVersionId: text("pendingPlanVersionId"),
94
94
  isPilot: boolean("isPilot").notNull().default(false),
95
95
  startedAt: ts("startedAt"),
@@ -1232,9 +1232,6 @@ var DrizzleSubscriptionRepository = class {
1232
1232
  return this.toRecord(db, row);
1233
1233
  }
1234
1234
  async toRecord(db, row) {
1235
- if (!row.planVersionId) {
1236
- throw new Error(`Subscription ${row.id} binds no planVersionId (businessType-only composition). The shipped @saasicat/adapter-drizzle SubscriptionRepository does not support BusinessType aggregation \u2014 provide a custom SubscriptionRepository adapter.`);
1237
- }
1238
1235
  const versionRows = await db.select().from(planVersions).where(eq10(planVersions.id, row.planVersionId)).limit(1);
1239
1236
  const planVersion = versionRows[0];
1240
1237
  if (!planVersion) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasicat/adapter-drizzle",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Drizzle + PostgreSQL persistence adapter for SaaSicat: drizzlePersistence() bundle plus the individual adapters (MFA, audit, RLS bypass, transaction runner, subscription/plan-version/promo repositories, SuperAdmin bootstrap, plan-catalog sinks). Targets the canonical schema from @saasicat/spec and passes the same executable persistence contract as @saasicat/adapter-prisma.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -22,7 +22,7 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@saasicat/types": "^0.5.0"
25
+ "@saasicat/types": "^0.6.0"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@nestjs/common": "^11.0.0",
@@ -36,8 +36,8 @@
36
36
  "pg": "^8.22.0",
37
37
  "tsup": "^8.0.0",
38
38
  "typescript": "^6.0.0",
39
- "@saasicat/persistence-testing": "^0.5.0",
40
- "@saasicat/spec": "^0.5.0"
39
+ "@saasicat/persistence-testing": "^0.6.0",
40
+ "@saasicat/spec": "^0.6.0"
41
41
  },
42
42
  "license": "Apache-2.0",
43
43
  "author": "Taci Uelker",