@saasicat/nest 1.0.0-rc.2 → 1.0.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -8
- package/dist/.build-stamp +1 -1
- package/dist/_entries.cjs +10214 -4796
- package/dist/admin/index.d.cts +5 -4
- package/dist/admin/index.d.ts +5 -4
- package/dist/admin/index.js +13 -9
- package/dist/{admin-resources.module-CpvzcfCc.d.cts → admin-resources.module-B4XNvdH-.d.cts} +1 -2
- package/dist/{admin-resources.module-DF5_Q7RD.d.ts → admin-resources.module-CWqdI9BV.d.ts} +1 -2
- package/dist/{admin-stats.service-TYiSUwIR.d.ts → admin-stats.service-CsLNt19Z.d.ts} +11 -7
- package/dist/{admin-stats.service-DfKupywR.d.cts → admin-stats.service-DrZrU8IJ.d.cts} +11 -7
- package/dist/{aggregation-B3CD0v_d.d.cts → aggregation-ChpZDh0g.d.ts} +39 -6
- package/dist/{aggregation-BFzW07DE.d.ts → aggregation-OpnhwzF5.d.cts} +39 -6
- package/dist/billing/index.d.cts +448 -108
- package/dist/billing/index.d.ts +448 -108
- package/dist/billing/index.js +108 -41
- package/dist/catalog/index.d.cts +74 -45
- package/dist/catalog/index.d.ts +74 -45
- package/dist/catalog/index.js +21 -13
- package/dist/catalog.module-C9O7BxRq.d.ts +180 -0
- package/dist/catalog.module-T-I5Ricz.d.cts +180 -0
- package/dist/checkout-offer/index.d.cts +17 -22
- package/dist/checkout-offer/index.d.ts +17 -22
- package/dist/checkout-offer/index.js +21 -7
- package/dist/checkout-offer.module-DFhGy6JO.d.cts +58 -0
- package/dist/checkout-offer.module-x7SP_dX4.d.ts +58 -0
- package/dist/checkout-offer.service-BeHgYikI.d.ts +242 -0
- package/dist/checkout-offer.service-CCVxG9b2.d.cts +242 -0
- package/dist/chunk-34XVPR6P.js +222 -0
- package/dist/{chunk-AOQJEYOL.js → chunk-3QVGA6JX.js} +3 -1
- package/dist/chunk-3RLWML2S.js +896 -0
- package/dist/{chunk-TXC3LHHB.js → chunk-4SDSYV4A.js} +21 -13
- package/dist/chunk-55QEDAMX.js +946 -0
- package/dist/chunk-5CKC7O52.js +140 -0
- package/dist/chunk-6PJE7EWO.js +185 -0
- package/dist/chunk-7NJKVC5X.js +353 -0
- package/dist/{chunk-RUNZ3X4C.js → chunk-AOS2JPDD.js} +1263 -185
- package/dist/{chunk-WOVQPXV4.js → chunk-CQ2ZZMTD.js} +702 -725
- package/dist/{chunk-NA6O63B7.js → chunk-F5X66HF5.js} +5 -5
- package/dist/chunk-FEQZCWUL.js +174 -0
- package/dist/{chunk-VIJ5NJWC.js → chunk-G6EZWECL.js} +107 -31
- package/dist/chunk-G7RQO2XO.js +0 -0
- package/dist/{chunk-N3L3AICU.js → chunk-GPQWGA6B.js} +5 -6
- package/dist/chunk-GZTL64QK.js +7 -0
- package/dist/{chunk-SABTXESR.js → chunk-J7NJRK3K.js} +17 -1
- package/dist/{chunk-SEPN52AD.js → chunk-JBCC6C3M.js} +566 -307
- package/dist/{chunk-I7GTA3RX.js → chunk-JQRA724W.js} +1 -1
- package/dist/{chunk-WXYJHZCN.js → chunk-JVAEKTJ4.js} +2 -14
- package/dist/chunk-KPEMTBOP.js +26 -0
- package/dist/chunk-LF6J4YYN.js +301 -0
- package/dist/{chunk-LTT736P3.js → chunk-LLYVYRGJ.js} +228 -387
- package/dist/{chunk-6Z7JR4EW.js → chunk-M47BNEY2.js} +1897 -633
- package/dist/{chunk-KFT5AIIH.js → chunk-NDLC5GYK.js} +206 -24
- package/dist/{chunk-O2J2HDXA.js → chunk-OOTEXP47.js} +3 -8
- package/dist/chunk-QPVDCKYS.js +702 -0
- package/dist/{chunk-NHVDCYK5.js → chunk-R5YCJBHY.js} +71 -106
- package/dist/{chunk-XBYAFEOR.js → chunk-S33SO5XX.js} +1 -1
- package/dist/chunk-SZ7RFPXA.js +10 -0
- package/dist/chunk-TBBZWZQT.js +98 -0
- package/dist/chunk-TOEFN7DN.js +295 -0
- package/dist/{chunk-7ZEGFL42.js → chunk-WHJSYKNC.js} +6 -6
- package/dist/chunk-WOEJ6K7M.js +55 -0
- package/dist/{chunk-AU3OOREM.js → chunk-XSSWYPP5.js} +16 -3
- package/dist/contract-line-item-money-B0Z3Ogur.d.cts +43 -0
- package/dist/contract-line-item-money-B0Z3Ogur.d.ts +43 -0
- package/dist/discovery/index.d.cts +2 -2
- package/dist/discovery/index.d.ts +2 -2
- package/dist/discovery/index.js +6 -6
- package/dist/{discovery.scanner-9cMqF95o.d.cts → discovery.scanner-DXKc6JkV.d.cts} +1 -1
- package/dist/{discovery.scanner-9cMqF95o.d.ts → discovery.scanner-DXKc6JkV.d.ts} +1 -1
- package/dist/{enforce-quota.interceptor-Df0e3OWe.d.cts → enforce-quota.interceptor-BFyVdWe8.d.cts} +6 -6
- package/dist/{enforce-quota.interceptor-DW3etVyI.d.ts → enforce-quota.interceptor-GaBXboGx.d.ts} +6 -6
- package/dist/entitlement/index.d.cts +27 -4
- package/dist/entitlement/index.d.ts +27 -4
- package/dist/entitlement/index.js +13 -8
- package/dist/index.d.cts +209 -28
- package/dist/index.d.ts +209 -28
- package/dist/index.js +285 -163
- package/dist/issuer-identity.check-CBO0vcsq.d.cts +197 -0
- package/dist/issuer-identity.check-Cz9CEMkZ.d.ts +197 -0
- package/dist/{module-options-COSEb0VW.d.ts → module-options-DmQ3G4sZ.d.ts} +135 -41
- package/dist/{module-options-BG3MzQva.d.cts → module-options-qAOwinHR.d.cts} +135 -41
- package/dist/payment-callback.service-CR84Xw1Z.d.cts +125 -0
- package/dist/payment-callback.service-CR84Xw1Z.d.ts +125 -0
- package/dist/payments/index.cjs +4 -0
- package/dist/payments/index.d.cts +187 -0
- package/dist/payments/index.d.ts +187 -0
- package/dist/payments/index.js +141 -0
- package/dist/payments.module-BdUq9ot_.d.cts +57 -0
- package/dist/payments.module-CQGv_VG7.d.ts +57 -0
- package/dist/plan-catalog-source-DWe-BGY1.d.cts +21 -0
- package/dist/plan-catalog-source-DWe-BGY1.d.ts +21 -0
- package/dist/{plan-resolution-Cgo_TR1H.d.cts → plan-resolution-CwUy_OqC.d.cts} +14 -0
- package/dist/{plan-resolution-Cgo_TR1H.d.ts → plan-resolution-CwUy_OqC.d.ts} +14 -0
- package/dist/{plan-versions.service-DChhbK6h.d.ts → plan-versions.service-C0N-Em2W.d.ts} +38 -64
- package/dist/{plan-versions.service-TPEtbN0r.d.cts → plan-versions.service-DARLh-qI.d.cts} +38 -64
- package/dist/platform/index.d.cts +52 -23
- package/dist/platform/index.d.ts +52 -23
- package/dist/platform/index.js +57 -36
- package/dist/promo/index.d.cts +23 -8
- package/dist/promo/index.d.ts +23 -8
- package/dist/promo/index.js +15 -7
- package/dist/{promo.module-DtvIycpt.d.cts → promo.module-CKkECmU8.d.cts} +9 -3
- package/dist/{promo.module-Z8h1PNX-.d.ts → promo.module-DuIJdK3U.d.ts} +9 -3
- package/dist/promo.service-BYBu6dy3.d.cts +215 -0
- package/dist/promo.service-CFjfF0Xm.d.ts +215 -0
- package/dist/registration/index.d.cts +104 -47
- package/dist/registration/index.d.ts +104 -47
- package/dist/registration/index.js +15 -9
- package/dist/subscriber/index.cjs +4 -0
- package/dist/subscriber/index.d.cts +28 -0
- package/dist/subscriber/index.d.ts +28 -0
- package/dist/subscriber/index.js +16 -0
- package/dist/subscriber.service-5W6Gi-1B.d.cts +68 -0
- package/dist/subscriber.service-5W6Gi-1B.d.ts +68 -0
- package/dist/subscription-contract/index.d.cts +4 -2
- package/dist/subscription-contract/index.d.ts +4 -2
- package/dist/subscription-contract/index.js +13 -5
- package/dist/{subscription-contract.module-fDFdQ0jm.d.ts → subscription-contract.module-BfIRpc1o.d.ts} +8 -2
- package/dist/{subscription-contract.module-CEK8HS5-.d.cts → subscription-contract.module-DTMuUJYd.d.cts} +8 -2
- package/dist/{subscription-contract.service-hD87MKyg.d.cts → subscription-contract.service-CPZrTM9C.d.ts} +32 -3
- package/dist/{subscription-contract.service-hD87MKyg.d.ts → subscription-contract.service-CfNApLuP.d.cts} +32 -3
- package/dist/tenant-billing.controller-BLqbsONe.d.ts +812 -0
- package/dist/tenant-billing.controller-DKbAqTbM.d.cts +812 -0
- package/dist/tenant-billing.module-ClbjzocC.d.cts +364 -0
- package/dist/tenant-billing.module-DohgJJ2m.d.ts +364 -0
- package/dist/tenant-billing.tokens-G-1xOlMr.d.cts +129 -0
- package/dist/tenant-billing.tokens-G-1xOlMr.d.ts +129 -0
- package/dist/testing/index.d.cts +44 -17
- package/dist/testing/index.d.ts +44 -17
- package/dist/testing/index.js +189 -40
- package/package.json +24 -4
- package/dist/catalog.module-BDDO6iwq.d.cts +0 -103
- package/dist/catalog.module-BTnMsE6u.d.ts +0 -103
- package/dist/checkout-offer.module-CMtiQJTT.d.ts +0 -39
- package/dist/checkout-offer.module-CVpWrzbe.d.cts +0 -39
- package/dist/checkout-offer.service-BLOv2HOo.d.cts +0 -49
- package/dist/checkout-offer.service-BLOv2HOo.d.ts +0 -49
- package/dist/chunk-57V6ZTI6.js +0 -22
- package/dist/chunk-BSK6YBLI.js +0 -87
- package/dist/chunk-DQKCK7DX.js +0 -217
- package/dist/chunk-VXEYLNIB.js +0 -632
- package/dist/chunk-WUDYIPYH.js +0 -715
- package/dist/define-saasicat-DROBe-b1.d.ts +0 -69
- package/dist/define-saasicat-vGBCkFys.d.cts +0 -69
- package/dist/promo.service-BJbKAmw3.d.cts +0 -112
- package/dist/promo.service-BJbKAmw3.d.ts +0 -112
- package/dist/tenant-billing.controller-BQ67mlmI.d.ts +0 -438
- package/dist/tenant-billing.controller-DS8kB8a7.d.cts +0 -438
- package/dist/tenant-billing.module-BznC3XtW.d.cts +0 -299
- package/dist/tenant-billing.module-wUbsQSFG.d.ts +0 -299
- /package/dist/{chunk-2FR6ZL7R.js → chunk-BHZOH2DY.js} +0 -0
- /package/dist/{chunk-2SLTRKXC.js → chunk-DFOW3JVO.js} +0 -0
- /package/dist/{chunk-DBZGV3HC.js → chunk-DU56UKEH.js} +0 -0
- /package/dist/{chunk-OYNHOY45.js → chunk-GAUEVIAE.js} +0 -0
package/dist/testing/index.d.cts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
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,
|
|
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, SubscriberRepository, CreateSubscriberData, SubscriberRecord, SubscriberContactChange, SubscriberCorrectionData, SubscriberCorrectionResult, SubscriberCorrectionRecord, SubscriptionBundleRepository, SubscriptionBundleRecord, CreateSubscriptionBundleData, CancelSubscriptionBundleData, SubscriptionContractRepository, SubscriptionContractFilter, SubscriptionContractRecord, NewSubscriptionContractData, TerminateSubscriptionContractData, RunningContractIssuers, SubscriptionRepository, SubscriptionRecord, TransactionRunner, PlanCatalog, QuotaProvider } from '@saasicat/core';
|
|
2
2
|
import { Type, DynamicModule } from '@nestjs/common';
|
|
3
|
-
import { S as SaaSiCatAdapters } from '../module-options-
|
|
4
|
-
export { P as PLAN_RESOLVER_PORT_TOKEN,
|
|
5
|
-
export { E as EnforceQuotaInterceptor, S as StaticEntitlementService, a as StaticFeatureGuard } from '../enforce-quota.interceptor-
|
|
3
|
+
import { S as SaaSiCatAdapters } from '../module-options-qAOwinHR.cjs';
|
|
4
|
+
export { P as PLAN_RESOLVER_PORT_TOKEN, a as StaticPlanResolver } from '../module-options-qAOwinHR.cjs';
|
|
5
|
+
export { E as EnforceQuotaInterceptor, S as StaticEntitlementService, a as StaticFeatureGuard } from '../enforce-quota.interceptor-BFyVdWe8.cjs';
|
|
6
6
|
import '../di-CcNeq9v-.cjs';
|
|
7
|
-
import '../admin-resources.module-
|
|
7
|
+
import '../admin-resources.module-B4XNvdH-.cjs';
|
|
8
8
|
import '../admin-audit.service-4P3Djdxk.cjs';
|
|
9
|
-
import '../tenant-billing.module-
|
|
10
|
-
import '../
|
|
11
|
-
import '../
|
|
9
|
+
import '../tenant-billing.module-ClbjzocC.cjs';
|
|
10
|
+
import '../tenant-billing.tokens-G-1xOlMr.cjs';
|
|
11
|
+
import '../contract-line-item-money-B0Z3Ogur.cjs';
|
|
12
|
+
import '../catalog.module-T-I5Ricz.cjs';
|
|
13
|
+
import '../discovery.scanner-DXKc6JkV.cjs';
|
|
12
14
|
import '@nestjs/core';
|
|
13
|
-
import '../plan-resolution-
|
|
14
|
-
import '../promo.module-
|
|
15
|
-
import '../promo.service-
|
|
16
|
-
import '../
|
|
17
|
-
import '../
|
|
15
|
+
import '../plan-resolution-CwUy_OqC.cjs';
|
|
16
|
+
import '../promo.module-CKkECmU8.cjs';
|
|
17
|
+
import '../promo.service-BYBu6dy3.cjs';
|
|
18
|
+
import '../plan-catalog-source-DWe-BGY1.cjs';
|
|
19
|
+
import '../checkout-offer.module-DFhGy6JO.cjs';
|
|
20
|
+
import '../payments.module-BdUq9ot_.cjs';
|
|
21
|
+
import '../subscription-contract.module-DTMuUJYd.cjs';
|
|
18
22
|
import 'rxjs';
|
|
19
23
|
|
|
20
24
|
/**
|
|
@@ -87,11 +91,34 @@ declare class FakeSubscriptionContractRepository implements SubscriptionContract
|
|
|
87
91
|
list(filter: SubscriptionContractFilter): Promise<SubscriptionContractRecord[]>;
|
|
88
92
|
findById(contractId: string): Promise<SubscriptionContractRecord | null>;
|
|
89
93
|
findActiveByTenantId(tenantId: string, asOf?: Date): Promise<SubscriptionContractRecord | null>;
|
|
90
|
-
|
|
94
|
+
findByOriginalOfferId(offerId: string): Promise<SubscriptionContractRecord | null>;
|
|
95
|
+
create(data: NewSubscriptionContractData): Promise<SubscriptionContractRecord>;
|
|
91
96
|
terminate(contractId: string, data: TerminateSubscriptionContractData): Promise<SubscriptionContractRecord>;
|
|
97
|
+
listRunningIssuers(limit: number, asOf?: Date): Promise<RunningContractIssuers>;
|
|
92
98
|
private isActiveAt;
|
|
93
99
|
private cloneRecord;
|
|
94
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* In-memory FakeSubscriberRepository — one live subscriber per tenant, customer
|
|
103
|
+
* numbers counted from 10001 like the canonical schema, and corrections
|
|
104
|
+
* recorded with the values they replaced. No transactions: `tx` is accepted and
|
|
105
|
+
* ignored.
|
|
106
|
+
*/
|
|
107
|
+
declare class FakeSubscriberRepository implements SubscriberRepository {
|
|
108
|
+
/** Where the canonical schema starts counting (`sql/constraints.postgres.sql`). */
|
|
109
|
+
static readonly FIRST_CUSTOMER_NUMBER = 10001;
|
|
110
|
+
private readonly byId;
|
|
111
|
+
private readonly corrections;
|
|
112
|
+
private nextSequence;
|
|
113
|
+
private nextCorrectionId;
|
|
114
|
+
createForTenant(data: CreateSubscriberData): Promise<SubscriberRecord | null>;
|
|
115
|
+
findById(subscriberId: string): Promise<SubscriberRecord | null>;
|
|
116
|
+
findByTenantId(tenantId: string): Promise<SubscriberRecord | null>;
|
|
117
|
+
updateContact(subscriberId: string, change: SubscriberContactChange): Promise<SubscriberRecord | null>;
|
|
118
|
+
correctIdentity(subscriberId: string, data: SubscriberCorrectionData): Promise<SubscriberCorrectionResult | null>;
|
|
119
|
+
listCorrections(subscriberId: string): Promise<SubscriberCorrectionRecord[]>;
|
|
120
|
+
private liveFor;
|
|
121
|
+
}
|
|
95
122
|
/**
|
|
96
123
|
* In-memory FakePlanVersionRepository — stores PlanVersions per `planId`
|
|
97
124
|
* and returns the most recently set one as "latest live".
|
|
@@ -132,7 +159,7 @@ declare class FakeBundleRepository implements BundleRepository {
|
|
|
132
159
|
clear(): void;
|
|
133
160
|
list(filter: BundleListFilter): Promise<BundleRow[]>;
|
|
134
161
|
findById(bundleId: string): Promise<BundleRow | null>;
|
|
135
|
-
findByKey(
|
|
162
|
+
findByKey(bundleKey: string): Promise<BundleRow | null>;
|
|
136
163
|
create(data: CreateBundleData): Promise<BundleRow>;
|
|
137
164
|
update(bundleId: string, data: UpdateBundleData): Promise<BundleRow>;
|
|
138
165
|
softDelete(bundleId: string): Promise<void>;
|
|
@@ -183,7 +210,7 @@ declare class FakePlanRepository implements PlanRepository {
|
|
|
183
210
|
clear(): void;
|
|
184
211
|
list(filter: PlanListFilter): Promise<PlanRow[]>;
|
|
185
212
|
findById(planId: string): Promise<PlanRow | null>;
|
|
186
|
-
findByKey(
|
|
213
|
+
findByKey(planKey: string): Promise<PlanRow | null>;
|
|
187
214
|
create(data: CreatePlanData): Promise<PlanRow>;
|
|
188
215
|
update(planId: string, data: UpdatePlanData): Promise<PlanRow>;
|
|
189
216
|
softDelete(planId: string): Promise<void>;
|
|
@@ -250,4 +277,4 @@ interface CreateSaaSiCatTestModuleOptions {
|
|
|
250
277
|
*/
|
|
251
278
|
declare function createSaaSiCatTestModule(options: CreateSaaSiCatTestModuleOptions): DynamicModule;
|
|
252
279
|
|
|
253
|
-
export { type CreateSaaSiCatTestModuleOptions, FakeBundleRepository, FakeMarketingProjectionRepository, FakePlanRepository, FakePlanVersionRepository, FakeSubscriptionBundleRepository, FakeSubscriptionContractRepository, FakeSubscriptionRepository, FakeTransactionRunner, StubAuditPort, StubMfaPort, StubRlsBypassPort, createSaaSiCatTestModule };
|
|
280
|
+
export { type CreateSaaSiCatTestModuleOptions, FakeBundleRepository, FakeMarketingProjectionRepository, FakePlanRepository, FakePlanVersionRepository, FakeSubscriberRepository, FakeSubscriptionBundleRepository, FakeSubscriptionContractRepository, FakeSubscriptionRepository, FakeTransactionRunner, StubAuditPort, StubMfaPort, StubRlsBypassPort, createSaaSiCatTestModule };
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
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,
|
|
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, SubscriberRepository, CreateSubscriberData, SubscriberRecord, SubscriberContactChange, SubscriberCorrectionData, SubscriberCorrectionResult, SubscriberCorrectionRecord, SubscriptionBundleRepository, SubscriptionBundleRecord, CreateSubscriptionBundleData, CancelSubscriptionBundleData, SubscriptionContractRepository, SubscriptionContractFilter, SubscriptionContractRecord, NewSubscriptionContractData, TerminateSubscriptionContractData, RunningContractIssuers, SubscriptionRepository, SubscriptionRecord, TransactionRunner, PlanCatalog, QuotaProvider } from '@saasicat/core';
|
|
2
2
|
import { Type, DynamicModule } from '@nestjs/common';
|
|
3
|
-
import { S as SaaSiCatAdapters } from '../module-options-
|
|
4
|
-
export { P as PLAN_RESOLVER_PORT_TOKEN,
|
|
5
|
-
export { E as EnforceQuotaInterceptor, S as StaticEntitlementService, a as StaticFeatureGuard } from '../enforce-quota.interceptor-
|
|
3
|
+
import { S as SaaSiCatAdapters } from '../module-options-DmQ3G4sZ.js';
|
|
4
|
+
export { P as PLAN_RESOLVER_PORT_TOKEN, a as StaticPlanResolver } from '../module-options-DmQ3G4sZ.js';
|
|
5
|
+
export { E as EnforceQuotaInterceptor, S as StaticEntitlementService, a as StaticFeatureGuard } from '../enforce-quota.interceptor-GaBXboGx.js';
|
|
6
6
|
import '../di-CcNeq9v-.js';
|
|
7
|
-
import '../admin-resources.module-
|
|
7
|
+
import '../admin-resources.module-CWqdI9BV.js';
|
|
8
8
|
import '../admin-audit.service-4P3Djdxk.js';
|
|
9
|
-
import '../tenant-billing.module-
|
|
10
|
-
import '../
|
|
11
|
-
import '../
|
|
9
|
+
import '../tenant-billing.module-DohgJJ2m.js';
|
|
10
|
+
import '../tenant-billing.tokens-G-1xOlMr.js';
|
|
11
|
+
import '../contract-line-item-money-B0Z3Ogur.js';
|
|
12
|
+
import '../catalog.module-C9O7BxRq.js';
|
|
13
|
+
import '../discovery.scanner-DXKc6JkV.js';
|
|
12
14
|
import '@nestjs/core';
|
|
13
|
-
import '../plan-resolution-
|
|
14
|
-
import '../promo.module-
|
|
15
|
-
import '../promo.service-
|
|
16
|
-
import '../
|
|
17
|
-
import '../
|
|
15
|
+
import '../plan-resolution-CwUy_OqC.js';
|
|
16
|
+
import '../promo.module-DuIJdK3U.js';
|
|
17
|
+
import '../promo.service-CFjfF0Xm.js';
|
|
18
|
+
import '../plan-catalog-source-DWe-BGY1.js';
|
|
19
|
+
import '../checkout-offer.module-x7SP_dX4.js';
|
|
20
|
+
import '../payments.module-CQGv_VG7.js';
|
|
21
|
+
import '../subscription-contract.module-BfIRpc1o.js';
|
|
18
22
|
import 'rxjs';
|
|
19
23
|
|
|
20
24
|
/**
|
|
@@ -87,11 +91,34 @@ declare class FakeSubscriptionContractRepository implements SubscriptionContract
|
|
|
87
91
|
list(filter: SubscriptionContractFilter): Promise<SubscriptionContractRecord[]>;
|
|
88
92
|
findById(contractId: string): Promise<SubscriptionContractRecord | null>;
|
|
89
93
|
findActiveByTenantId(tenantId: string, asOf?: Date): Promise<SubscriptionContractRecord | null>;
|
|
90
|
-
|
|
94
|
+
findByOriginalOfferId(offerId: string): Promise<SubscriptionContractRecord | null>;
|
|
95
|
+
create(data: NewSubscriptionContractData): Promise<SubscriptionContractRecord>;
|
|
91
96
|
terminate(contractId: string, data: TerminateSubscriptionContractData): Promise<SubscriptionContractRecord>;
|
|
97
|
+
listRunningIssuers(limit: number, asOf?: Date): Promise<RunningContractIssuers>;
|
|
92
98
|
private isActiveAt;
|
|
93
99
|
private cloneRecord;
|
|
94
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* In-memory FakeSubscriberRepository — one live subscriber per tenant, customer
|
|
103
|
+
* numbers counted from 10001 like the canonical schema, and corrections
|
|
104
|
+
* recorded with the values they replaced. No transactions: `tx` is accepted and
|
|
105
|
+
* ignored.
|
|
106
|
+
*/
|
|
107
|
+
declare class FakeSubscriberRepository implements SubscriberRepository {
|
|
108
|
+
/** Where the canonical schema starts counting (`sql/constraints.postgres.sql`). */
|
|
109
|
+
static readonly FIRST_CUSTOMER_NUMBER = 10001;
|
|
110
|
+
private readonly byId;
|
|
111
|
+
private readonly corrections;
|
|
112
|
+
private nextSequence;
|
|
113
|
+
private nextCorrectionId;
|
|
114
|
+
createForTenant(data: CreateSubscriberData): Promise<SubscriberRecord | null>;
|
|
115
|
+
findById(subscriberId: string): Promise<SubscriberRecord | null>;
|
|
116
|
+
findByTenantId(tenantId: string): Promise<SubscriberRecord | null>;
|
|
117
|
+
updateContact(subscriberId: string, change: SubscriberContactChange): Promise<SubscriberRecord | null>;
|
|
118
|
+
correctIdentity(subscriberId: string, data: SubscriberCorrectionData): Promise<SubscriberCorrectionResult | null>;
|
|
119
|
+
listCorrections(subscriberId: string): Promise<SubscriberCorrectionRecord[]>;
|
|
120
|
+
private liveFor;
|
|
121
|
+
}
|
|
95
122
|
/**
|
|
96
123
|
* In-memory FakePlanVersionRepository — stores PlanVersions per `planId`
|
|
97
124
|
* and returns the most recently set one as "latest live".
|
|
@@ -132,7 +159,7 @@ declare class FakeBundleRepository implements BundleRepository {
|
|
|
132
159
|
clear(): void;
|
|
133
160
|
list(filter: BundleListFilter): Promise<BundleRow[]>;
|
|
134
161
|
findById(bundleId: string): Promise<BundleRow | null>;
|
|
135
|
-
findByKey(
|
|
162
|
+
findByKey(bundleKey: string): Promise<BundleRow | null>;
|
|
136
163
|
create(data: CreateBundleData): Promise<BundleRow>;
|
|
137
164
|
update(bundleId: string, data: UpdateBundleData): Promise<BundleRow>;
|
|
138
165
|
softDelete(bundleId: string): Promise<void>;
|
|
@@ -183,7 +210,7 @@ declare class FakePlanRepository implements PlanRepository {
|
|
|
183
210
|
clear(): void;
|
|
184
211
|
list(filter: PlanListFilter): Promise<PlanRow[]>;
|
|
185
212
|
findById(planId: string): Promise<PlanRow | null>;
|
|
186
|
-
findByKey(
|
|
213
|
+
findByKey(planKey: string): Promise<PlanRow | null>;
|
|
187
214
|
create(data: CreatePlanData): Promise<PlanRow>;
|
|
188
215
|
update(planId: string, data: UpdatePlanData): Promise<PlanRow>;
|
|
189
216
|
softDelete(planId: string): Promise<void>;
|
|
@@ -250,4 +277,4 @@ interface CreateSaaSiCatTestModuleOptions {
|
|
|
250
277
|
*/
|
|
251
278
|
declare function createSaaSiCatTestModule(options: CreateSaaSiCatTestModuleOptions): DynamicModule;
|
|
252
279
|
|
|
253
|
-
export { type CreateSaaSiCatTestModuleOptions, FakeBundleRepository, FakeMarketingProjectionRepository, FakePlanRepository, FakePlanVersionRepository, FakeSubscriptionBundleRepository, FakeSubscriptionContractRepository, FakeSubscriptionRepository, FakeTransactionRunner, StubAuditPort, StubMfaPort, StubRlsBypassPort, createSaaSiCatTestModule };
|
|
280
|
+
export { type CreateSaaSiCatTestModuleOptions, FakeBundleRepository, FakeMarketingProjectionRepository, FakePlanRepository, FakePlanVersionRepository, FakeSubscriberRepository, FakeSubscriptionBundleRepository, FakeSubscriptionContractRepository, FakeSubscriptionRepository, FakeTransactionRunner, StubAuditPort, StubMfaPort, StubRlsBypassPort, createSaaSiCatTestModule };
|
package/dist/testing/index.js
CHANGED
|
@@ -5,36 +5,46 @@ 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-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-AOS2JPDD.js";
|
|
9
|
+
import "../chunk-4SDSYV4A.js";
|
|
10
|
+
import "../chunk-XSSWYPP5.js";
|
|
11
|
+
import "../chunk-LLYVYRGJ.js";
|
|
12
|
+
import "../chunk-M47BNEY2.js";
|
|
13
|
+
import "../chunk-CQ2ZZMTD.js";
|
|
14
|
+
import "../chunk-GZTL64QK.js";
|
|
15
|
+
import "../chunk-34XVPR6P.js";
|
|
16
|
+
import "../chunk-OOTEXP47.js";
|
|
17
|
+
import "../chunk-TOEFN7DN.js";
|
|
18
|
+
import "../chunk-55QEDAMX.js";
|
|
19
|
+
import "../chunk-3RLWML2S.js";
|
|
20
|
+
import "../chunk-NDLC5GYK.js";
|
|
21
|
+
import "../chunk-KPEMTBOP.js";
|
|
22
|
+
import "../chunk-S33SO5XX.js";
|
|
23
|
+
import "../chunk-JVAEKTJ4.js";
|
|
24
|
+
import "../chunk-WHJSYKNC.js";
|
|
25
|
+
import "../chunk-G6EZWECL.js";
|
|
26
26
|
import "../chunk-OUDSQ3PU.js";
|
|
27
|
-
import "../chunk-
|
|
28
|
-
import "../chunk-
|
|
29
|
-
import "../chunk-
|
|
30
|
-
import "../chunk-
|
|
27
|
+
import "../chunk-TBBZWZQT.js";
|
|
28
|
+
import "../chunk-VBRYPU7V.js";
|
|
29
|
+
import "../chunk-6PJE7EWO.js";
|
|
30
|
+
import "../chunk-3QVGA6JX.js";
|
|
31
31
|
import "../chunk-QUZU2M33.js";
|
|
32
|
+
import "../chunk-QPVDCKYS.js";
|
|
33
|
+
import "../chunk-7NJKVC5X.js";
|
|
34
|
+
import "../chunk-5CKC7O52.js";
|
|
35
|
+
import "../chunk-GPQWGA6B.js";
|
|
36
|
+
import "../chunk-SZ7RFPXA.js";
|
|
37
|
+
import "../chunk-WOEJ6K7M.js";
|
|
38
|
+
import "../chunk-LF6J4YYN.js";
|
|
39
|
+
import "../chunk-YSC46BGM.js";
|
|
40
|
+
import "../chunk-FEQZCWUL.js";
|
|
41
|
+
import "../chunk-J7NJRK3K.js";
|
|
32
42
|
import {
|
|
33
43
|
__name
|
|
34
44
|
} from "../chunk-SHUYVCID.js";
|
|
35
45
|
|
|
36
46
|
// src/testing/fake-repositories.ts
|
|
37
|
-
import { startOfUtcDay } from "@saasicat/core";
|
|
47
|
+
import { formatCustomerNumber, identityCorrectionDelta, startOfUtcDay } from "@saasicat/core";
|
|
38
48
|
var FakeSubscriptionRepository = class {
|
|
39
49
|
static {
|
|
40
50
|
__name(this, "FakeSubscriptionRepository");
|
|
@@ -116,6 +126,9 @@ var FakeSubscriptionBundleRepository = class {
|
|
|
116
126
|
minimumTermEndsAt: data.minimumTermEndsAt ?? null,
|
|
117
127
|
canceledAt: null,
|
|
118
128
|
canceledEffectiveAt: null,
|
|
129
|
+
billingCycle: data.billingCycle ?? null,
|
|
130
|
+
currentPeriodStart: data.currentPeriodStart ?? null,
|
|
131
|
+
currentPeriodEnd: data.currentPeriodEnd ?? null,
|
|
119
132
|
createdAt,
|
|
120
133
|
updatedAt: createdAt
|
|
121
134
|
};
|
|
@@ -180,7 +193,7 @@ var FakeSubscriptionContractRepository = class {
|
|
|
180
193
|
async list(filter) {
|
|
181
194
|
return [
|
|
182
195
|
...this.byId.values()
|
|
183
|
-
].filter((row) => !filter.
|
|
196
|
+
].filter((row) => !filter.tenantId || row.tenantId === filter.tenantId).filter((row) => !filter.status || row.status === filter.status).filter((row) => !filter.asOf || this.isActiveAt(row, filter.asOf)).sort((a, b) => b.effectiveFrom.getTime() - a.effectiveFrom.getTime()).map((row) => this.cloneRecord(row));
|
|
184
197
|
}
|
|
185
198
|
async findById(contractId) {
|
|
186
199
|
const row = this.byId.get(contractId);
|
|
@@ -192,13 +205,26 @@ var FakeSubscriptionContractRepository = class {
|
|
|
192
205
|
].filter((row) => row.tenantId === tenantId).filter((row) => this.isActiveAt(row, asOf)).sort((a, b) => b.effectiveFrom.getTime() - a.effectiveFrom.getTime())[0];
|
|
193
206
|
return active ? this.cloneRecord(active) : null;
|
|
194
207
|
}
|
|
208
|
+
async findByOriginalOfferId(offerId) {
|
|
209
|
+
const first = [
|
|
210
|
+
...this.byId.values()
|
|
211
|
+
].find((row) => row.originalOfferId === offerId);
|
|
212
|
+
return first ? this.cloneRecord(first) : null;
|
|
213
|
+
}
|
|
195
214
|
async create(data) {
|
|
196
215
|
const now = /* @__PURE__ */ new Date();
|
|
197
216
|
const id = `contract-${this.nextContractId++}`;
|
|
198
217
|
const row = {
|
|
199
218
|
id,
|
|
200
|
-
projectKey: data.projectKey,
|
|
201
219
|
tenantId: data.tenantId,
|
|
220
|
+
subscriberId: data.parties.subscriberId,
|
|
221
|
+
subscriber: {
|
|
222
|
+
...data.parties.subscriber
|
|
223
|
+
},
|
|
224
|
+
issuer: data.parties.issuer ? {
|
|
225
|
+
...data.parties.issuer
|
|
226
|
+
} : null,
|
|
227
|
+
partiesMigrated: false,
|
|
202
228
|
status: data.status ?? "active",
|
|
203
229
|
effectiveFrom: new Date(data.effectiveFrom),
|
|
204
230
|
effectiveUntil: data.effectiveUntil ? new Date(data.effectiveUntil) : null,
|
|
@@ -255,13 +281,29 @@ var FakeSubscriptionContractRepository = class {
|
|
|
255
281
|
if (!existing) throw new Error(`SubscriptionContract '${contractId}' not found`);
|
|
256
282
|
const updated = {
|
|
257
283
|
...existing,
|
|
258
|
-
|
|
284
|
+
// Null means "end it by date": the row keeps the status it has and
|
|
285
|
+
// leaves the active window when `effectiveUntil` passes.
|
|
286
|
+
status: data.status ?? existing.status,
|
|
259
287
|
effectiveUntil: new Date(data.effectiveUntil),
|
|
260
288
|
updatedAt: /* @__PURE__ */ new Date()
|
|
261
289
|
};
|
|
262
290
|
this.byId.set(contractId, updated);
|
|
263
291
|
return this.cloneRecord(updated);
|
|
264
292
|
}
|
|
293
|
+
async listRunningIssuers(limit, asOf = /* @__PURE__ */ new Date()) {
|
|
294
|
+
const running = [
|
|
295
|
+
...this.byId.values()
|
|
296
|
+
].filter((row) => row.status === "active" || row.status === "scheduled").filter((row) => row.effectiveUntil === null || row.effectiveUntil > asOf).sort((a, b) => a.effectiveFrom.getTime() - b.effectiveFrom.getTime() || a.createdAt.getTime() - b.createdAt.getTime() || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
297
|
+
return {
|
|
298
|
+
total: running.length,
|
|
299
|
+
contracts: running.slice(0, limit).map((row) => ({
|
|
300
|
+
id: row.id,
|
|
301
|
+
tenantId: row.tenantId,
|
|
302
|
+
issuerLegalName: row.issuer?.legalName ?? null,
|
|
303
|
+
effectiveFrom: new Date(row.effectiveFrom)
|
|
304
|
+
}))
|
|
305
|
+
};
|
|
306
|
+
}
|
|
265
307
|
isActiveAt(row, asOf) {
|
|
266
308
|
if (row.status !== "active" && row.status !== "scheduled") return false;
|
|
267
309
|
return row.effectiveFrom.getTime() <= asOf.getTime() && (row.effectiveUntil === null || row.effectiveUntil.getTime() > asOf.getTime());
|
|
@@ -269,6 +311,12 @@ var FakeSubscriptionContractRepository = class {
|
|
|
269
311
|
cloneRecord(row) {
|
|
270
312
|
return {
|
|
271
313
|
...row,
|
|
314
|
+
subscriber: {
|
|
315
|
+
...row.subscriber
|
|
316
|
+
},
|
|
317
|
+
issuer: row.issuer ? {
|
|
318
|
+
...row.issuer
|
|
319
|
+
} : null,
|
|
272
320
|
effectiveFrom: new Date(row.effectiveFrom),
|
|
273
321
|
effectiveUntil: row.effectiveUntil ? new Date(row.effectiveUntil) : null,
|
|
274
322
|
originalBundleVersionIds: [
|
|
@@ -314,6 +362,108 @@ var FakeSubscriptionContractRepository = class {
|
|
|
314
362
|
};
|
|
315
363
|
}
|
|
316
364
|
};
|
|
365
|
+
var FakeSubscriberRepository = class _FakeSubscriberRepository {
|
|
366
|
+
static {
|
|
367
|
+
__name(this, "FakeSubscriberRepository");
|
|
368
|
+
}
|
|
369
|
+
/** Where the canonical schema starts counting (`sql/constraints.postgres.sql`). */
|
|
370
|
+
static FIRST_CUSTOMER_NUMBER = 10001;
|
|
371
|
+
byId = /* @__PURE__ */ new Map();
|
|
372
|
+
corrections = [];
|
|
373
|
+
nextSequence = _FakeSubscriberRepository.FIRST_CUSTOMER_NUMBER;
|
|
374
|
+
nextCorrectionId = 1;
|
|
375
|
+
async createForTenant(data) {
|
|
376
|
+
if (this.liveFor(data.tenantId)) return null;
|
|
377
|
+
const now = /* @__PURE__ */ new Date();
|
|
378
|
+
const sequence = this.nextSequence++;
|
|
379
|
+
const { tenantId, customerNumberPrefix, ...details } = data;
|
|
380
|
+
const record = {
|
|
381
|
+
...details,
|
|
382
|
+
id: `subscriber-${sequence}`,
|
|
383
|
+
customerNumber: formatCustomerNumber(customerNumberPrefix, sequence),
|
|
384
|
+
tenantId,
|
|
385
|
+
migrated: false,
|
|
386
|
+
createdAt: now,
|
|
387
|
+
updatedAt: now
|
|
388
|
+
};
|
|
389
|
+
this.byId.set(record.id, record);
|
|
390
|
+
return {
|
|
391
|
+
...record
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
async findById(subscriberId) {
|
|
395
|
+
const record = this.byId.get(subscriberId);
|
|
396
|
+
return record ? {
|
|
397
|
+
...record
|
|
398
|
+
} : null;
|
|
399
|
+
}
|
|
400
|
+
async findByTenantId(tenantId) {
|
|
401
|
+
const record = this.liveFor(tenantId);
|
|
402
|
+
return record ? {
|
|
403
|
+
...record
|
|
404
|
+
} : null;
|
|
405
|
+
}
|
|
406
|
+
async updateContact(subscriberId, change) {
|
|
407
|
+
const record = this.byId.get(subscriberId);
|
|
408
|
+
if (!record) return null;
|
|
409
|
+
const updated = {
|
|
410
|
+
...record,
|
|
411
|
+
...change,
|
|
412
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
413
|
+
};
|
|
414
|
+
this.byId.set(subscriberId, updated);
|
|
415
|
+
return {
|
|
416
|
+
...updated
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
async correctIdentity(subscriberId, data) {
|
|
420
|
+
const record = this.byId.get(subscriberId);
|
|
421
|
+
if (!record) return null;
|
|
422
|
+
const delta = identityCorrectionDelta(record, data.corrected);
|
|
423
|
+
if (Object.keys(delta.corrected).length === 0) {
|
|
424
|
+
return {
|
|
425
|
+
subscriber: {
|
|
426
|
+
...record
|
|
427
|
+
},
|
|
428
|
+
correction: null
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
const updated = {
|
|
432
|
+
...record,
|
|
433
|
+
...delta.corrected,
|
|
434
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
435
|
+
};
|
|
436
|
+
this.byId.set(subscriberId, updated);
|
|
437
|
+
const correction = {
|
|
438
|
+
id: `correction-${this.nextCorrectionId++}`,
|
|
439
|
+
subscriberId,
|
|
440
|
+
previous: delta.previous,
|
|
441
|
+
corrected: delta.corrected,
|
|
442
|
+
reason: data.reason,
|
|
443
|
+
correctedBy: data.correctedBy,
|
|
444
|
+
correctedAt: data.correctedAt
|
|
445
|
+
};
|
|
446
|
+
this.corrections.push(correction);
|
|
447
|
+
return {
|
|
448
|
+
subscriber: {
|
|
449
|
+
...updated
|
|
450
|
+
},
|
|
451
|
+
correction: {
|
|
452
|
+
...correction
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
async listCorrections(subscriberId) {
|
|
457
|
+
return this.corrections.filter((correction) => correction.subscriberId === subscriberId).reverse().map((correction) => ({
|
|
458
|
+
...correction
|
|
459
|
+
}));
|
|
460
|
+
}
|
|
461
|
+
liveFor(tenantId) {
|
|
462
|
+
return [
|
|
463
|
+
...this.byId.values()
|
|
464
|
+
].find((record) => record.tenantId === tenantId);
|
|
465
|
+
}
|
|
466
|
+
};
|
|
317
467
|
var FakePlanVersionRepository = class {
|
|
318
468
|
static {
|
|
319
469
|
__name(this, "FakePlanVersionRepository");
|
|
@@ -379,24 +529,24 @@ var FakeBundleRepository = class {
|
|
|
379
529
|
const excludeDeleted = filter.excludeDeleted ?? true;
|
|
380
530
|
return [
|
|
381
531
|
...this.bundles.values()
|
|
382
|
-
].filter((b) =>
|
|
532
|
+
].filter((b) => !excludeDeleted || b.deletedAt === null);
|
|
383
533
|
}
|
|
384
534
|
async findById(bundleId) {
|
|
385
535
|
return this.bundles.get(bundleId) ?? null;
|
|
386
536
|
}
|
|
387
|
-
async findByKey(
|
|
537
|
+
async findByKey(bundleKey) {
|
|
388
538
|
for (const b of this.bundles.values()) {
|
|
389
|
-
if (b.
|
|
390
|
-
return b;
|
|
391
|
-
}
|
|
539
|
+
if (b.bundleKey === bundleKey) return b;
|
|
392
540
|
}
|
|
393
541
|
return null;
|
|
394
542
|
}
|
|
395
543
|
async create(data) {
|
|
544
|
+
if (await this.findByKey(data.bundleKey)) {
|
|
545
|
+
throw new Error(`bundleKey '${data.bundleKey}' is already taken.`);
|
|
546
|
+
}
|
|
396
547
|
const now = this.nowIso();
|
|
397
548
|
const row = {
|
|
398
549
|
id: this.genId("bbbb"),
|
|
399
|
-
projectKey: data.projectKey,
|
|
400
550
|
bundleKey: data.bundleKey,
|
|
401
551
|
label: data.label,
|
|
402
552
|
description: data.description ?? null,
|
|
@@ -579,7 +729,6 @@ var FakeMarketingProjectionRepository = class {
|
|
|
579
729
|
return [
|
|
580
730
|
...this.rows.values()
|
|
581
731
|
].filter((r) => {
|
|
582
|
-
if (r.projectKey !== filter.projectKey) return false;
|
|
583
732
|
if (filter.targetType && r.targetType !== filter.targetType) return false;
|
|
584
733
|
if (filter.targetVersionId && r.targetVersionId !== filter.targetVersionId) return false;
|
|
585
734
|
if (filter.locale && r.locale !== filter.locale) return false;
|
|
@@ -606,7 +755,6 @@ var FakeMarketingProjectionRepository = class {
|
|
|
606
755
|
const now = this.nowIso();
|
|
607
756
|
const row = {
|
|
608
757
|
id: this.genId(),
|
|
609
|
-
projectKey: data.projectKey,
|
|
610
758
|
targetType: data.targetType,
|
|
611
759
|
targetVersionId: data.targetVersionId,
|
|
612
760
|
locale,
|
|
@@ -691,24 +839,24 @@ var FakePlanRepository = class {
|
|
|
691
839
|
].filter((v) => v.publishedAt != null && v.supersededAt == null).map((v) => v.planId)) : null;
|
|
692
840
|
return [
|
|
693
841
|
...this.plans.values()
|
|
694
|
-
].filter((p) =>
|
|
842
|
+
].filter((p) => (!excludeDeleted || p.deletedAt === null) && (!liveKeys || liveKeys.has(p.planKey)));
|
|
695
843
|
}
|
|
696
844
|
async findById(planId) {
|
|
697
845
|
return this.plans.get(planId) ?? null;
|
|
698
846
|
}
|
|
699
|
-
async findByKey(
|
|
847
|
+
async findByKey(planKey) {
|
|
700
848
|
for (const p of this.plans.values()) {
|
|
701
|
-
if (p.
|
|
702
|
-
return p;
|
|
703
|
-
}
|
|
849
|
+
if (p.planKey === planKey) return p;
|
|
704
850
|
}
|
|
705
851
|
return null;
|
|
706
852
|
}
|
|
707
853
|
async create(data) {
|
|
854
|
+
if (await this.findByKey(data.planKey)) {
|
|
855
|
+
throw new Error(`planKey '${data.planKey}' is already taken.`);
|
|
856
|
+
}
|
|
708
857
|
const now = this.nowIso();
|
|
709
858
|
const row = {
|
|
710
859
|
id: this.genId(),
|
|
711
|
-
projectKey: data.projectKey,
|
|
712
860
|
planKey: data.planKey,
|
|
713
861
|
label: data.label,
|
|
714
862
|
description: data.description ?? null,
|
|
@@ -1001,6 +1149,7 @@ export {
|
|
|
1001
1149
|
FakeMarketingProjectionRepository,
|
|
1002
1150
|
FakePlanRepository,
|
|
1003
1151
|
FakePlanVersionRepository,
|
|
1152
|
+
FakeSubscriberRepository,
|
|
1004
1153
|
FakeSubscriptionBundleRepository,
|
|
1005
1154
|
FakeSubscriptionContractRepository,
|
|
1006
1155
|
FakeSubscriptionRepository,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saasicat/nest",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.21",
|
|
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",
|
|
@@ -117,6 +117,26 @@
|
|
|
117
117
|
"default": "./dist/subscription-contract/index.cjs"
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
|
+
"./subscriber": {
|
|
121
|
+
"import": {
|
|
122
|
+
"types": "./dist/subscriber/index.d.ts",
|
|
123
|
+
"default": "./dist/subscriber/index.js"
|
|
124
|
+
},
|
|
125
|
+
"require": {
|
|
126
|
+
"types": "./dist/subscriber/index.d.cts",
|
|
127
|
+
"default": "./dist/subscriber/index.cjs"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"./payments": {
|
|
131
|
+
"import": {
|
|
132
|
+
"types": "./dist/payments/index.d.ts",
|
|
133
|
+
"default": "./dist/payments/index.js"
|
|
134
|
+
},
|
|
135
|
+
"require": {
|
|
136
|
+
"types": "./dist/payments/index.d.cts",
|
|
137
|
+
"default": "./dist/payments/index.cjs"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
120
140
|
"./platform": {
|
|
121
141
|
"import": {
|
|
122
142
|
"types": "./dist/platform/index.d.ts",
|
|
@@ -135,11 +155,11 @@
|
|
|
135
155
|
"dependencies": {
|
|
136
156
|
"ajv": "^8.17.1",
|
|
137
157
|
"ajv-formats": "^3.0.1",
|
|
138
|
-
"js-yaml": "^4.3.
|
|
158
|
+
"js-yaml": "^4.3.2",
|
|
139
159
|
"otplib": "^13.4.1",
|
|
140
160
|
"qrcode": "^1.5.4",
|
|
141
|
-
"@saasicat/spec": "^1.0.0-rc.
|
|
142
|
-
"@saasicat/core": "^1.0.0-rc.
|
|
161
|
+
"@saasicat/spec": "^1.0.0-rc.21",
|
|
162
|
+
"@saasicat/core": "^1.0.0-rc.21"
|
|
143
163
|
},
|
|
144
164
|
"peerDependencies": {
|
|
145
165
|
"@nestjs/common": "^11.0.0",
|