@saasicat/nest 0.12.1 → 0.13.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/_entries.cjs CHANGED
@@ -2287,11 +2287,11 @@ var EntitlementService = class {
2287
2287
  * have a `SubscriptionRecord` (e.g. within a transaction).
2288
2288
  */
2289
2289
  async deriveLimits(sub, now, tx) {
2290
- const contractLimits = await this.deriveLimitsFromContract(sub.tenantId, now);
2290
+ const contractLimits = await this.deriveLimitsFromContract(sub.tenantId, now, tx);
2291
2291
  if (contractLimits) return this.withReplacedFeatureAliases(contractLimits);
2292
2292
  const effectivePlan = resolveEntitlementPlan(sub, this.resolutionConfig ?? {}, now);
2293
2293
  const planVersion = effectivePlan === sub.plan ? sub.planVersion : await this.findActivePlanVersionOrFallback(effectivePlan, now, tx);
2294
- const subscriptionBundles = await this.loadSubscriptionBundleSnapshots(sub.id, now);
2294
+ const subscriptionBundles = await this.loadSubscriptionBundleSnapshots(sub.id, now, tx);
2295
2295
  return this.withReplacedFeatureAliases(aggregateLimits({
2296
2296
  plan: effectivePlan,
2297
2297
  planVersion,
@@ -2315,9 +2315,9 @@ var EntitlementService = class {
2315
2315
  features: expandReplacedFeatures(limits.features, this.replacedByIndex)
2316
2316
  };
2317
2317
  }
2318
- async deriveLimitsFromContract(tenantId, now) {
2318
+ async deriveLimitsFromContract(tenantId, now, tx) {
2319
2319
  if (!this.subscriptionContracts) return null;
2320
- const contract = await this.subscriptionContracts.findActiveByTenantId(tenantId, now);
2320
+ const contract = await this.subscriptionContracts.findActiveByTenantId(tenantId, now, tx);
2321
2321
  if (!contract) return null;
2322
2322
  if (contract.entitlementSnapshot) {
2323
2323
  return {
@@ -2337,12 +2337,12 @@ var EntitlementService = class {
2337
2337
  * returns an empty list — apps without a bundle schema stay unchanged
2338
2338
  * (plan-only aggregation).
2339
2339
  */
2340
- async loadSubscriptionBundleSnapshots(subscriptionId, now) {
2340
+ async loadSubscriptionBundleSnapshots(subscriptionId, now, tx) {
2341
2341
  if (!this.subscriptionBundles || !this.bundles) return [];
2342
- const active = await this.subscriptionBundles.listActiveBySubscription(subscriptionId, now);
2342
+ const active = await this.subscriptionBundles.listActiveBySubscription(subscriptionId, now, tx);
2343
2343
  if (active.length === 0) return [];
2344
2344
  return Promise.all(active.map(async (booking) => {
2345
- const bv = await this.bundles.findVersionById(booking.bundleVersionId);
2345
+ const bv = await this.bundles.findVersionById(booking.bundleVersionId, tx);
2346
2346
  if (!bv) {
2347
2347
  throw new Error(`BundleVersion '${booking.bundleVersionId}' aus aktiver SubscriptionBundle nicht gefunden`);
2348
2348
  }
@@ -58,7 +58,7 @@ import {
58
58
  periodEndWithMinLead,
59
59
  resolveBundleCancelEffectiveAt,
60
60
  resolveBundlePriceNet
61
- } from "../chunk-F3VV6EXG.js";
61
+ } from "../chunk-DVFPKVLO.js";
62
62
  import "../chunk-E7AJ42AB.js";
63
63
  import "../chunk-2PNX2QL2.js";
64
64
  import {
@@ -80,7 +80,7 @@ import "../chunk-MDIZUVIK.js";
80
80
  import {
81
81
  SUBSCRIPTION_BUNDLE_CONFIG_TOKEN,
82
82
  SUBSCRIPTION_BUNDLE_REPOSITORY_TOKEN
83
- } from "../chunk-GBDUH6DO.js";
83
+ } from "../chunk-2WNM5THV.js";
84
84
  import {
85
85
  PLAN_CATALOG_READ_SINK_TOKEN,
86
86
  PLAN_CATALOG_TOKEN,
@@ -348,11 +348,11 @@ var EntitlementService = class {
348
348
  * have a `SubscriptionRecord` (e.g. within a transaction).
349
349
  */
350
350
  async deriveLimits(sub, now, tx) {
351
- const contractLimits = await this.deriveLimitsFromContract(sub.tenantId, now);
351
+ const contractLimits = await this.deriveLimitsFromContract(sub.tenantId, now, tx);
352
352
  if (contractLimits) return this.withReplacedFeatureAliases(contractLimits);
353
353
  const effectivePlan = resolveEntitlementPlan(sub, this.resolutionConfig ?? {}, now);
354
354
  const planVersion = effectivePlan === sub.plan ? sub.planVersion : await this.findActivePlanVersionOrFallback(effectivePlan, now, tx);
355
- const subscriptionBundles = await this.loadSubscriptionBundleSnapshots(sub.id, now);
355
+ const subscriptionBundles = await this.loadSubscriptionBundleSnapshots(sub.id, now, tx);
356
356
  return this.withReplacedFeatureAliases(aggregateLimits({
357
357
  plan: effectivePlan,
358
358
  planVersion,
@@ -376,9 +376,9 @@ var EntitlementService = class {
376
376
  features: expandReplacedFeatures(limits.features, this.replacedByIndex)
377
377
  };
378
378
  }
379
- async deriveLimitsFromContract(tenantId, now) {
379
+ async deriveLimitsFromContract(tenantId, now, tx) {
380
380
  if (!this.subscriptionContracts) return null;
381
- const contract = await this.subscriptionContracts.findActiveByTenantId(tenantId, now);
381
+ const contract = await this.subscriptionContracts.findActiveByTenantId(tenantId, now, tx);
382
382
  if (!contract) return null;
383
383
  if (contract.entitlementSnapshot) {
384
384
  return {
@@ -398,12 +398,12 @@ var EntitlementService = class {
398
398
  * returns an empty list — apps without a bundle schema stay unchanged
399
399
  * (plan-only aggregation).
400
400
  */
401
- async loadSubscriptionBundleSnapshots(subscriptionId, now) {
401
+ async loadSubscriptionBundleSnapshots(subscriptionId, now, tx) {
402
402
  if (!this.subscriptionBundles || !this.bundles) return [];
403
- const active = await this.subscriptionBundles.listActiveBySubscription(subscriptionId, now);
403
+ const active = await this.subscriptionBundles.listActiveBySubscription(subscriptionId, now, tx);
404
404
  if (active.length === 0) return [];
405
405
  return Promise.all(active.map(async (booking) => {
406
- const bv = await this.bundles.findVersionById(booking.bundleVersionId);
406
+ const bv = await this.bundles.findVersionById(booking.bundleVersionId, tx);
407
407
  if (!bv) {
408
408
  throw new Error(`BundleVersion '${booking.bundleVersionId}' aus aktiver SubscriptionBundle nicht gefunden`);
409
409
  }
@@ -25,7 +25,7 @@ import {
25
25
  SUBSCRIPTION_BUNDLE_REPOSITORY_TOKEN,
26
26
  isLimitExceededError,
27
27
  toEffectiveLimitsSnapshot
28
- } from "./chunk-GBDUH6DO.js";
28
+ } from "./chunk-2WNM5THV.js";
29
29
  import {
30
30
  PLAN_CATALOG_TOKEN,
31
31
  findPlan,
@@ -13,7 +13,7 @@ import {
13
13
  REQUIRE_FEATURE_KEY,
14
14
  SubscriptionBundleModule,
15
15
  TenantBillingModule
16
- } from "./chunk-F3VV6EXG.js";
16
+ } from "./chunk-DVFPKVLO.js";
17
17
  import {
18
18
  CatalogModule
19
19
  } from "./chunk-33TP26MR.js";
@@ -23,7 +23,7 @@ import {
23
23
  import {
24
24
  EntitlementModule,
25
25
  LimitExceededError
26
- } from "./chunk-GBDUH6DO.js";
26
+ } from "./chunk-2WNM5THV.js";
27
27
  import {
28
28
  PLAN_CATALOG_TOKEN,
29
29
  PlanCatalogModule
@@ -16,7 +16,7 @@ import {
16
16
  isLimitExceededError,
17
17
  resolveEntitlementPlan,
18
18
  toEffectiveLimitsSnapshot
19
- } from "../chunk-GBDUH6DO.js";
19
+ } from "../chunk-2WNM5THV.js";
20
20
  import "../chunk-R2QOSVAA.js";
21
21
  import "../chunk-NYLON2VC.js";
22
22
  import {
package/dist/index.js CHANGED
@@ -167,7 +167,7 @@ import {
167
167
  periodEndWithMinLead,
168
168
  resolveBundleCancelEffectiveAt,
169
169
  resolveBundlePriceNet
170
- } from "./chunk-F3VV6EXG.js";
170
+ } from "./chunk-DVFPKVLO.js";
171
171
  import {
172
172
  PROMO_CODE_REDEMPTION_REPOSITORY_TOKEN,
173
173
  PROMO_CODE_REPOSITORY_TOKEN,
@@ -299,7 +299,7 @@ import {
299
299
  isLimitExceededError,
300
300
  resolveEntitlementPlan,
301
301
  toEffectiveLimitsSnapshot
302
- } from "./chunk-GBDUH6DO.js";
302
+ } from "./chunk-2WNM5THV.js";
303
303
  import {
304
304
  PLAN_CATALOG_READ_SINK_TOKEN,
305
305
  PLAN_CATALOG_TOKEN,
@@ -11,7 +11,7 @@ import {
11
11
  SubscriptionPlanResolver,
12
12
  TenantManifestService,
13
13
  buildTenantManifestController
14
- } from "../chunk-PUXLPUVH.js";
14
+ } from "../chunk-J3BMIR4W.js";
15
15
  import {
16
16
  SetupModule,
17
17
  SetupService
@@ -41,7 +41,7 @@ import {
41
41
  SubscriptionBundlesService,
42
42
  TenantAdminGuard,
43
43
  TenantBillingController
44
- } from "../chunk-F3VV6EXG.js";
44
+ } from "../chunk-DVFPKVLO.js";
45
45
  import {
46
46
  PromoCodesService
47
47
  } from "../chunk-E7AJ42AB.js";
@@ -74,7 +74,7 @@ import {
74
74
  } from "../chunk-Z3FWN3HJ.js";
75
75
  import {
76
76
  EntitlementService
77
- } from "../chunk-GBDUH6DO.js";
77
+ } from "../chunk-2WNM5THV.js";
78
78
  import "../chunk-R2QOSVAA.js";
79
79
  import "../chunk-NYLON2VC.js";
80
80
  import "../chunk-WKVBNTYC.js";
@@ -5,10 +5,10 @@ import {
5
5
  StaticEntitlementService,
6
6
  StaticFeatureGuard,
7
7
  StaticPlanResolver
8
- } from "../chunk-PUXLPUVH.js";
8
+ } from "../chunk-J3BMIR4W.js";
9
9
  import "../chunk-IRWZC3GC.js";
10
10
  import "../chunk-FVT7KTUI.js";
11
- import "../chunk-F3VV6EXG.js";
11
+ import "../chunk-DVFPKVLO.js";
12
12
  import "../chunk-E7AJ42AB.js";
13
13
  import "../chunk-2PNX2QL2.js";
14
14
  import "../chunk-33TP26MR.js";
@@ -17,7 +17,7 @@ import "../chunk-E56W4U2P.js";
17
17
  import "../chunk-MDIZUVIK.js";
18
18
  import "../chunk-V34AA7C7.js";
19
19
  import "../chunk-Z3FWN3HJ.js";
20
- import "../chunk-GBDUH6DO.js";
20
+ import "../chunk-2WNM5THV.js";
21
21
  import "../chunk-R2QOSVAA.js";
22
22
  import "../chunk-NYLON2VC.js";
23
23
  import "../chunk-WKVBNTYC.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasicat/nest",
3
- "version": "0.12.1",
3
+ "version": "0.13.0",
4
4
  "description": "NestJS implementation of SaaSiCat: capability discovery, catalog packaging, contracts, entitlement enforcement, billing and admin APIs.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -137,8 +137,8 @@
137
137
  "js-yaml": "^4.1.0",
138
138
  "otplib": "^13.4.1",
139
139
  "qrcode": "^1.5.4",
140
- "@saasicat/spec": "^0.12.1",
141
- "@saasicat/types": "^0.12.1"
140
+ "@saasicat/spec": "^0.13.0",
141
+ "@saasicat/types": "^0.13.0"
142
142
  },
143
143
  "peerDependencies": {
144
144
  "@nestjs/common": "^11.0.0",