@saasicat/nest 0.5.0 → 0.6.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 +3 -8
- package/dist/admin/index.d.cts +5 -33
- package/dist/admin/index.d.ts +5 -33
- package/dist/admin/index.js +2 -2
- package/dist/{admin-manifest.config-DxTfZ8-L.d.cts → admin-manifest.config-DyrQNT7M.d.cts} +1 -1
- package/dist/{admin-manifest.config-DxTfZ8-L.d.ts → admin-manifest.config-DyrQNT7M.d.ts} +1 -1
- package/dist/admin-manifest.service-Cp6uwvmt.d.cts +33 -0
- package/dist/admin-manifest.service-UGgzR1x-.d.ts +33 -0
- package/dist/{aggregation-DGCyoN5d.d.ts → aggregation-BibpEO0t.d.ts} +6 -59
- package/dist/{aggregation-Bt1i_whS.d.cts → aggregation-CfI0bOsQ.d.cts} +6 -59
- package/dist/billing/index.cjs +18 -106
- package/dist/billing/index.d.cts +8 -30
- package/dist/billing/index.d.ts +8 -30
- package/dist/billing/index.js +7 -9
- package/dist/catalog/index.cjs +1160 -1985
- package/dist/catalog/index.d.cts +9 -124
- package/dist/catalog/index.d.ts +9 -124
- package/dist/catalog/index.js +3 -25
- package/dist/checkout-offer/index.js +2 -2
- package/dist/{chunk-2VNZYRDV.js → chunk-52UTQRD3.js} +1 -1
- package/dist/{chunk-V7HUZ6UQ.js → chunk-5DDCSGZC.js} +1106 -1919
- package/dist/{chunk-S2OZ5RIM.js → chunk-BTL66TR6.js} +18 -71
- package/dist/{chunk-XSGU2Y2O.js → chunk-CK54YKVK.js} +2 -33
- package/dist/{chunk-NWLOILP6.js → chunk-FSGBRFLX.js} +15 -7
- package/dist/{chunk-SYEVGPFC.js → chunk-K3OPNVFR.js} +1 -1
- package/dist/{chunk-XCZ3TTFK.js → chunk-N3WANKSA.js} +0 -2
- package/dist/{chunk-NFOSITWB.js → chunk-ND7OOKOG.js} +15 -48
- package/dist/{chunk-MV6LW5UB.js → chunk-R2QOSVAA.js} +2 -2
- package/dist/{chunk-YNEW3L63.js → chunk-SD3TT2BR.js} +1 -1
- package/dist/{chunk-P6MYZMXQ.js → chunk-U6HT27J7.js} +3 -8
- package/dist/{chunk-7MLGHWKO.js → chunk-WKVBNTYC.js} +2 -0
- package/dist/{chunk-ZL4LLE2Z.js → chunk-ZLUGQE5D.js} +1 -1
- package/dist/{enforce-quota.interceptor-3HmbeHTM.d.ts → enforce-quota.interceptor-Dj1Kusr5.d.ts} +9 -4
- package/dist/{enforce-quota.interceptor-HmdZFg41.d.cts → enforce-quota.interceptor-cv7r80VM.d.cts} +9 -4
- package/dist/entitlement/index.cjs +13 -46
- package/dist/entitlement/index.d.cts +4 -3
- package/dist/entitlement/index.d.ts +4 -3
- package/dist/entitlement/index.js +6 -8
- package/dist/index.cjs +1348 -2300
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +32 -60
- package/dist/platform/index.cjs +28 -54
- package/dist/platform/index.d.cts +4 -3
- package/dist/platform/index.d.ts +4 -3
- package/dist/platform/index.js +9 -6
- package/dist/promo/index.cjs +2 -2
- package/dist/promo/index.js +3 -3
- package/dist/registration/index.cjs +2 -34
- package/dist/registration/index.d.cts +3 -21
- package/dist/registration/index.d.ts +3 -21
- package/dist/registration/index.js +1 -3
- package/dist/testing/index.cjs +26 -255
- package/dist/testing/index.d.cts +5 -37
- package/dist/testing/index.d.ts +5 -37
- package/dist/testing/index.js +6 -206
- package/package.json +3 -3
package/dist/admin/index.cjs
CHANGED
|
@@ -79,7 +79,8 @@ var SuperAdminGuard = class {
|
|
|
79
79
|
canActivate(context) {
|
|
80
80
|
const request = context.switchToHttp().getRequest();
|
|
81
81
|
if (!request.user) throw new import_common.ForbiddenException("Nicht authentifiziert");
|
|
82
|
-
|
|
82
|
+
const role = request.user.platformRole ?? request.user.role;
|
|
83
|
+
if (role !== "SUPER_ADMIN") {
|
|
83
84
|
throw new import_common.ForbiddenException("Nur SUPER_ADMIN-Rolle erlaubt");
|
|
84
85
|
}
|
|
85
86
|
return true;
|
|
@@ -686,7 +687,7 @@ var PLATFORM_CORE_MANIFEST_CONTRIBUTION = {
|
|
|
686
687
|
// section, see `DEFAULT_NAV_SECTIONS` in the nav-builder). The order per
|
|
687
688
|
// section is deliberately curated:
|
|
688
689
|
// Overview: dashboard
|
|
689
|
-
// Product catalog: discovery → bundles →
|
|
690
|
+
// Product catalog: discovery → bundles → plans →
|
|
690
691
|
// planVersions → marketingCatalog → promoCodes
|
|
691
692
|
// (promoCodes is appended by the app contributions
|
|
692
693
|
// and therefore lands at the end of the section)
|
|
@@ -711,12 +712,6 @@ var PLATFORM_CORE_MANIFEST_CONTRIBUTION = {
|
|
|
711
712
|
enabled: true,
|
|
712
713
|
requiredCapability: "bundles.read"
|
|
713
714
|
},
|
|
714
|
-
// SPEC_V2 §11.1 M3 — BusinessType editor in SuperAdmin.
|
|
715
|
-
// Apps with domain verticals set `businessTypes.read = true`.
|
|
716
|
-
businessTypes: {
|
|
717
|
-
enabled: true,
|
|
718
|
-
requiredCapability: "businessTypes.read"
|
|
719
|
-
},
|
|
720
715
|
plans: {
|
|
721
716
|
enabled: true,
|
|
722
717
|
requiredCapability: "plans.read"
|
package/dist/admin/index.d.cts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { CanActivate, ExecutionContext, NestInterceptor, CallHandler, DynamicModule, FactoryProvider, Type, ForwardReference, Provider } from '@nestjs/common';
|
|
2
2
|
import { Reflector } from '@nestjs/core';
|
|
3
|
-
import { MfaPort, RlsBypassPort, AuditPort,
|
|
3
|
+
import { MfaPort, RlsBypassPort, AuditPort, PublicBootResponse, ManifestContribution, SubscriptionStatsPort, PromoCodeStatsPort, AuditStatsPort, SubscriptionStatsSnapshot, PromoCodeStatsSnapshot, AuditStatsSnapshot } from '@saasicat/types';
|
|
4
4
|
export { A as AdminAuditService } from '../admin-audit.service-9IqXMlZm.cjs';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
6
|
import { P as ProviderSpec } from '../di-CcNeq9v-.cjs';
|
|
7
|
-
import {
|
|
8
|
-
export {
|
|
7
|
+
import { A as AdminManifestConfig } from '../admin-manifest.config-DyrQNT7M.cjs';
|
|
8
|
+
export { a as ADMIN_MANIFEST_CONFIG } from '../admin-manifest.config-DyrQNT7M.cjs';
|
|
9
|
+
export { A as AdminManifestService, P as PLATFORM_CORE_CONTRIBUTION_TOKEN } from '../admin-manifest.service-Cp6uwvmt.cjs';
|
|
9
10
|
|
|
10
11
|
declare const MFA_PORT_TOKEN: unique symbol;
|
|
11
12
|
declare const AUDIT_PORT_TOKEN: unique symbol;
|
|
@@ -81,35 +82,6 @@ declare class AdminModule {
|
|
|
81
82
|
static forRoot(options: AdminModuleOptions): DynamicModule;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
/**
|
|
85
|
-
* DI token for the platform core contribution. When `AdminManifestModule` is
|
|
86
|
-
* configured with `registerPlatformCore: true` (default), the module provides
|
|
87
|
-
* `PLATFORM_CORE_MANIFEST_CONTRIBUTION` under this token. The service
|
|
88
|
-
* registers the contribution in the constructor — before all app `register()`
|
|
89
|
-
* calls from `onModuleInit`.
|
|
90
|
-
*/
|
|
91
|
-
declare const PLATFORM_CORE_CONTRIBUTION_TOKEN: unique symbol;
|
|
92
|
-
declare class AdminManifestService {
|
|
93
|
-
private readonly config;
|
|
94
|
-
private readonly logger;
|
|
95
|
-
private readonly contributions;
|
|
96
|
-
private cached;
|
|
97
|
-
constructor(config: AdminManifestConfig, platformCore?: ManifestContribution | null);
|
|
98
|
-
register(contribution: ManifestContribution): void;
|
|
99
|
-
getManifest(): AdminManifest;
|
|
100
|
-
rebuild(): AdminManifest;
|
|
101
|
-
private build;
|
|
102
|
-
private mergeContributions;
|
|
103
|
-
/**
|
|
104
|
-
* Deterministic SHA-256 hash over the manifest. Uses the insertion
|
|
105
|
-
* order of the object keys — so that semantically meaningful reorders (e.g.
|
|
106
|
-
* the order of the sidebar items in `navigation.standardPages`) change the
|
|
107
|
-
* hash and invalidate the browser ETag cache. The manifest's own
|
|
108
|
-
* `manifestHash` field is hidden before serialization.
|
|
109
|
-
*/
|
|
110
|
-
private computeHash;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
85
|
declare class AdminPublicBootController {
|
|
114
86
|
private readonly config;
|
|
115
87
|
constructor(config: AdminManifestConfig);
|
|
@@ -222,4 +194,4 @@ declare class AdminStatsModule {
|
|
|
222
194
|
static forRoot(options: AdminStatsModuleOptions): DynamicModule;
|
|
223
195
|
}
|
|
224
196
|
|
|
225
|
-
export { ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN, AUDIT_PORT_TOKEN, AUDIT_STATS_PORT_TOKEN, AdminBypassRlsInterceptor, AdminManifestConfig, AdminManifestModule, type AdminManifestModuleOptions,
|
|
197
|
+
export { ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN, AUDIT_PORT_TOKEN, AUDIT_STATS_PORT_TOKEN, AdminBypassRlsInterceptor, AdminManifestConfig, AdminManifestModule, type AdminManifestModuleOptions, AdminModule, type AdminModuleOptions, AdminPublicBootController, AdminStatsController, AdminStatsModule, type AdminStatsModuleOptions, AdminStatsService, type AdminStatsSnapshot, MFA_PORT_TOKEN, MfaGuard, MfaService, PLATFORM_CORE_MANIFEST_CONTRIBUTION, PROMO_CODE_STATS_PORT_TOKEN, REQUIRE_MFA_KEY, RLS_BYPASS_PORT_TOKEN, RequireMfa, SUBSCRIPTION_STATS_PORT_TOKEN, SuperAdminGuard, type TotpSetupResult, type VerifyTotpInput };
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { CanActivate, ExecutionContext, NestInterceptor, CallHandler, DynamicModule, FactoryProvider, Type, ForwardReference, Provider } from '@nestjs/common';
|
|
2
2
|
import { Reflector } from '@nestjs/core';
|
|
3
|
-
import { MfaPort, RlsBypassPort, AuditPort,
|
|
3
|
+
import { MfaPort, RlsBypassPort, AuditPort, PublicBootResponse, ManifestContribution, SubscriptionStatsPort, PromoCodeStatsPort, AuditStatsPort, SubscriptionStatsSnapshot, PromoCodeStatsSnapshot, AuditStatsSnapshot } from '@saasicat/types';
|
|
4
4
|
export { A as AdminAuditService } from '../admin-audit.service-9IqXMlZm.js';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
6
|
import { P as ProviderSpec } from '../di-CcNeq9v-.js';
|
|
7
|
-
import {
|
|
8
|
-
export {
|
|
7
|
+
import { A as AdminManifestConfig } from '../admin-manifest.config-DyrQNT7M.js';
|
|
8
|
+
export { a as ADMIN_MANIFEST_CONFIG } from '../admin-manifest.config-DyrQNT7M.js';
|
|
9
|
+
export { A as AdminManifestService, P as PLATFORM_CORE_CONTRIBUTION_TOKEN } from '../admin-manifest.service-UGgzR1x-.js';
|
|
9
10
|
|
|
10
11
|
declare const MFA_PORT_TOKEN: unique symbol;
|
|
11
12
|
declare const AUDIT_PORT_TOKEN: unique symbol;
|
|
@@ -81,35 +82,6 @@ declare class AdminModule {
|
|
|
81
82
|
static forRoot(options: AdminModuleOptions): DynamicModule;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
/**
|
|
85
|
-
* DI token for the platform core contribution. When `AdminManifestModule` is
|
|
86
|
-
* configured with `registerPlatformCore: true` (default), the module provides
|
|
87
|
-
* `PLATFORM_CORE_MANIFEST_CONTRIBUTION` under this token. The service
|
|
88
|
-
* registers the contribution in the constructor — before all app `register()`
|
|
89
|
-
* calls from `onModuleInit`.
|
|
90
|
-
*/
|
|
91
|
-
declare const PLATFORM_CORE_CONTRIBUTION_TOKEN: unique symbol;
|
|
92
|
-
declare class AdminManifestService {
|
|
93
|
-
private readonly config;
|
|
94
|
-
private readonly logger;
|
|
95
|
-
private readonly contributions;
|
|
96
|
-
private cached;
|
|
97
|
-
constructor(config: AdminManifestConfig, platformCore?: ManifestContribution | null);
|
|
98
|
-
register(contribution: ManifestContribution): void;
|
|
99
|
-
getManifest(): AdminManifest;
|
|
100
|
-
rebuild(): AdminManifest;
|
|
101
|
-
private build;
|
|
102
|
-
private mergeContributions;
|
|
103
|
-
/**
|
|
104
|
-
* Deterministic SHA-256 hash over the manifest. Uses the insertion
|
|
105
|
-
* order of the object keys — so that semantically meaningful reorders (e.g.
|
|
106
|
-
* the order of the sidebar items in `navigation.standardPages`) change the
|
|
107
|
-
* hash and invalidate the browser ETag cache. The manifest's own
|
|
108
|
-
* `manifestHash` field is hidden before serialization.
|
|
109
|
-
*/
|
|
110
|
-
private computeHash;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
85
|
declare class AdminPublicBootController {
|
|
114
86
|
private readonly config;
|
|
115
87
|
constructor(config: AdminManifestConfig);
|
|
@@ -222,4 +194,4 @@ declare class AdminStatsModule {
|
|
|
222
194
|
static forRoot(options: AdminStatsModuleOptions): DynamicModule;
|
|
223
195
|
}
|
|
224
196
|
|
|
225
|
-
export { ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN, AUDIT_PORT_TOKEN, AUDIT_STATS_PORT_TOKEN, AdminBypassRlsInterceptor, AdminManifestConfig, AdminManifestModule, type AdminManifestModuleOptions,
|
|
197
|
+
export { ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN, AUDIT_PORT_TOKEN, AUDIT_STATS_PORT_TOKEN, AdminBypassRlsInterceptor, AdminManifestConfig, AdminManifestModule, type AdminManifestModuleOptions, AdminModule, type AdminModuleOptions, AdminPublicBootController, AdminStatsController, AdminStatsModule, type AdminStatsModuleOptions, AdminStatsService, type AdminStatsSnapshot, MFA_PORT_TOKEN, MfaGuard, MfaService, PLATFORM_CORE_MANIFEST_CONTRIBUTION, PROMO_CODE_STATS_PORT_TOKEN, REQUIRE_MFA_KEY, RLS_BYPASS_PORT_TOKEN, RequireMfa, SUBSCRIPTION_STATS_PORT_TOKEN, SuperAdminGuard, type TotpSetupResult, type VerifyTotpInput };
|
package/dist/admin/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
AdminStatsService,
|
|
7
7
|
PROMO_CODE_STATS_PORT_TOKEN,
|
|
8
8
|
SUBSCRIPTION_STATS_PORT_TOKEN
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-SD3TT2BR.js";
|
|
10
10
|
import {
|
|
11
11
|
ADMIN_MANIFEST_CONFIG,
|
|
12
12
|
AdminBypassRlsInterceptor,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
REQUIRE_MFA_KEY,
|
|
22
22
|
RequireMfa,
|
|
23
23
|
SuperAdminGuard
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-U6HT27J7.js";
|
|
25
25
|
import {
|
|
26
26
|
AUDIT_PORT_TOKEN,
|
|
27
27
|
AdminAuditService,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ManifestContribution, AdminManifest } from '@saasicat/types';
|
|
2
|
+
import { A as AdminManifestConfig } from './admin-manifest.config-DyrQNT7M.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* DI token for the platform core contribution. When `AdminManifestModule` is
|
|
6
|
+
* configured with `registerPlatformCore: true` (default), the module provides
|
|
7
|
+
* `PLATFORM_CORE_MANIFEST_CONTRIBUTION` under this token. The service
|
|
8
|
+
* registers the contribution in the constructor — before all app `register()`
|
|
9
|
+
* calls from `onModuleInit`.
|
|
10
|
+
*/
|
|
11
|
+
declare const PLATFORM_CORE_CONTRIBUTION_TOKEN: unique symbol;
|
|
12
|
+
declare class AdminManifestService {
|
|
13
|
+
private readonly config;
|
|
14
|
+
private readonly logger;
|
|
15
|
+
private readonly contributions;
|
|
16
|
+
private cached;
|
|
17
|
+
constructor(config: AdminManifestConfig, platformCore?: ManifestContribution | null);
|
|
18
|
+
register(contribution: ManifestContribution): void;
|
|
19
|
+
getManifest(): AdminManifest;
|
|
20
|
+
rebuild(): AdminManifest;
|
|
21
|
+
private build;
|
|
22
|
+
private mergeContributions;
|
|
23
|
+
/**
|
|
24
|
+
* Deterministic SHA-256 hash over the manifest. Uses the insertion
|
|
25
|
+
* order of the object keys — so that semantically meaningful reorders (e.g.
|
|
26
|
+
* the order of the sidebar items in `navigation.standardPages`) change the
|
|
27
|
+
* hash and invalidate the browser ETag cache. The manifest's own
|
|
28
|
+
* `manifestHash` field is hidden before serialization.
|
|
29
|
+
*/
|
|
30
|
+
private computeHash;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { AdminManifestService as A, PLATFORM_CORE_CONTRIBUTION_TOKEN as P };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ManifestContribution, AdminManifest } from '@saasicat/types';
|
|
2
|
+
import { A as AdminManifestConfig } from './admin-manifest.config-DyrQNT7M.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* DI token for the platform core contribution. When `AdminManifestModule` is
|
|
6
|
+
* configured with `registerPlatformCore: true` (default), the module provides
|
|
7
|
+
* `PLATFORM_CORE_MANIFEST_CONTRIBUTION` under this token. The service
|
|
8
|
+
* registers the contribution in the constructor — before all app `register()`
|
|
9
|
+
* calls from `onModuleInit`.
|
|
10
|
+
*/
|
|
11
|
+
declare const PLATFORM_CORE_CONTRIBUTION_TOKEN: unique symbol;
|
|
12
|
+
declare class AdminManifestService {
|
|
13
|
+
private readonly config;
|
|
14
|
+
private readonly logger;
|
|
15
|
+
private readonly contributions;
|
|
16
|
+
private cached;
|
|
17
|
+
constructor(config: AdminManifestConfig, platformCore?: ManifestContribution | null);
|
|
18
|
+
register(contribution: ManifestContribution): void;
|
|
19
|
+
getManifest(): AdminManifest;
|
|
20
|
+
rebuild(): AdminManifest;
|
|
21
|
+
private build;
|
|
22
|
+
private mergeContributions;
|
|
23
|
+
/**
|
|
24
|
+
* Deterministic SHA-256 hash over the manifest. Uses the insertion
|
|
25
|
+
* order of the object keys — so that semantically meaningful reorders (e.g.
|
|
26
|
+
* the order of the sidebar items in `navigation.standardPages`) change the
|
|
27
|
+
* hash and invalidate the browser ETag cache. The manifest's own
|
|
28
|
+
* `manifestHash` field is hidden before serialization.
|
|
29
|
+
*/
|
|
30
|
+
private computeHash;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { AdminManifestService as A, PLATFORM_CORE_CONTRIBUTION_TOKEN as P };
|
|
@@ -14,33 +14,6 @@ interface PlanVersionSnapshot {
|
|
|
14
14
|
quotas: Record<QuotaKey, number>;
|
|
15
15
|
features: FeatureKey[];
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Snapshot of a published BundleVersion (for BusinessType aggregation).
|
|
19
|
-
* The consumer resolves the bundle composition via repository lookup before
|
|
20
|
-
* the `aggregateLimits()` call.
|
|
21
|
-
*/
|
|
22
|
-
interface BundleVersionSnapshot {
|
|
23
|
-
bundleKey: string;
|
|
24
|
-
quotas: Record<QuotaKey, number>;
|
|
25
|
-
features: FeatureKey[];
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Snapshot of the binding `BusinessTypeVersion` of a subscription
|
|
29
|
-
* (SPEC_V2 §11.1 M5). Contains the resolved bundle snapshots in sortOrder
|
|
30
|
-
* order, plus the quota overrides of the BusinessTypeVersion.
|
|
31
|
-
*
|
|
32
|
-
* Aggregation (see GESCHAEFTSTYP_SPEC §6.2):
|
|
33
|
-
* - Quotas: Σ(bundle quotas) per QuotaKey, then override via
|
|
34
|
-
* `quotaOverrides[k]` if set
|
|
35
|
-
* - Features: ⋃ of all bundle features (set union)
|
|
36
|
-
*/
|
|
37
|
-
interface BusinessTypeVersionSnapshot {
|
|
38
|
-
businessTypeKey: string;
|
|
39
|
-
/** Bundles in sortOrder order. */
|
|
40
|
-
bundles: BundleVersionSnapshot[];
|
|
41
|
-
/** Override per QuotaKey. Missing key → Σ(bundle quotas) is used. */
|
|
42
|
-
quotaOverrides: Partial<Record<QuotaKey, number>>;
|
|
43
|
-
}
|
|
44
17
|
/**
|
|
45
18
|
* Snapshot of an active SubscriptionBundle booking (P11.7.3 +
|
|
46
19
|
* SPEC_V2 §11.1 M6 Pack 2e). Resolved by the EntitlementService from the
|
|
@@ -78,14 +51,10 @@ interface CustomLimitsShape {
|
|
|
78
51
|
* `planVersion` are the result of that resolution; see
|
|
79
52
|
* `resolveEntitlementPlan` for a configurable default strategy.
|
|
80
53
|
*
|
|
81
|
-
* `businessTypeVersion` is optional (SPEC_V2 §11.1 M5). When set, the
|
|
82
|
-
* BusinessType composition is included in the aggregation in addition to
|
|
83
|
-
* plan + add-ons — see GESCHAEFTSTYP_SPEC §6.
|
|
84
54
|
*/
|
|
85
55
|
interface SubscriptionLimitsInput {
|
|
86
56
|
plan: PlanId;
|
|
87
57
|
planVersion: PlanVersionSnapshot;
|
|
88
|
-
businessTypeVersion?: BusinessTypeVersionSnapshot | null;
|
|
89
58
|
/**
|
|
90
59
|
* Active bundle bookings (P11.7.3). The aggregator filters by
|
|
91
60
|
* `canceledEffectiveAt > now` and sums quotas + collects features into
|
|
@@ -192,18 +161,6 @@ declare class EntitlementService {
|
|
|
192
161
|
private writeCache;
|
|
193
162
|
}
|
|
194
163
|
|
|
195
|
-
/**
|
|
196
|
-
* Aggregates the quotas of a BusinessTypeVersion: Σ(bundle quotas) per
|
|
197
|
-
* QuotaKey, then override via `quotaOverrides[k]` if set.
|
|
198
|
-
*
|
|
199
|
-
* `-1` (unlimited) is handled as follows:
|
|
200
|
-
* - In Σ summation: -1 dominates (if a bundle has -1 for a key,
|
|
201
|
-
* the Σ is likewise -1 for that key — regardless of the other values).
|
|
202
|
-
* - In overrides: if the override is -1, it replaces the sum entirely.
|
|
203
|
-
*
|
|
204
|
-
* Spec: GESCHAEFTSTYP_SPEC §6.2.
|
|
205
|
-
*/
|
|
206
|
-
declare function aggregateBusinessTypeQuotas(snapshot: BusinessTypeVersionSnapshot): Record<QuotaKey, number>;
|
|
207
164
|
/**
|
|
208
165
|
* Filters SubscriptionBundle bookings down to those active at the given
|
|
209
166
|
* point in time. Active = `canceledEffectiveAt === null` or
|
|
@@ -229,13 +186,6 @@ declare function collectSubscriptionBundleFeatures(bundles: readonly Subscriptio
|
|
|
229
186
|
* `quotaEffectsSnapshot` are the contractual truth.
|
|
230
187
|
*/
|
|
231
188
|
declare function aggregateContractLineItemEntitlements(lineItems: readonly Pick<ContractLineItemRecord, 'kind' | 'sourceKey' | 'featuresSnapshot' | 'quotaEffectsSnapshot'>[], fallbackPlan?: string): EffectiveLimits;
|
|
232
|
-
/**
|
|
233
|
-
* Collects all feature keys from all bundles of a BusinessTypeVersion
|
|
234
|
-
* (set union; duplicate features are included once).
|
|
235
|
-
*
|
|
236
|
-
* Spec: GESCHAEFTSTYP_SPEC §6.3.
|
|
237
|
-
*/
|
|
238
|
-
declare function collectBusinessTypeFeatures(snapshot: BusinessTypeVersionSnapshot): FeatureKey[];
|
|
239
189
|
/**
|
|
240
190
|
* Consistently filters out `plannedOnly` features — regardless of whether they
|
|
241
191
|
* come from the plan, a bundle or customLimits. `plannedOnly` means: the feature
|
|
@@ -249,16 +199,13 @@ declare function filterPlannedOnlyFeatures(features: ReadonlySet<FeatureKey>, ca
|
|
|
249
199
|
*/
|
|
250
200
|
declare function applyCustomLimits(base: EffectiveLimits, custom: CustomLimitsShape | null | undefined): EffectiveLimits;
|
|
251
201
|
/**
|
|
252
|
-
* Main aggregator — yields the effective limits from PlanVersion +
|
|
253
|
-
*
|
|
254
|
-
* CustomLimits override.
|
|
202
|
+
* Main aggregator — yields the effective limits from PlanVersion + active
|
|
203
|
+
* bundle bookings + catalog + optional CustomLimits override.
|
|
255
204
|
*
|
|
256
|
-
* Order
|
|
205
|
+
* Order:
|
|
257
206
|
* 1. Filter active bundle bookings (canceledEffectiveAt).
|
|
258
|
-
* 2. Sum plan quotas +
|
|
259
|
-
*
|
|
260
|
-
* 3. Collect plan features ∪ BusinessType features ∪ bundle features
|
|
261
|
-
* (set union, deduplicated).
|
|
207
|
+
* 2. Sum plan quotas + bundle quotas per `quotaKey`. -1 (unlimited) dominates.
|
|
208
|
+
* 3. Collect plan features ∪ bundle features (set union, deduplicated).
|
|
262
209
|
* 4. Apply CustomLimits (quotas override, features add).
|
|
263
210
|
* 5. Consistently hide plannedOnly features.
|
|
264
211
|
*/
|
|
@@ -278,4 +225,4 @@ declare function hasAnyFeature(limits: EffectiveLimits, features: readonly Featu
|
|
|
278
225
|
*/
|
|
279
226
|
declare function toEffectiveLimitsSnapshot(limits: EffectiveLimits): EffectiveLimitsSnapshot;
|
|
280
227
|
|
|
281
|
-
export { type
|
|
228
|
+
export { type CustomLimitsShape as C, type EffectiveLimits as E, type PlanVersionSnapshot as P, type SubscriptionBundleSnapshot as S, type EffectiveLimitsSnapshot as a, type EnforceLimitInput as b, EntitlementService as c, type SubscriptionLimitsInput as d, aggregateContractLineItemEntitlements as e, aggregateLimits as f, aggregateSubscriptionBundleQuotas as g, applyCustomLimits as h, collectSubscriptionBundleFeatures as i, filterActiveSubscriptionBundles as j, filterPlannedOnlyFeatures as k, hasAnyFeature as l, hasFeature as m, toEffectiveLimitsSnapshot as t };
|
|
@@ -14,33 +14,6 @@ interface PlanVersionSnapshot {
|
|
|
14
14
|
quotas: Record<QuotaKey, number>;
|
|
15
15
|
features: FeatureKey[];
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Snapshot of a published BundleVersion (for BusinessType aggregation).
|
|
19
|
-
* The consumer resolves the bundle composition via repository lookup before
|
|
20
|
-
* the `aggregateLimits()` call.
|
|
21
|
-
*/
|
|
22
|
-
interface BundleVersionSnapshot {
|
|
23
|
-
bundleKey: string;
|
|
24
|
-
quotas: Record<QuotaKey, number>;
|
|
25
|
-
features: FeatureKey[];
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Snapshot of the binding `BusinessTypeVersion` of a subscription
|
|
29
|
-
* (SPEC_V2 §11.1 M5). Contains the resolved bundle snapshots in sortOrder
|
|
30
|
-
* order, plus the quota overrides of the BusinessTypeVersion.
|
|
31
|
-
*
|
|
32
|
-
* Aggregation (see GESCHAEFTSTYP_SPEC §6.2):
|
|
33
|
-
* - Quotas: Σ(bundle quotas) per QuotaKey, then override via
|
|
34
|
-
* `quotaOverrides[k]` if set
|
|
35
|
-
* - Features: ⋃ of all bundle features (set union)
|
|
36
|
-
*/
|
|
37
|
-
interface BusinessTypeVersionSnapshot {
|
|
38
|
-
businessTypeKey: string;
|
|
39
|
-
/** Bundles in sortOrder order. */
|
|
40
|
-
bundles: BundleVersionSnapshot[];
|
|
41
|
-
/** Override per QuotaKey. Missing key → Σ(bundle quotas) is used. */
|
|
42
|
-
quotaOverrides: Partial<Record<QuotaKey, number>>;
|
|
43
|
-
}
|
|
44
17
|
/**
|
|
45
18
|
* Snapshot of an active SubscriptionBundle booking (P11.7.3 +
|
|
46
19
|
* SPEC_V2 §11.1 M6 Pack 2e). Resolved by the EntitlementService from the
|
|
@@ -78,14 +51,10 @@ interface CustomLimitsShape {
|
|
|
78
51
|
* `planVersion` are the result of that resolution; see
|
|
79
52
|
* `resolveEntitlementPlan` for a configurable default strategy.
|
|
80
53
|
*
|
|
81
|
-
* `businessTypeVersion` is optional (SPEC_V2 §11.1 M5). When set, the
|
|
82
|
-
* BusinessType composition is included in the aggregation in addition to
|
|
83
|
-
* plan + add-ons — see GESCHAEFTSTYP_SPEC §6.
|
|
84
54
|
*/
|
|
85
55
|
interface SubscriptionLimitsInput {
|
|
86
56
|
plan: PlanId;
|
|
87
57
|
planVersion: PlanVersionSnapshot;
|
|
88
|
-
businessTypeVersion?: BusinessTypeVersionSnapshot | null;
|
|
89
58
|
/**
|
|
90
59
|
* Active bundle bookings (P11.7.3). The aggregator filters by
|
|
91
60
|
* `canceledEffectiveAt > now` and sums quotas + collects features into
|
|
@@ -192,18 +161,6 @@ declare class EntitlementService {
|
|
|
192
161
|
private writeCache;
|
|
193
162
|
}
|
|
194
163
|
|
|
195
|
-
/**
|
|
196
|
-
* Aggregates the quotas of a BusinessTypeVersion: Σ(bundle quotas) per
|
|
197
|
-
* QuotaKey, then override via `quotaOverrides[k]` if set.
|
|
198
|
-
*
|
|
199
|
-
* `-1` (unlimited) is handled as follows:
|
|
200
|
-
* - In Σ summation: -1 dominates (if a bundle has -1 for a key,
|
|
201
|
-
* the Σ is likewise -1 for that key — regardless of the other values).
|
|
202
|
-
* - In overrides: if the override is -1, it replaces the sum entirely.
|
|
203
|
-
*
|
|
204
|
-
* Spec: GESCHAEFTSTYP_SPEC §6.2.
|
|
205
|
-
*/
|
|
206
|
-
declare function aggregateBusinessTypeQuotas(snapshot: BusinessTypeVersionSnapshot): Record<QuotaKey, number>;
|
|
207
164
|
/**
|
|
208
165
|
* Filters SubscriptionBundle bookings down to those active at the given
|
|
209
166
|
* point in time. Active = `canceledEffectiveAt === null` or
|
|
@@ -229,13 +186,6 @@ declare function collectSubscriptionBundleFeatures(bundles: readonly Subscriptio
|
|
|
229
186
|
* `quotaEffectsSnapshot` are the contractual truth.
|
|
230
187
|
*/
|
|
231
188
|
declare function aggregateContractLineItemEntitlements(lineItems: readonly Pick<ContractLineItemRecord, 'kind' | 'sourceKey' | 'featuresSnapshot' | 'quotaEffectsSnapshot'>[], fallbackPlan?: string): EffectiveLimits;
|
|
232
|
-
/**
|
|
233
|
-
* Collects all feature keys from all bundles of a BusinessTypeVersion
|
|
234
|
-
* (set union; duplicate features are included once).
|
|
235
|
-
*
|
|
236
|
-
* Spec: GESCHAEFTSTYP_SPEC §6.3.
|
|
237
|
-
*/
|
|
238
|
-
declare function collectBusinessTypeFeatures(snapshot: BusinessTypeVersionSnapshot): FeatureKey[];
|
|
239
189
|
/**
|
|
240
190
|
* Consistently filters out `plannedOnly` features — regardless of whether they
|
|
241
191
|
* come from the plan, a bundle or customLimits. `plannedOnly` means: the feature
|
|
@@ -249,16 +199,13 @@ declare function filterPlannedOnlyFeatures(features: ReadonlySet<FeatureKey>, ca
|
|
|
249
199
|
*/
|
|
250
200
|
declare function applyCustomLimits(base: EffectiveLimits, custom: CustomLimitsShape | null | undefined): EffectiveLimits;
|
|
251
201
|
/**
|
|
252
|
-
* Main aggregator — yields the effective limits from PlanVersion +
|
|
253
|
-
*
|
|
254
|
-
* CustomLimits override.
|
|
202
|
+
* Main aggregator — yields the effective limits from PlanVersion + active
|
|
203
|
+
* bundle bookings + catalog + optional CustomLimits override.
|
|
255
204
|
*
|
|
256
|
-
* Order
|
|
205
|
+
* Order:
|
|
257
206
|
* 1. Filter active bundle bookings (canceledEffectiveAt).
|
|
258
|
-
* 2. Sum plan quotas +
|
|
259
|
-
*
|
|
260
|
-
* 3. Collect plan features ∪ BusinessType features ∪ bundle features
|
|
261
|
-
* (set union, deduplicated).
|
|
207
|
+
* 2. Sum plan quotas + bundle quotas per `quotaKey`. -1 (unlimited) dominates.
|
|
208
|
+
* 3. Collect plan features ∪ bundle features (set union, deduplicated).
|
|
262
209
|
* 4. Apply CustomLimits (quotas override, features add).
|
|
263
210
|
* 5. Consistently hide plannedOnly features.
|
|
264
211
|
*/
|
|
@@ -278,4 +225,4 @@ declare function hasAnyFeature(limits: EffectiveLimits, features: readonly Featu
|
|
|
278
225
|
*/
|
|
279
226
|
declare function toEffectiveLimitsSnapshot(limits: EffectiveLimits): EffectiveLimitsSnapshot;
|
|
280
227
|
|
|
281
|
-
export { type
|
|
228
|
+
export { type CustomLimitsShape as C, type EffectiveLimits as E, type PlanVersionSnapshot as P, type SubscriptionBundleSnapshot as S, type EffectiveLimitsSnapshot as a, type EnforceLimitInput as b, EntitlementService as c, type SubscriptionLimitsInput as d, aggregateContractLineItemEntitlements as e, aggregateLimits as f, aggregateSubscriptionBundleQuotas as g, applyCustomLimits as h, collectSubscriptionBundleFeatures as i, filterActiveSubscriptionBundles as j, filterPlannedOnlyFeatures as k, hasAnyFeature as l, hasFeature as m, toEffectiveLimitsSnapshot as t };
|