@saasicat/nest 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/_entries.cjs +17678 -0
  2. package/dist/admin/index.cjs +4 -1533
  3. package/dist/admin/index.d.cts +10 -173
  4. package/dist/admin/index.d.ts +10 -173
  5. package/dist/admin/index.js +3 -2
  6. package/dist/{admin-resources.module-BybEjZs-.d.cts → admin-resources.module-BZN_yBFj.d.cts} +1 -1
  7. package/dist/{admin-resources.module-CUCLlUAi.d.ts → admin-resources.module-Cms8MY6h.d.ts} +1 -1
  8. package/dist/admin-stats.module-15ac5KY3.d.ts +201 -0
  9. package/dist/admin-stats.module-v4SVvWzj.d.cts +201 -0
  10. package/dist/billing/index.cjs +4 -5130
  11. package/dist/billing/index.d.cts +8 -437
  12. package/dist/billing/index.d.ts +8 -437
  13. package/dist/billing/index.js +4 -4
  14. package/dist/catalog/index.cjs +4 -5624
  15. package/dist/catalog/index.d.cts +5 -328
  16. package/dist/catalog/index.d.ts +5 -328
  17. package/dist/catalog/index.js +4 -4
  18. package/dist/checkout-offer/index.cjs +4 -807
  19. package/dist/checkout-offer/index.d.cts +5 -84
  20. package/dist/checkout-offer/index.d.ts +5 -84
  21. package/dist/checkout-offer/index.js +3 -2
  22. package/dist/checkout-offer.module-Y0hDOVrq.d.ts +85 -0
  23. package/dist/checkout-offer.module-ZYF5IsDY.d.cts +85 -0
  24. package/dist/{chunk-PBQRPDO2.js → chunk-33TP26MR.js} +2 -2
  25. package/dist/{chunk-CK54YKVK.js → chunk-75JABGZK.js} +16 -16
  26. package/dist/{chunk-HRU3CP57.js → chunk-BOADBIGB.js} +1 -1
  27. package/dist/chunk-DBZGV3HC.js +0 -0
  28. package/dist/{chunk-ZLUGQE5D.js → chunk-E7AJ42AB.js} +8 -8
  29. package/dist/{chunk-HXAWPPFW.js → chunk-F3VV6EXG.js} +9 -9
  30. package/dist/{chunk-3M6VLT5N.js → chunk-FVT7KTUI.js} +2 -2
  31. package/dist/{chunk-GW2I3JZD.js → chunk-GBDUH6DO.js} +1 -1
  32. package/dist/{chunk-K3OPNVFR.js → chunk-HBFU5AN3.js} +5 -9
  33. package/dist/{chunk-OFBDEO45.js → chunk-IRWZC3GC.js} +1 -1
  34. package/dist/chunk-L4KTQ6CL.js +20 -0
  35. package/dist/{chunk-WGVTXSYW.js → chunk-LZHLGUQI.js} +1 -1
  36. package/dist/{chunk-ZZMAHX22.js → chunk-PUXLPUVH.js} +15 -12
  37. package/dist/{chunk-7K5PT2LX.js → chunk-TXDH4FUA.js} +1 -1
  38. package/dist/chunk-UF53DWWR.js +0 -0
  39. package/dist/{chunk-AJ3EPELS.js → chunk-V34AA7C7.js} +1 -1
  40. package/dist/chunk-WJ6BMDL3.js +313 -0
  41. package/dist/{chunk-M6CZQYPY.js → chunk-Z3FWN3HJ.js} +2 -2
  42. package/dist/discovery/index.cjs +4 -588
  43. package/dist/discovery/index.js +3 -3
  44. package/dist/{enforce-quota.interceptor-SqrQVF91.d.cts → enforce-quota.interceptor-BhkX5nq2.d.cts} +35 -2
  45. package/dist/{enforce-quota.interceptor-B3CL5MSw.d.ts → enforce-quota.interceptor-CcqZc0Yu.d.ts} +35 -2
  46. package/dist/entitlement/index.cjs +4 -781
  47. package/dist/entitlement/index.js +2 -2
  48. package/dist/index.cjs +4 -15671
  49. package/dist/index.d.cts +21 -56
  50. package/dist/index.d.ts +21 -56
  51. package/dist/index.js +39 -334
  52. package/dist/{module-DeH_Jkcq.d.cts → module-CSN8j8Tp.d.cts} +1 -1
  53. package/dist/{module-B5m080F0.d.ts → module-DgYJur6f.d.ts} +1 -1
  54. package/dist/plan-versions.service-BB36Q1bg.d.ts +329 -0
  55. package/dist/plan-versions.service-CUR2Whyr.d.cts +329 -0
  56. package/dist/platform/index.cjs +4 -12925
  57. package/dist/platform/index.d.cts +17 -9
  58. package/dist/platform/index.d.ts +17 -9
  59. package/dist/platform/index.js +98 -14
  60. package/dist/promo/index.cjs +4 -1520
  61. package/dist/promo/index.d.cts +6 -21
  62. package/dist/promo/index.d.ts +6 -21
  63. package/dist/promo/index.js +2 -2
  64. package/dist/rate-limit.guard-dntqAlfZ.d.cts +19 -0
  65. package/dist/rate-limit.guard-dntqAlfZ.d.ts +19 -0
  66. package/dist/registration/index.cjs +4 -1655
  67. package/dist/registration/index.js +1 -1
  68. package/dist/{service-DlhMnYjW.d.ts → service-DX8KbGXl.d.cts} +1 -1
  69. package/dist/{service-DlhMnYjW.d.cts → service-DX8KbGXl.d.ts} +1 -1
  70. package/dist/setup.service-BPwJ7My_.d.cts +45 -0
  71. package/dist/setup.service-D2mrdDDB.d.ts +45 -0
  72. package/dist/subscription-bundle-preview.service-BkJXHAeP.d.cts +438 -0
  73. package/dist/subscription-bundle-preview.service-DBbrE_cw.d.ts +438 -0
  74. package/dist/subscription-contract/index.cjs +4 -471
  75. package/dist/subscription-contract/index.d.cts +5 -13
  76. package/dist/subscription-contract/index.d.ts +5 -13
  77. package/dist/subscription-contract.module-CG9fPKAr.d.cts +14 -0
  78. package/dist/subscription-contract.module-CVebZzHR.d.ts +14 -0
  79. package/dist/testing/index.cjs +4 -13888
  80. package/dist/testing/index.d.cts +5 -5
  81. package/dist/testing/index.d.ts +5 -5
  82. package/dist/testing/index.js +10 -10
  83. package/package.json +4 -4
  84. package/dist/admin-manifest.service-BMeSLRW4.d.ts +0 -33
  85. package/dist/admin-manifest.service-StAQe6QO.d.cts +0 -33
  86. package/dist/chunk-N3WANKSA.js +0 -20
@@ -1,145 +1,24 @@
1
- import { CanActivate, ExecutionContext, NestInterceptor, CallHandler, Type, DynamicModule, ForwardReference, FactoryProvider, Provider } from '@nestjs/common';
2
- import { Reflector } from '@nestjs/core';
3
- import { MfaPort, RlsBypassPort, AuditPort, PublicBootResponse, ManifestContribution, SubscriptionStatsPort, PromoCodeStatsPort, AuditStatsPort, SubscriptionStatsSnapshot, PromoCodeStatsSnapshot, AuditStatsSnapshot } from '@saasicat/types';
1
+ import { h as AdminStatsService, i as AdminStatsSnapshot } from '../admin-stats.module-v4SVvWzj.cjs';
2
+ export { A as AdminBypassRlsInterceptor, a as AdminManifestModule, b as AdminManifestModuleOptions, c as AdminManifestService, d as AdminModule, e as AdminModuleOptions, f as AdminStatsModule, g as AdminStatsModuleOptions, M as MfaGuard, j as MfaService, P as PLATFORM_CORE_CONTRIBUTION_TOKEN, R as REQUIRE_MFA_KEY, k as RequireMfa, S as SuperAdminGuard, T as TotpSetupResult, V as VerifyTotpInput } from '../admin-stats.module-v4SVvWzj.cjs';
4
3
  export { A as AdminAuditService } from '../admin-audit.service-9IqXMlZm.cjs';
5
- import { Observable } from 'rxjs';
6
- import { P as ProviderSpec } from '../di-CcNeq9v-.cjs';
7
- import { A as AdminManifestConfig } from '../admin-resources.module-BybEjZs-.cjs';
8
- export { a as ADMIN_MANIFEST_CONFIG, b as ADMIN_RESOURCES_PORT_TOKEN, c as AdminResourcesModule, d as AdminResourcesModuleOptions, e as AdminResourcesService, S as SuspendTenantDto } from '../admin-resources.module-BybEjZs-.cjs';
9
- export { A as AdminManifestService, P as PLATFORM_CORE_CONTRIBUTION_TOKEN } from '../admin-manifest.service-StAQe6QO.cjs';
4
+ import { b as AdminManifestConfig } from '../admin-resources.module-BZN_yBFj.cjs';
5
+ export { A as ADMIN_MANIFEST_CONFIG, a as ADMIN_RESOURCES_PORT_TOKEN, c as AdminResourcesModule, d as AdminResourcesModuleOptions, e as AdminResourcesService, S as SuspendTenantDto } from '../admin-resources.module-BZN_yBFj.cjs';
6
+ import { PublicBootResponse, ManifestContribution } from '@saasicat/types';
7
+ import '@nestjs/common';
8
+ import '@nestjs/core';
9
+ import 'rxjs';
10
+ import '../di-CcNeq9v-.cjs';
10
11
 
11
12
  declare const MFA_PORT_TOKEN: unique symbol;
12
13
  declare const AUDIT_PORT_TOKEN: unique symbol;
13
14
  declare const RLS_BYPASS_PORT_TOKEN: unique symbol;
14
15
 
15
- declare class SuperAdminGuard implements CanActivate {
16
- canActivate(context: ExecutionContext): boolean;
17
- }
18
-
19
- interface TotpSetupResult {
20
- /** Base32-encoded TOTP secret (persisted in the MfaPort). */
21
- secret: string;
22
- /** otpauth:// URI for the QR code generator (authenticator app). */
23
- otpauthUri: string;
24
- }
25
- interface VerifyTotpInput {
26
- userId: string;
27
- code: string;
28
- }
29
- declare class MfaService {
30
- private readonly mfa;
31
- private readonly logger;
32
- constructor(mfa: MfaPort);
33
- /**
34
- * Generates a new TOTP secret, persists it via `MfaPort.setSecret`
35
- * and returns the secret + the otpauth URI for the QR code.
36
- *
37
- * `issuer` and `label` shape the display in the authenticator (e.g.
38
- * "DemoApp:taci@example.com").
39
- */
40
- setup(userId: string, label: string, issuer: string): Promise<TotpSetupResult>;
41
- /**
42
- * Verifies the entered code against the stored secret,
43
- * clock-drift-tolerant by ±1 time step.
44
- */
45
- verify(input: VerifyTotpInput): Promise<boolean>;
46
- /**
47
- * Deletes a user's secret — used by `ahp admin mfa-reset`.
48
- */
49
- disable(userId: string): Promise<void>;
50
- /** Delegates to `MfaPort.isEnabled`. */
51
- isEnabled(userId: string): Promise<boolean>;
52
- }
53
-
54
- declare const REQUIRE_MFA_KEY = "saas-platform/require-mfa";
55
- /**
56
- * Marks an endpoint as MFA-required. The frontend sends the TOTP code
57
- * in the `X-Mfa-Code` header.
58
- */
59
- declare const RequireMfa: () => MethodDecorator & ClassDecorator;
60
- declare class MfaGuard implements CanActivate {
61
- private readonly reflector;
62
- private readonly mfaService;
63
- private readonly logger;
64
- constructor(reflector: Reflector, mfaService: MfaService);
65
- canActivate(context: ExecutionContext): Promise<boolean>;
66
- }
67
-
68
- declare class AdminBypassRlsInterceptor implements NestInterceptor {
69
- private readonly port;
70
- constructor(port: RlsBypassPort);
71
- intercept(_context: ExecutionContext, next: CallHandler): Observable<unknown>;
72
- }
73
-
74
- interface AdminModuleOptions {
75
- mfaPort: ProviderSpec<MfaPort>;
76
- auditPort: ProviderSpec<AuditPort>;
77
- rlsBypassPort: ProviderSpec<RlsBypassPort>;
78
- /** Modules required by adapter factory `inject` tokens. */
79
- imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
80
- /** Register the module globally — default `false`. */
81
- global?: boolean;
82
- }
83
- declare class AdminModule {
84
- static forRoot(options: AdminModuleOptions): DynamicModule;
85
- }
86
-
87
16
  declare class AdminPublicBootController {
88
17
  private readonly config;
89
18
  constructor(config: AdminManifestConfig);
90
19
  getBoot(): PublicBootResponse;
91
20
  }
92
21
 
93
- type ConfigSpec = AdminManifestConfig | Pick<FactoryProvider<AdminManifestConfig>, 'useFactory' | 'inject'>;
94
- interface AdminManifestModuleOptions {
95
- /** AdminManifestConfig as a value or via a factory (e.g. with a PLAN_CATALOG_TOKEN inject). */
96
- config: ConfigSpec;
97
- /**
98
- * Default `true`. Set to `false` when the consumer registers its own
99
- * manifest controller with app-specific guards entirely on its own.
100
- */
101
- includeManifestController?: boolean;
102
- /**
103
- * Class-level guards for GET /admin/manifest and POST /admin/manifest/reload,
104
- * when `includeManifestController === true`. REQUIRED — otherwise
105
- * `forRoot()` throws at boot.
106
- *
107
- * Pass `[]` explicitly when the endpoint should intentionally be auth-free
108
- * (e.g. CI smoke tests, public demo). This makes the choice visible in the
109
- * code rather than a silent default.
110
- */
111
- guards?: Array<Type<CanActivate>>;
112
- /**
113
- * Additional guards that apply ONLY to POST /admin/manifest/reload
114
- * (typically `MfaGuard`). Placed after `guards` in the chain. Must be made
115
- * available by the consumer as a provider.
116
- */
117
- reloadGuards?: Array<Type<CanActivate>>;
118
- /**
119
- * Default `true`. When active, the module automatically hooks
120
- * `PLATFORM_CORE_MANIFEST_CONTRIBUTION` (StandardPage spine, generic tenant
121
- * actions, platform audit action labels) into the `AdminManifestService` —
122
- * before all app `register()` calls from `onModuleInit`. Consumers without
123
- * a SuperAdmin need set this to `false`.
124
- */
125
- registerPlatformCore?: boolean;
126
- /**
127
- * Modules whose providers must be visible in the DI scope of this
128
- * DynamicModule — typically: the app module that registers the
129
- * factory-inject provider (e.g. `AdminManifestConfigFactory`). Without this
130
- * entry, NestJS 11.1.19 cannot resolve the `inject:[...]` of the config
131
- * factory (UnknownDependenciesException for ADMIN_MANIFEST_CONFIG).
132
- */
133
- imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
134
- /** Additional providers that are registered in the DynamicModule itself. */
135
- extraProviders?: Provider[];
136
- /** Register the module globally — default `false`. */
137
- global?: boolean;
138
- }
139
- declare class AdminManifestModule {
140
- static forRoot(options: AdminManifestModuleOptions): DynamicModule;
141
- }
142
-
143
22
  declare const PLATFORM_CORE_MANIFEST_CONTRIBUTION: ManifestContribution;
144
23
 
145
24
  declare const SUBSCRIPTION_STATS_PORT_TOKEN: unique symbol;
@@ -148,52 +27,10 @@ declare const AUDIT_STATS_PORT_TOKEN: unique symbol;
148
27
  /** Default audit window in days for the dashboard KPI. Override via forRoot. */
149
28
  declare const ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN: unique symbol;
150
29
 
151
- /**
152
- * Platform stats for the SuperAdmin dashboard page.
153
- *
154
- * Contains subscription/promo/audit aggregates that are equally meaningful
155
- * across all consuming apps. App-specific KPIs (e.g. DATEV or Bundles/Members)
156
- * remain extra endpoints in the respective app.
157
- */
158
- interface AdminStatsSnapshot {
159
- subscriptions: SubscriptionStatsSnapshot;
160
- promos: PromoCodeStatsSnapshot;
161
- audit: AuditStatsSnapshot;
162
- }
163
- declare class AdminStatsService {
164
- private readonly subscriptions;
165
- private readonly promos;
166
- private readonly audit;
167
- private readonly auditWindowDays;
168
- constructor(subscriptions: SubscriptionStatsPort, promos: PromoCodeStatsPort, audit: AuditStatsPort, auditWindowDays?: number);
169
- getSnapshot(): Promise<AdminStatsSnapshot>;
170
- }
171
-
172
30
  declare class AdminStatsController {
173
31
  private readonly stats;
174
32
  constructor(stats: AdminStatsService);
175
33
  getDashboardSnapshot(): Promise<AdminStatsSnapshot>;
176
34
  }
177
35
 
178
- interface AdminStatsModuleOptions {
179
- subscriptionStatsPort: ProviderSpec<SubscriptionStatsPort>;
180
- promoCodeStatsPort: ProviderSpec<PromoCodeStatsPort>;
181
- auditStatsPort: ProviderSpec<AuditStatsPort>;
182
- /** Audit window in days for the "last N days" KPI. Default 7. */
183
- auditWindowDays?: number;
184
- /**
185
- * Modules whose providers must be visible in the DI scope of this
186
- * DynamicModule — e.g. the app module that registers the adapter classes
187
- * referenced by the factory `inject` lists.
188
- */
189
- imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
190
- /** Additional providers registered in the DynamicModule itself. */
191
- extraProviders?: Provider[];
192
- /** Register the module globally — default `false`. */
193
- global?: boolean;
194
- }
195
- declare class AdminStatsModule {
196
- static forRoot(options: AdminStatsModuleOptions): DynamicModule;
197
- }
198
-
199
- 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 };
36
+ export { ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN, AUDIT_PORT_TOKEN, AUDIT_STATS_PORT_TOKEN, AdminManifestConfig, AdminPublicBootController, AdminStatsController, AdminStatsService, AdminStatsSnapshot, MFA_PORT_TOKEN, PLATFORM_CORE_MANIFEST_CONTRIBUTION, PROMO_CODE_STATS_PORT_TOKEN, RLS_BYPASS_PORT_TOKEN, SUBSCRIPTION_STATS_PORT_TOKEN };
@@ -1,145 +1,24 @@
1
- import { CanActivate, ExecutionContext, NestInterceptor, CallHandler, Type, DynamicModule, ForwardReference, FactoryProvider, Provider } from '@nestjs/common';
2
- import { Reflector } from '@nestjs/core';
3
- import { MfaPort, RlsBypassPort, AuditPort, PublicBootResponse, ManifestContribution, SubscriptionStatsPort, PromoCodeStatsPort, AuditStatsPort, SubscriptionStatsSnapshot, PromoCodeStatsSnapshot, AuditStatsSnapshot } from '@saasicat/types';
1
+ import { h as AdminStatsService, i as AdminStatsSnapshot } from '../admin-stats.module-15ac5KY3.js';
2
+ export { A as AdminBypassRlsInterceptor, a as AdminManifestModule, b as AdminManifestModuleOptions, c as AdminManifestService, d as AdminModule, e as AdminModuleOptions, f as AdminStatsModule, g as AdminStatsModuleOptions, M as MfaGuard, j as MfaService, P as PLATFORM_CORE_CONTRIBUTION_TOKEN, R as REQUIRE_MFA_KEY, k as RequireMfa, S as SuperAdminGuard, T as TotpSetupResult, V as VerifyTotpInput } from '../admin-stats.module-15ac5KY3.js';
4
3
  export { A as AdminAuditService } from '../admin-audit.service-9IqXMlZm.js';
5
- import { Observable } from 'rxjs';
6
- import { P as ProviderSpec } from '../di-CcNeq9v-.js';
7
- import { A as AdminManifestConfig } from '../admin-resources.module-CUCLlUAi.js';
8
- export { a as ADMIN_MANIFEST_CONFIG, b as ADMIN_RESOURCES_PORT_TOKEN, c as AdminResourcesModule, d as AdminResourcesModuleOptions, e as AdminResourcesService, S as SuspendTenantDto } from '../admin-resources.module-CUCLlUAi.js';
9
- export { A as AdminManifestService, P as PLATFORM_CORE_CONTRIBUTION_TOKEN } from '../admin-manifest.service-BMeSLRW4.js';
4
+ import { b as AdminManifestConfig } from '../admin-resources.module-Cms8MY6h.js';
5
+ export { A as ADMIN_MANIFEST_CONFIG, a as ADMIN_RESOURCES_PORT_TOKEN, c as AdminResourcesModule, d as AdminResourcesModuleOptions, e as AdminResourcesService, S as SuspendTenantDto } from '../admin-resources.module-Cms8MY6h.js';
6
+ import { PublicBootResponse, ManifestContribution } from '@saasicat/types';
7
+ import '@nestjs/common';
8
+ import '@nestjs/core';
9
+ import 'rxjs';
10
+ import '../di-CcNeq9v-.js';
10
11
 
11
12
  declare const MFA_PORT_TOKEN: unique symbol;
12
13
  declare const AUDIT_PORT_TOKEN: unique symbol;
13
14
  declare const RLS_BYPASS_PORT_TOKEN: unique symbol;
14
15
 
15
- declare class SuperAdminGuard implements CanActivate {
16
- canActivate(context: ExecutionContext): boolean;
17
- }
18
-
19
- interface TotpSetupResult {
20
- /** Base32-encoded TOTP secret (persisted in the MfaPort). */
21
- secret: string;
22
- /** otpauth:// URI for the QR code generator (authenticator app). */
23
- otpauthUri: string;
24
- }
25
- interface VerifyTotpInput {
26
- userId: string;
27
- code: string;
28
- }
29
- declare class MfaService {
30
- private readonly mfa;
31
- private readonly logger;
32
- constructor(mfa: MfaPort);
33
- /**
34
- * Generates a new TOTP secret, persists it via `MfaPort.setSecret`
35
- * and returns the secret + the otpauth URI for the QR code.
36
- *
37
- * `issuer` and `label` shape the display in the authenticator (e.g.
38
- * "DemoApp:taci@example.com").
39
- */
40
- setup(userId: string, label: string, issuer: string): Promise<TotpSetupResult>;
41
- /**
42
- * Verifies the entered code against the stored secret,
43
- * clock-drift-tolerant by ±1 time step.
44
- */
45
- verify(input: VerifyTotpInput): Promise<boolean>;
46
- /**
47
- * Deletes a user's secret — used by `ahp admin mfa-reset`.
48
- */
49
- disable(userId: string): Promise<void>;
50
- /** Delegates to `MfaPort.isEnabled`. */
51
- isEnabled(userId: string): Promise<boolean>;
52
- }
53
-
54
- declare const REQUIRE_MFA_KEY = "saas-platform/require-mfa";
55
- /**
56
- * Marks an endpoint as MFA-required. The frontend sends the TOTP code
57
- * in the `X-Mfa-Code` header.
58
- */
59
- declare const RequireMfa: () => MethodDecorator & ClassDecorator;
60
- declare class MfaGuard implements CanActivate {
61
- private readonly reflector;
62
- private readonly mfaService;
63
- private readonly logger;
64
- constructor(reflector: Reflector, mfaService: MfaService);
65
- canActivate(context: ExecutionContext): Promise<boolean>;
66
- }
67
-
68
- declare class AdminBypassRlsInterceptor implements NestInterceptor {
69
- private readonly port;
70
- constructor(port: RlsBypassPort);
71
- intercept(_context: ExecutionContext, next: CallHandler): Observable<unknown>;
72
- }
73
-
74
- interface AdminModuleOptions {
75
- mfaPort: ProviderSpec<MfaPort>;
76
- auditPort: ProviderSpec<AuditPort>;
77
- rlsBypassPort: ProviderSpec<RlsBypassPort>;
78
- /** Modules required by adapter factory `inject` tokens. */
79
- imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
80
- /** Register the module globally — default `false`. */
81
- global?: boolean;
82
- }
83
- declare class AdminModule {
84
- static forRoot(options: AdminModuleOptions): DynamicModule;
85
- }
86
-
87
16
  declare class AdminPublicBootController {
88
17
  private readonly config;
89
18
  constructor(config: AdminManifestConfig);
90
19
  getBoot(): PublicBootResponse;
91
20
  }
92
21
 
93
- type ConfigSpec = AdminManifestConfig | Pick<FactoryProvider<AdminManifestConfig>, 'useFactory' | 'inject'>;
94
- interface AdminManifestModuleOptions {
95
- /** AdminManifestConfig as a value or via a factory (e.g. with a PLAN_CATALOG_TOKEN inject). */
96
- config: ConfigSpec;
97
- /**
98
- * Default `true`. Set to `false` when the consumer registers its own
99
- * manifest controller with app-specific guards entirely on its own.
100
- */
101
- includeManifestController?: boolean;
102
- /**
103
- * Class-level guards for GET /admin/manifest and POST /admin/manifest/reload,
104
- * when `includeManifestController === true`. REQUIRED — otherwise
105
- * `forRoot()` throws at boot.
106
- *
107
- * Pass `[]` explicitly when the endpoint should intentionally be auth-free
108
- * (e.g. CI smoke tests, public demo). This makes the choice visible in the
109
- * code rather than a silent default.
110
- */
111
- guards?: Array<Type<CanActivate>>;
112
- /**
113
- * Additional guards that apply ONLY to POST /admin/manifest/reload
114
- * (typically `MfaGuard`). Placed after `guards` in the chain. Must be made
115
- * available by the consumer as a provider.
116
- */
117
- reloadGuards?: Array<Type<CanActivate>>;
118
- /**
119
- * Default `true`. When active, the module automatically hooks
120
- * `PLATFORM_CORE_MANIFEST_CONTRIBUTION` (StandardPage spine, generic tenant
121
- * actions, platform audit action labels) into the `AdminManifestService` —
122
- * before all app `register()` calls from `onModuleInit`. Consumers without
123
- * a SuperAdmin need set this to `false`.
124
- */
125
- registerPlatformCore?: boolean;
126
- /**
127
- * Modules whose providers must be visible in the DI scope of this
128
- * DynamicModule — typically: the app module that registers the
129
- * factory-inject provider (e.g. `AdminManifestConfigFactory`). Without this
130
- * entry, NestJS 11.1.19 cannot resolve the `inject:[...]` of the config
131
- * factory (UnknownDependenciesException for ADMIN_MANIFEST_CONFIG).
132
- */
133
- imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
134
- /** Additional providers that are registered in the DynamicModule itself. */
135
- extraProviders?: Provider[];
136
- /** Register the module globally — default `false`. */
137
- global?: boolean;
138
- }
139
- declare class AdminManifestModule {
140
- static forRoot(options: AdminManifestModuleOptions): DynamicModule;
141
- }
142
-
143
22
  declare const PLATFORM_CORE_MANIFEST_CONTRIBUTION: ManifestContribution;
144
23
 
145
24
  declare const SUBSCRIPTION_STATS_PORT_TOKEN: unique symbol;
@@ -148,52 +27,10 @@ declare const AUDIT_STATS_PORT_TOKEN: unique symbol;
148
27
  /** Default audit window in days for the dashboard KPI. Override via forRoot. */
149
28
  declare const ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN: unique symbol;
150
29
 
151
- /**
152
- * Platform stats for the SuperAdmin dashboard page.
153
- *
154
- * Contains subscription/promo/audit aggregates that are equally meaningful
155
- * across all consuming apps. App-specific KPIs (e.g. DATEV or Bundles/Members)
156
- * remain extra endpoints in the respective app.
157
- */
158
- interface AdminStatsSnapshot {
159
- subscriptions: SubscriptionStatsSnapshot;
160
- promos: PromoCodeStatsSnapshot;
161
- audit: AuditStatsSnapshot;
162
- }
163
- declare class AdminStatsService {
164
- private readonly subscriptions;
165
- private readonly promos;
166
- private readonly audit;
167
- private readonly auditWindowDays;
168
- constructor(subscriptions: SubscriptionStatsPort, promos: PromoCodeStatsPort, audit: AuditStatsPort, auditWindowDays?: number);
169
- getSnapshot(): Promise<AdminStatsSnapshot>;
170
- }
171
-
172
30
  declare class AdminStatsController {
173
31
  private readonly stats;
174
32
  constructor(stats: AdminStatsService);
175
33
  getDashboardSnapshot(): Promise<AdminStatsSnapshot>;
176
34
  }
177
35
 
178
- interface AdminStatsModuleOptions {
179
- subscriptionStatsPort: ProviderSpec<SubscriptionStatsPort>;
180
- promoCodeStatsPort: ProviderSpec<PromoCodeStatsPort>;
181
- auditStatsPort: ProviderSpec<AuditStatsPort>;
182
- /** Audit window in days for the "last N days" KPI. Default 7. */
183
- auditWindowDays?: number;
184
- /**
185
- * Modules whose providers must be visible in the DI scope of this
186
- * DynamicModule — e.g. the app module that registers the adapter classes
187
- * referenced by the factory `inject` lists.
188
- */
189
- imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
190
- /** Additional providers registered in the DynamicModule itself. */
191
- extraProviders?: Provider[];
192
- /** Register the module globally — default `false`. */
193
- global?: boolean;
194
- }
195
- declare class AdminStatsModule {
196
- static forRoot(options: AdminStatsModuleOptions): DynamicModule;
197
- }
198
-
199
- 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 };
36
+ export { ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN, AUDIT_PORT_TOKEN, AUDIT_STATS_PORT_TOKEN, AdminManifestConfig, AdminPublicBootController, AdminStatsController, AdminStatsService, AdminStatsSnapshot, MFA_PORT_TOKEN, PLATFORM_CORE_MANIFEST_CONTRIBUTION, PROMO_CODE_STATS_PORT_TOKEN, RLS_BYPASS_PORT_TOKEN, SUBSCRIPTION_STATS_PORT_TOKEN };
@@ -1,3 +1,4 @@
1
+ import "../chunk-UF53DWWR.js";
1
2
  import {
2
3
  ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN,
3
4
  AUDIT_STATS_PORT_TOKEN,
@@ -6,7 +7,7 @@ import {
6
7
  AdminStatsService,
7
8
  PROMO_CODE_STATS_PORT_TOKEN,
8
9
  SUBSCRIPTION_STATS_PORT_TOKEN
9
- } from "../chunk-WGVTXSYW.js";
10
+ } from "../chunk-LZHLGUQI.js";
10
11
  import {
11
12
  ADMIN_MANIFEST_CONFIG,
12
13
  ADMIN_RESOURCES_PORT_TOKEN,
@@ -25,7 +26,7 @@ import {
25
26
  RequireMfa,
26
27
  SuperAdminGuard,
27
28
  SuspendTenantDto
28
- } from "../chunk-3M6VLT5N.js";
29
+ } from "../chunk-FVT7KTUI.js";
29
30
  import {
30
31
  AUDIT_PORT_TOKEN,
31
32
  AdminAuditService,
@@ -37,4 +37,4 @@ declare class AdminResourcesModule {
37
37
  static forRoot(options: AdminResourcesModuleOptions): DynamicModule;
38
38
  }
39
39
 
40
- export { type AdminManifestConfig as A, SuspendTenantDto as S, ADMIN_MANIFEST_CONFIG as a, ADMIN_RESOURCES_PORT_TOKEN as b, AdminResourcesModule as c, type AdminResourcesModuleOptions as d, AdminResourcesService as e };
40
+ export { ADMIN_MANIFEST_CONFIG as A, SuspendTenantDto as S, ADMIN_RESOURCES_PORT_TOKEN as a, type AdminManifestConfig as b, AdminResourcesModule as c, type AdminResourcesModuleOptions as d, AdminResourcesService as e };
@@ -37,4 +37,4 @@ declare class AdminResourcesModule {
37
37
  static forRoot(options: AdminResourcesModuleOptions): DynamicModule;
38
38
  }
39
39
 
40
- export { type AdminManifestConfig as A, SuspendTenantDto as S, ADMIN_MANIFEST_CONFIG as a, ADMIN_RESOURCES_PORT_TOKEN as b, AdminResourcesModule as c, type AdminResourcesModuleOptions as d, AdminResourcesService as e };
40
+ export { ADMIN_MANIFEST_CONFIG as A, SuspendTenantDto as S, ADMIN_RESOURCES_PORT_TOKEN as a, type AdminManifestConfig as b, AdminResourcesModule as c, type AdminResourcesModuleOptions as d, AdminResourcesService as e };
@@ -0,0 +1,201 @@
1
+ import { CanActivate, ExecutionContext, NestInterceptor, CallHandler, Type, DynamicModule, ForwardReference, FactoryProvider, Provider } from '@nestjs/common';
2
+ import { Reflector } from '@nestjs/core';
3
+ import { MfaPort, RlsBypassPort, AuditPort, ManifestContribution, AdminManifest, SubscriptionStatsPort, PromoCodeStatsPort, AuditStatsPort, SubscriptionStatsSnapshot, PromoCodeStatsSnapshot, AuditStatsSnapshot } from '@saasicat/types';
4
+ import { Observable } from 'rxjs';
5
+ import { P as ProviderSpec } from './di-CcNeq9v-.js';
6
+ import { b as AdminManifestConfig } from './admin-resources.module-Cms8MY6h.js';
7
+
8
+ declare class SuperAdminGuard implements CanActivate {
9
+ canActivate(context: ExecutionContext): boolean;
10
+ }
11
+
12
+ interface TotpSetupResult {
13
+ /** Base32-encoded TOTP secret (persisted in the MfaPort). */
14
+ secret: string;
15
+ /** otpauth:// URI for the QR code generator (authenticator app). */
16
+ otpauthUri: string;
17
+ }
18
+ interface VerifyTotpInput {
19
+ userId: string;
20
+ code: string;
21
+ }
22
+ declare class MfaService {
23
+ private readonly mfa;
24
+ private readonly logger;
25
+ constructor(mfa: MfaPort);
26
+ /**
27
+ * Generates a new TOTP secret, persists it via `MfaPort.setSecret`
28
+ * and returns the secret + the otpauth URI for the QR code.
29
+ *
30
+ * `issuer` and `label` shape the display in the authenticator (e.g.
31
+ * "DemoApp:taci@example.com").
32
+ */
33
+ setup(userId: string, label: string, issuer: string): Promise<TotpSetupResult>;
34
+ /**
35
+ * Verifies the entered code against the stored secret,
36
+ * clock-drift-tolerant by ±1 time step.
37
+ */
38
+ verify(input: VerifyTotpInput): Promise<boolean>;
39
+ /**
40
+ * Deletes a user's secret — used by `ahp admin mfa-reset`.
41
+ */
42
+ disable(userId: string): Promise<void>;
43
+ /** Delegates to `MfaPort.isEnabled`. */
44
+ isEnabled(userId: string): Promise<boolean>;
45
+ }
46
+
47
+ declare const REQUIRE_MFA_KEY = "saas-platform/require-mfa";
48
+ /**
49
+ * Marks an endpoint as MFA-required. The frontend sends the TOTP code
50
+ * in the `X-Mfa-Code` header.
51
+ */
52
+ declare const RequireMfa: () => MethodDecorator & ClassDecorator;
53
+ declare class MfaGuard implements CanActivate {
54
+ private readonly reflector;
55
+ private readonly mfaService;
56
+ private readonly logger;
57
+ constructor(reflector: Reflector, mfaService: MfaService);
58
+ canActivate(context: ExecutionContext): Promise<boolean>;
59
+ }
60
+
61
+ declare class AdminBypassRlsInterceptor implements NestInterceptor {
62
+ private readonly port;
63
+ constructor(port: RlsBypassPort);
64
+ intercept(_context: ExecutionContext, next: CallHandler): Observable<unknown>;
65
+ }
66
+
67
+ interface AdminModuleOptions {
68
+ mfaPort: ProviderSpec<MfaPort>;
69
+ auditPort: ProviderSpec<AuditPort>;
70
+ rlsBypassPort: ProviderSpec<RlsBypassPort>;
71
+ /** Modules required by adapter factory `inject` tokens. */
72
+ imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
73
+ /** Register the module globally — default `false`. */
74
+ global?: boolean;
75
+ }
76
+ declare class AdminModule {
77
+ static forRoot(options: AdminModuleOptions): DynamicModule;
78
+ }
79
+
80
+ /**
81
+ * DI token for the platform core contribution. When `AdminManifestModule` is
82
+ * configured with `registerPlatformCore: true` (default), the module provides
83
+ * `PLATFORM_CORE_MANIFEST_CONTRIBUTION` under this token. The service
84
+ * registers the contribution in the constructor — before all app `register()`
85
+ * calls from `onModuleInit`.
86
+ */
87
+ declare const PLATFORM_CORE_CONTRIBUTION_TOKEN: unique symbol;
88
+ declare class AdminManifestService {
89
+ private readonly config;
90
+ private readonly logger;
91
+ private readonly contributions;
92
+ private cached;
93
+ constructor(config: AdminManifestConfig, platformCore?: ManifestContribution | null);
94
+ register(contribution: ManifestContribution): void;
95
+ getManifest(): AdminManifest;
96
+ rebuild(): AdminManifest;
97
+ private build;
98
+ private mergeContributions;
99
+ /**
100
+ * Deterministic SHA-256 hash over the manifest. Uses the insertion
101
+ * order of the object keys — so that semantically meaningful reorders (e.g.
102
+ * the order of the sidebar items in `navigation.standardPages`) change the
103
+ * hash and invalidate the browser ETag cache. The manifest's own
104
+ * `manifestHash` field is hidden before serialization.
105
+ */
106
+ private computeHash;
107
+ }
108
+
109
+ type ConfigSpec = AdminManifestConfig | Pick<FactoryProvider<AdminManifestConfig>, 'useFactory' | 'inject'>;
110
+ interface AdminManifestModuleOptions {
111
+ /** AdminManifestConfig as a value or via a factory (e.g. with a PLAN_CATALOG_TOKEN inject). */
112
+ config: ConfigSpec;
113
+ /**
114
+ * Default `true`. Set to `false` when the consumer registers its own
115
+ * manifest controller with app-specific guards entirely on its own.
116
+ */
117
+ includeManifestController?: boolean;
118
+ /**
119
+ * Class-level guards for GET /admin/manifest and POST /admin/manifest/reload,
120
+ * when `includeManifestController === true`. REQUIRED — otherwise
121
+ * `forRoot()` throws at boot.
122
+ *
123
+ * Pass `[]` explicitly when the endpoint should intentionally be auth-free
124
+ * (e.g. CI smoke tests, public demo). This makes the choice visible in the
125
+ * code rather than a silent default.
126
+ */
127
+ guards?: Array<Type<CanActivate>>;
128
+ /**
129
+ * Additional guards that apply ONLY to POST /admin/manifest/reload
130
+ * (typically `MfaGuard`). Placed after `guards` in the chain. Must be made
131
+ * available by the consumer as a provider.
132
+ */
133
+ reloadGuards?: Array<Type<CanActivate>>;
134
+ /**
135
+ * Default `true`. When active, the module automatically hooks
136
+ * `PLATFORM_CORE_MANIFEST_CONTRIBUTION` (StandardPage spine, generic tenant
137
+ * actions, platform audit action labels) into the `AdminManifestService` —
138
+ * before all app `register()` calls from `onModuleInit`. Consumers without
139
+ * a SuperAdmin need set this to `false`.
140
+ */
141
+ registerPlatformCore?: boolean;
142
+ /**
143
+ * Modules whose providers must be visible in the DI scope of this
144
+ * DynamicModule — typically: the app module that registers the
145
+ * factory-inject provider (e.g. `AdminManifestConfigFactory`). Without this
146
+ * entry, NestJS 11.1.19 cannot resolve the `inject:[...]` of the config
147
+ * factory (UnknownDependenciesException for ADMIN_MANIFEST_CONFIG).
148
+ */
149
+ imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
150
+ /** Additional providers that are registered in the DynamicModule itself. */
151
+ extraProviders?: Provider[];
152
+ /** Register the module globally — default `false`. */
153
+ global?: boolean;
154
+ }
155
+ declare class AdminManifestModule {
156
+ static forRoot(options: AdminManifestModuleOptions): DynamicModule;
157
+ }
158
+
159
+ /**
160
+ * Platform stats for the SuperAdmin dashboard page.
161
+ *
162
+ * Contains subscription/promo/audit aggregates that are equally meaningful
163
+ * across all consuming apps. App-specific KPIs (e.g. DATEV or Bundles/Members)
164
+ * remain extra endpoints in the respective app.
165
+ */
166
+ interface AdminStatsSnapshot {
167
+ subscriptions: SubscriptionStatsSnapshot;
168
+ promos: PromoCodeStatsSnapshot;
169
+ audit: AuditStatsSnapshot;
170
+ }
171
+ declare class AdminStatsService {
172
+ private readonly subscriptions;
173
+ private readonly promos;
174
+ private readonly audit;
175
+ private readonly auditWindowDays;
176
+ constructor(subscriptions: SubscriptionStatsPort, promos: PromoCodeStatsPort, audit: AuditStatsPort, auditWindowDays?: number);
177
+ getSnapshot(): Promise<AdminStatsSnapshot>;
178
+ }
179
+
180
+ interface AdminStatsModuleOptions {
181
+ subscriptionStatsPort: ProviderSpec<SubscriptionStatsPort>;
182
+ promoCodeStatsPort: ProviderSpec<PromoCodeStatsPort>;
183
+ auditStatsPort: ProviderSpec<AuditStatsPort>;
184
+ /** Audit window in days for the "last N days" KPI. Default 7. */
185
+ auditWindowDays?: number;
186
+ /**
187
+ * Modules whose providers must be visible in the DI scope of this
188
+ * DynamicModule — e.g. the app module that registers the adapter classes
189
+ * referenced by the factory `inject` lists.
190
+ */
191
+ imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
192
+ /** Additional providers registered in the DynamicModule itself. */
193
+ extraProviders?: Provider[];
194
+ /** Register the module globally — default `false`. */
195
+ global?: boolean;
196
+ }
197
+ declare class AdminStatsModule {
198
+ static forRoot(options: AdminStatsModuleOptions): DynamicModule;
199
+ }
200
+
201
+ export { AdminBypassRlsInterceptor as A, MfaGuard as M, PLATFORM_CORE_CONTRIBUTION_TOKEN as P, REQUIRE_MFA_KEY as R, SuperAdminGuard as S, type TotpSetupResult as T, type VerifyTotpInput as V, AdminManifestModule as a, type AdminManifestModuleOptions as b, AdminManifestService as c, AdminModule as d, type AdminModuleOptions as e, AdminStatsModule as f, type AdminStatsModuleOptions as g, AdminStatsService as h, type AdminStatsSnapshot as i, MfaService as j, RequireMfa as k };