@saasicat/nest 1.0.0-rc.2 → 1.0.0-rc.21

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 (154) hide show
  1. package/README.md +44 -8
  2. package/dist/.build-stamp +1 -1
  3. package/dist/_entries.cjs +10214 -4796
  4. package/dist/admin/index.d.cts +5 -4
  5. package/dist/admin/index.d.ts +5 -4
  6. package/dist/admin/index.js +13 -9
  7. package/dist/{admin-resources.module-CpvzcfCc.d.cts → admin-resources.module-B4XNvdH-.d.cts} +1 -2
  8. package/dist/{admin-resources.module-DF5_Q7RD.d.ts → admin-resources.module-CWqdI9BV.d.ts} +1 -2
  9. package/dist/{admin-stats.service-TYiSUwIR.d.ts → admin-stats.service-CsLNt19Z.d.ts} +11 -7
  10. package/dist/{admin-stats.service-DfKupywR.d.cts → admin-stats.service-DrZrU8IJ.d.cts} +11 -7
  11. package/dist/{aggregation-B3CD0v_d.d.cts → aggregation-ChpZDh0g.d.ts} +39 -6
  12. package/dist/{aggregation-BFzW07DE.d.ts → aggregation-OpnhwzF5.d.cts} +39 -6
  13. package/dist/billing/index.d.cts +448 -108
  14. package/dist/billing/index.d.ts +448 -108
  15. package/dist/billing/index.js +108 -41
  16. package/dist/catalog/index.d.cts +74 -45
  17. package/dist/catalog/index.d.ts +74 -45
  18. package/dist/catalog/index.js +21 -13
  19. package/dist/catalog.module-C9O7BxRq.d.ts +180 -0
  20. package/dist/catalog.module-T-I5Ricz.d.cts +180 -0
  21. package/dist/checkout-offer/index.d.cts +17 -22
  22. package/dist/checkout-offer/index.d.ts +17 -22
  23. package/dist/checkout-offer/index.js +21 -7
  24. package/dist/checkout-offer.module-DFhGy6JO.d.cts +58 -0
  25. package/dist/checkout-offer.module-x7SP_dX4.d.ts +58 -0
  26. package/dist/checkout-offer.service-BeHgYikI.d.ts +242 -0
  27. package/dist/checkout-offer.service-CCVxG9b2.d.cts +242 -0
  28. package/dist/chunk-34XVPR6P.js +222 -0
  29. package/dist/{chunk-AOQJEYOL.js → chunk-3QVGA6JX.js} +3 -1
  30. package/dist/chunk-3RLWML2S.js +896 -0
  31. package/dist/{chunk-TXC3LHHB.js → chunk-4SDSYV4A.js} +21 -13
  32. package/dist/chunk-55QEDAMX.js +946 -0
  33. package/dist/chunk-5CKC7O52.js +140 -0
  34. package/dist/chunk-6PJE7EWO.js +185 -0
  35. package/dist/chunk-7NJKVC5X.js +353 -0
  36. package/dist/{chunk-RUNZ3X4C.js → chunk-AOS2JPDD.js} +1263 -185
  37. package/dist/{chunk-WOVQPXV4.js → chunk-CQ2ZZMTD.js} +702 -725
  38. package/dist/{chunk-NA6O63B7.js → chunk-F5X66HF5.js} +5 -5
  39. package/dist/chunk-FEQZCWUL.js +174 -0
  40. package/dist/{chunk-VIJ5NJWC.js → chunk-G6EZWECL.js} +107 -31
  41. package/dist/chunk-G7RQO2XO.js +0 -0
  42. package/dist/{chunk-N3L3AICU.js → chunk-GPQWGA6B.js} +5 -6
  43. package/dist/chunk-GZTL64QK.js +7 -0
  44. package/dist/{chunk-SABTXESR.js → chunk-J7NJRK3K.js} +17 -1
  45. package/dist/{chunk-SEPN52AD.js → chunk-JBCC6C3M.js} +566 -307
  46. package/dist/{chunk-I7GTA3RX.js → chunk-JQRA724W.js} +1 -1
  47. package/dist/{chunk-WXYJHZCN.js → chunk-JVAEKTJ4.js} +2 -14
  48. package/dist/chunk-KPEMTBOP.js +26 -0
  49. package/dist/chunk-LF6J4YYN.js +301 -0
  50. package/dist/{chunk-LTT736P3.js → chunk-LLYVYRGJ.js} +228 -387
  51. package/dist/{chunk-6Z7JR4EW.js → chunk-M47BNEY2.js} +1897 -633
  52. package/dist/{chunk-KFT5AIIH.js → chunk-NDLC5GYK.js} +206 -24
  53. package/dist/{chunk-O2J2HDXA.js → chunk-OOTEXP47.js} +3 -8
  54. package/dist/chunk-QPVDCKYS.js +702 -0
  55. package/dist/{chunk-NHVDCYK5.js → chunk-R5YCJBHY.js} +71 -106
  56. package/dist/{chunk-XBYAFEOR.js → chunk-S33SO5XX.js} +1 -1
  57. package/dist/chunk-SZ7RFPXA.js +10 -0
  58. package/dist/chunk-TBBZWZQT.js +98 -0
  59. package/dist/chunk-TOEFN7DN.js +295 -0
  60. package/dist/{chunk-7ZEGFL42.js → chunk-WHJSYKNC.js} +6 -6
  61. package/dist/chunk-WOEJ6K7M.js +55 -0
  62. package/dist/{chunk-AU3OOREM.js → chunk-XSSWYPP5.js} +16 -3
  63. package/dist/contract-line-item-money-B0Z3Ogur.d.cts +43 -0
  64. package/dist/contract-line-item-money-B0Z3Ogur.d.ts +43 -0
  65. package/dist/discovery/index.d.cts +2 -2
  66. package/dist/discovery/index.d.ts +2 -2
  67. package/dist/discovery/index.js +6 -6
  68. package/dist/{discovery.scanner-9cMqF95o.d.cts → discovery.scanner-DXKc6JkV.d.cts} +1 -1
  69. package/dist/{discovery.scanner-9cMqF95o.d.ts → discovery.scanner-DXKc6JkV.d.ts} +1 -1
  70. package/dist/{enforce-quota.interceptor-Df0e3OWe.d.cts → enforce-quota.interceptor-BFyVdWe8.d.cts} +6 -6
  71. package/dist/{enforce-quota.interceptor-DW3etVyI.d.ts → enforce-quota.interceptor-GaBXboGx.d.ts} +6 -6
  72. package/dist/entitlement/index.d.cts +27 -4
  73. package/dist/entitlement/index.d.ts +27 -4
  74. package/dist/entitlement/index.js +13 -8
  75. package/dist/index.d.cts +209 -28
  76. package/dist/index.d.ts +209 -28
  77. package/dist/index.js +285 -163
  78. package/dist/issuer-identity.check-CBO0vcsq.d.cts +197 -0
  79. package/dist/issuer-identity.check-Cz9CEMkZ.d.ts +197 -0
  80. package/dist/{module-options-COSEb0VW.d.ts → module-options-DmQ3G4sZ.d.ts} +135 -41
  81. package/dist/{module-options-BG3MzQva.d.cts → module-options-qAOwinHR.d.cts} +135 -41
  82. package/dist/payment-callback.service-CR84Xw1Z.d.cts +125 -0
  83. package/dist/payment-callback.service-CR84Xw1Z.d.ts +125 -0
  84. package/dist/payments/index.cjs +4 -0
  85. package/dist/payments/index.d.cts +187 -0
  86. package/dist/payments/index.d.ts +187 -0
  87. package/dist/payments/index.js +141 -0
  88. package/dist/payments.module-BdUq9ot_.d.cts +57 -0
  89. package/dist/payments.module-CQGv_VG7.d.ts +57 -0
  90. package/dist/plan-catalog-source-DWe-BGY1.d.cts +21 -0
  91. package/dist/plan-catalog-source-DWe-BGY1.d.ts +21 -0
  92. package/dist/{plan-resolution-Cgo_TR1H.d.cts → plan-resolution-CwUy_OqC.d.cts} +14 -0
  93. package/dist/{plan-resolution-Cgo_TR1H.d.ts → plan-resolution-CwUy_OqC.d.ts} +14 -0
  94. package/dist/{plan-versions.service-DChhbK6h.d.ts → plan-versions.service-C0N-Em2W.d.ts} +38 -64
  95. package/dist/{plan-versions.service-TPEtbN0r.d.cts → plan-versions.service-DARLh-qI.d.cts} +38 -64
  96. package/dist/platform/index.d.cts +52 -23
  97. package/dist/platform/index.d.ts +52 -23
  98. package/dist/platform/index.js +57 -36
  99. package/dist/promo/index.d.cts +23 -8
  100. package/dist/promo/index.d.ts +23 -8
  101. package/dist/promo/index.js +15 -7
  102. package/dist/{promo.module-DtvIycpt.d.cts → promo.module-CKkECmU8.d.cts} +9 -3
  103. package/dist/{promo.module-Z8h1PNX-.d.ts → promo.module-DuIJdK3U.d.ts} +9 -3
  104. package/dist/promo.service-BYBu6dy3.d.cts +215 -0
  105. package/dist/promo.service-CFjfF0Xm.d.ts +215 -0
  106. package/dist/registration/index.d.cts +104 -47
  107. package/dist/registration/index.d.ts +104 -47
  108. package/dist/registration/index.js +15 -9
  109. package/dist/subscriber/index.cjs +4 -0
  110. package/dist/subscriber/index.d.cts +28 -0
  111. package/dist/subscriber/index.d.ts +28 -0
  112. package/dist/subscriber/index.js +16 -0
  113. package/dist/subscriber.service-5W6Gi-1B.d.cts +68 -0
  114. package/dist/subscriber.service-5W6Gi-1B.d.ts +68 -0
  115. package/dist/subscription-contract/index.d.cts +4 -2
  116. package/dist/subscription-contract/index.d.ts +4 -2
  117. package/dist/subscription-contract/index.js +13 -5
  118. package/dist/{subscription-contract.module-fDFdQ0jm.d.ts → subscription-contract.module-BfIRpc1o.d.ts} +8 -2
  119. package/dist/{subscription-contract.module-CEK8HS5-.d.cts → subscription-contract.module-DTMuUJYd.d.cts} +8 -2
  120. package/dist/{subscription-contract.service-hD87MKyg.d.cts → subscription-contract.service-CPZrTM9C.d.ts} +32 -3
  121. package/dist/{subscription-contract.service-hD87MKyg.d.ts → subscription-contract.service-CfNApLuP.d.cts} +32 -3
  122. package/dist/tenant-billing.controller-BLqbsONe.d.ts +812 -0
  123. package/dist/tenant-billing.controller-DKbAqTbM.d.cts +812 -0
  124. package/dist/tenant-billing.module-ClbjzocC.d.cts +364 -0
  125. package/dist/tenant-billing.module-DohgJJ2m.d.ts +364 -0
  126. package/dist/tenant-billing.tokens-G-1xOlMr.d.cts +129 -0
  127. package/dist/tenant-billing.tokens-G-1xOlMr.d.ts +129 -0
  128. package/dist/testing/index.d.cts +44 -17
  129. package/dist/testing/index.d.ts +44 -17
  130. package/dist/testing/index.js +189 -40
  131. package/package.json +24 -4
  132. package/dist/catalog.module-BDDO6iwq.d.cts +0 -103
  133. package/dist/catalog.module-BTnMsE6u.d.ts +0 -103
  134. package/dist/checkout-offer.module-CMtiQJTT.d.ts +0 -39
  135. package/dist/checkout-offer.module-CVpWrzbe.d.cts +0 -39
  136. package/dist/checkout-offer.service-BLOv2HOo.d.cts +0 -49
  137. package/dist/checkout-offer.service-BLOv2HOo.d.ts +0 -49
  138. package/dist/chunk-57V6ZTI6.js +0 -22
  139. package/dist/chunk-BSK6YBLI.js +0 -87
  140. package/dist/chunk-DQKCK7DX.js +0 -217
  141. package/dist/chunk-VXEYLNIB.js +0 -632
  142. package/dist/chunk-WUDYIPYH.js +0 -715
  143. package/dist/define-saasicat-DROBe-b1.d.ts +0 -69
  144. package/dist/define-saasicat-vGBCkFys.d.cts +0 -69
  145. package/dist/promo.service-BJbKAmw3.d.cts +0 -112
  146. package/dist/promo.service-BJbKAmw3.d.ts +0 -112
  147. package/dist/tenant-billing.controller-BQ67mlmI.d.ts +0 -438
  148. package/dist/tenant-billing.controller-DS8kB8a7.d.cts +0 -438
  149. package/dist/tenant-billing.module-BznC3XtW.d.cts +0 -299
  150. package/dist/tenant-billing.module-wUbsQSFG.d.ts +0 -299
  151. /package/dist/{chunk-2FR6ZL7R.js → chunk-BHZOH2DY.js} +0 -0
  152. /package/dist/{chunk-2SLTRKXC.js → chunk-DFOW3JVO.js} +0 -0
  153. /package/dist/{chunk-DBZGV3HC.js → chunk-DU56UKEH.js} +0 -0
  154. /package/dist/{chunk-OYNHOY45.js → chunk-GAUEVIAE.js} +0 -0
@@ -1,18 +1,25 @@
1
+ import {
2
+ EnforceMfa,
3
+ MfaGuard,
4
+ MfaService
5
+ } from "./chunk-34XVPR6P.js";
6
+ import {
7
+ AdminAuditService
8
+ } from "./chunk-OOTEXP47.js";
1
9
  import {
2
10
  AUDIT_PORT_TOKEN,
3
- AdminAuditService,
4
11
  MFA_PORT_TOKEN,
5
12
  RLS_BYPASS_PORT_TOKEN
6
- } from "./chunk-O2J2HDXA.js";
13
+ } from "./chunk-SZ7RFPXA.js";
7
14
  import {
8
15
  SaaSiCatPublicRoute
9
16
  } from "./chunk-YSC46BGM.js";
10
17
  import {
11
- codedError
12
- } from "./chunk-57V6ZTI6.js";
18
+ PLAN_CATALOG_SOURCE_TOKEN
19
+ } from "./chunk-FEQZCWUL.js";
13
20
  import {
14
21
  asProvider
15
- } from "./chunk-SABTXESR.js";
22
+ } from "./chunk-J7NJRK3K.js";
16
23
  import {
17
24
  __name
18
25
  } from "./chunk-SHUYVCID.js";
@@ -53,9 +60,10 @@ SuperAdminGuard = _ts_decorate([
53
60
  Injectable()
54
61
  ], SuperAdminGuard);
55
62
 
56
- // src/admin/mfa.service.ts
57
- import { Inject, Injectable as Injectable2, Logger } from "@nestjs/common";
58
- import { generateSecret, generateURI, verify as verifyTotpCode } from "otplib";
63
+ // src/admin/admin-bypass-rls.interceptor.ts
64
+ import { Inject, Injectable as Injectable2 } from "@nestjs/common";
65
+ import { defer, from } from "rxjs";
66
+ import { switchAll } from "rxjs/operators";
59
67
  function _ts_decorate2(decorators, target, key, desc) {
60
68
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
61
69
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -73,205 +81,6 @@ function _ts_param(paramIndex, decorator) {
73
81
  };
74
82
  }
75
83
  __name(_ts_param, "_ts_param");
76
- var CLOCK_DRIFT_TOLERANCE_SECONDS = 30;
77
- var OTPLIB_TOKEN_ERROR_NAMES = /* @__PURE__ */ new Set([
78
- "TokenError",
79
- "TokenFormatError",
80
- "TokenLengthError"
81
- ]);
82
- function isOtplibTokenError(error) {
83
- return error instanceof Error && OTPLIB_TOKEN_ERROR_NAMES.has(error.name);
84
- }
85
- __name(isOtplibTokenError, "isOtplibTokenError");
86
- var MfaService = class _MfaService {
87
- static {
88
- __name(this, "MfaService");
89
- }
90
- mfa;
91
- logger = new Logger(_MfaService.name);
92
- constructor(mfa) {
93
- this.mfa = mfa;
94
- }
95
- /**
96
- * Generates a new TOTP secret, persists it via `MfaPort.setSecret`
97
- * and returns the secret + the otpauth URI for the QR code.
98
- *
99
- * `issuer` and `label` shape the display in the authenticator (e.g.
100
- * "DemoApp:taci@example.com").
101
- */
102
- async setup(userId, label, issuer) {
103
- const secret = generateSecret();
104
- const otpauthUri = generateURI({
105
- issuer,
106
- label,
107
- secret
108
- });
109
- await this.mfa.setSecret(userId, secret);
110
- return {
111
- secret,
112
- otpauthUri
113
- };
114
- }
115
- /**
116
- * Verifies the entered code against the stored secret,
117
- * clock-drift-tolerant by ±1 time step.
118
- */
119
- async verify(input) {
120
- const secret = await this.mfa.getSecret(input.userId);
121
- if (!secret) return false;
122
- try {
123
- const result = await verifyTotpCode({
124
- secret,
125
- token: input.code.trim(),
126
- epochTolerance: CLOCK_DRIFT_TOLERANCE_SECONDS
127
- });
128
- return result.valid;
129
- } catch (error) {
130
- if (isOtplibTokenError(error)) {
131
- return false;
132
- }
133
- const message = error instanceof Error ? error.message : String(error);
134
- this.logger.warn(`TOTP verification for user ${input.userId} failed unexpectedly: ${message}`);
135
- return false;
136
- }
137
- }
138
- /**
139
- * Deletes a user's secret — used by `ahp admin mfa-reset`.
140
- */
141
- async disable(userId) {
142
- await this.mfa.setSecret(userId, null);
143
- }
144
- /** Delegates to `MfaPort.isEnabled`. */
145
- async isEnabled(userId) {
146
- return this.mfa.isEnabled(userId);
147
- }
148
- };
149
- MfaService = _ts_decorate2([
150
- Injectable2(),
151
- _ts_param(0, Inject(MFA_PORT_TOKEN)),
152
- _ts_metadata("design:type", Function),
153
- _ts_metadata("design:paramtypes", [
154
- typeof MfaPort === "undefined" ? Object : MfaPort
155
- ])
156
- ], MfaService);
157
-
158
- // src/admin/mfa.guard.ts
159
- import { Inject as Inject2, Injectable as Injectable3, Logger as Logger2, SetMetadata, UnauthorizedException } from "@nestjs/common";
160
- import { Reflector } from "@nestjs/core";
161
- import { AUTH_ERROR_CODES as AUTH_ERROR_CODES2 } from "@saasicat/core";
162
- function _ts_decorate3(decorators, target, key, desc) {
163
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
164
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
165
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
166
- return c > 3 && r && Object.defineProperty(target, key, r), r;
167
- }
168
- __name(_ts_decorate3, "_ts_decorate");
169
- function _ts_metadata2(k, v) {
170
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
171
- }
172
- __name(_ts_metadata2, "_ts_metadata");
173
- function _ts_param2(paramIndex, decorator) {
174
- return function(target, key) {
175
- decorator(target, key, paramIndex);
176
- };
177
- }
178
- __name(_ts_param2, "_ts_param");
179
- var REQUIRE_MFA_KEY = "saasicat/nest/require-mfa";
180
- var RequireMfa = /* @__PURE__ */ __name(() => SetMetadata(REQUIRE_MFA_KEY, true), "RequireMfa");
181
- var MfaGuard = class _MfaGuard {
182
- static {
183
- __name(this, "MfaGuard");
184
- }
185
- reflector;
186
- mfaService;
187
- logger = new Logger2(_MfaGuard.name);
188
- constructor(reflector, mfaService) {
189
- this.reflector = reflector;
190
- this.mfaService = mfaService;
191
- }
192
- async canActivate(context) {
193
- const required = this.reflector.getAllAndOverride(REQUIRE_MFA_KEY, [
194
- context.getHandler(),
195
- context.getClass()
196
- ]);
197
- if (!required) return true;
198
- if (process.env.SAAS_PLATFORM_SKIP_MFA === "1" && process.env.NODE_ENV !== "production") {
199
- return true;
200
- }
201
- const request = context.switchToHttp().getRequest();
202
- const user = request.user;
203
- if (!user) {
204
- throw new UnauthorizedException({
205
- ...codedError(AUTH_ERROR_CODES2.NOT_AUTHENTICATED),
206
- // `reason` is superseded by `code` and will be removed.
207
- reason: "NOT_AUTHENTICATED"
208
- });
209
- }
210
- const enabled = await this.mfaService.isEnabled(user.id);
211
- if (!enabled) {
212
- throw new UnauthorizedException({
213
- code: AUTH_ERROR_CODES2.MFA_NOT_SET_UP,
214
- // `reason` is superseded by `code` and will be removed.
215
- reason: "MFA_NOT_SET_UP",
216
- message: "Run the MFA setup via the CLI first."
217
- });
218
- }
219
- const headerVal = request.headers?.["x-mfa-code"];
220
- const code = Array.isArray(headerVal) ? headerVal[0] : headerVal;
221
- if (!code) {
222
- throw new UnauthorizedException({
223
- code: AUTH_ERROR_CODES2.MFA_REQUIRED,
224
- // `reason` is superseded by `code` and will be removed.
225
- reason: "MFA_REQUIRED",
226
- message: "TOTP code required in the X-Mfa-Code header."
227
- });
228
- }
229
- const valid = await this.mfaService.verify({
230
- userId: user.id,
231
- code: String(code)
232
- });
233
- if (!valid) {
234
- throw new UnauthorizedException({
235
- code: AUTH_ERROR_CODES2.MFA_FAILED,
236
- // `reason` is superseded by `code` and will be removed.
237
- reason: "MFA_FAILED",
238
- message: "Invalid TOTP code."
239
- });
240
- }
241
- return true;
242
- }
243
- };
244
- MfaGuard = _ts_decorate3([
245
- Injectable3(),
246
- _ts_param2(0, Inject2(Reflector)),
247
- _ts_metadata2("design:type", Function),
248
- _ts_metadata2("design:paramtypes", [
249
- typeof Reflector === "undefined" ? Object : Reflector,
250
- typeof MfaService === "undefined" ? Object : MfaService
251
- ])
252
- ], MfaGuard);
253
-
254
- // src/admin/admin-bypass-rls.interceptor.ts
255
- import { Inject as Inject3, Injectable as Injectable4 } from "@nestjs/common";
256
- import { defer, from } from "rxjs";
257
- import { switchAll } from "rxjs/operators";
258
- function _ts_decorate4(decorators, target, key, desc) {
259
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
260
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
261
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
262
- return c > 3 && r && Object.defineProperty(target, key, r), r;
263
- }
264
- __name(_ts_decorate4, "_ts_decorate");
265
- function _ts_metadata3(k, v) {
266
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
267
- }
268
- __name(_ts_metadata3, "_ts_metadata");
269
- function _ts_param3(paramIndex, decorator) {
270
- return function(target, key) {
271
- decorator(target, key, paramIndex);
272
- };
273
- }
274
- __name(_ts_param3, "_ts_param");
275
84
  var AdminBypassRlsInterceptor = class {
276
85
  static {
277
86
  __name(this, "AdminBypassRlsInterceptor");
@@ -286,24 +95,24 @@ var AdminBypassRlsInterceptor = class {
286
95
  })).pipe(switchAll()));
287
96
  }
288
97
  };
289
- AdminBypassRlsInterceptor = _ts_decorate4([
290
- Injectable4(),
291
- _ts_param3(0, Inject3(RLS_BYPASS_PORT_TOKEN)),
292
- _ts_metadata3("design:type", Function),
293
- _ts_metadata3("design:paramtypes", [
98
+ AdminBypassRlsInterceptor = _ts_decorate2([
99
+ Injectable2(),
100
+ _ts_param(0, Inject(RLS_BYPASS_PORT_TOKEN)),
101
+ _ts_metadata("design:type", Function),
102
+ _ts_metadata("design:paramtypes", [
294
103
  typeof RlsBypassPort === "undefined" ? Object : RlsBypassPort
295
104
  ])
296
105
  ], AdminBypassRlsInterceptor);
297
106
 
298
107
  // src/admin/admin.module.ts
299
108
  import { Module } from "@nestjs/common";
300
- function _ts_decorate5(decorators, target, key, desc) {
109
+ function _ts_decorate3(decorators, target, key, desc) {
301
110
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
302
111
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
303
112
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
304
113
  return c > 3 && r && Object.defineProperty(target, key, r), r;
305
114
  }
306
- __name(_ts_decorate5, "_ts_decorate");
115
+ __name(_ts_decorate3, "_ts_decorate");
307
116
  var AdminModule = class _AdminModule {
308
117
  static {
309
118
  __name(this, "AdminModule");
@@ -337,7 +146,7 @@ var AdminModule = class _AdminModule {
337
146
  };
338
147
  }
339
148
  };
340
- AdminModule = _ts_decorate5([
149
+ AdminModule = _ts_decorate3([
341
150
  Module({})
342
151
  ], AdminModule);
343
152
 
@@ -345,56 +154,65 @@ AdminModule = _ts_decorate5([
345
154
  var ADMIN_MANIFEST_CONFIG = /* @__PURE__ */ Symbol.for("saasicat/nest/AdminManifestConfig");
346
155
 
347
156
  // src/admin/admin-manifest.service.ts
348
- import { Inject as Inject4, Injectable as Injectable5, Logger as Logger3, Optional } from "@nestjs/common";
157
+ import { Inject as Inject2, Injectable as Injectable3, Logger, Optional } from "@nestjs/common";
349
158
  import { createHash } from "crypto";
350
- function _ts_decorate6(decorators, target, key, desc) {
159
+ import { canonicalJson } from "@saasicat/core";
160
+ function _ts_decorate4(decorators, target, key, desc) {
351
161
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
352
162
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
353
163
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
354
164
  return c > 3 && r && Object.defineProperty(target, key, r), r;
355
165
  }
356
- __name(_ts_decorate6, "_ts_decorate");
357
- function _ts_metadata4(k, v) {
166
+ __name(_ts_decorate4, "_ts_decorate");
167
+ function _ts_metadata2(k, v) {
358
168
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
359
169
  }
360
- __name(_ts_metadata4, "_ts_metadata");
361
- function _ts_param4(paramIndex, decorator) {
170
+ __name(_ts_metadata2, "_ts_metadata");
171
+ function _ts_param2(paramIndex, decorator) {
362
172
  return function(target, key) {
363
173
  decorator(target, key, paramIndex);
364
174
  };
365
175
  }
366
- __name(_ts_param4, "_ts_param");
176
+ __name(_ts_param2, "_ts_param");
367
177
  var PLATFORM_CORE_CONTRIBUTION_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/PlatformCoreContribution");
368
178
  var AdminManifestService = class _AdminManifestService {
369
179
  static {
370
180
  __name(this, "AdminManifestService");
371
181
  }
372
182
  config;
373
- logger = new Logger3(_AdminManifestService.name);
183
+ planCatalogs;
184
+ logger = new Logger(_AdminManifestService.name);
374
185
  contributions = [];
375
- cached = null;
376
- constructor(config, platformCore = null) {
186
+ merged = null;
187
+ lastHash = null;
188
+ constructor(config, planCatalogs, platformCore = null) {
377
189
  this.config = config;
190
+ this.planCatalogs = planCatalogs;
378
191
  if (platformCore) {
379
192
  this.contributions.push(platformCore);
380
193
  }
381
194
  }
382
195
  register(contribution) {
383
196
  this.contributions.push(contribution);
384
- this.cached = null;
197
+ this.merged = null;
385
198
  }
386
- getManifest() {
387
- if (this.cached) return this.cached;
388
- this.cached = this.build();
389
- this.logger.log(`Manifest built: ${this.contributions.length} contribution(s), hash=${this.cached.build.manifestHash.slice(0, 24)}\u2026`);
390
- return this.cached;
199
+ async getManifest() {
200
+ const manifest = this.build(await this.planCatalogs.current());
201
+ const hash = manifest.build.manifestHash;
202
+ if (hash !== this.lastHash) {
203
+ this.lastHash = hash;
204
+ this.logger.log(`Manifest built: ${this.contributions.length} contribution(s), hash=${hash.slice(0, 24)}\u2026`);
205
+ }
206
+ return manifest;
391
207
  }
392
- rebuild() {
393
- this.cached = null;
208
+ /** Merges the contributions again, then serves the manifest as `getManifest` does. */
209
+ async rebuild() {
210
+ this.merged = null;
394
211
  return this.getManifest();
395
212
  }
396
- build() {
397
- const merged = this.mergeContributions(this.contributions);
213
+ build(catalog) {
214
+ this.merged ??= this.mergeContributions(this.contributions);
215
+ const merged = this.merged;
398
216
  const draft = {
399
217
  schemaVersion: 1,
400
218
  project: this.config.project,
@@ -402,7 +220,7 @@ var AdminManifestService = class _AdminManifestService {
402
220
  ...this.config.build,
403
221
  manifestHash: "sha256-pending"
404
222
  },
405
- planCatalogSnapshot: this.config.planCatalogSnapshot,
223
+ planCatalogSnapshot: planCatalogSnapshotOf(catalog, this.planCatalogs.origin),
406
224
  capabilities: merged.capabilities,
407
225
  navigation: merged.navigation,
408
226
  dashboard: merged.dashboard,
@@ -472,17 +290,34 @@ var AdminManifestService = class _AdminManifestService {
472
290
  return `sha256-${digest}`;
473
291
  }
474
292
  };
475
- AdminManifestService = _ts_decorate6([
476
- Injectable5(),
477
- _ts_param4(0, Inject4(ADMIN_MANIFEST_CONFIG)),
478
- _ts_param4(1, Optional()),
479
- _ts_param4(1, Inject4(PLATFORM_CORE_CONTRIBUTION_TOKEN)),
480
- _ts_metadata4("design:type", Function),
481
- _ts_metadata4("design:paramtypes", [
293
+ AdminManifestService = _ts_decorate4([
294
+ Injectable3(),
295
+ _ts_param2(0, Inject2(ADMIN_MANIFEST_CONFIG)),
296
+ _ts_param2(1, Inject2(PLAN_CATALOG_SOURCE_TOKEN)),
297
+ _ts_param2(2, Optional()),
298
+ _ts_param2(2, Inject2(PLATFORM_CORE_CONTRIBUTION_TOKEN)),
299
+ _ts_metadata2("design:type", Function),
300
+ _ts_metadata2("design:paramtypes", [
482
301
  typeof AdminManifestConfig === "undefined" ? Object : AdminManifestConfig,
302
+ typeof PlanCatalogSource === "undefined" ? Object : PlanCatalogSource,
483
303
  Object
484
304
  ])
485
305
  ], AdminManifestService);
306
+ function planCatalogSnapshotOf(catalog, origin) {
307
+ const carried = {
308
+ currency: catalog.currency,
309
+ vatRate: catalog.vatRate,
310
+ plans: catalog.plans ?? [],
311
+ features: catalog.features ?? []
312
+ };
313
+ const digest = createHash("sha256").update(canonicalJson(carried)).digest("base64url");
314
+ return {
315
+ source: origin,
316
+ hash: `sha256-${digest}`,
317
+ ...carried
318
+ };
319
+ }
320
+ __name(planCatalogSnapshotOf, "planCatalogSnapshotOf");
486
321
  function stableStringify(value) {
487
322
  if (value === null) return "null";
488
323
  if (value === void 0) return "null";
@@ -502,24 +337,24 @@ function stableStringify(value) {
502
337
  __name(stableStringify, "stableStringify");
503
338
 
504
339
  // src/admin/admin-public-boot.controller.ts
505
- import { Controller, Get, Inject as Inject5 } from "@nestjs/common";
506
- function _ts_decorate7(decorators, target, key, desc) {
340
+ import { Controller, Get, Inject as Inject3 } from "@nestjs/common";
341
+ function _ts_decorate5(decorators, target, key, desc) {
507
342
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
508
343
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
509
344
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
510
345
  return c > 3 && r && Object.defineProperty(target, key, r), r;
511
346
  }
512
- __name(_ts_decorate7, "_ts_decorate");
513
- function _ts_metadata5(k, v) {
347
+ __name(_ts_decorate5, "_ts_decorate");
348
+ function _ts_metadata3(k, v) {
514
349
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
515
350
  }
516
- __name(_ts_metadata5, "_ts_metadata");
517
- function _ts_param5(paramIndex, decorator) {
351
+ __name(_ts_metadata3, "_ts_metadata");
352
+ function _ts_param3(paramIndex, decorator) {
518
353
  return function(target, key) {
519
354
  decorator(target, key, paramIndex);
520
355
  };
521
356
  }
522
- __name(_ts_param5, "_ts_param");
357
+ __name(_ts_param3, "_ts_param");
523
358
  var AdminPublicBootController = class {
524
359
  static {
525
360
  __name(this, "AdminPublicBootController");
@@ -541,18 +376,18 @@ var AdminPublicBootController = class {
541
376
  };
542
377
  }
543
378
  };
544
- _ts_decorate7([
379
+ _ts_decorate5([
545
380
  Get("boot"),
546
- _ts_metadata5("design:type", Function),
547
- _ts_metadata5("design:paramtypes", []),
548
- _ts_metadata5("design:returntype", typeof PublicBootResponse === "undefined" ? Object : PublicBootResponse)
381
+ _ts_metadata3("design:type", Function),
382
+ _ts_metadata3("design:paramtypes", []),
383
+ _ts_metadata3("design:returntype", typeof PublicBootResponse === "undefined" ? Object : PublicBootResponse)
549
384
  ], AdminPublicBootController.prototype, "getBoot", null);
550
- AdminPublicBootController = _ts_decorate7([
385
+ AdminPublicBootController = _ts_decorate5([
551
386
  Controller("admin"),
552
387
  SaaSiCatPublicRoute(),
553
- _ts_param5(0, Inject5(ADMIN_MANIFEST_CONFIG)),
554
- _ts_metadata5("design:type", Function),
555
- _ts_metadata5("design:paramtypes", [
388
+ _ts_param3(0, Inject3(ADMIN_MANIFEST_CONFIG)),
389
+ _ts_metadata3("design:type", Function),
390
+ _ts_metadata3("design:paramtypes", [
556
391
  typeof AdminManifestConfig === "undefined" ? Object : AdminManifestConfig
557
392
  ])
558
393
  ], AdminPublicBootController);
@@ -631,6 +466,14 @@ var PLATFORM_CORE_MANIFEST_CONTRIBUTION = {
631
466
  platformEmailHistory: {
632
467
  enabled: true,
633
468
  requiredCapability: "platformEmailHistory.read"
469
+ },
470
+ // The applied configuration, read-only. The platform grants
471
+ // `settings.read` unconditionally — see `compose/manifest.ts` —
472
+ // because the page is mounted and the route answers either way;
473
+ // `includeSettingsController` only says who serves it.
474
+ settings: {
475
+ enabled: true,
476
+ requiredCapability: "settings.read"
634
477
  }
635
478
  }
636
479
  },
@@ -809,24 +652,24 @@ var PLATFORM_CORE_MANIFEST_CONTRIBUTION = {
809
652
  };
810
653
 
811
654
  // src/admin/admin-manifest.module.ts
812
- import { Controller as Controller2, Get as Get2, Header, Headers, HttpCode, HttpStatus, Inject as Inject6, Module as Module2, Post, Res, UseGuards } from "@nestjs/common";
813
- function _ts_decorate8(decorators, target, key, desc) {
655
+ import { Controller as Controller2, Get as Get2, Header, Headers, HttpCode, HttpStatus, Inject as Inject4, Module as Module2, Post, Res, UseGuards } from "@nestjs/common";
656
+ function _ts_decorate6(decorators, target, key, desc) {
814
657
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
815
658
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
816
659
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
817
660
  return c > 3 && r && Object.defineProperty(target, key, r), r;
818
661
  }
819
- __name(_ts_decorate8, "_ts_decorate");
820
- function _ts_metadata6(k, v) {
662
+ __name(_ts_decorate6, "_ts_decorate");
663
+ function _ts_metadata4(k, v) {
821
664
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
822
665
  }
823
- __name(_ts_metadata6, "_ts_metadata");
824
- function _ts_param6(paramIndex, decorator) {
666
+ __name(_ts_metadata4, "_ts_metadata");
667
+ function _ts_param4(paramIndex, decorator) {
825
668
  return function(target, key) {
826
669
  decorator(target, key, paramIndex);
827
670
  };
828
671
  }
829
- __name(_ts_param6, "_ts_param");
672
+ __name(_ts_param4, "_ts_param");
830
673
  function asConfigProvider(impl) {
831
674
  if (typeof impl === "object" && impl !== null && "useFactory" in impl && typeof impl.useFactory === "function") {
832
675
  return {
@@ -857,8 +700,8 @@ function buildManifestController(guards, reloadGuards) {
857
700
  constructor(manifest) {
858
701
  this.manifest = manifest;
859
702
  }
860
- getManifest(ifNoneMatch, res) {
861
- const m = this.manifest.getManifest();
703
+ async getManifest(ifNoneMatch, res) {
704
+ const m = await this.manifest.getManifest();
862
705
  const etag = `"${m.build.manifestHash}"`;
863
706
  res.header("ETag", etag);
864
707
  if (ifNoneMatch && ifNoneMatch === etag) {
@@ -867,42 +710,42 @@ function buildManifestController(guards, reloadGuards) {
867
710
  }
868
711
  return m;
869
712
  }
870
- reload() {
871
- const m = this.manifest.rebuild();
713
+ async reload() {
714
+ const m = await this.manifest.rebuild();
872
715
  return {
873
716
  manifestHash: m.build.manifestHash,
874
717
  reloadedAt: (/* @__PURE__ */ new Date()).toISOString()
875
718
  };
876
719
  }
877
720
  };
878
- _ts_decorate8([
721
+ _ts_decorate6([
879
722
  Get2("manifest"),
880
723
  Header("Cache-Control", "private, max-age=60, must-revalidate"),
881
- _ts_param6(0, Headers("if-none-match")),
882
- _ts_param6(1, Res({
724
+ _ts_param4(0, Headers("if-none-match")),
725
+ _ts_param4(1, Res({
883
726
  passthrough: true
884
727
  })),
885
- _ts_metadata6("design:type", Function),
886
- _ts_metadata6("design:paramtypes", [
728
+ _ts_metadata4("design:type", Function),
729
+ _ts_metadata4("design:paramtypes", [
887
730
  Object,
888
731
  typeof HttpResponseLike === "undefined" ? Object : HttpResponseLike
889
732
  ]),
890
- _ts_metadata6("design:returntype", void 0)
733
+ _ts_metadata4("design:returntype", Promise)
891
734
  ], GeneratedAdminManifestController.prototype, "getManifest", null);
892
- _ts_decorate8([
735
+ _ts_decorate6([
893
736
  Post("manifest/reload"),
894
737
  UseGuards(...reloadChain),
895
738
  HttpCode(HttpStatus.OK),
896
- _ts_metadata6("design:type", Function),
897
- _ts_metadata6("design:paramtypes", []),
898
- _ts_metadata6("design:returntype", void 0)
739
+ _ts_metadata4("design:type", Function),
740
+ _ts_metadata4("design:paramtypes", []),
741
+ _ts_metadata4("design:returntype", Promise)
899
742
  ], GeneratedAdminManifestController.prototype, "reload", null);
900
- GeneratedAdminManifestController = _ts_decorate8([
743
+ GeneratedAdminManifestController = _ts_decorate6([
901
744
  Controller2("admin"),
902
745
  UseGuards(...guards),
903
- _ts_param6(0, Inject6(AdminManifestService)),
904
- _ts_metadata6("design:type", Function),
905
- _ts_metadata6("design:paramtypes", [
746
+ _ts_param4(0, Inject4(AdminManifestService)),
747
+ _ts_metadata4("design:type", Function),
748
+ _ts_metadata4("design:paramtypes", [
906
749
  typeof AdminManifestService === "undefined" ? Object : AdminManifestService
907
750
  ])
908
751
  ], GeneratedAdminManifestController);
@@ -949,7 +792,7 @@ var AdminManifestModule = class _AdminManifestModule {
949
792
  };
950
793
  }
951
794
  };
952
- AdminManifestModule = _ts_decorate8([
795
+ AdminManifestModule = _ts_decorate6([
953
796
  Module2({})
954
797
  ], AdminManifestModule);
955
798
 
@@ -960,24 +803,24 @@ var AUDIT_STATS_PORT_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/AuditStat
960
803
  var ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/AdminStatsAuditWindowDays");
961
804
 
962
805
  // src/admin/admin-stats.service.ts
963
- import { Inject as Inject7, Injectable as Injectable6, Optional as Optional2 } from "@nestjs/common";
964
- function _ts_decorate9(decorators, target, key, desc) {
806
+ import { Inject as Inject5, Injectable as Injectable4, Optional as Optional2 } from "@nestjs/common";
807
+ function _ts_decorate7(decorators, target, key, desc) {
965
808
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
966
809
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
967
810
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
968
811
  return c > 3 && r && Object.defineProperty(target, key, r), r;
969
812
  }
970
- __name(_ts_decorate9, "_ts_decorate");
971
- function _ts_metadata7(k, v) {
813
+ __name(_ts_decorate7, "_ts_decorate");
814
+ function _ts_metadata5(k, v) {
972
815
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
973
816
  }
974
- __name(_ts_metadata7, "_ts_metadata");
975
- function _ts_param7(paramIndex, decorator) {
817
+ __name(_ts_metadata5, "_ts_metadata");
818
+ function _ts_param5(paramIndex, decorator) {
976
819
  return function(target, key) {
977
820
  decorator(target, key, paramIndex);
978
821
  };
979
822
  }
980
- __name(_ts_param7, "_ts_param");
823
+ __name(_ts_param5, "_ts_param");
981
824
  var DAY_MS = 864e5;
982
825
  var DEFAULT_AUDIT_WINDOW_DAYS = 7;
983
826
  var AdminStatsService = class {
@@ -1011,15 +854,15 @@ var AdminStatsService = class {
1011
854
  };
1012
855
  }
1013
856
  };
1014
- AdminStatsService = _ts_decorate9([
1015
- Injectable6(),
1016
- _ts_param7(0, Inject7(SUBSCRIPTION_STATS_PORT_TOKEN)),
1017
- _ts_param7(1, Inject7(PROMO_CODE_STATS_PORT_TOKEN)),
1018
- _ts_param7(2, Inject7(AUDIT_STATS_PORT_TOKEN)),
1019
- _ts_param7(3, Optional2()),
1020
- _ts_param7(3, Inject7(ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN)),
1021
- _ts_metadata7("design:type", Function),
1022
- _ts_metadata7("design:paramtypes", [
857
+ AdminStatsService = _ts_decorate7([
858
+ Injectable4(),
859
+ _ts_param5(0, Inject5(SUBSCRIPTION_STATS_PORT_TOKEN)),
860
+ _ts_param5(1, Inject5(PROMO_CODE_STATS_PORT_TOKEN)),
861
+ _ts_param5(2, Inject5(AUDIT_STATS_PORT_TOKEN)),
862
+ _ts_param5(3, Optional2()),
863
+ _ts_param5(3, Inject5(ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN)),
864
+ _ts_metadata5("design:type", Function),
865
+ _ts_metadata5("design:paramtypes", [
1023
866
  typeof SubscriptionStatsPort === "undefined" ? Object : SubscriptionStatsPort,
1024
867
  typeof PromoCodeStatsPort === "undefined" ? Object : PromoCodeStatsPort,
1025
868
  typeof AuditStatsPort === "undefined" ? Object : AuditStatsPort,
@@ -1028,24 +871,24 @@ AdminStatsService = _ts_decorate9([
1028
871
  ], AdminStatsService);
1029
872
 
1030
873
  // src/admin/admin-stats.controller.ts
1031
- import { Controller as Controller3, Get as Get3, Inject as Inject8, UseGuards as UseGuards2 } from "@nestjs/common";
1032
- function _ts_decorate10(decorators, target, key, desc) {
874
+ import { Controller as Controller3, Get as Get3, Inject as Inject6, UseGuards as UseGuards2 } from "@nestjs/common";
875
+ function _ts_decorate8(decorators, target, key, desc) {
1033
876
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1034
877
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1035
878
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1036
879
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1037
880
  }
1038
- __name(_ts_decorate10, "_ts_decorate");
1039
- function _ts_metadata8(k, v) {
881
+ __name(_ts_decorate8, "_ts_decorate");
882
+ function _ts_metadata6(k, v) {
1040
883
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1041
884
  }
1042
- __name(_ts_metadata8, "_ts_metadata");
1043
- function _ts_param8(paramIndex, decorator) {
885
+ __name(_ts_metadata6, "_ts_metadata");
886
+ function _ts_param6(paramIndex, decorator) {
1044
887
  return function(target, key) {
1045
888
  decorator(target, key, paramIndex);
1046
889
  };
1047
890
  }
1048
- __name(_ts_param8, "_ts_param");
891
+ __name(_ts_param6, "_ts_param");
1049
892
  var AdminStatsController = class {
1050
893
  static {
1051
894
  __name(this, "AdminStatsController");
@@ -1061,18 +904,18 @@ var AdminStatsController = class {
1061
904
  return this.stats.getSnapshot();
1062
905
  }
1063
906
  };
1064
- _ts_decorate10([
907
+ _ts_decorate8([
1065
908
  Get3("dashboard"),
1066
- _ts_metadata8("design:type", Function),
1067
- _ts_metadata8("design:paramtypes", []),
1068
- _ts_metadata8("design:returntype", Promise)
909
+ _ts_metadata6("design:type", Function),
910
+ _ts_metadata6("design:paramtypes", []),
911
+ _ts_metadata6("design:returntype", Promise)
1069
912
  ], AdminStatsController.prototype, "getDashboardSnapshot", null);
1070
- AdminStatsController = _ts_decorate10([
913
+ AdminStatsController = _ts_decorate8([
1071
914
  Controller3("admin/stats"),
1072
915
  UseGuards2(SuperAdminGuard),
1073
- _ts_param8(0, Inject8(AdminStatsService)),
1074
- _ts_metadata8("design:type", Function),
1075
- _ts_metadata8("design:paramtypes", [
916
+ _ts_param6(0, Inject6(AdminStatsService)),
917
+ _ts_metadata6("design:type", Function),
918
+ _ts_metadata6("design:paramtypes", [
1076
919
  typeof AdminStatsService === "undefined" ? Object : AdminStatsService
1077
920
  ])
1078
921
  ], AdminStatsController);
@@ -1089,18 +932,18 @@ function buildAdminStatsController(guards) {
1089
932
  return this.stats.getSnapshot();
1090
933
  }
1091
934
  };
1092
- _ts_decorate10([
935
+ _ts_decorate8([
1093
936
  Get3("dashboard"),
1094
- _ts_metadata8("design:type", Function),
1095
- _ts_metadata8("design:paramtypes", []),
1096
- _ts_metadata8("design:returntype", Promise)
937
+ _ts_metadata6("design:type", Function),
938
+ _ts_metadata6("design:paramtypes", []),
939
+ _ts_metadata6("design:returntype", Promise)
1097
940
  ], GeneratedAdminStatsController.prototype, "getDashboardSnapshot", null);
1098
- GeneratedAdminStatsController = _ts_decorate10([
941
+ GeneratedAdminStatsController = _ts_decorate8([
1099
942
  Controller3("admin/stats"),
1100
943
  UseGuards2(...guards),
1101
- _ts_param8(0, Inject8(AdminStatsService)),
1102
- _ts_metadata8("design:type", Function),
1103
- _ts_metadata8("design:paramtypes", [
944
+ _ts_param6(0, Inject6(AdminStatsService)),
945
+ _ts_metadata6("design:type", Function),
946
+ _ts_metadata6("design:paramtypes", [
1104
947
  typeof AdminStatsService === "undefined" ? Object : AdminStatsService
1105
948
  ])
1106
949
  ], GeneratedAdminStatsController);
@@ -1110,13 +953,13 @@ __name(buildAdminStatsController, "buildAdminStatsController");
1110
953
 
1111
954
  // src/admin/admin-stats.module.ts
1112
955
  import { Module as Module3 } from "@nestjs/common";
1113
- function _ts_decorate11(decorators, target, key, desc) {
956
+ function _ts_decorate9(decorators, target, key, desc) {
1114
957
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1115
958
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1116
959
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1117
960
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1118
961
  }
1119
- __name(_ts_decorate11, "_ts_decorate");
962
+ __name(_ts_decorate9, "_ts_decorate");
1120
963
  var AdminStatsModule = class _AdminStatsModule {
1121
964
  static {
1122
965
  __name(this, "AdminStatsModule");
@@ -1151,31 +994,31 @@ var AdminStatsModule = class _AdminStatsModule {
1151
994
  };
1152
995
  }
1153
996
  };
1154
- AdminStatsModule = _ts_decorate11([
997
+ AdminStatsModule = _ts_decorate9([
1155
998
  Module3({})
1156
999
  ], AdminStatsModule);
1157
1000
 
1158
1001
  // src/admin/admin-resources.module.ts
1159
- import { Body, Controller as Controller4, Get as Get4, Inject as Inject9, Injectable as Injectable7, Module as Module4, NotFoundException, Param, Post as Post2, Query, Req, UseGuards as UseGuards3 } from "@nestjs/common";
1002
+ import { Body, Controller as Controller4, Get as Get4, Inject as Inject7, Injectable as Injectable5, Module as Module4, NotFoundException, Param, Post as Post2, Query, Req, UseGuards as UseGuards3 } from "@nestjs/common";
1160
1003
  import { IsOptional, IsString, MaxLength } from "class-validator";
1161
1004
  import { BILLING_ERROR_CODES } from "@saasicat/core";
1162
- function _ts_decorate12(decorators, target, key, desc) {
1005
+ function _ts_decorate10(decorators, target, key, desc) {
1163
1006
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1164
1007
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1165
1008
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1166
1009
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1167
1010
  }
1168
- __name(_ts_decorate12, "_ts_decorate");
1169
- function _ts_metadata9(k, v) {
1011
+ __name(_ts_decorate10, "_ts_decorate");
1012
+ function _ts_metadata7(k, v) {
1170
1013
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1171
1014
  }
1172
- __name(_ts_metadata9, "_ts_metadata");
1173
- function _ts_param9(paramIndex, decorator) {
1015
+ __name(_ts_metadata7, "_ts_metadata");
1016
+ function _ts_param7(paramIndex, decorator) {
1174
1017
  return function(target, key) {
1175
1018
  decorator(target, key, paramIndex);
1176
1019
  };
1177
1020
  }
1178
- __name(_ts_param9, "_ts_param");
1021
+ __name(_ts_param7, "_ts_param");
1179
1022
  var ADMIN_RESOURCES_PORT_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/AdminResourcesPort");
1180
1023
  var SuspendTenantDto = class {
1181
1024
  static {
@@ -1183,11 +1026,11 @@ var SuspendTenantDto = class {
1183
1026
  }
1184
1027
  reason;
1185
1028
  };
1186
- _ts_decorate12([
1029
+ _ts_decorate10([
1187
1030
  IsOptional(),
1188
1031
  IsString(),
1189
1032
  MaxLength(500),
1190
- _ts_metadata9("design:type", String)
1033
+ _ts_metadata7("design:type", String)
1191
1034
  ], SuspendTenantDto.prototype, "reason", void 0);
1192
1035
  var AdminResourcesService = class {
1193
1036
  static {
@@ -1260,12 +1103,12 @@ var AdminResourcesService = class {
1260
1103
  return result;
1261
1104
  }
1262
1105
  };
1263
- AdminResourcesService = _ts_decorate12([
1264
- Injectable7(),
1265
- _ts_param9(0, Inject9(ADMIN_RESOURCES_PORT_TOKEN)),
1266
- _ts_param9(1, Inject9(AdminAuditService)),
1267
- _ts_metadata9("design:type", Function),
1268
- _ts_metadata9("design:paramtypes", [
1106
+ AdminResourcesService = _ts_decorate10([
1107
+ Injectable5(),
1108
+ _ts_param7(0, Inject7(ADMIN_RESOURCES_PORT_TOKEN)),
1109
+ _ts_param7(1, Inject7(AdminAuditService)),
1110
+ _ts_metadata7("design:type", Function),
1111
+ _ts_metadata7("design:paramtypes", [
1269
1112
  typeof AdminResourcesPort === "undefined" ? Object : AdminResourcesPort,
1270
1113
  typeof AdminAuditService === "undefined" ? Object : AdminAuditService
1271
1114
  ])
@@ -1317,78 +1160,80 @@ function buildAdminResourcesController(guards) {
1317
1160
  return this.resources.listSubscriptions();
1318
1161
  }
1319
1162
  };
1320
- _ts_decorate12([
1163
+ _ts_decorate10([
1321
1164
  Get4("tenants"),
1322
- _ts_param9(0, Query()),
1323
- _ts_metadata9("design:type", Function),
1324
- _ts_metadata9("design:paramtypes", [
1165
+ _ts_param7(0, Query()),
1166
+ _ts_metadata7("design:type", Function),
1167
+ _ts_metadata7("design:paramtypes", [
1325
1168
  Object
1326
1169
  ]),
1327
- _ts_metadata9("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1170
+ _ts_metadata7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1328
1171
  ], GeneratedAdminResourcesController.prototype, "listTenants", null);
1329
- _ts_decorate12([
1172
+ _ts_decorate10([
1330
1173
  Get4("tenants/:slug"),
1331
- _ts_param9(0, Param("slug")),
1332
- _ts_metadata9("design:type", Function),
1333
- _ts_metadata9("design:paramtypes", [
1174
+ _ts_param7(0, Param("slug")),
1175
+ _ts_metadata7("design:type", Function),
1176
+ _ts_metadata7("design:paramtypes", [
1334
1177
  String
1335
1178
  ]),
1336
- _ts_metadata9("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1179
+ _ts_metadata7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1337
1180
  ], GeneratedAdminResourcesController.prototype, "getTenant", null);
1338
- _ts_decorate12([
1181
+ _ts_decorate10([
1339
1182
  Post2("tenants/:slug/suspend"),
1340
- _ts_param9(0, Req()),
1341
- _ts_param9(1, Param("slug")),
1342
- _ts_param9(2, Body()),
1343
- _ts_metadata9("design:type", Function),
1344
- _ts_metadata9("design:paramtypes", [
1183
+ EnforceMfa(),
1184
+ _ts_param7(0, Req()),
1185
+ _ts_param7(1, Param("slug")),
1186
+ _ts_param7(2, Body()),
1187
+ _ts_metadata7("design:type", Function),
1188
+ _ts_metadata7("design:paramtypes", [
1345
1189
  typeof AdminRequest === "undefined" ? Object : AdminRequest,
1346
1190
  String,
1347
1191
  typeof SuspendTenantDto === "undefined" ? Object : SuspendTenantDto
1348
1192
  ]),
1349
- _ts_metadata9("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1193
+ _ts_metadata7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1350
1194
  ], GeneratedAdminResourcesController.prototype, "suspendTenant", null);
1351
- _ts_decorate12([
1195
+ _ts_decorate10([
1352
1196
  Post2("tenants/:slug/reactivate"),
1353
- _ts_param9(0, Req()),
1354
- _ts_param9(1, Param("slug")),
1355
- _ts_metadata9("design:type", Function),
1356
- _ts_metadata9("design:paramtypes", [
1197
+ EnforceMfa(),
1198
+ _ts_param7(0, Req()),
1199
+ _ts_param7(1, Param("slug")),
1200
+ _ts_metadata7("design:type", Function),
1201
+ _ts_metadata7("design:paramtypes", [
1357
1202
  typeof AdminRequest === "undefined" ? Object : AdminRequest,
1358
1203
  String
1359
1204
  ]),
1360
- _ts_metadata9("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1205
+ _ts_metadata7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1361
1206
  ], GeneratedAdminResourcesController.prototype, "reactivateTenant", null);
1362
- _ts_decorate12([
1207
+ _ts_decorate10([
1363
1208
  Get4("users"),
1364
- _ts_param9(0, Query()),
1365
- _ts_metadata9("design:type", Function),
1366
- _ts_metadata9("design:paramtypes", [
1209
+ _ts_param7(0, Query()),
1210
+ _ts_metadata7("design:type", Function),
1211
+ _ts_metadata7("design:paramtypes", [
1367
1212
  Object
1368
1213
  ]),
1369
- _ts_metadata9("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1214
+ _ts_metadata7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1370
1215
  ], GeneratedAdminResourcesController.prototype, "listUsers", null);
1371
- _ts_decorate12([
1216
+ _ts_decorate10([
1372
1217
  Get4("audit"),
1373
- _ts_param9(0, Query()),
1374
- _ts_metadata9("design:type", Function),
1375
- _ts_metadata9("design:paramtypes", [
1218
+ _ts_param7(0, Query()),
1219
+ _ts_metadata7("design:type", Function),
1220
+ _ts_metadata7("design:paramtypes", [
1376
1221
  Object
1377
1222
  ]),
1378
- _ts_metadata9("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1223
+ _ts_metadata7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1379
1224
  ], GeneratedAdminResourcesController.prototype, "listAudit", null);
1380
- _ts_decorate12([
1225
+ _ts_decorate10([
1381
1226
  Get4("subscriptions"),
1382
- _ts_metadata9("design:type", Function),
1383
- _ts_metadata9("design:paramtypes", []),
1384
- _ts_metadata9("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1227
+ _ts_metadata7("design:type", Function),
1228
+ _ts_metadata7("design:paramtypes", []),
1229
+ _ts_metadata7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1385
1230
  ], GeneratedAdminResourcesController.prototype, "listSubscriptions", null);
1386
- GeneratedAdminResourcesController = _ts_decorate12([
1231
+ GeneratedAdminResourcesController = _ts_decorate10([
1387
1232
  Controller4("admin"),
1388
1233
  UseGuards3(...guards),
1389
- _ts_param9(0, Inject9(AdminResourcesService)),
1390
- _ts_metadata9("design:type", Function),
1391
- _ts_metadata9("design:paramtypes", [
1234
+ _ts_param7(0, Inject7(AdminResourcesService)),
1235
+ _ts_metadata7("design:type", Function),
1236
+ _ts_metadata7("design:paramtypes", [
1392
1237
  typeof AdminResourcesService === "undefined" ? Object : AdminResourcesService
1393
1238
  ])
1394
1239
  ], GeneratedAdminResourcesController);
@@ -1418,16 +1263,12 @@ var AdminResourcesModule = class _AdminResourcesModule {
1418
1263
  };
1419
1264
  }
1420
1265
  };
1421
- AdminResourcesModule = _ts_decorate12([
1266
+ AdminResourcesModule = _ts_decorate10([
1422
1267
  Module4({})
1423
1268
  ], AdminResourcesModule);
1424
1269
 
1425
1270
  export {
1426
1271
  SuperAdminGuard,
1427
- MfaService,
1428
- REQUIRE_MFA_KEY,
1429
- RequireMfa,
1430
- MfaGuard,
1431
1272
  AdminBypassRlsInterceptor,
1432
1273
  AdminModule,
1433
1274
  ADMIN_MANIFEST_CONFIG,