@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.
Files changed (95) hide show
  1. package/dist/_entries.cjs +17678 -0
  2. package/dist/admin/index.cjs +4 -1274
  3. package/dist/admin/index.d.cts +10 -171
  4. package/dist/admin/index.d.ts +10 -171
  5. package/dist/admin/index.js +13 -4
  6. package/dist/admin-resources.module-BZN_yBFj.d.cts +40 -0
  7. package/dist/admin-resources.module-Cms8MY6h.d.ts +40 -0
  8. package/dist/admin-stats.module-15ac5KY3.d.ts +201 -0
  9. package/dist/admin-stats.module-v4SVvWzj.d.cts +201 -0
  10. package/dist/billing/index.cjs +4 -5128
  11. package/dist/billing/index.d.cts +8 -719
  12. package/dist/billing/index.d.ts +8 -719
  13. package/dist/billing/index.js +7 -10
  14. package/dist/catalog/index.cjs +4 -5624
  15. package/dist/catalog/index.d.cts +7 -427
  16. package/dist/catalog/index.d.ts +7 -427
  17. package/dist/catalog/index.js +14 -12
  18. package/dist/catalog.module-BKObceo0.d.ts +103 -0
  19. package/dist/catalog.module-Dw2Hrbyu.d.cts +103 -0
  20. package/dist/checkout-offer/index.cjs +4 -807
  21. package/dist/checkout-offer/index.d.cts +5 -84
  22. package/dist/checkout-offer/index.d.ts +5 -84
  23. package/dist/checkout-offer/index.js +3 -2
  24. package/dist/checkout-offer.module-Y0hDOVrq.d.ts +85 -0
  25. package/dist/checkout-offer.module-ZYF5IsDY.d.cts +85 -0
  26. package/dist/{chunk-5DDCSGZC.js → chunk-33TP26MR.js} +144 -356
  27. package/dist/{chunk-CK54YKVK.js → chunk-75JABGZK.js} +16 -16
  28. package/dist/{chunk-HRU3CP57.js → chunk-BOADBIGB.js} +1 -1
  29. package/dist/{chunk-ZLUGQE5D.js → chunk-E7AJ42AB.js} +8 -8
  30. package/dist/{chunk-6LP7CDS2.js → chunk-F3VV6EXG.js} +18 -13
  31. package/dist/{chunk-PLDHI6NA.js → chunk-FVT7KTUI.js} +258 -3
  32. package/dist/{chunk-RZU4HIAN.js → chunk-GBDUH6DO.js} +26 -23
  33. package/dist/{chunk-K3OPNVFR.js → chunk-HBFU5AN3.js} +5 -9
  34. package/dist/chunk-HWGIMNWR.js +0 -0
  35. package/dist/chunk-IRWZC3GC.js +755 -0
  36. package/dist/chunk-L4KTQ6CL.js +20 -0
  37. package/dist/{chunk-T5SXXAKG.js → chunk-LZHLGUQI.js} +1 -1
  38. package/dist/{chunk-YHHE4KDA.js → chunk-PUXLPUVH.js} +351 -21
  39. package/dist/chunk-TXDH4FUA.js +211 -0
  40. package/dist/chunk-UF53DWWR.js +0 -0
  41. package/dist/{chunk-AJ3EPELS.js → chunk-V34AA7C7.js} +1 -1
  42. package/dist/chunk-WJ6BMDL3.js +313 -0
  43. package/dist/{chunk-M6CZQYPY.js → chunk-Z3FWN3HJ.js} +2 -2
  44. package/dist/discovery/index.cjs +4 -588
  45. package/dist/discovery/index.js +3 -3
  46. package/dist/{enforce-quota.interceptor-cv7r80VM.d.cts → enforce-quota.interceptor-BhkX5nq2.d.cts} +127 -12
  47. package/dist/{enforce-quota.interceptor-Dj1Kusr5.d.ts → enforce-quota.interceptor-CcqZc0Yu.d.ts} +127 -12
  48. package/dist/entitlement/index.cjs +4 -780
  49. package/dist/entitlement/index.d.cts +3 -1
  50. package/dist/entitlement/index.d.ts +3 -1
  51. package/dist/entitlement/index.js +2 -3
  52. package/dist/index.cjs +4 -14975
  53. package/dist/index.d.cts +22 -54
  54. package/dist/index.d.ts +22 -54
  55. package/dist/index.js +88 -369
  56. package/dist/module-CSN8j8Tp.d.cts +39 -0
  57. package/dist/module-DgYJur6f.d.ts +39 -0
  58. package/dist/plan-versions.service-BB36Q1bg.d.ts +329 -0
  59. package/dist/plan-versions.service-CUR2Whyr.d.cts +329 -0
  60. package/dist/platform/index.cjs +4 -2779
  61. package/dist/platform/index.d.cts +50 -8
  62. package/dist/platform/index.d.ts +50 -8
  63. package/dist/platform/index.js +116 -12
  64. package/dist/promo/index.cjs +4 -995
  65. package/dist/promo/index.d.cts +48 -46
  66. package/dist/promo/index.d.ts +48 -46
  67. package/dist/promo/index.js +10 -2
  68. package/dist/rate-limit.guard-dntqAlfZ.d.cts +19 -0
  69. package/dist/rate-limit.guard-dntqAlfZ.d.ts +19 -0
  70. package/dist/registration/index.cjs +4 -1655
  71. package/dist/registration/index.js +1 -1
  72. package/dist/setup.service-BPwJ7My_.d.cts +45 -0
  73. package/dist/setup.service-D2mrdDDB.d.ts +45 -0
  74. package/dist/subscription-bundle-preview.service-BkJXHAeP.d.cts +438 -0
  75. package/dist/subscription-bundle-preview.service-DBbrE_cw.d.ts +438 -0
  76. package/dist/subscription-bundles.module-BQmoozm5.d.ts +291 -0
  77. package/dist/subscription-bundles.module-DCpV-Pb5.d.cts +291 -0
  78. package/dist/subscription-contract/index.cjs +4 -471
  79. package/dist/subscription-contract/index.d.cts +5 -13
  80. package/dist/subscription-contract/index.d.ts +5 -13
  81. package/dist/subscription-contract.module-CG9fPKAr.d.cts +14 -0
  82. package/dist/subscription-contract.module-CVebZzHR.d.ts +14 -0
  83. package/dist/testing/index.cjs +4 -3756
  84. package/dist/testing/index.d.cts +9 -4
  85. package/dist/testing/index.d.ts +9 -4
  86. package/dist/testing/index.js +13 -7
  87. package/package.json +5 -5
  88. package/dist/admin-manifest.config-DyrQNT7M.d.cts +0 -10
  89. package/dist/admin-manifest.config-DyrQNT7M.d.ts +0 -10
  90. package/dist/admin-manifest.service-Cp6uwvmt.d.cts +0 -33
  91. package/dist/admin-manifest.service-UGgzR1x-.d.ts +0 -33
  92. package/dist/chunk-52UTQRD3.js +0 -326
  93. package/dist/chunk-N3WANKSA.js +0 -20
  94. package/dist/chunk-Q53N43LQ.js +0 -13
  95. /package/dist/{chunk-2FR6ZL7R.js → chunk-DBZGV3HC.js} +0 -0
@@ -1,9 +1,12 @@
1
- import { Type, CanActivate, DynamicModule, ForwardReference, FactoryProvider, ExecutionContext, NestInterceptor, CallHandler } from '@nestjs/common';
2
- import { MfaPort, AuditPort, RlsBypassPort, PlanCatalogReadSink, SubscriptionRepository, PlanVersionRepository, TransactionRunner, PlanCatalog, SaasicatPersistenceAdapter, QuotaProvider } from '@saasicat/types';
1
+ import { Type, CanActivate, DynamicModule, ForwardReference, FactoryProvider, Provider, ExecutionContext, NestInterceptor, CallHandler } from '@nestjs/common';
2
+ import { PlanCatalog, SaasicatPersistenceAdapter, MfaPort, AuditPort, RlsBypassPort, PlanCatalogReadSink, SubscriptionRepository, PlanVersionRepository, TransactionRunner, QuotaProvider, FeatureUiRegistry, SubscriptionUsagePort, UsageSnapshotPort, TenantSubscriptionWritePort, AdminResourcesPort, FirstTimeCustomerCheck } from '@saasicat/types';
3
3
  import { P as ProviderSpec } from './di-CcNeq9v-.cjs';
4
- import { A as AdminManifestConfig } from './admin-manifest.config-DyrQNT7M.cjs';
5
- import { b as DiscoveryAppInfo } from './discovery.scanner-DLgEvuoy.cjs';
4
+ import { b as AdminManifestConfig, d as AdminResourcesModuleOptions } from './admin-resources.module-BZN_yBFj.cjs';
6
5
  import { E as EntitlementResolutionConfig } from './plan-resolution-CFCoUkrE.cjs';
6
+ import { a as PromoCodesModuleOptions } from './module-CSN8j8Tp.cjs';
7
+ import { b as DiscoveryAppInfo } from './discovery.scanner-DLgEvuoy.cjs';
8
+ import { b as CatalogModuleOptions } from './catalog.module-Dw2Hrbyu.cjs';
9
+ import { t as TenantBillingModuleOptions, p as SubscriptionBundleModuleOptions, n as SubscriptionBundleControllerOptions } from './subscription-bundles.module-DCpV-Pb5.cjs';
7
10
  import { Reflector } from '@nestjs/core';
8
11
  import { Observable } from 'rxjs';
9
12
 
@@ -67,8 +70,8 @@ interface SaasPlatformAdapters {
67
70
  * Optional — resolver `tenantId → planId`. The quickstart path uses this
68
71
  * together with the `StaticEntitlementService` to automatically check
69
72
  * `@RequireFeature` and `@EnforceQuota` against the plan catalog limit.
70
- * If not set, `defaultPlanId` **must** be provided a `StaticPlanResolver`
71
- * then returns the same plan for all tenants.
73
+ * If not set, `tenantBilling` derives the resolver from the subscription
74
+ * repository. Lightweight setups can instead set `defaultPlanId`.
72
75
  */
73
76
  planResolver?: ProviderSpec<PlanResolverPort>;
74
77
  /**
@@ -79,6 +82,59 @@ interface SaasPlatformAdapters {
79
82
  planVersionRepository?: ProviderSpec<PlanVersionRepository>;
80
83
  transactionRunner?: ProviderSpec<TransactionRunner>;
81
84
  }
85
+ type PlatformImports = Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
86
+ interface SaasPlatformCatalogOptions extends Pick<CatalogModuleOptions, 'strictModeCheckMode' | 'autoSyncDiscoveryAtBoot' | 'marketedOnlyFeatures' | 'publicMarketingCatalog' | 'extraProviders'> {
87
+ /** Labels/icons used by discovery review and the public catalog. */
88
+ featureUiRegistry: FeatureUiRegistry;
89
+ /** Mount the SuperAdmin catalog controllers. Default `true`. */
90
+ adminControllers?: boolean;
91
+ /** Mount `/billing/plans|bundles|feature-registry`. Default `true`. */
92
+ publicCatalog?: boolean;
93
+ /** Override the top-level module imports for catalog adapter factories. */
94
+ imports?: PlatformImports;
95
+ }
96
+ type SaasPlatformTenantAuthGuards = Array<Type<CanActivate>> | ProviderSpec<ReadonlyArray<CanActivate>>;
97
+ interface SaasPlatformTenantBillingOptions extends Omit<TenantBillingModuleOptions, 'authGuards' | 'subscriptionUsagePort' | 'usageSnapshotPort' | 'subscriptionWritePort' | 'global'> {
98
+ /**
99
+ * Tenant guards as classes (the common path) or as a custom provider
100
+ * factory. Guard classes are resolved from `imports`.
101
+ */
102
+ authGuards: SaasPlatformTenantAuthGuards;
103
+ /** Optional overrides; otherwise the persistence bundle supplies them. */
104
+ subscriptionUsagePort?: ProviderSpec<SubscriptionUsagePort>;
105
+ usageSnapshotPort?: ProviderSpec<UsageSnapshotPort>;
106
+ subscriptionWritePort?: ProviderSpec<TenantSubscriptionWritePort>;
107
+ }
108
+ interface SaasPlatformSubscriptionBundlesOptions extends Omit<SubscriptionBundleModuleOptions, 'subscriptionBundleRepository' | 'bundleRepository' | 'controller' | 'imports' | 'extraProviders' | 'global'> {
109
+ /** Default mounts the tenant controller and reuses tenant-billing auth. */
110
+ controller?: false | Omit<SubscriptionBundleControllerOptions, 'authGuards' | 'subscriptionUsagePort'>;
111
+ imports?: PlatformImports;
112
+ extraProviders?: Provider[];
113
+ }
114
+ interface SaasPlatformAdminResourcesOptions extends Omit<AdminResourcesModuleOptions, 'resources' | 'guards' | 'global'> {
115
+ /** Override the default controller guards + `SuperAdminGuard` chain. */
116
+ guards?: Array<Type<CanActivate>>;
117
+ /** Custom schema override; the persistence bundle supplies the default. */
118
+ resources?: ProviderSpec<AdminResourcesPort>;
119
+ }
120
+ interface SaasPlatformPromoCodesOptions extends Omit<PromoCodesModuleOptions, 'promoCodeRepository' | 'redemptionRepository' | 'validationLogRepository' | 'subscriptionLookup' | 'revenueAggregator' | 'transactionRunner' | 'firstTimeCustomerCheck' | 'adminController' | 'global'> {
121
+ /**
122
+ * Required when the public preview/redeem flow is enabled. Admin-only
123
+ * setups do not need an app-specific customer-history check.
124
+ */
125
+ firstTimeCustomerCheck?: ProviderSpec<FirstTimeCustomerCheck>;
126
+ /** Override the default controller guards + `SuperAdminGuard` chain. */
127
+ adminGuards?: Array<Type<CanActivate>>;
128
+ /**
129
+ * Mount the SuperAdmin promo-code CRUD controller. Default `true`.
130
+ *
131
+ * Set `false` when the app serves `/admin/promo-codes` itself — two
132
+ * controllers on one path abort the boot with a duplicate-route error.
133
+ * The promo domain service stays available either way, so an app-owned
134
+ * controller can still delegate its validation to the platform.
135
+ */
136
+ adminController?: false;
137
+ }
82
138
  interface SaasPlatformModuleOptions {
83
139
  /**
84
140
  * Plan catalog. Either as an already-loaded object (quickstart, comes
@@ -131,11 +187,21 @@ interface SaasPlatformModuleOptions {
131
187
  * `MfaGuard`). Optional.
132
188
  */
133
189
  reloadGuards?: Array<Type<CanActivate>>;
190
+ /**
191
+ * Mount the platform's `GET /admin/manifest` + `POST /admin/manifest/reload`
192
+ * controller. Default `true`.
193
+ *
194
+ * Set `false` when the app serves those routes from its own controller —
195
+ * two controllers on one path abort the boot with a duplicate-route error
196
+ * (`FST_ERR_DUPLICATED_ROUTE` under Fastify), so this is not something the
197
+ * app can simply override.
198
+ */
199
+ includeManifestController?: boolean;
134
200
  /**
135
201
  * Modules whose providers must be visible in the DI scope (typically:
136
202
  * `AuthModule` with the `JwtAuthGuard`).
137
203
  */
138
- imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
204
+ imports?: PlatformImports;
139
205
  /**
140
206
  * App identity for the DiscoveryScanner. If omitted, `planCatalog.app` is
141
207
  * used (recommendation: simply declare it in the YAML).
@@ -154,10 +220,17 @@ interface SaasPlatformModuleOptions {
154
220
  */
155
221
  adminManifestConfig?: AdminManifestConfig | Pick<FactoryProvider<AdminManifestConfig>, 'useFactory' | 'inject'>;
156
222
  /**
157
- * Default `false`. If `true`, `EntitlementModule.forRoot({...})` is called
223
+ * Infer manifest capabilities for platform endpoints mounted by this
224
+ * module. Default `true`; set `false` only when the app owns the complete
225
+ * manifest capability policy.
226
+ */
227
+ autoManifest?: boolean;
228
+ /**
229
+ * Default `false`. When set, `EntitlementModule.forRoot({...})` is called
158
230
  * with the repositories from `adapters` — only meaningful if the app
159
231
  * implements the V3 contract path (`subscriptionRepository` & co. must then
160
- * be set).
232
+ * be set). `tenantBilling` and `subscriptionBundles` enable it
233
+ * automatically.
161
234
  */
162
235
  entitlement?: false | {
163
236
  resolutionConfig?: EntitlementResolutionConfig;
@@ -177,12 +250,54 @@ interface SaasPlatformModuleOptions {
177
250
  * `QUOTA_PROVIDERS_TOKEN`.
178
251
  */
179
252
  quotaProviders?: Array<Type<QuotaProvider>>;
253
+ /**
254
+ * Standard DB-backed catalog stack. Repositories are taken from
255
+ * `persistence.catalog`; no consumer forwarding module is needed.
256
+ */
257
+ catalog?: false | SaasPlatformCatalogOptions;
258
+ /**
259
+ * Standard tenant self-service stack. Subscription read/write adapters
260
+ * come from `persistence.tenantBilling`; usage is derived from
261
+ * `quotaProviders` unless explicitly overridden.
262
+ */
263
+ tenantBilling?: false | SaasPlatformTenantBillingOptions;
264
+ /**
265
+ * Add-on bundle service and tenant controller. `true` uses defaults and
266
+ * reuses tenant-billing auth/usage; an object customizes policy.
267
+ */
268
+ subscriptionBundles?: false | true | SaasPlatformSubscriptionBundlesOptions;
269
+ /**
270
+ * Standard SuperAdmin Tenant/User/Audit/Subscription endpoints. `true`
271
+ * uses `persistence.adminResources` and the standard guard chain.
272
+ */
273
+ adminResources?: false | true | SaasPlatformAdminResourcesOptions;
274
+ /**
275
+ * Promo-code domain and SuperAdmin CRUD. `true` enables the admin API
276
+ * without the public preview endpoint; pass an object to enable preview.
277
+ */
278
+ promoCodes?: false | true | SaasPlatformPromoCodesOptions;
180
279
  /**
181
280
  * Enable the tenant manifest — the app UI gets a filtered manifest per
182
281
  * tenant with features, quotas and visible navigation. Requires that
183
- * `defaultPlanId` or `adapters.planResolver` is set.
282
+ * `defaultPlanId`, `adapters.planResolver` or `tenantBilling` is set.
283
+ * `true` reuses tenant-billing guard classes when available, otherwise
284
+ * `controller.guards`.
285
+ */
286
+ tenantManifest?: true | TenantManifestControllerOptions;
287
+ /**
288
+ * Bind `StaticFeatureGuard` as a global `APP_GUARD`. Default `true`.
289
+ *
290
+ * Set `false` when the app authenticates in a controller-local guard.
291
+ * Nest runs every global guard before every controller-local one, so a
292
+ * global feature guard sees no `request.user` and rejects with 403 before
293
+ * authentication has run. Apps in that shape bind the guard themselves,
294
+ * behind their auth guard: `@UseGuards(JwtAuthGuard, FeatureGuard)`.
295
+ *
296
+ * Only the guard is affected. `EnforceQuotaInterceptor` stays global
297
+ * either way — interceptors run after all guards, so it does see the
298
+ * authenticated request.
184
299
  */
185
- tenantManifest?: TenantManifestControllerOptions;
300
+ globalFeatureGuard?: boolean;
186
301
  }
187
302
  /**
188
303
  * Bundles PlanCatalog + Discovery + Admin + AdminManifest (+ optionally
@@ -260,4 +375,4 @@ declare class EnforceQuotaInterceptor implements NestInterceptor {
260
375
  private check;
261
376
  }
262
377
 
263
- export { EnforceQuotaInterceptor as E, PLAN_RESOLVER_PORT_TOKEN as P, QUOTA_PROVIDERS_TOKEN as Q, StaticEntitlementService as S, type TenantManifestControllerOptions as T, type PlanResolverPort as a, STATIC_FEATURE_GUARD_CONFIG_TOKEN as b, type SaasPlatformAdapters as c, SaasPlatformModule as d, type SaasPlatformModuleOptions as e, type StaticEntitlementSnapshot as f, StaticFeatureGuard as g, type StaticFeatureGuardConfig as h, StaticPlanResolver as i, buildTenantManifestController as j };
378
+ export { EnforceQuotaInterceptor as E, PLAN_RESOLVER_PORT_TOKEN as P, QUOTA_PROVIDERS_TOKEN as Q, type SaasPlatformAdapters as S, type TenantManifestControllerOptions as T, StaticEntitlementService as a, StaticFeatureGuard as b, StaticPlanResolver as c, type SaasPlatformModuleOptions as d, type PlanResolverPort as e, STATIC_FEATURE_GUARD_CONFIG_TOKEN as f, SaasPlatformModule as g, type SaasPlatformAdminResourcesOptions as h, type SaasPlatformCatalogOptions as i, type SaasPlatformPromoCodesOptions as j, type SaasPlatformSubscriptionBundlesOptions as k, type SaasPlatformTenantAuthGuards as l, type SaasPlatformTenantBillingOptions as m, type StaticEntitlementSnapshot as n, type StaticFeatureGuardConfig as o, buildTenantManifestController as p };
@@ -1,9 +1,12 @@
1
- import { Type, CanActivate, DynamicModule, ForwardReference, FactoryProvider, ExecutionContext, NestInterceptor, CallHandler } from '@nestjs/common';
2
- import { MfaPort, AuditPort, RlsBypassPort, PlanCatalogReadSink, SubscriptionRepository, PlanVersionRepository, TransactionRunner, PlanCatalog, SaasicatPersistenceAdapter, QuotaProvider } from '@saasicat/types';
1
+ import { Type, CanActivate, DynamicModule, ForwardReference, FactoryProvider, Provider, ExecutionContext, NestInterceptor, CallHandler } from '@nestjs/common';
2
+ import { PlanCatalog, SaasicatPersistenceAdapter, MfaPort, AuditPort, RlsBypassPort, PlanCatalogReadSink, SubscriptionRepository, PlanVersionRepository, TransactionRunner, QuotaProvider, FeatureUiRegistry, SubscriptionUsagePort, UsageSnapshotPort, TenantSubscriptionWritePort, AdminResourcesPort, FirstTimeCustomerCheck } from '@saasicat/types';
3
3
  import { P as ProviderSpec } from './di-CcNeq9v-.js';
4
- import { A as AdminManifestConfig } from './admin-manifest.config-DyrQNT7M.js';
5
- import { b as DiscoveryAppInfo } from './discovery.scanner-DLgEvuoy.js';
4
+ import { b as AdminManifestConfig, d as AdminResourcesModuleOptions } from './admin-resources.module-Cms8MY6h.js';
6
5
  import { E as EntitlementResolutionConfig } from './plan-resolution-CFCoUkrE.js';
6
+ import { a as PromoCodesModuleOptions } from './module-DgYJur6f.js';
7
+ import { b as DiscoveryAppInfo } from './discovery.scanner-DLgEvuoy.js';
8
+ import { b as CatalogModuleOptions } from './catalog.module-BKObceo0.js';
9
+ import { t as TenantBillingModuleOptions, p as SubscriptionBundleModuleOptions, n as SubscriptionBundleControllerOptions } from './subscription-bundles.module-BQmoozm5.js';
7
10
  import { Reflector } from '@nestjs/core';
8
11
  import { Observable } from 'rxjs';
9
12
 
@@ -67,8 +70,8 @@ interface SaasPlatformAdapters {
67
70
  * Optional — resolver `tenantId → planId`. The quickstart path uses this
68
71
  * together with the `StaticEntitlementService` to automatically check
69
72
  * `@RequireFeature` and `@EnforceQuota` against the plan catalog limit.
70
- * If not set, `defaultPlanId` **must** be provided a `StaticPlanResolver`
71
- * then returns the same plan for all tenants.
73
+ * If not set, `tenantBilling` derives the resolver from the subscription
74
+ * repository. Lightweight setups can instead set `defaultPlanId`.
72
75
  */
73
76
  planResolver?: ProviderSpec<PlanResolverPort>;
74
77
  /**
@@ -79,6 +82,59 @@ interface SaasPlatformAdapters {
79
82
  planVersionRepository?: ProviderSpec<PlanVersionRepository>;
80
83
  transactionRunner?: ProviderSpec<TransactionRunner>;
81
84
  }
85
+ type PlatformImports = Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
86
+ interface SaasPlatformCatalogOptions extends Pick<CatalogModuleOptions, 'strictModeCheckMode' | 'autoSyncDiscoveryAtBoot' | 'marketedOnlyFeatures' | 'publicMarketingCatalog' | 'extraProviders'> {
87
+ /** Labels/icons used by discovery review and the public catalog. */
88
+ featureUiRegistry: FeatureUiRegistry;
89
+ /** Mount the SuperAdmin catalog controllers. Default `true`. */
90
+ adminControllers?: boolean;
91
+ /** Mount `/billing/plans|bundles|feature-registry`. Default `true`. */
92
+ publicCatalog?: boolean;
93
+ /** Override the top-level module imports for catalog adapter factories. */
94
+ imports?: PlatformImports;
95
+ }
96
+ type SaasPlatformTenantAuthGuards = Array<Type<CanActivate>> | ProviderSpec<ReadonlyArray<CanActivate>>;
97
+ interface SaasPlatformTenantBillingOptions extends Omit<TenantBillingModuleOptions, 'authGuards' | 'subscriptionUsagePort' | 'usageSnapshotPort' | 'subscriptionWritePort' | 'global'> {
98
+ /**
99
+ * Tenant guards as classes (the common path) or as a custom provider
100
+ * factory. Guard classes are resolved from `imports`.
101
+ */
102
+ authGuards: SaasPlatformTenantAuthGuards;
103
+ /** Optional overrides; otherwise the persistence bundle supplies them. */
104
+ subscriptionUsagePort?: ProviderSpec<SubscriptionUsagePort>;
105
+ usageSnapshotPort?: ProviderSpec<UsageSnapshotPort>;
106
+ subscriptionWritePort?: ProviderSpec<TenantSubscriptionWritePort>;
107
+ }
108
+ interface SaasPlatformSubscriptionBundlesOptions extends Omit<SubscriptionBundleModuleOptions, 'subscriptionBundleRepository' | 'bundleRepository' | 'controller' | 'imports' | 'extraProviders' | 'global'> {
109
+ /** Default mounts the tenant controller and reuses tenant-billing auth. */
110
+ controller?: false | Omit<SubscriptionBundleControllerOptions, 'authGuards' | 'subscriptionUsagePort'>;
111
+ imports?: PlatformImports;
112
+ extraProviders?: Provider[];
113
+ }
114
+ interface SaasPlatformAdminResourcesOptions extends Omit<AdminResourcesModuleOptions, 'resources' | 'guards' | 'global'> {
115
+ /** Override the default controller guards + `SuperAdminGuard` chain. */
116
+ guards?: Array<Type<CanActivate>>;
117
+ /** Custom schema override; the persistence bundle supplies the default. */
118
+ resources?: ProviderSpec<AdminResourcesPort>;
119
+ }
120
+ interface SaasPlatformPromoCodesOptions extends Omit<PromoCodesModuleOptions, 'promoCodeRepository' | 'redemptionRepository' | 'validationLogRepository' | 'subscriptionLookup' | 'revenueAggregator' | 'transactionRunner' | 'firstTimeCustomerCheck' | 'adminController' | 'global'> {
121
+ /**
122
+ * Required when the public preview/redeem flow is enabled. Admin-only
123
+ * setups do not need an app-specific customer-history check.
124
+ */
125
+ firstTimeCustomerCheck?: ProviderSpec<FirstTimeCustomerCheck>;
126
+ /** Override the default controller guards + `SuperAdminGuard` chain. */
127
+ adminGuards?: Array<Type<CanActivate>>;
128
+ /**
129
+ * Mount the SuperAdmin promo-code CRUD controller. Default `true`.
130
+ *
131
+ * Set `false` when the app serves `/admin/promo-codes` itself — two
132
+ * controllers on one path abort the boot with a duplicate-route error.
133
+ * The promo domain service stays available either way, so an app-owned
134
+ * controller can still delegate its validation to the platform.
135
+ */
136
+ adminController?: false;
137
+ }
82
138
  interface SaasPlatformModuleOptions {
83
139
  /**
84
140
  * Plan catalog. Either as an already-loaded object (quickstart, comes
@@ -131,11 +187,21 @@ interface SaasPlatformModuleOptions {
131
187
  * `MfaGuard`). Optional.
132
188
  */
133
189
  reloadGuards?: Array<Type<CanActivate>>;
190
+ /**
191
+ * Mount the platform's `GET /admin/manifest` + `POST /admin/manifest/reload`
192
+ * controller. Default `true`.
193
+ *
194
+ * Set `false` when the app serves those routes from its own controller —
195
+ * two controllers on one path abort the boot with a duplicate-route error
196
+ * (`FST_ERR_DUPLICATED_ROUTE` under Fastify), so this is not something the
197
+ * app can simply override.
198
+ */
199
+ includeManifestController?: boolean;
134
200
  /**
135
201
  * Modules whose providers must be visible in the DI scope (typically:
136
202
  * `AuthModule` with the `JwtAuthGuard`).
137
203
  */
138
- imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
204
+ imports?: PlatformImports;
139
205
  /**
140
206
  * App identity for the DiscoveryScanner. If omitted, `planCatalog.app` is
141
207
  * used (recommendation: simply declare it in the YAML).
@@ -154,10 +220,17 @@ interface SaasPlatformModuleOptions {
154
220
  */
155
221
  adminManifestConfig?: AdminManifestConfig | Pick<FactoryProvider<AdminManifestConfig>, 'useFactory' | 'inject'>;
156
222
  /**
157
- * Default `false`. If `true`, `EntitlementModule.forRoot({...})` is called
223
+ * Infer manifest capabilities for platform endpoints mounted by this
224
+ * module. Default `true`; set `false` only when the app owns the complete
225
+ * manifest capability policy.
226
+ */
227
+ autoManifest?: boolean;
228
+ /**
229
+ * Default `false`. When set, `EntitlementModule.forRoot({...})` is called
158
230
  * with the repositories from `adapters` — only meaningful if the app
159
231
  * implements the V3 contract path (`subscriptionRepository` & co. must then
160
- * be set).
232
+ * be set). `tenantBilling` and `subscriptionBundles` enable it
233
+ * automatically.
161
234
  */
162
235
  entitlement?: false | {
163
236
  resolutionConfig?: EntitlementResolutionConfig;
@@ -177,12 +250,54 @@ interface SaasPlatformModuleOptions {
177
250
  * `QUOTA_PROVIDERS_TOKEN`.
178
251
  */
179
252
  quotaProviders?: Array<Type<QuotaProvider>>;
253
+ /**
254
+ * Standard DB-backed catalog stack. Repositories are taken from
255
+ * `persistence.catalog`; no consumer forwarding module is needed.
256
+ */
257
+ catalog?: false | SaasPlatformCatalogOptions;
258
+ /**
259
+ * Standard tenant self-service stack. Subscription read/write adapters
260
+ * come from `persistence.tenantBilling`; usage is derived from
261
+ * `quotaProviders` unless explicitly overridden.
262
+ */
263
+ tenantBilling?: false | SaasPlatformTenantBillingOptions;
264
+ /**
265
+ * Add-on bundle service and tenant controller. `true` uses defaults and
266
+ * reuses tenant-billing auth/usage; an object customizes policy.
267
+ */
268
+ subscriptionBundles?: false | true | SaasPlatformSubscriptionBundlesOptions;
269
+ /**
270
+ * Standard SuperAdmin Tenant/User/Audit/Subscription endpoints. `true`
271
+ * uses `persistence.adminResources` and the standard guard chain.
272
+ */
273
+ adminResources?: false | true | SaasPlatformAdminResourcesOptions;
274
+ /**
275
+ * Promo-code domain and SuperAdmin CRUD. `true` enables the admin API
276
+ * without the public preview endpoint; pass an object to enable preview.
277
+ */
278
+ promoCodes?: false | true | SaasPlatformPromoCodesOptions;
180
279
  /**
181
280
  * Enable the tenant manifest — the app UI gets a filtered manifest per
182
281
  * tenant with features, quotas and visible navigation. Requires that
183
- * `defaultPlanId` or `adapters.planResolver` is set.
282
+ * `defaultPlanId`, `adapters.planResolver` or `tenantBilling` is set.
283
+ * `true` reuses tenant-billing guard classes when available, otherwise
284
+ * `controller.guards`.
285
+ */
286
+ tenantManifest?: true | TenantManifestControllerOptions;
287
+ /**
288
+ * Bind `StaticFeatureGuard` as a global `APP_GUARD`. Default `true`.
289
+ *
290
+ * Set `false` when the app authenticates in a controller-local guard.
291
+ * Nest runs every global guard before every controller-local one, so a
292
+ * global feature guard sees no `request.user` and rejects with 403 before
293
+ * authentication has run. Apps in that shape bind the guard themselves,
294
+ * behind their auth guard: `@UseGuards(JwtAuthGuard, FeatureGuard)`.
295
+ *
296
+ * Only the guard is affected. `EnforceQuotaInterceptor` stays global
297
+ * either way — interceptors run after all guards, so it does see the
298
+ * authenticated request.
184
299
  */
185
- tenantManifest?: TenantManifestControllerOptions;
300
+ globalFeatureGuard?: boolean;
186
301
  }
187
302
  /**
188
303
  * Bundles PlanCatalog + Discovery + Admin + AdminManifest (+ optionally
@@ -260,4 +375,4 @@ declare class EnforceQuotaInterceptor implements NestInterceptor {
260
375
  private check;
261
376
  }
262
377
 
263
- export { EnforceQuotaInterceptor as E, PLAN_RESOLVER_PORT_TOKEN as P, QUOTA_PROVIDERS_TOKEN as Q, StaticEntitlementService as S, type TenantManifestControllerOptions as T, type PlanResolverPort as a, STATIC_FEATURE_GUARD_CONFIG_TOKEN as b, type SaasPlatformAdapters as c, SaasPlatformModule as d, type SaasPlatformModuleOptions as e, type StaticEntitlementSnapshot as f, StaticFeatureGuard as g, type StaticFeatureGuardConfig as h, StaticPlanResolver as i, buildTenantManifestController as j };
378
+ export { EnforceQuotaInterceptor as E, PLAN_RESOLVER_PORT_TOKEN as P, QUOTA_PROVIDERS_TOKEN as Q, type SaasPlatformAdapters as S, type TenantManifestControllerOptions as T, StaticEntitlementService as a, StaticFeatureGuard as b, StaticPlanResolver as c, type SaasPlatformModuleOptions as d, type PlanResolverPort as e, STATIC_FEATURE_GUARD_CONFIG_TOKEN as f, SaasPlatformModule as g, type SaasPlatformAdminResourcesOptions as h, type SaasPlatformCatalogOptions as i, type SaasPlatformPromoCodesOptions as j, type SaasPlatformSubscriptionBundlesOptions as k, type SaasPlatformTenantAuthGuards as l, type SaasPlatformTenantBillingOptions as m, type StaticEntitlementSnapshot as n, type StaticFeatureGuardConfig as o, buildTenantManifestController as p };