@saasicat/nest 0.8.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 (95) hide show
  1. package/dist/_entries.cjs +17678 -0
  2. package/dist/admin/index.cjs +4 -1274
  3. package/dist/admin/index.d.cts +10 -171
  4. package/dist/admin/index.d.ts +10 -171
  5. package/dist/admin/index.js +13 -4
  6. package/dist/admin-resources.module-BZN_yBFj.d.cts +40 -0
  7. package/dist/admin-resources.module-Cms8MY6h.d.ts +40 -0
  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 -5128
  11. package/dist/billing/index.d.cts +8 -719
  12. package/dist/billing/index.d.ts +8 -719
  13. package/dist/billing/index.js +7 -10
  14. package/dist/catalog/index.cjs +4 -5624
  15. package/dist/catalog/index.d.cts +7 -427
  16. package/dist/catalog/index.d.ts +7 -427
  17. package/dist/catalog/index.js +14 -12
  18. package/dist/catalog.module-BKObceo0.d.ts +103 -0
  19. package/dist/catalog.module-Dw2Hrbyu.d.cts +103 -0
  20. package/dist/checkout-offer/index.cjs +4 -807
  21. package/dist/checkout-offer/index.d.cts +5 -84
  22. package/dist/checkout-offer/index.d.ts +5 -84
  23. package/dist/checkout-offer/index.js +3 -2
  24. package/dist/checkout-offer.module-Y0hDOVrq.d.ts +85 -0
  25. package/dist/checkout-offer.module-ZYF5IsDY.d.cts +85 -0
  26. package/dist/{chunk-5DDCSGZC.js → chunk-33TP26MR.js} +144 -356
  27. package/dist/{chunk-CK54YKVK.js → chunk-75JABGZK.js} +16 -16
  28. package/dist/{chunk-HRU3CP57.js → chunk-BOADBIGB.js} +1 -1
  29. package/dist/{chunk-ZLUGQE5D.js → chunk-E7AJ42AB.js} +8 -8
  30. package/dist/{chunk-6LP7CDS2.js → chunk-F3VV6EXG.js} +18 -13
  31. package/dist/{chunk-PLDHI6NA.js → chunk-FVT7KTUI.js} +258 -3
  32. package/dist/{chunk-RZU4HIAN.js → chunk-GBDUH6DO.js} +26 -23
  33. package/dist/{chunk-K3OPNVFR.js → chunk-HBFU5AN3.js} +5 -9
  34. package/dist/chunk-HWGIMNWR.js +0 -0
  35. package/dist/chunk-IRWZC3GC.js +755 -0
  36. package/dist/chunk-L4KTQ6CL.js +20 -0
  37. package/dist/{chunk-T5SXXAKG.js → chunk-LZHLGUQI.js} +1 -1
  38. package/dist/{chunk-YHHE4KDA.js → chunk-PUXLPUVH.js} +351 -21
  39. package/dist/chunk-TXDH4FUA.js +211 -0
  40. package/dist/chunk-UF53DWWR.js +0 -0
  41. package/dist/{chunk-AJ3EPELS.js → chunk-V34AA7C7.js} +1 -1
  42. package/dist/chunk-WJ6BMDL3.js +313 -0
  43. package/dist/{chunk-M6CZQYPY.js → chunk-Z3FWN3HJ.js} +2 -2
  44. package/dist/discovery/index.cjs +4 -588
  45. package/dist/discovery/index.js +3 -3
  46. package/dist/{enforce-quota.interceptor-cv7r80VM.d.cts → enforce-quota.interceptor-BhkX5nq2.d.cts} +127 -12
  47. package/dist/{enforce-quota.interceptor-Dj1Kusr5.d.ts → enforce-quota.interceptor-CcqZc0Yu.d.ts} +127 -12
  48. package/dist/entitlement/index.cjs +4 -780
  49. package/dist/entitlement/index.d.cts +3 -1
  50. package/dist/entitlement/index.d.ts +3 -1
  51. package/dist/entitlement/index.js +2 -3
  52. package/dist/index.cjs +4 -14975
  53. package/dist/index.d.cts +22 -54
  54. package/dist/index.d.ts +22 -54
  55. package/dist/index.js +88 -369
  56. package/dist/module-CSN8j8Tp.d.cts +39 -0
  57. package/dist/module-DgYJur6f.d.ts +39 -0
  58. package/dist/plan-versions.service-BB36Q1bg.d.ts +329 -0
  59. package/dist/plan-versions.service-CUR2Whyr.d.cts +329 -0
  60. package/dist/platform/index.cjs +4 -2779
  61. package/dist/platform/index.d.cts +50 -8
  62. package/dist/platform/index.d.ts +50 -8
  63. package/dist/platform/index.js +116 -12
  64. package/dist/promo/index.cjs +4 -995
  65. package/dist/promo/index.d.cts +48 -46
  66. package/dist/promo/index.d.ts +48 -46
  67. package/dist/promo/index.js +10 -2
  68. package/dist/rate-limit.guard-dntqAlfZ.d.cts +19 -0
  69. package/dist/rate-limit.guard-dntqAlfZ.d.ts +19 -0
  70. package/dist/registration/index.cjs +4 -1655
  71. package/dist/registration/index.js +1 -1
  72. package/dist/setup.service-BPwJ7My_.d.cts +45 -0
  73. package/dist/setup.service-D2mrdDDB.d.ts +45 -0
  74. package/dist/subscription-bundle-preview.service-BkJXHAeP.d.cts +438 -0
  75. package/dist/subscription-bundle-preview.service-DBbrE_cw.d.ts +438 -0
  76. package/dist/subscription-bundles.module-BQmoozm5.d.ts +291 -0
  77. package/dist/subscription-bundles.module-DCpV-Pb5.d.cts +291 -0
  78. package/dist/subscription-contract/index.cjs +4 -471
  79. package/dist/subscription-contract/index.d.cts +5 -13
  80. package/dist/subscription-contract/index.d.ts +5 -13
  81. package/dist/subscription-contract.module-CG9fPKAr.d.cts +14 -0
  82. package/dist/subscription-contract.module-CVebZzHR.d.ts +14 -0
  83. package/dist/testing/index.cjs +4 -3756
  84. package/dist/testing/index.d.cts +9 -4
  85. package/dist/testing/index.d.ts +9 -4
  86. package/dist/testing/index.js +13 -7
  87. package/package.json +5 -5
  88. package/dist/admin-manifest.config-DyrQNT7M.d.cts +0 -10
  89. package/dist/admin-manifest.config-DyrQNT7M.d.ts +0 -10
  90. package/dist/admin-manifest.service-Cp6uwvmt.d.cts +0 -33
  91. package/dist/admin-manifest.service-UGgzR1x-.d.ts +0 -33
  92. package/dist/chunk-52UTQRD3.js +0 -326
  93. package/dist/chunk-N3WANKSA.js +0 -20
  94. package/dist/chunk-Q53N43LQ.js +0 -13
  95. /package/dist/{chunk-2FR6ZL7R.js → chunk-DBZGV3HC.js} +0 -0
package/dist/index.js CHANGED
@@ -1,12 +1,4 @@
1
- import {
2
- PreviewPromoCodeDto,
3
- PromoCodeExpirer,
4
- PromoCodePublicController,
5
- PromoCodeRateLimitGuard,
6
- PromoCodesModule,
7
- hashIp,
8
- ipFingerprint
9
- } from "./chunk-52UTQRD3.js";
1
+ import "./chunk-HWGIMNWR.js";
10
2
  import {
11
3
  ACTIVATION_ORCHESTRATOR_TOKEN,
12
4
  BaseIpRateLimitGuard,
@@ -45,7 +37,48 @@ import {
45
37
  resolveModel,
46
38
  slugify,
47
39
  verifyOtpCode
48
- } from "./chunk-CK54YKVK.js";
40
+ } from "./chunk-75JABGZK.js";
41
+ import "./chunk-UF53DWWR.js";
42
+ import {
43
+ formatPreflightReport,
44
+ formatSeedGateReport,
45
+ preflightExitCode,
46
+ runPreflight,
47
+ runSeedGateFromFile,
48
+ seedGateExitCode,
49
+ validateSeedAgainstSnapshot
50
+ } from "./chunk-TXDH4FUA.js";
51
+ import "./chunk-DBZGV3HC.js";
52
+ import {
53
+ DefinesQuota,
54
+ EnforceQuota,
55
+ ImplementsCapability,
56
+ RequiresCapability,
57
+ runHeadlessDiscoveryScan
58
+ } from "./chunk-BOADBIGB.js";
59
+ import {
60
+ DiscoverySnapshotNotFoundError,
61
+ loadDiscoverySnapshotFromFile
62
+ } from "./chunk-ABB2CRAS.js";
63
+ import {
64
+ SETUP_CONFIG_TOKEN,
65
+ SETUP_PROVISIONING_PORT_TOKEN,
66
+ SetupController,
67
+ SetupModule,
68
+ SetupService
69
+ } from "./chunk-WJ6BMDL3.js";
70
+ import {
71
+ CreatePromoCodeDto,
72
+ PreviewPromoCodeDto,
73
+ PromoCodeExpirer,
74
+ PromoCodePublicController,
75
+ PromoCodeRateLimitGuard,
76
+ PromoCodesModule,
77
+ UpdatePromoCodeDto,
78
+ buildPromoCodeAdminController,
79
+ hashIp,
80
+ ipFingerprint
81
+ } from "./chunk-IRWZC3GC.js";
49
82
  import {
50
83
  ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN,
51
84
  AUDIT_STATS_PORT_TOKEN,
@@ -54,7 +87,26 @@ import {
54
87
  AdminStatsService,
55
88
  PROMO_CODE_STATS_PORT_TOKEN,
56
89
  SUBSCRIPTION_STATS_PORT_TOKEN
57
- } from "./chunk-T5SXXAKG.js";
90
+ } from "./chunk-LZHLGUQI.js";
91
+ import {
92
+ ADMIN_MANIFEST_CONFIG,
93
+ ADMIN_RESOURCES_PORT_TOKEN,
94
+ AdminBypassRlsInterceptor,
95
+ AdminManifestModule,
96
+ AdminManifestService,
97
+ AdminModule,
98
+ AdminPublicBootController,
99
+ AdminResourcesModule,
100
+ AdminResourcesService,
101
+ MfaGuard,
102
+ MfaService,
103
+ PLATFORM_CORE_CONTRIBUTION_TOKEN,
104
+ PLATFORM_CORE_MANIFEST_CONTRIBUTION,
105
+ REQUIRE_MFA_KEY,
106
+ RequireMfa,
107
+ SuperAdminGuard,
108
+ SuspendTenantDto
109
+ } from "./chunk-FVT7KTUI.js";
58
110
  import {
59
111
  CONTRACT_FREEZE_PORT_TOKEN,
60
112
  CONTRACT_FREEZE_PROJECT_KEY_TOKEN,
@@ -83,6 +135,8 @@ import {
83
135
  PublicCatalogController,
84
136
  PublicCatalogModule,
85
137
  PublishValidationError,
138
+ REQUIRE_FEATURE_KEY,
139
+ RequireFeature,
86
140
  SELF_SERVICE_BLOCKED_BUNDLES_TOKEN,
87
141
  SELF_SERVICE_BLOCKED_PLANS_TOKEN,
88
142
  SubscriptionBundleModule,
@@ -113,7 +167,7 @@ import {
113
167
  periodEndWithMinLead,
114
168
  resolveBundleCancelEffectiveAt,
115
169
  resolveBundlePriceNet
116
- } from "./chunk-6LP7CDS2.js";
170
+ } from "./chunk-F3VV6EXG.js";
117
171
  import {
118
172
  PROMO_CODE_REDEMPTION_REPOSITORY_TOKEN,
119
173
  PROMO_CODE_REPOSITORY_TOKEN,
@@ -129,7 +183,7 @@ import {
129
183
  computeDiscountGross,
130
184
  computeDiscountedGross,
131
185
  computeRegularStartsAt
132
- } from "./chunk-ZLUGQE5D.js";
186
+ } from "./chunk-E7AJ42AB.js";
133
187
  import {
134
188
  SubscriptionContractModule,
135
189
  SubscriptionContractService,
@@ -181,18 +235,11 @@ import {
181
235
  buildPromotionsController,
182
236
  buildPublicMarketingCatalogController,
183
237
  featureApprovalSignature,
184
- formatPreflightReport,
185
- formatSeedGateReport,
186
238
  loadApprovedCatalogKeys,
187
- preflightExitCode,
188
239
  quotaApprovalSignature,
189
- runPreflight,
190
- runSeedGateFromFile,
191
- seedGateExitCode,
192
240
  validateBundleDraft,
193
- validatePlanDraft,
194
- validateSeedAgainstSnapshot
195
- } from "./chunk-5DDCSGZC.js";
241
+ validatePlanDraft
242
+ } from "./chunk-33TP26MR.js";
196
243
  import {
197
244
  AUDIT_CONTEXT_RESOLVER_TOKEN,
198
245
  PENDING_PLAN_QUERY_PORT_TOKEN,
@@ -207,6 +254,12 @@ import {
207
254
  classifyBundleVersionDiff,
208
255
  classifyPlanDiff
209
256
  } from "./chunk-WPUVJRIN.js";
257
+ import {
258
+ AUDIT_PORT_TOKEN,
259
+ AdminAuditService,
260
+ MFA_PORT_TOKEN,
261
+ RLS_BYPASS_PORT_TOKEN
262
+ } from "./chunk-E56W4U2P.js";
210
263
  import {
211
264
  CHECKOUT_OFFER_REPOSITORY_TOKEN,
212
265
  CheckoutOfferModule,
@@ -214,55 +267,18 @@ import {
214
267
  CreateCheckoutOfferDto,
215
268
  UpdateCheckoutOfferDto,
216
269
  buildCheckoutOfferController
217
- } from "./chunk-K3OPNVFR.js";
270
+ } from "./chunk-HBFU5AN3.js";
218
271
  import "./chunk-MDIZUVIK.js";
219
- import {
220
- DefinesQuota,
221
- EnforceQuota,
222
- ImplementsCapability,
223
- RequiresCapability,
224
- runHeadlessDiscoveryScan
225
- } from "./chunk-HRU3CP57.js";
226
- import {
227
- DiscoverySnapshotNotFoundError,
228
- loadDiscoverySnapshotFromFile
229
- } from "./chunk-ABB2CRAS.js";
230
- import "./chunk-2FR6ZL7R.js";
231
- import {
232
- ADMIN_MANIFEST_CONFIG,
233
- AdminBypassRlsInterceptor,
234
- AdminManifestModule,
235
- AdminManifestService,
236
- AdminModule,
237
- AdminPublicBootController,
238
- MfaGuard,
239
- MfaService,
240
- PLATFORM_CORE_CONTRIBUTION_TOKEN,
241
- PLATFORM_CORE_MANIFEST_CONTRIBUTION,
242
- REQUIRE_MFA_KEY,
243
- RequireMfa,
244
- SuperAdminGuard
245
- } from "./chunk-PLDHI6NA.js";
246
- import {
247
- REQUIRE_FEATURE_KEY,
248
- RequireFeature
249
- } from "./chunk-Q53N43LQ.js";
250
- import {
251
- AUDIT_PORT_TOKEN,
252
- AdminAuditService,
253
- MFA_PORT_TOKEN,
254
- RLS_BYPASS_PORT_TOKEN
255
- } from "./chunk-E56W4U2P.js";
256
272
  import {
257
273
  DiscoveryModule,
258
274
  buildDiscoveryController
259
- } from "./chunk-AJ3EPELS.js";
275
+ } from "./chunk-V34AA7C7.js";
260
276
  import {
261
277
  DISCOVERY_APP_INFO_TOKEN,
262
278
  DISCOVERY_SNAPSHOT_PATH_TOKEN,
263
279
  DiscoveryScanner,
264
280
  computeSnapshotHash
265
- } from "./chunk-M6CZQYPY.js";
281
+ } from "./chunk-Z3FWN3HJ.js";
266
282
  import {
267
283
  EntitlementModule,
268
284
  EntitlementService,
@@ -283,7 +299,7 @@ import {
283
299
  isLimitExceededError,
284
300
  resolveEntitlementPlan,
285
301
  toEffectiveLimitsSnapshot
286
- } from "./chunk-RZU4HIAN.js";
302
+ } from "./chunk-GBDUH6DO.js";
287
303
  import {
288
304
  PLAN_CATALOG_READ_SINK_TOKEN,
289
305
  PLAN_CATALOG_TOKEN,
@@ -320,7 +336,7 @@ import {
320
336
  MARKETING_SETTINGS_REPOSITORY_TOKEN,
321
337
  PLAN_REPOSITORY_TOKEN,
322
338
  PROMOTION_REPOSITORY_TOKEN
323
- } from "./chunk-N3WANKSA.js";
339
+ } from "./chunk-L4KTQ6CL.js";
324
340
  import {
325
341
  asProvider
326
342
  } from "./chunk-SABTXESR.js";
@@ -331,314 +347,11 @@ import {
331
347
  IMPLEMENTS_CAPABILITY_KEY,
332
348
  REQUIRES_CAPABILITY_KEY
333
349
  } from "./chunk-L4SUWH5B.js";
334
- import {
335
- __name
336
- } from "./chunk-SHUYVCID.js";
337
-
338
- // src/setup/setup.module.ts
339
- import { Module } from "@nestjs/common";
340
-
341
- // src/setup/setup.controller.ts
342
- import { Body, Controller, Get, Post } from "@nestjs/common";
343
- import { IsEmail, IsNotEmpty, IsOptional, IsString, MinLength } from "class-validator";
344
-
345
- // src/setup/setup.service.ts
346
- import { BadRequestException, ConflictException, ForbiddenException, Inject, Injectable, UnauthorizedException } from "@nestjs/common";
347
- import { isPlatformUserExistsError, SETUP_ERROR_CODES } from "@saasicat/types";
348
- import { randomBytes, timingSafeEqual } from "crypto";
349
- import QRCode from "qrcode";
350
-
351
- // src/setup/tokens.ts
352
- var SETUP_PROVISIONING_PORT_TOKEN = /* @__PURE__ */ Symbol.for("saas-platform/SetupProvisioningPort");
353
- var SETUP_CONFIG_TOKEN = /* @__PURE__ */ Symbol.for("saas-platform/SetupConfig");
354
-
355
- // src/setup/setup.service.ts
356
- function _ts_decorate(decorators, target, key, desc) {
357
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
358
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
359
- 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;
360
- return c > 3 && r && Object.defineProperty(target, key, r), r;
361
- }
362
- __name(_ts_decorate, "_ts_decorate");
363
- function _ts_metadata(k, v) {
364
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
365
- }
366
- __name(_ts_metadata, "_ts_metadata");
367
- function _ts_param(paramIndex, decorator) {
368
- return function(target, key) {
369
- decorator(target, key, paramIndex);
370
- };
371
- }
372
- __name(_ts_param, "_ts_param");
373
- var GENERATED_PASSWORD_BYTES = 12;
374
- function timingSafeEqualStr(a, b) {
375
- const ab = Buffer.from(a, "utf8");
376
- const bb = Buffer.from(b, "utf8");
377
- if (ab.length !== bb.length) return false;
378
- return timingSafeEqual(ab, bb);
379
- }
380
- __name(timingSafeEqualStr, "timingSafeEqualStr");
381
- var SetupService = class {
382
- static {
383
- __name(this, "SetupService");
384
- }
385
- users;
386
- config;
387
- mfa;
388
- constructor(users, config, mfa) {
389
- this.users = users;
390
- this.config = config;
391
- this.mfa = mfa;
392
- }
393
- async status() {
394
- return {
395
- needsSetup: await this.users.countSuperAdmins() === 0
396
- };
397
- }
398
- async setup(req) {
399
- this.assertToken(req.token);
400
- await this.assertNoSuperAdmin();
401
- const email = req.email.trim().toLowerCase();
402
- if (!email.includes("@")) {
403
- throw new BadRequestException({
404
- code: SETUP_ERROR_CODES.INVALID_EMAIL
405
- });
406
- }
407
- const generated = !req.password;
408
- const password = req.password ?? randomBytes(GENERATED_PASSWORD_BYTES).toString("base64url");
409
- let user;
410
- try {
411
- user = await this.users.createSuperAdmin({
412
- email,
413
- password
414
- });
415
- } catch (err) {
416
- if (isPlatformUserExistsError(err)) {
417
- throw new ConflictException({
418
- code: SETUP_ERROR_CODES.EMAIL_EXISTS,
419
- message: err.message
420
- });
421
- }
422
- throw err;
423
- }
424
- const totp = await this.mfa.setup(user.id, user.email, this.config.mfaIssuer);
425
- const qrDataUrl = await QRCode.toDataURL(totp.otpauthUri, {
426
- width: 220,
427
- margin: 1
428
- });
429
- return {
430
- userId: user.id,
431
- email: user.email,
432
- otpauthUri: totp.otpauthUri,
433
- qrDataUrl,
434
- secret: totp.secret,
435
- ...generated ? {
436
- generatedPassword: password
437
- } : {}
438
- };
439
- }
440
- async confirmMfa(req) {
441
- this.assertToken(req.token);
442
- const ok = await this.mfa.verify({
443
- userId: req.userId,
444
- code: req.code
445
- });
446
- return {
447
- ok
448
- };
449
- }
450
- assertToken(token) {
451
- const expected = process.env[this.config.setupTokenEnvVar]?.trim();
452
- if (!expected) {
453
- throw new ForbiddenException({
454
- code: SETUP_ERROR_CODES.SETUP_DISABLED,
455
- message: `${this.config.setupTokenEnvVar} ist nicht gesetzt \u2014 Setup ist deaktiviert.`
456
- });
457
- }
458
- if (!token || !timingSafeEqualStr(token, expected)) {
459
- throw new UnauthorizedException({
460
- code: SETUP_ERROR_CODES.INVALID_SETUP_TOKEN
461
- });
462
- }
463
- }
464
- async assertNoSuperAdmin() {
465
- if (await this.users.countSuperAdmins() > 0) {
466
- throw new ConflictException({
467
- code: SETUP_ERROR_CODES.SETUP_ALREADY_DONE
468
- });
469
- }
470
- }
471
- };
472
- SetupService = _ts_decorate([
473
- Injectable(),
474
- _ts_param(0, Inject(SETUP_PROVISIONING_PORT_TOKEN)),
475
- _ts_param(1, Inject(SETUP_CONFIG_TOKEN)),
476
- _ts_metadata("design:type", Function),
477
- _ts_metadata("design:paramtypes", [
478
- typeof SuperAdminProvisioningPort === "undefined" ? Object : SuperAdminProvisioningPort,
479
- typeof SetupConfig === "undefined" ? Object : SetupConfig,
480
- typeof MfaService === "undefined" ? Object : MfaService
481
- ])
482
- ], SetupService);
483
-
484
- // src/setup/setup.controller.ts
485
- function _ts_decorate2(decorators, target, key, desc) {
486
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
487
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
488
- 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;
489
- return c > 3 && r && Object.defineProperty(target, key, r), r;
490
- }
491
- __name(_ts_decorate2, "_ts_decorate");
492
- function _ts_metadata2(k, v) {
493
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
494
- }
495
- __name(_ts_metadata2, "_ts_metadata");
496
- function _ts_param2(paramIndex, decorator) {
497
- return function(target, key) {
498
- decorator(target, key, paramIndex);
499
- };
500
- }
501
- __name(_ts_param2, "_ts_param");
502
- var SetupDto = class SetupDto2 {
503
- static {
504
- __name(this, "SetupDto");
505
- }
506
- token;
507
- email;
508
- password;
509
- };
510
- _ts_decorate2([
511
- IsString(),
512
- IsNotEmpty(),
513
- _ts_metadata2("design:type", String)
514
- ], SetupDto.prototype, "token", void 0);
515
- _ts_decorate2([
516
- IsEmail(),
517
- _ts_metadata2("design:type", String)
518
- ], SetupDto.prototype, "email", void 0);
519
- _ts_decorate2([
520
- IsOptional(),
521
- IsString(),
522
- MinLength(8),
523
- _ts_metadata2("design:type", String)
524
- ], SetupDto.prototype, "password", void 0);
525
- var SetupConfirmMfaDto = class SetupConfirmMfaDto2 {
526
- static {
527
- __name(this, "SetupConfirmMfaDto");
528
- }
529
- token;
530
- userId;
531
- code;
532
- };
533
- _ts_decorate2([
534
- IsString(),
535
- IsNotEmpty(),
536
- _ts_metadata2("design:type", String)
537
- ], SetupConfirmMfaDto.prototype, "token", void 0);
538
- _ts_decorate2([
539
- IsString(),
540
- IsNotEmpty(),
541
- _ts_metadata2("design:type", String)
542
- ], SetupConfirmMfaDto.prototype, "userId", void 0);
543
- _ts_decorate2([
544
- IsString(),
545
- IsNotEmpty(),
546
- _ts_metadata2("design:type", String)
547
- ], SetupConfirmMfaDto.prototype, "code", void 0);
548
- var SetupController = class {
549
- static {
550
- __name(this, "SetupController");
551
- }
552
- setup;
553
- constructor(setup) {
554
- this.setup = setup;
555
- }
556
- status() {
557
- return this.setup.status();
558
- }
559
- run(dto) {
560
- return this.setup.setup(dto);
561
- }
562
- confirm(dto) {
563
- return this.setup.confirmMfa(dto);
564
- }
565
- };
566
- _ts_decorate2([
567
- Get("status"),
568
- _ts_metadata2("design:type", Function),
569
- _ts_metadata2("design:paramtypes", []),
570
- _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
571
- ], SetupController.prototype, "status", null);
572
- _ts_decorate2([
573
- Post(),
574
- _ts_param2(0, Body()),
575
- _ts_metadata2("design:type", Function),
576
- _ts_metadata2("design:paramtypes", [
577
- typeof SetupDto === "undefined" ? Object : SetupDto
578
- ]),
579
- _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
580
- ], SetupController.prototype, "run", null);
581
- _ts_decorate2([
582
- Post("confirm-mfa"),
583
- _ts_param2(0, Body()),
584
- _ts_metadata2("design:type", Function),
585
- _ts_metadata2("design:paramtypes", [
586
- typeof SetupConfirmMfaDto === "undefined" ? Object : SetupConfirmMfaDto
587
- ]),
588
- _ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
589
- ], SetupController.prototype, "confirm", null);
590
- SetupController = _ts_decorate2([
591
- Controller("admin/setup"),
592
- _ts_metadata2("design:type", Function),
593
- _ts_metadata2("design:paramtypes", [
594
- typeof SetupService === "undefined" ? Object : SetupService
595
- ])
596
- ], SetupController);
597
-
598
- // src/setup/setup.module.ts
599
- function _ts_decorate3(decorators, target, key, desc) {
600
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
601
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
602
- 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;
603
- return c > 3 && r && Object.defineProperty(target, key, r), r;
604
- }
605
- __name(_ts_decorate3, "_ts_decorate");
606
- var DEFAULT_SETUP_TOKEN_ENV_VAR = "SETUP_TOKEN";
607
- var DEFAULT_MFA_ISSUER = "SuperAdmin";
608
- var SetupModule = class _SetupModule {
609
- static {
610
- __name(this, "SetupModule");
611
- }
612
- static forRoot(options) {
613
- return {
614
- module: _SetupModule,
615
- global: options.global ?? false,
616
- controllers: [
617
- SetupController
618
- ],
619
- providers: [
620
- asProvider(SETUP_PROVISIONING_PORT_TOKEN, options.provisioningPort),
621
- {
622
- provide: SETUP_CONFIG_TOKEN,
623
- useValue: {
624
- setupTokenEnvVar: options.setupTokenEnvVar ?? DEFAULT_SETUP_TOKEN_ENV_VAR,
625
- mfaIssuer: options.mfaIssuer ?? DEFAULT_MFA_ISSUER
626
- }
627
- },
628
- SetupService
629
- ],
630
- exports: [
631
- SetupService
632
- ]
633
- };
634
- }
635
- };
636
- SetupModule = _ts_decorate3([
637
- Module({})
638
- ], SetupModule);
350
+ import "./chunk-SHUYVCID.js";
639
351
  export {
640
352
  ACTIVATION_ORCHESTRATOR_TOKEN,
641
353
  ADMIN_MANIFEST_CONFIG,
354
+ ADMIN_RESOURCES_PORT_TOKEN,
642
355
  ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN,
643
356
  ADVISORY_STRICT_MODE_CODES,
644
357
  AUDIT_CONTEXT_RESOLVER_TOKEN,
@@ -650,6 +363,8 @@ export {
650
363
  AdminManifestService,
651
364
  AdminModule,
652
365
  AdminPublicBootController,
366
+ AdminResourcesModule,
367
+ AdminResourcesService,
653
368
  AdminStatsController,
654
369
  AdminStatsModule,
655
370
  AdminStatsService,
@@ -679,6 +394,7 @@ export {
679
394
  CreateMarketingProjectionDto,
680
395
  CreatePlanDto,
681
396
  CreatePlanVersionDraftDto,
397
+ CreatePromoCodeDto,
682
398
  CreatePromotionDto,
683
399
  CronExpression,
684
400
  DEFINES_QUOTA_KEY,
@@ -811,6 +527,7 @@ export {
811
527
  SubscriptionContractModule,
812
528
  SubscriptionContractService,
813
529
  SuperAdminGuard,
530
+ SuspendTenantDto,
814
531
  SyncDiscoveryDto,
815
532
  TENANT_AUTH_GUARDS_TOKEN,
816
533
  TENANT_ID_RESOLVER_TOKEN,
@@ -833,6 +550,7 @@ export {
833
550
  UpdateMarketingSettingsDto,
834
551
  UpdatePlanDto,
835
552
  UpdatePlanVersionDraftDto,
553
+ UpdatePromoCodeDto,
836
554
  UpdatePromotionDto,
837
555
  VerifyRegistrationOtpDto,
838
556
  addCycles,
@@ -859,6 +577,7 @@ export {
859
577
  buildPlanCatalogImporterController,
860
578
  buildPlanVersionsController,
861
579
  buildPlansController,
580
+ buildPromoCodeAdminController,
862
581
  buildPromotionsController,
863
582
  buildPublicMarketingCatalogController,
864
583
  buildReplacedByIndex,
@@ -0,0 +1,39 @@
1
+ import { Type, CanActivate, DynamicModule, ForwardReference } from '@nestjs/common';
2
+ import { PromoCodeRepository, PromoCodeRedemptionRepository, PromoCodeValidationLogRepository, FirstTimeCustomerCheck, PromoSubscriptionLookup, PromoRevenueDeductionAggregator, TransactionRunner } from '@saasicat/types';
3
+ import { P as ProviderSpec } from './di-CcNeq9v-.cjs';
4
+ import { g as PromoServiceConfig } from './service-DX8KbGXl.cjs';
5
+
6
+ interface PromoCodesModuleOptions {
7
+ promoCodeRepository: ProviderSpec<PromoCodeRepository>;
8
+ redemptionRepository: ProviderSpec<PromoCodeRedemptionRepository>;
9
+ validationLogRepository: ProviderSpec<PromoCodeValidationLogRepository>;
10
+ firstTimeCustomerCheck: ProviderSpec<FirstTimeCustomerCheck>;
11
+ subscriptionLookup: ProviderSpec<PromoSubscriptionLookup>;
12
+ revenueAggregator: ProviderSpec<PromoRevenueDeductionAggregator>;
13
+ transactionRunner: ProviderSpec<TransactionRunner>;
14
+ config?: PromoServiceConfig;
15
+ /**
16
+ * Default `true`. Set to `false` if the consumer wants to disable the cron
17
+ * (e.g. CLI boot, test setups without ScheduleModule).
18
+ */
19
+ includeExpirerCron?: boolean;
20
+ /**
21
+ * Default `true`. Registers `PromoCodePublicController` with
22
+ * `POST /billing/promo/preview`. Set to `false` if the consumer does not
23
+ * want to expose a public preview API (e.g. SuperAdmin-only deploy).
24
+ */
25
+ includePublicController?: boolean;
26
+ /** Mount the standard SuperAdmin CRUD API at `/admin/promo-codes`. */
27
+ adminController?: false | {
28
+ guards: Array<Type<CanActivate>>;
29
+ };
30
+ /** Modules required by adapter factory tokens and admin guards. */
31
+ imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
32
+ /** Register the module globally — default `false`. */
33
+ global?: boolean;
34
+ }
35
+ declare class PromoCodesModule {
36
+ static forRoot(options: PromoCodesModuleOptions): DynamicModule;
37
+ }
38
+
39
+ export { PromoCodesModule as P, type PromoCodesModuleOptions as a };
@@ -0,0 +1,39 @@
1
+ import { Type, CanActivate, DynamicModule, ForwardReference } from '@nestjs/common';
2
+ import { PromoCodeRepository, PromoCodeRedemptionRepository, PromoCodeValidationLogRepository, FirstTimeCustomerCheck, PromoSubscriptionLookup, PromoRevenueDeductionAggregator, TransactionRunner } from '@saasicat/types';
3
+ import { P as ProviderSpec } from './di-CcNeq9v-.js';
4
+ import { g as PromoServiceConfig } from './service-DX8KbGXl.js';
5
+
6
+ interface PromoCodesModuleOptions {
7
+ promoCodeRepository: ProviderSpec<PromoCodeRepository>;
8
+ redemptionRepository: ProviderSpec<PromoCodeRedemptionRepository>;
9
+ validationLogRepository: ProviderSpec<PromoCodeValidationLogRepository>;
10
+ firstTimeCustomerCheck: ProviderSpec<FirstTimeCustomerCheck>;
11
+ subscriptionLookup: ProviderSpec<PromoSubscriptionLookup>;
12
+ revenueAggregator: ProviderSpec<PromoRevenueDeductionAggregator>;
13
+ transactionRunner: ProviderSpec<TransactionRunner>;
14
+ config?: PromoServiceConfig;
15
+ /**
16
+ * Default `true`. Set to `false` if the consumer wants to disable the cron
17
+ * (e.g. CLI boot, test setups without ScheduleModule).
18
+ */
19
+ includeExpirerCron?: boolean;
20
+ /**
21
+ * Default `true`. Registers `PromoCodePublicController` with
22
+ * `POST /billing/promo/preview`. Set to `false` if the consumer does not
23
+ * want to expose a public preview API (e.g. SuperAdmin-only deploy).
24
+ */
25
+ includePublicController?: boolean;
26
+ /** Mount the standard SuperAdmin CRUD API at `/admin/promo-codes`. */
27
+ adminController?: false | {
28
+ guards: Array<Type<CanActivate>>;
29
+ };
30
+ /** Modules required by adapter factory tokens and admin guards. */
31
+ imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
32
+ /** Register the module globally — default `false`. */
33
+ global?: boolean;
34
+ }
35
+ declare class PromoCodesModule {
36
+ static forRoot(options: PromoCodesModuleOptions): DynamicModule;
37
+ }
38
+
39
+ export { PromoCodesModule as P, type PromoCodesModuleOptions as a };