@vritti/api-sdk 0.2.4 → 0.2.5

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 CHANGED
@@ -43,6 +43,7 @@ __export(index_exports, {
43
43
  CookieDomain: () => CookieDomain,
44
44
  CorrelationIdMiddleware: () => CorrelationIdMiddleware,
45
45
  CreateDataTableViewDto: () => CreateDataTableViewDto,
46
+ CreateResponseDto: () => CreateResponseDto,
46
47
  DATA_TABLE_VIEWS_TABLE: () => DATA_TABLE_VIEWS_TABLE,
47
48
  DEFAULT_CORRELATION_HEADER: () => DEFAULT_CORRELATION_HEADER,
48
49
  DataTableModule: () => DataTableModule,
@@ -58,6 +59,8 @@ __export(index_exports, {
58
59
  HttpExceptionFilter: () => HttpExceptionFilter,
59
60
  HttpLoggerInterceptor: () => HttpLoggerInterceptor,
60
61
  HttpProblemException: () => HttpProblemException,
62
+ ImportResponseDto: () => ImportResponseDto,
63
+ ImportSummaryDto: () => ImportSummaryDto,
61
64
  InternalServerErrorException: () => InternalServerErrorException,
62
65
  JwtAuthService: () => JwtAuthService,
63
66
  LOGGER_MODULE_OPTIONS: () => LOGGER_MODULE_OPTIONS,
@@ -67,30 +70,26 @@ __export(index_exports, {
67
70
  NotAcceptableException: () => NotAcceptableException,
68
71
  NotFoundException: () => NotFoundException,
69
72
  NotImplementedException: () => NotImplementedException,
70
- Onboarding: () => Onboarding,
71
73
  PayloadTooLargeException: () => PayloadTooLargeException,
72
74
  PrimaryBaseRepository: () => PrimaryBaseRepository,
73
75
  PrimaryDatabaseService: () => PrimaryDatabaseService,
74
76
  Public: () => Public,
75
- RESET_KEY: () => RESET_KEY,
77
+ REQUIRE_SESSION_KEY: () => REQUIRE_SESSION_KEY,
76
78
  RedisCacheProvider: () => RedisCacheProvider,
77
79
  RefreshCookieOptions: () => RefreshCookieOptions,
78
80
  RefreshTokenCookie: () => RefreshTokenCookie,
79
81
  RenameDataTableViewDto: () => RenameDataTableViewDto,
80
82
  RequestTimeoutException: () => RequestTimeoutException,
81
- Reset: () => Reset,
83
+ RequireSession: () => RequireSession,
82
84
  RootModule: () => RootModule,
83
85
  SKIP_CSRF_KEY: () => SKIP_CSRF_KEY,
84
86
  SelectOptionsQueryDto: () => SelectOptionsQueryDto,
85
87
  ServiceUnavailableException: () => ServiceUnavailableException,
86
88
  SessionData: () => SessionData,
87
89
  SkipCsrf: () => SkipCsrf,
90
+ Subdomain: () => Subdomain,
88
91
  SuccessResponseDto: () => SuccessResponseDto,
89
92
  TableResponseDto: () => TableResponseDto,
90
- Tenant: () => Tenant,
91
- TenantBaseRepository: () => TenantBaseRepository,
92
- TenantContextService: () => TenantContextService,
93
- TenantDatabaseService: () => TenantDatabaseService,
94
93
  ToggleShareDataTableViewDto: () => ToggleShareDataTableViewDto,
95
94
  TokenType: () => TokenType,
96
95
  TooManyRequestsException: () => TooManyRequestsException,
@@ -98,8 +97,10 @@ __export(index_exports, {
98
97
  UnprocessableEntityException: () => UnprocessableEntityException,
99
98
  UnsupportedMediaTypeException: () => UnsupportedMediaTypeException,
100
99
  UpdateDataTableViewDto: () => UpdateDataTableViewDto,
100
+ UploadedFile: () => UploadedFile,
101
101
  UpsertDataTableStateDto: () => UpsertDataTableStateDto,
102
102
  UserId: () => UserId,
103
+ ValidatedRowDto: () => ValidatedRowDto,
103
104
  ValidationException: () => ValidationException,
104
105
  VrittiAuthGuard: () => VrittiAuthGuard,
105
106
  addCorrelationIdToResponse: () => addCorrelationIdToResponse,
@@ -130,7 +131,7 @@ module.exports = __toCommonJS(index_exports);
130
131
 
131
132
  // src/auth/auth-config.module.ts
132
133
  var import_common26 = require("@nestjs/common");
133
- var import_config4 = require("@nestjs/config");
134
+ var import_config5 = require("@nestjs/config");
134
135
  var import_core3 = require("@nestjs/core");
135
136
  var import_jwt4 = require("@nestjs/jwt");
136
137
 
@@ -378,7 +379,10 @@ var defaultConfig = {
378
379
  guard: {
379
380
  tenantHeaderName: "x-tenant-id",
380
381
  authHeaderName: "authorization",
381
- tokenPrefix: "Bearer"
382
+ tokenPrefix: "Bearer",
383
+ defaultSessionTypes: [
384
+ "CLOUD"
385
+ ]
382
386
  }
383
387
  };
384
388
  var currentConfig = {
@@ -566,10 +570,10 @@ var import_config2 = require("@nestjs/config");
566
570
  var import_core2 = require("@nestjs/core");
567
571
  var import_jwt = require("@nestjs/jwt");
568
572
 
569
- // src/auth/decorators/reset.decorator.ts
573
+ // src/auth/decorators/require-session.decorator.ts
570
574
  var import_common22 = require("@nestjs/common");
571
- var RESET_KEY = "isReset";
572
- var Reset = /* @__PURE__ */ __name(() => (0, import_common22.SetMetadata)(RESET_KEY, true), "Reset");
575
+ var REQUIRE_SESSION_KEY = "requiredSessionTypes";
576
+ var RequireSession = /* @__PURE__ */ __name((...types) => (0, import_common22.SetMetadata)(REQUIRE_SESSION_KEY, types), "RequireSession");
573
577
 
574
578
  // src/auth/decorators/skip-csrf.decorator.ts
575
579
  var import_common23 = require("@nestjs/common");
@@ -633,17 +637,13 @@ var VrittiAuthGuard = class _VrittiAuthGuard {
633
637
  if (isPublic) {
634
638
  return true;
635
639
  }
636
- const isOnboarding = this.reflector.getAllAndOverride("isOnboarding", [
637
- context.getHandler(),
638
- context.getClass()
639
- ]);
640
- const isReset = this.reflector.getAllAndOverride(RESET_KEY, [
640
+ const requiredSessionTypes = this.reflector.getAllAndOverride(REQUIRE_SESSION_KEY, [
641
641
  context.getHandler(),
642
642
  context.getClass()
643
643
  ]);
644
644
  const isSseEndpoint = this.reflector.get(import_constants.SSE_METADATA, context.getHandler());
645
645
  if (isSseEndpoint) {
646
- return this.handleSseAuth(request, isOnboarding);
646
+ return this.handleSseAuth(request, requiredSessionTypes);
647
647
  }
648
648
  try {
649
649
  const accessToken = this.requestService.getAccessToken();
@@ -655,14 +655,10 @@ var VrittiAuthGuard = class _VrittiAuthGuard {
655
655
  throw new import_common24.UnauthorizedException("Invalid token type");
656
656
  }
657
657
  this.validateRefreshTokenBinding(decodedAccessToken);
658
- if (isOnboarding && decodedAccessToken.sessionType !== "ONBOARDING") {
659
- throw new import_common24.UnauthorizedException("This endpoint requires an onboarding session");
660
- }
661
- if (isReset && decodedAccessToken.sessionType !== "RESET") {
662
- throw new import_common24.UnauthorizedException("This endpoint requires a reset session");
663
- }
664
- if (!isOnboarding && !isReset && (decodedAccessToken.sessionType === "ONBOARDING" || decodedAccessToken.sessionType === "RESET")) {
665
- throw new import_common24.UnauthorizedException(`${decodedAccessToken.sessionType} sessions cannot access this endpoint`);
658
+ const sessionType = decodedAccessToken.sessionType;
659
+ const allowed = requiredSessionTypes ?? getConfig().guard.defaultSessionTypes;
660
+ if (!allowed.includes(sessionType)) {
661
+ throw new import_common24.UnauthorizedException(`${sessionType} sessions cannot access this endpoint`);
666
662
  }
667
663
  request.sessionInfo = {
668
664
  userId: decodedAccessToken.userId,
@@ -711,7 +707,7 @@ var VrittiAuthGuard = class _VrittiAuthGuard {
711
707
  }
712
708
  }
713
709
  // Authenticates SSE connections using the refresh token httpOnly cookie
714
- handleSseAuth(request, isOnboarding) {
710
+ handleSseAuth(request, requiredSessionTypes) {
715
711
  const refreshToken = this.requestService.getRefreshToken();
716
712
  if (!refreshToken) {
717
713
  throw new import_common24.UnauthorizedException("Authentication required");
@@ -725,8 +721,9 @@ var VrittiAuthGuard = class _VrittiAuthGuard {
725
721
  if (decoded.tokenType !== "refresh") {
726
722
  throw new import_common24.UnauthorizedException("Invalid token type");
727
723
  }
728
- if (isOnboarding && decoded.sessionType !== "ONBOARDING") {
729
- throw new import_common24.UnauthorizedException("This endpoint requires an onboarding session");
724
+ const allowed = requiredSessionTypes ?? getConfig().guard.defaultSessionTypes;
725
+ if (!allowed.includes(decoded.sessionType)) {
726
+ throw new import_common24.UnauthorizedException(`${decoded.sessionType} sessions cannot access this endpoint`);
730
727
  }
731
728
  request.sessionInfo = {
732
729
  userId: decoded.userId,
@@ -790,7 +787,7 @@ VrittiAuthGuard = _ts_decorate3([
790
787
 
791
788
  // src/auth/services/jwt-auth.service.ts
792
789
  var import_common25 = require("@nestjs/common");
793
- var import_config3 = require("@nestjs/config");
790
+ var import_config4 = require("@nestjs/config");
794
791
  var import_jwt2 = require("@nestjs/jwt");
795
792
 
796
793
  // src/utils/time.utils.ts
@@ -906,7 +903,7 @@ JwtAuthService = _ts_decorate4([
906
903
  _ts_metadata3("design:type", Function),
907
904
  _ts_metadata3("design:paramtypes", [
908
905
  typeof import_jwt2.JwtService === "undefined" ? Object : import_jwt2.JwtService,
909
- typeof import_config3.ConfigService === "undefined" ? Object : import_config3.ConfigService
906
+ typeof import_config4.ConfigService === "undefined" ? Object : import_config4.ConfigService
910
907
  ])
911
908
  ], JwtAuthService);
912
909
 
@@ -927,14 +924,14 @@ var AuthConfigModule = class _AuthConfigModule {
927
924
  return {
928
925
  module: _AuthConfigModule,
929
926
  imports: [
930
- import_config4.ConfigModule,
927
+ import_config5.ConfigModule,
931
928
  RequestModule,
932
929
  import_jwt4.JwtModule.registerAsync({
933
930
  imports: [
934
- import_config4.ConfigModule
931
+ import_config5.ConfigModule
935
932
  ],
936
933
  inject: [
937
- import_config4.ConfigService
934
+ import_config5.ConfigService
938
935
  ],
939
936
  useFactory: /* @__PURE__ */ __name((config) => ({
940
937
  secret: config.get("JWT_SECRET"),
@@ -988,17 +985,13 @@ var CookieDomain = (0, import_common28.createParamDecorator)((_data, ctx) => {
988
985
  return domain.endsWith(`.${baseDomain}`) ? domain : baseDomain;
989
986
  });
990
987
 
991
- // src/auth/decorators/onboarding.decorator.ts
992
- var import_common29 = require("@nestjs/common");
993
- var Onboarding = /* @__PURE__ */ __name(() => (0, import_common29.SetMetadata)("isOnboarding", true), "Onboarding");
994
-
995
988
  // src/auth/decorators/public.decorator.ts
996
- var import_common30 = require("@nestjs/common");
997
- var Public = /* @__PURE__ */ __name(() => (0, import_common30.SetMetadata)("isPublic", true), "Public");
989
+ var import_common29 = require("@nestjs/common");
990
+ var Public = /* @__PURE__ */ __name(() => (0, import_common29.SetMetadata)("isPublic", true), "Public");
998
991
 
999
992
  // src/auth/decorators/refresh-cookie-options.decorator.ts
1000
- var import_common31 = require("@nestjs/common");
1001
- var RefreshCookieOptions = (0, import_common31.createParamDecorator)((_data, ctx) => {
993
+ var import_common30 = require("@nestjs/common");
994
+ var RefreshCookieOptions = (0, import_common30.createParamDecorator)((_data, ctx) => {
1002
995
  const request = ctx.switchToHttp().getRequest();
1003
996
  const forwarded = request.headers["x-forwarded-host"];
1004
997
  const raw = Array.isArray(forwarded) ? forwarded[0] : forwarded;
@@ -1008,14 +1001,32 @@ var RefreshCookieOptions = (0, import_common31.createParamDecorator)((_data, ctx
1008
1001
  });
1009
1002
 
1010
1003
  // src/auth/decorators/refresh-token-cookie.decorator.ts
1011
- var import_common32 = require("@nestjs/common");
1012
- var RefreshTokenCookie = (0, import_common32.createParamDecorator)((_data, ctx) => {
1004
+ var import_common31 = require("@nestjs/common");
1005
+ var RefreshTokenCookie = (0, import_common31.createParamDecorator)((_data, ctx) => {
1013
1006
  const request = ctx.switchToHttp().getRequest();
1014
1007
  const cookies = request.cookies ?? {};
1015
1008
  const config = getConfig();
1016
1009
  return cookies[config.cookie.refreshCookieName];
1017
1010
  });
1018
1011
 
1012
+ // src/auth/decorators/subdomain.decorator.ts
1013
+ var import_common32 = require("@nestjs/common");
1014
+ var Subdomain = (0, import_common32.createParamDecorator)((_data, ctx) => {
1015
+ const request = ctx.switchToHttp().getRequest();
1016
+ const origin = request.headers.origin;
1017
+ if (origin) {
1018
+ try {
1019
+ const url = new URL(origin);
1020
+ return url.hostname.split(".")[0];
1021
+ } catch {
1022
+ }
1023
+ }
1024
+ const forwarded = request.headers["x-forwarded-host"];
1025
+ const host = Array.isArray(forwarded) ? forwarded[0] : forwarded;
1026
+ if (host) return host.split(".")[0];
1027
+ return void 0;
1028
+ });
1029
+
1019
1030
  // src/auth/decorators/session-data.decorator.ts
1020
1031
  var import_common33 = require("@nestjs/common");
1021
1032
  var SessionData = (0, import_common33.createParamDecorator)((_data, ctx) => {
@@ -1044,7 +1055,7 @@ var UserId = (0, import_common34.createParamDecorator)((_data, ctx) => {
1044
1055
 
1045
1056
  // src/cache/cache.module.ts
1046
1057
  var import_common37 = require("@nestjs/common");
1047
- var import_config9 = require("@nestjs/config");
1058
+ var import_config10 = require("@nestjs/config");
1048
1059
 
1049
1060
  // src/cache/cache.service.ts
1050
1061
  var import_common35 = require("@nestjs/common");
@@ -1134,7 +1145,7 @@ CacheService = _ts_decorate6([
1134
1145
 
1135
1146
  // src/cache/providers/redis.provider.ts
1136
1147
  var import_common36 = require("@nestjs/common");
1137
- var import_config8 = require("@nestjs/config");
1148
+ var import_config9 = require("@nestjs/config");
1138
1149
  var import_ioredis = __toESM(require("ioredis"), 1);
1139
1150
  function _ts_decorate7(decorators, target, key, desc2) {
1140
1151
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
@@ -1209,7 +1220,7 @@ RedisCacheProvider = _ts_decorate7([
1209
1220
  (0, import_common36.Injectable)(),
1210
1221
  _ts_metadata5("design:type", Function),
1211
1222
  _ts_metadata5("design:paramtypes", [
1212
- typeof import_config8.ConfigService === "undefined" ? Object : import_config8.ConfigService
1223
+ typeof import_config9.ConfigService === "undefined" ? Object : import_config9.ConfigService
1213
1224
  ])
1214
1225
  ], RedisCacheProvider);
1215
1226
 
@@ -1229,7 +1240,7 @@ var CacheModule = class {
1229
1240
  CacheModule = _ts_decorate8([
1230
1241
  (0, import_common37.Module)({
1231
1242
  imports: [
1232
- import_config9.ConfigModule
1243
+ import_config10.ConfigModule
1233
1244
  ],
1234
1245
  providers: [
1235
1246
  RedisCacheProvider,
@@ -1248,7 +1259,7 @@ CacheModule = _ts_decorate8([
1248
1259
  ], CacheModule);
1249
1260
 
1250
1261
  // src/database/database.module.ts
1251
- var import_common41 = require("@nestjs/common");
1262
+ var import_common39 = require("@nestjs/common");
1252
1263
  var import_core4 = require("@nestjs/core");
1253
1264
 
1254
1265
  // src/database/constants.ts
@@ -1256,7 +1267,6 @@ var DATABASE_MODULE_OPTIONS = Symbol("DATABASE_MODULE_OPTIONS");
1256
1267
 
1257
1268
  // src/database/services/primary-database.service.ts
1258
1269
  var import_common38 = require("@nestjs/common");
1259
- var import_drizzle_orm = require("drizzle-orm");
1260
1270
  var import_node_postgres = require("drizzle-orm/node-postgres");
1261
1271
  var import_pg = require("pg");
1262
1272
  function _ts_decorate9(decorators, target, key, desc2) {
@@ -1284,11 +1294,8 @@ var PrimaryDatabaseService = class _PrimaryDatabaseService {
1284
1294
  logger = new import_common38.Logger(_PrimaryDatabaseService.name);
1285
1295
  pool = null;
1286
1296
  db = null;
1287
- tenantConfigCache = /* @__PURE__ */ new Map();
1288
- cacheTTL;
1289
1297
  constructor(options) {
1290
1298
  this.options = options;
1291
- this.cacheTTL = options.connectionCacheTTL || 3e5;
1292
1299
  }
1293
1300
  async onModuleInit() {
1294
1301
  if (this.options.primaryDb) {
@@ -1309,7 +1316,6 @@ var PrimaryDatabaseService = class _PrimaryDatabaseService {
1309
1316
  ssl: sslMode === "disable" ? false : {
1310
1317
  rejectUnauthorized: sslMode !== "no-verify"
1311
1318
  },
1312
- // Pass schema as a PostgreSQL startup option — recognized by node-postgres, unlike the ?schema= URL param
1313
1319
  ...schema && {
1314
1320
  options: `-csearch_path=${schema}`
1315
1321
  }
@@ -1326,84 +1332,10 @@ var PrimaryDatabaseService = class _PrimaryDatabaseService {
1326
1332
  this.logger.log(`Connected to primary database (schema: ${schema ?? "public"})`);
1327
1333
  } catch (error) {
1328
1334
  this.logger.error("Failed to connect to primary database", error);
1329
- throw new import_common38.InternalServerErrorException("Failed to initialize tenant registry");
1335
+ throw new import_common38.InternalServerErrorException("Failed to initialize database connection");
1330
1336
  }
1331
1337
  }
1332
- // Retrieves tenant configuration by ID or subdomain, with in-memory caching
1333
- async getTenantInfo(tenantIdentifier) {
1334
- const cached = this.tenantConfigCache.get(tenantIdentifier);
1335
- if (cached) {
1336
- this.logger.debug(`Cache hit for tenant: ${tenantIdentifier}`);
1337
- return cached;
1338
- }
1339
- try {
1340
- if (!this.db) {
1341
- throw new Error("Primary database client not initialized");
1342
- }
1343
- this.logger.debug(`Querying primary database for tenant: ${tenantIdentifier}`);
1344
- const schema = this.options.drizzleSchema;
1345
- const { tenants, tenantDatabaseConfigs } = schema;
1346
- const result = await this.db.select().from(tenants).leftJoin(tenantDatabaseConfigs, (0, import_drizzle_orm.eq)(tenants.id, tenantDatabaseConfigs.tenantId)).where((0, import_drizzle_orm.or)((0, import_drizzle_orm.eq)(tenants.id, tenantIdentifier), (0, import_drizzle_orm.eq)(tenants.subdomain, tenantIdentifier))).limit(1);
1347
- if (!result.length) {
1348
- this.logger.warn(`Tenant not found: ${tenantIdentifier}`);
1349
- return null;
1350
- }
1351
- const row = result[0];
1352
- const tenant = row.tenants;
1353
- const config = row.tenant_database_configs;
1354
- if (tenant.status !== "ACTIVE") {
1355
- this.logger.warn(`Tenant not active: ${tenantIdentifier}`);
1356
- return null;
1357
- }
1358
- const info = {
1359
- id: tenant.id,
1360
- subdomain: tenant.subdomain,
1361
- type: tenant.dbType,
1362
- status: tenant.status,
1363
- // For SHARED tenants: schema name
1364
- schemaName: config?.dbSchema || void 0,
1365
- // For DEDICATED tenants: database configuration from TenantDatabaseConfig table
1366
- databaseName: config?.dbName || void 0,
1367
- databaseHost: config?.dbHost || void 0,
1368
- databasePort: config?.dbPort || void 0,
1369
- databaseUsername: config?.dbUsername ? this.decrypt(config.dbUsername) : void 0,
1370
- databasePassword: config?.dbPassword ? this.decrypt(config.dbPassword) : void 0,
1371
- databaseSslMode: config?.dbSslMode || void 0,
1372
- connectionPoolSize: config?.connectionPoolSize || void 0
1373
- };
1374
- this.cacheInfo(info);
1375
- return info;
1376
- } catch (error) {
1377
- this.logger.error(`Failed to fetch tenant info: ${tenantIdentifier}`, error);
1378
- throw new import_common38.InternalServerErrorException("Failed to resolve tenant");
1379
- }
1380
- }
1381
- // Caches tenant info by both ID and subdomain with TTL expiration
1382
- cacheInfo(info) {
1383
- this.tenantConfigCache.set(info.id, info);
1384
- this.tenantConfigCache.set(info.subdomain, info);
1385
- setTimeout(() => {
1386
- this.tenantConfigCache.delete(info.id);
1387
- this.tenantConfigCache.delete(info.subdomain);
1388
- this.logger.debug(`Cache expired for tenant: ${info.subdomain}`);
1389
- }, this.cacheTTL);
1390
- }
1391
- // Clears cached tenant info for the given ID or subdomain
1392
- clearTenantCache(tenantIdentifier) {
1393
- const config = this.tenantConfigCache.get(tenantIdentifier);
1394
- if (config) {
1395
- this.tenantConfigCache.delete(config.id);
1396
- this.tenantConfigCache.delete(config.subdomain);
1397
- this.logger.log(`Cleared cache for tenant: ${tenantIdentifier}`);
1398
- }
1399
- }
1400
- // Clears all cached tenant configurations
1401
- clearAllCaches() {
1402
- const size = this.tenantConfigCache.size;
1403
- this.tenantConfigCache.clear();
1404
- this.logger.log(`Cleared ${size} cached tenant configs`);
1405
- }
1406
- // Returns the initialized Drizzle client, throwing if not yet initialized
1338
+ // Returns the initialized Drizzle client
1407
1339
  get drizzleClient() {
1408
1340
  if (!this.db) {
1409
1341
  throw new Error("Primary database client not initialized");
@@ -1414,10 +1346,6 @@ var PrimaryDatabaseService = class _PrimaryDatabaseService {
1414
1346
  get schema() {
1415
1347
  return this.options.drizzleSchema;
1416
1348
  }
1417
- // Decrypts a database credential value (placeholder for actual decryption)
1418
- decrypt(encrypted) {
1419
- return encrypted;
1420
- }
1421
1349
  async onModuleDestroy() {
1422
1350
  if (this.pool) {
1423
1351
  await this.pool.end();
@@ -1434,8 +1362,7 @@ PrimaryDatabaseService = _ts_decorate9([
1434
1362
  ])
1435
1363
  ], PrimaryDatabaseService);
1436
1364
 
1437
- // src/database/services/tenant-context.service.ts
1438
- var import_common39 = require("@nestjs/common");
1365
+ // src/database/database.module.ts
1439
1366
  function _ts_decorate10(decorators, target, key, desc2) {
1440
1367
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
1441
1368
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
@@ -1443,52 +1370,63 @@ function _ts_decorate10(decorators, target, key, desc2) {
1443
1370
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1444
1371
  }
1445
1372
  __name(_ts_decorate10, "_ts_decorate");
1446
- var TenantContextService = class {
1373
+ var DatabaseModule = class _DatabaseModule {
1447
1374
  static {
1448
- __name(this, "TenantContextService");
1449
- }
1450
- tenantInfo = null;
1451
- // Sets tenant info for this request, throwing if already set to prevent overwrites
1452
- setTenant(tenantInfo) {
1453
- if (this.tenantInfo) {
1454
- throw new Error("Tenant context already set for this request");
1455
- }
1456
- this.tenantInfo = tenantInfo;
1457
- }
1458
- // Returns the tenant info for this request, throwing if context is not set
1459
- getTenant() {
1460
- if (!this.tenantInfo) {
1461
- throw new import_common39.UnauthorizedException("Tenant context not set");
1462
- }
1463
- return this.tenantInfo;
1464
- }
1465
- // Returns true if tenant context has been set for this request
1466
- hasTenant() {
1467
- return this.tenantInfo !== null;
1468
- }
1469
- // Clears the tenant context (useful for RabbitMQ message handler cleanup)
1470
- clearTenant() {
1471
- this.tenantInfo = null;
1472
- }
1473
- // Returns the tenant ID or null if context is not set
1474
- getTenantIdSafe() {
1475
- return this.tenantInfo?.id ?? null;
1375
+ __name(this, "DatabaseModule");
1476
1376
  }
1477
- // Returns the tenant subdomain or null if context is not set
1478
- getTenantSubdomainSafe() {
1479
- return this.tenantInfo?.subdomain ?? null;
1377
+ // Configures the database module with a single primary connection
1378
+ static forServer(options) {
1379
+ const asyncProvider = {
1380
+ provide: DATABASE_MODULE_OPTIONS,
1381
+ useFactory: options.useFactory,
1382
+ inject: options.inject || []
1383
+ };
1384
+ return {
1385
+ module: _DatabaseModule,
1386
+ imports: [
1387
+ RequestModule
1388
+ ],
1389
+ providers: [
1390
+ {
1391
+ provide: import_core4.Reflector,
1392
+ useClass: import_core4.Reflector
1393
+ },
1394
+ asyncProvider,
1395
+ PrimaryDatabaseService
1396
+ ],
1397
+ exports: [
1398
+ PrimaryDatabaseService,
1399
+ asyncProvider
1400
+ ]
1401
+ };
1480
1402
  }
1481
1403
  };
1482
- TenantContextService = _ts_decorate10([
1483
- (0, import_common39.Injectable)({
1484
- scope: import_common39.Scope.REQUEST
1485
- })
1486
- ], TenantContextService);
1404
+ DatabaseModule = _ts_decorate10([
1405
+ (0, import_common39.Global)(),
1406
+ (0, import_common39.Module)({})
1407
+ ], DatabaseModule);
1487
1408
 
1488
- // src/database/services/tenant-database.service.ts
1409
+ // src/decorators/uploaded-file.decorator.ts
1489
1410
  var import_common40 = require("@nestjs/common");
1490
- var import_node_postgres2 = require("drizzle-orm/node-postgres");
1491
- var import_pg2 = require("pg");
1411
+ var UploadedFile = (0, import_common40.createParamDecorator)(async (_data, ctx) => {
1412
+ const request = ctx.switchToHttp().getRequest();
1413
+ const file = await request.file();
1414
+ if (!file) {
1415
+ throw new BadRequestException({
1416
+ label: "File Required",
1417
+ detail: "Please attach a file to your request."
1418
+ });
1419
+ }
1420
+ const buffer = await file.toBuffer();
1421
+ return {
1422
+ buffer,
1423
+ filename: file.filename,
1424
+ mimetype: file.mimetype
1425
+ };
1426
+ });
1427
+
1428
+ // src/database/dto/create-response.dto.ts
1429
+ var import_swagger = require("@nestjs/swagger");
1492
1430
  function _ts_decorate11(decorators, target, key, desc2) {
1493
1431
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
1494
1432
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
@@ -1500,161 +1438,33 @@ function _ts_metadata7(k, v) {
1500
1438
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1501
1439
  }
1502
1440
  __name(_ts_metadata7, "_ts_metadata");
1503
- function _ts_param4(paramIndex, decorator) {
1504
- return function(target, key) {
1505
- decorator(target, key, paramIndex);
1506
- };
1507
- }
1508
- __name(_ts_param4, "_ts_param");
1509
- var TenantDatabaseService = class _TenantDatabaseService {
1441
+ var CreateResponseDto = class {
1510
1442
  static {
1511
- __name(this, "TenantDatabaseService");
1512
- }
1513
- options;
1514
- tenantContext;
1515
- logger = new import_common40.Logger(_TenantDatabaseService.name);
1516
- clients = /* @__PURE__ */ new Map();
1517
- clientLastUsed = /* @__PURE__ */ new Map();
1518
- cleanupInterval;
1519
- constructor(options, tenantContext) {
1520
- this.options = options;
1521
- this.tenantContext = tenantContext;
1522
- this.startConnectionCleaner();
1523
- }
1524
- // Returns the Drizzle client scoped to the current tenant's database
1525
- get drizzleClient() {
1526
- return this.getDbClient();
1527
- }
1528
- // Returns the Drizzle schema passed in module options
1529
- get schema() {
1530
- return this.options.drizzleSchema;
1531
- }
1532
- // Returns a cached or new Drizzle client for the current tenant context
1533
- getDbClient() {
1534
- const tenant = this.tenantContext.getTenant();
1535
- const cacheKey = this.buildCacheKey(tenant);
1536
- const existing = this.clients.get(cacheKey);
1537
- if (existing) {
1538
- this.clientLastUsed.set(cacheKey, Date.now());
1539
- this.logger.debug(`Reusing cached connection: ${cacheKey}`);
1540
- return existing.db;
1541
- }
1542
- this.logger.log(`Creating new database connection: ${cacheKey}`);
1543
- const connection = this.createDbClientSync(tenant);
1544
- this.clients.set(cacheKey, connection);
1545
- this.clientLastUsed.set(cacheKey, Date.now());
1546
- return connection.db;
1547
- }
1548
- // Creates a new pool and Drizzle client for the given tenant
1549
- createDbClientSync(tenant) {
1550
- try {
1551
- const databaseUrl = this.buildTenantDbUrl(tenant);
1552
- const pool = new import_pg2.Pool({
1553
- connectionString: databaseUrl,
1554
- max: tenant.connectionPoolSize || this.options.maxConnections || 10
1555
- });
1556
- const db = (0, import_node_postgres2.drizzle)({
1557
- client: pool,
1558
- schema: this.options.drizzleSchema
1559
- });
1560
- this.logger.log(`Connected to database for tenant: ${tenant.subdomain}`);
1561
- return {
1562
- pool,
1563
- db
1564
- };
1565
- } catch (error) {
1566
- this.logger.error(`Failed to create database connection for tenant: ${tenant.subdomain}`, error);
1567
- throw new import_common40.InternalServerErrorException("Failed to connect to tenant database");
1568
- }
1569
- }
1570
- // Builds the PostgreSQL connection URL for a dedicated tenant database
1571
- buildTenantDbUrl(tenant) {
1572
- const { databaseHost, databasePort, databaseName, databaseUsername, databasePassword, databaseSslMode } = tenant;
1573
- if (!databaseHost || !databaseName || !databaseUsername) {
1574
- throw new Error(`Tenant ${tenant.subdomain} missing database configuration`);
1575
- }
1576
- const port = databasePort || 5432;
1577
- const sslMode = databaseSslMode || "require";
1578
- const connectionUrl = `postgresql://${databaseUsername}:${encodeURIComponent(databasePassword || "")}@${databaseHost}:${port}/${databaseName}?sslmode=${sslMode}`;
1579
- this.logger.debug(`Tenant connection URL: ${this.maskPassword(connectionUrl)}`);
1580
- return connectionUrl;
1581
- }
1582
- // Builds a cache key for connection pooling from tenant database coordinates
1583
- buildCacheKey(tenant) {
1584
- return `${tenant.type}:${tenant.databaseName}@${tenant.databaseHost}`;
1585
- }
1586
- // Starts a periodic interval to close idle database connections
1587
- startConnectionCleaner() {
1588
- const interval = this.options.connectionCacheTTL || 3e5;
1589
- this.cleanupInterval = setInterval(() => {
1590
- this.cleanupIdleConnections();
1591
- }, interval);
1592
- this.logger.log(`Connection cleanup scheduled every ${interval / 1e3} seconds`);
1593
- }
1594
- // Closes and removes connections that have been idle beyond the TTL
1595
- async cleanupIdleConnections() {
1596
- const now = Date.now();
1597
- const maxIdle = this.options.connectionCacheTTL || 3e5;
1598
- let cleaned = 0;
1599
- for (const [key, lastUsed] of this.clientLastUsed.entries()) {
1600
- if (now - lastUsed > maxIdle) {
1601
- const connection = this.clients.get(key);
1602
- if (connection) {
1603
- try {
1604
- await connection.pool.end();
1605
- this.logger.debug(`Cleaned up idle connection: ${key}`);
1606
- } catch (error) {
1607
- this.logger.error(`Error disconnecting idle client: ${key}`, error);
1608
- }
1609
- this.clients.delete(key);
1610
- this.clientLastUsed.delete(key);
1611
- cleaned++;
1612
- }
1613
- }
1614
- }
1615
- if (cleaned > 0) {
1616
- this.logger.log(`Cleaned up ${cleaned} idle connections`);
1617
- }
1618
- }
1619
- // Returns the current number of active pooled connections and their tenant keys
1620
- getPoolStats() {
1621
- return {
1622
- activeConnections: this.clients.size,
1623
- tenants: Array.from(this.clients.keys())
1624
- };
1625
- }
1626
- // Masks password in connection URL for safe logging
1627
- maskPassword(url) {
1628
- return url.replace(/:([^@]+)@/, ":****@");
1629
- }
1630
- async onModuleDestroy() {
1631
- if (this.cleanupInterval) {
1632
- clearInterval(this.cleanupInterval);
1633
- }
1634
- this.logger.log(`Disconnecting ${this.clients.size} database connections`);
1635
- const disconnectPromises = Array.from(this.clients.entries()).map(async ([key, connection]) => {
1636
- try {
1637
- await connection.pool.end();
1638
- this.logger.debug(`Disconnected: ${key}`);
1639
- } catch (error) {
1640
- this.logger.error(`Error disconnecting client: ${key}`, error);
1641
- }
1642
- });
1643
- await Promise.all(disconnectPromises);
1644
- this.logger.log("All database connections closed");
1443
+ __name(this, "CreateResponseDto");
1645
1444
  }
1445
+ success;
1446
+ message;
1447
+ data;
1646
1448
  };
1647
- TenantDatabaseService = _ts_decorate11([
1648
- (0, import_common40.Injectable)(),
1649
- _ts_param4(0, (0, import_common40.Inject)(DATABASE_MODULE_OPTIONS)),
1650
- _ts_metadata7("design:type", Function),
1651
- _ts_metadata7("design:paramtypes", [
1652
- typeof DatabaseModuleOptions === "undefined" ? Object : DatabaseModuleOptions,
1653
- typeof TenantContextService === "undefined" ? Object : TenantContextService
1654
- ])
1655
- ], TenantDatabaseService);
1656
-
1657
- // src/database/database.module.ts
1449
+ _ts_decorate11([
1450
+ (0, import_swagger.ApiProperty)({
1451
+ example: true
1452
+ }),
1453
+ _ts_metadata7("design:type", Boolean)
1454
+ ], CreateResponseDto.prototype, "success", void 0);
1455
+ _ts_decorate11([
1456
+ (0, import_swagger.ApiProperty)({
1457
+ example: "Resource created successfully"
1458
+ }),
1459
+ _ts_metadata7("design:type", String)
1460
+ ], CreateResponseDto.prototype, "message", void 0);
1461
+ _ts_decorate11([
1462
+ (0, import_swagger.ApiProperty)(),
1463
+ _ts_metadata7("design:type", typeof T === "undefined" ? Object : T)
1464
+ ], CreateResponseDto.prototype, "data", void 0);
1465
+
1466
+ // src/database/dto/import-response.dto.ts
1467
+ var import_swagger2 = require("@nestjs/swagger");
1658
1468
  function _ts_decorate12(decorators, target, key, desc2) {
1659
1469
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
1660
1470
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
@@ -1662,69 +1472,133 @@ function _ts_decorate12(decorators, target, key, desc2) {
1662
1472
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1663
1473
  }
1664
1474
  __name(_ts_decorate12, "_ts_decorate");
1665
- var DatabaseModule = class _DatabaseModule {
1475
+ function _ts_metadata8(k, v) {
1476
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1477
+ }
1478
+ __name(_ts_metadata8, "_ts_metadata");
1479
+ var ValidatedRowDto = class {
1666
1480
  static {
1667
- __name(this, "DatabaseModule");
1481
+ __name(this, "ValidatedRowDto");
1668
1482
  }
1669
- // Configures the module for gateway/HTTP mode with TenantContextInterceptor
1670
- static forServer(options) {
1671
- return _DatabaseModule.createDynamicModule(options, "server");
1672
- }
1673
- // Configures the module for microservice mode with MessageTenantContextInterceptor
1674
- static forMicroservice(options) {
1675
- return _DatabaseModule.createDynamicModule(options, "microservice");
1676
- }
1677
- // Creates the dynamic module configuration with the appropriate interceptor for the given mode
1678
- static createDynamicModule(options, mode) {
1679
- const asyncProvider = {
1680
- provide: DATABASE_MODULE_OPTIONS,
1681
- useFactory: options.useFactory,
1682
- inject: options.inject || []
1683
- };
1684
- const providers = [
1685
- // Required for external packages - NestJS global Reflector not available
1686
- {
1687
- provide: import_core4.Reflector,
1688
- useClass: import_core4.Reflector
1689
- },
1690
- asyncProvider,
1691
- TenantContextService,
1692
- PrimaryDatabaseService,
1693
- TenantDatabaseService
1694
- ];
1695
- return {
1696
- module: _DatabaseModule,
1697
- imports: [
1698
- RequestModule
1699
- ],
1700
- providers,
1701
- exports: [
1702
- TenantDatabaseService,
1703
- TenantContextService,
1704
- PrimaryDatabaseService,
1705
- asyncProvider
1706
- ]
1707
- };
1483
+ index;
1484
+ data;
1485
+ valid;
1486
+ errors;
1487
+ };
1488
+ _ts_decorate12([
1489
+ (0, import_swagger2.ApiProperty)({
1490
+ example: 1
1491
+ }),
1492
+ _ts_metadata8("design:type", Number)
1493
+ ], ValidatedRowDto.prototype, "index", void 0);
1494
+ _ts_decorate12([
1495
+ (0, import_swagger2.ApiProperty)({
1496
+ example: {
1497
+ code: "products",
1498
+ name: "Products"
1499
+ }
1500
+ }),
1501
+ _ts_metadata8("design:type", typeof Record === "undefined" ? Object : Record)
1502
+ ], ValidatedRowDto.prototype, "data", void 0);
1503
+ _ts_decorate12([
1504
+ (0, import_swagger2.ApiProperty)({
1505
+ example: true
1506
+ }),
1507
+ _ts_metadata8("design:type", Boolean)
1508
+ ], ValidatedRowDto.prototype, "valid", void 0);
1509
+ _ts_decorate12([
1510
+ (0, import_swagger2.ApiProperty)({
1511
+ example: [
1512
+ "Code already exists"
1513
+ ]
1514
+ }),
1515
+ _ts_metadata8("design:type", Array)
1516
+ ], ValidatedRowDto.prototype, "errors", void 0);
1517
+ var ImportSummaryDto = class {
1518
+ static {
1519
+ __name(this, "ImportSummaryDto");
1708
1520
  }
1521
+ total;
1522
+ valid;
1523
+ invalid;
1709
1524
  };
1710
- DatabaseModule = _ts_decorate12([
1711
- (0, import_common41.Global)(),
1712
- (0, import_common41.Module)({})
1713
- ], DatabaseModule);
1714
-
1715
- // src/database/decorators/tenant.decorator.ts
1716
- var import_common42 = require("@nestjs/common");
1717
- var Tenant = (0, import_common42.createParamDecorator)((_data, ctx) => {
1718
- const request = ctx.switchToHttp().getRequest();
1719
- const tenantContext = request.app?.get?.(TenantContextService);
1720
- if (!tenantContext) {
1721
- throw new Error("TenantContextService not found.");
1525
+ _ts_decorate12([
1526
+ (0, import_swagger2.ApiProperty)({
1527
+ example: 10
1528
+ }),
1529
+ _ts_metadata8("design:type", Number)
1530
+ ], ImportSummaryDto.prototype, "total", void 0);
1531
+ _ts_decorate12([
1532
+ (0, import_swagger2.ApiProperty)({
1533
+ example: 8
1534
+ }),
1535
+ _ts_metadata8("design:type", Number)
1536
+ ], ImportSummaryDto.prototype, "valid", void 0);
1537
+ _ts_decorate12([
1538
+ (0, import_swagger2.ApiProperty)({
1539
+ example: 2
1540
+ }),
1541
+ _ts_metadata8("design:type", Number)
1542
+ ], ImportSummaryDto.prototype, "invalid", void 0);
1543
+ var ImportResponseDto = class {
1544
+ static {
1545
+ __name(this, "ImportResponseDto");
1722
1546
  }
1723
- return tenantContext.getTenant();
1724
- });
1547
+ success;
1548
+ message;
1549
+ created;
1550
+ updated;
1551
+ skipped;
1552
+ rows;
1553
+ summary;
1554
+ };
1555
+ _ts_decorate12([
1556
+ (0, import_swagger2.ApiProperty)({
1557
+ example: true
1558
+ }),
1559
+ _ts_metadata8("design:type", Boolean)
1560
+ ], ImportResponseDto.prototype, "success", void 0);
1561
+ _ts_decorate12([
1562
+ (0, import_swagger2.ApiProperty)({
1563
+ example: "Import complete."
1564
+ }),
1565
+ _ts_metadata8("design:type", String)
1566
+ ], ImportResponseDto.prototype, "message", void 0);
1567
+ _ts_decorate12([
1568
+ (0, import_swagger2.ApiPropertyOptional)({
1569
+ example: 3
1570
+ }),
1571
+ _ts_metadata8("design:type", Number)
1572
+ ], ImportResponseDto.prototype, "created", void 0);
1573
+ _ts_decorate12([
1574
+ (0, import_swagger2.ApiPropertyOptional)({
1575
+ example: 2
1576
+ }),
1577
+ _ts_metadata8("design:type", Number)
1578
+ ], ImportResponseDto.prototype, "updated", void 0);
1579
+ _ts_decorate12([
1580
+ (0, import_swagger2.ApiPropertyOptional)({
1581
+ example: 1
1582
+ }),
1583
+ _ts_metadata8("design:type", Number)
1584
+ ], ImportResponseDto.prototype, "skipped", void 0);
1585
+ _ts_decorate12([
1586
+ (0, import_swagger2.ApiPropertyOptional)({
1587
+ type: [
1588
+ ValidatedRowDto
1589
+ ]
1590
+ }),
1591
+ _ts_metadata8("design:type", Array)
1592
+ ], ImportResponseDto.prototype, "rows", void 0);
1593
+ _ts_decorate12([
1594
+ (0, import_swagger2.ApiPropertyOptional)({
1595
+ type: ImportSummaryDto
1596
+ }),
1597
+ _ts_metadata8("design:type", typeof ImportSummaryDto === "undefined" ? Object : ImportSummaryDto)
1598
+ ], ImportResponseDto.prototype, "summary", void 0);
1725
1599
 
1726
1600
  // src/database/dto/select-options-query.dto.ts
1727
- var import_swagger = require("@nestjs/swagger");
1601
+ var import_swagger3 = require("@nestjs/swagger");
1728
1602
  var import_class_transformer = require("class-transformer");
1729
1603
  var import_class_validator = require("class-validator");
1730
1604
  function _ts_decorate13(decorators, target, key, desc2) {
@@ -1734,10 +1608,10 @@ function _ts_decorate13(decorators, target, key, desc2) {
1734
1608
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1735
1609
  }
1736
1610
  __name(_ts_decorate13, "_ts_decorate");
1737
- function _ts_metadata8(k, v) {
1611
+ function _ts_metadata9(k, v) {
1738
1612
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1739
1613
  }
1740
- __name(_ts_metadata8, "_ts_metadata");
1614
+ __name(_ts_metadata9, "_ts_metadata");
1741
1615
  var SelectOptionsQueryDto = class {
1742
1616
  static {
1743
1617
  __name(this, "SelectOptionsQueryDto");
@@ -1753,16 +1627,16 @@ var SelectOptionsQueryDto = class {
1753
1627
  groupIdKey;
1754
1628
  };
1755
1629
  _ts_decorate13([
1756
- (0, import_swagger.ApiPropertyOptional)({
1630
+ (0, import_swagger3.ApiPropertyOptional)({
1757
1631
  description: "Search term to filter by label",
1758
1632
  example: "united"
1759
1633
  }),
1760
1634
  (0, import_class_validator.IsOptional)(),
1761
1635
  (0, import_class_validator.IsString)(),
1762
- _ts_metadata8("design:type", String)
1636
+ _ts_metadata9("design:type", String)
1763
1637
  ], SelectOptionsQueryDto.prototype, "search", void 0);
1764
1638
  _ts_decorate13([
1765
- (0, import_swagger.ApiPropertyOptional)({
1639
+ (0, import_swagger3.ApiPropertyOptional)({
1766
1640
  description: "Maximum number of results",
1767
1641
  example: 20,
1768
1642
  default: 20
@@ -1771,10 +1645,10 @@ _ts_decorate13([
1771
1645
  (0, import_class_transformer.Type)(() => Number),
1772
1646
  (0, import_class_validator.IsInt)(),
1773
1647
  (0, import_class_validator.Min)(1),
1774
- _ts_metadata8("design:type", Number)
1648
+ _ts_metadata9("design:type", Number)
1775
1649
  ], SelectOptionsQueryDto.prototype, "limit", void 0);
1776
1650
  _ts_decorate13([
1777
- (0, import_swagger.ApiPropertyOptional)({
1651
+ (0, import_swagger3.ApiPropertyOptional)({
1778
1652
  description: "Number of results to skip",
1779
1653
  example: 0,
1780
1654
  default: 0
@@ -1783,67 +1657,67 @@ _ts_decorate13([
1783
1657
  (0, import_class_transformer.Type)(() => Number),
1784
1658
  (0, import_class_validator.IsInt)(),
1785
1659
  (0, import_class_validator.Min)(0),
1786
- _ts_metadata8("design:type", Number)
1660
+ _ts_metadata9("design:type", Number)
1787
1661
  ], SelectOptionsQueryDto.prototype, "offset", void 0);
1788
1662
  _ts_decorate13([
1789
- (0, import_swagger.ApiPropertyOptional)({
1663
+ (0, import_swagger3.ApiPropertyOptional)({
1790
1664
  description: "Comma-separated values to fetch specific options",
1791
1665
  example: "1,2,3"
1792
1666
  }),
1793
1667
  (0, import_class_validator.IsOptional)(),
1794
1668
  (0, import_class_validator.IsString)(),
1795
- _ts_metadata8("design:type", String)
1669
+ _ts_metadata9("design:type", String)
1796
1670
  ], SelectOptionsQueryDto.prototype, "values", void 0);
1797
1671
  _ts_decorate13([
1798
- (0, import_swagger.ApiPropertyOptional)({
1672
+ (0, import_swagger3.ApiPropertyOptional)({
1799
1673
  description: "Comma-separated IDs to exclude from results (already selected)",
1800
1674
  example: "5,10"
1801
1675
  }),
1802
1676
  (0, import_class_validator.IsOptional)(),
1803
1677
  (0, import_class_validator.IsString)(),
1804
- _ts_metadata8("design:type", String)
1678
+ _ts_metadata9("design:type", String)
1805
1679
  ], SelectOptionsQueryDto.prototype, "excludeIds", void 0);
1806
1680
  _ts_decorate13([
1807
- (0, import_swagger.ApiPropertyOptional)({
1681
+ (0, import_swagger3.ApiPropertyOptional)({
1808
1682
  description: "Column name for option value",
1809
1683
  example: "id",
1810
1684
  default: "id"
1811
1685
  }),
1812
1686
  (0, import_class_validator.IsOptional)(),
1813
1687
  (0, import_class_validator.IsString)(),
1814
- _ts_metadata8("design:type", String)
1688
+ _ts_metadata9("design:type", String)
1815
1689
  ], SelectOptionsQueryDto.prototype, "valueKey", void 0);
1816
1690
  _ts_decorate13([
1817
- (0, import_swagger.ApiPropertyOptional)({
1691
+ (0, import_swagger3.ApiPropertyOptional)({
1818
1692
  description: "Column name for option label",
1819
1693
  example: "name",
1820
1694
  default: "name"
1821
1695
  }),
1822
1696
  (0, import_class_validator.IsOptional)(),
1823
1697
  (0, import_class_validator.IsString)(),
1824
- _ts_metadata8("design:type", String)
1698
+ _ts_metadata9("design:type", String)
1825
1699
  ], SelectOptionsQueryDto.prototype, "labelKey", void 0);
1826
1700
  _ts_decorate13([
1827
- (0, import_swagger.ApiPropertyOptional)({
1701
+ (0, import_swagger3.ApiPropertyOptional)({
1828
1702
  description: "Column name for option description",
1829
1703
  example: "description"
1830
1704
  }),
1831
1705
  (0, import_class_validator.IsOptional)(),
1832
1706
  (0, import_class_validator.IsString)(),
1833
- _ts_metadata8("design:type", String)
1707
+ _ts_metadata9("design:type", String)
1834
1708
  ], SelectOptionsQueryDto.prototype, "descriptionKey", void 0);
1835
1709
  _ts_decorate13([
1836
- (0, import_swagger.ApiPropertyOptional)({
1710
+ (0, import_swagger3.ApiPropertyOptional)({
1837
1711
  description: "Column name for group ID",
1838
1712
  example: "regionId"
1839
1713
  }),
1840
1714
  (0, import_class_validator.IsOptional)(),
1841
1715
  (0, import_class_validator.IsString)(),
1842
- _ts_metadata8("design:type", String)
1716
+ _ts_metadata9("design:type", String)
1843
1717
  ], SelectOptionsQueryDto.prototype, "groupIdKey", void 0);
1844
1718
 
1845
1719
  // src/database/dto/success-response.dto.ts
1846
- var import_swagger2 = require("@nestjs/swagger");
1720
+ var import_swagger4 = require("@nestjs/swagger");
1847
1721
  var import_class_validator2 = require("class-validator");
1848
1722
  function _ts_decorate14(decorators, target, key, desc2) {
1849
1723
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
@@ -1852,10 +1726,10 @@ function _ts_decorate14(decorators, target, key, desc2) {
1852
1726
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1853
1727
  }
1854
1728
  __name(_ts_decorate14, "_ts_decorate");
1855
- function _ts_metadata9(k, v) {
1729
+ function _ts_metadata10(k, v) {
1856
1730
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1857
1731
  }
1858
- __name(_ts_metadata9, "_ts_metadata");
1732
+ __name(_ts_metadata10, "_ts_metadata");
1859
1733
  var SuccessResponseDto = class {
1860
1734
  static {
1861
1735
  __name(this, "SuccessResponseDto");
@@ -1864,24 +1738,24 @@ var SuccessResponseDto = class {
1864
1738
  message;
1865
1739
  };
1866
1740
  _ts_decorate14([
1867
- (0, import_swagger2.ApiProperty)({
1741
+ (0, import_swagger4.ApiProperty)({
1868
1742
  example: true
1869
1743
  }),
1870
1744
  (0, import_class_validator2.IsNotEmpty)(),
1871
1745
  (0, import_class_validator2.IsBoolean)(),
1872
- _ts_metadata9("design:type", Boolean)
1746
+ _ts_metadata10("design:type", Boolean)
1873
1747
  ], SuccessResponseDto.prototype, "success", void 0);
1874
1748
  _ts_decorate14([
1875
- (0, import_swagger2.ApiProperty)({
1749
+ (0, import_swagger4.ApiProperty)({
1876
1750
  example: "Operation completed successfully"
1877
1751
  }),
1878
1752
  (0, import_class_validator2.IsNotEmpty)(),
1879
1753
  (0, import_class_validator2.IsString)(),
1880
- _ts_metadata9("design:type", String)
1754
+ _ts_metadata10("design:type", String)
1881
1755
  ], SuccessResponseDto.prototype, "message", void 0);
1882
1756
 
1883
1757
  // src/database/dto/table-response.dto.ts
1884
- var import_swagger3 = require("@nestjs/swagger");
1758
+ var import_swagger5 = require("@nestjs/swagger");
1885
1759
  function _ts_decorate15(decorators, target, key, desc2) {
1886
1760
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
1887
1761
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
@@ -1889,10 +1763,10 @@ function _ts_decorate15(decorators, target, key, desc2) {
1889
1763
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1890
1764
  }
1891
1765
  __name(_ts_decorate15, "_ts_decorate");
1892
- function _ts_metadata10(k, v) {
1766
+ function _ts_metadata11(k, v) {
1893
1767
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1894
1768
  }
1895
- __name(_ts_metadata10, "_ts_metadata");
1769
+ __name(_ts_metadata11, "_ts_metadata");
1896
1770
  var TableResponseDto = class {
1897
1771
  static {
1898
1772
  __name(this, "TableResponseDto");
@@ -1903,26 +1777,26 @@ var TableResponseDto = class {
1903
1777
  activeViewId;
1904
1778
  };
1905
1779
  _ts_decorate15([
1906
- (0, import_swagger3.ApiProperty)(),
1907
- _ts_metadata10("design:type", Array)
1780
+ (0, import_swagger5.ApiProperty)(),
1781
+ _ts_metadata11("design:type", Array)
1908
1782
  ], TableResponseDto.prototype, "result", void 0);
1909
1783
  _ts_decorate15([
1910
- (0, import_swagger3.ApiProperty)(),
1911
- _ts_metadata10("design:type", Number)
1784
+ (0, import_swagger5.ApiProperty)(),
1785
+ _ts_metadata11("design:type", Number)
1912
1786
  ], TableResponseDto.prototype, "count", void 0);
1913
1787
  _ts_decorate15([
1914
- (0, import_swagger3.ApiProperty)(),
1915
- _ts_metadata10("design:type", typeof TableViewState === "undefined" ? Object : TableViewState)
1788
+ (0, import_swagger5.ApiProperty)(),
1789
+ _ts_metadata11("design:type", typeof TableViewState === "undefined" ? Object : TableViewState)
1916
1790
  ], TableResponseDto.prototype, "state", void 0);
1917
1791
  _ts_decorate15([
1918
- (0, import_swagger3.ApiPropertyOptional)({
1792
+ (0, import_swagger5.ApiPropertyOptional)({
1919
1793
  nullable: true
1920
1794
  }),
1921
- _ts_metadata10("design:type", Object)
1795
+ _ts_metadata11("design:type", Object)
1922
1796
  ], TableResponseDto.prototype, "activeViewId", void 0);
1923
1797
 
1924
1798
  // src/database/filter/filter.processor.ts
1925
- var import_drizzle_orm2 = require("drizzle-orm");
1799
+ var import_drizzle_orm = require("drizzle-orm");
1926
1800
  var FilterProcessor = class {
1927
1801
  static {
1928
1802
  __name(this, "FilterProcessor");
@@ -1940,58 +1814,58 @@ var FilterProcessor = class {
1940
1814
  switch (f.operator) {
1941
1815
  case "equals":
1942
1816
  if (def.type === "boolean") return [
1943
- (0, import_drizzle_orm2.eq)(col, val === "true" || val === 1)
1817
+ (0, import_drizzle_orm.eq)(col, val === "true" || val === 1)
1944
1818
  ];
1945
1819
  return [
1946
- (0, import_drizzle_orm2.eq)(col, val)
1820
+ (0, import_drizzle_orm.eq)(col, val)
1947
1821
  ];
1948
1822
  case "notEquals":
1949
1823
  if (def.type === "boolean") return [
1950
- (0, import_drizzle_orm2.ne)(col, val === "true" || val === 1)
1824
+ (0, import_drizzle_orm.ne)(col, val === "true" || val === 1)
1951
1825
  ];
1952
1826
  return [
1953
- (0, import_drizzle_orm2.ne)(col, val)
1827
+ (0, import_drizzle_orm.ne)(col, val)
1954
1828
  ];
1955
1829
  case "contains":
1956
1830
  return [
1957
- (0, import_drizzle_orm2.ilike)(col, `%${val}%`)
1831
+ (0, import_drizzle_orm.ilike)(col, `%${val}%`)
1958
1832
  ];
1959
1833
  case "notContains":
1960
1834
  return [
1961
- (0, import_drizzle_orm2.notIlike)(col, `%${val}%`)
1835
+ (0, import_drizzle_orm.notIlike)(col, `%${val}%`)
1962
1836
  ];
1963
1837
  case "gt":
1964
1838
  return [
1965
- (0, import_drizzle_orm2.gt)(col, val)
1839
+ (0, import_drizzle_orm.gt)(col, val)
1966
1840
  ];
1967
1841
  case "gte":
1968
1842
  return [
1969
- (0, import_drizzle_orm2.gte)(col, val)
1843
+ (0, import_drizzle_orm.gte)(col, val)
1970
1844
  ];
1971
1845
  case "lt":
1972
1846
  return [
1973
- (0, import_drizzle_orm2.lt)(col, val)
1847
+ (0, import_drizzle_orm.lt)(col, val)
1974
1848
  ];
1975
1849
  case "lte":
1976
1850
  return [
1977
- (0, import_drizzle_orm2.lte)(col, val)
1851
+ (0, import_drizzle_orm.lte)(col, val)
1978
1852
  ];
1979
1853
  default:
1980
1854
  return [];
1981
1855
  }
1982
1856
  });
1983
- return conditions.length ? (0, import_drizzle_orm2.and)(...conditions) : void 0;
1857
+ return conditions.length ? (0, import_drizzle_orm.and)(...conditions) : void 0;
1984
1858
  }
1985
1859
  // Builds a search WHERE — OR across all string fields when columnId is 'all', otherwise a single ilike
1986
1860
  static buildSearch(search, fieldMap) {
1987
1861
  if (!search?.value) return void 0;
1988
1862
  if (search.columnId === "all") {
1989
- const conditions = Object.values(fieldMap).filter((def2) => "column" in def2 && def2.type === "string").map((def2) => (0, import_drizzle_orm2.ilike)(def2.column, `%${search.value}%`));
1990
- return conditions.length ? (0, import_drizzle_orm2.or)(...conditions) : void 0;
1863
+ const conditions = Object.values(fieldMap).filter((def2) => "column" in def2 && def2.type === "string").map((def2) => (0, import_drizzle_orm.ilike)(def2.column, `%${search.value}%`));
1864
+ return conditions.length ? (0, import_drizzle_orm.or)(...conditions) : void 0;
1991
1865
  }
1992
1866
  const def = fieldMap[search.columnId];
1993
1867
  if (!def || !("column" in def)) return void 0;
1994
- return (0, import_drizzle_orm2.ilike)(def.column, `%${search.value}%`);
1868
+ return (0, import_drizzle_orm.ilike)(def.column, `%${search.value}%`);
1995
1869
  }
1996
1870
  // Maps each SortCondition to an asc/desc SQL expression
1997
1871
  static buildOrderBy(sort = [], fieldMap) {
@@ -1999,15 +1873,15 @@ var FilterProcessor = class {
1999
1873
  const def = fieldMap[s.field];
2000
1874
  if (!def || !("column" in def)) return [];
2001
1875
  return [
2002
- s.direction === "asc" ? (0, import_drizzle_orm2.asc)(def.column) : (0, import_drizzle_orm2.desc)(def.column)
1876
+ s.direction === "asc" ? (0, import_drizzle_orm.asc)(def.column) : (0, import_drizzle_orm.desc)(def.column)
2003
1877
  ];
2004
1878
  });
2005
1879
  }
2006
1880
  };
2007
1881
 
2008
1882
  // src/database/repositories/primary-base.repository.ts
2009
- var import_common43 = require("@nestjs/common");
2010
- var import_drizzle_orm3 = require("drizzle-orm");
1883
+ var import_common41 = require("@nestjs/common");
1884
+ var import_drizzle_orm2 = require("drizzle-orm");
2011
1885
  function snakeToCamel(str) {
2012
1886
  return str.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
2013
1887
  }
@@ -2036,16 +1910,17 @@ var PrimaryBaseRepository = class {
2036
1910
  constructor(database, table) {
2037
1911
  this.database = database;
2038
1912
  this.table = table;
2039
- const dbTableName = (0, import_drizzle_orm3.getTableName)(table);
1913
+ const dbTableName = (0, import_drizzle_orm2.getTableName)(table);
2040
1914
  this.tableName = snakeToCamel(dbTableName);
2041
- this.logger = new import_common43.Logger(this.constructor.name);
1915
+ this.logger = new import_common41.Logger(this.constructor.name);
2042
1916
  this.logger.debug(`Initialized ${this.constructor.name}`);
2043
1917
  this.logger.debug(`Table name: '${dbTableName}' -> query key: '${this.tableName}'`);
2044
1918
  }
2045
1919
  // Creates a new record and returns it
2046
- async create(data) {
1920
+ async create(data, tx) {
2047
1921
  this.logger.log("Creating record");
2048
- const results = await this.db.insert(this.table).values(data).returning();
1922
+ const db = tx ?? this.db;
1923
+ const results = await db.insert(this.table).values(data).returning();
2049
1924
  const record = results[0];
2050
1925
  if (!record) throw new Error(`${this.tableName}: database operation returned no record`);
2051
1926
  return record;
@@ -2071,16 +1946,35 @@ var PrimaryBaseRepository = class {
2071
1946
  this.logger.debug("Finding multiple records");
2072
1947
  return this.model.findMany(options);
2073
1948
  }
2074
- // Builds a select query with optional custom fields, join, filter, ordering, and pagination
1949
+ // Builds a select query with optional custom fields, joins, filter, grouping, ordering, and pagination
2075
1950
  buildSelectQuery(options) {
2076
- const base = options?.select ? this.db.select(options.select).from(this.table) : this.db.select().from(this.table);
2077
- const joined = options?.leftJoin ? base.leftJoin(options.leftJoin.table, options.leftJoin.on) : base;
2078
- const filtered = options?.where ? joined.where(options.where) : joined;
2079
- const ordered = options?.orderBy?.length ? filtered.orderBy(...options.orderBy) : filtered;
2080
- const limited = options?.limit ? ordered.limit(options.limit) : ordered;
2081
- return options?.offset ? limited.offset(options.offset) : limited;
2082
- }
2083
- // Returns paginated result and total count, with optional custom select, LEFT JOIN, and ordering
1951
+ let query = (options?.select ? this.db.select(options.select).from(this.table) : this.db.select().from(this.table)).$dynamic();
1952
+ if (options?.leftJoin) {
1953
+ query = query.leftJoin(options.leftJoin.table, options.leftJoin.on);
1954
+ }
1955
+ if (options?.leftJoins) {
1956
+ for (const join of options.leftJoins) {
1957
+ query = query.leftJoin(join.table, join.on);
1958
+ }
1959
+ }
1960
+ if (options?.where) {
1961
+ query = query.where(options.where);
1962
+ }
1963
+ if (options?.groupBy?.length) {
1964
+ query = query.groupBy(...options.groupBy);
1965
+ }
1966
+ if (options?.orderBy?.length) {
1967
+ query = query.orderBy(...options.orderBy);
1968
+ }
1969
+ if (options?.limit) {
1970
+ query = query.limit(options.limit);
1971
+ }
1972
+ if (options?.offset) {
1973
+ query = query.offset(options.offset);
1974
+ }
1975
+ return query;
1976
+ }
1977
+ // Returns paginated result and total count, with optional custom select, LEFT JOINs, GROUP BY, and ordering
2084
1978
  async findAllAndCount(options) {
2085
1979
  const [count, result] = await Promise.all([
2086
1980
  this.count(options?.where),
@@ -2092,37 +1986,41 @@ var PrimaryBaseRepository = class {
2092
1986
  };
2093
1987
  }
2094
1988
  // Updates a record by ID and returns the updated record
2095
- async update(id, data) {
1989
+ async update(id, data, tx) {
2096
1990
  this.logger.log(`Updating record with ID: ${id}`);
1991
+ const db = tx ?? this.db;
2097
1992
  const idColumn = this.table.id;
2098
1993
  if (!idColumn) throw new Error(`Table '${this.tableName}' has no 'id' column`);
2099
- const results = await this.db.update(this.table).set(data).where((0, import_drizzle_orm3.eq)(idColumn, id)).returning();
1994
+ const results = await db.update(this.table).set(data).where((0, import_drizzle_orm2.eq)(idColumn, id)).returning();
2100
1995
  const record = results[0];
2101
1996
  if (!record) throw new Error(`${this.tableName}: database operation returned no record`);
2102
1997
  return record;
2103
1998
  }
2104
1999
  // Updates all records matching the SQL condition and returns the affected count
2105
- async updateMany(where, data) {
2000
+ async updateMany(where, data, tx) {
2106
2001
  this.logger.log("Updating multiple records");
2107
- const result = await this.db.update(this.table).set(data).where(where);
2002
+ const db = tx ?? this.db;
2003
+ const result = await db.update(this.table).set(data).where(where);
2108
2004
  return {
2109
2005
  count: result.rowCount ?? 0
2110
2006
  };
2111
2007
  }
2112
2008
  // Deletes a record by ID and returns the deleted record
2113
- async delete(id) {
2009
+ async delete(id, tx) {
2114
2010
  this.logger.log(`Deleting record with ID: ${id}`);
2011
+ const db = tx ?? this.db;
2115
2012
  const idColumn = this.table.id;
2116
2013
  if (!idColumn) throw new Error(`Table '${this.tableName}' has no 'id' column`);
2117
- const results = await this.db.delete(this.table).where((0, import_drizzle_orm3.eq)(idColumn, id)).returning();
2014
+ const results = await db.delete(this.table).where((0, import_drizzle_orm2.eq)(idColumn, id)).returning();
2118
2015
  const record = results[0];
2119
2016
  if (!record) throw new Error(`${this.tableName}: database operation returned no record`);
2120
2017
  return record;
2121
2018
  }
2122
2019
  // Deletes all records matching the SQL condition and returns the affected count
2123
- async deleteMany(where) {
2020
+ async deleteMany(where, tx) {
2124
2021
  this.logger.log("Deleting multiple records");
2125
- const result = await this.db.delete(this.table).where(where);
2022
+ const db = tx ?? this.db;
2023
+ const result = await db.delete(this.table).where(where);
2126
2024
  return {
2127
2025
  count: result.rowCount ?? 0
2128
2026
  };
@@ -2131,7 +2029,7 @@ var PrimaryBaseRepository = class {
2131
2029
  async count(where) {
2132
2030
  this.logger.debug("Counting records");
2133
2031
  let query = this.db.select({
2134
- count: import_drizzle_orm3.sql`count(*)::int`
2032
+ count: import_drizzle_orm2.sql`count(*)::int`
2135
2033
  }).from(this.table).$dynamic();
2136
2034
  if (where) {
2137
2035
  query = query.where(where);
@@ -2144,9 +2042,14 @@ var PrimaryBaseRepository = class {
2144
2042
  const count = await this.count(where);
2145
2043
  return count > 0;
2146
2044
  }
2045
+ // Executes the callback within a database transaction
2046
+ async transaction(callback) {
2047
+ return this.db.transaction(callback);
2048
+ }
2147
2049
  // Finds records formatted as select dropdown options with optional search, pagination, and grouping
2148
2050
  async findForSelect(config) {
2149
2051
  this.logger.debug("Finding records for select dropdown");
2052
+ const selectFn = config.distinct ? this.db.selectDistinct.bind(this.db) : this.db.select.bind(this.db);
2150
2053
  const parsedValues = typeof config.values === "string" ? config.values.split(",").map((v) => v.trim()).filter(Boolean) : config.values;
2151
2054
  const parsedExcludeIds = typeof config.excludeIds === "string" ? config.excludeIds.split(",").map((v) => v.trim()).filter(Boolean) : config.excludeIds ?? [];
2152
2055
  const tableColumns = this.table;
@@ -2174,7 +2077,7 @@ var PrimaryBaseRepository = class {
2174
2077
  const groupIdCol = tableColumns[config.groupId];
2175
2078
  if (groupIdCol) selectCols.groupId = groupIdCol;
2176
2079
  }
2177
- let valuesQuery = this.db.select(selectCols).from(this.table).$dynamic();
2080
+ let valuesQuery = selectFn(selectCols).from(this.table).$dynamic();
2178
2081
  if (config.joins) {
2179
2082
  for (const join of config.joins) {
2180
2083
  if (join.type === "inner") {
@@ -2184,7 +2087,7 @@ var PrimaryBaseRepository = class {
2184
2087
  }
2185
2088
  }
2186
2089
  }
2187
- const rows2 = await valuesQuery.where((0, import_drizzle_orm3.inArray)(valueCol, parsedValues));
2090
+ const rows2 = await valuesQuery.where((0, import_drizzle_orm2.inArray)(valueCol, parsedValues));
2188
2091
  return {
2189
2092
  options: rows2.map((row) => ({
2190
2093
  value: row.value,
@@ -2205,7 +2108,7 @@ var PrimaryBaseRepository = class {
2205
2108
  const selectFields = {
2206
2109
  value: valueCol,
2207
2110
  label: labelCol,
2208
- totalCount: import_drizzle_orm3.sql`count(*) over()`.mapWith(Number)
2111
+ totalCount: import_drizzle_orm2.sql`count(*) over()`.mapWith(Number)
2209
2112
  };
2210
2113
  if (descriptionCol) selectFields.description = descriptionCol;
2211
2114
  if (config.groupId) {
@@ -2214,16 +2117,16 @@ var PrimaryBaseRepository = class {
2214
2117
  }
2215
2118
  const conditions = [];
2216
2119
  if (config.search) {
2217
- conditions.push((0, import_drizzle_orm3.ilike)(labelCol, `%${config.search}%`));
2120
+ conditions.push((0, import_drizzle_orm2.ilike)(labelCol, `%${config.search}%`));
2218
2121
  }
2219
2122
  if (parsedExcludeIds.length > 0) {
2220
- conditions.push((0, import_drizzle_orm3.notInArray)(valueCol, parsedExcludeIds));
2123
+ conditions.push((0, import_drizzle_orm2.notInArray)(valueCol, parsedExcludeIds));
2221
2124
  }
2222
2125
  if (config.where) {
2223
2126
  for (const [field, val] of Object.entries(config.where)) {
2224
2127
  const column = tableColumns[field];
2225
2128
  if (column) {
2226
- conditions.push((0, import_drizzle_orm3.eq)(column, val));
2129
+ conditions.push((0, import_drizzle_orm2.eq)(column, val));
2227
2130
  }
2228
2131
  }
2229
2132
  }
@@ -2234,7 +2137,7 @@ var PrimaryBaseRepository = class {
2234
2137
  const orderByCol = orderByKey ? tableColumns[orderByKey] ?? labelCol : labelCol;
2235
2138
  const limit = Number(config.limit) || 20;
2236
2139
  const offset = Number(config.offset) || 0;
2237
- let query = this.db.select(selectFields).from(this.table).$dynamic();
2140
+ let query = selectFn(selectFields).from(this.table).$dynamic();
2238
2141
  if (config.joins) {
2239
2142
  for (const join of config.joins) {
2240
2143
  if (join.type === "inner") {
@@ -2245,14 +2148,14 @@ var PrimaryBaseRepository = class {
2245
2148
  }
2246
2149
  }
2247
2150
  if (conditions.length > 0) {
2248
- query = query.where(conditions.length === 1 ? conditions[0] : (0, import_drizzle_orm3.and)(...conditions));
2151
+ query = query.where(conditions.length === 1 ? conditions[0] : (0, import_drizzle_orm2.and)(...conditions));
2249
2152
  }
2250
2153
  const orderClauses = [];
2251
2154
  if (config.groupId) {
2252
2155
  const groupIdCol = tableColumns[config.groupId];
2253
- if (groupIdCol) orderClauses.push((0, import_drizzle_orm3.asc)(groupIdCol));
2156
+ if (groupIdCol) orderClauses.push((0, import_drizzle_orm2.asc)(groupIdCol));
2254
2157
  }
2255
- orderClauses.push((0, import_drizzle_orm3.asc)(orderByCol));
2158
+ orderClauses.push((0, import_drizzle_orm2.asc)(orderByCol));
2256
2159
  query = query.orderBy(...orderClauses).limit(limit).offset(offset);
2257
2160
  const rows = await query;
2258
2161
  const totalCount = rows.length > 0 ? rows[0].totalCount : 0;
@@ -2278,235 +2181,7 @@ var PrimaryBaseRepository = class {
2278
2181
  const groupRows = await this.db.select({
2279
2182
  id: groupIdCol,
2280
2183
  name: groupNameCol
2281
- }).from(config.groupTable).orderBy((0, import_drizzle_orm3.asc)(groupNameCol));
2282
- resolvedGroups = groupRows.map((r) => ({
2283
- id: r.id,
2284
- name: String(r.name)
2285
- }));
2286
- }
2287
- return {
2288
- options,
2289
- hasMore: offset + limit < totalCount,
2290
- totalCount,
2291
- ...resolvedGroups ? {
2292
- groups: resolvedGroups
2293
- } : {}
2294
- };
2295
- }
2296
- };
2297
-
2298
- // src/database/repositories/tenant-base.repository.ts
2299
- var import_common44 = require("@nestjs/common");
2300
- var import_drizzle_orm4 = require("drizzle-orm");
2301
- var TenantBaseRepository = class {
2302
- static {
2303
- __name(this, "TenantBaseRepository");
2304
- }
2305
- database;
2306
- table;
2307
- logger;
2308
- tableName;
2309
- get db() {
2310
- return this.database.drizzleClient;
2311
- }
2312
- get model() {
2313
- return this.database.drizzleClient.query[this.tableName];
2314
- }
2315
- constructor(database, table) {
2316
- this.database = database;
2317
- this.table = table;
2318
- this.tableName = (0, import_drizzle_orm4.getTableName)(table);
2319
- this.logger = new import_common44.Logger(this.constructor.name);
2320
- this.logger.debug(`Initialized ${this.constructor.name}`);
2321
- }
2322
- // Creates a new record and returns it
2323
- async create(data) {
2324
- this.logger.log("Creating record");
2325
- const results = await this.db.insert(this.table).values(data).returning();
2326
- const record = results[0];
2327
- if (!record) throw new Error(`${this.tableName}: database operation returned no record`);
2328
- return record;
2329
- }
2330
- // Finds a single record by primary key ID
2331
- async findById(id) {
2332
- this.logger.debug(`Finding record by ID: ${id}`);
2333
- const idColumn = this.table.id;
2334
- if (!idColumn) throw new Error(`Table '${this.tableName}' has no 'id' column`);
2335
- const results = await this.db.select().from(this.table).where((0, import_drizzle_orm4.eq)(idColumn, id)).limit(1);
2336
- return results[0] ?? null;
2337
- }
2338
- // Finds a single record matching the given SQL condition
2339
- async findOne(where) {
2340
- this.logger.debug("Finding record with custom query");
2341
- const results = await this.db.select().from(this.table).where(where).limit(1);
2342
- return results[0] ?? null;
2343
- }
2344
- // Finds multiple records with optional SQL filtering, ordering, and pagination
2345
- async findMany(options) {
2346
- this.logger.debug("Finding multiple records");
2347
- let query = this.db.select().from(this.table).$dynamic();
2348
- if (options?.where) {
2349
- query = query.where(options.where);
2350
- }
2351
- if (options?.orderBy) {
2352
- query = query.orderBy(options.orderBy);
2353
- }
2354
- if (options?.limit) {
2355
- query = query.limit(options.limit);
2356
- }
2357
- if (options?.offset) {
2358
- query = query.offset(options.offset);
2359
- }
2360
- return await query;
2361
- }
2362
- // Updates a record by ID and returns the updated record
2363
- async update(id, data) {
2364
- this.logger.log(`Updating record with ID: ${id}`);
2365
- const idColumn = this.table.id;
2366
- if (!idColumn) throw new Error(`Table '${this.tableName}' has no 'id' column`);
2367
- const results = await this.db.update(this.table).set(data).where((0, import_drizzle_orm4.eq)(idColumn, id)).returning();
2368
- const record = results[0];
2369
- if (!record) throw new Error(`${this.tableName}: database operation returned no record`);
2370
- return record;
2371
- }
2372
- // Updates all records matching the SQL condition and returns the affected count
2373
- async updateMany(where, data) {
2374
- this.logger.log("Updating multiple records");
2375
- const result = await this.db.update(this.table).set(data).where(where);
2376
- return {
2377
- count: result.rowCount ?? 0
2378
- };
2379
- }
2380
- // Deletes a record by ID and returns the deleted record
2381
- async delete(id) {
2382
- this.logger.log(`Deleting record with ID: ${id}`);
2383
- const idColumn = this.table.id;
2384
- if (!idColumn) throw new Error(`Table '${this.tableName}' has no 'id' column`);
2385
- const results = await this.db.delete(this.table).where((0, import_drizzle_orm4.eq)(idColumn, id)).returning();
2386
- const record = results[0];
2387
- if (!record) throw new Error(`${this.tableName}: database operation returned no record`);
2388
- return record;
2389
- }
2390
- // Deletes all records matching the SQL condition and returns the affected count
2391
- async deleteMany(where) {
2392
- this.logger.log("Deleting multiple records");
2393
- const result = await this.db.delete(this.table).where(where);
2394
- return {
2395
- count: result.rowCount ?? 0
2396
- };
2397
- }
2398
- // Counts records matching the optional SQL condition
2399
- async count(where) {
2400
- this.logger.debug("Counting records");
2401
- let query = this.db.select({
2402
- count: import_drizzle_orm4.sql`count(*)::int`
2403
- }).from(this.table).$dynamic();
2404
- if (where) {
2405
- query = query.where(where);
2406
- }
2407
- const results = await query;
2408
- return results[0].count;
2409
- }
2410
- // Returns true if at least one record matches the SQL condition
2411
- async exists(where) {
2412
- const count = await this.count(where);
2413
- return count > 0;
2414
- }
2415
- // Finds records formatted as select dropdown options with optional search, pagination, and grouping
2416
- async findForSelect(config) {
2417
- this.logger.debug("Finding records for select dropdown");
2418
- const parsedValues = typeof config.values === "string" ? config.values.split(",").map((v) => v.trim()).filter(Boolean) : config.values;
2419
- const parsedExcludeIds = typeof config.excludeIds === "string" ? config.excludeIds.split(",").map((v) => v.trim()).filter(Boolean) : config.excludeIds ?? [];
2420
- const tableColumns = this.table;
2421
- const valueCol = tableColumns[config.value];
2422
- if (!valueCol) throw new Error(`Column '${config.value}' not found in table '${this.tableName}'`);
2423
- const labelCol = tableColumns[config.label];
2424
- if (!labelCol) throw new Error(`Column '${config.label}' not found in table '${this.tableName}'`);
2425
- if (parsedValues && parsedValues.length > 0) {
2426
- const selectCols = {
2427
- value: valueCol,
2428
- label: labelCol
2429
- };
2430
- if (config.groupId) {
2431
- const groupIdCol = tableColumns[config.groupId];
2432
- if (groupIdCol) selectCols.groupId = groupIdCol;
2433
- }
2434
- const rows2 = await this.db.select(selectCols).from(this.table).where((0, import_drizzle_orm4.inArray)(valueCol, parsedValues));
2435
- return {
2436
- options: rows2.map((row) => ({
2437
- value: row.value,
2438
- label: String(row.label),
2439
- ...config.groupId && row.groupId != null ? {
2440
- groupId: row.groupId
2441
- } : {}
2442
- })),
2443
- hasMore: false,
2444
- ...config.groups ? {
2445
- groups: config.groups
2446
- } : {}
2447
- };
2448
- }
2449
- const selectFields = {
2450
- value: valueCol,
2451
- label: labelCol,
2452
- totalCount: import_drizzle_orm4.sql`count(*) over()`.mapWith(Number)
2453
- };
2454
- if (config.groupId) {
2455
- const groupIdCol = tableColumns[config.groupId];
2456
- if (groupIdCol) selectFields.groupId = groupIdCol;
2457
- }
2458
- const conditions = [];
2459
- if (config.search) {
2460
- conditions.push((0, import_drizzle_orm4.ilike)(labelCol, `%${config.search}%`));
2461
- }
2462
- if (parsedExcludeIds.length > 0) {
2463
- conditions.push((0, import_drizzle_orm4.notInArray)(valueCol, parsedExcludeIds));
2464
- }
2465
- if (config.where) {
2466
- for (const [field, val] of Object.entries(config.where)) {
2467
- const column = tableColumns[field];
2468
- if (column) {
2469
- conditions.push((0, import_drizzle_orm4.eq)(column, val));
2470
- }
2471
- }
2472
- }
2473
- const orderByKey = config.orderBy ? Object.keys(config.orderBy)[0] : void 0;
2474
- const orderByCol = orderByKey ? tableColumns[orderByKey] ?? labelCol : labelCol;
2475
- const limit = Number(config.limit) || 20;
2476
- const offset = Number(config.offset) || 0;
2477
- let query = this.db.select(selectFields).from(this.table).$dynamic();
2478
- if (conditions.length > 0) {
2479
- query = query.where(conditions.length === 1 ? conditions[0] : (0, import_drizzle_orm4.and)(...conditions));
2480
- }
2481
- const orderClauses = [];
2482
- if (config.groupId) {
2483
- const groupIdCol = tableColumns[config.groupId];
2484
- if (groupIdCol) orderClauses.push((0, import_drizzle_orm4.asc)(groupIdCol));
2485
- }
2486
- orderClauses.push((0, import_drizzle_orm4.asc)(orderByCol));
2487
- query = query.orderBy(...orderClauses).limit(limit).offset(offset);
2488
- const rows = await query;
2489
- const totalCount = rows.length > 0 ? rows[0].totalCount : 0;
2490
- const options = rows.map((row) => ({
2491
- value: row.value,
2492
- label: String(row.label),
2493
- ...config.groupId && row.groupId != null ? {
2494
- groupId: row.groupId
2495
- } : {}
2496
- }));
2497
- let resolvedGroups = config.groups;
2498
- if (config.groupTable && config.groupId) {
2499
- const groupTableColumns = config.groupTable;
2500
- const groupIdKey = config.groupIdKey ?? "id";
2501
- const groupNameKey = config.groupLabelKey ?? "name";
2502
- const groupIdCol = groupTableColumns[groupIdKey];
2503
- if (!groupIdCol) throw new Error(`Column '${groupIdKey}' not found in group table`);
2504
- const groupNameCol = groupTableColumns[groupNameKey];
2505
- if (!groupNameCol) throw new Error(`Column '${groupNameKey}' not found in group table`);
2506
- const groupRows = await this.db.select({
2507
- id: groupIdCol,
2508
- name: groupNameCol
2509
- }).from(config.groupTable).orderBy((0, import_drizzle_orm4.asc)(groupNameCol));
2184
+ }).from(config.groupTable).orderBy((0, import_drizzle_orm2.asc)(groupNameCol));
2510
2185
  resolvedGroups = groupRows.map((r) => ({
2511
2186
  id: r.id,
2512
2187
  name: String(r.name)
@@ -2524,13 +2199,13 @@ var TenantBaseRepository = class {
2524
2199
  };
2525
2200
 
2526
2201
  // src/email/email.module.ts
2527
- var import_common46 = require("@nestjs/common");
2528
- var import_config11 = require("@nestjs/config");
2202
+ var import_common43 = require("@nestjs/common");
2203
+ var import_config12 = require("@nestjs/config");
2529
2204
 
2530
2205
  // src/email/email.service.ts
2531
2206
  var import_brevo = require("@getbrevo/brevo");
2532
- var import_common45 = require("@nestjs/common");
2533
- var import_config10 = require("@nestjs/config");
2207
+ var import_common42 = require("@nestjs/common");
2208
+ var import_config11 = require("@nestjs/config");
2534
2209
  function _ts_decorate16(decorators, target, key, desc2) {
2535
2210
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
2536
2211
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
@@ -2538,16 +2213,16 @@ function _ts_decorate16(decorators, target, key, desc2) {
2538
2213
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2539
2214
  }
2540
2215
  __name(_ts_decorate16, "_ts_decorate");
2541
- function _ts_metadata11(k, v) {
2216
+ function _ts_metadata12(k, v) {
2542
2217
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
2543
2218
  }
2544
- __name(_ts_metadata11, "_ts_metadata");
2219
+ __name(_ts_metadata12, "_ts_metadata");
2545
2220
  var EmailService = class _EmailService {
2546
2221
  static {
2547
2222
  __name(this, "EmailService");
2548
2223
  }
2549
2224
  configService;
2550
- logger = new import_common45.Logger(_EmailService.name);
2225
+ logger = new import_common42.Logger(_EmailService.name);
2551
2226
  brevoClient;
2552
2227
  senderEmail;
2553
2228
  senderName;
@@ -2872,7 +2547,96 @@ DIDN'T MAKE THIS CHANGE?
2872
2547
  If you did not authorize this change, you can revert it within the next ${hoursUntilExpiry} hours by visiting:
2873
2548
  ${revertLink}
2874
2549
 
2875
- If you made this change, you can safely ignore this email.
2550
+ If you made this change, you can safely ignore this email.
2551
+
2552
+ ---
2553
+ Vritti AI Cloud - Cloud Management Platform
2554
+ This is an automated message, please do not reply.
2555
+ `.trim();
2556
+ await this.sendEmail({
2557
+ to: [
2558
+ {
2559
+ email: oldEmail,
2560
+ name
2561
+ }
2562
+ ],
2563
+ subject,
2564
+ htmlContent,
2565
+ textContent
2566
+ });
2567
+ this.logger.log(`Email change notification sent to ${oldEmail}`);
2568
+ }
2569
+ // Sends a confirmation to the restored email address after a revert
2570
+ async sendEmailRevertConfirmation(email, displayName) {
2571
+ const name = displayName || "there";
2572
+ const subject = "Email Address Change Reverted - Vritti AI Cloud";
2573
+ const htmlContent = `
2574
+ <!DOCTYPE html>
2575
+ <html>
2576
+ <head>
2577
+ <meta charset="UTF-8">
2578
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
2579
+ </head>
2580
+ <body style="margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; background-color: #f5f5f5;">
2581
+ <table role="presentation" style="width: 100%; border-collapse: collapse;">
2582
+ <tr>
2583
+ <td style="padding: 40px 20px;">
2584
+ <table role="presentation" style="max-width: 600px; margin: 0 auto; background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
2585
+ <!-- Header -->
2586
+ <tr>
2587
+ <td style="padding: 40px 40px 20px; text-align: center; border-bottom: 1px solid #e0e0e0;">
2588
+ <h1 style="margin: 0; color: #1a1a1a; font-size: 24px; font-weight: 600;">Email Change Reverted</h1>
2589
+ </td>
2590
+ </tr>
2591
+
2592
+ <!-- Content -->
2593
+ <tr>
2594
+ <td style="padding: 40px;">
2595
+ <p style="margin: 0 0 20px; color: #333333; font-size: 16px; line-height: 1.6;">
2596
+ Hello <strong>${name}</strong>,
2597
+ </p>
2598
+ <p style="margin: 0 0 30px; color: #333333; font-size: 16px; line-height: 1.6;">
2599
+ Your recent email address change has been successfully reverted. Your email is now:
2600
+ </p>
2601
+
2602
+ <div style="background-color: #d4edda; padding: 20px; border-radius: 8px; margin: 30px 0; text-align: center;">
2603
+ <p style="margin: 0; color: #155724; font-size: 18px; font-weight: 600; font-family: monospace;">
2604
+ ${email}
2605
+ </p>
2606
+ </div>
2607
+
2608
+ <p style="margin: 30px 0 20px; color: #666666; font-size: 14px; line-height: 1.6;">
2609
+ If you did not request this revert, please contact our support team immediately.
2610
+ </p>
2611
+ </td>
2612
+ </tr>
2613
+
2614
+ <!-- Footer -->
2615
+ <tr>
2616
+ <td style="padding: 30px 40px; border-top: 1px solid #e0e0e0; text-align: center;">
2617
+ <p style="margin: 0; color: #999999; font-size: 12px; line-height: 1.5;">
2618
+ Vritti AI Cloud - Cloud Management Platform
2619
+ </p>
2620
+ <p style="margin: 8px 0 0; color: #999999; font-size: 12px; line-height: 1.5;">
2621
+ This is an automated message, please do not reply.
2622
+ </p>
2623
+ </td>
2624
+ </tr>
2625
+ </table>
2626
+ </td>
2627
+ </tr>
2628
+ </table>
2629
+ </body>
2630
+ </html>
2631
+ `;
2632
+ const textContent = `
2633
+ Hello ${name},
2634
+
2635
+ Your recent email address change has been successfully reverted. Your email is now:
2636
+
2637
+ ${email}
2638
+
2639
+ If you did not request this revert, please contact our support team immediately.
2876
2640
 
2877
2641
  ---
2878
2642
  Vritti AI Cloud - Cloud Management Platform
@@ -2881,7 +2645,7 @@ This is an automated message, please do not reply.
2881
2645
  await this.sendEmail({
2882
2646
  to: [
2883
2647
  {
2884
- email: oldEmail,
2648
+ email,
2885
2649
  name
2886
2650
  }
2887
2651
  ],
@@ -2889,12 +2653,12 @@ This is an automated message, please do not reply.
2889
2653
  htmlContent,
2890
2654
  textContent
2891
2655
  });
2892
- this.logger.log(`Email change notification sent to ${oldEmail}`);
2656
+ this.logger.log(`Email revert confirmation sent to ${email}`);
2893
2657
  }
2894
- // Sends a confirmation to the restored email address after a revert
2895
- async sendEmailRevertConfirmation(email, displayName) {
2896
- const name = displayName || "there";
2897
- const subject = "Email Address Change Reverted - Vritti AI Cloud";
2658
+ // Sends an invite email to a new portal user with their set-password link
2659
+ async sendInviteEmail(params) {
2660
+ const { to, name, inviteUrl } = params;
2661
+ const subject = "You have been invited to Vritti AI";
2898
2662
  const htmlContent = `
2899
2663
  <!DOCTYPE html>
2900
2664
  <html>
@@ -2910,7 +2674,7 @@ This is an automated message, please do not reply.
2910
2674
  <!-- Header -->
2911
2675
  <tr>
2912
2676
  <td style="padding: 40px 40px 20px; text-align: center; border-bottom: 1px solid #e0e0e0;">
2913
- <h1 style="margin: 0; color: #1a1a1a; font-size: 24px; font-weight: 600;">Email Change Reverted</h1>
2677
+ <h1 style="margin: 0; color: #1a1a1a; font-size: 24px; font-weight: 600;">You're Invited</h1>
2914
2678
  </td>
2915
2679
  </tr>
2916
2680
 
@@ -2921,17 +2685,17 @@ This is an automated message, please do not reply.
2921
2685
  Hello <strong>${name}</strong>,
2922
2686
  </p>
2923
2687
  <p style="margin: 0 0 30px; color: #333333; font-size: 16px; line-height: 1.6;">
2924
- Your recent email address change has been successfully reverted. Your email is now:
2688
+ You have been invited to join Vritti AI. Click the button below to set your password and get started.
2925
2689
  </p>
2926
2690
 
2927
- <div style="background-color: #d4edda; padding: 20px; border-radius: 8px; margin: 30px 0; text-align: center;">
2928
- <p style="margin: 0; color: #155724; font-size: 18px; font-weight: 600; font-family: monospace;">
2929
- ${email}
2930
- </p>
2691
+ <div style="text-align: center; margin: 30px 0;">
2692
+ <a href="${inviteUrl}" style="display: inline-block; padding: 14px 32px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #ffffff; text-decoration: none; border-radius: 6px; font-weight: 600; font-size: 16px;">
2693
+ Set Your Password
2694
+ </a>
2931
2695
  </div>
2932
2696
 
2933
- <p style="margin: 30px 0 20px; color: #666666; font-size: 14px; line-height: 1.6;">
2934
- If you did not request this revert, please contact our support team immediately.
2697
+ <p style="margin: 30px 0 0; color: #666666; font-size: 14px; line-height: 1.6;">
2698
+ If you did not expect this invitation, you can safely ignore this email.
2935
2699
  </p>
2936
2700
  </td>
2937
2701
  </tr>
@@ -2957,11 +2721,11 @@ This is an automated message, please do not reply.
2957
2721
  const textContent = `
2958
2722
  Hello ${name},
2959
2723
 
2960
- Your recent email address change has been successfully reverted. Your email is now:
2724
+ You have been invited to join Vritti AI. Visit the link below to set your password and get started:
2961
2725
 
2962
- ${email}
2726
+ ${inviteUrl}
2963
2727
 
2964
- If you did not request this revert, please contact our support team immediately.
2728
+ If you did not expect this invitation, you can safely ignore this email.
2965
2729
 
2966
2730
  ---
2967
2731
  Vritti AI Cloud - Cloud Management Platform
@@ -2970,7 +2734,7 @@ This is an automated message, please do not reply.
2970
2734
  await this.sendEmail({
2971
2735
  to: [
2972
2736
  {
2973
- email,
2737
+ email: to,
2974
2738
  name
2975
2739
  }
2976
2740
  ],
@@ -2978,7 +2742,7 @@ This is an automated message, please do not reply.
2978
2742
  htmlContent,
2979
2743
  textContent
2980
2744
  });
2981
- this.logger.log(`Email revert confirmation sent to ${email}`);
2745
+ this.logger.log(`Invite email sent to ${to}`);
2982
2746
  }
2983
2747
  // Verifies Brevo API connectivity — a 400 response means the API is reachable
2984
2748
  async verifyConnection() {
@@ -3045,10 +2809,10 @@ This is an automated message, please do not reply.
3045
2809
  }
3046
2810
  };
3047
2811
  EmailService = _ts_decorate16([
3048
- (0, import_common45.Injectable)(),
3049
- _ts_metadata11("design:type", Function),
3050
- _ts_metadata11("design:paramtypes", [
3051
- typeof import_config10.ConfigService === "undefined" ? Object : import_config10.ConfigService
2812
+ (0, import_common42.Injectable)(),
2813
+ _ts_metadata12("design:type", Function),
2814
+ _ts_metadata12("design:paramtypes", [
2815
+ typeof import_config11.ConfigService === "undefined" ? Object : import_config11.ConfigService
3052
2816
  ])
3053
2817
  ], EmailService);
3054
2818
 
@@ -3066,10 +2830,10 @@ var EmailModule = class {
3066
2830
  }
3067
2831
  };
3068
2832
  EmailModule = _ts_decorate17([
3069
- (0, import_common46.Global)(),
3070
- (0, import_common46.Module)({
2833
+ (0, import_common43.Global)(),
2834
+ (0, import_common43.Module)({
3071
2835
  imports: [
3072
- import_config11.ConfigModule
2836
+ import_config12.ConfigModule
3073
2837
  ],
3074
2838
  providers: [
3075
2839
  EmailService
@@ -3081,7 +2845,7 @@ EmailModule = _ts_decorate17([
3081
2845
  ], EmailModule);
3082
2846
 
3083
2847
  // src/filters/http-exception.filter.ts
3084
- var import_common47 = require("@nestjs/common");
2848
+ var import_common44 = require("@nestjs/common");
3085
2849
  function _ts_decorate18(decorators, target, key, desc2) {
3086
2850
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
3087
2851
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
@@ -3090,7 +2854,7 @@ function _ts_decorate18(decorators, target, key, desc2) {
3090
2854
  }
3091
2855
  __name(_ts_decorate18, "_ts_decorate");
3092
2856
  function getHttpStatusTitle(status) {
3093
- const enumKey = Object.entries(import_common47.HttpStatus).find(([key, value]) => value === status && Number.isNaN(Number(key)))?.[0];
2857
+ const enumKey = Object.entries(import_common44.HttpStatus).find(([key, value]) => value === status && Number.isNaN(Number(key)))?.[0];
3094
2858
  if (!enumKey) {
3095
2859
  return "Error";
3096
2860
  }
@@ -3101,12 +2865,12 @@ var HttpExceptionFilter = class _HttpExceptionFilter {
3101
2865
  static {
3102
2866
  __name(this, "HttpExceptionFilter");
3103
2867
  }
3104
- logger = new import_common47.Logger(_HttpExceptionFilter.name);
2868
+ logger = new import_common44.Logger(_HttpExceptionFilter.name);
3105
2869
  catch(exception, host) {
3106
2870
  const ctx = host.switchToHttp();
3107
2871
  const response = ctx.getResponse();
3108
2872
  const request = ctx.getRequest();
3109
- let status = import_common47.HttpStatus.INTERNAL_SERVER_ERROR;
2873
+ let status = import_common44.HttpStatus.INTERNAL_SERVER_ERROR;
3110
2874
  let type = "about:blank";
3111
2875
  let label;
3112
2876
  let detail = "Internal server error";
@@ -3145,7 +2909,7 @@ var HttpExceptionFilter = class _HttpExceptionFilter {
3145
2909
  const axiosStatus = exception.response?.status;
3146
2910
  const axiosDetail = exception.response?.data?.message || exception.response?.data?.detail || exception.message;
3147
2911
  const url = exception.config?.url;
3148
- status = import_common47.HttpStatus.BAD_GATEWAY;
2912
+ status = import_common44.HttpStatus.BAD_GATEWAY;
3149
2913
  detail = `Upstream service error${axiosStatus ? ` (${axiosStatus})` : ""}: ${axiosDetail}`;
3150
2914
  this.logger.error(`Upstream API error [${axiosStatus}]: ${axiosDetail} \u2014 URL: ${url}`, exception.stack);
3151
2915
  } else {
@@ -3174,15 +2938,15 @@ var HttpExceptionFilter = class _HttpExceptionFilter {
3174
2938
  }
3175
2939
  };
3176
2940
  HttpExceptionFilter = _ts_decorate18([
3177
- (0, import_common47.Catch)()
2941
+ (0, import_common44.Catch)()
3178
2942
  ], HttpExceptionFilter);
3179
2943
 
3180
2944
  // src/logger/interceptors/http-logger.interceptor.ts
3181
- var import_common49 = require("@nestjs/common");
2945
+ var import_common46 = require("@nestjs/common");
3182
2946
  var import_operators = require("rxjs/operators");
3183
2947
 
3184
2948
  // src/logger/services/logger.service.ts
3185
- var import_common48 = require("@nestjs/common");
2949
+ var import_common45 = require("@nestjs/common");
3186
2950
  var import_winston = require("winston");
3187
2951
  var import_winston_daily_rotate_file = __toESM(require("winston-daily-rotate-file"), 1);
3188
2952
 
@@ -3227,16 +2991,16 @@ function _ts_decorate19(decorators, target, key, desc2) {
3227
2991
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3228
2992
  }
3229
2993
  __name(_ts_decorate19, "_ts_decorate");
3230
- function _ts_metadata12(k, v) {
2994
+ function _ts_metadata13(k, v) {
3231
2995
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3232
2996
  }
3233
- __name(_ts_metadata12, "_ts_metadata");
3234
- function _ts_param5(paramIndex, decorator) {
2997
+ __name(_ts_metadata13, "_ts_metadata");
2998
+ function _ts_param4(paramIndex, decorator) {
3235
2999
  return function(target, key) {
3236
3000
  decorator(target, key, paramIndex);
3237
3001
  };
3238
3002
  }
3239
- __name(_ts_param5, "_ts_param");
3003
+ __name(_ts_param4, "_ts_param");
3240
3004
  var LoggerService = class _LoggerService {
3241
3005
  static {
3242
3006
  __name(this, "LoggerService");
@@ -3429,11 +3193,11 @@ ${trace}`;
3429
3193
  }
3430
3194
  };
3431
3195
  LoggerService = _ts_decorate19([
3432
- (0, import_common48.Injectable)(),
3433
- _ts_param5(0, (0, import_common48.Optional)()),
3434
- _ts_param5(1, (0, import_common48.Optional)()),
3435
- _ts_metadata12("design:type", Function),
3436
- _ts_metadata12("design:paramtypes", [
3196
+ (0, import_common45.Injectable)(),
3197
+ _ts_param4(0, (0, import_common45.Optional)()),
3198
+ _ts_param4(1, (0, import_common45.Optional)()),
3199
+ _ts_metadata13("design:type", Function),
3200
+ _ts_metadata13("design:paramtypes", [
3437
3201
  typeof LoggerModuleOptions === "undefined" ? Object : LoggerModuleOptions,
3438
3202
  typeof Logger === "undefined" ? Object : Logger
3439
3203
  ])
@@ -3447,16 +3211,16 @@ function _ts_decorate20(decorators, target, key, desc2) {
3447
3211
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3448
3212
  }
3449
3213
  __name(_ts_decorate20, "_ts_decorate");
3450
- function _ts_metadata13(k, v) {
3214
+ function _ts_metadata14(k, v) {
3451
3215
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3452
3216
  }
3453
- __name(_ts_metadata13, "_ts_metadata");
3454
- function _ts_param6(paramIndex, decorator) {
3217
+ __name(_ts_metadata14, "_ts_metadata");
3218
+ function _ts_param5(paramIndex, decorator) {
3455
3219
  return function(target, key) {
3456
3220
  decorator(target, key, paramIndex);
3457
3221
  };
3458
3222
  }
3459
- __name(_ts_param6, "_ts_param");
3223
+ __name(_ts_param5, "_ts_param");
3460
3224
  var HttpLoggerInterceptor = class {
3461
3225
  static {
3462
3226
  __name(this, "HttpLoggerInterceptor");
@@ -3560,20 +3324,20 @@ var HttpLoggerInterceptor = class {
3560
3324
  }
3561
3325
  };
3562
3326
  HttpLoggerInterceptor = _ts_decorate20([
3563
- (0, import_common49.Injectable)(),
3564
- _ts_param6(1, (0, import_common49.Optional)()),
3565
- _ts_metadata13("design:type", Function),
3566
- _ts_metadata13("design:paramtypes", [
3327
+ (0, import_common46.Injectable)(),
3328
+ _ts_param5(1, (0, import_common46.Optional)()),
3329
+ _ts_metadata14("design:type", Function),
3330
+ _ts_metadata14("design:paramtypes", [
3567
3331
  typeof LoggerService === "undefined" ? Object : LoggerService,
3568
3332
  typeof HttpLoggerOptions === "undefined" ? Object : HttpLoggerOptions
3569
3333
  ])
3570
3334
  ], HttpLoggerInterceptor);
3571
3335
 
3572
3336
  // src/logger/logger.module.ts
3573
- var import_common51 = require("@nestjs/common");
3337
+ var import_common48 = require("@nestjs/common");
3574
3338
 
3575
3339
  // src/logger/middleware/correlation-id.middleware.ts
3576
- var import_common50 = require("@nestjs/common");
3340
+ var import_common47 = require("@nestjs/common");
3577
3341
  function _ts_decorate21(decorators, target, key, desc2) {
3578
3342
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
3579
3343
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
@@ -3581,10 +3345,10 @@ function _ts_decorate21(decorators, target, key, desc2) {
3581
3345
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3582
3346
  }
3583
3347
  __name(_ts_decorate21, "_ts_decorate");
3584
- function _ts_metadata14(k, v) {
3348
+ function _ts_metadata15(k, v) {
3585
3349
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3586
3350
  }
3587
- __name(_ts_metadata14, "_ts_metadata");
3351
+ __name(_ts_metadata15, "_ts_metadata");
3588
3352
  var CorrelationIdMiddleware = class {
3589
3353
  static {
3590
3354
  __name(this, "CorrelationIdMiddleware");
@@ -3622,9 +3386,9 @@ var CorrelationIdMiddleware = class {
3622
3386
  }
3623
3387
  };
3624
3388
  CorrelationIdMiddleware = _ts_decorate21([
3625
- (0, import_common50.Injectable)(),
3626
- _ts_metadata14("design:type", Function),
3627
- _ts_metadata14("design:paramtypes", [
3389
+ (0, import_common47.Injectable)(),
3390
+ _ts_metadata15("design:type", Function),
3391
+ _ts_metadata15("design:paramtypes", [
3628
3392
  typeof CorrelationIdMiddlewareOptions === "undefined" ? Object : CorrelationIdMiddlewareOptions
3629
3393
  ])
3630
3394
  ], CorrelationIdMiddleware);
@@ -3713,9 +3477,9 @@ function mergeWithDefaults(options = {}) {
3713
3477
  __name(mergeWithDefaults, "mergeWithDefaults");
3714
3478
  function createDefaultLoggerProvider(options) {
3715
3479
  return {
3716
- provide: import_common51.Logger,
3480
+ provide: import_common48.Logger,
3717
3481
  useFactory: /* @__PURE__ */ __name(() => {
3718
- const logger = new import_common51.Logger();
3482
+ const logger = new import_common48.Logger();
3719
3483
  if (options.level) {
3720
3484
  const levels = getLevelsUpTo(options.level);
3721
3485
  logger.setLogLevels?.(levels);
@@ -3745,7 +3509,7 @@ function createLoggerProviders(options = {}) {
3745
3509
  inject: [
3746
3510
  LOGGER_MODULE_OPTIONS,
3747
3511
  {
3748
- token: import_common51.Logger,
3512
+ token: import_common48.Logger,
3749
3513
  optional: true
3750
3514
  }
3751
3515
  ]
@@ -3824,10 +3588,10 @@ var LoggerModule = class _LoggerModule {
3824
3588
  ...asyncProviders,
3825
3589
  // Default logger provider
3826
3590
  {
3827
- provide: import_common51.Logger,
3591
+ provide: import_common48.Logger,
3828
3592
  useFactory: /* @__PURE__ */ __name((opts) => {
3829
3593
  if (opts.provider === "default") {
3830
- const logger = new import_common51.Logger();
3594
+ const logger = new import_common48.Logger();
3831
3595
  if (opts.level) {
3832
3596
  const levels = getLevelsUpTo(opts.level);
3833
3597
  logger.setLogLevels?.(levels);
@@ -3849,7 +3613,7 @@ var LoggerModule = class _LoggerModule {
3849
3613
  inject: [
3850
3614
  LOGGER_MODULE_OPTIONS,
3851
3615
  {
3852
- token: import_common51.Logger,
3616
+ token: import_common48.Logger,
3853
3617
  optional: true
3854
3618
  }
3855
3619
  ]
@@ -3949,24 +3713,24 @@ var LoggerModule = class _LoggerModule {
3949
3713
  }
3950
3714
  };
3951
3715
  LoggerModule = _ts_decorate22([
3952
- (0, import_common51.Global)(),
3953
- (0, import_common51.Module)({})
3716
+ (0, import_common48.Global)(),
3717
+ (0, import_common48.Module)({})
3954
3718
  ], LoggerModule);
3955
3719
 
3956
3720
  // src/root/root.module.ts
3957
- var import_common57 = require("@nestjs/common");
3721
+ var import_common54 = require("@nestjs/common");
3958
3722
 
3959
3723
  // src/root/controllers/app.controller.ts
3960
- var import_common54 = require("@nestjs/common");
3961
- var import_swagger5 = require("@nestjs/swagger");
3724
+ var import_common51 = require("@nestjs/common");
3725
+ var import_swagger7 = require("@nestjs/swagger");
3962
3726
 
3963
3727
  // src/root/docs/app.docs.ts
3964
- var import_common52 = require("@nestjs/common");
3965
- var import_swagger4 = require("@nestjs/swagger");
3728
+ var import_common49 = require("@nestjs/common");
3729
+ var import_swagger6 = require("@nestjs/swagger");
3966
3730
  function ApiHealthCheck() {
3967
- return (0, import_common52.applyDecorators)((0, import_swagger4.ApiOperation)({
3731
+ return (0, import_common49.applyDecorators)((0, import_swagger6.ApiOperation)({
3968
3732
  summary: "Health check endpoint"
3969
- }), (0, import_swagger4.ApiResponse)({
3733
+ }), (0, import_swagger6.ApiResponse)({
3970
3734
  status: 200,
3971
3735
  description: "Returns a welcome message indicating the API is running",
3972
3736
  type: String
@@ -3975,7 +3739,7 @@ function ApiHealthCheck() {
3975
3739
  __name(ApiHealthCheck, "ApiHealthCheck");
3976
3740
 
3977
3741
  // src/root/services/app.service.ts
3978
- var import_common53 = require("@nestjs/common");
3742
+ var import_common50 = require("@nestjs/common");
3979
3743
  function _ts_decorate23(decorators, target, key, desc2) {
3980
3744
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
3981
3745
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
@@ -3993,7 +3757,7 @@ var AppService = class {
3993
3757
  }
3994
3758
  };
3995
3759
  AppService = _ts_decorate23([
3996
- (0, import_common53.Injectable)()
3760
+ (0, import_common50.Injectable)()
3997
3761
  ], AppService);
3998
3762
 
3999
3763
  // src/root/controllers/app.controller.ts
@@ -4004,10 +3768,10 @@ function _ts_decorate24(decorators, target, key, desc2) {
4004
3768
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4005
3769
  }
4006
3770
  __name(_ts_decorate24, "_ts_decorate");
4007
- function _ts_metadata15(k, v) {
3771
+ function _ts_metadata16(k, v) {
4008
3772
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4009
3773
  }
4010
- __name(_ts_metadata15, "_ts_metadata");
3774
+ __name(_ts_metadata16, "_ts_metadata");
4011
3775
  var AppController = class {
4012
3776
  static {
4013
3777
  __name(this, "AppController");
@@ -4022,34 +3786,34 @@ var AppController = class {
4022
3786
  }
4023
3787
  };
4024
3788
  _ts_decorate24([
4025
- (0, import_common54.Get)(),
3789
+ (0, import_common51.Get)(),
4026
3790
  Public(),
4027
3791
  ApiHealthCheck(),
4028
- _ts_metadata15("design:type", Function),
4029
- _ts_metadata15("design:paramtypes", []),
4030
- _ts_metadata15("design:returntype", String)
3792
+ _ts_metadata16("design:type", Function),
3793
+ _ts_metadata16("design:paramtypes", []),
3794
+ _ts_metadata16("design:returntype", String)
4031
3795
  ], AppController.prototype, "getHello", null);
4032
3796
  AppController = _ts_decorate24([
4033
- (0, import_swagger5.ApiTags)("Health"),
4034
- (0, import_common54.Controller)(),
4035
- _ts_metadata15("design:type", Function),
4036
- _ts_metadata15("design:paramtypes", [
3797
+ (0, import_swagger7.ApiTags)("Health"),
3798
+ (0, import_common51.Controller)(),
3799
+ _ts_metadata16("design:type", Function),
3800
+ _ts_metadata16("design:paramtypes", [
4037
3801
  typeof AppService === "undefined" ? Object : AppService
4038
3802
  ])
4039
3803
  ], AppController);
4040
3804
 
4041
3805
  // src/root/controllers/csrf.controller.ts
4042
- var import_common56 = require("@nestjs/common");
4043
- var import_swagger7 = require("@nestjs/swagger");
3806
+ var import_common53 = require("@nestjs/common");
3807
+ var import_swagger9 = require("@nestjs/swagger");
4044
3808
 
4045
3809
  // src/root/docs/csrf.docs.ts
4046
- var import_common55 = require("@nestjs/common");
4047
- var import_swagger6 = require("@nestjs/swagger");
3810
+ var import_common52 = require("@nestjs/common");
3811
+ var import_swagger8 = require("@nestjs/swagger");
4048
3812
  function ApiGetCsrfToken() {
4049
- return (0, import_common55.applyDecorators)((0, import_swagger6.ApiOperation)({
3813
+ return (0, import_common52.applyDecorators)((0, import_swagger8.ApiOperation)({
4050
3814
  summary: "Get CSRF token",
4051
3815
  description: "Generates and returns a CSRF token that must be included in all state-changing requests (POST, PUT, PATCH, DELETE). The token should be sent in the X-CSRF-Token header."
4052
- }), (0, import_swagger6.ApiResponse)({
3816
+ }), (0, import_swagger8.ApiResponse)({
4053
3817
  status: 200,
4054
3818
  description: "CSRF token generated successfully",
4055
3819
  schema: {
@@ -4077,16 +3841,16 @@ function _ts_decorate25(decorators, target, key, desc2) {
4077
3841
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4078
3842
  }
4079
3843
  __name(_ts_decorate25, "_ts_decorate");
4080
- function _ts_metadata16(k, v) {
3844
+ function _ts_metadata17(k, v) {
4081
3845
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4082
3846
  }
4083
- __name(_ts_metadata16, "_ts_metadata");
4084
- function _ts_param7(paramIndex, decorator) {
3847
+ __name(_ts_metadata17, "_ts_metadata");
3848
+ function _ts_param6(paramIndex, decorator) {
4085
3849
  return function(target, key) {
4086
3850
  decorator(target, key, paramIndex);
4087
3851
  };
4088
3852
  }
4089
- __name(_ts_param7, "_ts_param");
3853
+ __name(_ts_param6, "_ts_param");
4090
3854
  var CsrfController = class {
4091
3855
  static {
4092
3856
  __name(this, "CsrfController");
@@ -4100,22 +3864,22 @@ var CsrfController = class {
4100
3864
  }
4101
3865
  };
4102
3866
  _ts_decorate25([
4103
- (0, import_common56.Get)("token"),
3867
+ (0, import_common53.Get)("token"),
4104
3868
  Public(),
4105
- (0, import_common56.HttpCode)(import_common56.HttpStatus.OK),
3869
+ (0, import_common53.HttpCode)(import_common53.HttpStatus.OK),
4106
3870
  ApiGetCsrfToken(),
4107
- _ts_param7(0, (0, import_common56.Res)({
3871
+ _ts_param6(0, (0, import_common53.Res)({
4108
3872
  passthrough: true
4109
3873
  })),
4110
- _ts_metadata16("design:type", Function),
4111
- _ts_metadata16("design:paramtypes", [
3874
+ _ts_metadata17("design:type", Function),
3875
+ _ts_metadata17("design:paramtypes", [
4112
3876
  typeof FastifyReply === "undefined" ? Object : FastifyReply
4113
3877
  ]),
4114
- _ts_metadata16("design:returntype", Object)
3878
+ _ts_metadata17("design:returntype", Object)
4115
3879
  ], CsrfController.prototype, "getToken", null);
4116
3880
  CsrfController = _ts_decorate25([
4117
- (0, import_swagger7.ApiTags)("CSRF"),
4118
- (0, import_common56.Controller)("csrf")
3881
+ (0, import_swagger9.ApiTags)("CSRF"),
3882
+ (0, import_common53.Controller)("csrf")
4119
3883
  ], CsrfController);
4120
3884
 
4121
3885
  // src/root/root.module.ts
@@ -4132,7 +3896,7 @@ var RootModule = class {
4132
3896
  }
4133
3897
  };
4134
3898
  RootModule = _ts_decorate26([
4135
- (0, import_common57.Module)({
3899
+ (0, import_common54.Module)({
4136
3900
  controllers: [
4137
3901
  AppController,
4138
3902
  CsrfController
@@ -4354,22 +4118,22 @@ function normalizePhoneNumber(phone) {
4354
4118
  __name(normalizePhoneNumber, "normalizePhoneNumber");
4355
4119
 
4356
4120
  // src/data-table/data-table.module.ts
4357
- var import_common65 = require("@nestjs/common");
4358
- var import_config14 = require("@nestjs/config");
4121
+ var import_common62 = require("@nestjs/common");
4122
+ var import_config15 = require("@nestjs/config");
4359
4123
 
4360
4124
  // src/data-table/data-table.constants.ts
4361
4125
  var DATA_TABLE_VIEWS_TABLE = Symbol("DATA_TABLE_VIEWS_TABLE");
4362
4126
 
4363
4127
  // src/data-table/state/controllers/data-table-state.controller.ts
4364
- var import_common60 = require("@nestjs/common");
4365
- var import_swagger10 = require("@nestjs/swagger");
4128
+ var import_common57 = require("@nestjs/common");
4129
+ var import_swagger12 = require("@nestjs/swagger");
4366
4130
 
4367
4131
  // src/data-table/state/docs/data-table-state.docs.ts
4368
- var import_common58 = require("@nestjs/common");
4369
- var import_swagger9 = require("@nestjs/swagger");
4132
+ var import_common55 = require("@nestjs/common");
4133
+ var import_swagger11 = require("@nestjs/swagger");
4370
4134
 
4371
4135
  // src/data-table/state/dto/request/upsert-data-table-state.dto.ts
4372
- var import_swagger8 = require("@nestjs/swagger");
4136
+ var import_swagger10 = require("@nestjs/swagger");
4373
4137
  var import_class_validator3 = require("class-validator");
4374
4138
  function _ts_decorate27(decorators, target, key, desc2) {
4375
4139
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
@@ -4378,10 +4142,10 @@ function _ts_decorate27(decorators, target, key, desc2) {
4378
4142
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4379
4143
  }
4380
4144
  __name(_ts_decorate27, "_ts_decorate");
4381
- function _ts_metadata17(k, v) {
4145
+ function _ts_metadata18(k, v) {
4382
4146
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4383
4147
  }
4384
- __name(_ts_metadata17, "_ts_metadata");
4148
+ __name(_ts_metadata18, "_ts_metadata");
4385
4149
  var UpsertDataTableStateDto = class {
4386
4150
  static {
4387
4151
  __name(this, "UpsertDataTableStateDto");
@@ -4391,42 +4155,42 @@ var UpsertDataTableStateDto = class {
4391
4155
  activeViewId;
4392
4156
  };
4393
4157
  _ts_decorate27([
4394
- (0, import_swagger8.ApiProperty)({
4158
+ (0, import_swagger10.ApiProperty)({
4395
4159
  description: "Unique slug identifying the table",
4396
4160
  example: "cloud-providers"
4397
4161
  }),
4398
4162
  (0, import_class_validator3.IsString)(),
4399
4163
  (0, import_class_validator3.MaxLength)(100),
4400
- _ts_metadata17("design:type", String)
4164
+ _ts_metadata18("design:type", String)
4401
4165
  ], UpsertDataTableStateDto.prototype, "tableSlug", void 0);
4402
4166
  _ts_decorate27([
4403
- (0, import_swagger8.ApiProperty)({
4167
+ (0, import_swagger10.ApiProperty)({
4404
4168
  description: "Full table view state including filters, sort, and column visibility"
4405
4169
  }),
4406
4170
  (0, import_class_validator3.IsObject)(),
4407
- _ts_metadata17("design:type", typeof TableViewState === "undefined" ? Object : TableViewState)
4171
+ _ts_metadata18("design:type", typeof TableViewState === "undefined" ? Object : TableViewState)
4408
4172
  ], UpsertDataTableStateDto.prototype, "state", void 0);
4409
4173
  _ts_decorate27([
4410
- (0, import_swagger8.ApiPropertyOptional)(),
4174
+ (0, import_swagger10.ApiPropertyOptional)(),
4411
4175
  (0, import_class_validator3.IsOptional)(),
4412
4176
  (0, import_class_validator3.IsUUID)(),
4413
- _ts_metadata17("design:type", Object)
4177
+ _ts_metadata18("design:type", Object)
4414
4178
  ], UpsertDataTableStateDto.prototype, "activeViewId", void 0);
4415
4179
 
4416
4180
  // src/data-table/state/docs/data-table-state.docs.ts
4417
4181
  function ApiUpsertDataTableState() {
4418
- return (0, import_common58.applyDecorators)((0, import_swagger9.ApiOperation)({
4182
+ return (0, import_common55.applyDecorators)((0, import_swagger11.ApiOperation)({
4419
4183
  summary: "Save live table state",
4420
4184
  description: "Stores the current filter, sort, and column visibility state in Redis cache. Called on filter Apply and sort column click. State expires after TABLE_STATE_CACHE_TTL seconds."
4421
- }), (0, import_swagger9.ApiBody)({
4185
+ }), (0, import_swagger11.ApiBody)({
4422
4186
  type: UpsertDataTableStateDto
4423
- }), (0, import_swagger9.ApiResponse)({
4187
+ }), (0, import_swagger11.ApiResponse)({
4424
4188
  status: 200,
4425
4189
  description: "Live state cached."
4426
- }), (0, import_swagger9.ApiResponse)({
4190
+ }), (0, import_swagger11.ApiResponse)({
4427
4191
  status: 400,
4428
4192
  description: "Invalid request body."
4429
- }), (0, import_swagger9.ApiResponse)({
4193
+ }), (0, import_swagger11.ApiResponse)({
4430
4194
  status: 401,
4431
4195
  description: "Unauthorized."
4432
4196
  }));
@@ -4434,8 +4198,8 @@ function ApiUpsertDataTableState() {
4434
4198
  __name(ApiUpsertDataTableState, "ApiUpsertDataTableState");
4435
4199
 
4436
4200
  // src/data-table/state/services/data-table-state.service.ts
4437
- var import_common59 = require("@nestjs/common");
4438
- var import_config12 = require("@nestjs/config");
4201
+ var import_common56 = require("@nestjs/common");
4202
+ var import_config13 = require("@nestjs/config");
4439
4203
  function _ts_decorate28(decorators, target, key, desc2) {
4440
4204
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
4441
4205
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
@@ -4443,10 +4207,10 @@ function _ts_decorate28(decorators, target, key, desc2) {
4443
4207
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4444
4208
  }
4445
4209
  __name(_ts_decorate28, "_ts_decorate");
4446
- function _ts_metadata18(k, v) {
4210
+ function _ts_metadata19(k, v) {
4447
4211
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4448
4212
  }
4449
- __name(_ts_metadata18, "_ts_metadata");
4213
+ __name(_ts_metadata19, "_ts_metadata");
4450
4214
  var EMPTY_TABLE_STATE = {
4451
4215
  filters: [],
4452
4216
  sort: [],
@@ -4472,7 +4236,7 @@ var DataTableStateService = class _DataTableStateService {
4472
4236
  }
4473
4237
  cacheService;
4474
4238
  configService;
4475
- logger = new import_common59.Logger(_DataTableStateService.name);
4239
+ logger = new import_common56.Logger(_DataTableStateService.name);
4476
4240
  constructor(cacheService, configService) {
4477
4241
  this.cacheService = cacheService;
4478
4242
  this.configService = configService;
@@ -4501,11 +4265,11 @@ var DataTableStateService = class _DataTableStateService {
4501
4265
  }
4502
4266
  };
4503
4267
  DataTableStateService = _ts_decorate28([
4504
- (0, import_common59.Injectable)(),
4505
- _ts_metadata18("design:type", Function),
4506
- _ts_metadata18("design:paramtypes", [
4268
+ (0, import_common56.Injectable)(),
4269
+ _ts_metadata19("design:type", Function),
4270
+ _ts_metadata19("design:paramtypes", [
4507
4271
  typeof CacheService === "undefined" ? Object : CacheService,
4508
- typeof import_config12.ConfigService === "undefined" ? Object : import_config12.ConfigService
4272
+ typeof import_config13.ConfigService === "undefined" ? Object : import_config13.ConfigService
4509
4273
  ])
4510
4274
  ], DataTableStateService);
4511
4275
 
@@ -4517,22 +4281,22 @@ function _ts_decorate29(decorators, target, key, desc2) {
4517
4281
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4518
4282
  }
4519
4283
  __name(_ts_decorate29, "_ts_decorate");
4520
- function _ts_metadata19(k, v) {
4284
+ function _ts_metadata20(k, v) {
4521
4285
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4522
4286
  }
4523
- __name(_ts_metadata19, "_ts_metadata");
4524
- function _ts_param8(paramIndex, decorator) {
4287
+ __name(_ts_metadata20, "_ts_metadata");
4288
+ function _ts_param7(paramIndex, decorator) {
4525
4289
  return function(target, key) {
4526
4290
  decorator(target, key, paramIndex);
4527
4291
  };
4528
4292
  }
4529
- __name(_ts_param8, "_ts_param");
4293
+ __name(_ts_param7, "_ts_param");
4530
4294
  var DataTableStateController = class _DataTableStateController {
4531
4295
  static {
4532
4296
  __name(this, "DataTableStateController");
4533
4297
  }
4534
4298
  dataTableStateService;
4535
- logger = new import_common60.Logger(_DataTableStateController.name);
4299
+ logger = new import_common57.Logger(_DataTableStateController.name);
4536
4300
  constructor(dataTableStateService) {
4537
4301
  this.dataTableStateService = dataTableStateService;
4538
4302
  }
@@ -4543,38 +4307,39 @@ var DataTableStateController = class _DataTableStateController {
4543
4307
  }
4544
4308
  };
4545
4309
  _ts_decorate29([
4546
- (0, import_common60.Post)(),
4547
- (0, import_common60.HttpCode)(import_common60.HttpStatus.OK),
4310
+ (0, import_common57.Post)(),
4311
+ (0, import_common57.HttpCode)(import_common57.HttpStatus.OK),
4548
4312
  ApiUpsertDataTableState(),
4549
- _ts_param8(0, UserId()),
4550
- _ts_param8(1, (0, import_common60.Body)()),
4551
- _ts_metadata19("design:type", Function),
4552
- _ts_metadata19("design:paramtypes", [
4313
+ _ts_param7(0, UserId()),
4314
+ _ts_param7(1, (0, import_common57.Body)()),
4315
+ _ts_metadata20("design:type", Function),
4316
+ _ts_metadata20("design:paramtypes", [
4553
4317
  String,
4554
4318
  typeof UpsertDataTableStateDto === "undefined" ? Object : UpsertDataTableStateDto
4555
4319
  ]),
4556
- _ts_metadata19("design:returntype", typeof Promise === "undefined" ? Object : Promise)
4320
+ _ts_metadata20("design:returntype", typeof Promise === "undefined" ? Object : Promise)
4557
4321
  ], DataTableStateController.prototype, "upsertCurrentState", null);
4558
4322
  DataTableStateController = _ts_decorate29([
4559
- (0, import_swagger10.ApiTags)("Table States"),
4560
- (0, import_swagger10.ApiBearerAuth)(),
4561
- (0, import_common60.Controller)("table-states"),
4562
- _ts_metadata19("design:type", Function),
4563
- _ts_metadata19("design:paramtypes", [
4323
+ (0, import_swagger12.ApiTags)("Table States"),
4324
+ (0, import_swagger12.ApiBearerAuth)(),
4325
+ RequireSession("CLOUD", "ADMIN"),
4326
+ (0, import_common57.Controller)("table-states"),
4327
+ _ts_metadata20("design:type", Function),
4328
+ _ts_metadata20("design:paramtypes", [
4564
4329
  typeof DataTableStateService === "undefined" ? Object : DataTableStateService
4565
4330
  ])
4566
4331
  ], DataTableStateController);
4567
4332
 
4568
4333
  // src/data-table/views/controllers/data-table-views.controller.ts
4569
- var import_common64 = require("@nestjs/common");
4570
- var import_swagger17 = require("@nestjs/swagger");
4334
+ var import_common61 = require("@nestjs/common");
4335
+ var import_swagger19 = require("@nestjs/swagger");
4571
4336
 
4572
4337
  // src/data-table/views/docs/data-table-views.docs.ts
4573
- var import_common61 = require("@nestjs/common");
4574
- var import_swagger16 = require("@nestjs/swagger");
4338
+ var import_common58 = require("@nestjs/common");
4339
+ var import_swagger18 = require("@nestjs/swagger");
4575
4340
 
4576
4341
  // src/data-table/views/dto/entity/data-table-view.dto.ts
4577
- var import_swagger11 = require("@nestjs/swagger");
4342
+ var import_swagger13 = require("@nestjs/swagger");
4578
4343
  function _ts_decorate30(decorators, target, key, desc2) {
4579
4344
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
4580
4345
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
@@ -4582,10 +4347,10 @@ function _ts_decorate30(decorators, target, key, desc2) {
4582
4347
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4583
4348
  }
4584
4349
  __name(_ts_decorate30, "_ts_decorate");
4585
- function _ts_metadata20(k, v) {
4350
+ function _ts_metadata21(k, v) {
4586
4351
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4587
4352
  }
4588
- __name(_ts_metadata20, "_ts_metadata");
4353
+ __name(_ts_metadata21, "_ts_metadata");
4589
4354
  var DataTableViewDto = class _DataTableViewDto {
4590
4355
  static {
4591
4356
  __name(this, "DataTableViewDto");
@@ -4613,61 +4378,61 @@ var DataTableViewDto = class _DataTableViewDto {
4613
4378
  }
4614
4379
  };
4615
4380
  _ts_decorate30([
4616
- (0, import_swagger11.ApiProperty)({
4381
+ (0, import_swagger13.ApiProperty)({
4617
4382
  description: "View unique identifier"
4618
4383
  }),
4619
- _ts_metadata20("design:type", String)
4384
+ _ts_metadata21("design:type", String)
4620
4385
  ], DataTableViewDto.prototype, "id", void 0);
4621
4386
  _ts_decorate30([
4622
- (0, import_swagger11.ApiPropertyOptional)({
4387
+ (0, import_swagger13.ApiPropertyOptional)({
4623
4388
  description: "Display name of the view",
4624
4389
  nullable: true
4625
4390
  }),
4626
- _ts_metadata20("design:type", Object)
4391
+ _ts_metadata21("design:type", Object)
4627
4392
  ], DataTableViewDto.prototype, "name", void 0);
4628
4393
  _ts_decorate30([
4629
- (0, import_swagger11.ApiProperty)({
4394
+ (0, import_swagger13.ApiProperty)({
4630
4395
  description: "Slug of the table this view belongs to",
4631
4396
  example: "cloud-providers"
4632
4397
  }),
4633
- _ts_metadata20("design:type", String)
4398
+ _ts_metadata21("design:type", String)
4634
4399
  ], DataTableViewDto.prototype, "tableSlug", void 0);
4635
4400
  _ts_decorate30([
4636
- (0, import_swagger11.ApiProperty)({
4401
+ (0, import_swagger13.ApiProperty)({
4637
4402
  description: "Stored filter, sort, and column visibility state"
4638
4403
  }),
4639
- _ts_metadata20("design:type", typeof TableViewState === "undefined" ? Object : TableViewState)
4404
+ _ts_metadata21("design:type", typeof TableViewState === "undefined" ? Object : TableViewState)
4640
4405
  ], DataTableViewDto.prototype, "state", void 0);
4641
4406
  _ts_decorate30([
4642
- (0, import_swagger11.ApiProperty)({
4407
+ (0, import_swagger13.ApiProperty)({
4643
4408
  description: "Whether the view is visible to all users",
4644
4409
  example: false
4645
4410
  }),
4646
- _ts_metadata20("design:type", Boolean)
4411
+ _ts_metadata21("design:type", Boolean)
4647
4412
  ], DataTableViewDto.prototype, "isShared", void 0);
4648
4413
  _ts_decorate30([
4649
- (0, import_swagger11.ApiProperty)({
4414
+ (0, import_swagger13.ApiProperty)({
4650
4415
  description: "Whether the requesting user owns this view",
4651
4416
  example: true
4652
4417
  }),
4653
- _ts_metadata20("design:type", Boolean)
4418
+ _ts_metadata21("design:type", Boolean)
4654
4419
  ], DataTableViewDto.prototype, "isOwn", void 0);
4655
4420
  _ts_decorate30([
4656
- (0, import_swagger11.ApiProperty)({
4421
+ (0, import_swagger13.ApiProperty)({
4657
4422
  description: "Creation timestamp"
4658
4423
  }),
4659
- _ts_metadata20("design:type", typeof Date === "undefined" ? Object : Date)
4424
+ _ts_metadata21("design:type", typeof Date === "undefined" ? Object : Date)
4660
4425
  ], DataTableViewDto.prototype, "createdAt", void 0);
4661
4426
  _ts_decorate30([
4662
- (0, import_swagger11.ApiPropertyOptional)({
4427
+ (0, import_swagger13.ApiPropertyOptional)({
4663
4428
  description: "Last updated timestamp",
4664
4429
  nullable: true
4665
4430
  }),
4666
- _ts_metadata20("design:type", Object)
4431
+ _ts_metadata21("design:type", Object)
4667
4432
  ], DataTableViewDto.prototype, "updatedAt", void 0);
4668
4433
 
4669
4434
  // src/data-table/views/dto/request/create-data-table-view.dto.ts
4670
- var import_swagger12 = require("@nestjs/swagger");
4435
+ var import_swagger14 = require("@nestjs/swagger");
4671
4436
  var import_class_validator4 = require("class-validator");
4672
4437
  function _ts_decorate31(decorators, target, key, desc2) {
4673
4438
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
@@ -4676,10 +4441,10 @@ function _ts_decorate31(decorators, target, key, desc2) {
4676
4441
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4677
4442
  }
4678
4443
  __name(_ts_decorate31, "_ts_decorate");
4679
- function _ts_metadata21(k, v) {
4444
+ function _ts_metadata22(k, v) {
4680
4445
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4681
4446
  }
4682
- __name(_ts_metadata21, "_ts_metadata");
4447
+ __name(_ts_metadata22, "_ts_metadata");
4683
4448
  var CreateDataTableViewDto = class {
4684
4449
  static {
4685
4450
  __name(this, "CreateDataTableViewDto");
@@ -4690,42 +4455,42 @@ var CreateDataTableViewDto = class {
4690
4455
  isShared;
4691
4456
  };
4692
4457
  _ts_decorate31([
4693
- (0, import_swagger12.ApiProperty)({
4458
+ (0, import_swagger14.ApiProperty)({
4694
4459
  description: "Display name for the saved view",
4695
4460
  example: "AWS Only"
4696
4461
  }),
4697
4462
  (0, import_class_validator4.IsString)(),
4698
4463
  (0, import_class_validator4.MaxLength)(100),
4699
- _ts_metadata21("design:type", String)
4464
+ _ts_metadata22("design:type", String)
4700
4465
  ], CreateDataTableViewDto.prototype, "name", void 0);
4701
4466
  _ts_decorate31([
4702
- (0, import_swagger12.ApiProperty)({
4467
+ (0, import_swagger14.ApiProperty)({
4703
4468
  description: "Unique slug identifying the table",
4704
4469
  example: "cloud-providers"
4705
4470
  }),
4706
4471
  (0, import_class_validator4.IsString)(),
4707
4472
  (0, import_class_validator4.MaxLength)(100),
4708
- _ts_metadata21("design:type", String)
4473
+ _ts_metadata22("design:type", String)
4709
4474
  ], CreateDataTableViewDto.prototype, "tableSlug", void 0);
4710
4475
  _ts_decorate31([
4711
- (0, import_swagger12.ApiProperty)({
4476
+ (0, import_swagger14.ApiProperty)({
4712
4477
  description: "Full table view state including filters, sort, and column visibility"
4713
4478
  }),
4714
4479
  (0, import_class_validator4.IsObject)(),
4715
- _ts_metadata21("design:type", typeof TableViewState === "undefined" ? Object : TableViewState)
4480
+ _ts_metadata22("design:type", typeof TableViewState === "undefined" ? Object : TableViewState)
4716
4481
  ], CreateDataTableViewDto.prototype, "state", void 0);
4717
4482
  _ts_decorate31([
4718
- (0, import_swagger12.ApiPropertyOptional)({
4483
+ (0, import_swagger14.ApiPropertyOptional)({
4719
4484
  description: "Whether this view is visible to all users",
4720
4485
  example: false
4721
4486
  }),
4722
4487
  (0, import_class_validator4.IsBoolean)(),
4723
4488
  (0, import_class_validator4.IsOptional)(),
4724
- _ts_metadata21("design:type", Boolean)
4489
+ _ts_metadata22("design:type", Boolean)
4725
4490
  ], CreateDataTableViewDto.prototype, "isShared", void 0);
4726
4491
 
4727
4492
  // src/data-table/views/dto/request/rename-data-table-view.dto.ts
4728
- var import_swagger13 = require("@nestjs/swagger");
4493
+ var import_swagger15 = require("@nestjs/swagger");
4729
4494
  var import_class_validator5 = require("class-validator");
4730
4495
  function _ts_decorate32(decorators, target, key, desc2) {
4731
4496
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
@@ -4734,10 +4499,10 @@ function _ts_decorate32(decorators, target, key, desc2) {
4734
4499
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4735
4500
  }
4736
4501
  __name(_ts_decorate32, "_ts_decorate");
4737
- function _ts_metadata22(k, v) {
4502
+ function _ts_metadata23(k, v) {
4738
4503
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4739
4504
  }
4740
- __name(_ts_metadata22, "_ts_metadata");
4505
+ __name(_ts_metadata23, "_ts_metadata");
4741
4506
  var RenameDataTableViewDto = class {
4742
4507
  static {
4743
4508
  __name(this, "RenameDataTableViewDto");
@@ -4745,18 +4510,18 @@ var RenameDataTableViewDto = class {
4745
4510
  name;
4746
4511
  };
4747
4512
  _ts_decorate32([
4748
- (0, import_swagger13.ApiProperty)({
4513
+ (0, import_swagger15.ApiProperty)({
4749
4514
  description: "New display name for the view",
4750
4515
  example: "AWS Only"
4751
4516
  }),
4752
4517
  (0, import_class_validator5.IsString)(),
4753
4518
  (0, import_class_validator5.MinLength)(1),
4754
4519
  (0, import_class_validator5.MaxLength)(100),
4755
- _ts_metadata22("design:type", String)
4520
+ _ts_metadata23("design:type", String)
4756
4521
  ], RenameDataTableViewDto.prototype, "name", void 0);
4757
4522
 
4758
4523
  // src/data-table/views/dto/request/toggle-share-data-table-view.dto.ts
4759
- var import_swagger14 = require("@nestjs/swagger");
4524
+ var import_swagger16 = require("@nestjs/swagger");
4760
4525
  var import_class_validator6 = require("class-validator");
4761
4526
  function _ts_decorate33(decorators, target, key, desc2) {
4762
4527
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
@@ -4765,10 +4530,10 @@ function _ts_decorate33(decorators, target, key, desc2) {
4765
4530
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4766
4531
  }
4767
4532
  __name(_ts_decorate33, "_ts_decorate");
4768
- function _ts_metadata23(k, v) {
4533
+ function _ts_metadata24(k, v) {
4769
4534
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4770
4535
  }
4771
- __name(_ts_metadata23, "_ts_metadata");
4536
+ __name(_ts_metadata24, "_ts_metadata");
4772
4537
  var ToggleShareDataTableViewDto = class {
4773
4538
  static {
4774
4539
  __name(this, "ToggleShareDataTableViewDto");
@@ -4776,16 +4541,16 @@ var ToggleShareDataTableViewDto = class {
4776
4541
  isShared;
4777
4542
  };
4778
4543
  _ts_decorate33([
4779
- (0, import_swagger14.ApiProperty)({
4544
+ (0, import_swagger16.ApiProperty)({
4780
4545
  description: "Whether the view should be visible to all users",
4781
4546
  example: true
4782
4547
  }),
4783
4548
  (0, import_class_validator6.IsBoolean)(),
4784
- _ts_metadata23("design:type", Boolean)
4549
+ _ts_metadata24("design:type", Boolean)
4785
4550
  ], ToggleShareDataTableViewDto.prototype, "isShared", void 0);
4786
4551
 
4787
4552
  // src/data-table/views/dto/request/update-data-table-view.dto.ts
4788
- var import_swagger15 = require("@nestjs/swagger");
4553
+ var import_swagger17 = require("@nestjs/swagger");
4789
4554
  var import_class_validator7 = require("class-validator");
4790
4555
  function _ts_decorate34(decorators, target, key, desc2) {
4791
4556
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
@@ -4794,10 +4559,10 @@ function _ts_decorate34(decorators, target, key, desc2) {
4794
4559
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4795
4560
  }
4796
4561
  __name(_ts_decorate34, "_ts_decorate");
4797
- function _ts_metadata24(k, v) {
4562
+ function _ts_metadata25(k, v) {
4798
4563
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4799
4564
  }
4800
- __name(_ts_metadata24, "_ts_metadata");
4565
+ __name(_ts_metadata25, "_ts_metadata");
4801
4566
  var UpdateDataTableViewDto = class {
4802
4567
  static {
4803
4568
  __name(this, "UpdateDataTableViewDto");
@@ -4805,150 +4570,150 @@ var UpdateDataTableViewDto = class {
4805
4570
  state;
4806
4571
  };
4807
4572
  _ts_decorate34([
4808
- (0, import_swagger15.ApiProperty)({
4573
+ (0, import_swagger17.ApiProperty)({
4809
4574
  description: "Updated filter, sort, and column visibility state"
4810
4575
  }),
4811
4576
  (0, import_class_validator7.IsObject)(),
4812
- _ts_metadata24("design:type", typeof TableViewState === "undefined" ? Object : TableViewState)
4577
+ _ts_metadata25("design:type", typeof TableViewState === "undefined" ? Object : TableViewState)
4813
4578
  ], UpdateDataTableViewDto.prototype, "state", void 0);
4814
4579
 
4815
4580
  // src/data-table/views/docs/data-table-views.docs.ts
4816
4581
  function ApiListDataTableViews() {
4817
- return (0, import_common61.applyDecorators)((0, import_swagger16.ApiOperation)({
4582
+ return (0, import_common58.applyDecorators)((0, import_swagger18.ApiOperation)({
4818
4583
  summary: "List named table views",
4819
4584
  description: "Returns the authenticated user's own named views plus all shared views for the given table slug."
4820
- }), (0, import_swagger16.ApiQuery)({
4585
+ }), (0, import_swagger18.ApiQuery)({
4821
4586
  name: "tableSlug",
4822
4587
  description: "Slug of the table to fetch views for",
4823
4588
  example: "cloud-providers",
4824
4589
  required: true
4825
- }), (0, import_swagger16.ApiResponse)({
4590
+ }), (0, import_swagger18.ApiResponse)({
4826
4591
  status: 200,
4827
4592
  description: "Named views retrieved.",
4828
4593
  type: [
4829
4594
  DataTableViewDto
4830
4595
  ]
4831
- }), (0, import_swagger16.ApiResponse)({
4596
+ }), (0, import_swagger18.ApiResponse)({
4832
4597
  status: 401,
4833
4598
  description: "Unauthorized."
4834
4599
  }));
4835
4600
  }
4836
4601
  __name(ApiListDataTableViews, "ApiListDataTableViews");
4837
4602
  function ApiCreateDataTableView() {
4838
- return (0, import_common61.applyDecorators)((0, import_swagger16.ApiOperation)({
4603
+ return (0, import_common58.applyDecorators)((0, import_swagger18.ApiOperation)({
4839
4604
  summary: "Create named table view",
4840
4605
  description: "Saves the current table state as a named view snapshot. The name must be unique per user+table."
4841
- }), (0, import_swagger16.ApiBody)({
4606
+ }), (0, import_swagger18.ApiBody)({
4842
4607
  type: CreateDataTableViewDto
4843
- }), (0, import_swagger16.ApiResponse)({
4608
+ }), (0, import_swagger18.ApiResponse)({
4844
4609
  status: 201,
4845
4610
  description: "Named view created.",
4846
4611
  type: DataTableViewDto
4847
- }), (0, import_swagger16.ApiResponse)({
4612
+ }), (0, import_swagger18.ApiResponse)({
4848
4613
  status: 400,
4849
4614
  description: "Invalid request body."
4850
- }), (0, import_swagger16.ApiResponse)({
4615
+ }), (0, import_swagger18.ApiResponse)({
4851
4616
  status: 401,
4852
4617
  description: "Unauthorized."
4853
4618
  }));
4854
4619
  }
4855
4620
  __name(ApiCreateDataTableView, "ApiCreateDataTableView");
4856
4621
  function ApiUpdateDataTableView() {
4857
- return (0, import_common61.applyDecorators)((0, import_swagger16.ApiOperation)({
4622
+ return (0, import_common58.applyDecorators)((0, import_swagger18.ApiOperation)({
4858
4623
  summary: "Update named table view",
4859
4624
  description: "Updates the state of an existing named view. Only the owner can update."
4860
- }), (0, import_swagger16.ApiParam)({
4625
+ }), (0, import_swagger18.ApiParam)({
4861
4626
  name: "id",
4862
4627
  description: "UUID of the table view to update"
4863
- }), (0, import_swagger16.ApiBody)({
4628
+ }), (0, import_swagger18.ApiBody)({
4864
4629
  type: UpdateDataTableViewDto
4865
- }), (0, import_swagger16.ApiResponse)({
4630
+ }), (0, import_swagger18.ApiResponse)({
4866
4631
  status: 200,
4867
4632
  description: "View updated.",
4868
4633
  type: DataTableViewDto
4869
- }), (0, import_swagger16.ApiResponse)({
4634
+ }), (0, import_swagger18.ApiResponse)({
4870
4635
  status: 400,
4871
4636
  description: "Validation failed or not owned by caller."
4872
- }), (0, import_swagger16.ApiResponse)({
4637
+ }), (0, import_swagger18.ApiResponse)({
4873
4638
  status: 401,
4874
4639
  description: "Unauthorized."
4875
- }), (0, import_swagger16.ApiResponse)({
4640
+ }), (0, import_swagger18.ApiResponse)({
4876
4641
  status: 404,
4877
4642
  description: "View not found."
4878
4643
  }));
4879
4644
  }
4880
4645
  __name(ApiUpdateDataTableView, "ApiUpdateDataTableView");
4881
4646
  function ApiRenameDataTableView() {
4882
- return (0, import_common61.applyDecorators)((0, import_swagger16.ApiOperation)({
4647
+ return (0, import_common58.applyDecorators)((0, import_swagger18.ApiOperation)({
4883
4648
  summary: "Rename a named table view",
4884
4649
  description: "Updates the display name of an existing view. The new name must be unique per user+table. Only the owner can rename."
4885
- }), (0, import_swagger16.ApiParam)({
4650
+ }), (0, import_swagger18.ApiParam)({
4886
4651
  name: "id",
4887
4652
  description: "UUID of the table view to rename"
4888
- }), (0, import_swagger16.ApiBody)({
4653
+ }), (0, import_swagger18.ApiBody)({
4889
4654
  type: RenameDataTableViewDto
4890
- }), (0, import_swagger16.ApiResponse)({
4655
+ }), (0, import_swagger18.ApiResponse)({
4891
4656
  status: 200,
4892
4657
  description: "View renamed.",
4893
4658
  type: DataTableViewDto
4894
- }), (0, import_swagger16.ApiResponse)({
4659
+ }), (0, import_swagger18.ApiResponse)({
4895
4660
  status: 400,
4896
4661
  description: "Not owned by caller."
4897
- }), (0, import_swagger16.ApiResponse)({
4662
+ }), (0, import_swagger18.ApiResponse)({
4898
4663
  status: 401,
4899
4664
  description: "Unauthorized."
4900
- }), (0, import_swagger16.ApiResponse)({
4665
+ }), (0, import_swagger18.ApiResponse)({
4901
4666
  status: 404,
4902
4667
  description: "View not found."
4903
- }), (0, import_swagger16.ApiResponse)({
4668
+ }), (0, import_swagger18.ApiResponse)({
4904
4669
  status: 409,
4905
4670
  description: "A view with this name already exists."
4906
4671
  }));
4907
4672
  }
4908
4673
  __name(ApiRenameDataTableView, "ApiRenameDataTableView");
4909
4674
  function ApiToggleShareDataTableView() {
4910
- return (0, import_common61.applyDecorators)((0, import_swagger16.ApiOperation)({
4675
+ return (0, import_common58.applyDecorators)((0, import_swagger18.ApiOperation)({
4911
4676
  summary: "Toggle view sharing",
4912
4677
  description: "Makes a view visible to all users (shared) or restricts it to the owner only (private). Only the owner can toggle sharing."
4913
- }), (0, import_swagger16.ApiParam)({
4678
+ }), (0, import_swagger18.ApiParam)({
4914
4679
  name: "id",
4915
4680
  description: "UUID of the table view"
4916
- }), (0, import_swagger16.ApiBody)({
4681
+ }), (0, import_swagger18.ApiBody)({
4917
4682
  type: ToggleShareDataTableViewDto
4918
- }), (0, import_swagger16.ApiResponse)({
4683
+ }), (0, import_swagger18.ApiResponse)({
4919
4684
  status: 200,
4920
4685
  description: "Sharing status updated.",
4921
4686
  type: DataTableViewDto
4922
- }), (0, import_swagger16.ApiResponse)({
4687
+ }), (0, import_swagger18.ApiResponse)({
4923
4688
  status: 400,
4924
4689
  description: "Not owned by caller."
4925
- }), (0, import_swagger16.ApiResponse)({
4690
+ }), (0, import_swagger18.ApiResponse)({
4926
4691
  status: 401,
4927
4692
  description: "Unauthorized."
4928
- }), (0, import_swagger16.ApiResponse)({
4693
+ }), (0, import_swagger18.ApiResponse)({
4929
4694
  status: 404,
4930
4695
  description: "View not found."
4931
4696
  }));
4932
4697
  }
4933
4698
  __name(ApiToggleShareDataTableView, "ApiToggleShareDataTableView");
4934
4699
  function ApiDeleteDataTableView() {
4935
- return (0, import_common61.applyDecorators)((0, import_swagger16.ApiOperation)({
4700
+ return (0, import_common58.applyDecorators)((0, import_swagger18.ApiOperation)({
4936
4701
  summary: "Delete named table view",
4937
4702
  description: "Permanently deletes a named view. Only the owner can delete their own views."
4938
- }), (0, import_swagger16.ApiParam)({
4703
+ }), (0, import_swagger18.ApiParam)({
4939
4704
  name: "id",
4940
4705
  description: "UUID of the table view to delete"
4941
- }), (0, import_swagger16.ApiResponse)({
4706
+ }), (0, import_swagger18.ApiResponse)({
4942
4707
  status: 200,
4943
4708
  description: "View deleted.",
4944
4709
  type: DataTableViewDto
4945
- }), (0, import_swagger16.ApiResponse)({
4710
+ }), (0, import_swagger18.ApiResponse)({
4946
4711
  status: 400,
4947
4712
  description: "Not owned by caller."
4948
- }), (0, import_swagger16.ApiResponse)({
4713
+ }), (0, import_swagger18.ApiResponse)({
4949
4714
  status: 401,
4950
4715
  description: "Unauthorized."
4951
- }), (0, import_swagger16.ApiResponse)({
4716
+ }), (0, import_swagger18.ApiResponse)({
4952
4717
  status: 404,
4953
4718
  description: "View not found."
4954
4719
  }));
@@ -4957,12 +4722,12 @@ __name(ApiDeleteDataTableView, "ApiDeleteDataTableView");
4957
4722
 
4958
4723
  // src/data-table/views/services/data-table-views.service.ts
4959
4724
  var import_node_crypto2 = require("crypto");
4960
- var import_common63 = require("@nestjs/common");
4961
- var import_config13 = require("@nestjs/config");
4725
+ var import_common60 = require("@nestjs/common");
4726
+ var import_config14 = require("@nestjs/config");
4962
4727
 
4963
4728
  // src/data-table/views/repositories/data-table-views.repository.ts
4964
- var import_common62 = require("@nestjs/common");
4965
- var import_drizzle_orm5 = require("drizzle-orm");
4729
+ var import_common59 = require("@nestjs/common");
4730
+ var import_drizzle_orm3 = require("drizzle-orm");
4966
4731
  function _ts_decorate35(decorators, target, key, desc2) {
4967
4732
  var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
4968
4733
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
@@ -4970,16 +4735,16 @@ function _ts_decorate35(decorators, target, key, desc2) {
4970
4735
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4971
4736
  }
4972
4737
  __name(_ts_decorate35, "_ts_decorate");
4973
- function _ts_metadata25(k, v) {
4738
+ function _ts_metadata26(k, v) {
4974
4739
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4975
4740
  }
4976
- __name(_ts_metadata25, "_ts_metadata");
4977
- function _ts_param9(paramIndex, decorator) {
4741
+ __name(_ts_metadata26, "_ts_metadata");
4742
+ function _ts_param8(paramIndex, decorator) {
4978
4743
  return function(target, key) {
4979
4744
  decorator(target, key, paramIndex);
4980
4745
  };
4981
4746
  }
4982
- __name(_ts_param9, "_ts_param");
4747
+ __name(_ts_param8, "_ts_param");
4983
4748
  var NAMED_VIEWS_LIMIT = 100;
4984
4749
  var DataTableViewsRepository = class extends PrimaryBaseRepository {
4985
4750
  static {
@@ -4991,19 +4756,19 @@ var DataTableViewsRepository = class extends PrimaryBaseRepository {
4991
4756
  // Returns personal (non-shared) named views owned by the user for a given table
4992
4757
  async findPersonalViewsBySlug(userId, tableSlug) {
4993
4758
  const t = this.table;
4994
- return this.db.select().from(this.table).where((0, import_drizzle_orm5.and)((0, import_drizzle_orm5.eq)(t.tableSlug, tableSlug), (0, import_drizzle_orm5.eq)(t.userId, userId), (0, import_drizzle_orm5.eq)(t.isShared, false))).orderBy(t.createdAt).limit(NAMED_VIEWS_LIMIT);
4759
+ return this.db.select().from(this.table).where((0, import_drizzle_orm3.and)((0, import_drizzle_orm3.eq)(t.tableSlug, tableSlug), (0, import_drizzle_orm3.eq)(t.userId, userId), (0, import_drizzle_orm3.eq)(t.isShared, false))).orderBy(t.createdAt).limit(NAMED_VIEWS_LIMIT);
4995
4760
  }
4996
4761
  // Returns all shared named views for a given table — visible to all users
4997
4762
  async findSharedViewsBySlug(tableSlug) {
4998
4763
  const t = this.table;
4999
- return this.db.select().from(this.table).where((0, import_drizzle_orm5.and)((0, import_drizzle_orm5.eq)(t.tableSlug, tableSlug), (0, import_drizzle_orm5.eq)(t.isShared, true))).orderBy(t.createdAt).limit(NAMED_VIEWS_LIMIT);
4764
+ return this.db.select().from(this.table).where((0, import_drizzle_orm3.and)((0, import_drizzle_orm3.eq)(t.tableSlug, tableSlug), (0, import_drizzle_orm3.eq)(t.isShared, true))).orderBy(t.createdAt).limit(NAMED_VIEWS_LIMIT);
5000
4765
  }
5001
4766
  };
5002
4767
  DataTableViewsRepository = _ts_decorate35([
5003
- (0, import_common62.Injectable)(),
5004
- _ts_param9(1, (0, import_common62.Inject)(DATA_TABLE_VIEWS_TABLE)),
5005
- _ts_metadata25("design:type", Function),
5006
- _ts_metadata25("design:paramtypes", [
4768
+ (0, import_common59.Injectable)(),
4769
+ _ts_param8(1, (0, import_common59.Inject)(DATA_TABLE_VIEWS_TABLE)),
4770
+ _ts_metadata26("design:type", Function),
4771
+ _ts_metadata26("design:paramtypes", [
5007
4772
  typeof PrimaryDatabaseService === "undefined" ? Object : PrimaryDatabaseService,
5008
4773
  typeof PgTable === "undefined" ? Object : PgTable
5009
4774
  ])
@@ -5017,10 +4782,10 @@ function _ts_decorate36(decorators, target, key, desc2) {
5017
4782
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5018
4783
  }
5019
4784
  __name(_ts_decorate36, "_ts_decorate");
5020
- function _ts_metadata26(k, v) {
4785
+ function _ts_metadata27(k, v) {
5021
4786
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
5022
4787
  }
5023
- __name(_ts_metadata26, "_ts_metadata");
4788
+ __name(_ts_metadata27, "_ts_metadata");
5024
4789
  function computeChecksum(value) {
5025
4790
  return (0, import_node_crypto2.createHash)("sha256").update(JSON.stringify(value)).digest("hex");
5026
4791
  }
@@ -5032,7 +4797,7 @@ var DataTableViewsService = class _DataTableViewsService {
5032
4797
  dataTableViewsRepository;
5033
4798
  cacheService;
5034
4799
  configService;
5035
- logger = new import_common63.Logger(_DataTableViewsService.name);
4800
+ logger = new import_common60.Logger(_DataTableViewsService.name);
5036
4801
  constructor(dataTableViewsRepository, cacheService, configService) {
5037
4802
  this.dataTableViewsRepository = dataTableViewsRepository;
5038
4803
  this.cacheService = cacheService;
@@ -5176,12 +4941,12 @@ var DataTableViewsService = class _DataTableViewsService {
5176
4941
  }
5177
4942
  };
5178
4943
  DataTableViewsService = _ts_decorate36([
5179
- (0, import_common63.Injectable)(),
5180
- _ts_metadata26("design:type", Function),
5181
- _ts_metadata26("design:paramtypes", [
4944
+ (0, import_common60.Injectable)(),
4945
+ _ts_metadata27("design:type", Function),
4946
+ _ts_metadata27("design:paramtypes", [
5182
4947
  typeof DataTableViewsRepository === "undefined" ? Object : DataTableViewsRepository,
5183
4948
  typeof CacheService === "undefined" ? Object : CacheService,
5184
- typeof import_config13.ConfigService === "undefined" ? Object : import_config13.ConfigService
4949
+ typeof import_config14.ConfigService === "undefined" ? Object : import_config14.ConfigService
5185
4950
  ])
5186
4951
  ], DataTableViewsService);
5187
4952
 
@@ -5193,22 +4958,22 @@ function _ts_decorate37(decorators, target, key, desc2) {
5193
4958
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5194
4959
  }
5195
4960
  __name(_ts_decorate37, "_ts_decorate");
5196
- function _ts_metadata27(k, v) {
4961
+ function _ts_metadata28(k, v) {
5197
4962
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
5198
4963
  }
5199
- __name(_ts_metadata27, "_ts_metadata");
5200
- function _ts_param10(paramIndex, decorator) {
4964
+ __name(_ts_metadata28, "_ts_metadata");
4965
+ function _ts_param9(paramIndex, decorator) {
5201
4966
  return function(target, key) {
5202
4967
  decorator(target, key, paramIndex);
5203
4968
  };
5204
4969
  }
5205
- __name(_ts_param10, "_ts_param");
4970
+ __name(_ts_param9, "_ts_param");
5206
4971
  var DataTableViewsController = class _DataTableViewsController {
5207
4972
  static {
5208
4973
  __name(this, "DataTableViewsController");
5209
4974
  }
5210
4975
  dataTableViewsService;
5211
- logger = new import_common64.Logger(_DataTableViewsController.name);
4976
+ logger = new import_common61.Logger(_DataTableViewsController.name);
5212
4977
  constructor(dataTableViewsService) {
5213
4978
  this.dataTableViewsService = dataTableViewsService;
5214
4979
  }
@@ -5244,90 +5009,91 @@ var DataTableViewsController = class _DataTableViewsController {
5244
5009
  }
5245
5010
  };
5246
5011
  _ts_decorate37([
5247
- (0, import_common64.Get)(),
5012
+ (0, import_common61.Get)(),
5248
5013
  ApiListDataTableViews(),
5249
- _ts_param10(0, UserId()),
5250
- _ts_param10(1, (0, import_common64.Query)("tableSlug")),
5251
- _ts_metadata27("design:type", Function),
5252
- _ts_metadata27("design:paramtypes", [
5014
+ _ts_param9(0, UserId()),
5015
+ _ts_param9(1, (0, import_common61.Query)("tableSlug")),
5016
+ _ts_metadata28("design:type", Function),
5017
+ _ts_metadata28("design:paramtypes", [
5253
5018
  String,
5254
5019
  String
5255
5020
  ]),
5256
- _ts_metadata27("design:returntype", typeof Promise === "undefined" ? Object : Promise)
5021
+ _ts_metadata28("design:returntype", typeof Promise === "undefined" ? Object : Promise)
5257
5022
  ], DataTableViewsController.prototype, "findViews", null);
5258
5023
  _ts_decorate37([
5259
- (0, import_common64.Post)(),
5260
- (0, import_common64.HttpCode)(import_common64.HttpStatus.CREATED),
5024
+ (0, import_common61.Post)(),
5025
+ (0, import_common61.HttpCode)(import_common61.HttpStatus.CREATED),
5261
5026
  ApiCreateDataTableView(),
5262
- _ts_param10(0, UserId()),
5263
- _ts_param10(1, (0, import_common64.Body)()),
5264
- _ts_metadata27("design:type", Function),
5265
- _ts_metadata27("design:paramtypes", [
5027
+ _ts_param9(0, UserId()),
5028
+ _ts_param9(1, (0, import_common61.Body)()),
5029
+ _ts_metadata28("design:type", Function),
5030
+ _ts_metadata28("design:paramtypes", [
5266
5031
  String,
5267
5032
  typeof CreateDataTableViewDto === "undefined" ? Object : CreateDataTableViewDto
5268
5033
  ]),
5269
- _ts_metadata27("design:returntype", typeof Promise === "undefined" ? Object : Promise)
5034
+ _ts_metadata28("design:returntype", typeof Promise === "undefined" ? Object : Promise)
5270
5035
  ], DataTableViewsController.prototype, "createView", null);
5271
5036
  _ts_decorate37([
5272
- (0, import_common64.Patch)(":id"),
5037
+ (0, import_common61.Patch)(":id"),
5273
5038
  ApiUpdateDataTableView(),
5274
- _ts_param10(0, UserId()),
5275
- _ts_param10(1, (0, import_common64.Param)("id")),
5276
- _ts_param10(2, (0, import_common64.Body)()),
5277
- _ts_metadata27("design:type", Function),
5278
- _ts_metadata27("design:paramtypes", [
5039
+ _ts_param9(0, UserId()),
5040
+ _ts_param9(1, (0, import_common61.Param)("id")),
5041
+ _ts_param9(2, (0, import_common61.Body)()),
5042
+ _ts_metadata28("design:type", Function),
5043
+ _ts_metadata28("design:paramtypes", [
5279
5044
  String,
5280
5045
  String,
5281
5046
  typeof UpdateDataTableViewDto === "undefined" ? Object : UpdateDataTableViewDto
5282
5047
  ]),
5283
- _ts_metadata27("design:returntype", typeof Promise === "undefined" ? Object : Promise)
5048
+ _ts_metadata28("design:returntype", typeof Promise === "undefined" ? Object : Promise)
5284
5049
  ], DataTableViewsController.prototype, "updateView", null);
5285
5050
  _ts_decorate37([
5286
- (0, import_common64.Patch)(":id/rename"),
5051
+ (0, import_common61.Patch)(":id/rename"),
5287
5052
  ApiRenameDataTableView(),
5288
- _ts_param10(0, UserId()),
5289
- _ts_param10(1, (0, import_common64.Param)("id")),
5290
- _ts_param10(2, (0, import_common64.Body)()),
5291
- _ts_metadata27("design:type", Function),
5292
- _ts_metadata27("design:paramtypes", [
5053
+ _ts_param9(0, UserId()),
5054
+ _ts_param9(1, (0, import_common61.Param)("id")),
5055
+ _ts_param9(2, (0, import_common61.Body)()),
5056
+ _ts_metadata28("design:type", Function),
5057
+ _ts_metadata28("design:paramtypes", [
5293
5058
  String,
5294
5059
  String,
5295
5060
  typeof RenameDataTableViewDto === "undefined" ? Object : RenameDataTableViewDto
5296
5061
  ]),
5297
- _ts_metadata27("design:returntype", typeof Promise === "undefined" ? Object : Promise)
5062
+ _ts_metadata28("design:returntype", typeof Promise === "undefined" ? Object : Promise)
5298
5063
  ], DataTableViewsController.prototype, "renameView", null);
5299
5064
  _ts_decorate37([
5300
- (0, import_common64.Patch)(":id/share"),
5065
+ (0, import_common61.Patch)(":id/share"),
5301
5066
  ApiToggleShareDataTableView(),
5302
- _ts_param10(0, UserId()),
5303
- _ts_param10(1, (0, import_common64.Param)("id")),
5304
- _ts_param10(2, (0, import_common64.Body)()),
5305
- _ts_metadata27("design:type", Function),
5306
- _ts_metadata27("design:paramtypes", [
5067
+ _ts_param9(0, UserId()),
5068
+ _ts_param9(1, (0, import_common61.Param)("id")),
5069
+ _ts_param9(2, (0, import_common61.Body)()),
5070
+ _ts_metadata28("design:type", Function),
5071
+ _ts_metadata28("design:paramtypes", [
5307
5072
  String,
5308
5073
  String,
5309
5074
  typeof ToggleShareDataTableViewDto === "undefined" ? Object : ToggleShareDataTableViewDto
5310
5075
  ]),
5311
- _ts_metadata27("design:returntype", typeof Promise === "undefined" ? Object : Promise)
5076
+ _ts_metadata28("design:returntype", typeof Promise === "undefined" ? Object : Promise)
5312
5077
  ], DataTableViewsController.prototype, "toggleShareView", null);
5313
5078
  _ts_decorate37([
5314
- (0, import_common64.Delete)(":id"),
5079
+ (0, import_common61.Delete)(":id"),
5315
5080
  ApiDeleteDataTableView(),
5316
- _ts_param10(0, UserId()),
5317
- _ts_param10(1, (0, import_common64.Param)("id")),
5318
- _ts_metadata27("design:type", Function),
5319
- _ts_metadata27("design:paramtypes", [
5081
+ _ts_param9(0, UserId()),
5082
+ _ts_param9(1, (0, import_common61.Param)("id")),
5083
+ _ts_metadata28("design:type", Function),
5084
+ _ts_metadata28("design:paramtypes", [
5320
5085
  String,
5321
5086
  String
5322
5087
  ]),
5323
- _ts_metadata27("design:returntype", typeof Promise === "undefined" ? Object : Promise)
5088
+ _ts_metadata28("design:returntype", typeof Promise === "undefined" ? Object : Promise)
5324
5089
  ], DataTableViewsController.prototype, "deleteView", null);
5325
5090
  DataTableViewsController = _ts_decorate37([
5326
- (0, import_swagger17.ApiTags)("Table Views"),
5327
- (0, import_swagger17.ApiBearerAuth)(),
5328
- (0, import_common64.Controller)("table-views"),
5329
- _ts_metadata27("design:type", Function),
5330
- _ts_metadata27("design:paramtypes", [
5091
+ (0, import_swagger19.ApiTags)("Table Views"),
5092
+ (0, import_swagger19.ApiBearerAuth)(),
5093
+ RequireSession("CLOUD", "ADMIN"),
5094
+ (0, import_common61.Controller)("table-views"),
5095
+ _ts_metadata28("design:type", Function),
5096
+ _ts_metadata28("design:paramtypes", [
5331
5097
  typeof DataTableViewsService === "undefined" ? Object : DataTableViewsService
5332
5098
  ])
5333
5099
  ], DataTableViewsController);
@@ -5349,7 +5115,7 @@ var DataTableModule = class _DataTableModule {
5349
5115
  global: true,
5350
5116
  module: _DataTableModule,
5351
5117
  imports: [
5352
- import_config14.ConfigModule,
5118
+ import_config15.ConfigModule,
5353
5119
  CacheModule
5354
5120
  ],
5355
5121
  controllers: [
@@ -5373,7 +5139,7 @@ var DataTableModule = class _DataTableModule {
5373
5139
  }
5374
5140
  };
5375
5141
  DataTableModule = _ts_decorate38([
5376
- (0, import_common65.Module)({})
5142
+ (0, import_common62.Module)({})
5377
5143
  ], DataTableModule);
5378
5144
 
5379
5145
  // src/drizzle-pg-core.ts
@@ -5423,6 +5189,7 @@ __name(dataTableViewsIndexes, "dataTableViewsIndexes");
5423
5189
  CookieDomain,
5424
5190
  CorrelationIdMiddleware,
5425
5191
  CreateDataTableViewDto,
5192
+ CreateResponseDto,
5426
5193
  DATA_TABLE_VIEWS_TABLE,
5427
5194
  DEFAULT_CORRELATION_HEADER,
5428
5195
  DataTableModule,
@@ -5438,6 +5205,8 @@ __name(dataTableViewsIndexes, "dataTableViewsIndexes");
5438
5205
  HttpExceptionFilter,
5439
5206
  HttpLoggerInterceptor,
5440
5207
  HttpProblemException,
5208
+ ImportResponseDto,
5209
+ ImportSummaryDto,
5441
5210
  InternalServerErrorException,
5442
5211
  JwtAuthService,
5443
5212
  LOGGER_MODULE_OPTIONS,
@@ -5447,30 +5216,26 @@ __name(dataTableViewsIndexes, "dataTableViewsIndexes");
5447
5216
  NotAcceptableException,
5448
5217
  NotFoundException,
5449
5218
  NotImplementedException,
5450
- Onboarding,
5451
5219
  PayloadTooLargeException,
5452
5220
  PrimaryBaseRepository,
5453
5221
  PrimaryDatabaseService,
5454
5222
  Public,
5455
- RESET_KEY,
5223
+ REQUIRE_SESSION_KEY,
5456
5224
  RedisCacheProvider,
5457
5225
  RefreshCookieOptions,
5458
5226
  RefreshTokenCookie,
5459
5227
  RenameDataTableViewDto,
5460
5228
  RequestTimeoutException,
5461
- Reset,
5229
+ RequireSession,
5462
5230
  RootModule,
5463
5231
  SKIP_CSRF_KEY,
5464
5232
  SelectOptionsQueryDto,
5465
5233
  ServiceUnavailableException,
5466
5234
  SessionData,
5467
5235
  SkipCsrf,
5236
+ Subdomain,
5468
5237
  SuccessResponseDto,
5469
5238
  TableResponseDto,
5470
- Tenant,
5471
- TenantBaseRepository,
5472
- TenantContextService,
5473
- TenantDatabaseService,
5474
5239
  ToggleShareDataTableViewDto,
5475
5240
  TokenType,
5476
5241
  TooManyRequestsException,
@@ -5478,8 +5243,10 @@ __name(dataTableViewsIndexes, "dataTableViewsIndexes");
5478
5243
  UnprocessableEntityException,
5479
5244
  UnsupportedMediaTypeException,
5480
5245
  UpdateDataTableViewDto,
5246
+ UploadedFile,
5481
5247
  UpsertDataTableStateDto,
5482
5248
  UserId,
5249
+ ValidatedRowDto,
5483
5250
  ValidationException,
5484
5251
  VrittiAuthGuard,
5485
5252
  addCorrelationIdToResponse,