@saasicat/nest 0.26.0 → 0.27.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/LICENSE +90 -201
- package/dist/_entries.cjs +3265 -2846
- package/dist/billing/index.d.cts +4 -4
- package/dist/billing/index.d.ts +4 -4
- package/dist/billing/index.js +33 -31
- package/dist/catalog/index.js +5 -5
- package/dist/checkout-offer/index.js +2 -2
- package/dist/chunk-2FR6ZL7R.js +0 -0
- package/dist/chunk-2JTISFUZ.js +792 -0
- package/dist/chunk-2SLTRKXC.js +0 -0
- package/dist/chunk-3E6ONOMG.js +50 -0
- package/dist/{chunk-UOWK2HYG.js → chunk-7ZPFQXHM.js} +1 -1
- package/dist/{chunk-B7NRY2LV.js → chunk-CJFAOD7K.js} +1 -39
- package/dist/{chunk-J62YI25C.js → chunk-EHKMPP6J.js} +1194 -775
- package/dist/{chunk-RPO4IVUY.js → chunk-F4B2NJUZ.js} +26 -91
- package/dist/chunk-H4DOTO7S.js +85 -0
- package/dist/{chunk-V3MRZ7SH.js → chunk-UHD6FJBQ.js} +421 -1197
- package/dist/{define-saasicat-BK6RRWWG.d.ts → define-saasicat-3ois8t8s.d.ts} +26 -3
- package/dist/{define-saasicat-D30I-WET.d.cts → define-saasicat-CFxut1VR.d.cts} +26 -3
- package/dist/{enforce-quota.interceptor-B9QueAFf.d.ts → enforce-quota.interceptor-CYDNvAQz.d.ts} +3 -3
- package/dist/{enforce-quota.interceptor-DY6CLjoP.d.cts → enforce-quota.interceptor-N80KC34N.d.cts} +3 -3
- package/dist/entitlement/index.js +7 -4
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +87 -79
- package/dist/{saas-platform.module-D1mUZPrz.d.ts → module-options-ByJL7FZm.d.ts} +40 -27
- package/dist/{saas-platform.module-CgalxzcT.d.cts → module-options-klrPnWGF.d.cts} +40 -27
- package/dist/platform/index.d.cts +201 -19
- package/dist/platform/index.d.ts +201 -19
- package/dist/platform/index.js +58 -33
- package/dist/promo/index.js +2 -2
- package/dist/subscription-contract/index.js +5 -2
- package/dist/{tenant-billing.controller-DHSUrT_N.d.cts → tenant-billing.controller-CAMMdfn1.d.cts} +1 -1
- package/dist/{tenant-billing.controller-BSlpFqVA.d.ts → tenant-billing.controller-CYYK0CpT.d.ts} +1 -1
- package/dist/{subscription-bundles.module-BDbODWvA.d.ts → tenant-billing.module-B0stLoJn.d.ts} +51 -51
- package/dist/{subscription-bundles.module-Cfi-lFWF.d.cts → tenant-billing.module-BxJS6fX4.d.cts} +51 -51
- package/dist/testing/index.d.cts +8 -8
- package/dist/testing/index.d.ts +8 -8
- package/dist/testing/index.js +13 -11
- package/package.json +4 -4
- package/dist/{chunk-QB7MICKQ.js → chunk-7X5MSAIL.js} +9 -9
- package/dist/{chunk-FY4EJTV4.js → chunk-OYNHOY45.js} +0 -0
- package/dist/{chunk-I4XD43AN.js → chunk-XTVAFJ3P.js} +3 -3
package/dist/platform/index.d.ts
CHANGED
|
@@ -1,31 +1,179 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
import {
|
|
1
|
+
export { a as SAASICAT_PUBLIC_ROUTE_KEY, d as SaaSiCatModule, e as SaaSiCatPublicRoute, d as SaasPlatformModule, S as SetupService, g as defineSaaSiCat, i as isSaaSiCatPublicRoute } from '../define-saasicat-3ois8t8s.js';
|
|
2
|
+
import { CanActivate, DynamicModule, OnApplicationBootstrap } from '@nestjs/common';
|
|
3
|
+
import { SaasicatPersistenceAdapter, SubscriptionUsagePort, SubscriptionRepository, UsageSnapshotPort, QuotaProvider } from '@saasicat/types';
|
|
4
|
+
import { P as ProviderSpec } from '../di-CcNeq9v-.js';
|
|
5
|
+
import { b as DiscoveryAppInfo } from '../discovery.scanner-DLgEvuoy.js';
|
|
6
|
+
export { c as DiscoveryScanner } from '../discovery.scanner-DLgEvuoy.js';
|
|
7
|
+
import { e as SaasPlatformModuleOptions, S as SaasPlatformAdapters, o as PlanResolverPort } from '../module-options-ByJL7FZm.js';
|
|
8
|
+
export { P as PLAN_RESOLVER_PORT_TOKEN, a as SaasPlatformAdminResourcesOptions, b as SaasPlatformAdminStatsOptions, c as SaasPlatformCatalogOptions, d as SaasPlatformCheckoutOfferOptions, f as SaasPlatformPromoCodesOptions, g as SaasPlatformSetupOptions, h as SaasPlatformSubscriptionBundlesOptions, i as SaasPlatformSubscriptionContractOptions, j as SaasPlatformTenantAuthGuards, k as SaasPlatformTenantBillingOptions, l as SetupModule, m as SetupModuleOptions, n as StaticPlanResolver, T as TenantManifestControllerOptions, p as buildTenantManifestController } from '../module-options-ByJL7FZm.js';
|
|
9
|
+
import { S as StaticEntitlementService } from '../enforce-quota.interceptor-CYDNvAQz.js';
|
|
10
|
+
export { E as EnforceQuotaInterceptor, Q as QUOTA_PROVIDERS_TOKEN, b as STATIC_FEATURE_GUARD_CONFIG_TOKEN, c as StaticEntitlementSnapshot, a as StaticFeatureGuard, d as StaticFeatureGuardConfig } from '../enforce-quota.interceptor-CYDNvAQz.js';
|
|
8
11
|
import { DiscoveryService, MetadataScanner } from '@nestjs/core';
|
|
9
12
|
export { A as AdminBypassRlsInterceptor, a as AdminManifestModule, b as AdminManifestModuleOptions, c as AdminManifestService, d as AdminModule, e as AdminModuleOptions, f as AdminStatsService, M as MfaGuard, h as MfaService, S as SuperAdminGuard } from '../admin-stats.service-Db2exT_d.js';
|
|
10
13
|
export { A as AdminAuditService } from '../admin-audit.service-9IqXMlZm.js';
|
|
11
14
|
export { e as AdminResourcesService, f as AdminStatsModule, g as AdminStatsModuleOptions } from '../admin-resources.module-BY5r_1MG.js';
|
|
12
15
|
export { c as EntitlementService } from '../aggregation-DP5zfKbU.js';
|
|
13
|
-
export { d as ComposedTenantAuthGuard, P as PendingPlanMaterializationService, h as PlanChangePreviewService, r as SubscriptionBundlePreviewService, s as SubscriptionBundlesService, T as TenantAdminGuard, t as TenantBillingController } from '../tenant-billing.controller-
|
|
16
|
+
export { d as ComposedTenantAuthGuard, P as PendingPlanMaterializationService, h as PlanChangePreviewService, r as SubscriptionBundlePreviewService, s as SubscriptionBundlesService, T as TenantAdminGuard, t as TenantBillingController } from '../tenant-billing.controller-CYYK0CpT.js';
|
|
14
17
|
export { B as BundlesService, C as CatalogEntriesService, M as MarketingProjectionsService, b as MarketingSettingsService, P as PlanVersionsService, c as PlansService, d as PromotionsService, e as PublicMarketingCatalogService } from '../plan-versions.service-B-YoE4SZ.js';
|
|
15
|
-
export { c as DiscoveryScanner } from '../discovery.scanner-DLgEvuoy.js';
|
|
16
18
|
export { P as PromoCodeRateLimitGuard } from '../rate-limit.guard-dntqAlfZ.js';
|
|
17
19
|
export { g as PromoCodesService } from '../service-D48clObR.js';
|
|
18
20
|
export { a as CheckoutOfferModule, b as CheckoutOfferModuleOptions } from '../checkout-offer.module-Ca3_TieR.js';
|
|
19
21
|
export { C as CheckoutOfferService } from '../checkout-offer.service-BX51dljL.js';
|
|
20
22
|
export { S as SubscriptionContractModule, a as SubscriptionContractModuleOptions } from '../subscription-contract.module-edyhBr4n.js';
|
|
21
23
|
export { S as SubscriptionContractService } from '../subscription-contract.service--cm47ZJJ.js';
|
|
22
|
-
import '../
|
|
24
|
+
import '../tenant-billing.module-B0stLoJn.js';
|
|
25
|
+
import '../catalog.module-CQr1FpkI.js';
|
|
23
26
|
import '../plan-resolution-CFCoUkrE.js';
|
|
24
27
|
import '../module-BE17XFLg.js';
|
|
25
|
-
import '../catalog.module-CQr1FpkI.js';
|
|
26
|
-
import '../subscription-bundles.module-BDbODWvA.js';
|
|
27
28
|
import 'rxjs';
|
|
28
29
|
|
|
30
|
+
/**
|
|
31
|
+
* What `tenantBilling` resolved and its two dependants need.
|
|
32
|
+
*
|
|
33
|
+
* Mutable, and the only mutable thing here: `composeTenantBilling` writes it,
|
|
34
|
+
* `composeSubscriptionBundles` and the entitlement runtime read it. A composer
|
|
35
|
+
* that runs before tenant billing sees the initial values, which is correct —
|
|
36
|
+
* there was no tenant billing to resolve anything.
|
|
37
|
+
*/
|
|
38
|
+
interface SharedTenantBinding {
|
|
39
|
+
/** Normalised `authGuards`, shared with the bundle controller. */
|
|
40
|
+
authGuards?: ProviderSpec<ReadonlyArray<CanActivate>>;
|
|
41
|
+
/** The usage port both controllers report against. */
|
|
42
|
+
subscriptionUsagePort?: ProviderSpec<SubscriptionUsagePort>;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the tenant-billing module already registered the app's quota
|
|
45
|
+
* providers.
|
|
46
|
+
*
|
|
47
|
+
* It registers them as its own providers and exports, so the entitlement
|
|
48
|
+
* runtime must not register them a second time — two instances of a
|
|
49
|
+
* `QuotaProvider` are two counters over the same rows.
|
|
50
|
+
*/
|
|
51
|
+
quotaProvidersHostedByTenantBilling: boolean;
|
|
52
|
+
}
|
|
53
|
+
interface CompositionContext {
|
|
54
|
+
readonly options: SaasPlatformModuleOptions;
|
|
55
|
+
/** After the bundle slices and the explicit entries have been merged. */
|
|
56
|
+
readonly adapters: SaasPlatformAdapters;
|
|
57
|
+
readonly persistence: SaasicatPersistenceAdapter | undefined;
|
|
58
|
+
/** App key and version, for discovery and the public catalogue. */
|
|
59
|
+
readonly appInfo: DiscoveryAppInfo;
|
|
60
|
+
/** Entitlement is needed directly, or by tenant billing / bundles. */
|
|
61
|
+
readonly requiresFullEntitlement: boolean;
|
|
62
|
+
readonly shared: SharedTenantBinding;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** One feature's contribution: the modules it adds, or none. */
|
|
66
|
+
type Composer = (ctx: CompositionContext) => DynamicModule[];
|
|
67
|
+
declare const FEATURE_COMPOSERS: readonly Composer[];
|
|
68
|
+
/** Every module the enabled features contribute, in composer order. */
|
|
69
|
+
declare function composeFeatures(ctx: CompositionContext): DynamicModule[];
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Mounted on purpose and deliberately not re-exported.
|
|
73
|
+
*
|
|
74
|
+
* Declared here rather than left as an absence, because the guard in
|
|
75
|
+
* `tests/platform-composition.test.js` otherwise reports it every time and the
|
|
76
|
+
* next person has to re-derive whether it is a bug.
|
|
77
|
+
*
|
|
78
|
+
* `PublicCatalogModule` is a controller and one token, `FEATURE_UI_REGISTRY` —
|
|
79
|
+
* which the APP supplies through `catalog: { featureUiRegistry }` rather than
|
|
80
|
+
* injects. Re-exporting it would also collide with the identically named token
|
|
81
|
+
* from `billing`, which means something else (see CONTRIBUTING, "One bundle,
|
|
82
|
+
* many entries").
|
|
83
|
+
*/
|
|
84
|
+
declare const MOUNTED_BUT_NOT_EXPORTED: readonly string[];
|
|
85
|
+
/** The `exports` of the assembled module, plus whatever it provides itself. */
|
|
86
|
+
declare function composeModuleExports(ctx: CompositionContext, ownExports: NonNullable<DynamicModule['exports']>): NonNullable<DynamicModule['exports']>;
|
|
87
|
+
|
|
88
|
+
/** Everything a rule may look at: the options as given, the adapters as resolved. */
|
|
89
|
+
interface PlatformConfiguration {
|
|
90
|
+
readonly options: SaasPlatformModuleOptions;
|
|
91
|
+
/** After the bundle slices and the explicit entries have been merged. */
|
|
92
|
+
readonly adapters: SaasPlatformAdapters;
|
|
93
|
+
}
|
|
94
|
+
interface PlatformRule {
|
|
95
|
+
/** Stable id — `<area>.<what-it-requires>`. Appears in the boot error. */
|
|
96
|
+
readonly id: string;
|
|
97
|
+
/** Whether this rule has anything to say about this configuration. */
|
|
98
|
+
readonly when: (c: PlatformConfiguration) => boolean;
|
|
99
|
+
/** True when the configuration satisfies it. */
|
|
100
|
+
readonly assert: (c: PlatformConfiguration) => boolean;
|
|
101
|
+
/**
|
|
102
|
+
* What is wrong and what to do about it.
|
|
103
|
+
*
|
|
104
|
+
* A function only where it has to be: several of these name which of a set
|
|
105
|
+
* is missing, and "adapters are missing: subscriptionRepository,
|
|
106
|
+
* transactionRunner" is worth more than "adapters are missing". The rest
|
|
107
|
+
* are the same sentence every time, and a closure that ignores its argument
|
|
108
|
+
* is one more thing a reader has to check for.
|
|
109
|
+
*/
|
|
110
|
+
readonly message: string | ((c: PlatformConfiguration) => string);
|
|
111
|
+
/**
|
|
112
|
+
* Where the option is documented.
|
|
113
|
+
*
|
|
114
|
+
* Derived from the id rather than written beside it — see `docsUrlFor`.
|
|
115
|
+
*/
|
|
116
|
+
readonly docs: string;
|
|
117
|
+
/**
|
|
118
|
+
* The typed error this rule threw before the table existed, when it has
|
|
119
|
+
* one.
|
|
120
|
+
*
|
|
121
|
+
* Used only when this rule is the ONLY violation — and that is not a
|
|
122
|
+
* compromise, it is the exact set of cases where the typed error was ever
|
|
123
|
+
* observable. A configuration with two problems used to throw whichever
|
|
124
|
+
* check ran first and stop, so nothing could catch the second one by type
|
|
125
|
+
* either. Where a consumer could see `PersistenceCapabilityError`, it still
|
|
126
|
+
* sees it; where it could not, it now gets the full list instead of one
|
|
127
|
+
* arbitrary problem.
|
|
128
|
+
*/
|
|
129
|
+
readonly error?: (c: PlatformConfiguration) => Error;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* GitHub's heading slug for `text`: lowercased, punctuation dropped, spaces
|
|
133
|
+
* hyphenated.
|
|
134
|
+
*
|
|
135
|
+
* Written out because the anchor has to match a heading nobody types — the
|
|
136
|
+
* page is generated. `tests/options-reference-is-generated.test.js` asserts
|
|
137
|
+
* every rule's anchor is a heading in the file, so a wrong slug fails the build
|
|
138
|
+
* rather than producing a link that lands at the top of the page.
|
|
139
|
+
*/
|
|
140
|
+
declare const headingSlug: (text: string) => string;
|
|
141
|
+
/**
|
|
142
|
+
* The documentation link for a rule.
|
|
143
|
+
*
|
|
144
|
+
* Derived from the id, so the two cannot disagree. They did, on the first
|
|
145
|
+
* attempt: eleven hand-written anchors against headings the generator names
|
|
146
|
+
* after the ids, and every one of them landed at the top of the page.
|
|
147
|
+
*/
|
|
148
|
+
declare const docsUrlFor: (id: string) => string;
|
|
149
|
+
declare const PLATFORM_RULES: readonly PlatformRule[];
|
|
150
|
+
|
|
151
|
+
interface PlatformViolation {
|
|
152
|
+
readonly id: string;
|
|
153
|
+
readonly message: string;
|
|
154
|
+
readonly docs: string;
|
|
155
|
+
}
|
|
156
|
+
/** Every rule that applies to this configuration and is not satisfied by it. */
|
|
157
|
+
declare function findViolations(configuration: PlatformConfiguration, rules?: readonly PlatformRule[]): PlatformViolation[];
|
|
158
|
+
/**
|
|
159
|
+
* The error a misconfigured application boots into.
|
|
160
|
+
*
|
|
161
|
+
* Carries the violations as data as well as prose: a consumer's own boot
|
|
162
|
+
* diagnostics can group them, and the rule ids are stable enough to assert on.
|
|
163
|
+
*/
|
|
164
|
+
declare class SaaSiCatConfigurationError extends Error {
|
|
165
|
+
readonly violations: readonly PlatformViolation[];
|
|
166
|
+
constructor(violations: readonly PlatformViolation[]);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Throws once, naming every problem, or returns.
|
|
170
|
+
*
|
|
171
|
+
* A single violation from a rule that owns a typed error raises that error
|
|
172
|
+
* instead of the aggregate — see `PlatformRule.error` for why that is the
|
|
173
|
+
* whole of the previous behaviour rather than part of it.
|
|
174
|
+
*/
|
|
175
|
+
declare function assertConfiguration(configuration: PlatformConfiguration, rules?: readonly PlatformRule[]): void;
|
|
176
|
+
|
|
29
177
|
/**
|
|
30
178
|
* Standard `tenantId → planId` resolver backed by the canonical subscription
|
|
31
179
|
* repository. This removes the identical resolver class most applications
|
|
@@ -48,22 +196,56 @@ declare class QuotaProvidersUsageSnapshot implements UsageSnapshotPort {
|
|
|
48
196
|
snapshot(tenantId: string): Promise<Record<string, number>>;
|
|
49
197
|
}
|
|
50
198
|
|
|
51
|
-
|
|
199
|
+
/** What the module knows at composition time and this check cannot see. */
|
|
200
|
+
interface EnforcementChainState {
|
|
201
|
+
/**
|
|
202
|
+
* Whether anything can enforce `@RequireFeature`.
|
|
203
|
+
*
|
|
204
|
+
* True on the static path, and also on the V3 path, where the application
|
|
205
|
+
* binds `FeatureGuard` from `@saasicat/nest/billing` itself.
|
|
206
|
+
*/
|
|
207
|
+
readonly featureEnforcementActive: boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Whether anything can enforce `@EnforceQuota`.
|
|
210
|
+
*
|
|
211
|
+
* Narrower than the field above, and the two were one field until an app
|
|
212
|
+
* on the V3 path with no plan resolver booted with every quota unenforced:
|
|
213
|
+
* `EnforceQuotaInterceptor` comes from `composeEnforcementRuntime`, which
|
|
214
|
+
* registers nothing unless a plan resolver exists. A flag named for
|
|
215
|
+
* "entitlement" answered a question about features and was read as an
|
|
216
|
+
* answer about quotas.
|
|
217
|
+
*/
|
|
218
|
+
readonly quotaEnforcementActive: boolean;
|
|
219
|
+
/** Whether the platform bound its own global feature guard. */
|
|
220
|
+
readonly globalGuardBound: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Whether `globalFeatureGuard: false` is what unbound it.
|
|
223
|
+
*
|
|
224
|
+
* Distinct from `globalGuardBound` because the two have different causes
|
|
225
|
+
* and the message has to say the true one. On the V3 entitlement path the
|
|
226
|
+
* platform binds no global guard either — it never registers the static
|
|
227
|
+
* stack — and naming an option the application did not set sends the reader
|
|
228
|
+
* to look for a line that is not in their file.
|
|
229
|
+
*/
|
|
230
|
+
readonly globalGuardOptedOut: boolean;
|
|
231
|
+
}
|
|
232
|
+
declare const ENFORCEMENT_CHAIN_STATE_TOKEN: unique symbol;
|
|
233
|
+
declare class EnforcementChainCheck implements OnApplicationBootstrap {
|
|
52
234
|
private readonly discoveryService;
|
|
53
235
|
private readonly metadataScanner;
|
|
54
|
-
private readonly
|
|
55
|
-
constructor(discoveryService: DiscoveryService, metadataScanner: MetadataScanner);
|
|
236
|
+
private readonly state;
|
|
237
|
+
constructor(discoveryService: DiscoveryService, metadataScanner: MetadataScanner, state?: EnforcementChainState);
|
|
56
238
|
onApplicationBootstrap(): void;
|
|
57
239
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
240
|
+
* Every route carrying an enforcement annotation, with whether a
|
|
241
|
+
* recognisable feature guard covers it.
|
|
60
242
|
*
|
|
61
243
|
* Deliberately conservative in one direction only: an unrecognised wrapper
|
|
62
244
|
* is reported (and the message says so) rather than assumed safe, because
|
|
63
245
|
* the named route is cheap to check. The reverse — staying silent about a
|
|
64
246
|
* route with no guard at all — is the failure this exists to prevent.
|
|
65
247
|
*/
|
|
66
|
-
private
|
|
248
|
+
private findAnnotatedRoutes;
|
|
67
249
|
}
|
|
68
250
|
|
|
69
251
|
interface TenantNavItem {
|
|
@@ -119,4 +301,4 @@ declare class TenantManifestService {
|
|
|
119
301
|
getManifest(tenantId: string): Promise<TenantManifest>;
|
|
120
302
|
}
|
|
121
303
|
|
|
122
|
-
export {
|
|
304
|
+
export { type Composer, type CompositionContext, ENFORCEMENT_CHAIN_STATE_TOKEN, EnforcementChainCheck, type EnforcementChainState, FEATURE_COMPOSERS, MOUNTED_BUT_NOT_EXPORTED, PLATFORM_RULES, PlanResolverPort, type PlatformConfiguration, type PlatformRule, type PlatformViolation, QuotaProvidersUsageSnapshot, SaaSiCatConfigurationError, SaasPlatformAdapters, SaasPlatformModuleOptions, StaticEntitlementService, SubscriptionPlanResolver, type TenantManifest, TenantManifestService, type TenantNavItem, assertConfiguration, composeFeatures, composeModuleExports, docsUrlFor, findViolations, headingSlug };
|
package/dist/platform/index.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineSaaSiCat
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-OYNHOY45.js";
|
|
4
4
|
import {
|
|
5
|
+
ENFORCEMENT_CHAIN_STATE_TOKEN,
|
|
5
6
|
EnforceQuotaInterceptor,
|
|
6
|
-
|
|
7
|
+
EnforcementChainCheck,
|
|
8
|
+
FEATURE_COMPOSERS,
|
|
9
|
+
MOUNTED_BUT_NOT_EXPORTED,
|
|
7
10
|
PLAN_RESOLVER_PORT_TOKEN,
|
|
11
|
+
PLATFORM_RULES,
|
|
8
12
|
QUOTA_PROVIDERS_TOKEN,
|
|
9
13
|
QuotaProvidersUsageSnapshot,
|
|
10
14
|
STATIC_FEATURE_GUARD_CONFIG_TOKEN,
|
|
15
|
+
SaaSiCatConfigurationError,
|
|
11
16
|
SaasPlatformModule,
|
|
12
17
|
SetupModule,
|
|
13
18
|
SetupService,
|
|
@@ -16,11 +21,32 @@ import {
|
|
|
16
21
|
StaticPlanResolver,
|
|
17
22
|
SubscriptionPlanResolver,
|
|
18
23
|
TenantManifestService,
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
assertConfiguration,
|
|
25
|
+
buildTenantManifestController,
|
|
26
|
+
composeFeatures,
|
|
27
|
+
composeModuleExports,
|
|
28
|
+
docsUrlFor,
|
|
29
|
+
findViolations,
|
|
30
|
+
headingSlug
|
|
31
|
+
} from "../chunk-EHKMPP6J.js";
|
|
21
32
|
import {
|
|
22
33
|
PromoCodeRateLimitGuard
|
|
23
34
|
} from "../chunk-B6IWLV7R.js";
|
|
35
|
+
import {
|
|
36
|
+
SubscriptionContractModule
|
|
37
|
+
} from "../chunk-3E6ONOMG.js";
|
|
38
|
+
import {
|
|
39
|
+
AdminBypassRlsInterceptor,
|
|
40
|
+
AdminManifestModule,
|
|
41
|
+
AdminManifestService,
|
|
42
|
+
AdminModule,
|
|
43
|
+
AdminResourcesService,
|
|
44
|
+
AdminStatsModule,
|
|
45
|
+
AdminStatsService,
|
|
46
|
+
MfaGuard,
|
|
47
|
+
MfaService,
|
|
48
|
+
SuperAdminGuard
|
|
49
|
+
} from "../chunk-SN5UOC43.js";
|
|
24
50
|
import {
|
|
25
51
|
ComposedTenantAuthGuard,
|
|
26
52
|
PendingPlanMaterializationService,
|
|
@@ -29,14 +55,13 @@ import {
|
|
|
29
55
|
SubscriptionBundlesService,
|
|
30
56
|
TenantAdminGuard,
|
|
31
57
|
TenantBillingController
|
|
32
|
-
} from "../chunk-
|
|
58
|
+
} from "../chunk-UHD6FJBQ.js";
|
|
33
59
|
import {
|
|
34
60
|
PromoCodesService
|
|
35
61
|
} from "../chunk-37HEKVDH.js";
|
|
36
62
|
import {
|
|
37
|
-
SubscriptionContractModule,
|
|
38
63
|
SubscriptionContractService
|
|
39
|
-
} from "../chunk-
|
|
64
|
+
} from "../chunk-CJFAOD7K.js";
|
|
40
65
|
import {
|
|
41
66
|
BundlesService,
|
|
42
67
|
CatalogEntriesService,
|
|
@@ -46,47 +71,36 @@ import {
|
|
|
46
71
|
PlansService,
|
|
47
72
|
PromotionsService,
|
|
48
73
|
PublicMarketingCatalogService
|
|
49
|
-
} from "../chunk-
|
|
74
|
+
} from "../chunk-7X5MSAIL.js";
|
|
50
75
|
import "../chunk-WPUVJRIN.js";
|
|
76
|
+
import {
|
|
77
|
+
AdminAuditService
|
|
78
|
+
} from "../chunk-E56W4U2P.js";
|
|
51
79
|
import {
|
|
52
80
|
CheckoutOfferModule,
|
|
53
81
|
CheckoutOfferService
|
|
54
|
-
} from "../chunk-
|
|
82
|
+
} from "../chunk-XTVAFJ3P.js";
|
|
55
83
|
import "../chunk-BSK6YBLI.js";
|
|
84
|
+
import {
|
|
85
|
+
SAASICAT_PUBLIC_ROUTE_KEY,
|
|
86
|
+
SaaSiCatPublicRoute,
|
|
87
|
+
isSaaSiCatPublicRoute
|
|
88
|
+
} from "../chunk-YSC46BGM.js";
|
|
56
89
|
import "../chunk-6WL6VQ7Z.js";
|
|
57
90
|
import {
|
|
58
91
|
DiscoveryScanner
|
|
59
92
|
} from "../chunk-5ZXBXYXU.js";
|
|
93
|
+
import "../chunk-H4DOTO7S.js";
|
|
60
94
|
import {
|
|
61
95
|
EntitlementService
|
|
62
|
-
} from "../chunk-
|
|
96
|
+
} from "../chunk-F4B2NJUZ.js";
|
|
63
97
|
import "../chunk-DQKCK7DX.js";
|
|
64
98
|
import "../chunk-NYLON2VC.js";
|
|
99
|
+
import "../chunk-EBJJNTW6.js";
|
|
65
100
|
import "../chunk-WKVBNTYC.js";
|
|
66
101
|
import "../chunk-L4KTQ6CL.js";
|
|
67
|
-
import "../chunk-L4SUWH5B.js";
|
|
68
|
-
import {
|
|
69
|
-
AdminBypassRlsInterceptor,
|
|
70
|
-
AdminManifestModule,
|
|
71
|
-
AdminManifestService,
|
|
72
|
-
AdminModule,
|
|
73
|
-
AdminResourcesService,
|
|
74
|
-
AdminStatsModule,
|
|
75
|
-
AdminStatsService,
|
|
76
|
-
MfaGuard,
|
|
77
|
-
MfaService,
|
|
78
|
-
SuperAdminGuard
|
|
79
|
-
} from "../chunk-SN5UOC43.js";
|
|
80
|
-
import {
|
|
81
|
-
AdminAuditService
|
|
82
|
-
} from "../chunk-E56W4U2P.js";
|
|
83
|
-
import {
|
|
84
|
-
SAASICAT_PUBLIC_ROUTE_KEY,
|
|
85
|
-
SaaSiCatPublicRoute,
|
|
86
|
-
isSaaSiCatPublicRoute
|
|
87
|
-
} from "../chunk-YSC46BGM.js";
|
|
88
|
-
import "../chunk-EBJJNTW6.js";
|
|
89
102
|
import "../chunk-SABTXESR.js";
|
|
103
|
+
import "../chunk-L4SUWH5B.js";
|
|
90
104
|
import "../chunk-SHUYVCID.js";
|
|
91
105
|
export {
|
|
92
106
|
AdminAuditService,
|
|
@@ -103,14 +117,18 @@ export {
|
|
|
103
117
|
CheckoutOfferService,
|
|
104
118
|
ComposedTenantAuthGuard,
|
|
105
119
|
DiscoveryScanner,
|
|
120
|
+
ENFORCEMENT_CHAIN_STATE_TOKEN,
|
|
106
121
|
EnforceQuotaInterceptor,
|
|
122
|
+
EnforcementChainCheck,
|
|
107
123
|
EntitlementService,
|
|
108
|
-
|
|
124
|
+
FEATURE_COMPOSERS,
|
|
125
|
+
MOUNTED_BUT_NOT_EXPORTED,
|
|
109
126
|
MarketingProjectionsService,
|
|
110
127
|
MarketingSettingsService,
|
|
111
128
|
MfaGuard,
|
|
112
129
|
MfaService,
|
|
113
130
|
PLAN_RESOLVER_PORT_TOKEN,
|
|
131
|
+
PLATFORM_RULES,
|
|
114
132
|
PendingPlanMaterializationService,
|
|
115
133
|
PlanChangePreviewService,
|
|
116
134
|
PlanVersionsService,
|
|
@@ -123,6 +141,7 @@ export {
|
|
|
123
141
|
QuotaProvidersUsageSnapshot,
|
|
124
142
|
SAASICAT_PUBLIC_ROUTE_KEY,
|
|
125
143
|
STATIC_FEATURE_GUARD_CONFIG_TOKEN,
|
|
144
|
+
SaaSiCatConfigurationError,
|
|
126
145
|
SaasPlatformModule as SaaSiCatModule,
|
|
127
146
|
SaaSiCatPublicRoute,
|
|
128
147
|
SaasPlatformModule,
|
|
@@ -140,7 +159,13 @@ export {
|
|
|
140
159
|
TenantAdminGuard,
|
|
141
160
|
TenantBillingController,
|
|
142
161
|
TenantManifestService,
|
|
162
|
+
assertConfiguration,
|
|
143
163
|
buildTenantManifestController,
|
|
164
|
+
composeFeatures,
|
|
165
|
+
composeModuleExports,
|
|
144
166
|
defineSaaSiCat,
|
|
167
|
+
docsUrlFor,
|
|
168
|
+
findViolations,
|
|
169
|
+
headingSlug,
|
|
145
170
|
isSaaSiCatPublicRoute
|
|
146
171
|
};
|
package/dist/promo/index.js
CHANGED
|
@@ -27,13 +27,13 @@ import {
|
|
|
27
27
|
computeDiscountedGross,
|
|
28
28
|
computeRegularStartsAt
|
|
29
29
|
} from "../chunk-37HEKVDH.js";
|
|
30
|
+
import "../chunk-E56W4U2P.js";
|
|
31
|
+
import "../chunk-YSC46BGM.js";
|
|
30
32
|
import {
|
|
31
33
|
computeIncludedVat,
|
|
32
34
|
grossFromNet,
|
|
33
35
|
round2
|
|
34
36
|
} from "../chunk-DQKCK7DX.js";
|
|
35
|
-
import "../chunk-E56W4U2P.js";
|
|
36
|
-
import "../chunk-YSC46BGM.js";
|
|
37
37
|
import "../chunk-EBJJNTW6.js";
|
|
38
38
|
import "../chunk-SABTXESR.js";
|
|
39
39
|
import "../chunk-SHUYVCID.js";
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import "../chunk-2SLTRKXC.js";
|
|
2
|
+
import {
|
|
3
|
+
SubscriptionContractModule
|
|
4
|
+
} from "../chunk-3E6ONOMG.js";
|
|
1
5
|
import {
|
|
2
|
-
SubscriptionContractModule,
|
|
3
6
|
SubscriptionContractService,
|
|
4
7
|
contractLineItemToInvoiceLineItem,
|
|
5
8
|
sortContractLineItemsForInvoice,
|
|
6
9
|
subscriptionContractToInvoiceSnapshot
|
|
7
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-CJFAOD7K.js";
|
|
8
11
|
import "../chunk-BSK6YBLI.js";
|
|
9
12
|
import {
|
|
10
13
|
SUBSCRIPTION_CONTRACT_REPOSITORY_TOKEN
|
package/dist/{tenant-billing.controller-DHSUrT_N.d.cts → tenant-billing.controller-CAMMdfn1.d.cts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
|
-
import { b as AuthGuardList, m as SelfServiceBlockedPlans, w as TrialProjectionPort, h as PendingPlanQueryPort, f as ContractFreezePort, l as SelfServiceBlockedBundles, u as TenantIdResolver, B as UserIdResolver, z as UserEmailResolver, a as AuditContextResolver } from './
|
|
2
|
+
import { b as AuthGuardList, m as SelfServiceBlockedPlans, w as TrialProjectionPort, h as PendingPlanQueryPort, f as ContractFreezePort, l as SelfServiceBlockedBundles, u as TenantIdResolver, B as UserIdResolver, z as UserEmailResolver, a as AuditContextResolver } from './tenant-billing.module-BxJS6fX4.cjs';
|
|
3
3
|
import { PlanCatalog, SubscriptionUsagePort, UsageSnapshotPort, TenantSubscriptionWritePort, SubscriptionBundleRepository, BundleRepository, SubscriptionBundleView, SubscriptionBundleRecord, PlanRepository, CatalogEntryRepository, BundleVersionRow, SubscriptionUsageRecord, OnboardingSelectionResponse } from '@saasicat/types';
|
|
4
4
|
import { c as EntitlementService, a as EffectiveLimitsSnapshot, t as toEffectiveLimitsSnapshot } from './aggregation-mZ7WZROK.cjs';
|
|
5
5
|
import { g as PromoCodesService } from './service-D48clObR.cjs';
|
package/dist/{tenant-billing.controller-BSlpFqVA.d.ts → tenant-billing.controller-CYYK0CpT.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
|
-
import { b as AuthGuardList, m as SelfServiceBlockedPlans, w as TrialProjectionPort, h as PendingPlanQueryPort, f as ContractFreezePort, l as SelfServiceBlockedBundles, u as TenantIdResolver, B as UserIdResolver, z as UserEmailResolver, a as AuditContextResolver } from './
|
|
2
|
+
import { b as AuthGuardList, m as SelfServiceBlockedPlans, w as TrialProjectionPort, h as PendingPlanQueryPort, f as ContractFreezePort, l as SelfServiceBlockedBundles, u as TenantIdResolver, B as UserIdResolver, z as UserEmailResolver, a as AuditContextResolver } from './tenant-billing.module-B0stLoJn.js';
|
|
3
3
|
import { PlanCatalog, SubscriptionUsagePort, UsageSnapshotPort, TenantSubscriptionWritePort, SubscriptionBundleRepository, BundleRepository, SubscriptionBundleView, SubscriptionBundleRecord, PlanRepository, CatalogEntryRepository, BundleVersionRow, SubscriptionUsageRecord, OnboardingSelectionResponse } from '@saasicat/types';
|
|
4
4
|
import { c as EntitlementService, a as EffectiveLimitsSnapshot, t as toEffectiveLimitsSnapshot } from './aggregation-DP5zfKbU.js';
|
|
5
5
|
import { g as PromoCodesService } from './service-D48clObR.js';
|
package/dist/{subscription-bundles.module-BDbODWvA.d.ts → tenant-billing.module-B0stLoJn.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CanActivate, Type, DynamicModule, ForwardReference, Provider } from '@nestjs/common';
|
|
2
|
+
import { NewContractLineItemData, BillingCycle, SubscriptionUsagePort, SubscriptionBundleRepository, BundleRepository, UsageSnapshotPort, TenantSubscriptionWritePort, SubscriptionContractRepository } from '@saasicat/types';
|
|
2
3
|
import { P as ProviderSpec } from './di-CcNeq9v-.js';
|
|
3
|
-
import { NewContractLineItemData, BillingCycle, SubscriptionUsagePort, UsageSnapshotPort, TenantSubscriptionWritePort, SubscriptionContractRepository, SubscriptionBundleRepository, BundleRepository } from '@saasicat/types';
|
|
4
4
|
|
|
5
5
|
declare const FEATURE_GUARD_MARKER: unique symbol;
|
|
6
6
|
/** A guard class or instance carrying the platform's marker. */
|
|
@@ -157,6 +157,56 @@ interface ContractFreezeSourcePort {
|
|
|
157
157
|
loadBookedBundles(tenantId: string, cycle: 'monthly' | 'yearly', vatRate: number): Promise<ContractFreezeBundleSnapshot>;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
interface SubscriptionBundleControllerOptions {
|
|
161
|
+
extraGuards?: Array<Type<CanActivate>>;
|
|
162
|
+
/**
|
|
163
|
+
* Auth guard list analogous to `TenantBillingModule.forRoot.authGuards`.
|
|
164
|
+
* Without this list, `ComposedTenantAuthGuard` blocks fail-closed.
|
|
165
|
+
*/
|
|
166
|
+
authGuards?: ProviderSpec<ReadonlyArray<CanActivate>>;
|
|
167
|
+
/**
|
|
168
|
+
* Usage port for subscription lookup and current plan compatibility.
|
|
169
|
+
* If not set, an imported module must export the token.
|
|
170
|
+
*/
|
|
171
|
+
subscriptionUsagePort?: ProviderSpec<SubscriptionUsagePort>;
|
|
172
|
+
/** Optional tenant-ID resolver. Default: `req.user.tenantId`. */
|
|
173
|
+
tenantIdResolver?: TenantIdResolver;
|
|
174
|
+
}
|
|
175
|
+
interface SubscriptionBundleModuleOptions {
|
|
176
|
+
subscriptionBundleRepository: ProviderSpec<SubscriptionBundleRepository>;
|
|
177
|
+
/**
|
|
178
|
+
* Optional — if omitted, `BUNDLE_REPOSITORY_TOKEN` is expected via
|
|
179
|
+
* default inject from the DI scope (typically via an imported
|
|
180
|
+
* `CatalogModule`).
|
|
181
|
+
*/
|
|
182
|
+
bundleRepository?: ProviderSpec<BundleRepository>;
|
|
183
|
+
/** Default minimum term (months). Default = 12. */
|
|
184
|
+
defaultMinimumTermMonths?: number;
|
|
185
|
+
/**
|
|
186
|
+
* Self-service policy (#37): bundles that are only bookable via sales.
|
|
187
|
+
* Applies in `addBundleToSubscription` (422 BUNDLE_NOT_SELF_SERVICE)
|
|
188
|
+
* and in the preview (blocker).
|
|
189
|
+
*/
|
|
190
|
+
selfServiceBlockedBundles?: SelfServiceBlockedBundles;
|
|
191
|
+
/**
|
|
192
|
+
* If set: the tenant self-service controller is mounted at
|
|
193
|
+
* `/billing/subscription-bundles` (GET/POST/DELETE). The
|
|
194
|
+
* `extraGuards` are applied in addition to the platform default
|
|
195
|
+
* `ComposedTenantAuthGuard` (role/MFA guards).
|
|
196
|
+
*
|
|
197
|
+
* Prerequisite: the consumer has already registered `TenantBillingModule`
|
|
198
|
+
* — the controller needs `SUBSCRIPTION_USAGE_PORT_TOKEN`
|
|
199
|
+
* + `TENANT_ID_RESOLVER_TOKEN` in the same DI scope.
|
|
200
|
+
*/
|
|
201
|
+
controller?: SubscriptionBundleControllerOptions;
|
|
202
|
+
imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
203
|
+
extraProviders?: Provider[];
|
|
204
|
+
global?: boolean;
|
|
205
|
+
}
|
|
206
|
+
declare class SubscriptionBundleModule {
|
|
207
|
+
static forRoot(options: SubscriptionBundleModuleOptions): DynamicModule;
|
|
208
|
+
}
|
|
209
|
+
|
|
160
210
|
interface TenantBillingModuleOptions {
|
|
161
211
|
/**
|
|
162
212
|
* App guards in the order in which they should be executed
|
|
@@ -246,54 +296,4 @@ declare class TenantBillingModule {
|
|
|
246
296
|
static forRoot(options: TenantBillingModuleOptions): DynamicModule;
|
|
247
297
|
}
|
|
248
298
|
|
|
249
|
-
interface SubscriptionBundleControllerOptions {
|
|
250
|
-
extraGuards?: Array<Type<CanActivate>>;
|
|
251
|
-
/**
|
|
252
|
-
* Auth guard list analogous to `TenantBillingModule.forRoot.authGuards`.
|
|
253
|
-
* Without this list, `ComposedTenantAuthGuard` blocks fail-closed.
|
|
254
|
-
*/
|
|
255
|
-
authGuards?: ProviderSpec<ReadonlyArray<CanActivate>>;
|
|
256
|
-
/**
|
|
257
|
-
* Usage port for subscription lookup and current plan compatibility.
|
|
258
|
-
* If not set, an imported module must export the token.
|
|
259
|
-
*/
|
|
260
|
-
subscriptionUsagePort?: ProviderSpec<SubscriptionUsagePort>;
|
|
261
|
-
/** Optional tenant-ID resolver. Default: `req.user.tenantId`. */
|
|
262
|
-
tenantIdResolver?: TenantIdResolver;
|
|
263
|
-
}
|
|
264
|
-
interface SubscriptionBundleModuleOptions {
|
|
265
|
-
subscriptionBundleRepository: ProviderSpec<SubscriptionBundleRepository>;
|
|
266
|
-
/**
|
|
267
|
-
* Optional — if omitted, `BUNDLE_REPOSITORY_TOKEN` is expected via
|
|
268
|
-
* default inject from the DI scope (typically via an imported
|
|
269
|
-
* `CatalogModule`).
|
|
270
|
-
*/
|
|
271
|
-
bundleRepository?: ProviderSpec<BundleRepository>;
|
|
272
|
-
/** Default minimum term (months). Default = 12. */
|
|
273
|
-
defaultMinimumTermMonths?: number;
|
|
274
|
-
/**
|
|
275
|
-
* Self-service policy (#37): bundles that are only bookable via sales.
|
|
276
|
-
* Applies in `addBundleToSubscription` (422 BUNDLE_NOT_SELF_SERVICE)
|
|
277
|
-
* and in the preview (blocker).
|
|
278
|
-
*/
|
|
279
|
-
selfServiceBlockedBundles?: SelfServiceBlockedBundles;
|
|
280
|
-
/**
|
|
281
|
-
* If set: the tenant self-service controller is mounted at
|
|
282
|
-
* `/billing/subscription-bundles` (GET/POST/DELETE). The
|
|
283
|
-
* `extraGuards` are applied in addition to the platform default
|
|
284
|
-
* `ComposedTenantAuthGuard` (role/MFA guards).
|
|
285
|
-
*
|
|
286
|
-
* Prerequisite: the consumer has already registered `TenantBillingModule`
|
|
287
|
-
* — the controller needs `SUBSCRIPTION_USAGE_PORT_TOKEN`
|
|
288
|
-
* + `TENANT_ID_RESOLVER_TOKEN` in the same DI scope.
|
|
289
|
-
*/
|
|
290
|
-
controller?: SubscriptionBundleControllerOptions;
|
|
291
|
-
imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
292
|
-
extraProviders?: Provider[];
|
|
293
|
-
global?: boolean;
|
|
294
|
-
}
|
|
295
|
-
declare class SubscriptionBundleModule {
|
|
296
|
-
static forRoot(options: SubscriptionBundleModuleOptions): DynamicModule;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
299
|
export { AUDIT_CONTEXT_RESOLVER_TOKEN as A, type UserIdResolver as B, CONTRACT_FREEZE_PORT_TOKEN as C, type DuePendingPlanChange as D, isPlatformFeatureGuard as E, FEATURE_GUARD_MARKER as F, type MarkedFeatureGuard as M, PENDING_PLAN_QUERY_PORT_TOKEN as P, SELF_SERVICE_BLOCKED_BUNDLES_TOKEN as S, TENANT_AUTH_GUARDS_TOKEN as T, USAGE_SNAPSHOT_PORT_TOKEN as U, type AuditContextResolver as a, type AuthGuardList as b, CONTRACT_FREEZE_PROJECT_KEY_TOKEN as c, CONTRACT_FREEZE_SOURCE_PORT_TOKEN as d, type ContractFreezeBundleSnapshot as e, type ContractFreezePort as f, type ContractFreezeSourcePort as g, type PendingPlanQueryPort as h, SELF_SERVICE_BLOCKED_PLANS_TOKEN as i, SUBSCRIPTION_USAGE_PORT_TOKEN as j, SUBSCRIPTION_WRITE_PORT_TOKEN as k, type SelfServiceBlockedBundles as l, type SelfServiceBlockedPlans as m, type SubscriptionBundleControllerOptions as n, SubscriptionBundleModule as o, type SubscriptionBundleModuleOptions as p, TENANT_ID_RESOLVER_TOKEN as q, TRIAL_PROJECTION_PORT_TOKEN as r, TenantBillingModule as s, type TenantBillingModuleOptions as t, type TenantIdResolver as u, type TrialProjectionInput as v, type TrialProjectionPort as w, USER_EMAIL_RESOLVER_TOKEN as x, USER_ID_RESOLVER_TOKEN as y, type UserEmailResolver as z };
|