@saasicat/nest 0.2.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 (96) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +53 -0
  3. package/dist/admin/index.cjs +1283 -0
  4. package/dist/admin/index.d.cts +225 -0
  5. package/dist/admin/index.d.ts +225 -0
  6. package/dist/admin/index.js +58 -0
  7. package/dist/admin-audit.service-9IqXMlZm.d.cts +30 -0
  8. package/dist/admin-audit.service-9IqXMlZm.d.ts +30 -0
  9. package/dist/admin-manifest.config-DyrQNT7M.d.cts +10 -0
  10. package/dist/admin-manifest.config-DyrQNT7M.d.ts +10 -0
  11. package/dist/aggregation-CJ3qQf92.d.cts +288 -0
  12. package/dist/aggregation-Dvz9e8X2.d.ts +288 -0
  13. package/dist/billing/index.cjs +5205 -0
  14. package/dist/billing/index.d.cts +1326 -0
  15. package/dist/billing/index.d.ts +1326 -0
  16. package/dist/billing/index.js +197 -0
  17. package/dist/catalog/index.cjs +6449 -0
  18. package/dist/catalog/index.d.cts +1073 -0
  19. package/dist/catalog/index.d.ts +1073 -0
  20. package/dist/catalog/index.js +158 -0
  21. package/dist/checkout-offer/index.cjs +807 -0
  22. package/dist/checkout-offer/index.d.cts +120 -0
  23. package/dist/checkout-offer/index.d.ts +120 -0
  24. package/dist/checkout-offer/index.js +20 -0
  25. package/dist/chunk-2FR6ZL7R.js +0 -0
  26. package/dist/chunk-2PNX2QL2.js +347 -0
  27. package/dist/chunk-2VNZYRDV.js +326 -0
  28. package/dist/chunk-7MLGHWKO.js +12 -0
  29. package/dist/chunk-ABB2CRAS.js +31 -0
  30. package/dist/chunk-AJ3EPELS.js +157 -0
  31. package/dist/chunk-E56W4U2P.js +90 -0
  32. package/dist/chunk-HRU3CP57.js +71 -0
  33. package/dist/chunk-L4SUWH5B.js +14 -0
  34. package/dist/chunk-M6CZQYPY.js +314 -0
  35. package/dist/chunk-MDIZUVIK.js +87 -0
  36. package/dist/chunk-MV6LW5UB.js +217 -0
  37. package/dist/chunk-NYLON2VC.js +6 -0
  38. package/dist/chunk-P6MYZMXQ.js +951 -0
  39. package/dist/chunk-Q53N43LQ.js +13 -0
  40. package/dist/chunk-QJVPRD3R.js +573 -0
  41. package/dist/chunk-RIGLQ4BV.js +3367 -0
  42. package/dist/chunk-SABTXESR.js +24 -0
  43. package/dist/chunk-SHUYVCID.js +6 -0
  44. package/dist/chunk-SYEVGPFC.js +686 -0
  45. package/dist/chunk-V7HUZ6UQ.js +5923 -0
  46. package/dist/chunk-WPUVJRIN.js +29 -0
  47. package/dist/chunk-XCZ3TTFK.js +22 -0
  48. package/dist/chunk-XSGU2Y2O.js +1611 -0
  49. package/dist/chunk-YNEW3L63.js +190 -0
  50. package/dist/chunk-YXGHPILG.js +614 -0
  51. package/dist/chunk-ZL4LLE2Z.js +465 -0
  52. package/dist/di-CcNeq9v-.d.cts +16 -0
  53. package/dist/di-CcNeq9v-.d.ts +16 -0
  54. package/dist/discovery/index.cjs +588 -0
  55. package/dist/discovery/index.d.cts +299 -0
  56. package/dist/discovery/index.d.ts +299 -0
  57. package/dist/discovery/index.js +49 -0
  58. package/dist/discovery.scanner-CUYLKlYT.d.cts +59 -0
  59. package/dist/discovery.scanner-CUYLKlYT.d.ts +59 -0
  60. package/dist/entitlement/index.cjs +805 -0
  61. package/dist/entitlement/index.d.cts +60 -0
  62. package/dist/entitlement/index.d.ts +60 -0
  63. package/dist/entitlement/index.js +57 -0
  64. package/dist/index.cjs +15918 -0
  65. package/dist/index.d.cts +85 -0
  66. package/dist/index.d.ts +85 -0
  67. package/dist/index.js +956 -0
  68. package/dist/plan-resolution-CFCoUkrE.d.cts +41 -0
  69. package/dist/plan-resolution-CFCoUkrE.d.ts +41 -0
  70. package/dist/platform/index.cjs +2772 -0
  71. package/dist/platform/index.d.cts +118 -0
  72. package/dist/platform/index.d.ts +118 -0
  73. package/dist/platform/index.js +37 -0
  74. package/dist/promo/index.cjs +995 -0
  75. package/dist/promo/index.d.cts +121 -0
  76. package/dist/promo/index.d.ts +121 -0
  77. package/dist/promo/index.js +58 -0
  78. package/dist/registration/index.cjs +1687 -0
  79. package/dist/registration/index.d.cts +444 -0
  80. package/dist/registration/index.d.ts +444 -0
  81. package/dist/registration/index.js +82 -0
  82. package/dist/saas-platform.module-CgZ2omgg.d.cts +180 -0
  83. package/dist/saas-platform.module-DT9TnCzk.d.ts +180 -0
  84. package/dist/service-DX8KbGXl.d.cts +109 -0
  85. package/dist/service-DX8KbGXl.d.ts +109 -0
  86. package/dist/subscription-contract/index.cjs +471 -0
  87. package/dist/subscription-contract/index.d.cts +17 -0
  88. package/dist/subscription-contract/index.d.ts +17 -0
  89. package/dist/subscription-contract/index.js +21 -0
  90. package/dist/subscription-contract.service--cm47ZJJ.d.cts +39 -0
  91. package/dist/subscription-contract.service--cm47ZJJ.d.ts +39 -0
  92. package/dist/testing/index.cjs +3942 -0
  93. package/dist/testing/index.d.cts +279 -0
  94. package/dist/testing/index.d.ts +279 -0
  95. package/dist/testing/index.js +1195 -0
  96. package/package.json +185 -0
@@ -0,0 +1,225 @@
1
+ import { CanActivate, ExecutionContext, NestInterceptor, CallHandler, DynamicModule, FactoryProvider, Type, ForwardReference, Provider } from '@nestjs/common';
2
+ import { Reflector } from '@nestjs/core';
3
+ import { MfaPort, RlsBypassPort, AuditPort, ManifestContribution, AdminManifest, PublicBootResponse, SubscriptionStatsPort, PromoCodeStatsPort, AuditStatsPort, SubscriptionStatsSnapshot, PromoCodeStatsSnapshot, AuditStatsSnapshot } from '@saasicat/types';
4
+ 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-manifest.config-DyrQNT7M.cjs';
8
+ export { a as ADMIN_MANIFEST_CONFIG } from '../admin-manifest.config-DyrQNT7M.cjs';
9
+
10
+ declare const MFA_PORT_TOKEN: unique symbol;
11
+ declare const AUDIT_PORT_TOKEN: unique symbol;
12
+ declare const RLS_BYPASS_PORT_TOKEN: unique symbol;
13
+
14
+ declare class SuperAdminGuard implements CanActivate {
15
+ canActivate(context: ExecutionContext): boolean;
16
+ }
17
+
18
+ interface TotpSetupResult {
19
+ /** Base32-encoded TOTP secret (persisted in the MfaPort). */
20
+ secret: string;
21
+ /** otpauth:// URI for the QR code generator (authenticator app). */
22
+ otpauthUri: string;
23
+ }
24
+ interface VerifyTotpInput {
25
+ userId: string;
26
+ code: string;
27
+ }
28
+ declare class MfaService {
29
+ private readonly mfa;
30
+ private readonly logger;
31
+ constructor(mfa: MfaPort);
32
+ /**
33
+ * Generates a new TOTP secret, persists it via `MfaPort.setSecret`
34
+ * and returns the secret + the otpauth URI for the QR code.
35
+ *
36
+ * `issuer` and `label` shape the display in the authenticator (e.g.
37
+ * "DemoApp:taci@example.com").
38
+ */
39
+ setup(userId: string, label: string, issuer: string): Promise<TotpSetupResult>;
40
+ /**
41
+ * Verifies the entered code against the stored secret,
42
+ * clock-drift-tolerant by ±1 time step.
43
+ */
44
+ verify(input: VerifyTotpInput): Promise<boolean>;
45
+ /**
46
+ * Deletes a user's secret — used by `ahp admin mfa-reset`.
47
+ */
48
+ disable(userId: string): Promise<void>;
49
+ /** Delegates to `MfaPort.isEnabled`. */
50
+ isEnabled(userId: string): Promise<boolean>;
51
+ }
52
+
53
+ declare const REQUIRE_MFA_KEY = "saas-platform/require-mfa";
54
+ /**
55
+ * Marks an endpoint as MFA-required. The frontend sends the TOTP code
56
+ * in the `X-Mfa-Code` header.
57
+ */
58
+ declare const RequireMfa: () => MethodDecorator & ClassDecorator;
59
+ declare class MfaGuard implements CanActivate {
60
+ private readonly reflector;
61
+ private readonly mfaService;
62
+ private readonly logger;
63
+ constructor(reflector: Reflector, mfaService: MfaService);
64
+ canActivate(context: ExecutionContext): Promise<boolean>;
65
+ }
66
+
67
+ declare class AdminBypassRlsInterceptor implements NestInterceptor {
68
+ private readonly port;
69
+ constructor(port: RlsBypassPort);
70
+ intercept(_context: ExecutionContext, next: CallHandler): Observable<unknown>;
71
+ }
72
+
73
+ interface AdminModuleOptions {
74
+ mfaPort: ProviderSpec<MfaPort>;
75
+ auditPort: ProviderSpec<AuditPort>;
76
+ rlsBypassPort: ProviderSpec<RlsBypassPort>;
77
+ /** Register the module globally — default `false`. */
78
+ global?: boolean;
79
+ }
80
+ declare class AdminModule {
81
+ static forRoot(options: AdminModuleOptions): DynamicModule;
82
+ }
83
+
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
+ declare class AdminPublicBootController {
114
+ private readonly config;
115
+ constructor(config: AdminManifestConfig);
116
+ getBoot(): PublicBootResponse;
117
+ }
118
+
119
+ type ConfigSpec = AdminManifestConfig | Pick<FactoryProvider<AdminManifestConfig>, 'useFactory' | 'inject'>;
120
+ interface AdminManifestModuleOptions {
121
+ /** AdminManifestConfig as a value or via a factory (e.g. with a PLAN_CATALOG_TOKEN inject). */
122
+ config: ConfigSpec;
123
+ /**
124
+ * Default `true`. Set to `false` when the consumer registers its own
125
+ * manifest controller with app-specific guards entirely on its own.
126
+ */
127
+ includeManifestController?: boolean;
128
+ /**
129
+ * Class-level guards for GET /admin/manifest and POST /admin/manifest/reload,
130
+ * when `includeManifestController === true`. REQUIRED — otherwise
131
+ * `forRoot()` throws at boot.
132
+ *
133
+ * Pass `[]` explicitly when the endpoint should intentionally be auth-free
134
+ * (e.g. CI smoke tests, public demo). This makes the choice visible in the
135
+ * code rather than a silent default.
136
+ */
137
+ guards?: Array<Type<CanActivate>>;
138
+ /**
139
+ * Additional guards that apply ONLY to POST /admin/manifest/reload
140
+ * (typically `MfaGuard`). Placed after `guards` in the chain. Must be made
141
+ * available by the consumer as a provider.
142
+ */
143
+ reloadGuards?: Array<Type<CanActivate>>;
144
+ /**
145
+ * Default `true`. When active, the module automatically hooks
146
+ * `PLATFORM_CORE_MANIFEST_CONTRIBUTION` (StandardPage spine, generic tenant
147
+ * actions, platform audit action labels) into the `AdminManifestService` —
148
+ * before all app `register()` calls from `onModuleInit`. Consumers without
149
+ * a SuperAdmin need set this to `false`.
150
+ */
151
+ registerPlatformCore?: boolean;
152
+ /**
153
+ * Modules whose providers must be visible in the DI scope of this
154
+ * DynamicModule — typically: the app module that registers the
155
+ * factory-inject provider (e.g. `AdminManifestConfigFactory`). Without this
156
+ * entry, NestJS 11.1.19 cannot resolve the `inject:[...]` of the config
157
+ * factory (UnknownDependenciesException for ADMIN_MANIFEST_CONFIG).
158
+ */
159
+ imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
160
+ /** Additional providers that are registered in the DynamicModule itself. */
161
+ extraProviders?: Provider[];
162
+ /** Register the module globally — default `false`. */
163
+ global?: boolean;
164
+ }
165
+ declare class AdminManifestModule {
166
+ static forRoot(options: AdminManifestModuleOptions): DynamicModule;
167
+ }
168
+
169
+ declare const PLATFORM_CORE_MANIFEST_CONTRIBUTION: ManifestContribution;
170
+
171
+ declare const SUBSCRIPTION_STATS_PORT_TOKEN: unique symbol;
172
+ declare const PROMO_CODE_STATS_PORT_TOKEN: unique symbol;
173
+ declare const AUDIT_STATS_PORT_TOKEN: unique symbol;
174
+ /** Default audit window in days for the dashboard KPI. Override via forRoot. */
175
+ declare const ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN: unique symbol;
176
+
177
+ /**
178
+ * Platform stats for the SuperAdmin dashboard page.
179
+ *
180
+ * Contains subscription/promo/audit aggregates that are equally meaningful
181
+ * across all consuming apps. App-specific KPIs (e.g. DATEV or Bundles/Members)
182
+ * remain extra endpoints in the respective app.
183
+ */
184
+ interface AdminStatsSnapshot {
185
+ subscriptions: SubscriptionStatsSnapshot;
186
+ promos: PromoCodeStatsSnapshot;
187
+ audit: AuditStatsSnapshot;
188
+ }
189
+ declare class AdminStatsService {
190
+ private readonly subscriptions;
191
+ private readonly promos;
192
+ private readonly audit;
193
+ private readonly auditWindowDays;
194
+ constructor(subscriptions: SubscriptionStatsPort, promos: PromoCodeStatsPort, audit: AuditStatsPort, auditWindowDays?: number);
195
+ getSnapshot(): Promise<AdminStatsSnapshot>;
196
+ }
197
+
198
+ declare class AdminStatsController {
199
+ private readonly stats;
200
+ constructor(stats: AdminStatsService);
201
+ getDashboardSnapshot(): Promise<AdminStatsSnapshot>;
202
+ }
203
+
204
+ interface AdminStatsModuleOptions {
205
+ subscriptionStatsPort: ProviderSpec<SubscriptionStatsPort>;
206
+ promoCodeStatsPort: ProviderSpec<PromoCodeStatsPort>;
207
+ auditStatsPort: ProviderSpec<AuditStatsPort>;
208
+ /** Audit window in days for the "last N days" KPI. Default 7. */
209
+ auditWindowDays?: number;
210
+ /**
211
+ * Modules whose providers must be visible in the DI scope of this
212
+ * DynamicModule — e.g. the app module that registers the adapter classes
213
+ * referenced by the factory `inject` lists.
214
+ */
215
+ imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
216
+ /** Additional providers registered in the DynamicModule itself. */
217
+ extraProviders?: Provider[];
218
+ /** Register the module globally — default `false`. */
219
+ global?: boolean;
220
+ }
221
+ declare class AdminStatsModule {
222
+ static forRoot(options: AdminStatsModuleOptions): DynamicModule;
223
+ }
224
+
225
+ export { ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN, AUDIT_PORT_TOKEN, AUDIT_STATS_PORT_TOKEN, AdminBypassRlsInterceptor, AdminManifestConfig, AdminManifestModule, type AdminManifestModuleOptions, AdminManifestService, AdminModule, type AdminModuleOptions, AdminPublicBootController, AdminStatsController, AdminStatsModule, type AdminStatsModuleOptions, AdminStatsService, type AdminStatsSnapshot, MFA_PORT_TOKEN, MfaGuard, MfaService, PLATFORM_CORE_CONTRIBUTION_TOKEN, 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 };
@@ -0,0 +1,225 @@
1
+ import { CanActivate, ExecutionContext, NestInterceptor, CallHandler, DynamicModule, FactoryProvider, Type, ForwardReference, Provider } from '@nestjs/common';
2
+ import { Reflector } from '@nestjs/core';
3
+ import { MfaPort, RlsBypassPort, AuditPort, ManifestContribution, AdminManifest, PublicBootResponse, SubscriptionStatsPort, PromoCodeStatsPort, AuditStatsPort, SubscriptionStatsSnapshot, PromoCodeStatsSnapshot, AuditStatsSnapshot } from '@saasicat/types';
4
+ 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-manifest.config-DyrQNT7M.js';
8
+ export { a as ADMIN_MANIFEST_CONFIG } from '../admin-manifest.config-DyrQNT7M.js';
9
+
10
+ declare const MFA_PORT_TOKEN: unique symbol;
11
+ declare const AUDIT_PORT_TOKEN: unique symbol;
12
+ declare const RLS_BYPASS_PORT_TOKEN: unique symbol;
13
+
14
+ declare class SuperAdminGuard implements CanActivate {
15
+ canActivate(context: ExecutionContext): boolean;
16
+ }
17
+
18
+ interface TotpSetupResult {
19
+ /** Base32-encoded TOTP secret (persisted in the MfaPort). */
20
+ secret: string;
21
+ /** otpauth:// URI for the QR code generator (authenticator app). */
22
+ otpauthUri: string;
23
+ }
24
+ interface VerifyTotpInput {
25
+ userId: string;
26
+ code: string;
27
+ }
28
+ declare class MfaService {
29
+ private readonly mfa;
30
+ private readonly logger;
31
+ constructor(mfa: MfaPort);
32
+ /**
33
+ * Generates a new TOTP secret, persists it via `MfaPort.setSecret`
34
+ * and returns the secret + the otpauth URI for the QR code.
35
+ *
36
+ * `issuer` and `label` shape the display in the authenticator (e.g.
37
+ * "DemoApp:taci@example.com").
38
+ */
39
+ setup(userId: string, label: string, issuer: string): Promise<TotpSetupResult>;
40
+ /**
41
+ * Verifies the entered code against the stored secret,
42
+ * clock-drift-tolerant by ±1 time step.
43
+ */
44
+ verify(input: VerifyTotpInput): Promise<boolean>;
45
+ /**
46
+ * Deletes a user's secret — used by `ahp admin mfa-reset`.
47
+ */
48
+ disable(userId: string): Promise<void>;
49
+ /** Delegates to `MfaPort.isEnabled`. */
50
+ isEnabled(userId: string): Promise<boolean>;
51
+ }
52
+
53
+ declare const REQUIRE_MFA_KEY = "saas-platform/require-mfa";
54
+ /**
55
+ * Marks an endpoint as MFA-required. The frontend sends the TOTP code
56
+ * in the `X-Mfa-Code` header.
57
+ */
58
+ declare const RequireMfa: () => MethodDecorator & ClassDecorator;
59
+ declare class MfaGuard implements CanActivate {
60
+ private readonly reflector;
61
+ private readonly mfaService;
62
+ private readonly logger;
63
+ constructor(reflector: Reflector, mfaService: MfaService);
64
+ canActivate(context: ExecutionContext): Promise<boolean>;
65
+ }
66
+
67
+ declare class AdminBypassRlsInterceptor implements NestInterceptor {
68
+ private readonly port;
69
+ constructor(port: RlsBypassPort);
70
+ intercept(_context: ExecutionContext, next: CallHandler): Observable<unknown>;
71
+ }
72
+
73
+ interface AdminModuleOptions {
74
+ mfaPort: ProviderSpec<MfaPort>;
75
+ auditPort: ProviderSpec<AuditPort>;
76
+ rlsBypassPort: ProviderSpec<RlsBypassPort>;
77
+ /** Register the module globally — default `false`. */
78
+ global?: boolean;
79
+ }
80
+ declare class AdminModule {
81
+ static forRoot(options: AdminModuleOptions): DynamicModule;
82
+ }
83
+
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
+ declare class AdminPublicBootController {
114
+ private readonly config;
115
+ constructor(config: AdminManifestConfig);
116
+ getBoot(): PublicBootResponse;
117
+ }
118
+
119
+ type ConfigSpec = AdminManifestConfig | Pick<FactoryProvider<AdminManifestConfig>, 'useFactory' | 'inject'>;
120
+ interface AdminManifestModuleOptions {
121
+ /** AdminManifestConfig as a value or via a factory (e.g. with a PLAN_CATALOG_TOKEN inject). */
122
+ config: ConfigSpec;
123
+ /**
124
+ * Default `true`. Set to `false` when the consumer registers its own
125
+ * manifest controller with app-specific guards entirely on its own.
126
+ */
127
+ includeManifestController?: boolean;
128
+ /**
129
+ * Class-level guards for GET /admin/manifest and POST /admin/manifest/reload,
130
+ * when `includeManifestController === true`. REQUIRED — otherwise
131
+ * `forRoot()` throws at boot.
132
+ *
133
+ * Pass `[]` explicitly when the endpoint should intentionally be auth-free
134
+ * (e.g. CI smoke tests, public demo). This makes the choice visible in the
135
+ * code rather than a silent default.
136
+ */
137
+ guards?: Array<Type<CanActivate>>;
138
+ /**
139
+ * Additional guards that apply ONLY to POST /admin/manifest/reload
140
+ * (typically `MfaGuard`). Placed after `guards` in the chain. Must be made
141
+ * available by the consumer as a provider.
142
+ */
143
+ reloadGuards?: Array<Type<CanActivate>>;
144
+ /**
145
+ * Default `true`. When active, the module automatically hooks
146
+ * `PLATFORM_CORE_MANIFEST_CONTRIBUTION` (StandardPage spine, generic tenant
147
+ * actions, platform audit action labels) into the `AdminManifestService` —
148
+ * before all app `register()` calls from `onModuleInit`. Consumers without
149
+ * a SuperAdmin need set this to `false`.
150
+ */
151
+ registerPlatformCore?: boolean;
152
+ /**
153
+ * Modules whose providers must be visible in the DI scope of this
154
+ * DynamicModule — typically: the app module that registers the
155
+ * factory-inject provider (e.g. `AdminManifestConfigFactory`). Without this
156
+ * entry, NestJS 11.1.19 cannot resolve the `inject:[...]` of the config
157
+ * factory (UnknownDependenciesException for ADMIN_MANIFEST_CONFIG).
158
+ */
159
+ imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
160
+ /** Additional providers that are registered in the DynamicModule itself. */
161
+ extraProviders?: Provider[];
162
+ /** Register the module globally — default `false`. */
163
+ global?: boolean;
164
+ }
165
+ declare class AdminManifestModule {
166
+ static forRoot(options: AdminManifestModuleOptions): DynamicModule;
167
+ }
168
+
169
+ declare const PLATFORM_CORE_MANIFEST_CONTRIBUTION: ManifestContribution;
170
+
171
+ declare const SUBSCRIPTION_STATS_PORT_TOKEN: unique symbol;
172
+ declare const PROMO_CODE_STATS_PORT_TOKEN: unique symbol;
173
+ declare const AUDIT_STATS_PORT_TOKEN: unique symbol;
174
+ /** Default audit window in days for the dashboard KPI. Override via forRoot. */
175
+ declare const ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN: unique symbol;
176
+
177
+ /**
178
+ * Platform stats for the SuperAdmin dashboard page.
179
+ *
180
+ * Contains subscription/promo/audit aggregates that are equally meaningful
181
+ * across all consuming apps. App-specific KPIs (e.g. DATEV or Bundles/Members)
182
+ * remain extra endpoints in the respective app.
183
+ */
184
+ interface AdminStatsSnapshot {
185
+ subscriptions: SubscriptionStatsSnapshot;
186
+ promos: PromoCodeStatsSnapshot;
187
+ audit: AuditStatsSnapshot;
188
+ }
189
+ declare class AdminStatsService {
190
+ private readonly subscriptions;
191
+ private readonly promos;
192
+ private readonly audit;
193
+ private readonly auditWindowDays;
194
+ constructor(subscriptions: SubscriptionStatsPort, promos: PromoCodeStatsPort, audit: AuditStatsPort, auditWindowDays?: number);
195
+ getSnapshot(): Promise<AdminStatsSnapshot>;
196
+ }
197
+
198
+ declare class AdminStatsController {
199
+ private readonly stats;
200
+ constructor(stats: AdminStatsService);
201
+ getDashboardSnapshot(): Promise<AdminStatsSnapshot>;
202
+ }
203
+
204
+ interface AdminStatsModuleOptions {
205
+ subscriptionStatsPort: ProviderSpec<SubscriptionStatsPort>;
206
+ promoCodeStatsPort: ProviderSpec<PromoCodeStatsPort>;
207
+ auditStatsPort: ProviderSpec<AuditStatsPort>;
208
+ /** Audit window in days for the "last N days" KPI. Default 7. */
209
+ auditWindowDays?: number;
210
+ /**
211
+ * Modules whose providers must be visible in the DI scope of this
212
+ * DynamicModule — e.g. the app module that registers the adapter classes
213
+ * referenced by the factory `inject` lists.
214
+ */
215
+ imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
216
+ /** Additional providers registered in the DynamicModule itself. */
217
+ extraProviders?: Provider[];
218
+ /** Register the module globally — default `false`. */
219
+ global?: boolean;
220
+ }
221
+ declare class AdminStatsModule {
222
+ static forRoot(options: AdminStatsModuleOptions): DynamicModule;
223
+ }
224
+
225
+ export { ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN, AUDIT_PORT_TOKEN, AUDIT_STATS_PORT_TOKEN, AdminBypassRlsInterceptor, AdminManifestConfig, AdminManifestModule, type AdminManifestModuleOptions, AdminManifestService, AdminModule, type AdminModuleOptions, AdminPublicBootController, AdminStatsController, AdminStatsModule, type AdminStatsModuleOptions, AdminStatsService, type AdminStatsSnapshot, MFA_PORT_TOKEN, MfaGuard, MfaService, PLATFORM_CORE_CONTRIBUTION_TOKEN, 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 };
@@ -0,0 +1,58 @@
1
+ import {
2
+ ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN,
3
+ AUDIT_STATS_PORT_TOKEN,
4
+ AdminStatsController,
5
+ AdminStatsModule,
6
+ AdminStatsService,
7
+ PROMO_CODE_STATS_PORT_TOKEN,
8
+ SUBSCRIPTION_STATS_PORT_TOKEN
9
+ } from "../chunk-YNEW3L63.js";
10
+ import {
11
+ ADMIN_MANIFEST_CONFIG,
12
+ AdminBypassRlsInterceptor,
13
+ AdminManifestModule,
14
+ AdminManifestService,
15
+ AdminModule,
16
+ AdminPublicBootController,
17
+ MfaGuard,
18
+ MfaService,
19
+ PLATFORM_CORE_CONTRIBUTION_TOKEN,
20
+ PLATFORM_CORE_MANIFEST_CONTRIBUTION,
21
+ REQUIRE_MFA_KEY,
22
+ RequireMfa,
23
+ SuperAdminGuard
24
+ } from "../chunk-P6MYZMXQ.js";
25
+ import {
26
+ AUDIT_PORT_TOKEN,
27
+ AdminAuditService,
28
+ MFA_PORT_TOKEN,
29
+ RLS_BYPASS_PORT_TOKEN
30
+ } from "../chunk-E56W4U2P.js";
31
+ import "../chunk-SABTXESR.js";
32
+ import "../chunk-SHUYVCID.js";
33
+ export {
34
+ ADMIN_MANIFEST_CONFIG,
35
+ ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN,
36
+ AUDIT_PORT_TOKEN,
37
+ AUDIT_STATS_PORT_TOKEN,
38
+ AdminAuditService,
39
+ AdminBypassRlsInterceptor,
40
+ AdminManifestModule,
41
+ AdminManifestService,
42
+ AdminModule,
43
+ AdminPublicBootController,
44
+ AdminStatsController,
45
+ AdminStatsModule,
46
+ AdminStatsService,
47
+ MFA_PORT_TOKEN,
48
+ MfaGuard,
49
+ MfaService,
50
+ PLATFORM_CORE_CONTRIBUTION_TOKEN,
51
+ PLATFORM_CORE_MANIFEST_CONTRIBUTION,
52
+ PROMO_CODE_STATS_PORT_TOKEN,
53
+ REQUIRE_MFA_KEY,
54
+ RLS_BYPASS_PORT_TOKEN,
55
+ RequireMfa,
56
+ SUBSCRIPTION_STATS_PORT_TOKEN,
57
+ SuperAdminGuard
58
+ };
@@ -0,0 +1,30 @@
1
+ import { AuditPort, AdminActor } from '@saasicat/types';
2
+
3
+ declare class AdminAuditService {
4
+ private readonly audit;
5
+ constructor(audit: AuditPort);
6
+ log(input: {
7
+ actor: AdminActor;
8
+ entity: string;
9
+ entityId: string;
10
+ action: string;
11
+ changes?: Record<string, unknown>;
12
+ }): Promise<void>;
13
+ /**
14
+ * Standardized actor tag for the `changes.actor` column:
15
+ * `<source>:<email>:<context>`.
16
+ */
17
+ actorTag(actor: AdminActor): string;
18
+ /** Helper: build an AdminActor from an authenticated web request. */
19
+ fromWebRequest(user: {
20
+ id: string;
21
+ email: string;
22
+ }, sessionId?: string | null): AdminActor;
23
+ /** Helper: build an AdminActor from a CLI identity (hostname as context). */
24
+ fromCli(user: {
25
+ id: string;
26
+ email: string;
27
+ }): AdminActor;
28
+ }
29
+
30
+ export { AdminAuditService as A };
@@ -0,0 +1,30 @@
1
+ import { AuditPort, AdminActor } from '@saasicat/types';
2
+
3
+ declare class AdminAuditService {
4
+ private readonly audit;
5
+ constructor(audit: AuditPort);
6
+ log(input: {
7
+ actor: AdminActor;
8
+ entity: string;
9
+ entityId: string;
10
+ action: string;
11
+ changes?: Record<string, unknown>;
12
+ }): Promise<void>;
13
+ /**
14
+ * Standardized actor tag for the `changes.actor` column:
15
+ * `<source>:<email>:<context>`.
16
+ */
17
+ actorTag(actor: AdminActor): string;
18
+ /** Helper: build an AdminActor from an authenticated web request. */
19
+ fromWebRequest(user: {
20
+ id: string;
21
+ email: string;
22
+ }, sessionId?: string | null): AdminActor;
23
+ /** Helper: build an AdminActor from a CLI identity (hostname as context). */
24
+ fromCli(user: {
25
+ id: string;
26
+ email: string;
27
+ }): AdminActor;
28
+ }
29
+
30
+ export { AdminAuditService as A };
@@ -0,0 +1,10 @@
1
+ import { AdminManifest } from '@saasicat/types';
2
+
3
+ declare const ADMIN_MANIFEST_CONFIG: unique symbol;
4
+ interface AdminManifestConfig {
5
+ project: AdminManifest['project'];
6
+ build: Omit<AdminManifest['build'], 'manifestHash'>;
7
+ planCatalogSnapshot: AdminManifest['planCatalogSnapshot'];
8
+ }
9
+
10
+ export { type AdminManifestConfig as A, ADMIN_MANIFEST_CONFIG as a };
@@ -0,0 +1,10 @@
1
+ import { AdminManifest } from '@saasicat/types';
2
+
3
+ declare const ADMIN_MANIFEST_CONFIG: unique symbol;
4
+ interface AdminManifestConfig {
5
+ project: AdminManifest['project'];
6
+ build: Omit<AdminManifest['build'], 'manifestHash'>;
7
+ planCatalogSnapshot: AdminManifest['planCatalogSnapshot'];
8
+ }
9
+
10
+ export { type AdminManifestConfig as A, ADMIN_MANIFEST_CONFIG as a };