@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
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Type, DynamicModule, ForwardReference, Provider, CanActivate, FactoryProvider } from '@nestjs/common';
|
|
2
|
-
import { SuperAdminProvisioningPort, MfaPort, AuditPort, RlsBypassPort, PlanCatalogReadSink, SubscriptionRepository, PlanVersionRepository, TransactionRunner, AdminResourcesPort, FeatureUiRegistry, PlanCatalog, SaaSiCatPersistenceAdapter, QuotaProvider, SubscriptionUsagePort, UsageSnapshotPort, TenantSubscriptionWritePort, FirstTimeCustomerCheck } from '@saasicat/core';
|
|
2
|
+
import { SuperAdminProvisioningPort, MfaPort, AuditPort, RlsBypassPort, AppliedSettingsPort, EmailPort, PlanCatalogReadSink, SubscriptionRepository, PlanVersionRepository, TransactionRunner, AdminResourcesPort, FeatureUiRegistry, PlanCatalog, SaaSiCatPersistenceAdapter, QuotaProvider, SubscriptionUsagePort, UsageSnapshotPort, TenantSubscriptionWritePort, FirstTimeCustomerCheck } from '@saasicat/core';
|
|
3
3
|
import { P as ProviderSpec } from './di-CcNeq9v-.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { E as EntitlementResolutionConfig } from './plan-resolution-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { a as
|
|
4
|
+
import { A as AdminResourcesModuleOptions, a as AdminStatsModuleOptions, b as AdminManifestConfig } from './admin-resources.module-CWqdI9BV.js';
|
|
5
|
+
import { L as LoadPlanCatalogOptions, T as TenantBillingModuleOptions, S as SubscriptionBundleModuleOptions, a as SubscriptionBundleControllerOptions } from './tenant-billing.module-DohgJJ2m.js';
|
|
6
|
+
import { C as CatalogModuleOptions, P as PublicMarketingCatalogOptions, N as NewPaymentMethodsSource } from './catalog.module-C9O7BxRq.js';
|
|
7
|
+
import { D as DiscoveryAppInfo } from './discovery.scanner-DXKc6JkV.js';
|
|
8
|
+
import { E as EntitlementResolutionConfig } from './plan-resolution-CwUy_OqC.js';
|
|
9
|
+
import { P as PromoCodesModuleOptions } from './promo.module-DuIJdK3U.js';
|
|
10
|
+
import { C as CheckoutOfferModuleOptions } from './checkout-offer.module-x7SP_dX4.js';
|
|
11
|
+
import { P as PaymentsModuleOptions, a as PaymentsTenantRoutesOptions } from './payments.module-CQGv_VG7.js';
|
|
12
|
+
import { S as SubscriptionContractModuleOptions } from './subscription-contract.module-BfIRpc1o.js';
|
|
12
13
|
|
|
13
14
|
interface SetupModuleOptions {
|
|
14
15
|
/**
|
|
@@ -82,6 +83,21 @@ interface SaaSiCatAdapters {
|
|
|
82
83
|
mfa?: ProviderSpec<MfaPort>;
|
|
83
84
|
audit?: ProviderSpec<AuditPort>;
|
|
84
85
|
rlsBypass?: ProviderSpec<RlsBypassPort>;
|
|
86
|
+
/**
|
|
87
|
+
* Optional. Where the record of the applied configuration is kept; the
|
|
88
|
+
* `persistence` bundle supplies it by default. Without either, the platform
|
|
89
|
+
* runs the configuration all the same and says once, at boot, that it is
|
|
90
|
+
* not recording it.
|
|
91
|
+
*/
|
|
92
|
+
appliedSettings?: ProviderSpec<AppliedSettingsPort>;
|
|
93
|
+
/**
|
|
94
|
+
* Optional. How the platform mails an operator — today, the people
|
|
95
|
+
* `config/saas.yaml#notifications.settingsChanged` names when a start
|
|
96
|
+
* finds the settings changed. Not part of a persistence bundle: mail is not
|
|
97
|
+
* persistence. Without it the record is still written, and the boot log
|
|
98
|
+
* says once that the addresses in the file reach nobody.
|
|
99
|
+
*/
|
|
100
|
+
email?: ProviderSpec<EmailPort>;
|
|
85
101
|
/**
|
|
86
102
|
* Optional. If provided, `PlanCatalogModule` is hydrated from this sink
|
|
87
103
|
* (DB read at boot). If omitted, `planCatalog` MUST be passed as a ready
|
|
@@ -105,7 +121,17 @@ interface SaaSiCatAdapters {
|
|
|
105
121
|
transactionRunner?: ProviderSpec<TransactionRunner>;
|
|
106
122
|
}
|
|
107
123
|
type PlatformImports = Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
108
|
-
interface SaaSiCatCatalogOptions extends Pick<CatalogModuleOptions, 'strictModeCheckMode' | 'autoSyncDiscoveryAtBoot' | 'marketedOnlyFeatures' | '
|
|
124
|
+
interface SaaSiCatCatalogOptions extends Pick<CatalogModuleOptions, 'strictModeCheckMode' | 'autoSyncDiscoveryAtBoot' | 'marketedOnlyFeatures' | 'extraProviders'> {
|
|
125
|
+
/**
|
|
126
|
+
* The auth-free pricing-page endpoint. Unlike `CatalogModule`'s own option,
|
|
127
|
+
* `newPaymentMethodsFrom` is left out here: it is filled from `payments`,
|
|
128
|
+
* so the endpoint and the gateways cannot disagree. Naming a source
|
|
129
|
+
* overrides that; there is no way to say "none" here, because `payments`
|
|
130
|
+
* says it already.
|
|
131
|
+
*/
|
|
132
|
+
publicMarketingCatalog?: Omit<PublicMarketingCatalogOptions, 'newPaymentMethodsFrom'> & {
|
|
133
|
+
newPaymentMethodsFrom?: Type<NewPaymentMethodsSource>;
|
|
134
|
+
};
|
|
109
135
|
/** Labels/icons used by discovery review and the public catalog. */
|
|
110
136
|
featureUiRegistry: FeatureUiRegistry;
|
|
111
137
|
/** Mount the SuperAdmin catalog controllers. Default `true`. */
|
|
@@ -127,6 +153,19 @@ interface SaaSiCatTenantBillingOptions extends Omit<TenantBillingModuleOptions,
|
|
|
127
153
|
usageSnapshotPort?: ProviderSpec<UsageSnapshotPort>;
|
|
128
154
|
subscriptionWritePort?: ProviderSpec<TenantSubscriptionWritePort>;
|
|
129
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Payment methods through a payment gateway. The event log and the payment
|
|
158
|
+
* methods come from `persistence.payments`, the subscribers from
|
|
159
|
+
* `persistence.entitlement`, and the tenant's routes share `tenantBilling`'s
|
|
160
|
+
* authentication and resolvers.
|
|
161
|
+
*/
|
|
162
|
+
interface SaaSiCatPaymentsOptions extends Pick<PaymentsModuleOptions, 'gateways' | 'imports' | 'extraProviders'> {
|
|
163
|
+
/**
|
|
164
|
+
* Who of a tenant's users holds the billing permission, which the tenant's
|
|
165
|
+
* payment method routes require. Default: the tenant's administrator.
|
|
166
|
+
*/
|
|
167
|
+
billingPermissionGuards?: PaymentsTenantRoutesOptions['billingPermissionGuards'];
|
|
168
|
+
}
|
|
130
169
|
interface SaaSiCatSubscriptionBundlesOptions extends Omit<SubscriptionBundleModuleOptions, 'subscriptionBundleRepository' | 'bundleRepository' | 'controller' | 'imports' | 'extraProviders' | 'global'> {
|
|
131
170
|
/** Default mounts the tenant controller and reuses tenant-billing auth. */
|
|
132
171
|
controller?: false | Omit<SubscriptionBundleControllerOptions, 'authGuards' | 'subscriptionUsagePort'>;
|
|
@@ -134,12 +173,16 @@ interface SaaSiCatSubscriptionBundlesOptions extends Omit<SubscriptionBundleModu
|
|
|
134
173
|
extraProviders?: Provider[];
|
|
135
174
|
}
|
|
136
175
|
interface SaaSiCatAdminResourcesOptions extends Omit<AdminResourcesModuleOptions, 'resources' | 'guards' | 'global'> {
|
|
137
|
-
/**
|
|
176
|
+
/**
|
|
177
|
+
* Override the default controller guards + `SuperAdminGuard` chain.
|
|
178
|
+
* Suspending and reactivating a tenant require the second factor either
|
|
179
|
+
* way; that check sits on the two handlers, not in this list.
|
|
180
|
+
*/
|
|
138
181
|
guards?: Array<Type<CanActivate>>;
|
|
139
182
|
/** Custom schema override; the persistence bundle supplies the default. */
|
|
140
183
|
resources?: ProviderSpec<AdminResourcesPort>;
|
|
141
184
|
}
|
|
142
|
-
interface SaaSiCatPromoCodesOptions extends Omit<PromoCodesModuleOptions, 'promoCodeRepository' | 'redemptionRepository' | 'validationLogRepository' | 'subscriptionLookup' | 'revenueAggregator' | 'transactionRunner' | 'firstTimeCustomerCheck' | 'adminController' | 'global'> {
|
|
185
|
+
interface SaaSiCatPromoCodesOptions extends Omit<PromoCodesModuleOptions, 'promoCodeRepository' | 'redemptionRepository' | 'validationLogRepository' | 'subscriptionLookup' | 'revenueAggregator' | 'holdRepository' | 'transactionRunner' | 'firstTimeCustomerCheck' | 'adminController' | 'global'> {
|
|
143
186
|
/**
|
|
144
187
|
* Required when the public preview/redeem flow is enabled. Admin-only
|
|
145
188
|
* setups do not need an app-specific customer-history check.
|
|
@@ -169,53 +212,81 @@ interface SaaSiCatAdminStatsOptions extends Omit<AdminStatsModuleOptions, 'audit
|
|
|
169
212
|
* Public checkout-offer flow. Catalog repositories default to the persistence
|
|
170
213
|
* bundle, while the app still supplies its checkout-offer repository.
|
|
171
214
|
*/
|
|
172
|
-
interface SaaSiCatCheckoutOfferOptions extends Omit<CheckoutOfferModuleOptions, 'bundleRepository' | 'planRepository' | 'catalogEntryRepository' | 'global'> {
|
|
215
|
+
interface SaaSiCatCheckoutOfferOptions extends Omit<CheckoutOfferModuleOptions, 'bundleRepository' | 'planRepository' | 'promotionRepository' | 'catalogEntryRepository' | 'conclusion' | 'global'> {
|
|
173
216
|
bundleRepository?: CheckoutOfferModuleOptions['bundleRepository'];
|
|
217
|
+
/**
|
|
218
|
+
* Defaults to the persistence bundle's subscription contract repository and
|
|
219
|
+
* transaction runner, so `conclude` works wherever the bundle has both.
|
|
220
|
+
*/
|
|
221
|
+
conclusion?: Partial<NonNullable<CheckoutOfferModuleOptions['conclusion']>>;
|
|
222
|
+
/** Defaults to the persistence bundle's plan repository; an offer cannot be priced without one. */
|
|
174
223
|
planRepository?: CheckoutOfferModuleOptions['planRepository'];
|
|
224
|
+
promotionRepository?: CheckoutOfferModuleOptions['promotionRepository'];
|
|
175
225
|
catalogEntryRepository?: CheckoutOfferModuleOptions['catalogEntryRepository'];
|
|
176
226
|
}
|
|
177
|
-
/**
|
|
178
|
-
|
|
227
|
+
/**
|
|
228
|
+
* Subscription-contract service and the subscriber service beside it, deriving
|
|
229
|
+
* both repositories from persistence by default.
|
|
230
|
+
*/
|
|
231
|
+
interface SaaSiCatSubscriptionContractOptions extends Omit<SubscriptionContractModuleOptions, 'subscriptionContractRepository' | 'subscriberRepository' | 'global'> {
|
|
179
232
|
subscriptionContractRepository?: SubscriptionContractModuleOptions['subscriptionContractRepository'];
|
|
233
|
+
subscriberRepository?: SubscriptionContractModuleOptions['subscriberRepository'];
|
|
180
234
|
}
|
|
181
235
|
/**
|
|
182
236
|
* What `SaaSiCatModule.forRoot()` composes.
|
|
183
237
|
*
|
|
184
238
|
* One subsystem is deliberately absent: **self-registration**. A prospect
|
|
185
|
-
* signing themselves up — mail address, OTP, plan choice, payment,
|
|
186
|
-
* is `RegistrationModule` from `@saasicat/nest/registration`, and
|
|
187
|
-
* hand-wired:
|
|
239
|
+
* signing themselves up — mail address, OTP, plan choice, payment method,
|
|
240
|
+
* activation — is `RegistrationModule` from `@saasicat/nest/registration`, and
|
|
241
|
+
* it is hand-wired: its required ports are ones no persistence bundle
|
|
242
|
+
* supplies. Its payment method is taken through `payments`, which is composed
|
|
243
|
+
* here.
|
|
188
244
|
*
|
|
189
|
-
* That is a decision with a reason and a plan, not an omission:
|
|
245
|
+
* That is a decision with a reason and a plan, not an omission: those ports
|
|
190
246
|
* have no executable contract yet (`@saasicat/persistence-testing` covers the
|
|
191
|
-
*
|
|
247
|
+
* ports a persistence bundle supplies and none of these), and
|
|
192
248
|
* folding unverified ports into a bundle would move the problem rather than
|
|
193
|
-
* check it. See `docs/self-registration.md`.
|
|
249
|
+
* check it. See `docs/guides/self-registration.md`.
|
|
194
250
|
*
|
|
195
251
|
* Everything else — an operator creating tenants through the SuperAdmin UI, a
|
|
196
252
|
* CLI, or your own onboarding form — is composed here.
|
|
197
253
|
*/
|
|
254
|
+
/**
|
|
255
|
+
* The members `dbCatalog` takes. The type below is derived from this list, so
|
|
256
|
+
* the shape the platform refuses at boot and the shape the compiler accepts
|
|
257
|
+
* cannot drift apart — and `saasicat codemod v1` reads the same list.
|
|
258
|
+
*/
|
|
259
|
+
declare const DB_CATALOG_MEMBERS: readonly ["path", "env"];
|
|
260
|
+
/**
|
|
261
|
+
* Which `config/saas.yaml` a database-held catalogue reads its settings from.
|
|
262
|
+
*
|
|
263
|
+
* The same file the quickstart path loads, read by the platform. A `plans:` or
|
|
264
|
+
* `features:` block in it is not read on this path — the sink is their source —
|
|
265
|
+
* so a file kept as the seed for `saasicat catalog import` still loads.
|
|
266
|
+
*/
|
|
267
|
+
type DbCatalogOptions = Pick<LoadPlanCatalogOptions, (typeof DB_CATALOG_MEMBERS)[number]>;
|
|
198
268
|
interface SaaSiCatModuleOptions {
|
|
199
269
|
/**
|
|
200
270
|
* Plan catalog. Either as an already-loaded object (quickstart, comes
|
|
201
271
|
* directly from `loadPlanCatalogFromFile('config/saas.yaml')`) or via DB
|
|
202
272
|
* hydration: a sink reference in `adapters.planCatalogReadSink` /
|
|
203
|
-
* `persistence.planCatalogReadSink` **plus**
|
|
273
|
+
* `persistence.planCatalogReadSink` **plus** `dbCatalog` naming the file.
|
|
204
274
|
*/
|
|
205
275
|
planCatalog?: PlanCatalog;
|
|
206
276
|
/**
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
277
|
+
* The DB-hydration path — required when `planCatalog` is omitted: the
|
|
278
|
+
* `config/saas.yaml` the platform reads the settings from. The read sink
|
|
279
|
+
* loads plans and features; `app`, `currency`, `vatRate`, `tenantBilling`,
|
|
280
|
+
* `marketing` and `notifications` are not in the database and never will
|
|
281
|
+
* be, so they come from the file this names.
|
|
282
|
+
*
|
|
283
|
+
* A path rather than the values. The option used to take them as values,
|
|
284
|
+
* and every consumer forwarded them from the file it had loaded anyway —
|
|
285
|
+
* by agreement, which is a second place a setting can live. The file
|
|
286
|
+
* defines them by construction now: there is nothing here to type a
|
|
287
|
+
* setting into.
|
|
288
|
+
*/
|
|
289
|
+
dbCatalog?: DbCatalogOptions;
|
|
219
290
|
/**
|
|
220
291
|
* Aggregate persistence bundle from an adapter package (e.g.
|
|
221
292
|
* `prismaPersistence({ client: PrismaService })` from
|
|
@@ -231,13 +302,16 @@ interface SaaSiCatModuleOptions {
|
|
|
231
302
|
*/
|
|
232
303
|
adapters?: SaaSiCatAdapters;
|
|
233
304
|
/**
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
* without auth (platform security).
|
|
305
|
+
* The guards that establish who is calling the platform's controllers —
|
|
306
|
+
* typically `[JwtAuthGuard]`. REQUIRED: the platform does not mount an
|
|
307
|
+
* administration route whose protection nobody decided.
|
|
238
308
|
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
309
|
+
* Authentication only. Every operator route the platform mounts — the
|
|
310
|
+
* administration, catalogue, discovery, manifest, settings, promo codes and
|
|
311
|
+
* statistics — runs `SuperAdminGuard` after these, and the tenant manifest
|
|
312
|
+
* falls back to these guards alone, so a role check added here would lock
|
|
313
|
+
* tenants out of their own manifest. With `[]` nothing establishes a
|
|
314
|
+
* caller, and `SuperAdminGuard` refuses every operator request.
|
|
241
315
|
*/
|
|
242
316
|
controller: {
|
|
243
317
|
guards: Array<Type<CanActivate>>;
|
|
@@ -257,6 +331,19 @@ interface SaaSiCatModuleOptions {
|
|
|
257
331
|
* app can simply override.
|
|
258
332
|
*/
|
|
259
333
|
includeManifestController?: boolean;
|
|
334
|
+
/**
|
|
335
|
+
* Mount the platform's `GET /admin/settings` controller — the running
|
|
336
|
+
* configuration, since when it applies, and what changed between two
|
|
337
|
+
* starts. Default `true`.
|
|
338
|
+
*
|
|
339
|
+
* Set `false` when the app serves that route itself; the record is kept
|
|
340
|
+
* and compared at boot either way, only the endpoint is left out — the
|
|
341
|
+
* sidebar entry stays, since the page is shipped and the route answers. Note
|
|
342
|
+
* what the endpoint answers: the resolved settings and the absolute path of
|
|
343
|
+
* `config/saas.yaml`, behind `controller.guards` and `SuperAdminGuard` —
|
|
344
|
+
* the same chain as the manifest and discovery.
|
|
345
|
+
*/
|
|
346
|
+
includeSettingsController?: boolean;
|
|
260
347
|
/**
|
|
261
348
|
* Modules whose providers must be visible in the DI scope (typically:
|
|
262
349
|
* `AuthModule` with the `JwtAuthGuard`).
|
|
@@ -323,6 +410,13 @@ interface SaaSiCatModuleOptions {
|
|
|
323
410
|
* `quotaProviders` unless explicitly overridden.
|
|
324
411
|
*/
|
|
325
412
|
tenantBilling?: false | SaaSiCatTenantBillingOptions;
|
|
413
|
+
/**
|
|
414
|
+
* Payment methods through a payment gateway: the webhook route for every
|
|
415
|
+
* account in `config/saas.yaml#payments`, and — with `tenantBilling` — the
|
|
416
|
+
* tenant's payment method behind the billing permission. Self-registration
|
|
417
|
+
* takes a sign-up's payment method through it.
|
|
418
|
+
*/
|
|
419
|
+
payments?: false | SaaSiCatPaymentsOptions;
|
|
326
420
|
/**
|
|
327
421
|
* Add-on bundle service and tenant controller. `true` uses defaults and
|
|
328
422
|
* reuses tenant-billing auth/usage; an object customizes policy.
|
|
@@ -403,4 +497,4 @@ interface SaaSiCatModuleOptions {
|
|
|
403
497
|
enforcementChainCheck?: boolean;
|
|
404
498
|
}
|
|
405
499
|
|
|
406
|
-
export { PLAN_RESOLVER_PORT_TOKEN as P, type SaaSiCatAdapters as S, type TenantManifestControllerOptions as T,
|
|
500
|
+
export { DB_CATALOG_MEMBERS as D, PLAN_RESOLVER_PORT_TOKEN as P, type SaaSiCatAdapters as S, type TenantManifestControllerOptions as T, StaticPlanResolver as a, type PlanResolverPort as b, type SaaSiCatModuleOptions as c, type SaaSiCatAdminResourcesOptions as d, type SaaSiCatAdminStatsOptions as e, type SaaSiCatCatalogOptions as f, type SaaSiCatCheckoutOfferOptions as g, type SaaSiCatPromoCodesOptions as h, type SaaSiCatSetupOptions as i, type SaaSiCatSubscriptionBundlesOptions as j, type SaaSiCatSubscriptionContractOptions as k, type SaaSiCatTenantAuthGuards as l, type SaaSiCatTenantBillingOptions as m, SetupModule as n, type SetupModuleOptions as o, type DbCatalogOptions as p, buildTenantManifestController as q };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Type, DynamicModule, ForwardReference, Provider, CanActivate, FactoryProvider } from '@nestjs/common';
|
|
2
|
-
import { SuperAdminProvisioningPort, MfaPort, AuditPort, RlsBypassPort, PlanCatalogReadSink, SubscriptionRepository, PlanVersionRepository, TransactionRunner, AdminResourcesPort, FeatureUiRegistry, PlanCatalog, SaaSiCatPersistenceAdapter, QuotaProvider, SubscriptionUsagePort, UsageSnapshotPort, TenantSubscriptionWritePort, FirstTimeCustomerCheck } from '@saasicat/core';
|
|
2
|
+
import { SuperAdminProvisioningPort, MfaPort, AuditPort, RlsBypassPort, AppliedSettingsPort, EmailPort, PlanCatalogReadSink, SubscriptionRepository, PlanVersionRepository, TransactionRunner, AdminResourcesPort, FeatureUiRegistry, PlanCatalog, SaaSiCatPersistenceAdapter, QuotaProvider, SubscriptionUsagePort, UsageSnapshotPort, TenantSubscriptionWritePort, FirstTimeCustomerCheck } from '@saasicat/core';
|
|
3
3
|
import { P as ProviderSpec } from './di-CcNeq9v-.cjs';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { E as EntitlementResolutionConfig } from './plan-resolution-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { a as
|
|
4
|
+
import { A as AdminResourcesModuleOptions, a as AdminStatsModuleOptions, b as AdminManifestConfig } from './admin-resources.module-B4XNvdH-.cjs';
|
|
5
|
+
import { L as LoadPlanCatalogOptions, T as TenantBillingModuleOptions, S as SubscriptionBundleModuleOptions, a as SubscriptionBundleControllerOptions } from './tenant-billing.module-ClbjzocC.cjs';
|
|
6
|
+
import { C as CatalogModuleOptions, P as PublicMarketingCatalogOptions, N as NewPaymentMethodsSource } from './catalog.module-T-I5Ricz.cjs';
|
|
7
|
+
import { D as DiscoveryAppInfo } from './discovery.scanner-DXKc6JkV.cjs';
|
|
8
|
+
import { E as EntitlementResolutionConfig } from './plan-resolution-CwUy_OqC.cjs';
|
|
9
|
+
import { P as PromoCodesModuleOptions } from './promo.module-CKkECmU8.cjs';
|
|
10
|
+
import { C as CheckoutOfferModuleOptions } from './checkout-offer.module-DFhGy6JO.cjs';
|
|
11
|
+
import { P as PaymentsModuleOptions, a as PaymentsTenantRoutesOptions } from './payments.module-BdUq9ot_.cjs';
|
|
12
|
+
import { S as SubscriptionContractModuleOptions } from './subscription-contract.module-DTMuUJYd.cjs';
|
|
12
13
|
|
|
13
14
|
interface SetupModuleOptions {
|
|
14
15
|
/**
|
|
@@ -82,6 +83,21 @@ interface SaaSiCatAdapters {
|
|
|
82
83
|
mfa?: ProviderSpec<MfaPort>;
|
|
83
84
|
audit?: ProviderSpec<AuditPort>;
|
|
84
85
|
rlsBypass?: ProviderSpec<RlsBypassPort>;
|
|
86
|
+
/**
|
|
87
|
+
* Optional. Where the record of the applied configuration is kept; the
|
|
88
|
+
* `persistence` bundle supplies it by default. Without either, the platform
|
|
89
|
+
* runs the configuration all the same and says once, at boot, that it is
|
|
90
|
+
* not recording it.
|
|
91
|
+
*/
|
|
92
|
+
appliedSettings?: ProviderSpec<AppliedSettingsPort>;
|
|
93
|
+
/**
|
|
94
|
+
* Optional. How the platform mails an operator — today, the people
|
|
95
|
+
* `config/saas.yaml#notifications.settingsChanged` names when a start
|
|
96
|
+
* finds the settings changed. Not part of a persistence bundle: mail is not
|
|
97
|
+
* persistence. Without it the record is still written, and the boot log
|
|
98
|
+
* says once that the addresses in the file reach nobody.
|
|
99
|
+
*/
|
|
100
|
+
email?: ProviderSpec<EmailPort>;
|
|
85
101
|
/**
|
|
86
102
|
* Optional. If provided, `PlanCatalogModule` is hydrated from this sink
|
|
87
103
|
* (DB read at boot). If omitted, `planCatalog` MUST be passed as a ready
|
|
@@ -105,7 +121,17 @@ interface SaaSiCatAdapters {
|
|
|
105
121
|
transactionRunner?: ProviderSpec<TransactionRunner>;
|
|
106
122
|
}
|
|
107
123
|
type PlatformImports = Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
108
|
-
interface SaaSiCatCatalogOptions extends Pick<CatalogModuleOptions, 'strictModeCheckMode' | 'autoSyncDiscoveryAtBoot' | 'marketedOnlyFeatures' | '
|
|
124
|
+
interface SaaSiCatCatalogOptions extends Pick<CatalogModuleOptions, 'strictModeCheckMode' | 'autoSyncDiscoveryAtBoot' | 'marketedOnlyFeatures' | 'extraProviders'> {
|
|
125
|
+
/**
|
|
126
|
+
* The auth-free pricing-page endpoint. Unlike `CatalogModule`'s own option,
|
|
127
|
+
* `newPaymentMethodsFrom` is left out here: it is filled from `payments`,
|
|
128
|
+
* so the endpoint and the gateways cannot disagree. Naming a source
|
|
129
|
+
* overrides that; there is no way to say "none" here, because `payments`
|
|
130
|
+
* says it already.
|
|
131
|
+
*/
|
|
132
|
+
publicMarketingCatalog?: Omit<PublicMarketingCatalogOptions, 'newPaymentMethodsFrom'> & {
|
|
133
|
+
newPaymentMethodsFrom?: Type<NewPaymentMethodsSource>;
|
|
134
|
+
};
|
|
109
135
|
/** Labels/icons used by discovery review and the public catalog. */
|
|
110
136
|
featureUiRegistry: FeatureUiRegistry;
|
|
111
137
|
/** Mount the SuperAdmin catalog controllers. Default `true`. */
|
|
@@ -127,6 +153,19 @@ interface SaaSiCatTenantBillingOptions extends Omit<TenantBillingModuleOptions,
|
|
|
127
153
|
usageSnapshotPort?: ProviderSpec<UsageSnapshotPort>;
|
|
128
154
|
subscriptionWritePort?: ProviderSpec<TenantSubscriptionWritePort>;
|
|
129
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Payment methods through a payment gateway. The event log and the payment
|
|
158
|
+
* methods come from `persistence.payments`, the subscribers from
|
|
159
|
+
* `persistence.entitlement`, and the tenant's routes share `tenantBilling`'s
|
|
160
|
+
* authentication and resolvers.
|
|
161
|
+
*/
|
|
162
|
+
interface SaaSiCatPaymentsOptions extends Pick<PaymentsModuleOptions, 'gateways' | 'imports' | 'extraProviders'> {
|
|
163
|
+
/**
|
|
164
|
+
* Who of a tenant's users holds the billing permission, which the tenant's
|
|
165
|
+
* payment method routes require. Default: the tenant's administrator.
|
|
166
|
+
*/
|
|
167
|
+
billingPermissionGuards?: PaymentsTenantRoutesOptions['billingPermissionGuards'];
|
|
168
|
+
}
|
|
130
169
|
interface SaaSiCatSubscriptionBundlesOptions extends Omit<SubscriptionBundleModuleOptions, 'subscriptionBundleRepository' | 'bundleRepository' | 'controller' | 'imports' | 'extraProviders' | 'global'> {
|
|
131
170
|
/** Default mounts the tenant controller and reuses tenant-billing auth. */
|
|
132
171
|
controller?: false | Omit<SubscriptionBundleControllerOptions, 'authGuards' | 'subscriptionUsagePort'>;
|
|
@@ -134,12 +173,16 @@ interface SaaSiCatSubscriptionBundlesOptions extends Omit<SubscriptionBundleModu
|
|
|
134
173
|
extraProviders?: Provider[];
|
|
135
174
|
}
|
|
136
175
|
interface SaaSiCatAdminResourcesOptions extends Omit<AdminResourcesModuleOptions, 'resources' | 'guards' | 'global'> {
|
|
137
|
-
/**
|
|
176
|
+
/**
|
|
177
|
+
* Override the default controller guards + `SuperAdminGuard` chain.
|
|
178
|
+
* Suspending and reactivating a tenant require the second factor either
|
|
179
|
+
* way; that check sits on the two handlers, not in this list.
|
|
180
|
+
*/
|
|
138
181
|
guards?: Array<Type<CanActivate>>;
|
|
139
182
|
/** Custom schema override; the persistence bundle supplies the default. */
|
|
140
183
|
resources?: ProviderSpec<AdminResourcesPort>;
|
|
141
184
|
}
|
|
142
|
-
interface SaaSiCatPromoCodesOptions extends Omit<PromoCodesModuleOptions, 'promoCodeRepository' | 'redemptionRepository' | 'validationLogRepository' | 'subscriptionLookup' | 'revenueAggregator' | 'transactionRunner' | 'firstTimeCustomerCheck' | 'adminController' | 'global'> {
|
|
185
|
+
interface SaaSiCatPromoCodesOptions extends Omit<PromoCodesModuleOptions, 'promoCodeRepository' | 'redemptionRepository' | 'validationLogRepository' | 'subscriptionLookup' | 'revenueAggregator' | 'holdRepository' | 'transactionRunner' | 'firstTimeCustomerCheck' | 'adminController' | 'global'> {
|
|
143
186
|
/**
|
|
144
187
|
* Required when the public preview/redeem flow is enabled. Admin-only
|
|
145
188
|
* setups do not need an app-specific customer-history check.
|
|
@@ -169,53 +212,81 @@ interface SaaSiCatAdminStatsOptions extends Omit<AdminStatsModuleOptions, 'audit
|
|
|
169
212
|
* Public checkout-offer flow. Catalog repositories default to the persistence
|
|
170
213
|
* bundle, while the app still supplies its checkout-offer repository.
|
|
171
214
|
*/
|
|
172
|
-
interface SaaSiCatCheckoutOfferOptions extends Omit<CheckoutOfferModuleOptions, 'bundleRepository' | 'planRepository' | 'catalogEntryRepository' | 'global'> {
|
|
215
|
+
interface SaaSiCatCheckoutOfferOptions extends Omit<CheckoutOfferModuleOptions, 'bundleRepository' | 'planRepository' | 'promotionRepository' | 'catalogEntryRepository' | 'conclusion' | 'global'> {
|
|
173
216
|
bundleRepository?: CheckoutOfferModuleOptions['bundleRepository'];
|
|
217
|
+
/**
|
|
218
|
+
* Defaults to the persistence bundle's subscription contract repository and
|
|
219
|
+
* transaction runner, so `conclude` works wherever the bundle has both.
|
|
220
|
+
*/
|
|
221
|
+
conclusion?: Partial<NonNullable<CheckoutOfferModuleOptions['conclusion']>>;
|
|
222
|
+
/** Defaults to the persistence bundle's plan repository; an offer cannot be priced without one. */
|
|
174
223
|
planRepository?: CheckoutOfferModuleOptions['planRepository'];
|
|
224
|
+
promotionRepository?: CheckoutOfferModuleOptions['promotionRepository'];
|
|
175
225
|
catalogEntryRepository?: CheckoutOfferModuleOptions['catalogEntryRepository'];
|
|
176
226
|
}
|
|
177
|
-
/**
|
|
178
|
-
|
|
227
|
+
/**
|
|
228
|
+
* Subscription-contract service and the subscriber service beside it, deriving
|
|
229
|
+
* both repositories from persistence by default.
|
|
230
|
+
*/
|
|
231
|
+
interface SaaSiCatSubscriptionContractOptions extends Omit<SubscriptionContractModuleOptions, 'subscriptionContractRepository' | 'subscriberRepository' | 'global'> {
|
|
179
232
|
subscriptionContractRepository?: SubscriptionContractModuleOptions['subscriptionContractRepository'];
|
|
233
|
+
subscriberRepository?: SubscriptionContractModuleOptions['subscriberRepository'];
|
|
180
234
|
}
|
|
181
235
|
/**
|
|
182
236
|
* What `SaaSiCatModule.forRoot()` composes.
|
|
183
237
|
*
|
|
184
238
|
* One subsystem is deliberately absent: **self-registration**. A prospect
|
|
185
|
-
* signing themselves up — mail address, OTP, plan choice, payment,
|
|
186
|
-
* is `RegistrationModule` from `@saasicat/nest/registration`, and
|
|
187
|
-
* hand-wired:
|
|
239
|
+
* signing themselves up — mail address, OTP, plan choice, payment method,
|
|
240
|
+
* activation — is `RegistrationModule` from `@saasicat/nest/registration`, and
|
|
241
|
+
* it is hand-wired: its required ports are ones no persistence bundle
|
|
242
|
+
* supplies. Its payment method is taken through `payments`, which is composed
|
|
243
|
+
* here.
|
|
188
244
|
*
|
|
189
|
-
* That is a decision with a reason and a plan, not an omission:
|
|
245
|
+
* That is a decision with a reason and a plan, not an omission: those ports
|
|
190
246
|
* have no executable contract yet (`@saasicat/persistence-testing` covers the
|
|
191
|
-
*
|
|
247
|
+
* ports a persistence bundle supplies and none of these), and
|
|
192
248
|
* folding unverified ports into a bundle would move the problem rather than
|
|
193
|
-
* check it. See `docs/self-registration.md`.
|
|
249
|
+
* check it. See `docs/guides/self-registration.md`.
|
|
194
250
|
*
|
|
195
251
|
* Everything else — an operator creating tenants through the SuperAdmin UI, a
|
|
196
252
|
* CLI, or your own onboarding form — is composed here.
|
|
197
253
|
*/
|
|
254
|
+
/**
|
|
255
|
+
* The members `dbCatalog` takes. The type below is derived from this list, so
|
|
256
|
+
* the shape the platform refuses at boot and the shape the compiler accepts
|
|
257
|
+
* cannot drift apart — and `saasicat codemod v1` reads the same list.
|
|
258
|
+
*/
|
|
259
|
+
declare const DB_CATALOG_MEMBERS: readonly ["path", "env"];
|
|
260
|
+
/**
|
|
261
|
+
* Which `config/saas.yaml` a database-held catalogue reads its settings from.
|
|
262
|
+
*
|
|
263
|
+
* The same file the quickstart path loads, read by the platform. A `plans:` or
|
|
264
|
+
* `features:` block in it is not read on this path — the sink is their source —
|
|
265
|
+
* so a file kept as the seed for `saasicat catalog import` still loads.
|
|
266
|
+
*/
|
|
267
|
+
type DbCatalogOptions = Pick<LoadPlanCatalogOptions, (typeof DB_CATALOG_MEMBERS)[number]>;
|
|
198
268
|
interface SaaSiCatModuleOptions {
|
|
199
269
|
/**
|
|
200
270
|
* Plan catalog. Either as an already-loaded object (quickstart, comes
|
|
201
271
|
* directly from `loadPlanCatalogFromFile('config/saas.yaml')`) or via DB
|
|
202
272
|
* hydration: a sink reference in `adapters.planCatalogReadSink` /
|
|
203
|
-
* `persistence.planCatalogReadSink` **plus**
|
|
273
|
+
* `persistence.planCatalogReadSink` **plus** `dbCatalog` naming the file.
|
|
204
274
|
*/
|
|
205
275
|
planCatalog?: PlanCatalog;
|
|
206
276
|
/**
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
277
|
+
* The DB-hydration path — required when `planCatalog` is omitted: the
|
|
278
|
+
* `config/saas.yaml` the platform reads the settings from. The read sink
|
|
279
|
+
* loads plans and features; `app`, `currency`, `vatRate`, `tenantBilling`,
|
|
280
|
+
* `marketing` and `notifications` are not in the database and never will
|
|
281
|
+
* be, so they come from the file this names.
|
|
282
|
+
*
|
|
283
|
+
* A path rather than the values. The option used to take them as values,
|
|
284
|
+
* and every consumer forwarded them from the file it had loaded anyway —
|
|
285
|
+
* by agreement, which is a second place a setting can live. The file
|
|
286
|
+
* defines them by construction now: there is nothing here to type a
|
|
287
|
+
* setting into.
|
|
288
|
+
*/
|
|
289
|
+
dbCatalog?: DbCatalogOptions;
|
|
219
290
|
/**
|
|
220
291
|
* Aggregate persistence bundle from an adapter package (e.g.
|
|
221
292
|
* `prismaPersistence({ client: PrismaService })` from
|
|
@@ -231,13 +302,16 @@ interface SaaSiCatModuleOptions {
|
|
|
231
302
|
*/
|
|
232
303
|
adapters?: SaaSiCatAdapters;
|
|
233
304
|
/**
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
* without auth (platform security).
|
|
305
|
+
* The guards that establish who is calling the platform's controllers —
|
|
306
|
+
* typically `[JwtAuthGuard]`. REQUIRED: the platform does not mount an
|
|
307
|
+
* administration route whose protection nobody decided.
|
|
238
308
|
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
309
|
+
* Authentication only. Every operator route the platform mounts — the
|
|
310
|
+
* administration, catalogue, discovery, manifest, settings, promo codes and
|
|
311
|
+
* statistics — runs `SuperAdminGuard` after these, and the tenant manifest
|
|
312
|
+
* falls back to these guards alone, so a role check added here would lock
|
|
313
|
+
* tenants out of their own manifest. With `[]` nothing establishes a
|
|
314
|
+
* caller, and `SuperAdminGuard` refuses every operator request.
|
|
241
315
|
*/
|
|
242
316
|
controller: {
|
|
243
317
|
guards: Array<Type<CanActivate>>;
|
|
@@ -257,6 +331,19 @@ interface SaaSiCatModuleOptions {
|
|
|
257
331
|
* app can simply override.
|
|
258
332
|
*/
|
|
259
333
|
includeManifestController?: boolean;
|
|
334
|
+
/**
|
|
335
|
+
* Mount the platform's `GET /admin/settings` controller — the running
|
|
336
|
+
* configuration, since when it applies, and what changed between two
|
|
337
|
+
* starts. Default `true`.
|
|
338
|
+
*
|
|
339
|
+
* Set `false` when the app serves that route itself; the record is kept
|
|
340
|
+
* and compared at boot either way, only the endpoint is left out — the
|
|
341
|
+
* sidebar entry stays, since the page is shipped and the route answers. Note
|
|
342
|
+
* what the endpoint answers: the resolved settings and the absolute path of
|
|
343
|
+
* `config/saas.yaml`, behind `controller.guards` and `SuperAdminGuard` —
|
|
344
|
+
* the same chain as the manifest and discovery.
|
|
345
|
+
*/
|
|
346
|
+
includeSettingsController?: boolean;
|
|
260
347
|
/**
|
|
261
348
|
* Modules whose providers must be visible in the DI scope (typically:
|
|
262
349
|
* `AuthModule` with the `JwtAuthGuard`).
|
|
@@ -323,6 +410,13 @@ interface SaaSiCatModuleOptions {
|
|
|
323
410
|
* `quotaProviders` unless explicitly overridden.
|
|
324
411
|
*/
|
|
325
412
|
tenantBilling?: false | SaaSiCatTenantBillingOptions;
|
|
413
|
+
/**
|
|
414
|
+
* Payment methods through a payment gateway: the webhook route for every
|
|
415
|
+
* account in `config/saas.yaml#payments`, and — with `tenantBilling` — the
|
|
416
|
+
* tenant's payment method behind the billing permission. Self-registration
|
|
417
|
+
* takes a sign-up's payment method through it.
|
|
418
|
+
*/
|
|
419
|
+
payments?: false | SaaSiCatPaymentsOptions;
|
|
326
420
|
/**
|
|
327
421
|
* Add-on bundle service and tenant controller. `true` uses defaults and
|
|
328
422
|
* reuses tenant-billing auth/usage; an object customizes policy.
|
|
@@ -403,4 +497,4 @@ interface SaaSiCatModuleOptions {
|
|
|
403
497
|
enforcementChainCheck?: boolean;
|
|
404
498
|
}
|
|
405
499
|
|
|
406
|
-
export { PLAN_RESOLVER_PORT_TOKEN as P, type SaaSiCatAdapters as S, type TenantManifestControllerOptions as T,
|
|
500
|
+
export { DB_CATALOG_MEMBERS as D, PLAN_RESOLVER_PORT_TOKEN as P, type SaaSiCatAdapters as S, type TenantManifestControllerOptions as T, StaticPlanResolver as a, type PlanResolverPort as b, type SaaSiCatModuleOptions as c, type SaaSiCatAdminResourcesOptions as d, type SaaSiCatAdminStatsOptions as e, type SaaSiCatCatalogOptions as f, type SaaSiCatCheckoutOfferOptions as g, type SaaSiCatPromoCodesOptions as h, type SaaSiCatSetupOptions as i, type SaaSiCatSubscriptionBundlesOptions as j, type SaaSiCatSubscriptionContractOptions as k, type SaaSiCatTenantAuthGuards as l, type SaaSiCatTenantBillingOptions as m, SetupModule as n, type SetupModuleOptions as o, type DbCatalogOptions as p, buildTenantManifestController as q };
|