@saasicat/adapter-drizzle 1.0.0-rc.21 → 1.0.0-rc.22
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/.build-stamp +1 -1
- package/dist/index.cjs +324 -247
- package/dist/index.d.cts +298 -22
- package/dist/index.d.ts +298 -22
- package/dist/index.js +309 -233
- package/package.json +6 -5
- package/sql/1.0-a-redemption-is-redeemed-in-utc.postgres.sql +63 -0
package/dist/index.cjs
CHANGED
|
@@ -39,6 +39,7 @@ __export(index_exports, {
|
|
|
39
39
|
DrizzlePromoCodeRepository: () => DrizzlePromoCodeRepository,
|
|
40
40
|
DrizzlePromoCodeValidationLogRepository: () => DrizzlePromoCodeValidationLogRepository,
|
|
41
41
|
DrizzlePromoSubscriptionLookup: () => DrizzlePromoSubscriptionLookup,
|
|
42
|
+
DrizzleSubscriberLedgerRepository: () => DrizzleSubscriberLedgerRepository,
|
|
42
43
|
DrizzleSubscriberPaymentMethodRepository: () => DrizzleSubscriberPaymentMethodRepository,
|
|
43
44
|
DrizzleSubscriberRepository: () => DrizzleSubscriberRepository,
|
|
44
45
|
DrizzleSubscriptionBundleRepository: () => DrizzleSubscriptionBundleRepository,
|
|
@@ -128,6 +129,7 @@ __export(schema_exports, {
|
|
|
128
129
|
promoCodes: () => promoCodes,
|
|
129
130
|
settingsChanges: () => settingsChanges,
|
|
130
131
|
subscriberCorrections: () => subscriberCorrections,
|
|
132
|
+
subscriberLedgerEntries: () => subscriberLedgerEntries,
|
|
131
133
|
subscriberPaymentMethodSetups: () => subscriberPaymentMethodSetups,
|
|
132
134
|
subscriberPaymentMethods: () => subscriberPaymentMethods,
|
|
133
135
|
subscriberTenants: () => subscriberTenants,
|
|
@@ -143,6 +145,7 @@ var ts = /* @__PURE__ */ __name((name) => (0, import_pg_core.timestamp)(name, {
|
|
|
143
145
|
precision: 3,
|
|
144
146
|
mode: "date"
|
|
145
147
|
}), "ts");
|
|
148
|
+
var writtenAt = /* @__PURE__ */ __name((name) => ts(name).notNull().$defaultFn(() => /* @__PURE__ */ new Date()), "writtenAt");
|
|
146
149
|
var subscriptions = (0, import_pg_core.pgTable)("subscriptions", {
|
|
147
150
|
id: (0, import_pg_core.text)("id").primaryKey(),
|
|
148
151
|
tenantId: (0, import_pg_core.text)("tenantId").notNull(),
|
|
@@ -193,7 +196,7 @@ var subscriptions = (0, import_pg_core.pgTable)("subscriptions", {
|
|
|
193
196
|
pilotNote: (0, import_pg_core.text)("pilotNote"),
|
|
194
197
|
checkoutOfferId: (0, import_pg_core.text)("checkoutOfferId"),
|
|
195
198
|
packageSnapshot: (0, import_pg_core.jsonb)("packageSnapshot"),
|
|
196
|
-
createdAt:
|
|
199
|
+
createdAt: writtenAt("createdAt"),
|
|
197
200
|
updatedAt: ts("updatedAt").notNull()
|
|
198
201
|
});
|
|
199
202
|
var planVersions = (0, import_pg_core.pgTable)("plan_versions", {
|
|
@@ -225,7 +228,7 @@ var planVersions = (0, import_pg_core.pgTable)("plan_versions", {
|
|
|
225
228
|
endsAt: ts("endsAt"),
|
|
226
229
|
createdByUserId: (0, import_pg_core.text)("createdByUserId"),
|
|
227
230
|
publishedByUserId: (0, import_pg_core.text)("publishedByUserId"),
|
|
228
|
-
createdAt:
|
|
231
|
+
createdAt: writtenAt("createdAt"),
|
|
229
232
|
updatedAt: ts("updatedAt").notNull()
|
|
230
233
|
});
|
|
231
234
|
var plans = (0, import_pg_core.pgTable)("plans", {
|
|
@@ -235,7 +238,7 @@ var plans = (0, import_pg_core.pgTable)("plans", {
|
|
|
235
238
|
description: (0, import_pg_core.text)("description"),
|
|
236
239
|
icon: (0, import_pg_core.text)("icon"),
|
|
237
240
|
sortOrder: (0, import_pg_core.integer)("sortOrder").notNull().default(0),
|
|
238
|
-
createdAt:
|
|
241
|
+
createdAt: writtenAt("createdAt"),
|
|
239
242
|
updatedAt: ts("updatedAt").notNull(),
|
|
240
243
|
deletedAt: ts("deletedAt")
|
|
241
244
|
});
|
|
@@ -260,7 +263,7 @@ var subscriptionContracts = (0, import_pg_core.pgTable)("subscription_contracts"
|
|
|
260
263
|
subscriberSnapshot: (0, import_pg_core.jsonb)("subscriberSnapshot").notNull(),
|
|
261
264
|
issuerSnapshot: (0, import_pg_core.jsonb)("issuerSnapshot"),
|
|
262
265
|
partiesMigrated: (0, import_pg_core.boolean)("partiesMigrated").notNull().default(false),
|
|
263
|
-
createdAt:
|
|
266
|
+
createdAt: writtenAt("createdAt"),
|
|
264
267
|
updatedAt: ts("updatedAt").notNull()
|
|
265
268
|
});
|
|
266
269
|
var contractLineItems = (0, import_pg_core.pgTable)("contract_line_items", {
|
|
@@ -295,7 +298,7 @@ var contractLineItems = (0, import_pg_core.pgTable)("contract_line_items", {
|
|
|
295
298
|
featuresSnapshot: (0, import_pg_core.jsonb)("featuresSnapshot").notNull(),
|
|
296
299
|
quotaEffectsSnapshot: (0, import_pg_core.jsonb)("quotaEffectsSnapshot").notNull(),
|
|
297
300
|
metadata: (0, import_pg_core.jsonb)("metadata"),
|
|
298
|
-
createdAt:
|
|
301
|
+
createdAt: writtenAt("createdAt")
|
|
299
302
|
});
|
|
300
303
|
var featureCatalogEntries = (0, import_pg_core.pgTable)("feature_catalog_entries", {
|
|
301
304
|
id: (0, import_pg_core.text)("id").primaryKey(),
|
|
@@ -317,7 +320,7 @@ var featureCatalogEntries = (0, import_pg_core.pgTable)("feature_catalog_entries
|
|
|
317
320
|
plannedOnly: (0, import_pg_core.boolean)("plannedOnly").notNull().default(false),
|
|
318
321
|
i18n: (0, import_pg_core.jsonb)("i18n").notNull().default({}),
|
|
319
322
|
sortOrder: (0, import_pg_core.integer)("sortOrder").notNull().default(0),
|
|
320
|
-
createdAt:
|
|
323
|
+
createdAt: writtenAt("createdAt"),
|
|
321
324
|
updatedAt: ts("updatedAt").notNull(),
|
|
322
325
|
deletedAt: ts("deletedAt")
|
|
323
326
|
});
|
|
@@ -349,7 +352,7 @@ var promoCodes = (0, import_pg_core.pgTable)("promo_codes", {
|
|
|
349
352
|
campaignTag: (0, import_pg_core.text)("campaignTag"),
|
|
350
353
|
revenueDeductionAccount: (0, import_pg_core.text)("revenueDeductionAccount"),
|
|
351
354
|
createdById: (0, import_pg_core.text)("createdById").notNull(),
|
|
352
|
-
createdAt:
|
|
355
|
+
createdAt: writtenAt("createdAt"),
|
|
353
356
|
updatedAt: ts("updatedAt").notNull(),
|
|
354
357
|
deletedAt: ts("deletedAt")
|
|
355
358
|
});
|
|
@@ -368,7 +371,7 @@ var promoCodeRedemptions = (0, import_pg_core.pgTable)("promo_code_redemptions",
|
|
|
368
371
|
startsAt: ts("startsAt").notNull(),
|
|
369
372
|
endsAt: ts("endsAt"),
|
|
370
373
|
status: (0, import_pg_core.text)("status").notNull().default("ACTIVE"),
|
|
371
|
-
redeemedAt:
|
|
374
|
+
redeemedAt: writtenAt("redeemedAt"),
|
|
372
375
|
reversedAt: ts("reversedAt")
|
|
373
376
|
});
|
|
374
377
|
var promoCodeHolds = (0, import_pg_core.pgTable)("promo_code_holds", {
|
|
@@ -379,7 +382,7 @@ var promoCodeHolds = (0, import_pg_core.pgTable)("promo_code_holds", {
|
|
|
379
382
|
handedOverTx: (0, import_pg_core.bigint)("handedOverTx", {
|
|
380
383
|
mode: "bigint"
|
|
381
384
|
}),
|
|
382
|
-
createdAt:
|
|
385
|
+
createdAt: writtenAt("createdAt")
|
|
383
386
|
});
|
|
384
387
|
var promoCodeValidationLogs = (0, import_pg_core.pgTable)("promo_code_validation_logs", {
|
|
385
388
|
id: (0, import_pg_core.text)("id").primaryKey(),
|
|
@@ -388,7 +391,7 @@ var promoCodeValidationLogs = (0, import_pg_core.pgTable)("promo_code_validation
|
|
|
388
391
|
ipHash: (0, import_pg_core.text)("ipHash"),
|
|
389
392
|
sessionId: (0, import_pg_core.text)("sessionId"),
|
|
390
393
|
result: (0, import_pg_core.text)("result").notNull(),
|
|
391
|
-
createdAt:
|
|
394
|
+
createdAt: writtenAt("createdAt")
|
|
392
395
|
});
|
|
393
396
|
var auditLogs = (0, import_pg_core.pgTable)("audit_logs", {
|
|
394
397
|
id: (0, import_pg_core.text)("id").primaryKey(),
|
|
@@ -401,7 +404,7 @@ var auditLogs = (0, import_pg_core.pgTable)("audit_logs", {
|
|
|
401
404
|
actorTag: (0, import_pg_core.text)("actorTag"),
|
|
402
405
|
ipAddress: (0, import_pg_core.text)("ipAddress"),
|
|
403
406
|
userAgent: (0, import_pg_core.text)("userAgent"),
|
|
404
|
-
createdAt:
|
|
407
|
+
createdAt: writtenAt("createdAt")
|
|
405
408
|
});
|
|
406
409
|
var superAdminUsers = (0, import_pg_core.pgTable)("super_admin_users", {
|
|
407
410
|
id: (0, import_pg_core.text)("id").primaryKey(),
|
|
@@ -413,7 +416,7 @@ var superAdminUsers = (0, import_pg_core.pgTable)("super_admin_users", {
|
|
|
413
416
|
isActive: (0, import_pg_core.boolean)("isActive").notNull().default(true),
|
|
414
417
|
lastLoginAt: ts("lastLoginAt"),
|
|
415
418
|
deletedAt: ts("deletedAt"),
|
|
416
|
-
createdAt:
|
|
419
|
+
createdAt: writtenAt("createdAt"),
|
|
417
420
|
updatedAt: ts("updatedAt").notNull()
|
|
418
421
|
});
|
|
419
422
|
var superAdminMfa = (0, import_pg_core.pgTable)("super_admin_mfa", {
|
|
@@ -430,7 +433,7 @@ var bundles = (0, import_pg_core.pgTable)("bundles", {
|
|
|
430
433
|
icon: (0, import_pg_core.text)("icon"),
|
|
431
434
|
sortOrder: (0, import_pg_core.integer)("sortOrder").notNull().default(0),
|
|
432
435
|
i18n: (0, import_pg_core.jsonb)("i18n").notNull(),
|
|
433
|
-
createdAt:
|
|
436
|
+
createdAt: writtenAt("createdAt"),
|
|
434
437
|
updatedAt: ts("updatedAt").notNull(),
|
|
435
438
|
deletedAt: ts("deletedAt")
|
|
436
439
|
});
|
|
@@ -463,7 +466,7 @@ var bundleVersions = (0, import_pg_core.pgTable)("bundle_versions", {
|
|
|
463
466
|
validUntil: ts("validUntil"),
|
|
464
467
|
createdByUserId: (0, import_pg_core.text)("createdByUserId"),
|
|
465
468
|
publishedByUserId: (0, import_pg_core.text)("publishedByUserId"),
|
|
466
|
-
createdAt:
|
|
469
|
+
createdAt: writtenAt("createdAt"),
|
|
467
470
|
updatedAt: ts("updatedAt").notNull()
|
|
468
471
|
});
|
|
469
472
|
var subscriptionBundles = (0, import_pg_core.pgTable)("subscription_bundles", {
|
|
@@ -481,7 +484,7 @@ var subscriptionBundles = (0, import_pg_core.pgTable)("subscription_bundles", {
|
|
|
481
484
|
currentPeriodEnd: ts("currentPeriodEnd"),
|
|
482
485
|
canceledAt: ts("canceledAt"),
|
|
483
486
|
canceledEffectiveAt: ts("canceledEffectiveAt"),
|
|
484
|
-
createdAt:
|
|
487
|
+
createdAt: writtenAt("createdAt"),
|
|
485
488
|
updatedAt: ts("updatedAt").notNull()
|
|
486
489
|
});
|
|
487
490
|
var appliedSettings = (0, import_pg_core.pgTable)("applied_settings", {
|
|
@@ -519,14 +522,14 @@ var subscribers = (0, import_pg_core.pgTable)("subscribers", {
|
|
|
519
522
|
country: (0, import_pg_core.text)("country"),
|
|
520
523
|
invoiceEmail: (0, import_pg_core.text)("invoiceEmail"),
|
|
521
524
|
migrated: (0, import_pg_core.boolean)("migrated").notNull().default(false),
|
|
522
|
-
createdAt:
|
|
525
|
+
createdAt: writtenAt("createdAt"),
|
|
523
526
|
updatedAt: ts("updatedAt").notNull()
|
|
524
527
|
});
|
|
525
528
|
var subscriberTenants = (0, import_pg_core.pgTable)("subscriber_tenants", {
|
|
526
529
|
id: (0, import_pg_core.text)("id").primaryKey(),
|
|
527
530
|
subscriberId: (0, import_pg_core.text)("subscriberId").notNull(),
|
|
528
531
|
tenantId: (0, import_pg_core.text)("tenantId").notNull(),
|
|
529
|
-
linkedAt:
|
|
532
|
+
linkedAt: writtenAt("linkedAt"),
|
|
530
533
|
unlinkedAt: ts("unlinkedAt")
|
|
531
534
|
});
|
|
532
535
|
var subscriberCorrections = (0, import_pg_core.pgTable)("subscriber_corrections", {
|
|
@@ -544,7 +547,7 @@ var subscriberPaymentMethodSetups = (0, import_pg_core.pgTable)("subscriber_paym
|
|
|
544
547
|
gatewayAccount: (0, import_pg_core.text)("gatewayAccount").notNull(),
|
|
545
548
|
sessionRef: (0, import_pg_core.text)("sessionRef").notNull(),
|
|
546
549
|
customerRef: (0, import_pg_core.text)("customerRef").notNull(),
|
|
547
|
-
startedAt:
|
|
550
|
+
startedAt: writtenAt("startedAt"),
|
|
548
551
|
completedAt: ts("completedAt")
|
|
549
552
|
});
|
|
550
553
|
var paymentEventLog = (0, import_pg_core.pgTable)("PaymentEventLog", {
|
|
@@ -555,7 +558,27 @@ var paymentEventLog = (0, import_pg_core.pgTable)("PaymentEventLog", {
|
|
|
555
558
|
sessionId: (0, import_pg_core.text)("sessionId"),
|
|
556
559
|
status: (0, import_pg_core.text)("status").notNull(),
|
|
557
560
|
payload: (0, import_pg_core.jsonb)("payload"),
|
|
558
|
-
processedAt:
|
|
561
|
+
processedAt: writtenAt("processedAt")
|
|
562
|
+
});
|
|
563
|
+
var subscriberLedgerEntries = (0, import_pg_core.pgTable)("subscriber_ledger_entries", {
|
|
564
|
+
id: (0, import_pg_core.text)("id").primaryKey(),
|
|
565
|
+
subscriberId: (0, import_pg_core.text)("subscriberId").notNull(),
|
|
566
|
+
tenantId: (0, import_pg_core.text)("tenantId").notNull(),
|
|
567
|
+
subscriptionId: (0, import_pg_core.text)("subscriptionId").notNull(),
|
|
568
|
+
contractId: (0, import_pg_core.text)("contractId").notNull(),
|
|
569
|
+
contractLineItemId: (0, import_pg_core.text)("contractLineItemId").notNull(),
|
|
570
|
+
origin: (0, import_pg_core.text)("origin").notNull(),
|
|
571
|
+
source: (0, import_pg_core.text)("source").notNull(),
|
|
572
|
+
sourceRef: (0, import_pg_core.text)("sourceRef").notNull(),
|
|
573
|
+
periodStart: ts("periodStart").notNull(),
|
|
574
|
+
periodEnd: ts("periodEnd").notNull(),
|
|
575
|
+
currency: (0, import_pg_core.text)("currency").notNull(),
|
|
576
|
+
amountNet: (0, import_pg_core.numeric)("amountNet", {
|
|
577
|
+
precision: 10,
|
|
578
|
+
scale: 2
|
|
579
|
+
}).notNull(),
|
|
580
|
+
bookedAt: ts("bookedAt").notNull(),
|
|
581
|
+
createdAt: writtenAt("createdAt")
|
|
559
582
|
});
|
|
560
583
|
var subscriberPaymentMethods = (0, import_pg_core.pgTable)("subscriber_payment_methods", {
|
|
561
584
|
id: (0, import_pg_core.text)("id").primaryKey(),
|
|
@@ -575,7 +598,7 @@ var subscriberPaymentMethods = (0, import_pg_core.pgTable)("subscriber_payment_m
|
|
|
575
598
|
status: (0, import_pg_core.text)("status").notNull().default("ACTIVE"),
|
|
576
599
|
confirmedAt: ts("confirmedAt").notNull(),
|
|
577
600
|
replacedAt: ts("replacedAt"),
|
|
578
|
-
createdAt:
|
|
601
|
+
createdAt: writtenAt("createdAt")
|
|
579
602
|
});
|
|
580
603
|
|
|
581
604
|
// src/drizzle-applied-settings.repository.ts
|
|
@@ -2119,8 +2142,10 @@ var DrizzlePlanRepository = class {
|
|
|
2119
2142
|
(0, import_drizzle_orm13.isNull)(planVersions.supersededAt),
|
|
2120
2143
|
// A version the operator terminated is not live, whatever
|
|
2121
2144
|
// its supersession says: `terminate` sets `endsAt` without
|
|
2122
|
-
// a successor to supersede it.
|
|
2123
|
-
|
|
2145
|
+
// a successor to supersede it. Compared with the
|
|
2146
|
+
// application's clock, which wrote it: the database's
|
|
2147
|
+
// `NOW()` reads the column in the session's zone.
|
|
2148
|
+
(0, import_drizzle_orm13.or)((0, import_drizzle_orm13.isNull)(planVersions.endsAt), (0, import_drizzle_orm13.gt)(planVersions.endsAt, /* @__PURE__ */ new Date()))
|
|
2124
2149
|
)).orderBy((0, import_drizzle_orm13.desc)(planVersions.version)).limit(1);
|
|
2125
2150
|
return rows[0] ? this.versionRow(rows[0]) : null;
|
|
2126
2151
|
}
|
|
@@ -2135,7 +2160,7 @@ var DrizzlePlanRepository = class {
|
|
|
2135
2160
|
* `@saasicat/core` so the two halves cannot drift apart.
|
|
2136
2161
|
*/
|
|
2137
2162
|
async activeVersionAt(planKey, asOf, tx) {
|
|
2138
|
-
const rows = await resolveDb(this.db, tx).select().from(planVersions).where((0, import_drizzle_orm13.and)((0, import_drizzle_orm13.eq)(planVersions.planId, planKey), import_drizzle_orm13.sql`${planVersions.publishedAt} IS NOT NULL`, (0, import_drizzle_orm13.or)((0, import_drizzle_orm13.isNull)(planVersions.validFrom), (0, import_drizzle_orm13.lte)(planVersions.validFrom, asOf)), (0, import_drizzle_orm13.or)((0, import_drizzle_orm13.isNull)(planVersions.validUntil), (0, import_drizzle_orm13.gte)(planVersions.validUntil, (0, import_core4.startOfUtcDay)(asOf))), (0, import_drizzle_orm13.or)((0, import_drizzle_orm13.isNull)(planVersions.endsAt), import_drizzle_orm13.
|
|
2163
|
+
const rows = await resolveDb(this.db, tx).select().from(planVersions).where((0, import_drizzle_orm13.and)((0, import_drizzle_orm13.eq)(planVersions.planId, planKey), import_drizzle_orm13.sql`${planVersions.publishedAt} IS NOT NULL`, (0, import_drizzle_orm13.or)((0, import_drizzle_orm13.isNull)(planVersions.validFrom), (0, import_drizzle_orm13.lte)(planVersions.validFrom, asOf)), (0, import_drizzle_orm13.or)((0, import_drizzle_orm13.isNull)(planVersions.validUntil), (0, import_drizzle_orm13.gte)(planVersions.validUntil, (0, import_core4.startOfUtcDay)(asOf))), (0, import_drizzle_orm13.or)((0, import_drizzle_orm13.isNull)(planVersions.endsAt), (0, import_drizzle_orm13.gt)(planVersions.endsAt, asOf)))).orderBy(import_drizzle_orm13.sql`"validFrom" DESC NULLS LAST`, (0, import_drizzle_orm13.desc)(planVersions.version)).limit(1);
|
|
2139
2164
|
return rows[0] ? this.versionRow(rows[0]) : null;
|
|
2140
2165
|
}
|
|
2141
2166
|
async createPlanVersionDraft(data) {
|
|
@@ -2458,7 +2483,7 @@ function toLineItemInsert(item, contractId, createdAt) {
|
|
|
2458
2483
|
}
|
|
2459
2484
|
__name(toLineItemInsert, "toLineItemInsert");
|
|
2460
2485
|
|
|
2461
|
-
// src/drizzle-subscriber-
|
|
2486
|
+
// src/drizzle-subscriber-ledger.repository.ts
|
|
2462
2487
|
var import_node_crypto11 = require("node:crypto");
|
|
2463
2488
|
var import_common17 = require("@nestjs/common");
|
|
2464
2489
|
var import_drizzle_orm15 = require("drizzle-orm");
|
|
@@ -2480,6 +2505,71 @@ function _ts_param16(paramIndex, decorator) {
|
|
|
2480
2505
|
};
|
|
2481
2506
|
}
|
|
2482
2507
|
__name(_ts_param16, "_ts_param");
|
|
2508
|
+
var DrizzleSubscriberLedgerRepository = class {
|
|
2509
|
+
static {
|
|
2510
|
+
__name(this, "DrizzleSubscriberLedgerRepository");
|
|
2511
|
+
}
|
|
2512
|
+
db;
|
|
2513
|
+
constructor(db) {
|
|
2514
|
+
this.db = db;
|
|
2515
|
+
}
|
|
2516
|
+
/**
|
|
2517
|
+
* One statement, `ON CONFLICT DO NOTHING` on the natural key: a charge
|
|
2518
|
+
* another caller wrote first — committed or still in flight — is waited for
|
|
2519
|
+
* and skipped rather than raised, and only what this call wrote comes back.
|
|
2520
|
+
*/
|
|
2521
|
+
async recordCharges(charges, tx) {
|
|
2522
|
+
if (charges.length === 0) return [];
|
|
2523
|
+
const rows = await resolveDb(this.db, tx).insert(subscriberLedgerEntries).values(charges.map((charge) => ({
|
|
2524
|
+
id: (0, import_node_crypto11.randomUUID)(),
|
|
2525
|
+
...(0, import_core6.subscriberChargeColumns)(charge)
|
|
2526
|
+
}))).onConflictDoNothing({
|
|
2527
|
+
target: [
|
|
2528
|
+
subscriberLedgerEntries.subscriptionId,
|
|
2529
|
+
subscriberLedgerEntries.source,
|
|
2530
|
+
subscriberLedgerEntries.sourceRef,
|
|
2531
|
+
subscriberLedgerEntries.periodStart,
|
|
2532
|
+
subscriberLedgerEntries.origin
|
|
2533
|
+
]
|
|
2534
|
+
}).returning();
|
|
2535
|
+
return rows.map(import_core6.toSubscriberChargeRecord);
|
|
2536
|
+
}
|
|
2537
|
+
async listBySubscription(subscriptionId, tx) {
|
|
2538
|
+
const rows = await resolveDb(this.db, tx).select().from(subscriberLedgerEntries).where((0, import_drizzle_orm15.eq)(subscriberLedgerEntries.subscriptionId, subscriptionId)).orderBy((0, import_drizzle_orm15.asc)(subscriberLedgerEntries.periodStart), (0, import_drizzle_orm15.asc)(subscriberLedgerEntries.source), (0, import_drizzle_orm15.asc)(subscriberLedgerEntries.sourceRef), (0, import_drizzle_orm15.asc)(subscriberLedgerEntries.origin));
|
|
2539
|
+
return rows.map(import_core6.toSubscriberChargeRecord);
|
|
2540
|
+
}
|
|
2541
|
+
};
|
|
2542
|
+
DrizzleSubscriberLedgerRepository = _ts_decorate17([
|
|
2543
|
+
(0, import_common17.Injectable)(),
|
|
2544
|
+
_ts_param16(0, (0, import_common17.Inject)(DRIZZLE_DB_TOKEN)),
|
|
2545
|
+
_ts_metadata16("design:type", Function),
|
|
2546
|
+
_ts_metadata16("design:paramtypes", [
|
|
2547
|
+
typeof DrizzleClient === "undefined" ? Object : DrizzleClient
|
|
2548
|
+
])
|
|
2549
|
+
], DrizzleSubscriberLedgerRepository);
|
|
2550
|
+
|
|
2551
|
+
// src/drizzle-subscriber-payment-method.repository.ts
|
|
2552
|
+
var import_node_crypto12 = require("node:crypto");
|
|
2553
|
+
var import_common18 = require("@nestjs/common");
|
|
2554
|
+
var import_drizzle_orm16 = require("drizzle-orm");
|
|
2555
|
+
var import_core7 = require("@saasicat/core");
|
|
2556
|
+
function _ts_decorate18(decorators, target, key, desc10) {
|
|
2557
|
+
var c = arguments.length, r = c < 3 ? target : desc10 === null ? desc10 = Object.getOwnPropertyDescriptor(target, key) : desc10, d;
|
|
2558
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc10);
|
|
2559
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2560
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2561
|
+
}
|
|
2562
|
+
__name(_ts_decorate18, "_ts_decorate");
|
|
2563
|
+
function _ts_metadata17(k, v) {
|
|
2564
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2565
|
+
}
|
|
2566
|
+
__name(_ts_metadata17, "_ts_metadata");
|
|
2567
|
+
function _ts_param17(paramIndex, decorator) {
|
|
2568
|
+
return function(target, key) {
|
|
2569
|
+
decorator(target, key, paramIndex);
|
|
2570
|
+
};
|
|
2571
|
+
}
|
|
2572
|
+
__name(_ts_param17, "_ts_param");
|
|
2483
2573
|
var DrizzleSubscriberPaymentMethodRepository = class {
|
|
2484
2574
|
static {
|
|
2485
2575
|
__name(this, "DrizzleSubscriberPaymentMethodRepository");
|
|
@@ -2493,29 +2583,29 @@ var DrizzleSubscriberPaymentMethodRepository = class {
|
|
|
2493
2583
|
const db = transaction;
|
|
2494
2584
|
const locked = await db.select({
|
|
2495
2585
|
id: subscribers.id
|
|
2496
|
-
}).from(subscribers).where((0,
|
|
2586
|
+
}).from(subscribers).where((0, import_drizzle_orm16.eq)(subscribers.id, data.subscriberId)).for("update").limit(1);
|
|
2497
2587
|
if (locked.length === 0) {
|
|
2498
2588
|
throw new Error(`Subscriber '${data.subscriberId}' does not exist; its payment method cannot be recorded.`);
|
|
2499
2589
|
}
|
|
2500
2590
|
const [recorded] = await db.select().from(subscriberPaymentMethods).where(this.byReference(data.gatewayAccount, data.paymentMethodRef)).limit(1);
|
|
2501
2591
|
if (recorded) {
|
|
2502
|
-
(0,
|
|
2592
|
+
(0, import_core7.refuseForeignPaymentMethodReference)(recorded, data.subscriberId);
|
|
2503
2593
|
return {
|
|
2504
|
-
method: (0,
|
|
2594
|
+
method: (0, import_core7.toSubscriberPaymentMethodRecord)(recorded),
|
|
2505
2595
|
outcome: "already-recorded"
|
|
2506
2596
|
};
|
|
2507
2597
|
}
|
|
2508
2598
|
const [active] = await db.select().from(subscriberPaymentMethods).where(this.activeOf(data.subscriberId)).limit(1);
|
|
2509
2599
|
const replacedOnArrival = active && active.confirmedAt.getTime() > data.confirmedAt.getTime() ? active.confirmedAt : null;
|
|
2510
2600
|
const claimed = await this.claimReference(db, {
|
|
2511
|
-
...(0,
|
|
2512
|
-
id: (0,
|
|
2601
|
+
...(0, import_core7.subscriberPaymentMethodColumns)(data),
|
|
2602
|
+
id: (0, import_node_crypto12.randomUUID)(),
|
|
2513
2603
|
status: "REPLACED",
|
|
2514
2604
|
replacedAt: replacedOnArrival ?? data.confirmedAt
|
|
2515
2605
|
});
|
|
2516
2606
|
if (replacedOnArrival) {
|
|
2517
2607
|
return {
|
|
2518
|
-
method: (0,
|
|
2608
|
+
method: (0, import_core7.toSubscriberPaymentMethodRecord)(claimed),
|
|
2519
2609
|
outcome: "superseded"
|
|
2520
2610
|
};
|
|
2521
2611
|
}
|
|
@@ -2523,14 +2613,14 @@ var DrizzleSubscriberPaymentMethodRepository = class {
|
|
|
2523
2613
|
await db.update(subscriberPaymentMethods).set({
|
|
2524
2614
|
status: "REPLACED",
|
|
2525
2615
|
replacedAt: data.confirmedAt
|
|
2526
|
-
}).where((0,
|
|
2616
|
+
}).where((0, import_drizzle_orm16.eq)(subscriberPaymentMethods.id, active.id));
|
|
2527
2617
|
}
|
|
2528
2618
|
const [inUse] = await db.update(subscriberPaymentMethods).set({
|
|
2529
2619
|
status: "ACTIVE",
|
|
2530
2620
|
replacedAt: null
|
|
2531
|
-
}).where((0,
|
|
2621
|
+
}).where((0, import_drizzle_orm16.eq)(subscriberPaymentMethods.id, claimed.id)).returning();
|
|
2532
2622
|
return {
|
|
2533
|
-
method: (0,
|
|
2623
|
+
method: (0, import_core7.toSubscriberPaymentMethodRecord)(inUse),
|
|
2534
2624
|
outcome: "activated"
|
|
2535
2625
|
};
|
|
2536
2626
|
});
|
|
@@ -2558,27 +2648,27 @@ var DrizzleSubscriberPaymentMethodRepository = class {
|
|
|
2558
2648
|
]
|
|
2559
2649
|
}).returning();
|
|
2560
2650
|
if (!claimed) {
|
|
2561
|
-
throw new
|
|
2651
|
+
throw new import_core7.ForeignPaymentMethodReferenceError(values.gatewayAccount, values.paymentMethodRef);
|
|
2562
2652
|
}
|
|
2563
2653
|
return claimed;
|
|
2564
2654
|
}
|
|
2565
2655
|
async findActive(subscriberId, tx) {
|
|
2566
2656
|
const [row] = await resolveDb(this.db, tx).select().from(subscriberPaymentMethods).where(this.activeOf(subscriberId)).limit(1);
|
|
2567
|
-
return row ? (0,
|
|
2657
|
+
return row ? (0, import_core7.toSubscriberPaymentMethodRecord)(row) : null;
|
|
2568
2658
|
}
|
|
2569
2659
|
async findByReference(reference, tx) {
|
|
2570
|
-
const [row] = await resolveDb(this.db, tx).select().from(subscriberPaymentMethods).where((0,
|
|
2571
|
-
return row ? (0,
|
|
2660
|
+
const [row] = await resolveDb(this.db, tx).select().from(subscriberPaymentMethods).where((0, import_drizzle_orm16.and)((0, import_drizzle_orm16.eq)(subscriberPaymentMethods.subscriberId, reference.subscriberId), this.byReference(reference.gatewayAccount, reference.paymentMethodRef))).limit(1);
|
|
2661
|
+
return row ? (0, import_core7.toSubscriberPaymentMethodRecord)(row) : null;
|
|
2572
2662
|
}
|
|
2573
2663
|
async accountsInUse() {
|
|
2574
2664
|
const rows = await this.db.selectDistinct({
|
|
2575
2665
|
gatewayAccount: subscriberPaymentMethods.gatewayAccount
|
|
2576
|
-
}).from(subscriberPaymentMethods).where((0,
|
|
2666
|
+
}).from(subscriberPaymentMethods).where((0, import_drizzle_orm16.eq)(subscriberPaymentMethods.status, "ACTIVE")).orderBy((0, import_drizzle_orm16.asc)(subscriberPaymentMethods.gatewayAccount));
|
|
2577
2667
|
return rows.map((row) => row.gatewayAccount);
|
|
2578
2668
|
}
|
|
2579
2669
|
async recordSetup(data, tx) {
|
|
2580
2670
|
await resolveDb(this.db, tx).insert(subscriberPaymentMethodSetups).values({
|
|
2581
|
-
id: (0,
|
|
2671
|
+
id: (0, import_node_crypto12.randomUUID)(),
|
|
2582
2672
|
subscriberId: data.subscriberId,
|
|
2583
2673
|
gatewayAccount: data.gatewayAccount,
|
|
2584
2674
|
sessionRef: data.sessionRef,
|
|
@@ -2589,49 +2679,49 @@ var DrizzleSubscriberPaymentMethodRepository = class {
|
|
|
2589
2679
|
async completeSetup(match, completedAt, tx) {
|
|
2590
2680
|
const completed = await resolveDb(this.db, tx).update(subscriberPaymentMethodSetups).set({
|
|
2591
2681
|
completedAt
|
|
2592
|
-
}).where((0,
|
|
2682
|
+
}).where((0, import_drizzle_orm16.and)((0, import_drizzle_orm16.eq)(subscriberPaymentMethodSetups.gatewayAccount, match.gatewayAccount), (0, import_drizzle_orm16.eq)(subscriberPaymentMethodSetups.sessionRef, match.sessionRef), (0, import_drizzle_orm16.eq)(subscriberPaymentMethodSetups.subscriberId, match.subscriberId), (0, import_drizzle_orm16.isNull)(subscriberPaymentMethodSetups.completedAt))).returning({
|
|
2593
2683
|
id: subscriberPaymentMethodSetups.id
|
|
2594
2684
|
});
|
|
2595
2685
|
return completed.length === 1;
|
|
2596
2686
|
}
|
|
2597
2687
|
activeOf(subscriberId) {
|
|
2598
|
-
return (0,
|
|
2688
|
+
return (0, import_drizzle_orm16.and)((0, import_drizzle_orm16.eq)(subscriberPaymentMethods.subscriberId, subscriberId), (0, import_drizzle_orm16.eq)(subscriberPaymentMethods.status, "ACTIVE"));
|
|
2599
2689
|
}
|
|
2600
2690
|
byReference(gatewayAccount, paymentMethodRef) {
|
|
2601
|
-
return (0,
|
|
2691
|
+
return (0, import_drizzle_orm16.and)((0, import_drizzle_orm16.eq)(subscriberPaymentMethods.gatewayAccount, gatewayAccount), (0, import_drizzle_orm16.eq)(subscriberPaymentMethods.paymentMethodRef, paymentMethodRef));
|
|
2602
2692
|
}
|
|
2603
2693
|
};
|
|
2604
|
-
DrizzleSubscriberPaymentMethodRepository =
|
|
2605
|
-
(0,
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2694
|
+
DrizzleSubscriberPaymentMethodRepository = _ts_decorate18([
|
|
2695
|
+
(0, import_common18.Injectable)(),
|
|
2696
|
+
_ts_param17(0, (0, import_common18.Inject)(DRIZZLE_DB_TOKEN)),
|
|
2697
|
+
_ts_metadata17("design:type", Function),
|
|
2698
|
+
_ts_metadata17("design:paramtypes", [
|
|
2609
2699
|
typeof DrizzleClient === "undefined" ? Object : DrizzleClient
|
|
2610
2700
|
])
|
|
2611
2701
|
], DrizzleSubscriberPaymentMethodRepository);
|
|
2612
2702
|
|
|
2613
2703
|
// src/drizzle-subscriber.repository.ts
|
|
2614
|
-
var
|
|
2615
|
-
var
|
|
2616
|
-
var
|
|
2617
|
-
var
|
|
2618
|
-
function
|
|
2704
|
+
var import_node_crypto13 = require("node:crypto");
|
|
2705
|
+
var import_common19 = require("@nestjs/common");
|
|
2706
|
+
var import_drizzle_orm17 = require("drizzle-orm");
|
|
2707
|
+
var import_core8 = require("@saasicat/core");
|
|
2708
|
+
function _ts_decorate19(decorators, target, key, desc10) {
|
|
2619
2709
|
var c = arguments.length, r = c < 3 ? target : desc10 === null ? desc10 = Object.getOwnPropertyDescriptor(target, key) : desc10, d;
|
|
2620
2710
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc10);
|
|
2621
2711
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2622
2712
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2623
2713
|
}
|
|
2624
|
-
__name(
|
|
2625
|
-
function
|
|
2714
|
+
__name(_ts_decorate19, "_ts_decorate");
|
|
2715
|
+
function _ts_metadata18(k, v) {
|
|
2626
2716
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2627
2717
|
}
|
|
2628
|
-
__name(
|
|
2629
|
-
function
|
|
2718
|
+
__name(_ts_metadata18, "_ts_metadata");
|
|
2719
|
+
function _ts_param18(paramIndex, decorator) {
|
|
2630
2720
|
return function(target, key) {
|
|
2631
2721
|
decorator(target, key, paramIndex);
|
|
2632
2722
|
};
|
|
2633
2723
|
}
|
|
2634
|
-
__name(
|
|
2724
|
+
__name(_ts_param18, "_ts_param");
|
|
2635
2725
|
var DrizzleSubscriberRepository = class {
|
|
2636
2726
|
static {
|
|
2637
2727
|
__name(this, "DrizzleSubscriberRepository");
|
|
@@ -2643,7 +2733,7 @@ var DrizzleSubscriberRepository = class {
|
|
|
2643
2733
|
async createForTenant(data, tx) {
|
|
2644
2734
|
const { tenantId, ...details } = data;
|
|
2645
2735
|
const now = /* @__PURE__ */ new Date();
|
|
2646
|
-
const subscriberId = (0,
|
|
2736
|
+
const subscriberId = (0, import_node_crypto13.randomUUID)();
|
|
2647
2737
|
return resolveDb(this.db, tx).transaction(async (transaction) => {
|
|
2648
2738
|
const db = transaction;
|
|
2649
2739
|
const [created] = await db.insert(subscribers).values({
|
|
@@ -2653,44 +2743,44 @@ var DrizzleSubscriberRepository = class {
|
|
|
2653
2743
|
updatedAt: now
|
|
2654
2744
|
}).returning();
|
|
2655
2745
|
const linked = await db.insert(subscriberTenants).values({
|
|
2656
|
-
id: (0,
|
|
2746
|
+
id: (0, import_node_crypto13.randomUUID)(),
|
|
2657
2747
|
subscriberId,
|
|
2658
2748
|
tenantId,
|
|
2659
2749
|
linkedAt: now
|
|
2660
2750
|
}).onConflictDoNothing().returning();
|
|
2661
2751
|
if (linked.length === 0) {
|
|
2662
|
-
await db.delete(subscribers).where((0,
|
|
2752
|
+
await db.delete(subscribers).where((0, import_drizzle_orm17.eq)(subscribers.id, subscriberId));
|
|
2663
2753
|
return null;
|
|
2664
2754
|
}
|
|
2665
|
-
return (0,
|
|
2755
|
+
return (0, import_core8.toSubscriberRecord)(created, tenantId);
|
|
2666
2756
|
});
|
|
2667
2757
|
}
|
|
2668
2758
|
async findById(subscriberId, tx) {
|
|
2669
2759
|
const db = resolveDb(this.db, tx);
|
|
2670
|
-
const rows = await db.select().from(subscribers).where((0,
|
|
2760
|
+
const rows = await db.select().from(subscribers).where((0, import_drizzle_orm17.eq)(subscribers.id, subscriberId)).limit(1);
|
|
2671
2761
|
return rows[0] ? this.withLiveTenant(db, rows[0]) : null;
|
|
2672
2762
|
}
|
|
2673
2763
|
async findByTenantId(tenantId, tx) {
|
|
2674
2764
|
const db = resolveDb(this.db, tx);
|
|
2675
2765
|
const rows = await db.select({
|
|
2676
2766
|
subscriber: subscribers
|
|
2677
|
-
}).from(subscriberTenants).innerJoin(subscribers, (0,
|
|
2678
|
-
return rows[0] ? (0,
|
|
2767
|
+
}).from(subscriberTenants).innerJoin(subscribers, (0, import_drizzle_orm17.eq)(subscribers.id, subscriberTenants.subscriberId)).where((0, import_drizzle_orm17.and)((0, import_drizzle_orm17.eq)(subscriberTenants.tenantId, tenantId), (0, import_drizzle_orm17.isNull)(subscriberTenants.unlinkedAt))).limit(1);
|
|
2768
|
+
return rows[0] ? (0, import_core8.toSubscriberRecord)(rows[0].subscriber, tenantId) : null;
|
|
2679
2769
|
}
|
|
2680
2770
|
async updateContact(subscriberId, change, tx) {
|
|
2681
2771
|
const db = resolveDb(this.db, tx);
|
|
2682
2772
|
const rows = await db.update(subscribers).set({
|
|
2683
2773
|
...change,
|
|
2684
2774
|
updatedAt: /* @__PURE__ */ new Date()
|
|
2685
|
-
}).where((0,
|
|
2775
|
+
}).where((0, import_drizzle_orm17.eq)(subscribers.id, subscriberId)).returning();
|
|
2686
2776
|
return rows[0] ? this.withLiveTenant(db, rows[0]) : null;
|
|
2687
2777
|
}
|
|
2688
2778
|
async correctIdentity(subscriberId, data, tx) {
|
|
2689
2779
|
return resolveDb(this.db, tx).transaction(async (transaction) => {
|
|
2690
2780
|
const db = transaction;
|
|
2691
|
-
const [current] = await db.select().from(subscribers).where((0,
|
|
2781
|
+
const [current] = await db.select().from(subscribers).where((0, import_drizzle_orm17.eq)(subscribers.id, subscriberId)).for("update").limit(1);
|
|
2692
2782
|
if (!current) return null;
|
|
2693
|
-
const delta = (0,
|
|
2783
|
+
const delta = (0, import_core8.identityCorrectionDelta)(current, data.corrected);
|
|
2694
2784
|
if (Object.keys(delta.corrected).length === 0) {
|
|
2695
2785
|
return {
|
|
2696
2786
|
subscriber: await this.withLiveTenant(db, current),
|
|
@@ -2700,9 +2790,9 @@ var DrizzleSubscriberRepository = class {
|
|
|
2700
2790
|
const [updated] = await db.update(subscribers).set({
|
|
2701
2791
|
...delta.corrected,
|
|
2702
2792
|
updatedAt: /* @__PURE__ */ new Date()
|
|
2703
|
-
}).where((0,
|
|
2793
|
+
}).where((0, import_drizzle_orm17.eq)(subscribers.id, subscriberId)).returning();
|
|
2704
2794
|
const [correction] = await db.insert(subscriberCorrections).values({
|
|
2705
|
-
id: (0,
|
|
2795
|
+
id: (0, import_node_crypto13.randomUUID)(),
|
|
2706
2796
|
subscriberId,
|
|
2707
2797
|
previous: delta.previous,
|
|
2708
2798
|
corrected: delta.corrected,
|
|
@@ -2712,50 +2802,50 @@ var DrizzleSubscriberRepository = class {
|
|
|
2712
2802
|
}).returning();
|
|
2713
2803
|
return {
|
|
2714
2804
|
subscriber: await this.withLiveTenant(db, updated),
|
|
2715
|
-
correction: (0,
|
|
2805
|
+
correction: (0, import_core8.toSubscriberCorrectionRecord)(correction)
|
|
2716
2806
|
};
|
|
2717
2807
|
});
|
|
2718
2808
|
}
|
|
2719
2809
|
async listCorrections(subscriberId) {
|
|
2720
|
-
const rows = await this.db.select().from(subscriberCorrections).where((0,
|
|
2721
|
-
return rows.map(
|
|
2810
|
+
const rows = await this.db.select().from(subscriberCorrections).where((0, import_drizzle_orm17.eq)(subscriberCorrections.subscriberId, subscriberId)).orderBy((0, import_drizzle_orm17.desc)(subscriberCorrections.correctedAt), (0, import_drizzle_orm17.desc)(subscriberCorrections.id));
|
|
2811
|
+
return rows.map(import_core8.toSubscriberCorrectionRecord);
|
|
2722
2812
|
}
|
|
2723
2813
|
async withLiveTenant(db, row) {
|
|
2724
2814
|
const links = await db.select({
|
|
2725
2815
|
tenantId: subscriberTenants.tenantId
|
|
2726
|
-
}).from(subscriberTenants).where((0,
|
|
2727
|
-
return (0,
|
|
2816
|
+
}).from(subscriberTenants).where((0, import_drizzle_orm17.and)((0, import_drizzle_orm17.eq)(subscriberTenants.subscriberId, row.id), (0, import_drizzle_orm17.isNull)(subscriberTenants.unlinkedAt))).limit(1);
|
|
2817
|
+
return (0, import_core8.toSubscriberRecord)(row, links[0]?.tenantId ?? null);
|
|
2728
2818
|
}
|
|
2729
2819
|
};
|
|
2730
|
-
DrizzleSubscriberRepository =
|
|
2731
|
-
(0,
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2820
|
+
DrizzleSubscriberRepository = _ts_decorate19([
|
|
2821
|
+
(0, import_common19.Injectable)(),
|
|
2822
|
+
_ts_param18(0, (0, import_common19.Inject)(DRIZZLE_DB_TOKEN)),
|
|
2823
|
+
_ts_metadata18("design:type", Function),
|
|
2824
|
+
_ts_metadata18("design:paramtypes", [
|
|
2735
2825
|
typeof DrizzleClient === "undefined" ? Object : DrizzleClient
|
|
2736
2826
|
])
|
|
2737
2827
|
], DrizzleSubscriberRepository);
|
|
2738
2828
|
|
|
2739
2829
|
// src/drizzle-subscription-usage.adapter.ts
|
|
2740
|
-
var
|
|
2741
|
-
var
|
|
2742
|
-
function
|
|
2830
|
+
var import_common20 = require("@nestjs/common");
|
|
2831
|
+
var import_drizzle_orm18 = require("drizzle-orm");
|
|
2832
|
+
function _ts_decorate20(decorators, target, key, desc10) {
|
|
2743
2833
|
var c = arguments.length, r = c < 3 ? target : desc10 === null ? desc10 = Object.getOwnPropertyDescriptor(target, key) : desc10, d;
|
|
2744
2834
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc10);
|
|
2745
2835
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2746
2836
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2747
2837
|
}
|
|
2748
|
-
__name(
|
|
2749
|
-
function
|
|
2838
|
+
__name(_ts_decorate20, "_ts_decorate");
|
|
2839
|
+
function _ts_metadata19(k, v) {
|
|
2750
2840
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2751
2841
|
}
|
|
2752
|
-
__name(
|
|
2753
|
-
function
|
|
2842
|
+
__name(_ts_metadata19, "_ts_metadata");
|
|
2843
|
+
function _ts_param19(paramIndex, decorator) {
|
|
2754
2844
|
return function(target, key) {
|
|
2755
2845
|
decorator(target, key, paramIndex);
|
|
2756
2846
|
};
|
|
2757
2847
|
}
|
|
2758
|
-
__name(
|
|
2848
|
+
__name(_ts_param19, "_ts_param");
|
|
2759
2849
|
var DrizzleSubscriptionUsageAdapter = class {
|
|
2760
2850
|
static {
|
|
2761
2851
|
__name(this, "DrizzleSubscriptionUsageAdapter");
|
|
@@ -2765,13 +2855,13 @@ var DrizzleSubscriptionUsageAdapter = class {
|
|
|
2765
2855
|
this.db = db;
|
|
2766
2856
|
}
|
|
2767
2857
|
async findForTenant(tenantId) {
|
|
2768
|
-
const [subscription] = await this.db.select().from(subscriptions).where((0,
|
|
2858
|
+
const [subscription] = await this.db.select().from(subscriptions).where((0, import_drizzle_orm18.eq)(subscriptions.tenantId, tenantId)).limit(1);
|
|
2769
2859
|
if (!subscription) return null;
|
|
2770
|
-
const [planVersion] = await this.db.select().from(planVersions).where((0,
|
|
2860
|
+
const [planVersion] = await this.db.select().from(planVersions).where((0, import_drizzle_orm18.eq)(planVersions.id, subscription.planVersionId)).limit(1);
|
|
2771
2861
|
if (!planVersion) {
|
|
2772
2862
|
throw new Error(`Subscription ${subscription.id} references missing PlanVersion ${subscription.planVersionId}.`);
|
|
2773
2863
|
}
|
|
2774
|
-
const [pendingPlanVersion] = subscription.pendingPlanVersionId ? await this.db.select().from(planVersions).where((0,
|
|
2864
|
+
const [pendingPlanVersion] = subscription.pendingPlanVersionId ? await this.db.select().from(planVersions).where((0, import_drizzle_orm18.eq)(planVersions.id, subscription.pendingPlanVersionId)).limit(1) : [];
|
|
2775
2865
|
return {
|
|
2776
2866
|
id: subscription.id,
|
|
2777
2867
|
plan: planVersion.planId,
|
|
@@ -2806,11 +2896,11 @@ var DrizzleSubscriptionUsageAdapter = class {
|
|
|
2806
2896
|
};
|
|
2807
2897
|
}
|
|
2808
2898
|
};
|
|
2809
|
-
DrizzleSubscriptionUsageAdapter =
|
|
2810
|
-
(0,
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2899
|
+
DrizzleSubscriptionUsageAdapter = _ts_decorate20([
|
|
2900
|
+
(0, import_common20.Injectable)(),
|
|
2901
|
+
_ts_param19(0, (0, import_common20.Inject)(DRIZZLE_DB_TOKEN)),
|
|
2902
|
+
_ts_metadata19("design:type", Function),
|
|
2903
|
+
_ts_metadata19("design:paramtypes", [
|
|
2814
2904
|
typeof DrizzleClient === "undefined" ? Object : DrizzleClient
|
|
2815
2905
|
])
|
|
2816
2906
|
], DrizzleSubscriptionUsageAdapter);
|
|
@@ -2829,25 +2919,25 @@ function toUsagePlanVersion(row) {
|
|
|
2829
2919
|
__name(toUsagePlanVersion, "toUsagePlanVersion");
|
|
2830
2920
|
|
|
2831
2921
|
// src/drizzle-tenant-subscription-write.adapter.ts
|
|
2832
|
-
var
|
|
2833
|
-
var
|
|
2834
|
-
function
|
|
2922
|
+
var import_common21 = require("@nestjs/common");
|
|
2923
|
+
var import_drizzle_orm19 = require("drizzle-orm");
|
|
2924
|
+
function _ts_decorate21(decorators, target, key, desc10) {
|
|
2835
2925
|
var c = arguments.length, r = c < 3 ? target : desc10 === null ? desc10 = Object.getOwnPropertyDescriptor(target, key) : desc10, d;
|
|
2836
2926
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc10);
|
|
2837
2927
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2838
2928
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2839
2929
|
}
|
|
2840
|
-
__name(
|
|
2841
|
-
function
|
|
2930
|
+
__name(_ts_decorate21, "_ts_decorate");
|
|
2931
|
+
function _ts_metadata20(k, v) {
|
|
2842
2932
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2843
2933
|
}
|
|
2844
|
-
__name(
|
|
2845
|
-
function
|
|
2934
|
+
__name(_ts_metadata20, "_ts_metadata");
|
|
2935
|
+
function _ts_param20(paramIndex, decorator) {
|
|
2846
2936
|
return function(target, key) {
|
|
2847
2937
|
decorator(target, key, paramIndex);
|
|
2848
2938
|
};
|
|
2849
2939
|
}
|
|
2850
|
-
__name(
|
|
2940
|
+
__name(_ts_param20, "_ts_param");
|
|
2851
2941
|
var DrizzleTenantSubscriptionWrite = class {
|
|
2852
2942
|
static {
|
|
2853
2943
|
__name(this, "DrizzleTenantSubscriptionWrite");
|
|
@@ -2917,7 +3007,7 @@ var DrizzleTenantSubscriptionWrite = class {
|
|
|
2917
3007
|
pendingPlanVersionAcceptedAt: now,
|
|
2918
3008
|
pendingPlanVersionAcceptedByUserId: userId,
|
|
2919
3009
|
updatedAt: now
|
|
2920
|
-
}).where((0,
|
|
3010
|
+
}).where((0, import_drizzle_orm19.and)((0, import_drizzle_orm19.eq)(subscriptions.id, sub.id), (0, import_drizzle_orm19.eq)(subscriptions.pendingPlanVersionId, pendingPlanVersionId), (0, import_drizzle_orm19.eq)(subscriptions.pendingPlanVersionAccepted, false))).returning({
|
|
2921
3011
|
id: subscriptions.id
|
|
2922
3012
|
});
|
|
2923
3013
|
const updated = await this.requireSubscription(this.db, tenantId);
|
|
@@ -2953,7 +3043,7 @@ var DrizzleTenantSubscriptionWrite = class {
|
|
|
2953
3043
|
status: "CANCELED"
|
|
2954
3044
|
} : {},
|
|
2955
3045
|
updatedAt: now
|
|
2956
|
-
}).where((0,
|
|
3046
|
+
}).where((0, import_drizzle_orm19.and)((0, import_drizzle_orm19.eq)(subscriptions.tenantId, tenantId), (0, import_drizzle_orm19.isNull)(subscriptions.canceledAt), (0, import_drizzle_orm19.isNull)(subscriptions.canceledEffectiveAt))).returning({
|
|
2957
3047
|
id: subscriptions.id
|
|
2958
3048
|
});
|
|
2959
3049
|
const current = await this.requireSubscription(this.db, tenantId);
|
|
@@ -3013,7 +3103,7 @@ var DrizzleTenantSubscriptionWrite = class {
|
|
|
3013
3103
|
const claimed = await db.update(subscriptions).set({
|
|
3014
3104
|
...values,
|
|
3015
3105
|
updatedAt: /* @__PURE__ */ new Date()
|
|
3016
|
-
}).where((0,
|
|
3106
|
+
}).where((0, import_drizzle_orm19.and)((0, import_drizzle_orm19.eq)(subscriptions.tenantId, tenantId), canceledAtIs(expectedCanceledAt))).returning({
|
|
3017
3107
|
id: subscriptions.id
|
|
3018
3108
|
});
|
|
3019
3109
|
return claimed.length;
|
|
@@ -3025,7 +3115,7 @@ var DrizzleTenantSubscriptionWrite = class {
|
|
|
3025
3115
|
* released with the statement.
|
|
3026
3116
|
*/
|
|
3027
3117
|
async requireSubscription(db, tenantId, options = {}) {
|
|
3028
|
-
const query = db.select().from(subscriptions).where((0,
|
|
3118
|
+
const query = db.select().from(subscriptions).where((0, import_drizzle_orm19.eq)(subscriptions.tenantId, tenantId));
|
|
3029
3119
|
const rows = await (options.lock ? query.for("update") : query).limit(1);
|
|
3030
3120
|
if (!rows[0]) throw new Error(`No subscription for tenant ${tenantId}.`);
|
|
3031
3121
|
return rows[0];
|
|
@@ -3047,11 +3137,11 @@ var DrizzleTenantSubscriptionWrite = class {
|
|
|
3047
3137
|
return !pending || pending.planId !== targetPlanKey;
|
|
3048
3138
|
}
|
|
3049
3139
|
};
|
|
3050
|
-
DrizzleTenantSubscriptionWrite =
|
|
3051
|
-
(0,
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3140
|
+
DrizzleTenantSubscriptionWrite = _ts_decorate21([
|
|
3141
|
+
(0, import_common21.Injectable)(),
|
|
3142
|
+
_ts_param20(0, (0, import_common21.Inject)(DRIZZLE_DB_TOKEN)),
|
|
3143
|
+
_ts_metadata20("design:type", Function),
|
|
3144
|
+
_ts_metadata20("design:paramtypes", [
|
|
3055
3145
|
typeof DrizzleClient === "undefined" ? Object : DrizzleClient
|
|
3056
3146
|
])
|
|
3057
3147
|
], DrizzleTenantSubscriptionWrite);
|
|
@@ -3077,31 +3167,32 @@ function clearedPendingVersion() {
|
|
|
3077
3167
|
}
|
|
3078
3168
|
__name(clearedPendingVersion, "clearedPendingVersion");
|
|
3079
3169
|
function canceledAtIs(expected) {
|
|
3080
|
-
return expected === null ? (0,
|
|
3170
|
+
return expected === null ? (0, import_drizzle_orm19.isNull)(subscriptions.canceledAt) : (0, import_drizzle_orm19.eq)(subscriptions.canceledAt, expected);
|
|
3081
3171
|
}
|
|
3082
3172
|
__name(canceledAtIs, "canceledAtIs");
|
|
3083
3173
|
|
|
3084
3174
|
// src/drizzle-subscription-bundle.repository.ts
|
|
3085
|
-
var
|
|
3086
|
-
var
|
|
3087
|
-
var
|
|
3088
|
-
|
|
3175
|
+
var import_node_crypto14 = require("node:crypto");
|
|
3176
|
+
var import_common22 = require("@nestjs/common");
|
|
3177
|
+
var import_drizzle_orm20 = require("drizzle-orm");
|
|
3178
|
+
var import_core9 = require("@saasicat/core");
|
|
3179
|
+
function _ts_decorate22(decorators, target, key, desc10) {
|
|
3089
3180
|
var c = arguments.length, r = c < 3 ? target : desc10 === null ? desc10 = Object.getOwnPropertyDescriptor(target, key) : desc10, d;
|
|
3090
3181
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc10);
|
|
3091
3182
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3092
3183
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3093
3184
|
}
|
|
3094
|
-
__name(
|
|
3095
|
-
function
|
|
3185
|
+
__name(_ts_decorate22, "_ts_decorate");
|
|
3186
|
+
function _ts_metadata21(k, v) {
|
|
3096
3187
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3097
3188
|
}
|
|
3098
|
-
__name(
|
|
3099
|
-
function
|
|
3189
|
+
__name(_ts_metadata21, "_ts_metadata");
|
|
3190
|
+
function _ts_param21(paramIndex, decorator) {
|
|
3100
3191
|
return function(target, key) {
|
|
3101
3192
|
decorator(target, key, paramIndex);
|
|
3102
3193
|
};
|
|
3103
3194
|
}
|
|
3104
|
-
__name(
|
|
3195
|
+
__name(_ts_param21, "_ts_param");
|
|
3105
3196
|
var DrizzleSubscriptionBundleRepository = class {
|
|
3106
3197
|
static {
|
|
3107
3198
|
__name(this, "DrizzleSubscriptionBundleRepository");
|
|
@@ -3111,21 +3202,21 @@ var DrizzleSubscriptionBundleRepository = class {
|
|
|
3111
3202
|
this.db = db;
|
|
3112
3203
|
}
|
|
3113
3204
|
async listBySubscription(subscriptionId) {
|
|
3114
|
-
const rows = await this.db.select().from(subscriptionBundles).where((0,
|
|
3115
|
-
return rows.map(
|
|
3205
|
+
const rows = await this.db.select().from(subscriptionBundles).where((0, import_drizzle_orm20.eq)(subscriptionBundles.subscriptionId, subscriptionId)).orderBy((0, import_drizzle_orm20.desc)(subscriptionBundles.startedAt));
|
|
3206
|
+
return rows.map(import_core9.toSubscriptionBundleRecord);
|
|
3116
3207
|
}
|
|
3117
3208
|
async findById(subscriptionBundleId) {
|
|
3118
|
-
const rows = await this.db.select().from(subscriptionBundles).where((0,
|
|
3119
|
-
return rows[0] ?
|
|
3209
|
+
const rows = await this.db.select().from(subscriptionBundles).where((0, import_drizzle_orm20.eq)(subscriptionBundles.id, subscriptionBundleId)).limit(1);
|
|
3210
|
+
return rows[0] ? (0, import_core9.toSubscriptionBundleRecord)(rows[0]) : null;
|
|
3120
3211
|
}
|
|
3121
3212
|
async listActiveBySubscription(subscriptionId, asOf = /* @__PURE__ */ new Date(), tx) {
|
|
3122
|
-
const rows = await resolveDb(this.db, tx).select().from(subscriptionBundles).where((0,
|
|
3123
|
-
return rows.map(
|
|
3213
|
+
const rows = await resolveDb(this.db, tx).select().from(subscriptionBundles).where((0, import_drizzle_orm20.and)((0, import_drizzle_orm20.eq)(subscriptionBundles.subscriptionId, subscriptionId), stillActive(asOf)));
|
|
3214
|
+
return rows.map(import_core9.toSubscriptionBundleRecord);
|
|
3124
3215
|
}
|
|
3125
3216
|
async add(data) {
|
|
3126
3217
|
const now = /* @__PURE__ */ new Date();
|
|
3127
3218
|
const rows = await this.db.insert(subscriptionBundles).values({
|
|
3128
|
-
id: (0,
|
|
3219
|
+
id: (0, import_node_crypto14.randomUUID)(),
|
|
3129
3220
|
subscriptionId: data.subscriptionId,
|
|
3130
3221
|
bundleVersionId: data.bundleVersionId,
|
|
3131
3222
|
startedAt: data.startedAt ?? now,
|
|
@@ -3137,86 +3228,69 @@ var DrizzleSubscriptionBundleRepository = class {
|
|
|
3137
3228
|
canceledEffectiveAt: null,
|
|
3138
3229
|
updatedAt: now
|
|
3139
3230
|
}).returning();
|
|
3140
|
-
return
|
|
3231
|
+
return (0, import_core9.toSubscriptionBundleRecord)(rows[0]);
|
|
3141
3232
|
}
|
|
3142
3233
|
async cancel(subscriptionBundleId, data) {
|
|
3143
3234
|
const rows = await this.db.update(subscriptionBundles).set({
|
|
3144
3235
|
canceledAt: data.canceledAt,
|
|
3145
3236
|
canceledEffectiveAt: data.canceledEffectiveAt,
|
|
3146
3237
|
updatedAt: /* @__PURE__ */ new Date()
|
|
3147
|
-
}).where((0,
|
|
3238
|
+
}).where((0, import_drizzle_orm20.and)((0, import_drizzle_orm20.eq)(subscriptionBundles.id, subscriptionBundleId), (0, import_drizzle_orm20.isNull)(subscriptionBundles.canceledAt))).returning();
|
|
3148
3239
|
if (!rows[0]) {
|
|
3149
3240
|
throw new Error(`SubscriptionBundle '${subscriptionBundleId}' not found or already cancelled`);
|
|
3150
3241
|
}
|
|
3151
|
-
return
|
|
3242
|
+
return (0, import_core9.toSubscriptionBundleRecord)(rows[0]);
|
|
3152
3243
|
}
|
|
3153
3244
|
async reactivate(subscriptionBundleId) {
|
|
3154
3245
|
const rows = await this.db.update(subscriptionBundles).set({
|
|
3155
3246
|
canceledAt: null,
|
|
3156
3247
|
canceledEffectiveAt: null,
|
|
3157
3248
|
updatedAt: /* @__PURE__ */ new Date()
|
|
3158
|
-
}).where((0,
|
|
3249
|
+
}).where((0, import_drizzle_orm20.eq)(subscriptionBundles.id, subscriptionBundleId)).returning();
|
|
3159
3250
|
if (!rows[0]) throw new Error(`SubscriptionBundle '${subscriptionBundleId}' not found`);
|
|
3160
|
-
return
|
|
3251
|
+
return (0, import_core9.toSubscriptionBundleRecord)(rows[0]);
|
|
3161
3252
|
}
|
|
3162
3253
|
async countActiveByBundleVersionId(bundleVersionId, asOf = /* @__PURE__ */ new Date()) {
|
|
3163
3254
|
const rows = await this.db.select({
|
|
3164
3255
|
id: subscriptionBundles.id
|
|
3165
|
-
}).from(subscriptionBundles).where((0,
|
|
3256
|
+
}).from(subscriptionBundles).where((0, import_drizzle_orm20.and)((0, import_drizzle_orm20.eq)(subscriptionBundles.bundleVersionId, bundleVersionId), stillActive(asOf)));
|
|
3166
3257
|
return rows.length;
|
|
3167
3258
|
}
|
|
3168
3259
|
};
|
|
3169
|
-
DrizzleSubscriptionBundleRepository =
|
|
3170
|
-
(0,
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3260
|
+
DrizzleSubscriptionBundleRepository = _ts_decorate22([
|
|
3261
|
+
(0, import_common22.Injectable)(),
|
|
3262
|
+
_ts_param21(0, (0, import_common22.Inject)(DRIZZLE_DB_TOKEN)),
|
|
3263
|
+
_ts_metadata21("design:type", Function),
|
|
3264
|
+
_ts_metadata21("design:paramtypes", [
|
|
3174
3265
|
typeof DrizzleClient === "undefined" ? Object : DrizzleClient
|
|
3175
3266
|
])
|
|
3176
3267
|
], DrizzleSubscriptionBundleRepository);
|
|
3177
3268
|
function stillActive(asOf) {
|
|
3178
|
-
return (0,
|
|
3269
|
+
return (0, import_drizzle_orm20.or)((0, import_drizzle_orm20.isNull)(subscriptionBundles.canceledAt), (0, import_drizzle_orm20.gt)(subscriptionBundles.canceledEffectiveAt, asOf));
|
|
3179
3270
|
}
|
|
3180
3271
|
__name(stillActive, "stillActive");
|
|
3181
|
-
function toRecord3(row) {
|
|
3182
|
-
return {
|
|
3183
|
-
id: row.id,
|
|
3184
|
-
subscriptionId: row.subscriptionId,
|
|
3185
|
-
bundleVersionId: row.bundleVersionId,
|
|
3186
|
-
startedAt: row.startedAt,
|
|
3187
|
-
minimumTermEndsAt: row.minimumTermEndsAt,
|
|
3188
|
-
billingCycle: row.billingCycle,
|
|
3189
|
-
currentPeriodStart: row.currentPeriodStart,
|
|
3190
|
-
currentPeriodEnd: row.currentPeriodEnd,
|
|
3191
|
-
canceledAt: row.canceledAt,
|
|
3192
|
-
canceledEffectiveAt: row.canceledEffectiveAt,
|
|
3193
|
-
createdAt: row.createdAt,
|
|
3194
|
-
updatedAt: row.updatedAt
|
|
3195
|
-
};
|
|
3196
|
-
}
|
|
3197
|
-
__name(toRecord3, "toRecord");
|
|
3198
3272
|
|
|
3199
3273
|
// src/drizzle-promo-code-validation-log.repository.ts
|
|
3200
|
-
var
|
|
3201
|
-
var
|
|
3202
|
-
var
|
|
3203
|
-
function
|
|
3274
|
+
var import_node_crypto15 = require("node:crypto");
|
|
3275
|
+
var import_common23 = require("@nestjs/common");
|
|
3276
|
+
var import_drizzle_orm21 = require("drizzle-orm");
|
|
3277
|
+
function _ts_decorate23(decorators, target, key, desc10) {
|
|
3204
3278
|
var c = arguments.length, r = c < 3 ? target : desc10 === null ? desc10 = Object.getOwnPropertyDescriptor(target, key) : desc10, d;
|
|
3205
3279
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc10);
|
|
3206
3280
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3207
3281
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3208
3282
|
}
|
|
3209
|
-
__name(
|
|
3210
|
-
function
|
|
3283
|
+
__name(_ts_decorate23, "_ts_decorate");
|
|
3284
|
+
function _ts_metadata22(k, v) {
|
|
3211
3285
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3212
3286
|
}
|
|
3213
|
-
__name(
|
|
3214
|
-
function
|
|
3287
|
+
__name(_ts_metadata22, "_ts_metadata");
|
|
3288
|
+
function _ts_param22(paramIndex, decorator) {
|
|
3215
3289
|
return function(target, key) {
|
|
3216
3290
|
decorator(target, key, paramIndex);
|
|
3217
3291
|
};
|
|
3218
3292
|
}
|
|
3219
|
-
__name(
|
|
3293
|
+
__name(_ts_param22, "_ts_param");
|
|
3220
3294
|
var DrizzlePromoCodeValidationLogRepository = class {
|
|
3221
3295
|
static {
|
|
3222
3296
|
__name(this, "DrizzlePromoCodeValidationLogRepository");
|
|
@@ -3227,7 +3301,7 @@ var DrizzlePromoCodeValidationLogRepository = class {
|
|
|
3227
3301
|
}
|
|
3228
3302
|
async log(args) {
|
|
3229
3303
|
await this.db.insert(promoCodeValidationLogs).values({
|
|
3230
|
-
id: (0,
|
|
3304
|
+
id: (0, import_node_crypto15.randomUUID)(),
|
|
3231
3305
|
promoCodeId: args.promoCodeId,
|
|
3232
3306
|
codeAttempt: args.codeAttempt.trim().toUpperCase(),
|
|
3233
3307
|
result: args.result,
|
|
@@ -3238,39 +3312,39 @@ var DrizzlePromoCodeValidationLogRepository = class {
|
|
|
3238
3312
|
async countValid(promoCodeId) {
|
|
3239
3313
|
const rows = await this.db.select({
|
|
3240
3314
|
id: promoCodeValidationLogs.id
|
|
3241
|
-
}).from(promoCodeValidationLogs).where((0,
|
|
3315
|
+
}).from(promoCodeValidationLogs).where((0, import_drizzle_orm21.and)((0, import_drizzle_orm21.eq)(promoCodeValidationLogs.promoCodeId, promoCodeId), (0, import_drizzle_orm21.eq)(promoCodeValidationLogs.result, "VALID")));
|
|
3242
3316
|
return rows.length;
|
|
3243
3317
|
}
|
|
3244
3318
|
};
|
|
3245
|
-
DrizzlePromoCodeValidationLogRepository =
|
|
3246
|
-
(0,
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3319
|
+
DrizzlePromoCodeValidationLogRepository = _ts_decorate23([
|
|
3320
|
+
(0, import_common23.Injectable)(),
|
|
3321
|
+
_ts_param22(0, (0, import_common23.Inject)(DRIZZLE_DB_TOKEN)),
|
|
3322
|
+
_ts_metadata22("design:type", Function),
|
|
3323
|
+
_ts_metadata22("design:paramtypes", [
|
|
3250
3324
|
typeof DrizzleClient === "undefined" ? Object : DrizzleClient
|
|
3251
3325
|
])
|
|
3252
3326
|
], DrizzlePromoCodeValidationLogRepository);
|
|
3253
3327
|
|
|
3254
3328
|
// src/drizzle-promo-subscription-lookup.adapter.ts
|
|
3255
|
-
var
|
|
3256
|
-
var
|
|
3257
|
-
function
|
|
3329
|
+
var import_common24 = require("@nestjs/common");
|
|
3330
|
+
var import_drizzle_orm22 = require("drizzle-orm");
|
|
3331
|
+
function _ts_decorate24(decorators, target, key, desc10) {
|
|
3258
3332
|
var c = arguments.length, r = c < 3 ? target : desc10 === null ? desc10 = Object.getOwnPropertyDescriptor(target, key) : desc10, d;
|
|
3259
3333
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc10);
|
|
3260
3334
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3261
3335
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3262
3336
|
}
|
|
3263
|
-
__name(
|
|
3264
|
-
function
|
|
3337
|
+
__name(_ts_decorate24, "_ts_decorate");
|
|
3338
|
+
function _ts_metadata23(k, v) {
|
|
3265
3339
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3266
3340
|
}
|
|
3267
|
-
__name(
|
|
3268
|
-
function
|
|
3341
|
+
__name(_ts_metadata23, "_ts_metadata");
|
|
3342
|
+
function _ts_param23(paramIndex, decorator) {
|
|
3269
3343
|
return function(target, key) {
|
|
3270
3344
|
decorator(target, key, paramIndex);
|
|
3271
3345
|
};
|
|
3272
3346
|
}
|
|
3273
|
-
__name(
|
|
3347
|
+
__name(_ts_param23, "_ts_param");
|
|
3274
3348
|
var DrizzlePromoSubscriptionLookup = class {
|
|
3275
3349
|
static {
|
|
3276
3350
|
__name(this, "DrizzlePromoSubscriptionLookup");
|
|
@@ -3287,7 +3361,7 @@ var DrizzlePromoSubscriptionLookup = class {
|
|
|
3287
3361
|
plan: subscriptions.plan,
|
|
3288
3362
|
billingCycle: subscriptions.billingCycle,
|
|
3289
3363
|
startedAt: subscriptions.startedAt
|
|
3290
|
-
}).from(subscriptions).where((0,
|
|
3364
|
+
}).from(subscriptions).where((0, import_drizzle_orm22.eq)(subscriptions.id, subscriptionId)).limit(1);
|
|
3291
3365
|
const row = rows[0];
|
|
3292
3366
|
if (!row) return null;
|
|
3293
3367
|
return {
|
|
@@ -3299,35 +3373,35 @@ var DrizzlePromoSubscriptionLookup = class {
|
|
|
3299
3373
|
};
|
|
3300
3374
|
}
|
|
3301
3375
|
};
|
|
3302
|
-
DrizzlePromoSubscriptionLookup =
|
|
3303
|
-
(0,
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3376
|
+
DrizzlePromoSubscriptionLookup = _ts_decorate24([
|
|
3377
|
+
(0, import_common24.Injectable)(),
|
|
3378
|
+
_ts_param23(0, (0, import_common24.Inject)(DRIZZLE_DB_TOKEN)),
|
|
3379
|
+
_ts_metadata23("design:type", Function),
|
|
3380
|
+
_ts_metadata23("design:paramtypes", [
|
|
3307
3381
|
typeof DrizzleClient === "undefined" ? Object : DrizzleClient
|
|
3308
3382
|
])
|
|
3309
3383
|
], DrizzlePromoSubscriptionLookup);
|
|
3310
3384
|
|
|
3311
3385
|
// src/drizzle-subscription.repository.ts
|
|
3312
|
-
var
|
|
3313
|
-
var
|
|
3314
|
-
function
|
|
3386
|
+
var import_common25 = require("@nestjs/common");
|
|
3387
|
+
var import_drizzle_orm23 = require("drizzle-orm");
|
|
3388
|
+
function _ts_decorate25(decorators, target, key, desc10) {
|
|
3315
3389
|
var c = arguments.length, r = c < 3 ? target : desc10 === null ? desc10 = Object.getOwnPropertyDescriptor(target, key) : desc10, d;
|
|
3316
3390
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc10);
|
|
3317
3391
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3318
3392
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3319
3393
|
}
|
|
3320
|
-
__name(
|
|
3321
|
-
function
|
|
3394
|
+
__name(_ts_decorate25, "_ts_decorate");
|
|
3395
|
+
function _ts_metadata24(k, v) {
|
|
3322
3396
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3323
3397
|
}
|
|
3324
|
-
__name(
|
|
3325
|
-
function
|
|
3398
|
+
__name(_ts_metadata24, "_ts_metadata");
|
|
3399
|
+
function _ts_param24(paramIndex, decorator) {
|
|
3326
3400
|
return function(target, key) {
|
|
3327
3401
|
decorator(target, key, paramIndex);
|
|
3328
3402
|
};
|
|
3329
3403
|
}
|
|
3330
|
-
__name(
|
|
3404
|
+
__name(_ts_param24, "_ts_param");
|
|
3331
3405
|
var ACTIVE_STATUSES = [
|
|
3332
3406
|
"ACTIVE",
|
|
3333
3407
|
"TRIAL"
|
|
@@ -3347,27 +3421,27 @@ var DrizzleSubscriptionRepository = class {
|
|
|
3347
3421
|
const db = resolveDb(this.db, tx);
|
|
3348
3422
|
await db.select({
|
|
3349
3423
|
id: subscriptions.id
|
|
3350
|
-
}).from(subscriptions).where((0,
|
|
3424
|
+
}).from(subscriptions).where((0, import_drizzle_orm23.eq)(subscriptions.tenantId, tenantId)).for("update");
|
|
3351
3425
|
return this.loadByTenantId(db, tenantId);
|
|
3352
3426
|
}
|
|
3353
3427
|
async countByPlanVersionId(planVersionId) {
|
|
3354
3428
|
const rows = await this.db.select({
|
|
3355
3429
|
id: subscriptions.id
|
|
3356
|
-
}).from(subscriptions).where((0,
|
|
3430
|
+
}).from(subscriptions).where((0, import_drizzle_orm23.or)((0, import_drizzle_orm23.eq)(subscriptions.planVersionId, planVersionId), (0, import_drizzle_orm23.eq)(subscriptions.pendingPlanVersionId, planVersionId)));
|
|
3357
3431
|
return rows.length;
|
|
3358
3432
|
}
|
|
3359
3433
|
async countActiveByPlanKey() {
|
|
3360
3434
|
const now = /* @__PURE__ */ new Date();
|
|
3361
3435
|
const rows = await this.db.select({
|
|
3362
3436
|
plan: subscriptions.plan
|
|
3363
|
-
}).from(subscriptions).where((0,
|
|
3364
|
-
(0,
|
|
3365
|
-
(0,
|
|
3437
|
+
}).from(subscriptions).where((0, import_drizzle_orm23.and)((0, import_drizzle_orm23.inArray)(subscriptions.status, ACTIVE_STATUSES), (0, import_drizzle_orm23.or)(
|
|
3438
|
+
(0, import_drizzle_orm23.isNull)(subscriptions.canceledAt),
|
|
3439
|
+
(0, import_drizzle_orm23.gt)(subscriptions.canceledEffectiveAt, now),
|
|
3366
3440
|
// The pre-split row keeps its effective date in the
|
|
3367
3441
|
// first column; reading only the second drops that
|
|
3368
3442
|
// customer on the day they declare rather than the day
|
|
3369
3443
|
// they leave.
|
|
3370
|
-
(0,
|
|
3444
|
+
(0, import_drizzle_orm23.and)((0, import_drizzle_orm23.isNull)(subscriptions.canceledEffectiveAt), (0, import_drizzle_orm23.gt)(subscriptions.canceledAt, now))
|
|
3371
3445
|
)));
|
|
3372
3446
|
const counts = {};
|
|
3373
3447
|
for (const row of rows) {
|
|
@@ -3376,13 +3450,13 @@ var DrizzleSubscriptionRepository = class {
|
|
|
3376
3450
|
return counts;
|
|
3377
3451
|
}
|
|
3378
3452
|
async loadByTenantId(db, tenantId) {
|
|
3379
|
-
const rows = await db.select().from(subscriptions).where((0,
|
|
3453
|
+
const rows = await db.select().from(subscriptions).where((0, import_drizzle_orm23.eq)(subscriptions.tenantId, tenantId)).limit(1);
|
|
3380
3454
|
const row = rows[0];
|
|
3381
3455
|
if (!row) return null;
|
|
3382
3456
|
return this.toRecord(db, row);
|
|
3383
3457
|
}
|
|
3384
3458
|
async toRecord(db, row) {
|
|
3385
|
-
const versionRows = await db.select().from(planVersions).where((0,
|
|
3459
|
+
const versionRows = await db.select().from(planVersions).where((0, import_drizzle_orm23.eq)(planVersions.id, row.planVersionId)).limit(1);
|
|
3386
3460
|
const planVersion = versionRows[0];
|
|
3387
3461
|
if (!planVersion) {
|
|
3388
3462
|
throw new Error(`Subscription ${row.id} references missing PlanVersion ${row.planVersionId}.`);
|
|
@@ -3408,37 +3482,37 @@ var DrizzleSubscriptionRepository = class {
|
|
|
3408
3482
|
};
|
|
3409
3483
|
}
|
|
3410
3484
|
};
|
|
3411
|
-
DrizzleSubscriptionRepository =
|
|
3412
|
-
(0,
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3485
|
+
DrizzleSubscriptionRepository = _ts_decorate25([
|
|
3486
|
+
(0, import_common25.Injectable)(),
|
|
3487
|
+
_ts_param24(0, (0, import_common25.Inject)(DRIZZLE_DB_TOKEN)),
|
|
3488
|
+
_ts_metadata24("design:type", Function),
|
|
3489
|
+
_ts_metadata24("design:paramtypes", [
|
|
3416
3490
|
typeof DrizzleClient === "undefined" ? Object : DrizzleClient
|
|
3417
3491
|
])
|
|
3418
3492
|
], DrizzleSubscriptionRepository);
|
|
3419
3493
|
|
|
3420
3494
|
// src/drizzle-super-admin-bootstrap.adapter.ts
|
|
3421
|
-
var
|
|
3422
|
-
var
|
|
3423
|
-
var
|
|
3424
|
-
var
|
|
3425
|
-
function
|
|
3495
|
+
var import_node_crypto16 = require("node:crypto");
|
|
3496
|
+
var import_common26 = require("@nestjs/common");
|
|
3497
|
+
var import_drizzle_orm24 = require("drizzle-orm");
|
|
3498
|
+
var import_core10 = require("@saasicat/core");
|
|
3499
|
+
function _ts_decorate26(decorators, target, key, desc10) {
|
|
3426
3500
|
var c = arguments.length, r = c < 3 ? target : desc10 === null ? desc10 = Object.getOwnPropertyDescriptor(target, key) : desc10, d;
|
|
3427
3501
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc10);
|
|
3428
3502
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3429
3503
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3430
3504
|
}
|
|
3431
|
-
__name(
|
|
3432
|
-
function
|
|
3505
|
+
__name(_ts_decorate26, "_ts_decorate");
|
|
3506
|
+
function _ts_metadata25(k, v) {
|
|
3433
3507
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3434
3508
|
}
|
|
3435
|
-
__name(
|
|
3436
|
-
function
|
|
3509
|
+
__name(_ts_metadata25, "_ts_metadata");
|
|
3510
|
+
function _ts_param25(paramIndex, decorator) {
|
|
3437
3511
|
return function(target, key) {
|
|
3438
3512
|
decorator(target, key, paramIndex);
|
|
3439
3513
|
};
|
|
3440
3514
|
}
|
|
3441
|
-
__name(
|
|
3515
|
+
__name(_ts_param25, "_ts_param");
|
|
3442
3516
|
var PASSWORD_HASHER_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/adapter-drizzle/PasswordHasher");
|
|
3443
3517
|
var DrizzleSuperAdminBootstrapAdapter = class {
|
|
3444
3518
|
static {
|
|
@@ -3452,18 +3526,18 @@ var DrizzleSuperAdminBootstrapAdapter = class {
|
|
|
3452
3526
|
}
|
|
3453
3527
|
async countSuperAdmins() {
|
|
3454
3528
|
const rows = await this.db.select({
|
|
3455
|
-
value: (0,
|
|
3456
|
-
}).from(superAdminUsers).where((0,
|
|
3529
|
+
value: (0, import_drizzle_orm24.count)()
|
|
3530
|
+
}).from(superAdminUsers).where((0, import_drizzle_orm24.and)((0, import_drizzle_orm24.eq)(superAdminUsers.isActive, true), (0, import_drizzle_orm24.isNull)(superAdminUsers.deletedAt)));
|
|
3457
3531
|
return rows[0]?.value ?? 0;
|
|
3458
3532
|
}
|
|
3459
3533
|
async createSuperAdmin(input) {
|
|
3460
3534
|
const email = input.email.trim().toLowerCase();
|
|
3461
|
-
const existing = await this.db.select().from(superAdminUsers).where((0,
|
|
3535
|
+
const existing = await this.db.select().from(superAdminUsers).where((0, import_drizzle_orm24.eq)(superAdminUsers.email, email)).limit(1);
|
|
3462
3536
|
if (existing[0]) {
|
|
3463
|
-
throw new
|
|
3537
|
+
throw new import_core10.PlatformUserExistsError(email, existing[0].platformRole);
|
|
3464
3538
|
}
|
|
3465
3539
|
const rows = await this.db.insert(superAdminUsers).values({
|
|
3466
|
-
id: (0,
|
|
3540
|
+
id: (0, import_node_crypto16.randomUUID)(),
|
|
3467
3541
|
email,
|
|
3468
3542
|
passwordHash: await this.passwordHasher.hash(input.password),
|
|
3469
3543
|
firstName: input.firstName ?? null,
|
|
@@ -3483,36 +3557,36 @@ var DrizzleSuperAdminBootstrapAdapter = class {
|
|
|
3483
3557
|
};
|
|
3484
3558
|
}
|
|
3485
3559
|
};
|
|
3486
|
-
DrizzleSuperAdminBootstrapAdapter =
|
|
3487
|
-
(0,
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3560
|
+
DrizzleSuperAdminBootstrapAdapter = _ts_decorate26([
|
|
3561
|
+
(0, import_common26.Injectable)(),
|
|
3562
|
+
_ts_param25(0, (0, import_common26.Inject)(DRIZZLE_DB_TOKEN)),
|
|
3563
|
+
_ts_param25(1, (0, import_common26.Inject)(PASSWORD_HASHER_TOKEN)),
|
|
3564
|
+
_ts_metadata25("design:type", Function),
|
|
3565
|
+
_ts_metadata25("design:paramtypes", [
|
|
3492
3566
|
typeof DrizzleClient === "undefined" ? Object : DrizzleClient,
|
|
3493
3567
|
typeof PasswordHasher === "undefined" ? Object : PasswordHasher
|
|
3494
3568
|
])
|
|
3495
3569
|
], DrizzleSuperAdminBootstrapAdapter);
|
|
3496
3570
|
|
|
3497
3571
|
// src/drizzle-transaction-runner.adapter.ts
|
|
3498
|
-
var
|
|
3499
|
-
function
|
|
3572
|
+
var import_common27 = require("@nestjs/common");
|
|
3573
|
+
function _ts_decorate27(decorators, target, key, desc10) {
|
|
3500
3574
|
var c = arguments.length, r = c < 3 ? target : desc10 === null ? desc10 = Object.getOwnPropertyDescriptor(target, key) : desc10, d;
|
|
3501
3575
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc10);
|
|
3502
3576
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3503
3577
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3504
3578
|
}
|
|
3505
|
-
__name(
|
|
3506
|
-
function
|
|
3579
|
+
__name(_ts_decorate27, "_ts_decorate");
|
|
3580
|
+
function _ts_metadata26(k, v) {
|
|
3507
3581
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3508
3582
|
}
|
|
3509
|
-
__name(
|
|
3510
|
-
function
|
|
3583
|
+
__name(_ts_metadata26, "_ts_metadata");
|
|
3584
|
+
function _ts_param26(paramIndex, decorator) {
|
|
3511
3585
|
return function(target, key) {
|
|
3512
3586
|
decorator(target, key, paramIndex);
|
|
3513
3587
|
};
|
|
3514
3588
|
}
|
|
3515
|
-
__name(
|
|
3589
|
+
__name(_ts_param26, "_ts_param");
|
|
3516
3590
|
var DrizzleTransactionRunner = class {
|
|
3517
3591
|
static {
|
|
3518
3592
|
__name(this, "DrizzleTransactionRunner");
|
|
@@ -3525,24 +3599,24 @@ var DrizzleTransactionRunner = class {
|
|
|
3525
3599
|
return this.db.transaction((tx) => fn(tx));
|
|
3526
3600
|
}
|
|
3527
3601
|
};
|
|
3528
|
-
DrizzleTransactionRunner =
|
|
3529
|
-
(0,
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3602
|
+
DrizzleTransactionRunner = _ts_decorate27([
|
|
3603
|
+
(0, import_common27.Injectable)(),
|
|
3604
|
+
_ts_param26(0, (0, import_common27.Inject)(DRIZZLE_DB_TOKEN)),
|
|
3605
|
+
_ts_metadata26("design:type", Function),
|
|
3606
|
+
_ts_metadata26("design:paramtypes", [
|
|
3533
3607
|
typeof DrizzleClient === "undefined" ? Object : DrizzleClient
|
|
3534
3608
|
])
|
|
3535
3609
|
], DrizzleTransactionRunner);
|
|
3536
3610
|
|
|
3537
3611
|
// src/zero-promo-revenue-aggregator.adapter.ts
|
|
3538
|
-
var
|
|
3539
|
-
function
|
|
3612
|
+
var import_common28 = require("@nestjs/common");
|
|
3613
|
+
function _ts_decorate28(decorators, target, key, desc10) {
|
|
3540
3614
|
var c = arguments.length, r = c < 3 ? target : desc10 === null ? desc10 = Object.getOwnPropertyDescriptor(target, key) : desc10, d;
|
|
3541
3615
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc10);
|
|
3542
3616
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3543
3617
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3544
3618
|
}
|
|
3545
|
-
__name(
|
|
3619
|
+
__name(_ts_decorate28, "_ts_decorate");
|
|
3546
3620
|
var ZeroPromoRevenueDeductionAggregator = class {
|
|
3547
3621
|
static {
|
|
3548
3622
|
__name(this, "ZeroPromoRevenueDeductionAggregator");
|
|
@@ -3551,8 +3625,8 @@ var ZeroPromoRevenueDeductionAggregator = class {
|
|
|
3551
3625
|
return "0.00";
|
|
3552
3626
|
}
|
|
3553
3627
|
};
|
|
3554
|
-
ZeroPromoRevenueDeductionAggregator =
|
|
3555
|
-
(0,
|
|
3628
|
+
ZeroPromoRevenueDeductionAggregator = _ts_decorate28([
|
|
3629
|
+
(0, import_common28.Injectable)()
|
|
3556
3630
|
], ZeroPromoRevenueDeductionAggregator);
|
|
3557
3631
|
|
|
3558
3632
|
// src/drizzle-persistence.ts
|
|
@@ -3595,6 +3669,8 @@ function drizzlePersistence(options) {
|
|
|
3595
3669
|
subscriptionContractRepository: provide((client) => new DrizzleSubscriptionContractRepository(client)),
|
|
3596
3670
|
// The party each of those contracts is concluded with.
|
|
3597
3671
|
subscriberRepository: provide((client) => new DrizzleSubscriberRepository(client)),
|
|
3672
|
+
// The charges those contracts give rise to, written once each.
|
|
3673
|
+
subscriberLedgerRepository: provide((client) => new DrizzleSubscriberLedgerRepository(client)),
|
|
3598
3674
|
// The catalogue behind those bookings: entitlement resolves a
|
|
3599
3675
|
// booking's features by reading the pinned version.
|
|
3600
3676
|
bundleRepository: provide((client) => new DrizzleBundleRepository(client, options.bundle))
|
|
@@ -3689,6 +3765,7 @@ __name(buildProvisioning, "buildProvisioning");
|
|
|
3689
3765
|
DrizzlePromoCodeRepository,
|
|
3690
3766
|
DrizzlePromoCodeValidationLogRepository,
|
|
3691
3767
|
DrizzlePromoSubscriptionLookup,
|
|
3768
|
+
DrizzleSubscriberLedgerRepository,
|
|
3692
3769
|
DrizzleSubscriberPaymentMethodRepository,
|
|
3693
3770
|
DrizzleSubscriberRepository,
|
|
3694
3771
|
DrizzleSubscriptionBundleRepository,
|