@saasicat/nest 0.18.0 → 0.19.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 +1309 -519
- package/dist/admin/index.js +1 -1
- package/dist/billing/index.d.cts +7 -4
- package/dist/billing/index.d.ts +7 -4
- package/dist/billing/index.js +6 -6
- package/dist/catalog/index.js +4 -4
- package/dist/checkout-offer/index.js +2 -2
- package/dist/{chunk-Z3FWN3HJ.js → chunk-5ZXBXYXU.js} +3 -3
- package/dist/{chunk-RZVSKKXX.js → chunk-6WA4X5U3.js} +46 -45
- package/dist/{chunk-V34AA7C7.js → chunk-6WL6VQ7Z.js} +1 -1
- package/dist/{chunk-ABB2CRAS.js → chunk-74SCJ4HF.js} +1 -1
- package/dist/{chunk-PLJEAUFU.js → chunk-7JIHG53V.js} +76 -39
- package/dist/{chunk-7RRWI5LH.js → chunk-AFK2IE2L.js} +10 -10
- package/dist/{chunk-32EMXPU2.js → chunk-B7NRY2LV.js} +48 -17
- package/dist/{chunk-MDIZUVIK.js → chunk-BSK6YBLI.js} +1 -1
- package/dist/{chunk-R2QOSVAA.js → chunk-DQKCK7DX.js} +1 -1
- package/dist/{chunk-GLLCB4BP.js → chunk-EUU3B6NB.js} +17 -13
- package/dist/{chunk-EXOLOJFZ.js → chunk-F6DCLVBB.js} +29 -8
- package/dist/{chunk-5KH2O4SF.js → chunk-I77VS3YH.js} +287 -105
- package/dist/{chunk-YITTE646.js → chunk-KUDKD7ZG.js} +34 -14
- package/dist/{chunk-P3DP6GJE.js → chunk-LXUBCLRK.js} +486 -160
- package/dist/{chunk-GJBXOCRZ.js → chunk-ORWIGSNN.js} +45 -17
- package/dist/{chunk-E7AJ42AB.js → chunk-QLJHIIOY.js} +168 -28
- package/dist/{chunk-BOADBIGB.js → chunk-YYUXKLXK.js} +2 -2
- package/dist/{define-saasicat-Rc0rXrYG.d.ts → define-saasicat-CqkhnHn-.d.ts} +1 -1
- package/dist/{define-saasicat-CeDBX9ji.d.cts → define-saasicat-D8c6Bs4T.d.cts} +1 -1
- package/dist/discovery/index.d.cts +2 -2
- package/dist/discovery/index.d.ts +2 -2
- package/dist/discovery/index.js +4 -4
- package/dist/{enforce-quota.interceptor-DMw-bPyk.d.cts → enforce-quota.interceptor-Dk0eEtzV.d.cts} +1 -1
- package/dist/{enforce-quota.interceptor-CmbWX39L.d.ts → enforce-quota.interceptor-Dp8wTYro.d.ts} +1 -1
- package/dist/entitlement/index.js +2 -2
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +17 -17
- package/dist/{module-DgYJur6f.d.ts → module-BwD-wAor.d.ts} +1 -1
- package/dist/{module-CSN8j8Tp.d.cts → module-DsDkbawm.d.cts} +1 -1
- package/dist/platform/index.d.cts +8 -8
- package/dist/platform/index.d.ts +8 -8
- package/dist/platform/index.js +13 -13
- package/dist/promo/index.d.cts +3 -3
- package/dist/promo/index.d.ts +3 -3
- package/dist/promo/index.js +3 -3
- package/dist/registration/index.js +1 -1
- package/dist/{saas-platform.module-DLhoqKNA.d.ts → saas-platform.module-BQmrDGVU.d.ts} +1 -1
- package/dist/{saas-platform.module-D3rUTiho.d.cts → saas-platform.module-DducnQ9s.d.cts} +1 -1
- package/dist/{service-DX8KbGXl.d.cts → service-DPZ2W1E-.d.cts} +2 -2
- package/dist/{service-DX8KbGXl.d.ts → service-DPZ2W1E-.d.ts} +2 -2
- package/dist/subscription-contract/index.js +2 -2
- package/dist/{tenant-billing.controller-BwZRnJ3q.d.ts → tenant-billing.controller-b1G1yB09.d.ts} +2 -2
- package/dist/{tenant-billing.controller-CG4CaFUP.d.cts → tenant-billing.controller-m42YQ_Ei.d.cts} +2 -2
- package/dist/testing/index.d.cts +5 -5
- package/dist/testing/index.d.ts +5 -5
- package/dist/testing/index.js +33 -33
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PromoCodesModule
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EUU3B6NB.js";
|
|
4
4
|
import {
|
|
5
5
|
AdminManifestModule,
|
|
6
6
|
AdminManifestService,
|
|
@@ -9,36 +9,36 @@ import {
|
|
|
9
9
|
AdminStatsModule,
|
|
10
10
|
MfaService,
|
|
11
11
|
SuperAdminGuard
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7JIHG53V.js";
|
|
13
13
|
import {
|
|
14
14
|
PublicCatalogModule,
|
|
15
15
|
REQUIRE_FEATURE_KEY,
|
|
16
16
|
SubscriptionBundleModule,
|
|
17
17
|
TenantBillingModule
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-I77VS3YH.js";
|
|
19
19
|
import {
|
|
20
20
|
SubscriptionContractModule
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-B7NRY2LV.js";
|
|
22
22
|
import {
|
|
23
23
|
CatalogModule
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-LXUBCLRK.js";
|
|
25
25
|
import {
|
|
26
26
|
CheckoutOfferModule
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-ORWIGSNN.js";
|
|
28
28
|
import {
|
|
29
29
|
SaaSiCatPublicRoute
|
|
30
30
|
} from "./chunk-YSC46BGM.js";
|
|
31
31
|
import {
|
|
32
32
|
DiscoveryModule
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-6WL6VQ7Z.js";
|
|
34
34
|
import {
|
|
35
35
|
EntitlementModule,
|
|
36
36
|
LimitExceededError
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-F6DCLVBB.js";
|
|
38
38
|
import {
|
|
39
39
|
PLAN_CATALOG_TOKEN,
|
|
40
40
|
PlanCatalogModule
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-DQKCK7DX.js";
|
|
42
42
|
import {
|
|
43
43
|
asProvider
|
|
44
44
|
} from "./chunk-SABTXESR.js";
|
|
@@ -157,7 +157,10 @@ var SetupService = class {
|
|
|
157
157
|
if (!expected) {
|
|
158
158
|
throw new ForbiddenException({
|
|
159
159
|
code: SETUP_ERROR_CODES.SETUP_DISABLED,
|
|
160
|
-
message: `${this.config.setupTokenEnvVar}
|
|
160
|
+
message: `${this.config.setupTokenEnvVar} is not set \u2014 setup is disabled.`,
|
|
161
|
+
params: {
|
|
162
|
+
envVar: this.config.setupTokenEnvVar
|
|
163
|
+
}
|
|
161
164
|
});
|
|
162
165
|
}
|
|
163
166
|
if (!token || !timingSafeEqualStr(token, expected)) {
|
|
@@ -448,6 +451,7 @@ StaticEntitlementService = _ts_decorate4([
|
|
|
448
451
|
// src/platform/static-feature.guard.ts
|
|
449
452
|
import { ForbiddenException as ForbiddenException2, Inject as Inject3, Injectable as Injectable3, Optional } from "@nestjs/common";
|
|
450
453
|
import { Reflector } from "@nestjs/core";
|
|
454
|
+
import { AUTH_ERROR_CODES, FEATURE_NOT_LICENSED } from "@saasicat/types";
|
|
451
455
|
function _ts_decorate5(decorators, target, key, desc) {
|
|
452
456
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
453
457
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -486,15 +490,31 @@ var StaticFeatureGuard = class {
|
|
|
486
490
|
if (!required || required.length === 0) return true;
|
|
487
491
|
const request = context.switchToHttp().getRequest();
|
|
488
492
|
const user = request.user;
|
|
489
|
-
if (!user)
|
|
493
|
+
if (!user) {
|
|
494
|
+
throw new ForbiddenException2({
|
|
495
|
+
code: AUTH_ERROR_CODES.NOT_AUTHENTICATED,
|
|
496
|
+
message: "Not authenticated"
|
|
497
|
+
});
|
|
498
|
+
}
|
|
490
499
|
const role = this.config?.userRoleResolver ? this.config.userRoleResolver(user) : user.role ?? user.platformRole;
|
|
491
500
|
if (role === "SUPER_ADMIN") return true;
|
|
492
501
|
const tenantId = this.config?.tenantIdResolver ? this.config.tenantIdResolver(request) : request.tenantId ?? user.tenantId;
|
|
493
|
-
if (!tenantId)
|
|
502
|
+
if (!tenantId) {
|
|
503
|
+
throw new ForbiddenException2({
|
|
504
|
+
code: AUTH_ERROR_CODES.NO_TENANT_ASSIGNED,
|
|
505
|
+
message: "No tenant assigned"
|
|
506
|
+
});
|
|
507
|
+
}
|
|
494
508
|
const snap = await this.entitlements.snapshot(tenantId);
|
|
495
509
|
const allowed = required.some((f) => snap.features.includes(f));
|
|
496
510
|
if (!allowed) {
|
|
497
|
-
throw new ForbiddenException2(
|
|
511
|
+
throw new ForbiddenException2({
|
|
512
|
+
code: FEATURE_NOT_LICENSED,
|
|
513
|
+
message: `Feature ${required.join(" / ")} is not included in the current plan.`,
|
|
514
|
+
params: {
|
|
515
|
+
featureKeys: required
|
|
516
|
+
}
|
|
517
|
+
});
|
|
498
518
|
}
|
|
499
519
|
return true;
|
|
500
520
|
}
|
|
@@ -737,7 +757,7 @@ function buildTenantManifestController(options) {
|
|
|
737
757
|
async get(req) {
|
|
738
758
|
const tenantId = req.user?.tenantId ?? req.tenantId;
|
|
739
759
|
if (!tenantId) {
|
|
740
|
-
throw new Error("
|
|
760
|
+
throw new Error("No tenant on the request \u2014 TenantManifest requires user.tenantId.");
|
|
741
761
|
}
|
|
742
762
|
return this.svc.getManifest(tenantId);
|
|
743
763
|
}
|