@saasicat/nest 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_entries.cjs +17678 -0
- package/dist/admin/index.cjs +4 -1533
- package/dist/admin/index.d.cts +10 -173
- package/dist/admin/index.d.ts +10 -173
- package/dist/admin/index.js +3 -2
- package/dist/{admin-resources.module-BybEjZs-.d.cts → admin-resources.module-BZN_yBFj.d.cts} +1 -1
- package/dist/{admin-resources.module-CUCLlUAi.d.ts → admin-resources.module-Cms8MY6h.d.ts} +1 -1
- package/dist/admin-stats.module-15ac5KY3.d.ts +201 -0
- package/dist/admin-stats.module-v4SVvWzj.d.cts +201 -0
- package/dist/billing/index.cjs +4 -5130
- package/dist/billing/index.d.cts +8 -437
- package/dist/billing/index.d.ts +8 -437
- package/dist/billing/index.js +4 -4
- package/dist/catalog/index.cjs +4 -5624
- package/dist/catalog/index.d.cts +5 -328
- package/dist/catalog/index.d.ts +5 -328
- package/dist/catalog/index.js +4 -4
- package/dist/checkout-offer/index.cjs +4 -807
- package/dist/checkout-offer/index.d.cts +5 -84
- package/dist/checkout-offer/index.d.ts +5 -84
- package/dist/checkout-offer/index.js +3 -2
- package/dist/checkout-offer.module-Y0hDOVrq.d.ts +85 -0
- package/dist/checkout-offer.module-ZYF5IsDY.d.cts +85 -0
- package/dist/{chunk-PBQRPDO2.js → chunk-33TP26MR.js} +2 -2
- package/dist/{chunk-CK54YKVK.js → chunk-75JABGZK.js} +16 -16
- package/dist/{chunk-HRU3CP57.js → chunk-BOADBIGB.js} +1 -1
- package/dist/chunk-DBZGV3HC.js +0 -0
- package/dist/{chunk-ZLUGQE5D.js → chunk-E7AJ42AB.js} +8 -8
- package/dist/{chunk-HXAWPPFW.js → chunk-F3VV6EXG.js} +9 -9
- package/dist/{chunk-3M6VLT5N.js → chunk-FVT7KTUI.js} +2 -2
- package/dist/{chunk-GW2I3JZD.js → chunk-GBDUH6DO.js} +1 -1
- package/dist/{chunk-K3OPNVFR.js → chunk-HBFU5AN3.js} +5 -9
- package/dist/{chunk-OFBDEO45.js → chunk-IRWZC3GC.js} +1 -1
- package/dist/chunk-L4KTQ6CL.js +20 -0
- package/dist/{chunk-WGVTXSYW.js → chunk-LZHLGUQI.js} +1 -1
- package/dist/{chunk-ZZMAHX22.js → chunk-PUXLPUVH.js} +15 -12
- package/dist/{chunk-7K5PT2LX.js → chunk-TXDH4FUA.js} +1 -1
- package/dist/chunk-UF53DWWR.js +0 -0
- package/dist/{chunk-AJ3EPELS.js → chunk-V34AA7C7.js} +1 -1
- package/dist/chunk-WJ6BMDL3.js +313 -0
- package/dist/{chunk-M6CZQYPY.js → chunk-Z3FWN3HJ.js} +2 -2
- package/dist/discovery/index.cjs +4 -588
- package/dist/discovery/index.js +3 -3
- package/dist/{enforce-quota.interceptor-SqrQVF91.d.cts → enforce-quota.interceptor-BhkX5nq2.d.cts} +35 -2
- package/dist/{enforce-quota.interceptor-B3CL5MSw.d.ts → enforce-quota.interceptor-CcqZc0Yu.d.ts} +35 -2
- package/dist/entitlement/index.cjs +4 -781
- package/dist/entitlement/index.js +2 -2
- package/dist/index.cjs +4 -15671
- package/dist/index.d.cts +21 -56
- package/dist/index.d.ts +21 -56
- package/dist/index.js +39 -334
- package/dist/{module-DeH_Jkcq.d.cts → module-CSN8j8Tp.d.cts} +1 -1
- package/dist/{module-B5m080F0.d.ts → module-DgYJur6f.d.ts} +1 -1
- package/dist/plan-versions.service-BB36Q1bg.d.ts +329 -0
- package/dist/plan-versions.service-CUR2Whyr.d.cts +329 -0
- package/dist/platform/index.cjs +4 -12925
- package/dist/platform/index.d.cts +17 -9
- package/dist/platform/index.d.ts +17 -9
- package/dist/platform/index.js +98 -14
- package/dist/promo/index.cjs +4 -1520
- package/dist/promo/index.d.cts +6 -21
- package/dist/promo/index.d.ts +6 -21
- package/dist/promo/index.js +2 -2
- package/dist/rate-limit.guard-dntqAlfZ.d.cts +19 -0
- package/dist/rate-limit.guard-dntqAlfZ.d.ts +19 -0
- package/dist/registration/index.cjs +4 -1655
- package/dist/registration/index.js +1 -1
- package/dist/{service-DlhMnYjW.d.ts → service-DX8KbGXl.d.cts} +1 -1
- package/dist/{service-DlhMnYjW.d.cts → service-DX8KbGXl.d.ts} +1 -1
- package/dist/setup.service-BPwJ7My_.d.cts +45 -0
- package/dist/setup.service-D2mrdDDB.d.ts +45 -0
- package/dist/subscription-bundle-preview.service-BkJXHAeP.d.cts +438 -0
- package/dist/subscription-bundle-preview.service-DBbrE_cw.d.ts +438 -0
- package/dist/subscription-contract/index.cjs +4 -471
- package/dist/subscription-contract/index.d.cts +5 -13
- package/dist/subscription-contract/index.d.ts +5 -13
- package/dist/subscription-contract.module-CG9fPKAr.d.cts +14 -0
- package/dist/subscription-contract.module-CVebZzHR.d.ts +14 -0
- package/dist/testing/index.cjs +4 -13888
- package/dist/testing/index.d.cts +5 -5
- package/dist/testing/index.d.ts +5 -5
- package/dist/testing/index.js +10 -10
- package/package.json +4 -4
- package/dist/admin-manifest.service-BMeSLRW4.d.ts +0 -33
- package/dist/admin-manifest.service-StAQe6QO.d.cts +0 -33
- package/dist/chunk-N3WANKSA.js +0 -20
package/dist/index.js
CHANGED
|
@@ -37,16 +37,8 @@ import {
|
|
|
37
37
|
resolveModel,
|
|
38
38
|
slugify,
|
|
39
39
|
verifyOtpCode
|
|
40
|
-
} from "./chunk-
|
|
41
|
-
import
|
|
42
|
-
ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN,
|
|
43
|
-
AUDIT_STATS_PORT_TOKEN,
|
|
44
|
-
AdminStatsController,
|
|
45
|
-
AdminStatsModule,
|
|
46
|
-
AdminStatsService,
|
|
47
|
-
PROMO_CODE_STATS_PORT_TOKEN,
|
|
48
|
-
SUBSCRIPTION_STATS_PORT_TOKEN
|
|
49
|
-
} from "./chunk-WGVTXSYW.js";
|
|
40
|
+
} from "./chunk-75JABGZK.js";
|
|
41
|
+
import "./chunk-UF53DWWR.js";
|
|
50
42
|
import {
|
|
51
43
|
formatPreflightReport,
|
|
52
44
|
formatSeedGateReport,
|
|
@@ -55,26 +47,26 @@ import {
|
|
|
55
47
|
runSeedGateFromFile,
|
|
56
48
|
seedGateExitCode,
|
|
57
49
|
validateSeedAgainstSnapshot
|
|
58
|
-
} from "./chunk-
|
|
59
|
-
import
|
|
60
|
-
CHECKOUT_OFFER_REPOSITORY_TOKEN,
|
|
61
|
-
CheckoutOfferModule,
|
|
62
|
-
CheckoutOfferService,
|
|
63
|
-
CreateCheckoutOfferDto,
|
|
64
|
-
UpdateCheckoutOfferDto,
|
|
65
|
-
buildCheckoutOfferController
|
|
66
|
-
} from "./chunk-K3OPNVFR.js";
|
|
50
|
+
} from "./chunk-TXDH4FUA.js";
|
|
51
|
+
import "./chunk-DBZGV3HC.js";
|
|
67
52
|
import {
|
|
68
53
|
DefinesQuota,
|
|
69
54
|
EnforceQuota,
|
|
70
55
|
ImplementsCapability,
|
|
71
56
|
RequiresCapability,
|
|
72
57
|
runHeadlessDiscoveryScan
|
|
73
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-BOADBIGB.js";
|
|
74
59
|
import {
|
|
75
60
|
DiscoverySnapshotNotFoundError,
|
|
76
61
|
loadDiscoverySnapshotFromFile
|
|
77
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";
|
|
78
70
|
import {
|
|
79
71
|
CreatePromoCodeDto,
|
|
80
72
|
PreviewPromoCodeDto,
|
|
@@ -86,7 +78,16 @@ import {
|
|
|
86
78
|
buildPromoCodeAdminController,
|
|
87
79
|
hashIp,
|
|
88
80
|
ipFingerprint
|
|
89
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-IRWZC3GC.js";
|
|
82
|
+
import {
|
|
83
|
+
ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN,
|
|
84
|
+
AUDIT_STATS_PORT_TOKEN,
|
|
85
|
+
AdminStatsController,
|
|
86
|
+
AdminStatsModule,
|
|
87
|
+
AdminStatsService,
|
|
88
|
+
PROMO_CODE_STATS_PORT_TOKEN,
|
|
89
|
+
SUBSCRIPTION_STATS_PORT_TOKEN
|
|
90
|
+
} from "./chunk-LZHLGUQI.js";
|
|
90
91
|
import {
|
|
91
92
|
ADMIN_MANIFEST_CONFIG,
|
|
92
93
|
ADMIN_RESOURCES_PORT_TOKEN,
|
|
@@ -105,7 +106,7 @@ import {
|
|
|
105
106
|
RequireMfa,
|
|
106
107
|
SuperAdminGuard,
|
|
107
108
|
SuspendTenantDto
|
|
108
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-FVT7KTUI.js";
|
|
109
110
|
import {
|
|
110
111
|
CONTRACT_FREEZE_PORT_TOKEN,
|
|
111
112
|
CONTRACT_FREEZE_PROJECT_KEY_TOKEN,
|
|
@@ -166,7 +167,7 @@ import {
|
|
|
166
167
|
periodEndWithMinLead,
|
|
167
168
|
resolveBundleCancelEffectiveAt,
|
|
168
169
|
resolveBundlePriceNet
|
|
169
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-F3VV6EXG.js";
|
|
170
171
|
import {
|
|
171
172
|
PROMO_CODE_REDEMPTION_REPOSITORY_TOKEN,
|
|
172
173
|
PROMO_CODE_REPOSITORY_TOKEN,
|
|
@@ -182,7 +183,7 @@ import {
|
|
|
182
183
|
computeDiscountGross,
|
|
183
184
|
computeDiscountedGross,
|
|
184
185
|
computeRegularStartsAt
|
|
185
|
-
} from "./chunk-
|
|
186
|
+
} from "./chunk-E7AJ42AB.js";
|
|
186
187
|
import {
|
|
187
188
|
SubscriptionContractModule,
|
|
188
189
|
SubscriptionContractService,
|
|
@@ -238,7 +239,7 @@ import {
|
|
|
238
239
|
quotaApprovalSignature,
|
|
239
240
|
validateBundleDraft,
|
|
240
241
|
validatePlanDraft
|
|
241
|
-
} from "./chunk-
|
|
242
|
+
} from "./chunk-33TP26MR.js";
|
|
242
243
|
import {
|
|
243
244
|
AUDIT_CONTEXT_RESOLVER_TOKEN,
|
|
244
245
|
PENDING_PLAN_QUERY_PORT_TOKEN,
|
|
@@ -259,17 +260,25 @@ import {
|
|
|
259
260
|
MFA_PORT_TOKEN,
|
|
260
261
|
RLS_BYPASS_PORT_TOKEN
|
|
261
262
|
} from "./chunk-E56W4U2P.js";
|
|
263
|
+
import {
|
|
264
|
+
CHECKOUT_OFFER_REPOSITORY_TOKEN,
|
|
265
|
+
CheckoutOfferModule,
|
|
266
|
+
CheckoutOfferService,
|
|
267
|
+
CreateCheckoutOfferDto,
|
|
268
|
+
UpdateCheckoutOfferDto,
|
|
269
|
+
buildCheckoutOfferController
|
|
270
|
+
} from "./chunk-HBFU5AN3.js";
|
|
262
271
|
import "./chunk-MDIZUVIK.js";
|
|
263
272
|
import {
|
|
264
273
|
DiscoveryModule,
|
|
265
274
|
buildDiscoveryController
|
|
266
|
-
} from "./chunk-
|
|
275
|
+
} from "./chunk-V34AA7C7.js";
|
|
267
276
|
import {
|
|
268
277
|
DISCOVERY_APP_INFO_TOKEN,
|
|
269
278
|
DISCOVERY_SNAPSHOT_PATH_TOKEN,
|
|
270
279
|
DiscoveryScanner,
|
|
271
280
|
computeSnapshotHash
|
|
272
|
-
} from "./chunk-
|
|
281
|
+
} from "./chunk-Z3FWN3HJ.js";
|
|
273
282
|
import {
|
|
274
283
|
EntitlementModule,
|
|
275
284
|
EntitlementService,
|
|
@@ -290,7 +299,7 @@ import {
|
|
|
290
299
|
isLimitExceededError,
|
|
291
300
|
resolveEntitlementPlan,
|
|
292
301
|
toEffectiveLimitsSnapshot
|
|
293
|
-
} from "./chunk-
|
|
302
|
+
} from "./chunk-GBDUH6DO.js";
|
|
294
303
|
import {
|
|
295
304
|
PLAN_CATALOG_READ_SINK_TOKEN,
|
|
296
305
|
PLAN_CATALOG_TOKEN,
|
|
@@ -327,7 +336,7 @@ import {
|
|
|
327
336
|
MARKETING_SETTINGS_REPOSITORY_TOKEN,
|
|
328
337
|
PLAN_REPOSITORY_TOKEN,
|
|
329
338
|
PROMOTION_REPOSITORY_TOKEN
|
|
330
|
-
} from "./chunk-
|
|
339
|
+
} from "./chunk-L4KTQ6CL.js";
|
|
331
340
|
import {
|
|
332
341
|
asProvider
|
|
333
342
|
} from "./chunk-SABTXESR.js";
|
|
@@ -338,311 +347,7 @@ import {
|
|
|
338
347
|
IMPLEMENTS_CAPABILITY_KEY,
|
|
339
348
|
REQUIRES_CAPABILITY_KEY
|
|
340
349
|
} from "./chunk-L4SUWH5B.js";
|
|
341
|
-
import
|
|
342
|
-
__name
|
|
343
|
-
} from "./chunk-SHUYVCID.js";
|
|
344
|
-
|
|
345
|
-
// src/setup/setup.module.ts
|
|
346
|
-
import { Module } from "@nestjs/common";
|
|
347
|
-
|
|
348
|
-
// src/setup/setup.controller.ts
|
|
349
|
-
import { Body, Controller, Get, Post } from "@nestjs/common";
|
|
350
|
-
import { IsEmail, IsNotEmpty, IsOptional, IsString, MinLength } from "class-validator";
|
|
351
|
-
|
|
352
|
-
// src/setup/setup.service.ts
|
|
353
|
-
import { BadRequestException, ConflictException, ForbiddenException, Inject, Injectable, UnauthorizedException } from "@nestjs/common";
|
|
354
|
-
import { isPlatformUserExistsError, SETUP_ERROR_CODES } from "@saasicat/types";
|
|
355
|
-
import { randomBytes, timingSafeEqual } from "crypto";
|
|
356
|
-
import QRCode from "qrcode";
|
|
357
|
-
|
|
358
|
-
// src/setup/tokens.ts
|
|
359
|
-
var SETUP_PROVISIONING_PORT_TOKEN = /* @__PURE__ */ Symbol.for("saas-platform/SetupProvisioningPort");
|
|
360
|
-
var SETUP_CONFIG_TOKEN = /* @__PURE__ */ Symbol.for("saas-platform/SetupConfig");
|
|
361
|
-
|
|
362
|
-
// src/setup/setup.service.ts
|
|
363
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
364
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
365
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
366
|
-
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;
|
|
367
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
368
|
-
}
|
|
369
|
-
__name(_ts_decorate, "_ts_decorate");
|
|
370
|
-
function _ts_metadata(k, v) {
|
|
371
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
372
|
-
}
|
|
373
|
-
__name(_ts_metadata, "_ts_metadata");
|
|
374
|
-
function _ts_param(paramIndex, decorator) {
|
|
375
|
-
return function(target, key) {
|
|
376
|
-
decorator(target, key, paramIndex);
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
__name(_ts_param, "_ts_param");
|
|
380
|
-
var GENERATED_PASSWORD_BYTES = 12;
|
|
381
|
-
function timingSafeEqualStr(a, b) {
|
|
382
|
-
const ab = Buffer.from(a, "utf8");
|
|
383
|
-
const bb = Buffer.from(b, "utf8");
|
|
384
|
-
if (ab.length !== bb.length) return false;
|
|
385
|
-
return timingSafeEqual(ab, bb);
|
|
386
|
-
}
|
|
387
|
-
__name(timingSafeEqualStr, "timingSafeEqualStr");
|
|
388
|
-
var SetupService = class {
|
|
389
|
-
static {
|
|
390
|
-
__name(this, "SetupService");
|
|
391
|
-
}
|
|
392
|
-
users;
|
|
393
|
-
config;
|
|
394
|
-
mfa;
|
|
395
|
-
constructor(users, config, mfa) {
|
|
396
|
-
this.users = users;
|
|
397
|
-
this.config = config;
|
|
398
|
-
this.mfa = mfa;
|
|
399
|
-
}
|
|
400
|
-
async status() {
|
|
401
|
-
return {
|
|
402
|
-
needsSetup: await this.users.countSuperAdmins() === 0
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
async setup(req) {
|
|
406
|
-
this.assertToken(req.token);
|
|
407
|
-
await this.assertNoSuperAdmin();
|
|
408
|
-
const email = req.email.trim().toLowerCase();
|
|
409
|
-
if (!email.includes("@")) {
|
|
410
|
-
throw new BadRequestException({
|
|
411
|
-
code: SETUP_ERROR_CODES.INVALID_EMAIL
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
const generated = !req.password;
|
|
415
|
-
const password = req.password ?? randomBytes(GENERATED_PASSWORD_BYTES).toString("base64url");
|
|
416
|
-
let user;
|
|
417
|
-
try {
|
|
418
|
-
user = await this.users.createSuperAdmin({
|
|
419
|
-
email,
|
|
420
|
-
password
|
|
421
|
-
});
|
|
422
|
-
} catch (err) {
|
|
423
|
-
if (isPlatformUserExistsError(err)) {
|
|
424
|
-
throw new ConflictException({
|
|
425
|
-
code: SETUP_ERROR_CODES.EMAIL_EXISTS,
|
|
426
|
-
message: err.message
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
throw err;
|
|
430
|
-
}
|
|
431
|
-
const totp = await this.mfa.setup(user.id, user.email, this.config.mfaIssuer);
|
|
432
|
-
const qrDataUrl = await QRCode.toDataURL(totp.otpauthUri, {
|
|
433
|
-
width: 220,
|
|
434
|
-
margin: 1
|
|
435
|
-
});
|
|
436
|
-
return {
|
|
437
|
-
userId: user.id,
|
|
438
|
-
email: user.email,
|
|
439
|
-
otpauthUri: totp.otpauthUri,
|
|
440
|
-
qrDataUrl,
|
|
441
|
-
secret: totp.secret,
|
|
442
|
-
...generated ? {
|
|
443
|
-
generatedPassword: password
|
|
444
|
-
} : {}
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
async confirmMfa(req) {
|
|
448
|
-
this.assertToken(req.token);
|
|
449
|
-
const ok = await this.mfa.verify({
|
|
450
|
-
userId: req.userId,
|
|
451
|
-
code: req.code
|
|
452
|
-
});
|
|
453
|
-
return {
|
|
454
|
-
ok
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
assertToken(token) {
|
|
458
|
-
const expected = process.env[this.config.setupTokenEnvVar]?.trim();
|
|
459
|
-
if (!expected) {
|
|
460
|
-
throw new ForbiddenException({
|
|
461
|
-
code: SETUP_ERROR_CODES.SETUP_DISABLED,
|
|
462
|
-
message: `${this.config.setupTokenEnvVar} ist nicht gesetzt \u2014 Setup ist deaktiviert.`
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
if (!token || !timingSafeEqualStr(token, expected)) {
|
|
466
|
-
throw new UnauthorizedException({
|
|
467
|
-
code: SETUP_ERROR_CODES.INVALID_SETUP_TOKEN
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
async assertNoSuperAdmin() {
|
|
472
|
-
if (await this.users.countSuperAdmins() > 0) {
|
|
473
|
-
throw new ConflictException({
|
|
474
|
-
code: SETUP_ERROR_CODES.SETUP_ALREADY_DONE
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
};
|
|
479
|
-
SetupService = _ts_decorate([
|
|
480
|
-
Injectable(),
|
|
481
|
-
_ts_param(0, Inject(SETUP_PROVISIONING_PORT_TOKEN)),
|
|
482
|
-
_ts_param(1, Inject(SETUP_CONFIG_TOKEN)),
|
|
483
|
-
_ts_metadata("design:type", Function),
|
|
484
|
-
_ts_metadata("design:paramtypes", [
|
|
485
|
-
typeof SuperAdminProvisioningPort === "undefined" ? Object : SuperAdminProvisioningPort,
|
|
486
|
-
typeof SetupConfig === "undefined" ? Object : SetupConfig,
|
|
487
|
-
typeof MfaService === "undefined" ? Object : MfaService
|
|
488
|
-
])
|
|
489
|
-
], SetupService);
|
|
490
|
-
|
|
491
|
-
// src/setup/setup.controller.ts
|
|
492
|
-
function _ts_decorate2(decorators, target, key, desc) {
|
|
493
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
494
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
495
|
-
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;
|
|
496
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
497
|
-
}
|
|
498
|
-
__name(_ts_decorate2, "_ts_decorate");
|
|
499
|
-
function _ts_metadata2(k, v) {
|
|
500
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
501
|
-
}
|
|
502
|
-
__name(_ts_metadata2, "_ts_metadata");
|
|
503
|
-
function _ts_param2(paramIndex, decorator) {
|
|
504
|
-
return function(target, key) {
|
|
505
|
-
decorator(target, key, paramIndex);
|
|
506
|
-
};
|
|
507
|
-
}
|
|
508
|
-
__name(_ts_param2, "_ts_param");
|
|
509
|
-
var SetupDto = class SetupDto2 {
|
|
510
|
-
static {
|
|
511
|
-
__name(this, "SetupDto");
|
|
512
|
-
}
|
|
513
|
-
token;
|
|
514
|
-
email;
|
|
515
|
-
password;
|
|
516
|
-
};
|
|
517
|
-
_ts_decorate2([
|
|
518
|
-
IsString(),
|
|
519
|
-
IsNotEmpty(),
|
|
520
|
-
_ts_metadata2("design:type", String)
|
|
521
|
-
], SetupDto.prototype, "token", void 0);
|
|
522
|
-
_ts_decorate2([
|
|
523
|
-
IsEmail(),
|
|
524
|
-
_ts_metadata2("design:type", String)
|
|
525
|
-
], SetupDto.prototype, "email", void 0);
|
|
526
|
-
_ts_decorate2([
|
|
527
|
-
IsOptional(),
|
|
528
|
-
IsString(),
|
|
529
|
-
MinLength(8),
|
|
530
|
-
_ts_metadata2("design:type", String)
|
|
531
|
-
], SetupDto.prototype, "password", void 0);
|
|
532
|
-
var SetupConfirmMfaDto = class SetupConfirmMfaDto2 {
|
|
533
|
-
static {
|
|
534
|
-
__name(this, "SetupConfirmMfaDto");
|
|
535
|
-
}
|
|
536
|
-
token;
|
|
537
|
-
userId;
|
|
538
|
-
code;
|
|
539
|
-
};
|
|
540
|
-
_ts_decorate2([
|
|
541
|
-
IsString(),
|
|
542
|
-
IsNotEmpty(),
|
|
543
|
-
_ts_metadata2("design:type", String)
|
|
544
|
-
], SetupConfirmMfaDto.prototype, "token", void 0);
|
|
545
|
-
_ts_decorate2([
|
|
546
|
-
IsString(),
|
|
547
|
-
IsNotEmpty(),
|
|
548
|
-
_ts_metadata2("design:type", String)
|
|
549
|
-
], SetupConfirmMfaDto.prototype, "userId", void 0);
|
|
550
|
-
_ts_decorate2([
|
|
551
|
-
IsString(),
|
|
552
|
-
IsNotEmpty(),
|
|
553
|
-
_ts_metadata2("design:type", String)
|
|
554
|
-
], SetupConfirmMfaDto.prototype, "code", void 0);
|
|
555
|
-
var SetupController = class {
|
|
556
|
-
static {
|
|
557
|
-
__name(this, "SetupController");
|
|
558
|
-
}
|
|
559
|
-
setup;
|
|
560
|
-
constructor(setup) {
|
|
561
|
-
this.setup = setup;
|
|
562
|
-
}
|
|
563
|
-
status() {
|
|
564
|
-
return this.setup.status();
|
|
565
|
-
}
|
|
566
|
-
run(dto) {
|
|
567
|
-
return this.setup.setup(dto);
|
|
568
|
-
}
|
|
569
|
-
confirm(dto) {
|
|
570
|
-
return this.setup.confirmMfa(dto);
|
|
571
|
-
}
|
|
572
|
-
};
|
|
573
|
-
_ts_decorate2([
|
|
574
|
-
Get("status"),
|
|
575
|
-
_ts_metadata2("design:type", Function),
|
|
576
|
-
_ts_metadata2("design:paramtypes", []),
|
|
577
|
-
_ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
578
|
-
], SetupController.prototype, "status", null);
|
|
579
|
-
_ts_decorate2([
|
|
580
|
-
Post(),
|
|
581
|
-
_ts_param2(0, Body()),
|
|
582
|
-
_ts_metadata2("design:type", Function),
|
|
583
|
-
_ts_metadata2("design:paramtypes", [
|
|
584
|
-
typeof SetupDto === "undefined" ? Object : SetupDto
|
|
585
|
-
]),
|
|
586
|
-
_ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
587
|
-
], SetupController.prototype, "run", null);
|
|
588
|
-
_ts_decorate2([
|
|
589
|
-
Post("confirm-mfa"),
|
|
590
|
-
_ts_param2(0, Body()),
|
|
591
|
-
_ts_metadata2("design:type", Function),
|
|
592
|
-
_ts_metadata2("design:paramtypes", [
|
|
593
|
-
typeof SetupConfirmMfaDto === "undefined" ? Object : SetupConfirmMfaDto
|
|
594
|
-
]),
|
|
595
|
-
_ts_metadata2("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
596
|
-
], SetupController.prototype, "confirm", null);
|
|
597
|
-
SetupController = _ts_decorate2([
|
|
598
|
-
Controller("admin/setup"),
|
|
599
|
-
_ts_metadata2("design:type", Function),
|
|
600
|
-
_ts_metadata2("design:paramtypes", [
|
|
601
|
-
typeof SetupService === "undefined" ? Object : SetupService
|
|
602
|
-
])
|
|
603
|
-
], SetupController);
|
|
604
|
-
|
|
605
|
-
// src/setup/setup.module.ts
|
|
606
|
-
function _ts_decorate3(decorators, target, key, desc) {
|
|
607
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
608
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
609
|
-
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;
|
|
610
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
611
|
-
}
|
|
612
|
-
__name(_ts_decorate3, "_ts_decorate");
|
|
613
|
-
var DEFAULT_SETUP_TOKEN_ENV_VAR = "SETUP_TOKEN";
|
|
614
|
-
var DEFAULT_MFA_ISSUER = "SuperAdmin";
|
|
615
|
-
var SetupModule = class _SetupModule {
|
|
616
|
-
static {
|
|
617
|
-
__name(this, "SetupModule");
|
|
618
|
-
}
|
|
619
|
-
static forRoot(options) {
|
|
620
|
-
return {
|
|
621
|
-
module: _SetupModule,
|
|
622
|
-
global: options.global ?? false,
|
|
623
|
-
controllers: [
|
|
624
|
-
SetupController
|
|
625
|
-
],
|
|
626
|
-
providers: [
|
|
627
|
-
asProvider(SETUP_PROVISIONING_PORT_TOKEN, options.provisioningPort),
|
|
628
|
-
{
|
|
629
|
-
provide: SETUP_CONFIG_TOKEN,
|
|
630
|
-
useValue: {
|
|
631
|
-
setupTokenEnvVar: options.setupTokenEnvVar ?? DEFAULT_SETUP_TOKEN_ENV_VAR,
|
|
632
|
-
mfaIssuer: options.mfaIssuer ?? DEFAULT_MFA_ISSUER
|
|
633
|
-
}
|
|
634
|
-
},
|
|
635
|
-
SetupService
|
|
636
|
-
],
|
|
637
|
-
exports: [
|
|
638
|
-
SetupService
|
|
639
|
-
]
|
|
640
|
-
};
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
SetupModule = _ts_decorate3([
|
|
644
|
-
Module({})
|
|
645
|
-
], SetupModule);
|
|
350
|
+
import "./chunk-SHUYVCID.js";
|
|
646
351
|
export {
|
|
647
352
|
ACTIVATION_ORCHESTRATOR_TOKEN,
|
|
648
353
|
ADMIN_MANIFEST_CONFIG,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Type, CanActivate, DynamicModule, ForwardReference } from '@nestjs/common';
|
|
2
2
|
import { PromoCodeRepository, PromoCodeRedemptionRepository, PromoCodeValidationLogRepository, FirstTimeCustomerCheck, PromoSubscriptionLookup, PromoRevenueDeductionAggregator, TransactionRunner } from '@saasicat/types';
|
|
3
3
|
import { P as ProviderSpec } from './di-CcNeq9v-.cjs';
|
|
4
|
-
import {
|
|
4
|
+
import { g as PromoServiceConfig } from './service-DX8KbGXl.cjs';
|
|
5
5
|
|
|
6
6
|
interface PromoCodesModuleOptions {
|
|
7
7
|
promoCodeRepository: ProviderSpec<PromoCodeRepository>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Type, CanActivate, DynamicModule, ForwardReference } from '@nestjs/common';
|
|
2
2
|
import { PromoCodeRepository, PromoCodeRedemptionRepository, PromoCodeValidationLogRepository, FirstTimeCustomerCheck, PromoSubscriptionLookup, PromoRevenueDeductionAggregator, TransactionRunner } from '@saasicat/types';
|
|
3
3
|
import { P as ProviderSpec } from './di-CcNeq9v-.js';
|
|
4
|
-
import {
|
|
4
|
+
import { g as PromoServiceConfig } from './service-DX8KbGXl.js';
|
|
5
5
|
|
|
6
6
|
interface PromoCodesModuleOptions {
|
|
7
7
|
promoCodeRepository: ProviderSpec<PromoCodeRepository>;
|