@saasicat/nest 1.0.0-rc.21 → 1.0.0-rc.23
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/.build-stamp +1 -1
- package/dist/_entries.cjs +15561 -12478
- package/dist/admin/index.d.cts +4 -4
- package/dist/admin/index.d.ts +4 -4
- package/dist/admin/index.js +8 -5
- package/dist/{admin-resources.module-CWqdI9BV.d.ts → admin-resources.module-DtWAFI-G.d.ts} +1 -1
- package/dist/{admin-resources.module-B4XNvdH-.d.cts → admin-resources.module-pS7LbdbI.d.cts} +1 -1
- package/dist/{admin-stats.service-CsLNt19Z.d.ts → admin-stats.service--1sRNpUx.d.ts} +2 -2
- package/dist/{admin-stats.service-DrZrU8IJ.d.cts → admin-stats.service-ChATI9YK.d.cts} +2 -2
- package/dist/{aggregation-ChpZDh0g.d.ts → aggregation-B8iZBesJ.d.ts} +63 -4
- package/dist/{aggregation-OpnhwzF5.d.cts → aggregation-BRzgRXDb.d.cts} +63 -4
- package/dist/billing/index.d.cts +280 -13
- package/dist/billing/index.d.ts +280 -13
- package/dist/billing/index.js +32 -8
- package/dist/catalog/index.d.cts +2 -2
- package/dist/catalog/index.d.ts +2 -2
- package/dist/catalog/index.js +4 -2
- package/dist/{catalog.module-T-I5Ricz.d.cts → catalog.module-CeKslGHW.d.cts} +1 -1
- package/dist/{catalog.module-C9O7BxRq.d.ts → catalog.module-CiurcIjI.d.ts} +1 -1
- package/dist/checkout-offer/index.d.cts +4 -4
- package/dist/checkout-offer/index.d.ts +4 -4
- package/dist/checkout-offer/index.js +5 -5
- package/dist/{checkout-offer.module-x7SP_dX4.d.ts → checkout-offer.module-C761mcEv.d.ts} +1 -1
- package/dist/{checkout-offer.module-DFhGy6JO.d.cts → checkout-offer.module-CSHB4bB8.d.cts} +1 -1
- package/dist/{checkout-offer.service-BeHgYikI.d.ts → checkout-offer.service-Dux8EgEM.d.ts} +3 -3
- package/dist/{checkout-offer.service-CCVxG9b2.d.cts → checkout-offer.service-HKoTZ3JH.d.cts} +3 -3
- package/dist/{chunk-F5X66HF5.js → chunk-2ECX7BST.js} +1 -1
- package/dist/{chunk-G6EZWECL.js → chunk-2XBWYMOL.js} +141 -26
- package/dist/{chunk-R5YCJBHY.js → chunk-3HBP2HK3.js} +6 -2
- package/dist/{chunk-S33SO5XX.js → chunk-4OFJLVVH.js} +4 -0
- package/dist/{chunk-AOS2JPDD.js → chunk-5LL2554P.js} +757 -163
- package/dist/chunk-5MZH3VVU.js +292 -0
- package/dist/{chunk-WHJSYKNC.js → chunk-7LHUENAT.js} +2 -2
- package/dist/{chunk-M47BNEY2.js → chunk-7MLB6T5B.js} +2072 -407
- package/dist/{chunk-NDLC5GYK.js → chunk-CVCKXKGT.js} +138 -21
- package/dist/{chunk-VBRYPU7V.js → chunk-E224LKO2.js} +3 -1
- package/dist/{chunk-QPVDCKYS.js → chunk-ESEWSAOV.js} +4 -3
- package/dist/{chunk-CQ2ZZMTD.js → chunk-MU4O4EKX.js} +711 -828
- package/dist/{chunk-JBCC6C3M.js → chunk-NQIPQI2Q.js} +26 -7
- package/dist/{chunk-4SDSYV4A.js → chunk-PBL7N5J3.js} +18 -2
- package/dist/{chunk-LLYVYRGJ.js → chunk-QTJEZDKC.js} +15 -275
- package/dist/{chunk-3RLWML2S.js → chunk-QWKBOLBH.js} +35 -0
- package/dist/{chunk-XSSWYPP5.js → chunk-TR3L6FRF.js} +6 -2
- package/dist/chunk-TSLGMPGZ.js +21 -0
- package/dist/chunk-UJZCESIC.js +466 -0
- package/dist/{chunk-TOEFN7DN.js → chunk-W6VNCMOQ.js} +3 -3
- package/dist/{chunk-7NJKVC5X.js → chunk-WQNOCOI2.js} +53 -6
- package/dist/chunk-YZSILFW4.js +142 -0
- package/dist/{chunk-55QEDAMX.js → chunk-ZCXW24NH.js} +4 -9
- package/dist/discovery/index.js +2 -1
- package/dist/{enforce-quota.interceptor-BFyVdWe8.d.cts → enforce-quota.interceptor-Dc-1_zQf.d.cts} +2 -2
- package/dist/{enforce-quota.interceptor-GaBXboGx.d.ts → enforce-quota.interceptor-MXpwsOJ2.d.ts} +2 -2
- package/dist/entitlement/index.d.cts +1 -1
- package/dist/entitlement/index.d.ts +1 -1
- package/dist/entitlement/index.js +5 -3
- package/dist/index.d.cts +62 -25
- package/dist/index.d.ts +62 -25
- package/dist/index.js +81 -26
- package/dist/{issuer-identity.check-CBO0vcsq.d.cts → issuer-identity.check-BrZXesOF.d.cts} +3 -3
- package/dist/{issuer-identity.check-Cz9CEMkZ.d.ts → issuer-identity.check-BzlFSmSZ.d.ts} +3 -3
- package/dist/maintenance.service-CNMI3tSm.d.cts +133 -0
- package/dist/maintenance.service-yx6fxjUj.d.ts +133 -0
- package/dist/{module-options-DmQ3G4sZ.d.ts → module-options-BSYxlA38.d.ts} +50 -9
- package/dist/{module-options-qAOwinHR.d.cts → module-options-BkufuqlM.d.cts} +50 -9
- package/dist/payments/index.d.cts +2 -2
- package/dist/payments/index.d.ts +2 -2
- package/dist/payments/index.js +2 -2
- package/dist/{payments.module-BdUq9ot_.d.cts → payments.module-CwLeaflk.d.cts} +1 -1
- package/dist/{payments.module-CQGv_VG7.d.ts → payments.module-DmIN-HWx.d.ts} +1 -1
- package/dist/{plan-versions.service-DARLh-qI.d.cts → plan-versions.service-2mD0iEvY.d.cts} +1 -1
- package/dist/{plan-versions.service-C0N-Em2W.d.ts → plan-versions.service-C4a9aCEU.d.ts} +1 -1
- package/dist/platform/index.d.cts +34 -25
- package/dist/platform/index.d.ts +34 -25
- package/dist/platform/index.js +22 -17
- package/dist/promo/index.d.cts +15 -5
- package/dist/promo/index.d.ts +15 -5
- package/dist/promo/index.js +9 -3
- package/dist/{promo.module-CKkECmU8.d.cts → promo.module-Ddx-swUV.d.cts} +1 -1
- package/dist/{promo.module-DuIJdK3U.d.ts → promo.module-PsIvDcUp.d.ts} +1 -1
- package/dist/{promo.service-BYBu6dy3.d.cts → promo.service-BextPvx5.d.cts} +23 -1
- package/dist/{promo.service-CFjfF0Xm.d.ts → promo.service-Dqqh0JXn.d.ts} +23 -1
- package/dist/registration/index.d.cts +7 -4
- package/dist/registration/index.d.ts +7 -4
- package/dist/registration/index.js +11 -6
- package/dist/subscription-contract/index.d.cts +13 -3
- package/dist/subscription-contract/index.d.ts +13 -3
- package/dist/subscription-contract/index.js +5 -3
- package/dist/{subscription-contract.module-BfIRpc1o.d.ts → subscription-contract.module-B5wrmzkz.d.ts} +8 -1
- package/dist/{subscription-contract.module-DTMuUJYd.d.cts → subscription-contract.module-qaswPXwT.d.cts} +8 -1
- package/dist/{subscription-contract.service-CfNApLuP.d.cts → subscription-contract.service-CH2TKw-j.d.cts} +45 -3
- package/dist/{subscription-contract.service-CPZrTM9C.d.ts → subscription-contract.service-Dm2xEFZi.d.ts} +45 -3
- package/dist/{tenant-billing.controller-BLqbsONe.d.ts → tenant-billing.controller-BMH9YODT.d.ts} +92 -11
- package/dist/{tenant-billing.controller-DKbAqTbM.d.cts → tenant-billing.controller-BX3VExL3.d.cts} +92 -11
- package/dist/{tenant-billing.module-ClbjzocC.d.cts → tenant-billing.module-Do3QyKbr.d.cts} +33 -3
- package/dist/{tenant-billing.module-DohgJJ2m.d.ts → tenant-billing.module-W5_Y4ogN.d.ts} +33 -3
- package/dist/{tenant-billing.tokens-G-1xOlMr.d.cts → tenant-billing.tokens-D0vr1lfj.d.cts} +1 -1
- package/dist/{tenant-billing.tokens-G-1xOlMr.d.ts → tenant-billing.tokens-D0vr1lfj.d.ts} +1 -1
- package/dist/testing/index.d.cts +14 -13
- package/dist/testing/index.d.ts +14 -13
- package/dist/testing/index.js +54 -35
- package/package.json +5 -3
package/dist/billing/index.d.cts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { BillingCycle, BundleVersionRow, FeatureKey, UpsellOfferResolver, BundleRepository, CatalogEntryRepository, UpsellOffer, PlanCatalogSettings, PlanCatalogReadSink, PlanCatalog, PlanCatalogReadSnapshot, PlanCatalogImportSink, PlanCatalogImportReport, PlanId, PlanDef, QuotaKey, MarketingTopFeature, FeatureUiRegistry, MarketingProjectionRepository, TenantSubscriptionWritePort, ConfiguratorSourcesLookup, ConfiguratorMarketingProvider, ConfiguratorCatalog } from '@saasicat/core';
|
|
1
|
+
import { BillingCycle, BundleVersionRow, FeatureKey, UpsellOfferResolver, BundleRepository, CatalogEntryRepository, UpsellOffer, PlanCatalogSettings, PlanCatalogReadSink, PlanCatalog, PlanCatalogReadSnapshot, PlanCatalogImportSink, PlanCatalogImportReport, PlanId, PlanDef, QuotaKey, MarketingTopFeature, FeatureUiRegistry, MarketingProjectionRepository, TenantSubscriptionWritePort, SubscriptionUsagePort, CreateSubscriptionContractData, SubscriptionContractRecord, DiscoverySnapshot, RlsBypassPort, AdminActor, SubscriberLedgerRepository, SubscriptionContractRepository, SubscriberRepository, AdminSubscriberAccount, ConfiguratorSourcesLookup, ConfiguratorMarketingProvider, ConfiguratorCatalog } from '@saasicat/core';
|
|
2
2
|
export { BundleVersionFields, CancellationNoticePeriods, ChangeDirection, DiffResult, PlanVersionFields, SelfServiceBlockedPlans, VersionChange, VersionChangeDirection, classifyBundleVersionDiff, classifyPlanDiff } from '@saasicat/core';
|
|
3
|
-
export { A as AddBundleToSubscriptionInput, B as BundlePreviewSnapshot,
|
|
4
|
-
import { F as FEATURE_GUARD_MARKER,
|
|
5
|
-
export { A as AjvErrorLike,
|
|
3
|
+
export { A as AddBundleToSubscriptionInput, B as BundlePreviewSnapshot, d as CancelBundleFromSubscriptionInput, e as CancelSubscriptionDto, f as CancellableSubscription, g as CancellationDecision, h as CancellationInput, i as ChangePlanDto, j as CompleteOnboardingSubscriptionDto, C as ComposedTenantAuthGuard, k as CycleDirection, L as LimitsCheckRow, N as NO_NOTICE_PERIOD, P as PendingPlanMaterializationService, l as PlanChangeContext, m as PlanChangePreviewDto, n as PlanChangePreviewIssue, a as PlanChangePreviewService, o as PlanChangeType, p as PlanDirection, q as PlanSnapshotDto, r as PreviewPlanChangeDto, s as ProrationBasis, t as ProrationDto, u as ProrationInput, R as RedundantFeatureHint, v as SubscriberChargeService, w as SubscriptionBundleAddPreviewDto, x as SubscriptionBundleCancelPreviewDto, y as SubscriptionBundleConfig, z as SubscriptionBundlePreviewContext, D as SubscriptionBundlePreviewIssue, S as SubscriptionBundlePreviewService, b as SubscriptionBundlesService, T as TenantAdminGuard, c as TenantBillingController, U as UsageResponse, E as addMonths, F as clampToParent, G as computeNewPeriodCharge, H as computeProration, I as decideCancellation, J as decideCancellationFor, K as noticeDaysFor, M as resolveBundleCancelEffectiveAt } from '../tenant-billing.controller-BX3VExL3.cjs';
|
|
4
|
+
import { F as FEATURE_GUARD_MARKER, C as ContractFreezePort, f as ContractFreezeSourcePort } from '../tenant-billing.module-Do3QyKbr.cjs';
|
|
5
|
+
export { A as AjvErrorLike, c as CONTRACT_FREEZE_PORT_TOKEN, d as CONTRACT_FREEZE_SOURCE_PORT_TOKEN, e as ContractFreezeBundleSnapshot, E as EnvironmentVariables, g as LoadPlanCatalogFromStringOptions, L as LoadPlanCatalogOptions, M as MarkedFeatureGuard, P as PLAN_CATALOG_UNREADABLE_ERROR, h as PlanCatalogValidationError, i as SELF_SERVICE_BLOCKED_BUNDLES_TOKEN, j as SELF_SERVICE_BLOCKED_PLANS_TOKEN, b as SelfServiceBlockedBundles, a as SubscriptionBundleControllerOptions, k as SubscriptionBundleModule, S as SubscriptionBundleModuleOptions, l as TenantBillingModule, T as TenantBillingModuleOptions, m as catalogSource, n as isPlatformFeatureGuard, o as loadPlanCatalogFromFile, p as loadPlanCatalogFromString } from '../tenant-billing.module-Do3QyKbr.cjs';
|
|
6
6
|
import * as _nestjs_common from '@nestjs/common';
|
|
7
7
|
import { CanActivate, ExecutionContext, ArgumentsHost, Type, DynamicModule, ForwardReference, Provider } from '@nestjs/common';
|
|
8
8
|
export { Type as NestType } from '@nestjs/common';
|
|
9
9
|
import { Reflector, BaseExceptionFilter } from '@nestjs/core';
|
|
10
|
-
import {
|
|
10
|
+
import { E as EntitlementService } from '../aggregation-BRzgRXDb.cjs';
|
|
11
11
|
import { P as ProviderSpec } from '../di-CcNeq9v-.cjs';
|
|
12
12
|
import { P as PlanCatalogSource } from '../plan-catalog-source-DWe-BGY1.cjs';
|
|
13
13
|
export { a as PlanCatalogOrigin, g as givenPlanCatalogSource } from '../plan-catalog-source-DWe-BGY1.cjs';
|
|
14
|
-
import {
|
|
15
|
-
export {
|
|
16
|
-
import { S as SubscriptionContractService } from '../subscription-contract.service-
|
|
17
|
-
import '../promo.service-
|
|
18
|
-
import '../admin-audit.service-4P3Djdxk.cjs';
|
|
14
|
+
import { c as AuthGuardList } from '../tenant-billing.tokens-D0vr1lfj.cjs';
|
|
15
|
+
export { d as AUDIT_CONTEXT_RESOLVER_TOKEN, A as AuditContextResolver, B as BILLING_PERMISSION_GUARDS_TOKEN, C as CANCELLATION_NOTICE_DAYS_TOKEN, D as DuePendingPlanChange, e as PENDING_PLAN_QUERY_PORT_TOKEN, P as PendingPlanQueryPort, S as SUBSCRIPTION_USAGE_PORT_TOKEN, f as SUBSCRIPTION_WRITE_PORT_TOKEN, g as TENANT_AUTH_GUARDS_TOKEN, h as TENANT_ID_RESOLVER_TOKEN, i as TRIAL_PROJECTION_PORT_TOKEN, T as TenantIdResolver, j as TrialProjectionInput, a as TrialProjectionPort, k as USAGE_SNAPSHOT_PORT_TOKEN, l as USER_EMAIL_RESOLVER_TOKEN, m as USER_ID_RESOLVER_TOKEN, U as UserEmailResolver, b as UserIdResolver } from '../tenant-billing.tokens-D0vr1lfj.cjs';
|
|
16
|
+
import { S as SubscriptionContractService } from '../subscription-contract.service-CH2TKw-j.cjs';
|
|
17
|
+
import { a as PromoCodesService } from '../promo.service-BextPvx5.cjs';
|
|
18
|
+
import { A as AdminAuditService } from '../admin-audit.service-4P3Djdxk.cjs';
|
|
19
19
|
import '../contract-line-item-money-B0Z3Ogur.cjs';
|
|
20
20
|
import '../plan-resolution-CwUy_OqC.cjs';
|
|
21
21
|
import '../subscriber.service-5W6Gi-1B.cjs';
|
|
@@ -277,7 +277,7 @@ declare function computeNextBundlePeriod(booking: BundlePeriodRollInput, plan: B
|
|
|
277
277
|
* publish gate checks; what it cannot check is the combination, since that
|
|
278
278
|
* depends on the plan the tenant is on and the rhythm they are billed in.
|
|
279
279
|
*/
|
|
280
|
-
declare function resolveBundlePriceNet(bundleVersion: BundleVersionRow, planKey: string, billingCycle:
|
|
280
|
+
declare function resolveBundlePriceNet(bundleVersion: BundleVersionRow, planKey: string, billingCycle: BillingCycle): number | null;
|
|
281
281
|
/**
|
|
282
282
|
* The cycles a plan version is actually sold in.
|
|
283
283
|
*
|
|
@@ -841,11 +841,278 @@ declare class SubscriptionContractFreezeService implements ContractFreezePort {
|
|
|
841
841
|
private readonly entitlements;
|
|
842
842
|
private readonly contracts;
|
|
843
843
|
private readonly source;
|
|
844
|
-
|
|
844
|
+
private readonly subscriptions;
|
|
845
|
+
private readonly promoCodes;
|
|
846
|
+
constructor(catalogs: PlanCatalogSource, entitlements: EntitlementService, contracts: SubscriptionContractService, source: ContractFreezeSourcePort, writes?: TenantSubscriptionWritePort | null, subscriptions?: SubscriptionUsagePort | null, promoCodes?: PromoCodesService | null);
|
|
845
847
|
assertPartyFor(tenantId: string): Promise<void>;
|
|
846
848
|
endOnCancellation(tenantId: string, effectiveAt: Date): Promise<void>;
|
|
847
849
|
freezeOnPlanChange(tenantId: string, newPlan: string, billingCycle: BillingCycle, effectiveFrom: Date, endsAt?: Date | null): Promise<void>;
|
|
850
|
+
/**
|
|
851
|
+
* The contract `freezeOnPlanChange` would write, and nothing written: the
|
|
852
|
+
* plan version the subscription is bound to, the add-ons booked, the
|
|
853
|
+
* catalogue's rate and currency, and a promotional code not yet recorded —
|
|
854
|
+
* checked the way a contract is checked before it is written.
|
|
855
|
+
*
|
|
856
|
+
* Public so that an operator's refresh can show a full re-freeze before it
|
|
857
|
+
* makes one, measured by the same rules a plan change is.
|
|
858
|
+
*/
|
|
859
|
+
composeOnPlanChange(tenantId: string, newPlan: string, billingCycle: BillingCycle, effectiveFrom: Date, endsAt?: Date | null): Promise<CreateSubscriptionContractData>;
|
|
860
|
+
/**
|
|
861
|
+
* The code redeemed for the tenant's subscription, as a discount line, where
|
|
862
|
+
* no contract of the tenant records it yet.
|
|
863
|
+
*
|
|
864
|
+
* The first contract written after a redemption records it — at onboarding,
|
|
865
|
+
* or at the activation after a trial, where onboarding wrote none — and the
|
|
866
|
+
* ones after it do not repeat it: the discount runs from where it was first
|
|
867
|
+
* agreed, for the duration on its snapshot, counted from the first period
|
|
868
|
+
* that is paid. A contract concluded from an offer that carried the code
|
|
869
|
+
* already records it. Nothing is recorded without the promo module, for a
|
|
870
|
+
* reversed redemption, or where a contract written since the redemption
|
|
871
|
+
* does not record it: that was the first one, written before contracts
|
|
872
|
+
* recorded codes or by the application itself, and a later contract does
|
|
873
|
+
* not start the discount again.
|
|
874
|
+
*/
|
|
875
|
+
private redeemedCodeNotYetRecorded;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* `features` replaces the frozen features alone and copies everything else;
|
|
880
|
+
* `full` re-freezes the contract the way a plan change does.
|
|
881
|
+
*/
|
|
882
|
+
type ContractRefreshMode = 'features' | 'full';
|
|
883
|
+
interface ContractFeatureChange {
|
|
884
|
+
added: string[];
|
|
885
|
+
removed: string[];
|
|
886
|
+
}
|
|
887
|
+
/** A quota the successor records differently; `null` where one side has none. */
|
|
888
|
+
interface ContractQuotaChange {
|
|
889
|
+
key: string;
|
|
890
|
+
before: number | null;
|
|
891
|
+
after: number | null;
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Something the successor would charge differently: a member of the price
|
|
895
|
+
* snapshot (`priceSnapshot.totalNet`), or a line (`line plan:PRO`), with its net
|
|
896
|
+
* price where the line is on one side only.
|
|
897
|
+
*/
|
|
898
|
+
interface ContractMoneyChange {
|
|
899
|
+
field: string;
|
|
900
|
+
before: string | number | null;
|
|
901
|
+
after: string | number | null;
|
|
848
902
|
}
|
|
903
|
+
/** The feature keys that tell a contract's vocabulary has fallen behind. */
|
|
904
|
+
interface ContractVocabulary {
|
|
905
|
+
/** Frozen keys nothing in the application knows any more. */
|
|
906
|
+
unknown: string[];
|
|
907
|
+
/** Keys granted today that the contract lacks, and no `replaces` carries it to. */
|
|
908
|
+
missing: string[];
|
|
909
|
+
}
|
|
910
|
+
declare function featureChangeOf(before: Iterable<string>, after: Iterable<string>): ContractFeatureChange;
|
|
911
|
+
declare function quotaChangesOf(before: Readonly<Record<string, number>>, after: Readonly<Record<string, number>>): ContractQuotaChange[];
|
|
912
|
+
/**
|
|
913
|
+
* Where the successor would charge anything differently from the contract:
|
|
914
|
+
* its price snapshot member by member, and its lines, each matched to the line
|
|
915
|
+
* of the same kind and key. A line whose version alone moved is not a change of
|
|
916
|
+
* money, and is not reported.
|
|
917
|
+
*/
|
|
918
|
+
declare function moneyChangesOf(contract: Pick<SubscriptionContractRecord, 'priceSnapshot' | 'lineItems'>, successor: Pick<CreateSubscriptionContractData, 'priceSnapshot' | 'lineItems'>): ContractMoneyChange[];
|
|
919
|
+
/**
|
|
920
|
+
* A re-frozen successor, with what the contract it replaces agreed beyond
|
|
921
|
+
* money carried over: its terms, the offer it came from, the promotions and
|
|
922
|
+
* codes it records, and each line's minimum term. A plan change composes a new
|
|
923
|
+
* agreement and records none of these; an operator's refresh is not one, and
|
|
924
|
+
* the money comparison does not look at them.
|
|
925
|
+
*/
|
|
926
|
+
declare function withAgreedTerms(contract: Pick<SubscriptionContractRecord, 'originalOfferId' | 'termsSnapshot' | 'promotionSnapshots' | 'promoCodeSnapshots' | 'lineItems'>, successor: CreateSubscriptionContractData): CreateSubscriptionContractData;
|
|
927
|
+
/**
|
|
928
|
+
* The frozen keys nothing knows, and the granted keys the contract lacks.
|
|
929
|
+
*
|
|
930
|
+
* `known` is the application's whole vocabulary: the features its code
|
|
931
|
+
* declares, the ones the catalogue lists, and the old keys a `replaces`
|
|
932
|
+
* declaration names — those are carried, not dead. `frozenWithReplacements` is
|
|
933
|
+
* the frozen set with what those declarations grant beyond it, so a renamed
|
|
934
|
+
* key covered by one is not missing.
|
|
935
|
+
*/
|
|
936
|
+
declare function vocabularyOf(input: {
|
|
937
|
+
frozen: ReadonlySet<string>;
|
|
938
|
+
frozenWithReplacements: ReadonlySet<string>;
|
|
939
|
+
grantedToday: ReadonlySet<string>;
|
|
940
|
+
known: ReadonlySet<string>;
|
|
941
|
+
}): ContractVocabulary;
|
|
942
|
+
|
|
943
|
+
/** Which contracts a refresh looks at. */
|
|
944
|
+
interface ContractRefreshSelection {
|
|
945
|
+
/** The contracts to look at; every contract in force where absent. */
|
|
946
|
+
contractIds?: readonly string[];
|
|
947
|
+
}
|
|
948
|
+
/** Why a refresh leaves a contract as it is. */
|
|
949
|
+
type ContractRefreshRefusal =
|
|
950
|
+
/** Not found, or not in force: ended, superseded, or not begun. */
|
|
951
|
+
{
|
|
952
|
+
code: 'NOT_IN_FORCE';
|
|
953
|
+
}
|
|
954
|
+
/** The tenant it was concluded for has no subscription to read today's versions from. */
|
|
955
|
+
| {
|
|
956
|
+
code: 'NO_SUBSCRIPTION';
|
|
957
|
+
}
|
|
958
|
+
/** The contract does not say which plan version it was frozen from. */
|
|
959
|
+
| {
|
|
960
|
+
code: 'PLAN_VERSION_NOT_RECORDED';
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* The subscription is bound to another plan version than the one the
|
|
964
|
+
* contract records. Replacing features alone would move the contract to
|
|
965
|
+
* that version's features without its price; a full re-freeze is the way,
|
|
966
|
+
* and weighs the price.
|
|
967
|
+
*/
|
|
968
|
+
| {
|
|
969
|
+
code: 'PLAN_VERSION_MOVED';
|
|
970
|
+
recorded: string;
|
|
971
|
+
bound: string;
|
|
972
|
+
}
|
|
973
|
+
/** A full re-freeze would charge differently; `money` says where. */
|
|
974
|
+
| {
|
|
975
|
+
code: 'MONEY_WOULD_CHANGE';
|
|
976
|
+
}
|
|
977
|
+
/** Composing or writing the successor was refused; `reason` is the refusal's message. */
|
|
978
|
+
| {
|
|
979
|
+
code: 'REFUSED';
|
|
980
|
+
reason: string;
|
|
981
|
+
};
|
|
982
|
+
/** What a refresh would change on one contract, or why it would not. */
|
|
983
|
+
interface ContractRefreshPreview {
|
|
984
|
+
contractId: string;
|
|
985
|
+
/** `null` only for a contract named that does not exist. */
|
|
986
|
+
tenantId: string | null;
|
|
987
|
+
vocabulary: ContractVocabulary;
|
|
988
|
+
features: ContractFeatureChange;
|
|
989
|
+
quotas: ContractQuotaChange[];
|
|
990
|
+
money: ContractMoneyChange[];
|
|
991
|
+
/** Whether a successor would record anything differently from the contract. */
|
|
992
|
+
changes: boolean;
|
|
993
|
+
/** Why the contract is left as it is; `null` where a successor would be written. */
|
|
994
|
+
refusal: ContractRefreshRefusal | null;
|
|
995
|
+
}
|
|
996
|
+
/** What a refresh did to one contract. */
|
|
997
|
+
interface ContractRefreshOutcome extends ContractRefreshPreview {
|
|
998
|
+
/** The successor written, or `null` where none was. */
|
|
999
|
+
successorId: string | null;
|
|
1000
|
+
/**
|
|
1001
|
+
* The contract moved between the read and the write — a plan change or a
|
|
1002
|
+
* cancellation got there first — and nothing was written. Ask again.
|
|
1003
|
+
*/
|
|
1004
|
+
moved: boolean;
|
|
1005
|
+
}
|
|
1006
|
+
/** The contracts in force whose frozen vocabulary has fallen behind. */
|
|
1007
|
+
interface ContractVocabularyReport {
|
|
1008
|
+
/** How many contracts in force were looked at. */
|
|
1009
|
+
inForce: number;
|
|
1010
|
+
stale: ContractRefreshPreview[];
|
|
1011
|
+
/**
|
|
1012
|
+
* The contracts today's features could not be read for — their tenant has
|
|
1013
|
+
* no subscription, or an add-on version they cover cannot be read — so
|
|
1014
|
+
* nothing is known about their vocabulary. Named rather than left out: left
|
|
1015
|
+
* out, they would read as up to date.
|
|
1016
|
+
*/
|
|
1017
|
+
unreadable: ContractRefreshPreview[];
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Carries a changed feature vocabulary into contracts in force, on the
|
|
1021
|
+
* operator's command (`SC-ENTL-023`), and says where it has fallen behind
|
|
1022
|
+
* (`SC-ENTL-022`).
|
|
1023
|
+
*
|
|
1024
|
+
* A contract keeps the feature keys it was frozen with, and that is the point
|
|
1025
|
+
* of freezing it (`SC-ENTL-021`). So nothing here runs by itself, and every
|
|
1026
|
+
* write is preceded by the preview it would show, worked out on the same path —
|
|
1027
|
+
* `apply` computes what `preview` shows and writes it, rather than trusting a
|
|
1028
|
+
* preview made earlier.
|
|
1029
|
+
*
|
|
1030
|
+
* It reads and writes across tenants, the way the administration does
|
|
1031
|
+
* (`SC-SEC-003`): the operator acts for the platform, and a policy scoping
|
|
1032
|
+
* reads to one tenant would make every other tenant's contracts look absent.
|
|
1033
|
+
*/
|
|
1034
|
+
declare class ContractRefreshService {
|
|
1035
|
+
private readonly contracts;
|
|
1036
|
+
private readonly entitlements;
|
|
1037
|
+
private readonly usage;
|
|
1038
|
+
private readonly catalogs;
|
|
1039
|
+
private readonly freeze;
|
|
1040
|
+
private readonly discovery;
|
|
1041
|
+
private readonly rlsBypass;
|
|
1042
|
+
private readonly audit;
|
|
1043
|
+
private readonly logger;
|
|
1044
|
+
constructor(contracts: SubscriptionContractService, entitlements: EntitlementService, usage: SubscriptionUsagePort, catalogs: PlanCatalogSource, freeze: SubscriptionContractFreezeService, discovery?: DiscoverySnapshot | null, rlsBypass?: RlsBypassPort | null, audit?: AdminAuditService | null);
|
|
1045
|
+
/** The contracts in force whose frozen features hold unknown keys or lack granted ones. */
|
|
1046
|
+
inspect(asOf?: Date): Promise<ContractVocabularyReport>;
|
|
1047
|
+
/** What a refresh would change on each contract selected. Writes nothing. */
|
|
1048
|
+
preview(selection: ContractRefreshSelection, mode: ContractRefreshMode, asOf?: Date): Promise<ContractRefreshPreview[]>;
|
|
1049
|
+
/**
|
|
1050
|
+
* Writes a successor for each contract selected that would change and is
|
|
1051
|
+
* not refused, and keeps the contract it replaces as superseded
|
|
1052
|
+
* (`SC-AUD-007`). What it writes is what `preview` shows at this moment.
|
|
1053
|
+
*/
|
|
1054
|
+
apply(selection: ContractRefreshSelection, mode: ContractRefreshMode, actor: AdminActor, asOf?: Date): Promise<ContractRefreshOutcome[]>;
|
|
1055
|
+
private previewAll;
|
|
1056
|
+
private write;
|
|
1057
|
+
private plan;
|
|
1058
|
+
/**
|
|
1059
|
+
* The contract `freezeOnPlanChange` would write for the tenant now, with
|
|
1060
|
+
* the terms the contract it replaces agreed.
|
|
1061
|
+
*/
|
|
1062
|
+
private refrozen;
|
|
1063
|
+
private compared;
|
|
1064
|
+
/**
|
|
1065
|
+
* Every feature key the application knows: the ones its code declares, the
|
|
1066
|
+
* old keys those declarations say they replace, and the catalogue's.
|
|
1067
|
+
*/
|
|
1068
|
+
private knownFeatures;
|
|
1069
|
+
/** The contracts selected, each read as it stands, or `null` where it is not in force. */
|
|
1070
|
+
private targets;
|
|
1071
|
+
/** Best effort: the successor stands whether or not its record could be written (`SC-AUD-004`). */
|
|
1072
|
+
private record;
|
|
1073
|
+
private withBypass;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
interface SubscriberAccountModuleOptions {
|
|
1077
|
+
/** The same chain the tenant routes of the administration run behind. */
|
|
1078
|
+
guards: Array<Type<CanActivate>>;
|
|
1079
|
+
/**
|
|
1080
|
+
* Must bring `AdminResourcesService` and `SubscriberAccountService` into
|
|
1081
|
+
* scope — the modules that already provide them, passed as the very objects
|
|
1082
|
+
* the application imports, so that no adapter is built a second time. The
|
|
1083
|
+
* `RlsBypassPort` has to be visible too; `SaaSiCatModule` provides it
|
|
1084
|
+
* globally.
|
|
1085
|
+
*/
|
|
1086
|
+
imports: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* The operator's view of a subscriber's account, served beside the tenant it
|
|
1090
|
+
* belongs to. Mounted where the platform keeps both the administration's
|
|
1091
|
+
* tenants and a charge journal.
|
|
1092
|
+
*/
|
|
1093
|
+
declare class SubscriberAccountModule {
|
|
1094
|
+
static forRoot(options: SubscriberAccountModuleOptions): DynamicModule;
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
/**
|
|
1098
|
+
* Reads a subscriber's account for the operator: the charges its journal
|
|
1099
|
+
* holds, each with the title of the contract line it came from.
|
|
1100
|
+
*
|
|
1101
|
+
* It reads only. Nothing here derives or writes a charge — that is
|
|
1102
|
+
* `SubscriberChargeService`'s — so looking at an account never changes it.
|
|
1103
|
+
*/
|
|
1104
|
+
declare class SubscriberAccountService {
|
|
1105
|
+
private readonly ledger;
|
|
1106
|
+
private readonly contracts;
|
|
1107
|
+
private readonly subscribers;
|
|
1108
|
+
private readonly subscriptions;
|
|
1109
|
+
constructor(ledger: SubscriberLedgerRepository, contracts: SubscriptionContractRepository, subscribers: SubscriberRepository, subscriptions: SubscriptionUsagePort);
|
|
1110
|
+
/** The account of the tenant's subscriber; empty while it has no subscription. */
|
|
1111
|
+
accountOf(tenantId: string): Promise<AdminSubscriberAccount>;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
/** Adapter token: where the subscriber's charges are written (`tenantBilling.chargeJournal`). */
|
|
1115
|
+
declare const SUBSCRIBER_LEDGER_REPOSITORY_TOKEN: unique symbol;
|
|
849
1116
|
|
|
850
1117
|
declare function computeCarriedTrialEndsAt(currentTrialDays: number, newTrialDays: number, currentTrialEndsAt: Date, now: Date): Date;
|
|
851
1118
|
|
|
@@ -936,4 +1203,4 @@ declare const SUBSCRIPTION_BUNDLE_CONFIG_TOKEN: unique symbol;
|
|
|
936
1203
|
*/
|
|
937
1204
|
declare function buildTenantSubscriptionBundlesController(extraGuards?: Array<Type<CanActivate>>): Type;
|
|
938
1205
|
|
|
939
|
-
export { AddSubscriptionBundleDto, AuthGuardList, BILLING_FEATURE_UI_REGISTRY_TOKEN, BillingPermissionGuard, type BundleFirstPeriodInput, type BundlePeriodRollInput, type BundlePeriodWindow, type BundlePlanContext, BundlePriceLookupDto, CancelSubscriptionBundleDto, CatalogBundleUpsellResolver, ConfiguratorCatalogBuilder, ContractFreezePort, ContractFreezeSourcePort, DEFAULT_BUNDLE_MINIMUM_TERM_MONTHS, FEATURE_GUARD_CONFIG_TOKEN, FEATURE_GUARD_MARKER, FeatureGuard, type FeatureGuardConfig, LimitExceededFilter, type MarketingFields, type NextPeriodWindow, PLAN_CATALOG_IMPORT_SINK_TOKEN, PLAN_CATALOG_READ_SINK_TOKEN, PLAN_CATALOG_SETTINGS_TOKEN, PLAN_CATALOG_SOURCE_TOKEN, PUBLIC_CATALOG_BUNDLE_REPOSITORY_TOKEN, PUBLIC_CATALOG_MARKETING_REPOSITORY_TOKEN, type PeriodRollInput, type PlanAnchorSource, type PlanCatalogBuildSettings, PlanCatalogImportDto, type PlanCatalogImporterControllerConfig, PlanCatalogImporterModule, type PlanCatalogImporterModuleOptions, PlanCatalogImporterService, PlanCatalogModule, type PlanCatalogModuleOptions, PlanCatalogSource, type PlanResponseEntry, PreviewSubscriptionBundleDto, type PublicBundleEntry, PublicCatalogController, PublicCatalogModule, type PublicCatalogModuleOptions, PublishValidationError, type PublishablePlanVersion, REQUIRE_FEATURE_KEY, type RenewalDecision, type RenewalSubInput, RequireFeature, SUBSCRIPTION_BUNDLE_CONFIG_TOKEN, SUBSCRIPTION_BUNDLE_REPOSITORY_TOKEN, SubscriptionContractFreezeService, UPSELL_OFFER_CURRENCY_TOKEN, UPSELL_OFFER_RESOLVER_TOKEN, advanceOneCycle, assertBaseVersionFresh, assertChangeNote, assertDraftPublishable, assertOptimisticLockHeld, billingAnchorDay, buildPlanCatalogFromSnapshot, buildPlanCatalogImporterController, buildTenantSubscriptionBundlesController, bundleCycleFitsPlan, bundleFirstPeriodEnd, bundleFirstPeriodStart, bundleNextPeriodEnd, clearPendingPlanVersionFields, computeCarriedTrialEndsAt, computeNextBundlePeriod, computeNextPeriod, cyclesSoldFor, decideRenewal, findPlan, getActiveFeatureKeys, getMarketedPlans, getPlanOrThrow, getPlanPriceGross, getPlanPriceNet, getPlanQuota, initialPeriodWindow, isFeatureInPlan, isFeaturePlannedOnly, isPlanNotSoldInCycle, listPriceNet, periodEndAfter, periodEndWithMinLead, planNotSoldInCycle, resolveBundlePriceNet, resolvePlanAnchorDay, retreatOneCycle };
|
|
1206
|
+
export { AddSubscriptionBundleDto, AuthGuardList, BILLING_FEATURE_UI_REGISTRY_TOKEN, BillingPermissionGuard, type BundleFirstPeriodInput, type BundlePeriodRollInput, type BundlePeriodWindow, type BundlePlanContext, BundlePriceLookupDto, CancelSubscriptionBundleDto, CatalogBundleUpsellResolver, ConfiguratorCatalogBuilder, type ContractFeatureChange, ContractFreezePort, ContractFreezeSourcePort, type ContractMoneyChange, type ContractQuotaChange, type ContractRefreshMode, type ContractRefreshOutcome, type ContractRefreshPreview, type ContractRefreshRefusal, type ContractRefreshSelection, ContractRefreshService, type ContractVocabulary, type ContractVocabularyReport, DEFAULT_BUNDLE_MINIMUM_TERM_MONTHS, FEATURE_GUARD_CONFIG_TOKEN, FEATURE_GUARD_MARKER, FeatureGuard, type FeatureGuardConfig, LimitExceededFilter, type MarketingFields, type NextPeriodWindow, PLAN_CATALOG_IMPORT_SINK_TOKEN, PLAN_CATALOG_READ_SINK_TOKEN, PLAN_CATALOG_SETTINGS_TOKEN, PLAN_CATALOG_SOURCE_TOKEN, PUBLIC_CATALOG_BUNDLE_REPOSITORY_TOKEN, PUBLIC_CATALOG_MARKETING_REPOSITORY_TOKEN, type PeriodRollInput, type PlanAnchorSource, type PlanCatalogBuildSettings, PlanCatalogImportDto, type PlanCatalogImporterControllerConfig, PlanCatalogImporterModule, type PlanCatalogImporterModuleOptions, PlanCatalogImporterService, PlanCatalogModule, type PlanCatalogModuleOptions, PlanCatalogSource, type PlanResponseEntry, PreviewSubscriptionBundleDto, type PublicBundleEntry, PublicCatalogController, PublicCatalogModule, type PublicCatalogModuleOptions, PublishValidationError, type PublishablePlanVersion, REQUIRE_FEATURE_KEY, type RenewalDecision, type RenewalSubInput, RequireFeature, SUBSCRIBER_LEDGER_REPOSITORY_TOKEN, SUBSCRIPTION_BUNDLE_CONFIG_TOKEN, SUBSCRIPTION_BUNDLE_REPOSITORY_TOKEN, SubscriberAccountModule, type SubscriberAccountModuleOptions, SubscriberAccountService, SubscriptionContractFreezeService, UPSELL_OFFER_CURRENCY_TOKEN, UPSELL_OFFER_RESOLVER_TOKEN, advanceOneCycle, assertBaseVersionFresh, assertChangeNote, assertDraftPublishable, assertOptimisticLockHeld, billingAnchorDay, buildPlanCatalogFromSnapshot, buildPlanCatalogImporterController, buildTenantSubscriptionBundlesController, bundleCycleFitsPlan, bundleFirstPeriodEnd, bundleFirstPeriodStart, bundleNextPeriodEnd, clearPendingPlanVersionFields, computeCarriedTrialEndsAt, computeNextBundlePeriod, computeNextPeriod, cyclesSoldFor, decideRenewal, featureChangeOf, findPlan, getActiveFeatureKeys, getMarketedPlans, getPlanOrThrow, getPlanPriceGross, getPlanPriceNet, getPlanQuota, initialPeriodWindow, isFeatureInPlan, isFeaturePlannedOnly, isPlanNotSoldInCycle, listPriceNet, moneyChangesOf, periodEndAfter, periodEndWithMinLead, planNotSoldInCycle, quotaChangesOf, resolveBundlePriceNet, resolvePlanAnchorDay, retreatOneCycle, vocabularyOf, withAgreedTerms };
|