@saasicat/nest 0.18.1 → 0.21.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 +1341 -590
- package/dist/admin/index.js +2 -1
- package/dist/billing/index.d.cts +10 -6
- package/dist/billing/index.d.ts +10 -6
- package/dist/billing/index.js +7 -6
- package/dist/catalog/index.js +4 -4
- package/dist/checkout-offer/index.js +2 -2
- package/dist/{chunk-RZVSKKXX.js → chunk-3DRZ5GCP.js} +56 -105
- package/dist/{chunk-GLLCB4BP.js → chunk-4O6R6ARQ.js} +23 -13
- package/dist/{chunk-7RRWI5LH.js → chunk-55QGAZRQ.js} +10 -10
- package/dist/{chunk-Z3FWN3HJ.js → chunk-5ZXBXYXU.js} +3 -3
- package/dist/{chunk-V34AA7C7.js → chunk-6WL6VQ7Z.js} +1 -1
- package/dist/{chunk-ABB2CRAS.js → chunk-74SCJ4HF.js} +1 -1
- package/dist/{chunk-EXOLOJFZ.js → chunk-AGOG5B77.js} +36 -9
- package/dist/{chunk-32EMXPU2.js → chunk-B7NRY2LV.js} +48 -17
- package/dist/{chunk-MDIZUVIK.js → chunk-BSK6YBLI.js} +1 -1
- package/dist/{chunk-R2QOSVAA.js → chunk-DQKCK7DX.js} +1 -1
- package/dist/chunk-EBJJNTW6.js +22 -0
- package/dist/{chunk-PLJEAUFU.js → chunk-FYWLPYBK.js} +79 -39
- package/dist/{chunk-P3DP6GJE.js → chunk-GC5AKN44.js} +487 -160
- package/dist/{chunk-5KH2O4SF.js → chunk-NZLAYCEX.js} +286 -110
- package/dist/{chunk-E7AJ42AB.js → chunk-VQQWF7MW.js} +172 -28
- package/dist/{chunk-GJBXOCRZ.js → chunk-XTVAFJ3P.js} +46 -17
- package/dist/{chunk-BOADBIGB.js → chunk-YYUXKLXK.js} +2 -2
- package/dist/{chunk-YITTE646.js → chunk-ZH5PYEMI.js} +41 -23
- package/dist/{define-saasicat-Rc0rXrYG.d.ts → define-saasicat-B20Ms8UC.d.ts} +1 -1
- package/dist/{define-saasicat-CeDBX9ji.d.cts → define-saasicat-Cf9DpEsY.d.cts} +1 -1
- package/dist/discovery/index.d.cts +2 -2
- package/dist/discovery/index.d.ts +2 -2
- package/dist/discovery/index.js +4 -4
- package/dist/{enforce-quota.interceptor-CmbWX39L.d.ts → enforce-quota.interceptor-CUyfR4cQ.d.ts} +1 -1
- package/dist/{enforce-quota.interceptor-DMw-bPyk.d.cts → enforce-quota.interceptor-Dtg5WdFj.d.cts} +1 -1
- package/dist/entitlement/index.js +3 -2
- package/dist/index.d.cts +27 -8
- package/dist/index.d.ts +27 -8
- package/dist/index.js +21 -17
- package/dist/{module-DgYJur6f.d.ts → module-BE17XFLg.d.ts} +1 -1
- package/dist/{module-CSN8j8Tp.d.cts → module-CHMIyWlf.d.cts} +1 -1
- package/dist/platform/index.d.cts +8 -8
- package/dist/platform/index.d.ts +8 -8
- package/dist/platform/index.js +14 -13
- package/dist/promo/index.d.cts +3 -3
- package/dist/promo/index.d.ts +3 -3
- package/dist/promo/index.js +4 -3
- package/dist/registration/index.js +2 -1
- package/dist/{saas-platform.module-D3rUTiho.d.cts → saas-platform.module-BfaYfL-G.d.cts} +1 -1
- package/dist/{saas-platform.module-DLhoqKNA.d.ts → saas-platform.module-DChhDrR-.d.ts} +1 -1
- package/dist/{service-DX8KbGXl.d.cts → service-D48clObR.d.cts} +3 -3
- package/dist/{service-DX8KbGXl.d.ts → service-D48clObR.d.ts} +3 -3
- package/dist/subscription-contract/index.js +2 -2
- package/dist/{tenant-billing.controller-CG4CaFUP.d.cts → tenant-billing.controller-BIF-mstX.d.cts} +2 -2
- package/dist/{tenant-billing.controller-BwZRnJ3q.d.ts → tenant-billing.controller-DT5UrnDX.d.ts} +2 -2
- package/dist/testing/index.d.cts +5 -5
- package/dist/testing/index.d.ts +5 -5
- package/dist/testing/index.js +34 -33
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PromoCodeRepository, PromoCodeRedemptionRepository, PromoCodeValidationLogRepository, FirstTimeCustomerCheck, PromoSubscriptionLookup, PromoRevenueDeductionAggregator, TransactionRunner, PlanCatalog, CreatePromoCodeData, PromoCodeRecord, UpdatePromoCodeData, PromoCodeFilter, PromoCodeRedemptionListItem, BillingCycle, PromoCodeRedemptionRecord, TransactionContext } from '@saasicat/types';
|
|
1
|
+
import { PromoCodeRepository, PromoCodeRedemptionRepository, PromoCodeValidationLogRepository, FirstTimeCustomerCheck, PromoSubscriptionLookup, PromoRevenueDeductionAggregator, TransactionRunner, PlanCatalog, CreatePromoCodeData, PromoCodeRecord, UpdatePromoCodeData, PromoCodeFilter, PromoCodeRedemptionListItem, BillingCycle, PromoPreviewInvalidReason, PromoCodeRedemptionRecord, TransactionContext } from '@saasicat/types';
|
|
2
2
|
|
|
3
|
-
type PreviewReason =
|
|
3
|
+
type PreviewReason = PromoPreviewInvalidReason;
|
|
4
4
|
type PreviewInvalid = {
|
|
5
5
|
valid: false;
|
|
6
6
|
reason: PreviewReason;
|
|
@@ -106,4 +106,4 @@ declare class PromoCodesService {
|
|
|
106
106
|
private lowestApplicablePlanGross;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
export { type
|
|
109
|
+
export { type PromoServiceConfig as P, type RedeemInput as R, type PreviewInput as a, type PreviewInvalid as b, type PreviewReason as c, type PreviewResult as d, type PreviewValid as e, type PromoCodeStats as f, PromoCodesService as g };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PromoCodeRepository, PromoCodeRedemptionRepository, PromoCodeValidationLogRepository, FirstTimeCustomerCheck, PromoSubscriptionLookup, PromoRevenueDeductionAggregator, TransactionRunner, PlanCatalog, CreatePromoCodeData, PromoCodeRecord, UpdatePromoCodeData, PromoCodeFilter, PromoCodeRedemptionListItem, BillingCycle, PromoCodeRedemptionRecord, TransactionContext } from '@saasicat/types';
|
|
1
|
+
import { PromoCodeRepository, PromoCodeRedemptionRepository, PromoCodeValidationLogRepository, FirstTimeCustomerCheck, PromoSubscriptionLookup, PromoRevenueDeductionAggregator, TransactionRunner, PlanCatalog, CreatePromoCodeData, PromoCodeRecord, UpdatePromoCodeData, PromoCodeFilter, PromoCodeRedemptionListItem, BillingCycle, PromoPreviewInvalidReason, PromoCodeRedemptionRecord, TransactionContext } from '@saasicat/types';
|
|
2
2
|
|
|
3
|
-
type PreviewReason =
|
|
3
|
+
type PreviewReason = PromoPreviewInvalidReason;
|
|
4
4
|
type PreviewInvalid = {
|
|
5
5
|
valid: false;
|
|
6
6
|
reason: PreviewReason;
|
|
@@ -106,4 +106,4 @@ declare class PromoCodesService {
|
|
|
106
106
|
private lowestApplicablePlanGross;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
export { type
|
|
109
|
+
export { type PromoServiceConfig as P, type RedeemInput as R, type PreviewInput as a, type PreviewInvalid as b, type PreviewReason as c, type PreviewResult as d, type PreviewValid as e, type PromoCodeStats as f, PromoCodesService as g };
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
contractLineItemToInvoiceLineItem,
|
|
5
5
|
sortContractLineItemsForInvoice,
|
|
6
6
|
subscriptionContractToInvoiceSnapshot
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-B7NRY2LV.js";
|
|
8
|
+
import "../chunk-BSK6YBLI.js";
|
|
9
9
|
import {
|
|
10
10
|
SUBSCRIPTION_CONTRACT_REPOSITORY_TOKEN
|
|
11
11
|
} from "../chunk-NYLON2VC.js";
|
package/dist/{tenant-billing.controller-CG4CaFUP.d.cts → tenant-billing.controller-BIF-mstX.d.cts}
RENAMED
|
@@ -2,7 +2,7 @@ import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
|
2
2
|
import { b as AuthGuardList, m as SelfServiceBlockedPlans, w as TrialProjectionPort, h as PendingPlanQueryPort, f as ContractFreezePort, l as SelfServiceBlockedBundles, u as TenantIdResolver, B as UserIdResolver, z as UserEmailResolver, a as AuditContextResolver } from './subscription-bundles.module-DCpV-Pb5.cjs';
|
|
3
3
|
import { PlanCatalog, SubscriptionUsagePort, UsageSnapshotPort, TenantSubscriptionWritePort, SubscriptionBundleRepository, BundleRepository, SubscriptionBundleView, SubscriptionBundleRecord, PlanRepository, CatalogEntryRepository, BundleVersionRow, SubscriptionUsageRecord, OnboardingSelectionResponse } from '@saasicat/types';
|
|
4
4
|
import { c as EntitlementService, a as EffectiveLimitsSnapshot, t as toEffectiveLimitsSnapshot } from './aggregation-SKfXu09x.cjs';
|
|
5
|
-
import {
|
|
5
|
+
import { g as PromoCodesService } from './service-D48clObR.cjs';
|
|
6
6
|
import { A as AdminAuditService } from './admin-audit.service-9IqXMlZm.cjs';
|
|
7
7
|
|
|
8
8
|
declare class ComposedTenantAuthGuard implements CanActivate {
|
|
@@ -71,7 +71,7 @@ interface PlanChangePreviewDto {
|
|
|
71
71
|
* Projected new trial end after the change (app trial logic, e.g.
|
|
72
72
|
* carry-over of the remaining time). `null` if no TrialProjectionPort is
|
|
73
73
|
* configured, the subscription is not in a trial, or nothing changes.
|
|
74
|
-
* The wizard uses this to show "
|
|
74
|
+
* The wizard uses this to show "regular from the end of the trial".
|
|
75
75
|
*/
|
|
76
76
|
projectedTrialEndsAt: Date | null;
|
|
77
77
|
proration: ProrationDto | null;
|
package/dist/{tenant-billing.controller-BwZRnJ3q.d.ts → tenant-billing.controller-DT5UrnDX.d.ts}
RENAMED
|
@@ -2,7 +2,7 @@ import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
|
2
2
|
import { b as AuthGuardList, m as SelfServiceBlockedPlans, w as TrialProjectionPort, h as PendingPlanQueryPort, f as ContractFreezePort, l as SelfServiceBlockedBundles, u as TenantIdResolver, B as UserIdResolver, z as UserEmailResolver, a as AuditContextResolver } from './subscription-bundles.module-BQmoozm5.js';
|
|
3
3
|
import { PlanCatalog, SubscriptionUsagePort, UsageSnapshotPort, TenantSubscriptionWritePort, SubscriptionBundleRepository, BundleRepository, SubscriptionBundleView, SubscriptionBundleRecord, PlanRepository, CatalogEntryRepository, BundleVersionRow, SubscriptionUsageRecord, OnboardingSelectionResponse } from '@saasicat/types';
|
|
4
4
|
import { c as EntitlementService, a as EffectiveLimitsSnapshot, t as toEffectiveLimitsSnapshot } from './aggregation-o0LMenvl.js';
|
|
5
|
-
import {
|
|
5
|
+
import { g as PromoCodesService } from './service-D48clObR.js';
|
|
6
6
|
import { A as AdminAuditService } from './admin-audit.service-9IqXMlZm.js';
|
|
7
7
|
|
|
8
8
|
declare class ComposedTenantAuthGuard implements CanActivate {
|
|
@@ -71,7 +71,7 @@ interface PlanChangePreviewDto {
|
|
|
71
71
|
* Projected new trial end after the change (app trial logic, e.g.
|
|
72
72
|
* carry-over of the remaining time). `null` if no TrialProjectionPort is
|
|
73
73
|
* configured, the subscription is not in a trial, or nothing changes.
|
|
74
|
-
* The wizard uses this to show "
|
|
74
|
+
* The wizard uses this to show "regular from the end of the trial".
|
|
75
75
|
*/
|
|
76
76
|
projectedTrialEndsAt: Date | null;
|
|
77
77
|
proration: ProrationDto | null;
|
package/dist/testing/index.d.cts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { BundleRepository, BundleRow, BundleVersionRow, BundleListFilter, CreateBundleData, UpdateBundleData, CreateBundleVersionDraftData, UpdateBundleVersionDraftData, VersionChange, MarketingProjectionRepository, MarketingProjectionRow, MarketingProjectionFilter, CreateMarketingProjectionData, UpdateMarketingProjectionData, PlanRepository, PlanRow, PlanVersionRow, PlanListFilter, CreatePlanData, UpdatePlanData, CreatePlanVersionDraftData, UpdatePlanVersionDraftData, PlanVersionRepository, PlanVersionRecord, TransactionContext, SubscriptionBundleRepository, SubscriptionBundleRecord, CreateSubscriptionBundleData, CancelSubscriptionBundleData, SubscriptionContractRepository, SubscriptionContractFilter, SubscriptionContractRecord, CreateSubscriptionContractData, TerminateSubscriptionContractData, SubscriptionRepository, SubscriptionRecord, TransactionRunner, PlanCatalog, QuotaProvider } from '@saasicat/types';
|
|
2
2
|
import { Type, DynamicModule } from '@nestjs/common';
|
|
3
|
-
import { a as SaasPlatformAdapters } from '../saas-platform.module-
|
|
4
|
-
export { P as PLAN_RESOLVER_PORT_TOKEN, o as StaticPlanResolver } from '../saas-platform.module-
|
|
5
|
-
export { E as EnforceQuotaInterceptor, S as StaticEntitlementService, a as StaticFeatureGuard } from '../enforce-quota.interceptor-
|
|
3
|
+
import { a as SaasPlatformAdapters } from '../saas-platform.module-BfaYfL-G.cjs';
|
|
4
|
+
export { P as PLAN_RESOLVER_PORT_TOKEN, o as StaticPlanResolver } from '../saas-platform.module-BfaYfL-G.cjs';
|
|
5
|
+
export { E as EnforceQuotaInterceptor, S as StaticEntitlementService, a as StaticFeatureGuard } from '../enforce-quota.interceptor-Dtg5WdFj.cjs';
|
|
6
6
|
import '../di-CcNeq9v-.cjs';
|
|
7
7
|
import '../admin-resources.module-DGgGSdzN.cjs';
|
|
8
8
|
import '../admin-audit.service-9IqXMlZm.cjs';
|
|
9
9
|
import '../plan-resolution-CFCoUkrE.cjs';
|
|
10
10
|
import '../subscription-contract.module-B2uNvUJL.cjs';
|
|
11
|
-
import '../module-
|
|
12
|
-
import '../service-
|
|
11
|
+
import '../module-CHMIyWlf.cjs';
|
|
12
|
+
import '../service-D48clObR.cjs';
|
|
13
13
|
import '../discovery.scanner-DLgEvuoy.cjs';
|
|
14
14
|
import '@nestjs/core';
|
|
15
15
|
import '../catalog.module-Dw2Hrbyu.cjs';
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { BundleRepository, BundleRow, BundleVersionRow, BundleListFilter, CreateBundleData, UpdateBundleData, CreateBundleVersionDraftData, UpdateBundleVersionDraftData, VersionChange, MarketingProjectionRepository, MarketingProjectionRow, MarketingProjectionFilter, CreateMarketingProjectionData, UpdateMarketingProjectionData, PlanRepository, PlanRow, PlanVersionRow, PlanListFilter, CreatePlanData, UpdatePlanData, CreatePlanVersionDraftData, UpdatePlanVersionDraftData, PlanVersionRepository, PlanVersionRecord, TransactionContext, SubscriptionBundleRepository, SubscriptionBundleRecord, CreateSubscriptionBundleData, CancelSubscriptionBundleData, SubscriptionContractRepository, SubscriptionContractFilter, SubscriptionContractRecord, CreateSubscriptionContractData, TerminateSubscriptionContractData, SubscriptionRepository, SubscriptionRecord, TransactionRunner, PlanCatalog, QuotaProvider } from '@saasicat/types';
|
|
2
2
|
import { Type, DynamicModule } from '@nestjs/common';
|
|
3
|
-
import { a as SaasPlatformAdapters } from '../saas-platform.module-
|
|
4
|
-
export { P as PLAN_RESOLVER_PORT_TOKEN, o as StaticPlanResolver } from '../saas-platform.module-
|
|
5
|
-
export { E as EnforceQuotaInterceptor, S as StaticEntitlementService, a as StaticFeatureGuard } from '../enforce-quota.interceptor-
|
|
3
|
+
import { a as SaasPlatformAdapters } from '../saas-platform.module-DChhDrR-.js';
|
|
4
|
+
export { P as PLAN_RESOLVER_PORT_TOKEN, o as StaticPlanResolver } from '../saas-platform.module-DChhDrR-.js';
|
|
5
|
+
export { E as EnforceQuotaInterceptor, S as StaticEntitlementService, a as StaticFeatureGuard } from '../enforce-quota.interceptor-CUyfR4cQ.js';
|
|
6
6
|
import '../di-CcNeq9v-.js';
|
|
7
7
|
import '../admin-resources.module-BY5r_1MG.js';
|
|
8
8
|
import '../admin-audit.service-9IqXMlZm.js';
|
|
9
9
|
import '../plan-resolution-CFCoUkrE.js';
|
|
10
10
|
import '../subscription-contract.module-edyhBr4n.js';
|
|
11
|
-
import '../module-
|
|
12
|
-
import '../service-
|
|
11
|
+
import '../module-BE17XFLg.js';
|
|
12
|
+
import '../service-D48clObR.js';
|
|
13
13
|
import '../discovery.scanner-DLgEvuoy.js';
|
|
14
14
|
import '@nestjs/core';
|
|
15
15
|
import '../catalog.module-BKObceo0.js';
|
package/dist/testing/index.js
CHANGED
|
@@ -5,23 +5,24 @@ import {
|
|
|
5
5
|
StaticEntitlementService,
|
|
6
6
|
StaticFeatureGuard,
|
|
7
7
|
StaticPlanResolver
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-ZH5PYEMI.js";
|
|
9
|
+
import "../chunk-4O6R6ARQ.js";
|
|
10
|
+
import "../chunk-FYWLPYBK.js";
|
|
11
|
+
import "../chunk-NZLAYCEX.js";
|
|
12
|
+
import "../chunk-VQQWF7MW.js";
|
|
13
|
+
import "../chunk-B7NRY2LV.js";
|
|
14
|
+
import "../chunk-GC5AKN44.js";
|
|
15
15
|
import "../chunk-WPUVJRIN.js";
|
|
16
16
|
import "../chunk-E56W4U2P.js";
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-XTVAFJ3P.js";
|
|
18
|
+
import "../chunk-BSK6YBLI.js";
|
|
19
19
|
import "../chunk-YSC46BGM.js";
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-6WL6VQ7Z.js";
|
|
21
|
+
import "../chunk-5ZXBXYXU.js";
|
|
22
|
+
import "../chunk-AGOG5B77.js";
|
|
23
|
+
import "../chunk-DQKCK7DX.js";
|
|
24
24
|
import "../chunk-NYLON2VC.js";
|
|
25
|
+
import "../chunk-EBJJNTW6.js";
|
|
25
26
|
import "../chunk-WKVBNTYC.js";
|
|
26
27
|
import "../chunk-L4KTQ6CL.js";
|
|
27
28
|
import "../chunk-SABTXESR.js";
|
|
@@ -122,10 +123,10 @@ var FakeSubscriptionBundleRepository = class {
|
|
|
122
123
|
async cancel(subscriptionBundleId, data) {
|
|
123
124
|
const existing = this.byId.get(subscriptionBundleId);
|
|
124
125
|
if (!existing) {
|
|
125
|
-
throw new Error(`SubscriptionBundle '${subscriptionBundleId}'
|
|
126
|
+
throw new Error(`SubscriptionBundle '${subscriptionBundleId}' not found`);
|
|
126
127
|
}
|
|
127
128
|
if (existing.canceledAt !== null) {
|
|
128
|
-
throw new Error(`SubscriptionBundle '${subscriptionBundleId}'
|
|
129
|
+
throw new Error(`SubscriptionBundle '${subscriptionBundleId}' is already cancelled`);
|
|
129
130
|
}
|
|
130
131
|
const updated = {
|
|
131
132
|
...existing,
|
|
@@ -139,7 +140,7 @@ var FakeSubscriptionBundleRepository = class {
|
|
|
139
140
|
async reactivate(subscriptionBundleId) {
|
|
140
141
|
const existing = this.byId.get(subscriptionBundleId);
|
|
141
142
|
if (!existing) {
|
|
142
|
-
throw new Error(`SubscriptionBundle '${subscriptionBundleId}'
|
|
143
|
+
throw new Error(`SubscriptionBundle '${subscriptionBundleId}' not found`);
|
|
143
144
|
}
|
|
144
145
|
const updated = {
|
|
145
146
|
...existing,
|
|
@@ -249,7 +250,7 @@ var FakeSubscriptionContractRepository = class {
|
|
|
249
250
|
}
|
|
250
251
|
async terminate(contractId, data) {
|
|
251
252
|
const existing = this.byId.get(contractId);
|
|
252
|
-
if (!existing) throw new Error(`SubscriptionContract '${contractId}'
|
|
253
|
+
if (!existing) throw new Error(`SubscriptionContract '${contractId}' not found`);
|
|
253
254
|
const updated = {
|
|
254
255
|
...existing,
|
|
255
256
|
status: data.status,
|
|
@@ -409,7 +410,7 @@ var FakeBundleRepository = class {
|
|
|
409
410
|
}
|
|
410
411
|
async update(bundleId, data) {
|
|
411
412
|
const existing = this.bundles.get(bundleId);
|
|
412
|
-
if (!existing) throw new Error(`Bundle '${bundleId}'
|
|
413
|
+
if (!existing) throw new Error(`Bundle '${bundleId}' not found`);
|
|
413
414
|
const updated = {
|
|
414
415
|
...existing,
|
|
415
416
|
label: data.label ?? existing.label,
|
|
@@ -424,7 +425,7 @@ var FakeBundleRepository = class {
|
|
|
424
425
|
}
|
|
425
426
|
async softDelete(bundleId) {
|
|
426
427
|
const existing = this.bundles.get(bundleId);
|
|
427
|
-
if (!existing) throw new Error(`Bundle '${bundleId}'
|
|
428
|
+
if (!existing) throw new Error(`Bundle '${bundleId}' not found`);
|
|
428
429
|
this.bundles.set(bundleId, {
|
|
429
430
|
...existing,
|
|
430
431
|
deletedAt: this.nowIso()
|
|
@@ -456,7 +457,7 @@ var FakeBundleRepository = class {
|
|
|
456
457
|
async createDraft(data) {
|
|
457
458
|
const draft = await this.findCurrentDraft(data.bundleId);
|
|
458
459
|
if (draft) {
|
|
459
|
-
throw new Error(`Bundle '${data.bundleId}'
|
|
460
|
+
throw new Error(`Bundle '${data.bundleId}' already has a draft version v${draft.version}`);
|
|
460
461
|
}
|
|
461
462
|
const all = await this.listVersions(data.bundleId);
|
|
462
463
|
const nextVersion = all.length === 0 ? 1 : Math.max(...all.map((v) => v.version)) + 1;
|
|
@@ -492,7 +493,7 @@ var FakeBundleRepository = class {
|
|
|
492
493
|
}
|
|
493
494
|
async updateDraft(versionId, data) {
|
|
494
495
|
const existing = this.versions.get(versionId);
|
|
495
|
-
if (!existing) throw new Error(`BundleVersion '${versionId}'
|
|
496
|
+
if (!existing) throw new Error(`BundleVersion '${versionId}' not found`);
|
|
496
497
|
const updated = {
|
|
497
498
|
...existing,
|
|
498
499
|
features: data.features ?? existing.features,
|
|
@@ -514,15 +515,15 @@ var FakeBundleRepository = class {
|
|
|
514
515
|
const existing = this.versions.get(versionId);
|
|
515
516
|
if (!existing) return;
|
|
516
517
|
if (existing.publishedAt !== null) {
|
|
517
|
-
throw new Error(`BundleVersion '${versionId}'
|
|
518
|
+
throw new Error(`BundleVersion '${versionId}' is already published`);
|
|
518
519
|
}
|
|
519
520
|
this.versions.delete(versionId);
|
|
520
521
|
}
|
|
521
522
|
async publishDraft(versionId, publishMeta) {
|
|
522
523
|
const draft = this.versions.get(versionId);
|
|
523
|
-
if (!draft) throw new Error(`BundleVersion '${versionId}'
|
|
524
|
+
if (!draft) throw new Error(`BundleVersion '${versionId}' not found`);
|
|
524
525
|
if (draft.publishedAt !== null) {
|
|
525
|
-
throw new Error(`BundleVersion '${versionId}'
|
|
526
|
+
throw new Error(`BundleVersion '${versionId}' is already published`);
|
|
526
527
|
}
|
|
527
528
|
const now = this.nowIso();
|
|
528
529
|
const validFromIso = publishMeta.validFrom.toISOString();
|
|
@@ -598,7 +599,7 @@ var FakeMarketingProjectionRepository = class {
|
|
|
598
599
|
const locale = data.locale ?? "de";
|
|
599
600
|
const existing = await this.findByTarget(data.targetType, data.targetVersionId, locale);
|
|
600
601
|
if (existing) {
|
|
601
|
-
throw new Error(`
|
|
602
|
+
throw new Error(`Marketing projection for ${data.targetType}/${data.targetVersionId}/${locale} already exists`);
|
|
602
603
|
}
|
|
603
604
|
const now = this.nowIso();
|
|
604
605
|
const row = {
|
|
@@ -626,7 +627,7 @@ var FakeMarketingProjectionRepository = class {
|
|
|
626
627
|
}
|
|
627
628
|
async update(id, data) {
|
|
628
629
|
const existing = this.rows.get(id);
|
|
629
|
-
if (!existing) throw new Error(`MarketingProjection '${id}'
|
|
630
|
+
if (!existing) throw new Error(`MarketingProjection '${id}' not found`);
|
|
630
631
|
const updated = {
|
|
631
632
|
...existing,
|
|
632
633
|
displayLabel: data.displayLabel ?? existing.displayLabel,
|
|
@@ -646,7 +647,7 @@ var FakeMarketingProjectionRepository = class {
|
|
|
646
647
|
return updated;
|
|
647
648
|
}
|
|
648
649
|
async delete(id) {
|
|
649
|
-
if (!this.rows.has(id)) throw new Error(`MarketingProjection '${id}'
|
|
650
|
+
if (!this.rows.has(id)) throw new Error(`MarketingProjection '${id}' not found`);
|
|
650
651
|
this.rows.delete(id);
|
|
651
652
|
}
|
|
652
653
|
};
|
|
@@ -720,7 +721,7 @@ var FakePlanRepository = class {
|
|
|
720
721
|
}
|
|
721
722
|
async update(planId, data) {
|
|
722
723
|
const existing = this.plans.get(planId);
|
|
723
|
-
if (!existing) throw new Error(`Plan '${planId}'
|
|
724
|
+
if (!existing) throw new Error(`Plan '${planId}' not found`);
|
|
724
725
|
const updated = {
|
|
725
726
|
...existing,
|
|
726
727
|
label: data.label ?? existing.label,
|
|
@@ -734,7 +735,7 @@ var FakePlanRepository = class {
|
|
|
734
735
|
}
|
|
735
736
|
async softDelete(planId) {
|
|
736
737
|
const existing = this.plans.get(planId);
|
|
737
|
-
if (!existing) throw new Error(`Plan '${planId}'
|
|
738
|
+
if (!existing) throw new Error(`Plan '${planId}' not found`);
|
|
738
739
|
const updated = {
|
|
739
740
|
...existing,
|
|
740
741
|
deletedAt: this.nowIso(),
|
|
@@ -851,7 +852,7 @@ var FakePlanRepository = class {
|
|
|
851
852
|
}
|
|
852
853
|
async updatePlanVersionDraft(versionId, data) {
|
|
853
854
|
const existing = this.versions.get(versionId);
|
|
854
|
-
if (!existing) throw new Error(`PlanVersion '${versionId}'
|
|
855
|
+
if (!existing) throw new Error(`PlanVersion '${versionId}' not found`);
|
|
855
856
|
const updated = {
|
|
856
857
|
...existing,
|
|
857
858
|
features: data.features ?? existing.features,
|
|
@@ -868,7 +869,7 @@ var FakePlanRepository = class {
|
|
|
868
869
|
}
|
|
869
870
|
async publishPlanVersionDraft(versionId, publishMeta) {
|
|
870
871
|
const draft = this.versions.get(versionId);
|
|
871
|
-
if (!draft) throw new Error(`PlanVersion '${versionId}'
|
|
872
|
+
if (!draft) throw new Error(`PlanVersion '${versionId}' not found`);
|
|
872
873
|
const planKey = draft.planId;
|
|
873
874
|
const now = this.nowIso();
|
|
874
875
|
const dayMs = 24 * 60 * 60 * 1e3;
|
|
@@ -900,14 +901,14 @@ var FakePlanRepository = class {
|
|
|
900
901
|
const existing = this.versions.get(versionId);
|
|
901
902
|
if (!existing) return;
|
|
902
903
|
if (existing.publishedAt !== null) {
|
|
903
|
-
throw new Error(`FakePlanRepository:
|
|
904
|
+
throw new Error(`FakePlanRepository: plan version '${versionId}' is already published \u2014 discard is not allowed`);
|
|
904
905
|
}
|
|
905
906
|
this.versions.delete(versionId);
|
|
906
907
|
}
|
|
907
908
|
async terminate(versionId, endsAt) {
|
|
908
909
|
const existing = this.versions.get(versionId);
|
|
909
910
|
if (!existing) {
|
|
910
|
-
throw new Error(`FakePlanRepository: PlanVersion '${versionId}'
|
|
911
|
+
throw new Error(`FakePlanRepository: PlanVersion '${versionId}' not found`);
|
|
911
912
|
}
|
|
912
913
|
const updated = {
|
|
913
914
|
...existing,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saasicat/nest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.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.3.1",
|
|
138
138
|
"otplib": "^13.4.1",
|
|
139
139
|
"qrcode": "^1.5.4",
|
|
140
|
-
"@saasicat/spec": "^0.
|
|
141
|
-
"@saasicat/types": "^0.
|
|
140
|
+
"@saasicat/spec": "^0.21.0",
|
|
141
|
+
"@saasicat/types": "^0.21.0"
|
|
142
142
|
},
|
|
143
143
|
"peerDependencies": {
|
|
144
144
|
"@nestjs/common": "^11.0.0",
|