@vritti/api-sdk 0.0.5 → 0.0.6
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/index.cjs +18 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -821,6 +821,7 @@ MessageTenantContextInterceptor = _ts_decorate7([
|
|
|
821
821
|
|
|
822
822
|
// src/database/interceptors/tenant-context.interceptor.ts
|
|
823
823
|
import { Injectable as Injectable6, Logger as Logger4, Scope as Scope5, UnauthorizedException as UnauthorizedException3 } from "@nestjs/common";
|
|
824
|
+
import { Reflector as Reflector2 } from "@nestjs/core";
|
|
824
825
|
function _ts_decorate8(decorators, target, key, desc) {
|
|
825
826
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
826
827
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -836,11 +837,13 @@ var TenantContextInterceptor = class _TenantContextInterceptor {
|
|
|
836
837
|
static {
|
|
837
838
|
__name(this, "TenantContextInterceptor");
|
|
838
839
|
}
|
|
840
|
+
reflector;
|
|
839
841
|
tenantContext;
|
|
840
842
|
primaryDatabase;
|
|
841
843
|
requestService;
|
|
842
844
|
logger = new Logger4(_TenantContextInterceptor.name);
|
|
843
|
-
constructor(tenantContext, primaryDatabase, requestService) {
|
|
845
|
+
constructor(reflector, tenantContext, primaryDatabase, requestService) {
|
|
846
|
+
this.reflector = reflector;
|
|
844
847
|
this.tenantContext = tenantContext;
|
|
845
848
|
this.primaryDatabase = primaryDatabase;
|
|
846
849
|
this.requestService = requestService;
|
|
@@ -848,8 +851,16 @@ var TenantContextInterceptor = class _TenantContextInterceptor {
|
|
|
848
851
|
async intercept(context, next) {
|
|
849
852
|
const request = context.switchToHttp().getRequest();
|
|
850
853
|
this.logger.debug(`Processing request: ${request.method} ${request.url}`);
|
|
854
|
+
const isPublic = this.reflector.getAllAndOverride("isPublic", [
|
|
855
|
+
context.getHandler(),
|
|
856
|
+
context.getClass()
|
|
857
|
+
]);
|
|
851
858
|
try {
|
|
852
859
|
const tenantIdentifier = this.requestService.getTenantIdentifier();
|
|
860
|
+
if (isPublic && !tenantIdentifier) {
|
|
861
|
+
this.logger.debug("Public endpoint without tenant identifier, skipping tenant context setup");
|
|
862
|
+
return next.handle();
|
|
863
|
+
}
|
|
853
864
|
if (!tenantIdentifier) {
|
|
854
865
|
throw new UnauthorizedException3("Tenant identifier not found in request");
|
|
855
866
|
}
|
|
@@ -884,6 +895,7 @@ TenantContextInterceptor = _ts_decorate8([
|
|
|
884
895
|
}),
|
|
885
896
|
_ts_metadata5("design:type", Function),
|
|
886
897
|
_ts_metadata5("design:paramtypes", [
|
|
898
|
+
typeof Reflector2 === "undefined" ? Object : Reflector2,
|
|
887
899
|
typeof TenantContextService === "undefined" ? Object : TenantContextService,
|
|
888
900
|
typeof PrimaryDatabaseService === "undefined" ? Object : PrimaryDatabaseService,
|
|
889
901
|
typeof RequestService === "undefined" ? Object : RequestService
|
|
@@ -1769,7 +1781,7 @@ import { Module as Module4 } from "@nestjs/common";
|
|
|
1769
1781
|
|
|
1770
1782
|
// src/http/guards/csrf.guard.ts
|
|
1771
1783
|
import { ForbiddenException, Injectable as Injectable8, Logger as Logger8 } from "@nestjs/common";
|
|
1772
|
-
import { Reflector as
|
|
1784
|
+
import { Reflector as Reflector3 } from "@nestjs/core";
|
|
1773
1785
|
function _ts_decorate11(decorators, target, key, desc) {
|
|
1774
1786
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1775
1787
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1836,7 +1848,7 @@ CsrfGuard = _ts_decorate11([
|
|
|
1836
1848
|
Injectable8(),
|
|
1837
1849
|
_ts_metadata7("design:type", Function),
|
|
1838
1850
|
_ts_metadata7("design:paramtypes", [
|
|
1839
|
-
typeof
|
|
1851
|
+
typeof Reflector3 === "undefined" ? Object : Reflector3
|
|
1840
1852
|
])
|
|
1841
1853
|
], CsrfGuard);
|
|
1842
1854
|
|