@saasicat/nest 0.7.0 → 0.9.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/admin/index.cjs +262 -7
- package/dist/admin/index.d.cts +6 -4
- package/dist/admin/index.d.ts +6 -4
- package/dist/admin/index.js +12 -4
- package/dist/{admin-manifest.service-Cp6uwvmt.d.cts → admin-manifest.service-BMeSLRW4.d.ts} +1 -1
- package/dist/{admin-manifest.service-UGgzR1x-.d.ts → admin-manifest.service-StAQe6QO.d.cts} +1 -1
- package/dist/admin-resources.module-BybEjZs-.d.cts +40 -0
- package/dist/admin-resources.module-CUCLlUAi.d.ts +40 -0
- package/dist/billing/index.cjs +3 -1
- package/dist/billing/index.d.cts +5 -287
- package/dist/billing/index.d.ts +5 -287
- package/dist/billing/index.js +5 -8
- package/dist/catalog/index.d.cts +4 -101
- package/dist/catalog/index.d.ts +4 -101
- package/dist/catalog/index.js +12 -10
- package/dist/catalog.module-BKObceo0.d.ts +103 -0
- package/dist/catalog.module-Dw2Hrbyu.d.cts +103 -0
- package/dist/{chunk-U6HT27J7.js → chunk-3M6VLT5N.js} +257 -6
- package/dist/chunk-7K5PT2LX.js +211 -0
- package/dist/{chunk-RZU4HIAN.js → chunk-GW2I3JZD.js} +25 -22
- package/dist/{chunk-6LP7CDS2.js → chunk-HXAWPPFW.js} +10 -5
- package/dist/chunk-OFBDEO45.js +755 -0
- package/dist/{chunk-5DDCSGZC.js → chunk-PBQRPDO2.js} +142 -354
- package/dist/{chunk-SD3TT2BR.js → chunk-WGVTXSYW.js} +1 -1
- package/dist/{chunk-A2QBXDJC.js → chunk-ZZMAHX22.js} +343 -16
- package/dist/{enforce-quota.interceptor-Dj1Kusr5.d.ts → enforce-quota.interceptor-B3CL5MSw.d.ts} +94 -12
- package/dist/{enforce-quota.interceptor-cv7r80VM.d.cts → enforce-quota.interceptor-SqrQVF91.d.cts} +94 -12
- package/dist/entitlement/index.cjs +1 -0
- package/dist/entitlement/index.d.cts +3 -1
- package/dist/entitlement/index.d.ts +3 -1
- package/dist/entitlement/index.js +1 -2
- package/dist/index.cjs +3503 -2811
- package/dist/index.d.cts +9 -6
- package/dist/index.d.ts +9 -6
- package/dist/index.js +75 -61
- package/dist/module-B5m080F0.d.ts +39 -0
- package/dist/module-DeH_Jkcq.d.cts +39 -0
- package/dist/platform/index.cjs +11113 -971
- package/dist/platform/index.d.cts +41 -7
- package/dist/platform/index.d.ts +41 -7
- package/dist/platform/index.js +26 -6
- package/dist/promo/index.cjs +530 -5
- package/dist/promo/index.d.cts +47 -30
- package/dist/promo/index.d.ts +47 -30
- package/dist/promo/index.js +9 -1
- package/dist/{service-DX8KbGXl.d.cts → service-DlhMnYjW.d.cts} +1 -1
- package/dist/{service-DX8KbGXl.d.ts → service-DlhMnYjW.d.ts} +1 -1
- package/dist/subscription-bundles.module-BQmoozm5.d.ts +291 -0
- package/dist/subscription-bundles.module-DCpV-Pb5.d.cts +291 -0
- package/dist/testing/index.cjs +11101 -973
- package/dist/testing/index.d.cts +9 -4
- package/dist/testing/index.d.ts +9 -4
- package/dist/testing/index.js +10 -4
- package/package.json +4 -4
- package/dist/admin-manifest.config-DyrQNT7M.d.cts +0 -10
- package/dist/admin-manifest.config-DyrQNT7M.d.ts +0 -10
- package/dist/chunk-52UTQRD3.js +0 -326
- package/dist/chunk-Q53N43LQ.js +0 -13
- /package/dist/{chunk-2FR6ZL7R.js → chunk-HWGIMNWR.js} +0 -0
package/dist/billing/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BillingCycle, FeatureKey, UpsellOfferResolver, BundleRepository, CatalogEntryRepository, UpsellOffer, PlanCatalog, PlanCatalogReadSink, PlanCatalogReadSnapshot, PlanCatalogImportSink, PlanCatalogImportReport, PlanId, PlanDef, QuotaKey, MarketingTopFeature, FeatureUiRegistry, MarketingProjectionRepository, SubscriptionUsagePort, UsageSnapshotPort,
|
|
1
|
+
import { BillingCycle, FeatureKey, UpsellOfferResolver, BundleRepository, CatalogEntryRepository, UpsellOffer, PlanCatalog, PlanCatalogReadSink, PlanCatalogReadSnapshot, PlanCatalogImportSink, PlanCatalogImportReport, PlanId, PlanDef, QuotaKey, MarketingTopFeature, FeatureUiRegistry, MarketingProjectionRepository, SubscriptionUsagePort, UsageSnapshotPort, TenantSubscriptionWritePort, SubscriptionBundleRepository, SubscriptionBundleView, SubscriptionBundleRecord, SubscriptionUsageRecord, OnboardingSelectionResponse, ConfiguratorSourcesLookup, ConfiguratorMarketingProvider, ConfiguratorCatalog, PlanRepository, BundleVersionRow } from '@saasicat/types';
|
|
2
2
|
export { BundleVersionFields, ChangeDirection, DiffResult, PlanVersionFields, VersionChange, VersionChangeDirection, classifyBundleVersionDiff, classifyPlanDiff } from '@saasicat/types';
|
|
3
3
|
import * as _nestjs_common from '@nestjs/common';
|
|
4
4
|
import { CanActivate, ExecutionContext, ArgumentsHost, Type, DynamicModule, ForwardReference, Provider } from '@nestjs/common';
|
|
@@ -6,8 +6,10 @@ export { Type as NestType } from '@nestjs/common';
|
|
|
6
6
|
import { Reflector, BaseExceptionFilter } from '@nestjs/core';
|
|
7
7
|
import { c as EntitlementService, a as EffectiveLimitsSnapshot, t as toEffectiveLimitsSnapshot } from '../aggregation-CfI0bOsQ.cjs';
|
|
8
8
|
import { P as ProviderSpec } from '../di-CcNeq9v-.cjs';
|
|
9
|
+
import { b as AuthGuardList, m as SelfServiceBlockedPlans, w as TrialProjectionPort, h as PendingPlanQueryPort, f as ContractFreezePort, g as ContractFreezeSourcePort, l as SelfServiceBlockedBundles, u as TenantIdResolver, B as UserIdResolver, z as UserEmailResolver, a as AuditContextResolver } from '../subscription-bundles.module-DCpV-Pb5.cjs';
|
|
10
|
+
export { A as AUDIT_CONTEXT_RESOLVER_TOKEN, C as CONTRACT_FREEZE_PORT_TOKEN, c as CONTRACT_FREEZE_PROJECT_KEY_TOKEN, d as CONTRACT_FREEZE_SOURCE_PORT_TOKEN, e as ContractFreezeBundleSnapshot, D as DuePendingPlanChange, P as PENDING_PLAN_QUERY_PORT_TOKEN, S as SELF_SERVICE_BLOCKED_BUNDLES_TOKEN, i as SELF_SERVICE_BLOCKED_PLANS_TOKEN, j as SUBSCRIPTION_USAGE_PORT_TOKEN, k as SUBSCRIPTION_WRITE_PORT_TOKEN, n as SubscriptionBundleControllerOptions, o as SubscriptionBundleModule, p as SubscriptionBundleModuleOptions, T as TENANT_AUTH_GUARDS_TOKEN, q as TENANT_ID_RESOLVER_TOKEN, r as TRIAL_PROJECTION_PORT_TOKEN, s as TenantBillingModule, t as TenantBillingModuleOptions, v as TrialProjectionInput, U as USAGE_SNAPSHOT_PORT_TOKEN, x as USER_EMAIL_RESOLVER_TOKEN, y as USER_ID_RESOLVER_TOKEN } from '../subscription-bundles.module-DCpV-Pb5.cjs';
|
|
9
11
|
import { S as SubscriptionContractService } from '../subscription-contract.service--cm47ZJJ.cjs';
|
|
10
|
-
import {
|
|
12
|
+
import { g as PromoCodesService } from '../service-DlhMnYjW.cjs';
|
|
11
13
|
import { A as AdminAuditService } from '../admin-audit.service-9IqXMlZm.cjs';
|
|
12
14
|
import '../plan-resolution-CFCoUkrE.cjs';
|
|
13
15
|
|
|
@@ -548,96 +550,6 @@ declare const PUBLIC_CATALOG_PROJECT_KEY_TOKEN: unique symbol;
|
|
|
548
550
|
declare const PUBLIC_CATALOG_BUNDLE_REPOSITORY_TOKEN: unique symbol;
|
|
549
551
|
declare const PUBLIC_CATALOG_MARKETING_REPOSITORY_TOKEN: unique symbol;
|
|
550
552
|
|
|
551
|
-
/**
|
|
552
|
-
* List of all auth guards the platform controller should iterate in order
|
|
553
|
-
* (analogous to `@UseGuards(JwtAuthGuard, TenantGuard, RolesGuard)`).
|
|
554
|
-
* Provided via `forRoot.authGuards` — can be an array of existing instances
|
|
555
|
-
* or a factory provider.
|
|
556
|
-
*/
|
|
557
|
-
declare const TENANT_AUTH_GUARDS_TOKEN: unique symbol;
|
|
558
|
-
/**
|
|
559
|
-
* Resolver function `(req) => string` that extracts the `tenantId` from the
|
|
560
|
-
* request. Default: `req.user.tenantId`.
|
|
561
|
-
*/
|
|
562
|
-
declare const TENANT_ID_RESOLVER_TOKEN: unique symbol;
|
|
563
|
-
/**
|
|
564
|
-
* Resolver function `(req) => string` that extracts the `userId` from the
|
|
565
|
-
* request. Default: `req.user.sub ?? req.user.id`.
|
|
566
|
-
*/
|
|
567
|
-
declare const USER_ID_RESOLVER_TOKEN: unique symbol;
|
|
568
|
-
/**
|
|
569
|
-
* Resolver function `(req) => string` that extracts the user email from the
|
|
570
|
-
* request. Optional — used by the audit-log path to build the AdminActor
|
|
571
|
-
* (`{userId, email, source: 'web', context}`). Default: `req.user.email`.
|
|
572
|
-
* If the consumer's JWT does not carry an email, the resolver can return
|
|
573
|
-
* `null` — the audit-log path then falls back to `'unknown'`.
|
|
574
|
-
*/
|
|
575
|
-
declare const USER_EMAIL_RESOLVER_TOKEN: unique symbol;
|
|
576
|
-
/**
|
|
577
|
-
* Resolver function `(req) => string` that extracts an audit context from the
|
|
578
|
-
* request (e.g. session ID, trace ID). Default: `req.headers['x-session-id']`
|
|
579
|
-
* or `'tenant-self-service'`.
|
|
580
|
-
*/
|
|
581
|
-
declare const AUDIT_CONTEXT_RESOLVER_TOKEN: unique symbol;
|
|
582
|
-
/** Adapter token: consumer's `SubscriptionUsagePort` implementation. */
|
|
583
|
-
declare const SUBSCRIPTION_USAGE_PORT_TOKEN: unique symbol;
|
|
584
|
-
/** Adapter token: consumer's `UsageSnapshotPort` implementation. */
|
|
585
|
-
declare const USAGE_SNAPSHOT_PORT_TOKEN: unique symbol;
|
|
586
|
-
/** Adapter token: consumer's `TenantSubscriptionWritePort` implementation. */
|
|
587
|
-
declare const SUBSCRIPTION_WRITE_PORT_TOKEN: unique symbol;
|
|
588
|
-
type TenantIdResolver = (req: unknown) => string | null | undefined;
|
|
589
|
-
type UserIdResolver = (req: unknown) => string | null | undefined;
|
|
590
|
-
type UserEmailResolver = (req: unknown) => string | null | undefined;
|
|
591
|
-
type AuditContextResolver = (req: unknown) => string | null | undefined;
|
|
592
|
-
type AuthGuardList = ReadonlyArray<CanActivate>;
|
|
593
|
-
/**
|
|
594
|
-
* Optional adapter token: projects the new trial end of a change
|
|
595
|
-
* (app-specific trial logic, e.g. carry-over of the remaining time). Without a
|
|
596
|
-
* port, `PlanChangePreviewDto.projectedTrialEndsAt` stays `null` and the wizard
|
|
597
|
-
* falls back to the current trial end.
|
|
598
|
-
*/
|
|
599
|
-
declare const TRIAL_PROJECTION_PORT_TOKEN: unique symbol;
|
|
600
|
-
interface TrialProjectionInput {
|
|
601
|
-
/** Current plan key of the subscription. */
|
|
602
|
-
currentPlan: string;
|
|
603
|
-
/** Target plan key of the change. */
|
|
604
|
-
targetPlan: string;
|
|
605
|
-
/** Current trial end (null = no trial). */
|
|
606
|
-
currentTrialEndsAt: Date | null;
|
|
607
|
-
/** Subscription status (e.g. 'TRIAL'/'ACTIVE'). */
|
|
608
|
-
status: string;
|
|
609
|
-
now: Date;
|
|
610
|
-
}
|
|
611
|
-
interface TrialProjectionPort {
|
|
612
|
-
/**
|
|
613
|
-
* Projected new trial end after the change. `null` if nothing changes or
|
|
614
|
-
* the target package does not support a trial.
|
|
615
|
-
*/
|
|
616
|
-
projectTrialEndsAt(input: TrialProjectionInput): Promise<Date | null>;
|
|
617
|
-
}
|
|
618
|
-
/**
|
|
619
|
-
* Optional adapter token: provides due scheduled plan changes for the
|
|
620
|
-
* `PendingPlanMaterializationService`. Without a port, the service is not
|
|
621
|
-
* registered (materialization is opt-in).
|
|
622
|
-
*/
|
|
623
|
-
declare const PENDING_PLAN_QUERY_PORT_TOKEN: unique symbol;
|
|
624
|
-
/** A due scheduled plan change — minimal for materialization. */
|
|
625
|
-
interface DuePendingPlanChange {
|
|
626
|
-
tenantId: string;
|
|
627
|
-
/** Target plan key of the scheduled change (`pendingPlan`). */
|
|
628
|
-
pendingPlan: string;
|
|
629
|
-
/** Target cycle (`pendingBillingCycle`); `null` → default MONTHLY. */
|
|
630
|
-
pendingBillingCycle: string | null;
|
|
631
|
-
}
|
|
632
|
-
interface PendingPlanQueryPort {
|
|
633
|
-
/**
|
|
634
|
-
* Returns all subscriptions with a due scheduled plan change:
|
|
635
|
-
* `pendingPlan != null AND pendingEffectiveAt <= now AND status != 'TRIAL'`.
|
|
636
|
-
* TRIAL is excluded — there the trial lifecycle drives the transition.
|
|
637
|
-
*/
|
|
638
|
-
findDuePendingPlanChanges(now: Date): Promise<DuePendingPlanChange[]>;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
553
|
declare class ComposedTenantAuthGuard implements CanActivate {
|
|
642
554
|
private readonly guards;
|
|
643
555
|
constructor(guards?: AuthGuardList | null);
|
|
@@ -648,22 +560,6 @@ declare class TenantAdminGuard implements CanActivate {
|
|
|
648
560
|
canActivate(context: ExecutionContext): boolean;
|
|
649
561
|
}
|
|
650
562
|
|
|
651
|
-
interface SelfServiceBlockedPlans {
|
|
652
|
-
asTarget?: string[];
|
|
653
|
-
asSource?: string[];
|
|
654
|
-
}
|
|
655
|
-
declare const SELF_SERVICE_BLOCKED_PLANS_TOKEN: unique symbol;
|
|
656
|
-
/**
|
|
657
|
-
* Bundle counterpart (#37): `bundleKeys` lists bundles that are not
|
|
658
|
-
* bookable via self-service (only via sales/special contract).
|
|
659
|
-
* Applies in `SubscriptionBundlesService.addBundleToSubscription`
|
|
660
|
-
* (enforcement, 422) and in the bundle preview (blocker indication).
|
|
661
|
-
*/
|
|
662
|
-
interface SelfServiceBlockedBundles {
|
|
663
|
-
bundleKeys?: string[];
|
|
664
|
-
}
|
|
665
|
-
declare const SELF_SERVICE_BLOCKED_BUNDLES_TOKEN: unique symbol;
|
|
666
|
-
|
|
667
563
|
interface ProrationDto {
|
|
668
564
|
daysRemainingInPeriod: number;
|
|
669
565
|
daysInPeriod: number;
|
|
@@ -768,47 +664,6 @@ declare class PlanChangePreviewService {
|
|
|
768
664
|
private computeProration;
|
|
769
665
|
}
|
|
770
666
|
|
|
771
|
-
/**
|
|
772
|
-
* Optional hook token: the platform `changePlan` path + the
|
|
773
|
-
* `PendingPlanMaterializationService` call the freeze after the plan mutation
|
|
774
|
-
* (analogous to `TrialProjectionPort`). Without a port nothing is frozen — the
|
|
775
|
-
* entitlements then stay catalog-/version-pinned as before.
|
|
776
|
-
*/
|
|
777
|
-
declare const CONTRACT_FREEZE_PORT_TOKEN: unique symbol;
|
|
778
|
-
/** Adapter token: consumer-specific bundle/version data access. */
|
|
779
|
-
declare const CONTRACT_FREEZE_SOURCE_PORT_TOKEN: unique symbol;
|
|
780
|
-
/** Config token: the consumer's `projectKey` for the contract. */
|
|
781
|
-
declare const CONTRACT_FREEZE_PROJECT_KEY_TOKEN: unique symbol;
|
|
782
|
-
interface ContractFreezePort {
|
|
783
|
-
/**
|
|
784
|
-
* Freezes the agreed service at `effectiveFrom` as the new active
|
|
785
|
-
* `SubscriptionContract` (supersedes the previous one). Non-fatal for the
|
|
786
|
-
* caller — the plan change is already persisted.
|
|
787
|
-
*/
|
|
788
|
-
freezeOnPlanChange(tenantId: string, newPlan: string, billingCycle: BillingCycle, effectiveFrom: Date): Promise<void>;
|
|
789
|
-
}
|
|
790
|
-
/** Frozen bundle line items + their version ids (trace). */
|
|
791
|
-
interface ContractFreezeBundleSnapshot {
|
|
792
|
-
lineItems: NewContractLineItemData[];
|
|
793
|
-
bundleVersionIds: string[];
|
|
794
|
-
}
|
|
795
|
-
/**
|
|
796
|
-
* Consumer-specific data access for the freeze: live PlanVersion id
|
|
797
|
-
* (trace) + booked bundles as contract line items. The generic freeze
|
|
798
|
-
* logic (plan line item from the catalog, snapshot, contract assembly) lives in
|
|
799
|
-
* the platform `SubscriptionContractFreezeService`.
|
|
800
|
-
*/
|
|
801
|
-
interface ContractFreezeSourcePort {
|
|
802
|
-
/** Live (published, non-superseded) PlanVersion id of the target plan, or null. */
|
|
803
|
-
findLivePlanVersionId(planId: string): Promise<string | null>;
|
|
804
|
-
/**
|
|
805
|
-
* The tenant's active (non-terminated) bundle bookings as line items.
|
|
806
|
-
* `vatRate` is passed through so the gross price is computed consistently
|
|
807
|
-
* with the catalog VAT. Apps without a bundle schema return empty lists.
|
|
808
|
-
*/
|
|
809
|
-
loadBookedBundles(tenantId: string, cycle: 'monthly' | 'yearly', vatRate: number): Promise<ContractFreezeBundleSnapshot>;
|
|
810
|
-
}
|
|
811
|
-
|
|
812
667
|
declare class PendingPlanMaterializationService {
|
|
813
668
|
private readonly query;
|
|
814
669
|
private readonly subscriptionWrite;
|
|
@@ -1033,93 +888,6 @@ declare class TenantBillingController {
|
|
|
1033
888
|
private auditLog;
|
|
1034
889
|
}
|
|
1035
890
|
|
|
1036
|
-
interface TenantBillingModuleOptions {
|
|
1037
|
-
/**
|
|
1038
|
-
* App guards in the order in which they should be executed
|
|
1039
|
-
* (e.g. `[JwtAuthGuard, TenantGuard]`). The platform combines them via
|
|
1040
|
-
* `ComposedTenantAuthGuard`. At least one guard is mandatory —
|
|
1041
|
-
* missing configuration leads to 403 (safe default).
|
|
1042
|
-
*
|
|
1043
|
-
* Variant 1: array of guard instances (e.g. via factory provider).
|
|
1044
|
-
* Variant 2: Pick<FactoryProvider, 'useFactory' | 'inject'> — apps
|
|
1045
|
-
* pass their guard classes through via `inject` and the factory builds
|
|
1046
|
-
* the array.
|
|
1047
|
-
*/
|
|
1048
|
-
authGuards: ProviderSpec<ReadonlyArray<CanActivate>>;
|
|
1049
|
-
/** Adapter to the subscription display form (`GET /billing/usage`). */
|
|
1050
|
-
subscriptionUsagePort: ProviderSpec<SubscriptionUsagePort>;
|
|
1051
|
-
/** Adapter to usage counters of all `quotaKeys`. */
|
|
1052
|
-
usageSnapshotPort: ProviderSpec<UsageSnapshotPort>;
|
|
1053
|
-
/** Adapter for plan/add-on mutations (phase C). */
|
|
1054
|
-
subscriptionWritePort: ProviderSpec<TenantSubscriptionWritePort>;
|
|
1055
|
-
/**
|
|
1056
|
-
* Optional adapter that provides the projected new trial end of a change
|
|
1057
|
-
* (app trial logic, e.g. carry-over). Without a port,
|
|
1058
|
-
* `PlanChangePreviewDto.projectedTrialEndsAt` stays `null`.
|
|
1059
|
-
*/
|
|
1060
|
-
trialProjectionPort?: ProviderSpec<TrialProjectionPort>;
|
|
1061
|
-
/**
|
|
1062
|
-
* Optional adapter that provides due scheduled plan changes (#19). If it is
|
|
1063
|
-
* passed, the module registers the `PendingPlanMaterializationService`
|
|
1064
|
-
* (exported) — the consumer triggers it via its own cron. Without a
|
|
1065
|
-
* port, the materialization stays disabled (lazy resolution as before).
|
|
1066
|
-
*/
|
|
1067
|
-
pendingPlanQueryPort?: ProviderSpec<PendingPlanQueryPort>;
|
|
1068
|
-
/**
|
|
1069
|
-
* Optional contract freeze hook (#18). If it is configured, the
|
|
1070
|
-
* platform `changePlan` path (non-TRIAL) AND the materialization freeze
|
|
1071
|
-
* the agreed service after the plan mutation as a `SubscriptionContract`
|
|
1072
|
-
* (analogous to `trialProjectionPort`). Consumer-specific are only `projectKey`
|
|
1073
|
-
* + bundle/version data access (`sourcePort`); the contract logic is
|
|
1074
|
-
* generic. `subscriptionContractRepository` is the same repo that also goes
|
|
1075
|
-
* to `EntitlementModule.forRoot` — the freeze needs it in its own scope.
|
|
1076
|
-
*/
|
|
1077
|
-
contractFreeze?: {
|
|
1078
|
-
projectKey: string;
|
|
1079
|
-
sourcePort: ProviderSpec<ContractFreezeSourcePort>;
|
|
1080
|
-
subscriptionContractRepository: ProviderSpec<SubscriptionContractRepository>;
|
|
1081
|
-
};
|
|
1082
|
-
/**
|
|
1083
|
-
* Plans that are not accepted as target/source via self-service
|
|
1084
|
-
* (typically ENTERPRISE → special contract). `null`/undefined = no blocks.
|
|
1085
|
-
*/
|
|
1086
|
-
selfServiceBlockedPlans?: SelfServiceBlockedPlans;
|
|
1087
|
-
/** Optional tenant ID resolver. Default: `req.user.tenantId`. */
|
|
1088
|
-
tenantIdResolver?: TenantIdResolver;
|
|
1089
|
-
/** Optional user ID resolver. Default: `req.user.sub ?? req.user.id`. */
|
|
1090
|
-
userIdResolver?: UserIdResolver;
|
|
1091
|
-
/**
|
|
1092
|
-
* Optional email resolver for the audit log path. Default: `req.user.email`.
|
|
1093
|
-
* If the consumer JWT does not include the email, the resolver can
|
|
1094
|
-
* return `null` — the audit log then uses `'unknown'`.
|
|
1095
|
-
*/
|
|
1096
|
-
userEmailResolver?: UserEmailResolver;
|
|
1097
|
-
/**
|
|
1098
|
-
* Optional audit context resolver (session ID / trace ID). Default:
|
|
1099
|
-
* `req.headers['x-session-id']` or `'tenant-self-service'`.
|
|
1100
|
-
*/
|
|
1101
|
-
auditContextResolver?: AuditContextResolver;
|
|
1102
|
-
/**
|
|
1103
|
-
* Modules whose providers must be visible within this module.
|
|
1104
|
-
* Typical use case: the app's own `AuthModule`, so that the `JwtAuthGuard`
|
|
1105
|
-
* is injectable in the `authGuards` factory. Without this entry NestJS throws
|
|
1106
|
-
* `UnknownDependenciesException` for JwtAuthGuard.
|
|
1107
|
-
*/
|
|
1108
|
-
imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
1109
|
-
/**
|
|
1110
|
-
* Additional providers that are registered in the DynamicModule itself —
|
|
1111
|
-
* typically: the adapter classes referenced in `inject:[Adapter]` lists
|
|
1112
|
-
* (e.g. `PrismaSubscriptionUsagePort`). NestJS 11.1.19
|
|
1113
|
-
* resolves factory inject tokens only in the DynamicModule's own scope.
|
|
1114
|
-
*/
|
|
1115
|
-
extraProviders?: Provider[];
|
|
1116
|
-
/** Register the module globally — default `false`. */
|
|
1117
|
-
global?: boolean;
|
|
1118
|
-
}
|
|
1119
|
-
declare class TenantBillingModule {
|
|
1120
|
-
static forRoot(options: TenantBillingModuleOptions): DynamicModule;
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
891
|
/**
|
|
1124
892
|
* Builds the `ConfiguratorCatalog` (for onboarding step 3) from the
|
|
1125
893
|
* live `plan_versions` (SuperAdmin defines plans + prices) plus the
|
|
@@ -1244,56 +1012,6 @@ declare class SubscriptionBundlePreviewService {
|
|
|
1244
1012
|
*/
|
|
1245
1013
|
declare function resolveBundlePriceNet(bundleVersion: BundleVersionRow, planKey: string, billingCycle: string): number | null;
|
|
1246
1014
|
|
|
1247
|
-
interface SubscriptionBundleControllerOptions {
|
|
1248
|
-
extraGuards?: Array<Type<CanActivate>>;
|
|
1249
|
-
/**
|
|
1250
|
-
* Auth guard list analogous to `TenantBillingModule.forRoot.authGuards`.
|
|
1251
|
-
* Without this list, `ComposedTenantAuthGuard` blocks fail-closed.
|
|
1252
|
-
*/
|
|
1253
|
-
authGuards?: ProviderSpec<ReadonlyArray<CanActivate>>;
|
|
1254
|
-
/**
|
|
1255
|
-
* Usage port for subscription lookup and current plan compatibility.
|
|
1256
|
-
* If not set, an imported module must export the token.
|
|
1257
|
-
*/
|
|
1258
|
-
subscriptionUsagePort?: ProviderSpec<SubscriptionUsagePort>;
|
|
1259
|
-
/** Optional tenant-ID resolver. Default: `req.user.tenantId`. */
|
|
1260
|
-
tenantIdResolver?: TenantIdResolver;
|
|
1261
|
-
}
|
|
1262
|
-
interface SubscriptionBundleModuleOptions {
|
|
1263
|
-
subscriptionBundleRepository: ProviderSpec<SubscriptionBundleRepository>;
|
|
1264
|
-
/**
|
|
1265
|
-
* Optional — if omitted, `BUNDLE_REPOSITORY_TOKEN` is expected via
|
|
1266
|
-
* default inject from the DI scope (typically via an imported
|
|
1267
|
-
* `CatalogModule`).
|
|
1268
|
-
*/
|
|
1269
|
-
bundleRepository?: ProviderSpec<BundleRepository>;
|
|
1270
|
-
/** Default minimum term (months). Default = 12. */
|
|
1271
|
-
defaultMinimumTermMonths?: number;
|
|
1272
|
-
/**
|
|
1273
|
-
* Self-service policy (#37): bundles that are only bookable via sales.
|
|
1274
|
-
* Applies in `addBundleToSubscription` (422 BUNDLE_NOT_SELF_SERVICE)
|
|
1275
|
-
* and in the preview (blocker).
|
|
1276
|
-
*/
|
|
1277
|
-
selfServiceBlockedBundles?: SelfServiceBlockedBundles;
|
|
1278
|
-
/**
|
|
1279
|
-
* If set: the tenant self-service controller is mounted at
|
|
1280
|
-
* `/billing/subscription-bundles` (GET/POST/DELETE). The
|
|
1281
|
-
* `extraGuards` are applied in addition to the platform default
|
|
1282
|
-
* `ComposedTenantAuthGuard` (role/MFA guards).
|
|
1283
|
-
*
|
|
1284
|
-
* Prerequisite: the consumer has already registered `TenantBillingModule`
|
|
1285
|
-
* — the controller needs `SUBSCRIPTION_USAGE_PORT_TOKEN`
|
|
1286
|
-
* + `TENANT_ID_RESOLVER_TOKEN` in the same DI scope.
|
|
1287
|
-
*/
|
|
1288
|
-
controller?: SubscriptionBundleControllerOptions;
|
|
1289
|
-
imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
1290
|
-
extraProviders?: Provider[];
|
|
1291
|
-
global?: boolean;
|
|
1292
|
-
}
|
|
1293
|
-
declare class SubscriptionBundleModule {
|
|
1294
|
-
static forRoot(options: SubscriptionBundleModuleOptions): DynamicModule;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
1015
|
/**
|
|
1298
1016
|
* Factory analogous to `buildBundlesController` etc. — the consumer can pass
|
|
1299
1017
|
* additional guards (e.g. RoleGuard) in addition to the platform default
|
|
@@ -1301,4 +1019,4 @@ declare class SubscriptionBundleModule {
|
|
|
1301
1019
|
*/
|
|
1302
1020
|
declare function buildTenantSubscriptionBundlesController(extraGuards?: Array<Type<CanActivate>>): Type;
|
|
1303
1021
|
|
|
1304
|
-
export {
|
|
1022
|
+
export { type AddBundleToSubscriptionInput, type AjvErrorLike, AuditContextResolver, AuthGuardList, type BundlePreviewSnapshot, type CancelBundleFromSubscriptionInput, CancelSubscriptionDto, CatalogBundleUpsellResolver, ChangePlanDto, CompleteOnboardingSubscriptionDto, ComposedTenantAuthGuard, ConfiguratorCatalogBuilder, ContractFreezePort, ContractFreezeSourcePort, FEATURE_GUARD_CONFIG_TOKEN, FEATURE_UI_REGISTRY_TOKEN, FeatureGuard, type FeatureGuardConfig, LimitExceededFilter, type LimitsCheckRow, type LoadPlanCatalogOptions, type MarketingFields, type NextPeriodWindow, PLAN_CATALOG_IMPORT_SINK_TOKEN, PLAN_CATALOG_READ_SINK_TOKEN, PLAN_CATALOG_TOKEN, PUBLIC_CATALOG_BUNDLE_REPOSITORY_TOKEN, PUBLIC_CATALOG_MARKETING_REPOSITORY_TOKEN, PUBLIC_CATALOG_PROJECT_KEY_TOKEN, PendingPlanMaterializationService, PendingPlanQueryPort, type PeriodRollInput, type PlanCatalogBuildSettings, PlanCatalogImportDto, type PlanCatalogImporterControllerConfig, PlanCatalogImporterModule, type PlanCatalogImporterModuleOptions, PlanCatalogImporterService, PlanCatalogModule, type PlanCatalogModuleOptions, PlanCatalogValidationError, type PlanChangeContext, type PlanChangePreviewDto, type PlanChangePreviewIssue, PlanChangePreviewService, type PlanChangeType, type PlanResponseEntry, type PlanSnapshotDto, PreviewPlanChangeDto, type ProrationDto, type ProrationInput, type PublicBundleEntry, PublicCatalogController, PublicCatalogModule, type PublicCatalogModuleOptions, PublishValidationError, type PublishablePlanVersion, REQUIRE_FEATURE_KEY, type RedundantFeatureHint, type RenewalDecision, type RenewalSubInput, RequireFeature, SUBSCRIPTION_BUNDLE_CONFIG_TOKEN, SUBSCRIPTION_BUNDLE_REPOSITORY_TOKEN, SelfServiceBlockedBundles, SelfServiceBlockedPlans, type SubscriptionBundleAddPreviewDto, type SubscriptionBundleCancelPreviewDto, type SubscriptionBundleConfig, type SubscriptionBundlePreviewContext, type SubscriptionBundlePreviewIssue, SubscriptionBundlePreviewService, SubscriptionBundlesService, SubscriptionContractFreezeService, TenantAdminGuard, TenantBillingController, TenantIdResolver, TrialProjectionPort, UPSELL_OFFER_CURRENCY_TOKEN, UPSELL_OFFER_RESOLVER_TOKEN, type UsageResponse, UserEmailResolver, UserIdResolver, addMonths, assertBaseVersionFresh, assertChangeNote, assertDraftPublishable, assertOptimisticLockHeld, buildPlanCatalogFromSnapshot, buildPlanCatalogImporterController, buildTenantSubscriptionBundlesController, clearPendingPlanVersionFields, computeCarriedTrialEndsAt, computeNextPeriod, computeProration, decideRenewal, findPlan, getActiveFeatureKeys, getMarketedPlans, getPlanOrThrow, getPlanPriceGross, getPlanPriceNet, getPlanQuota, initialPeriodWindow, isFeatureInPlan, isFeaturePlannedOnly, loadPlanCatalogFromFile, loadPlanCatalogFromString, periodEndAfter, periodEndWithMinLead, resolveBundleCancelEffectiveAt, resolveBundlePriceNet };
|