@saasicat/nest 0.8.0 → 0.10.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 +17678 -0
- package/dist/admin/index.cjs +4 -1274
- package/dist/admin/index.d.cts +10 -171
- package/dist/admin/index.d.ts +10 -171
- package/dist/admin/index.js +13 -4
- package/dist/admin-resources.module-BZN_yBFj.d.cts +40 -0
- package/dist/admin-resources.module-Cms8MY6h.d.ts +40 -0
- package/dist/admin-stats.module-15ac5KY3.d.ts +201 -0
- package/dist/admin-stats.module-v4SVvWzj.d.cts +201 -0
- package/dist/billing/index.cjs +4 -5128
- package/dist/billing/index.d.cts +8 -719
- package/dist/billing/index.d.ts +8 -719
- package/dist/billing/index.js +7 -10
- package/dist/catalog/index.cjs +4 -5624
- package/dist/catalog/index.d.cts +7 -427
- package/dist/catalog/index.d.ts +7 -427
- package/dist/catalog/index.js +14 -12
- package/dist/catalog.module-BKObceo0.d.ts +103 -0
- package/dist/catalog.module-Dw2Hrbyu.d.cts +103 -0
- package/dist/checkout-offer/index.cjs +4 -807
- package/dist/checkout-offer/index.d.cts +5 -84
- package/dist/checkout-offer/index.d.ts +5 -84
- package/dist/checkout-offer/index.js +3 -2
- package/dist/checkout-offer.module-Y0hDOVrq.d.ts +85 -0
- package/dist/checkout-offer.module-ZYF5IsDY.d.cts +85 -0
- package/dist/{chunk-5DDCSGZC.js → chunk-33TP26MR.js} +144 -356
- package/dist/{chunk-CK54YKVK.js → chunk-75JABGZK.js} +16 -16
- package/dist/{chunk-HRU3CP57.js → chunk-BOADBIGB.js} +1 -1
- package/dist/{chunk-ZLUGQE5D.js → chunk-E7AJ42AB.js} +8 -8
- package/dist/{chunk-6LP7CDS2.js → chunk-F3VV6EXG.js} +18 -13
- package/dist/{chunk-PLDHI6NA.js → chunk-FVT7KTUI.js} +258 -3
- package/dist/{chunk-RZU4HIAN.js → chunk-GBDUH6DO.js} +26 -23
- package/dist/{chunk-K3OPNVFR.js → chunk-HBFU5AN3.js} +5 -9
- package/dist/chunk-HWGIMNWR.js +0 -0
- package/dist/chunk-IRWZC3GC.js +755 -0
- package/dist/chunk-L4KTQ6CL.js +20 -0
- package/dist/{chunk-T5SXXAKG.js → chunk-LZHLGUQI.js} +1 -1
- package/dist/{chunk-YHHE4KDA.js → chunk-PUXLPUVH.js} +351 -21
- package/dist/chunk-TXDH4FUA.js +211 -0
- package/dist/chunk-UF53DWWR.js +0 -0
- package/dist/{chunk-AJ3EPELS.js → chunk-V34AA7C7.js} +1 -1
- package/dist/chunk-WJ6BMDL3.js +313 -0
- package/dist/{chunk-M6CZQYPY.js → chunk-Z3FWN3HJ.js} +2 -2
- package/dist/discovery/index.cjs +4 -588
- package/dist/discovery/index.js +3 -3
- package/dist/{enforce-quota.interceptor-cv7r80VM.d.cts → enforce-quota.interceptor-BhkX5nq2.d.cts} +127 -12
- package/dist/{enforce-quota.interceptor-Dj1Kusr5.d.ts → enforce-quota.interceptor-CcqZc0Yu.d.ts} +127 -12
- package/dist/entitlement/index.cjs +4 -780
- package/dist/entitlement/index.d.cts +3 -1
- package/dist/entitlement/index.d.ts +3 -1
- package/dist/entitlement/index.js +2 -3
- package/dist/index.cjs +4 -14975
- package/dist/index.d.cts +22 -54
- package/dist/index.d.ts +22 -54
- package/dist/index.js +88 -369
- package/dist/module-CSN8j8Tp.d.cts +39 -0
- package/dist/module-DgYJur6f.d.ts +39 -0
- package/dist/plan-versions.service-BB36Q1bg.d.ts +329 -0
- package/dist/plan-versions.service-CUR2Whyr.d.cts +329 -0
- package/dist/platform/index.cjs +4 -2779
- package/dist/platform/index.d.cts +50 -8
- package/dist/platform/index.d.ts +50 -8
- package/dist/platform/index.js +116 -12
- package/dist/promo/index.cjs +4 -995
- package/dist/promo/index.d.cts +48 -46
- package/dist/promo/index.d.ts +48 -46
- package/dist/promo/index.js +10 -2
- package/dist/rate-limit.guard-dntqAlfZ.d.cts +19 -0
- package/dist/rate-limit.guard-dntqAlfZ.d.ts +19 -0
- package/dist/registration/index.cjs +4 -1655
- package/dist/registration/index.js +1 -1
- package/dist/setup.service-BPwJ7My_.d.cts +45 -0
- package/dist/setup.service-D2mrdDDB.d.ts +45 -0
- package/dist/subscription-bundle-preview.service-BkJXHAeP.d.cts +438 -0
- package/dist/subscription-bundle-preview.service-DBbrE_cw.d.ts +438 -0
- package/dist/subscription-bundles.module-BQmoozm5.d.ts +291 -0
- package/dist/subscription-bundles.module-DCpV-Pb5.d.cts +291 -0
- package/dist/subscription-contract/index.cjs +4 -471
- package/dist/subscription-contract/index.d.cts +5 -13
- package/dist/subscription-contract/index.d.ts +5 -13
- package/dist/subscription-contract.module-CG9fPKAr.d.cts +14 -0
- package/dist/subscription-contract.module-CVebZzHR.d.ts +14 -0
- package/dist/testing/index.cjs +4 -3756
- package/dist/testing/index.d.cts +9 -4
- package/dist/testing/index.d.ts +9 -4
- package/dist/testing/index.js +13 -7
- package/package.json +5 -5
- package/dist/admin-manifest.config-DyrQNT7M.d.cts +0 -10
- package/dist/admin-manifest.config-DyrQNT7M.d.ts +0 -10
- package/dist/admin-manifest.service-Cp6uwvmt.d.cts +0 -33
- package/dist/admin-manifest.service-UGgzR1x-.d.ts +0 -33
- package/dist/chunk-52UTQRD3.js +0 -326
- package/dist/chunk-N3WANKSA.js +0 -20
- package/dist/chunk-Q53N43LQ.js +0 -13
- /package/dist/{chunk-2FR6ZL7R.js → chunk-DBZGV3HC.js} +0 -0
|
@@ -1,89 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import { Type, CanActivate
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
declare class CheckoutOfferService {
|
|
6
|
-
private readonly repo;
|
|
7
|
-
private readonly bundles;
|
|
8
|
-
private readonly plans;
|
|
9
|
-
private readonly catalogEntries;
|
|
10
|
-
constructor(repo: CheckoutOfferRepository, bundles?: BundleRepository | null, plans?: PlanRepository | null, catalogEntries?: CatalogEntryRepository | null);
|
|
11
|
-
list(filter: CheckoutOfferFilter): Promise<CheckoutOfferRow[]>;
|
|
12
|
-
getById(id: string): Promise<CheckoutOfferRow>;
|
|
13
|
-
create(data: CreateCheckoutOfferData): Promise<CheckoutOfferRow>;
|
|
14
|
-
/** Customization in onboarding — only while the offer is `open`. */
|
|
15
|
-
update(id: string, data: UpdateCheckoutOfferData): Promise<CheckoutOfferRow>;
|
|
16
|
-
/**
|
|
17
|
-
* Freezes the offer (`status = 'consumed'`). Returns the final
|
|
18
|
-
* snapshot — the caller (registration/billing) writes it
|
|
19
|
-
* as `Subscription.packageSnapshot`.
|
|
20
|
-
*/
|
|
21
|
-
consume(id: string): Promise<CheckoutOfferRow>;
|
|
22
|
-
/**
|
|
23
|
-
* #35 P6 — server-side requires validation: the dependencies of all
|
|
24
|
-
* features (plan ∪ selected bundles) must be covered within the
|
|
25
|
-
* selection, otherwise an offer would be created whose features cannot
|
|
26
|
-
* work at the tenant (an app-specific validateModuleDependencies check is
|
|
27
|
-
* thereby replaced on the platform side). The requires source are the
|
|
28
|
-
* curated FeatureCatalogEntries; without CatalogEntryRepository it is
|
|
29
|
-
* skipped (graceful — no requires data available).
|
|
30
|
-
*/
|
|
31
|
-
private assertFeatureRequiresSatisfied;
|
|
32
|
-
/**
|
|
33
|
-
* Plan features preferably from the server SSOT (PlanRepository); fallback
|
|
34
|
-
* is the frozen featuresSnapshot of the plan LineItem (adapter without
|
|
35
|
-
* PlanRepository wiring).
|
|
36
|
-
*/
|
|
37
|
-
private resolvePlanFeatures;
|
|
38
|
-
/** Bundle features from the BundleVersions; fallback featuresSnapshot. */
|
|
39
|
-
private resolveBundleFeatures;
|
|
40
|
-
private assertBundleVersionsStillBookable;
|
|
41
|
-
private normalizeCreateData;
|
|
42
|
-
private normalizeUpdateData;
|
|
43
|
-
private resolveLineItems;
|
|
44
|
-
private defaultPlanLineItem;
|
|
45
|
-
private assertOpen;
|
|
46
|
-
private isExpired;
|
|
47
|
-
private dateIsAfterNow;
|
|
48
|
-
private isValidUntilExpired;
|
|
49
|
-
}
|
|
1
|
+
export { C as CheckoutOfferControllerConfig, a as CheckoutOfferModule, b as CheckoutOfferModuleOptions, c as CheckoutOfferService } from '../checkout-offer.module-ZYF5IsDY.cjs';
|
|
2
|
+
import { Type, CanActivate } from '@nestjs/common';
|
|
3
|
+
import { CheckoutOfferPriceBreakdown, CheckoutOfferLineItem, CheckoutOfferPromotionSnapshot, CheckoutOfferPromoCodeSnapshot } from '@saasicat/types';
|
|
4
|
+
import '../di-CcNeq9v-.cjs';
|
|
50
5
|
|
|
51
6
|
declare function buildCheckoutOfferController(guards: Array<Type<CanActivate>>): Type;
|
|
52
7
|
|
|
53
|
-
interface CheckoutOfferControllerConfig {
|
|
54
|
-
/** Class-level guards; `[]` for auth-free public endpoints. */
|
|
55
|
-
guards: Array<Type<CanActivate>>;
|
|
56
|
-
}
|
|
57
|
-
interface CheckoutOfferModuleOptions {
|
|
58
|
-
checkoutOfferRepository: ProviderSpec<CheckoutOfferRepository>;
|
|
59
|
-
/**
|
|
60
|
-
* Optional for V3 revalidation on consume: if set, the service checks
|
|
61
|
-
* whether referenced bundle versions are still bookable. Also provides
|
|
62
|
-
* the bundle features for the requires validation (#35 P6).
|
|
63
|
-
*/
|
|
64
|
-
bundleRepository?: ProviderSpec<BundleRepository>;
|
|
65
|
-
/**
|
|
66
|
-
* Optional for the requires validation (#35 P6): plan features of the
|
|
67
|
-
* chosen plan version. Without wiring, falls back to the featuresSnapshot
|
|
68
|
-
* of the plan line item.
|
|
69
|
-
*/
|
|
70
|
-
planRepository?: ProviderSpec<PlanRepository>;
|
|
71
|
-
/**
|
|
72
|
-
* Optional for the requires validation (#35 P6): requires source =
|
|
73
|
-
* curated FeatureCatalogEntries. Without wiring, the validation is
|
|
74
|
-
* skipped (graceful).
|
|
75
|
-
*/
|
|
76
|
-
catalogEntryRepository?: ProviderSpec<CatalogEntryRepository>;
|
|
77
|
-
/** Controller mount for `/public/checkout-offer`. Omitted = service only. */
|
|
78
|
-
controller?: CheckoutOfferControllerConfig;
|
|
79
|
-
imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
80
|
-
extraProviders?: Provider[];
|
|
81
|
-
global?: boolean;
|
|
82
|
-
}
|
|
83
|
-
declare class CheckoutOfferModule {
|
|
84
|
-
static forRoot(options: CheckoutOfferModuleOptions): DynamicModule;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
8
|
/** Repository for `checkout_offers`. */
|
|
88
9
|
declare const CHECKOUT_OFFER_REPOSITORY_TOKEN: unique symbol;
|
|
89
10
|
|
|
@@ -117,4 +38,4 @@ declare class UpdateCheckoutOfferDto {
|
|
|
117
38
|
validUntil?: string | null;
|
|
118
39
|
}
|
|
119
40
|
|
|
120
|
-
export { CHECKOUT_OFFER_REPOSITORY_TOKEN,
|
|
41
|
+
export { CHECKOUT_OFFER_REPOSITORY_TOKEN, CreateCheckoutOfferDto, UpdateCheckoutOfferDto, buildCheckoutOfferController };
|
|
@@ -1,89 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import { Type, CanActivate
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
declare class CheckoutOfferService {
|
|
6
|
-
private readonly repo;
|
|
7
|
-
private readonly bundles;
|
|
8
|
-
private readonly plans;
|
|
9
|
-
private readonly catalogEntries;
|
|
10
|
-
constructor(repo: CheckoutOfferRepository, bundles?: BundleRepository | null, plans?: PlanRepository | null, catalogEntries?: CatalogEntryRepository | null);
|
|
11
|
-
list(filter: CheckoutOfferFilter): Promise<CheckoutOfferRow[]>;
|
|
12
|
-
getById(id: string): Promise<CheckoutOfferRow>;
|
|
13
|
-
create(data: CreateCheckoutOfferData): Promise<CheckoutOfferRow>;
|
|
14
|
-
/** Customization in onboarding — only while the offer is `open`. */
|
|
15
|
-
update(id: string, data: UpdateCheckoutOfferData): Promise<CheckoutOfferRow>;
|
|
16
|
-
/**
|
|
17
|
-
* Freezes the offer (`status = 'consumed'`). Returns the final
|
|
18
|
-
* snapshot — the caller (registration/billing) writes it
|
|
19
|
-
* as `Subscription.packageSnapshot`.
|
|
20
|
-
*/
|
|
21
|
-
consume(id: string): Promise<CheckoutOfferRow>;
|
|
22
|
-
/**
|
|
23
|
-
* #35 P6 — server-side requires validation: the dependencies of all
|
|
24
|
-
* features (plan ∪ selected bundles) must be covered within the
|
|
25
|
-
* selection, otherwise an offer would be created whose features cannot
|
|
26
|
-
* work at the tenant (an app-specific validateModuleDependencies check is
|
|
27
|
-
* thereby replaced on the platform side). The requires source are the
|
|
28
|
-
* curated FeatureCatalogEntries; without CatalogEntryRepository it is
|
|
29
|
-
* skipped (graceful — no requires data available).
|
|
30
|
-
*/
|
|
31
|
-
private assertFeatureRequiresSatisfied;
|
|
32
|
-
/**
|
|
33
|
-
* Plan features preferably from the server SSOT (PlanRepository); fallback
|
|
34
|
-
* is the frozen featuresSnapshot of the plan LineItem (adapter without
|
|
35
|
-
* PlanRepository wiring).
|
|
36
|
-
*/
|
|
37
|
-
private resolvePlanFeatures;
|
|
38
|
-
/** Bundle features from the BundleVersions; fallback featuresSnapshot. */
|
|
39
|
-
private resolveBundleFeatures;
|
|
40
|
-
private assertBundleVersionsStillBookable;
|
|
41
|
-
private normalizeCreateData;
|
|
42
|
-
private normalizeUpdateData;
|
|
43
|
-
private resolveLineItems;
|
|
44
|
-
private defaultPlanLineItem;
|
|
45
|
-
private assertOpen;
|
|
46
|
-
private isExpired;
|
|
47
|
-
private dateIsAfterNow;
|
|
48
|
-
private isValidUntilExpired;
|
|
49
|
-
}
|
|
1
|
+
export { C as CheckoutOfferControllerConfig, a as CheckoutOfferModule, b as CheckoutOfferModuleOptions, c as CheckoutOfferService } from '../checkout-offer.module-Y0hDOVrq.js';
|
|
2
|
+
import { Type, CanActivate } from '@nestjs/common';
|
|
3
|
+
import { CheckoutOfferPriceBreakdown, CheckoutOfferLineItem, CheckoutOfferPromotionSnapshot, CheckoutOfferPromoCodeSnapshot } from '@saasicat/types';
|
|
4
|
+
import '../di-CcNeq9v-.js';
|
|
50
5
|
|
|
51
6
|
declare function buildCheckoutOfferController(guards: Array<Type<CanActivate>>): Type;
|
|
52
7
|
|
|
53
|
-
interface CheckoutOfferControllerConfig {
|
|
54
|
-
/** Class-level guards; `[]` for auth-free public endpoints. */
|
|
55
|
-
guards: Array<Type<CanActivate>>;
|
|
56
|
-
}
|
|
57
|
-
interface CheckoutOfferModuleOptions {
|
|
58
|
-
checkoutOfferRepository: ProviderSpec<CheckoutOfferRepository>;
|
|
59
|
-
/**
|
|
60
|
-
* Optional for V3 revalidation on consume: if set, the service checks
|
|
61
|
-
* whether referenced bundle versions are still bookable. Also provides
|
|
62
|
-
* the bundle features for the requires validation (#35 P6).
|
|
63
|
-
*/
|
|
64
|
-
bundleRepository?: ProviderSpec<BundleRepository>;
|
|
65
|
-
/**
|
|
66
|
-
* Optional for the requires validation (#35 P6): plan features of the
|
|
67
|
-
* chosen plan version. Without wiring, falls back to the featuresSnapshot
|
|
68
|
-
* of the plan line item.
|
|
69
|
-
*/
|
|
70
|
-
planRepository?: ProviderSpec<PlanRepository>;
|
|
71
|
-
/**
|
|
72
|
-
* Optional for the requires validation (#35 P6): requires source =
|
|
73
|
-
* curated FeatureCatalogEntries. Without wiring, the validation is
|
|
74
|
-
* skipped (graceful).
|
|
75
|
-
*/
|
|
76
|
-
catalogEntryRepository?: ProviderSpec<CatalogEntryRepository>;
|
|
77
|
-
/** Controller mount for `/public/checkout-offer`. Omitted = service only. */
|
|
78
|
-
controller?: CheckoutOfferControllerConfig;
|
|
79
|
-
imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
80
|
-
extraProviders?: Provider[];
|
|
81
|
-
global?: boolean;
|
|
82
|
-
}
|
|
83
|
-
declare class CheckoutOfferModule {
|
|
84
|
-
static forRoot(options: CheckoutOfferModuleOptions): DynamicModule;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
8
|
/** Repository for `checkout_offers`. */
|
|
88
9
|
declare const CHECKOUT_OFFER_REPOSITORY_TOKEN: unique symbol;
|
|
89
10
|
|
|
@@ -117,4 +38,4 @@ declare class UpdateCheckoutOfferDto {
|
|
|
117
38
|
validUntil?: string | null;
|
|
118
39
|
}
|
|
119
40
|
|
|
120
|
-
export { CHECKOUT_OFFER_REPOSITORY_TOKEN,
|
|
41
|
+
export { CHECKOUT_OFFER_REPOSITORY_TOKEN, CreateCheckoutOfferDto, UpdateCheckoutOfferDto, buildCheckoutOfferController };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "../chunk-DBZGV3HC.js";
|
|
1
2
|
import {
|
|
2
3
|
CHECKOUT_OFFER_REPOSITORY_TOKEN,
|
|
3
4
|
CheckoutOfferModule,
|
|
@@ -5,9 +6,9 @@ import {
|
|
|
5
6
|
CreateCheckoutOfferDto,
|
|
6
7
|
UpdateCheckoutOfferDto,
|
|
7
8
|
buildCheckoutOfferController
|
|
8
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-HBFU5AN3.js";
|
|
9
10
|
import "../chunk-MDIZUVIK.js";
|
|
10
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-L4KTQ6CL.js";
|
|
11
12
|
import "../chunk-SABTXESR.js";
|
|
12
13
|
import "../chunk-SHUYVCID.js";
|
|
13
14
|
export {
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { CheckoutOfferRepository, BundleRepository, PlanRepository, CatalogEntryRepository, CheckoutOfferFilter, CheckoutOfferRow, CreateCheckoutOfferData, UpdateCheckoutOfferData } from '@saasicat/types';
|
|
2
|
+
import { Type, CanActivate, DynamicModule, ForwardReference, Provider } from '@nestjs/common';
|
|
3
|
+
import { P as ProviderSpec } from './di-CcNeq9v-.js';
|
|
4
|
+
|
|
5
|
+
declare class CheckoutOfferService {
|
|
6
|
+
private readonly repo;
|
|
7
|
+
private readonly bundles;
|
|
8
|
+
private readonly plans;
|
|
9
|
+
private readonly catalogEntries;
|
|
10
|
+
constructor(repo: CheckoutOfferRepository, bundles?: BundleRepository | null, plans?: PlanRepository | null, catalogEntries?: CatalogEntryRepository | null);
|
|
11
|
+
list(filter: CheckoutOfferFilter): Promise<CheckoutOfferRow[]>;
|
|
12
|
+
getById(id: string): Promise<CheckoutOfferRow>;
|
|
13
|
+
create(data: CreateCheckoutOfferData): Promise<CheckoutOfferRow>;
|
|
14
|
+
/** Customization in onboarding — only while the offer is `open`. */
|
|
15
|
+
update(id: string, data: UpdateCheckoutOfferData): Promise<CheckoutOfferRow>;
|
|
16
|
+
/**
|
|
17
|
+
* Freezes the offer (`status = 'consumed'`). Returns the final
|
|
18
|
+
* snapshot — the caller (registration/billing) writes it
|
|
19
|
+
* as `Subscription.packageSnapshot`.
|
|
20
|
+
*/
|
|
21
|
+
consume(id: string): Promise<CheckoutOfferRow>;
|
|
22
|
+
/**
|
|
23
|
+
* #35 P6 — server-side requires validation: the dependencies of all
|
|
24
|
+
* features (plan ∪ selected bundles) must be covered within the
|
|
25
|
+
* selection, otherwise an offer would be created whose features cannot
|
|
26
|
+
* work at the tenant (an app-specific validateModuleDependencies check is
|
|
27
|
+
* thereby replaced on the platform side). The requires source are the
|
|
28
|
+
* curated FeatureCatalogEntries; without CatalogEntryRepository it is
|
|
29
|
+
* skipped (graceful — no requires data available).
|
|
30
|
+
*/
|
|
31
|
+
private assertFeatureRequiresSatisfied;
|
|
32
|
+
/**
|
|
33
|
+
* Plan features preferably from the server SSOT (PlanRepository); fallback
|
|
34
|
+
* is the frozen featuresSnapshot of the plan LineItem (adapter without
|
|
35
|
+
* PlanRepository wiring).
|
|
36
|
+
*/
|
|
37
|
+
private resolvePlanFeatures;
|
|
38
|
+
/** Bundle features from the BundleVersions; fallback featuresSnapshot. */
|
|
39
|
+
private resolveBundleFeatures;
|
|
40
|
+
private assertBundleVersionsStillBookable;
|
|
41
|
+
private normalizeCreateData;
|
|
42
|
+
private normalizeUpdateData;
|
|
43
|
+
private resolveLineItems;
|
|
44
|
+
private defaultPlanLineItem;
|
|
45
|
+
private assertOpen;
|
|
46
|
+
private isExpired;
|
|
47
|
+
private dateIsAfterNow;
|
|
48
|
+
private isValidUntilExpired;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface CheckoutOfferControllerConfig {
|
|
52
|
+
/** Class-level guards; `[]` for auth-free public endpoints. */
|
|
53
|
+
guards: Array<Type<CanActivate>>;
|
|
54
|
+
}
|
|
55
|
+
interface CheckoutOfferModuleOptions {
|
|
56
|
+
checkoutOfferRepository: ProviderSpec<CheckoutOfferRepository>;
|
|
57
|
+
/**
|
|
58
|
+
* Optional for V3 revalidation on consume: if set, the service checks
|
|
59
|
+
* whether referenced bundle versions are still bookable. Also provides
|
|
60
|
+
* the bundle features for the requires validation (#35 P6).
|
|
61
|
+
*/
|
|
62
|
+
bundleRepository?: ProviderSpec<BundleRepository>;
|
|
63
|
+
/**
|
|
64
|
+
* Optional for the requires validation (#35 P6): plan features of the
|
|
65
|
+
* chosen plan version. Without wiring, falls back to the featuresSnapshot
|
|
66
|
+
* of the plan line item.
|
|
67
|
+
*/
|
|
68
|
+
planRepository?: ProviderSpec<PlanRepository>;
|
|
69
|
+
/**
|
|
70
|
+
* Optional for the requires validation (#35 P6): requires source =
|
|
71
|
+
* curated FeatureCatalogEntries. Without wiring, the validation is
|
|
72
|
+
* skipped (graceful).
|
|
73
|
+
*/
|
|
74
|
+
catalogEntryRepository?: ProviderSpec<CatalogEntryRepository>;
|
|
75
|
+
/** Controller mount for `/public/checkout-offer`. Omitted = service only. */
|
|
76
|
+
controller?: CheckoutOfferControllerConfig;
|
|
77
|
+
imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
78
|
+
extraProviders?: Provider[];
|
|
79
|
+
global?: boolean;
|
|
80
|
+
}
|
|
81
|
+
declare class CheckoutOfferModule {
|
|
82
|
+
static forRoot(options: CheckoutOfferModuleOptions): DynamicModule;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { type CheckoutOfferControllerConfig as C, CheckoutOfferModule as a, type CheckoutOfferModuleOptions as b, CheckoutOfferService as c };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { CheckoutOfferRepository, BundleRepository, PlanRepository, CatalogEntryRepository, CheckoutOfferFilter, CheckoutOfferRow, CreateCheckoutOfferData, UpdateCheckoutOfferData } from '@saasicat/types';
|
|
2
|
+
import { Type, CanActivate, DynamicModule, ForwardReference, Provider } from '@nestjs/common';
|
|
3
|
+
import { P as ProviderSpec } from './di-CcNeq9v-.cjs';
|
|
4
|
+
|
|
5
|
+
declare class CheckoutOfferService {
|
|
6
|
+
private readonly repo;
|
|
7
|
+
private readonly bundles;
|
|
8
|
+
private readonly plans;
|
|
9
|
+
private readonly catalogEntries;
|
|
10
|
+
constructor(repo: CheckoutOfferRepository, bundles?: BundleRepository | null, plans?: PlanRepository | null, catalogEntries?: CatalogEntryRepository | null);
|
|
11
|
+
list(filter: CheckoutOfferFilter): Promise<CheckoutOfferRow[]>;
|
|
12
|
+
getById(id: string): Promise<CheckoutOfferRow>;
|
|
13
|
+
create(data: CreateCheckoutOfferData): Promise<CheckoutOfferRow>;
|
|
14
|
+
/** Customization in onboarding — only while the offer is `open`. */
|
|
15
|
+
update(id: string, data: UpdateCheckoutOfferData): Promise<CheckoutOfferRow>;
|
|
16
|
+
/**
|
|
17
|
+
* Freezes the offer (`status = 'consumed'`). Returns the final
|
|
18
|
+
* snapshot — the caller (registration/billing) writes it
|
|
19
|
+
* as `Subscription.packageSnapshot`.
|
|
20
|
+
*/
|
|
21
|
+
consume(id: string): Promise<CheckoutOfferRow>;
|
|
22
|
+
/**
|
|
23
|
+
* #35 P6 — server-side requires validation: the dependencies of all
|
|
24
|
+
* features (plan ∪ selected bundles) must be covered within the
|
|
25
|
+
* selection, otherwise an offer would be created whose features cannot
|
|
26
|
+
* work at the tenant (an app-specific validateModuleDependencies check is
|
|
27
|
+
* thereby replaced on the platform side). The requires source are the
|
|
28
|
+
* curated FeatureCatalogEntries; without CatalogEntryRepository it is
|
|
29
|
+
* skipped (graceful — no requires data available).
|
|
30
|
+
*/
|
|
31
|
+
private assertFeatureRequiresSatisfied;
|
|
32
|
+
/**
|
|
33
|
+
* Plan features preferably from the server SSOT (PlanRepository); fallback
|
|
34
|
+
* is the frozen featuresSnapshot of the plan LineItem (adapter without
|
|
35
|
+
* PlanRepository wiring).
|
|
36
|
+
*/
|
|
37
|
+
private resolvePlanFeatures;
|
|
38
|
+
/** Bundle features from the BundleVersions; fallback featuresSnapshot. */
|
|
39
|
+
private resolveBundleFeatures;
|
|
40
|
+
private assertBundleVersionsStillBookable;
|
|
41
|
+
private normalizeCreateData;
|
|
42
|
+
private normalizeUpdateData;
|
|
43
|
+
private resolveLineItems;
|
|
44
|
+
private defaultPlanLineItem;
|
|
45
|
+
private assertOpen;
|
|
46
|
+
private isExpired;
|
|
47
|
+
private dateIsAfterNow;
|
|
48
|
+
private isValidUntilExpired;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface CheckoutOfferControllerConfig {
|
|
52
|
+
/** Class-level guards; `[]` for auth-free public endpoints. */
|
|
53
|
+
guards: Array<Type<CanActivate>>;
|
|
54
|
+
}
|
|
55
|
+
interface CheckoutOfferModuleOptions {
|
|
56
|
+
checkoutOfferRepository: ProviderSpec<CheckoutOfferRepository>;
|
|
57
|
+
/**
|
|
58
|
+
* Optional for V3 revalidation on consume: if set, the service checks
|
|
59
|
+
* whether referenced bundle versions are still bookable. Also provides
|
|
60
|
+
* the bundle features for the requires validation (#35 P6).
|
|
61
|
+
*/
|
|
62
|
+
bundleRepository?: ProviderSpec<BundleRepository>;
|
|
63
|
+
/**
|
|
64
|
+
* Optional for the requires validation (#35 P6): plan features of the
|
|
65
|
+
* chosen plan version. Without wiring, falls back to the featuresSnapshot
|
|
66
|
+
* of the plan line item.
|
|
67
|
+
*/
|
|
68
|
+
planRepository?: ProviderSpec<PlanRepository>;
|
|
69
|
+
/**
|
|
70
|
+
* Optional for the requires validation (#35 P6): requires source =
|
|
71
|
+
* curated FeatureCatalogEntries. Without wiring, the validation is
|
|
72
|
+
* skipped (graceful).
|
|
73
|
+
*/
|
|
74
|
+
catalogEntryRepository?: ProviderSpec<CatalogEntryRepository>;
|
|
75
|
+
/** Controller mount for `/public/checkout-offer`. Omitted = service only. */
|
|
76
|
+
controller?: CheckoutOfferControllerConfig;
|
|
77
|
+
imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
78
|
+
extraProviders?: Provider[];
|
|
79
|
+
global?: boolean;
|
|
80
|
+
}
|
|
81
|
+
declare class CheckoutOfferModule {
|
|
82
|
+
static forRoot(options: CheckoutOfferModuleOptions): DynamicModule;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { type CheckoutOfferControllerConfig as C, CheckoutOfferModule as a, type CheckoutOfferModuleOptions as b, CheckoutOfferService as c };
|