dbnexus 0.4.1 → 0.5.1

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/api.js CHANGED
@@ -114,7 +114,7 @@ var require_Reflect = __commonJS({
114
114
  var metadataProvider = CreateMetadataProvider(metadataRegistry);
115
115
  function decorate(decorators, target, propertyKey, attributes) {
116
116
  if (!IsUndefined(propertyKey)) {
117
- if (!IsArray9(decorators))
117
+ if (!IsArray10(decorators))
118
118
  throw new TypeError();
119
119
  if (!IsObject(target))
120
120
  throw new TypeError();
@@ -125,7 +125,7 @@ var require_Reflect = __commonJS({
125
125
  propertyKey = ToPropertyKey(propertyKey);
126
126
  return DecorateProperty(decorators, target, propertyKey, attributes);
127
127
  } else {
128
- if (!IsArray9(decorators))
128
+ if (!IsArray10(decorators))
129
129
  throw new TypeError();
130
130
  if (!IsConstructor(target))
131
131
  throw new TypeError();
@@ -438,7 +438,7 @@ var require_Reflect = __commonJS({
438
438
  return key;
439
439
  return ToString(key);
440
440
  }
441
- function IsArray9(argument) {
441
+ function IsArray10(argument) {
442
442
  return Array.isArray ? Array.isArray(argument) : argument instanceof Object ? argument instanceof Array : Object.prototype.toString.call(argument) === "[object Array]";
443
443
  }
444
444
  function IsCallable(argument) {
@@ -1993,10 +1993,10 @@ var require_controller_decorator = __commonJS({
1993
1993
  "node_modules/.pnpm/@nestjs+common@10.4.22_class-transformer@0.5.1_class-validator@0.14.3_reflect-metadata@0.2.2_rxjs@7.8.2/node_modules/@nestjs/common/decorators/core/controller.decorator.js"(exports2) {
1994
1994
  "use strict";
1995
1995
  Object.defineProperty(exports2, "__esModule", { value: true });
1996
- exports2.Controller = Controller14;
1996
+ exports2.Controller = Controller15;
1997
1997
  var constants_1 = require_constants2();
1998
1998
  var shared_utils_1 = require_shared_utils();
1999
- function Controller14(prefixOrOptions) {
1999
+ function Controller15(prefixOrOptions) {
2000
2000
  const defaultPath = "/";
2001
2001
  const [path5, host, scopeOptions, versionOptions] = (0, shared_utils_1.isUndefined)(prefixOrOptions) ? [defaultPath, void 0, void 0, void 0] : (0, shared_utils_1.isString)(prefixOrOptions) || Array.isArray(prefixOrOptions) ? [prefixOrOptions, void 0, void 0, void 0] : [
2002
2002
  prefixOrOptions.path || defaultPath,
@@ -2416,9 +2416,9 @@ var require_module_decorator = __commonJS({
2416
2416
  "node_modules/.pnpm/@nestjs+common@10.4.22_class-transformer@0.5.1_class-validator@0.14.3_reflect-metadata@0.2.2_rxjs@7.8.2/node_modules/@nestjs/common/decorators/modules/module.decorator.js"(exports2) {
2417
2417
  "use strict";
2418
2418
  Object.defineProperty(exports2, "__esModule", { value: true });
2419
- exports2.Module = Module16;
2419
+ exports2.Module = Module17;
2420
2420
  var validate_module_keys_util_1 = require_validate_module_keys_util();
2421
- function Module16(metadata) {
2421
+ function Module17(metadata) {
2422
2422
  const propsKeys = Object.keys(metadata);
2423
2423
  (0, validate_module_keys_util_1.validateModuleKeys)(propsKeys);
2424
2424
  return (target) => {
@@ -2540,9 +2540,9 @@ var require_route_params_decorator = __commonJS({
2540
2540
  exports2.UploadedFile = UploadedFile2;
2541
2541
  exports2.UploadedFiles = UploadedFiles;
2542
2542
  exports2.Query = Query10;
2543
- exports2.Body = Body11;
2543
+ exports2.Body = Body12;
2544
2544
  exports2.RawBody = RawBody;
2545
- exports2.Param = Param11;
2545
+ exports2.Param = Param12;
2546
2546
  exports2.HostParam = HostParam;
2547
2547
  var constants_1 = require_constants2();
2548
2548
  var route_paramtypes_enum_1 = require_route_paramtypes_enum();
@@ -2591,13 +2591,13 @@ var require_route_params_decorator = __commonJS({
2591
2591
  function Query10(property, ...pipes) {
2592
2592
  return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.QUERY)(property, ...pipes);
2593
2593
  }
2594
- function Body11(property, ...pipes) {
2594
+ function Body12(property, ...pipes) {
2595
2595
  return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.BODY)(property, ...pipes);
2596
2596
  }
2597
2597
  function RawBody(...pipes) {
2598
2598
  return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.RAW_BODY)(void 0, ...pipes);
2599
2599
  }
2600
- function Param11(property, ...pipes) {
2600
+ function Param12(property, ...pipes) {
2601
2601
  return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.PARAM)(property, ...pipes);
2602
2602
  }
2603
2603
  function HostParam(property) {
@@ -3176,7 +3176,7 @@ var require_forbidden_exception = __commonJS({
3176
3176
  exports2.ForbiddenException = void 0;
3177
3177
  var http_status_enum_1 = require_http_status_enum();
3178
3178
  var http_exception_1 = require_http_exception();
3179
- var ForbiddenException3 = class extends http_exception_1.HttpException {
3179
+ var ForbiddenException5 = class extends http_exception_1.HttpException {
3180
3180
  /**
3181
3181
  * Instantiate a `ForbiddenException` Exception.
3182
3182
  *
@@ -3206,7 +3206,7 @@ var require_forbidden_exception = __commonJS({
3206
3206
  super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.FORBIDDEN), http_status_enum_1.HttpStatus.FORBIDDEN, httpExceptionOptions);
3207
3207
  }
3208
3208
  };
3209
- exports2.ForbiddenException = ForbiddenException3;
3209
+ exports2.ForbiddenException = ForbiddenException5;
3210
3210
  }
3211
3211
  });
3212
3212
 
@@ -5062,8 +5062,8 @@ var require_generate_options_injection_token_util = __commonJS({
5062
5062
  exports2.generateOptionsInjectionToken = generateOptionsInjectionToken;
5063
5063
  var random_string_generator_util_1 = require_random_string_generator_util();
5064
5064
  function generateOptionsInjectionToken() {
5065
- const hash2 = (0, random_string_generator_util_1.randomStringGenerator)();
5066
- return `CONFIGURABLE_MODULE_OPTIONS[${hash2}]`;
5065
+ const hash = (0, random_string_generator_util_1.randomStringGenerator)();
5066
+ return `CONFIGURABLE_MODULE_OPTIONS[${hash}]`;
5067
5067
  }
5068
5068
  }
5069
5069
  });
@@ -17613,8 +17613,8 @@ var require_isHash = __commonJS({
17613
17613
  };
17614
17614
  function isHash(str, algorithm) {
17615
17615
  (0, _assertString.default)(str);
17616
- var hash2 = new RegExp("^[a-fA-F0-9]{".concat(lengths[algorithm], "}$"));
17617
- return hash2.test(str);
17616
+ var hash = new RegExp("^[a-fA-F0-9]{".concat(lengths[algorithm], "}$"));
17617
+ return hash.test(str);
17618
17618
  }
17619
17619
  module2.exports = exports2.default;
17620
17620
  module2.exports.default = exports2.default;
@@ -22948,7 +22948,7 @@ var require_IsBoolean = __commonJS({
22948
22948
  return value instanceof Boolean || typeof value === "boolean";
22949
22949
  }
22950
22950
  exports2.isBoolean = isBoolean;
22951
- function IsBoolean13(validationOptions) {
22951
+ function IsBoolean14(validationOptions) {
22952
22952
  return (0, ValidateBy_1.ValidateBy)({
22953
22953
  name: exports2.IS_BOOLEAN,
22954
22954
  validator: {
@@ -22957,7 +22957,7 @@ var require_IsBoolean = __commonJS({
22957
22957
  }
22958
22958
  }, validationOptions);
22959
22959
  }
22960
- exports2.IsBoolean = IsBoolean13;
22960
+ exports2.IsBoolean = IsBoolean14;
22961
22961
  }
22962
22962
  });
22963
22963
 
@@ -23122,7 +23122,7 @@ var require_IsArray = __commonJS({
23122
23122
  return Array.isArray(value);
23123
23123
  }
23124
23124
  exports2.isArray = isArray;
23125
- function IsArray9(validationOptions) {
23125
+ function IsArray10(validationOptions) {
23126
23126
  return (0, ValidateBy_1.ValidateBy)({
23127
23127
  name: exports2.IS_ARRAY,
23128
23128
  validator: {
@@ -23131,7 +23131,7 @@ var require_IsArray = __commonJS({
23131
23131
  }
23132
23132
  }, validationOptions);
23133
23133
  }
23134
- exports2.IsArray = IsArray9;
23134
+ exports2.IsArray = IsArray10;
23135
23135
  }
23136
23136
  });
23137
23137
 
@@ -29614,9 +29614,9 @@ var require_distinctUntilKeyChanged = __commonJS({
29614
29614
  Object.defineProperty(exports2, "__esModule", { value: true });
29615
29615
  exports2.distinctUntilKeyChanged = void 0;
29616
29616
  var distinctUntilChanged_1 = require_distinctUntilChanged();
29617
- function distinctUntilKeyChanged(key, compare2) {
29617
+ function distinctUntilKeyChanged(key, compare) {
29618
29618
  return distinctUntilChanged_1.distinctUntilChanged(function(x, y) {
29619
- return compare2 ? compare2(x[key], y[key]) : x[key] === y[key];
29619
+ return compare ? compare(x[key], y[key]) : x[key] === y[key];
29620
29620
  });
29621
29621
  }
29622
29622
  exports2.distinctUntilKeyChanged = distinctUntilKeyChanged;
@@ -39191,9 +39191,9 @@ var require_module_token_factory = __commonJS({
39191
39191
  if (this.moduleTokenCache.has(key)) {
39192
39192
  return this.moduleTokenCache.get(key);
39193
39193
  }
39194
- const hash2 = this.hashString(key);
39195
- this.moduleTokenCache.set(key, hash2);
39196
- return hash2;
39194
+ const hash = this.hashString(key);
39195
+ this.moduleTokenCache.set(key, hash);
39196
+ return hash;
39197
39197
  }
39198
39198
  getStringifiedOpaqueToken(opaqueToken) {
39199
39199
  return opaqueToken ? (0, fast_safe_stringify_1.default)(opaqueToken, this.replacer) : "";
@@ -39402,7 +39402,7 @@ var require_module = __commonJS({
39402
39402
  var constants_2 = require_constants5();
39403
39403
  var instance_wrapper_1 = require_instance_wrapper();
39404
39404
  var module_ref_1 = require_module_ref();
39405
- var Module16 = class {
39405
+ var Module17 = class {
39406
39406
  constructor(_metatype, container) {
39407
39407
  this._metatype = _metatype;
39408
39408
  this.container = container;
@@ -39796,7 +39796,7 @@ var require_module = __commonJS({
39796
39796
  return (0, get_class_scope_1.getClassScope)(provider) === interfaces_1.Scope.TRANSIENT;
39797
39797
  }
39798
39798
  };
39799
- exports2.Module = Module16;
39799
+ exports2.Module = Module17;
39800
39800
  }
39801
39801
  });
39802
39802
 
@@ -44883,12 +44883,12 @@ var require_debug = __commonJS({
44883
44883
  exports2.formatters = {};
44884
44884
  var prevTime;
44885
44885
  function selectColor(namespace) {
44886
- var hash2 = 0, i;
44886
+ var hash = 0, i;
44887
44887
  for (i in namespace) {
44888
- hash2 = (hash2 << 5) - hash2 + namespace.charCodeAt(i);
44889
- hash2 |= 0;
44888
+ hash = (hash << 5) - hash + namespace.charCodeAt(i);
44889
+ hash |= 0;
44890
44890
  }
44891
- return exports2.colors[Math.abs(hash2) % exports2.colors.length];
44891
+ return exports2.colors[Math.abs(hash) % exports2.colors.length];
44892
44892
  }
44893
44893
  function createDebug(namespace) {
44894
44894
  function debug() {
@@ -62882,9 +62882,9 @@ var require_etag = __commonJS({
62882
62882
  if (entity.length === 0) {
62883
62883
  return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"';
62884
62884
  }
62885
- var hash2 = crypto3.createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
62885
+ var hash = crypto3.createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
62886
62886
  var len = typeof entity === "string" ? Buffer.byteLength(entity, "utf8") : entity.length;
62887
- return '"' + len.toString(16) + "-" + hash2 + '"';
62887
+ return '"' + len.toString(16) + "-" + hash + '"';
62888
62888
  }
62889
62889
  function etag(entity, options) {
62890
62890
  if (entity == null) {
@@ -76035,7 +76035,7 @@ var require_serve_static_options_interface = __commonJS({
76035
76035
  var require_abstract_loader = __commonJS({
76036
76036
  "node_modules/.pnpm/@nestjs+serve-static@4.0.2_@nestjs+common@10.4.22_class-transformer@0.5.1_class-validator@0.1_kmdzv4ihqpcjmuu5h5u36hctmy/node_modules/@nestjs/serve-static/dist/loaders/abstract.loader.js"(exports2) {
76037
76037
  "use strict";
76038
- var __decorate75 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
76038
+ var __decorate77 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
76039
76039
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
76040
76040
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
76041
76041
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -76051,7 +76051,7 @@ var require_abstract_loader = __commonJS({
76051
76051
  }
76052
76052
  };
76053
76053
  exports2.AbstractLoader = AbstractLoader;
76054
- exports2.AbstractLoader = AbstractLoader = __decorate75([
76054
+ exports2.AbstractLoader = AbstractLoader = __decorate77([
76055
76055
  (0, common_1.Injectable)()
76056
76056
  ], AbstractLoader);
76057
76057
  }
@@ -76197,7 +76197,7 @@ var require_validate_path_util = __commonJS({
76197
76197
  var require_express_loader = __commonJS({
76198
76198
  "node_modules/.pnpm/@nestjs+serve-static@4.0.2_@nestjs+common@10.4.22_class-transformer@0.5.1_class-validator@0.1_kmdzv4ihqpcjmuu5h5u36hctmy/node_modules/@nestjs/serve-static/dist/loaders/express.loader.js"(exports2) {
76199
76199
  "use strict";
76200
- var __decorate75 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
76200
+ var __decorate77 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
76201
76201
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
76202
76202
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
76203
76203
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -76243,7 +76243,7 @@ var require_express_loader = __commonJS({
76243
76243
  }
76244
76244
  };
76245
76245
  exports2.ExpressLoader = ExpressLoader;
76246
- exports2.ExpressLoader = ExpressLoader = __decorate75([
76246
+ exports2.ExpressLoader = ExpressLoader = __decorate77([
76247
76247
  (0, common_1.Injectable)()
76248
76248
  ], ExpressLoader);
76249
76249
  }
@@ -76253,7 +76253,7 @@ var require_express_loader = __commonJS({
76253
76253
  var require_fastify_loader = __commonJS({
76254
76254
  "node_modules/.pnpm/@nestjs+serve-static@4.0.2_@nestjs+common@10.4.22_class-transformer@0.5.1_class-validator@0.1_kmdzv4ihqpcjmuu5h5u36hctmy/node_modules/@nestjs/serve-static/dist/loaders/fastify.loader.js"(exports2) {
76255
76255
  "use strict";
76256
- var __decorate75 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
76256
+ var __decorate77 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
76257
76257
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
76258
76258
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
76259
76259
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -76306,7 +76306,7 @@ var require_fastify_loader = __commonJS({
76306
76306
  }
76307
76307
  };
76308
76308
  exports2.FastifyLoader = FastifyLoader;
76309
- exports2.FastifyLoader = FastifyLoader = __decorate75([
76309
+ exports2.FastifyLoader = FastifyLoader = __decorate77([
76310
76310
  (0, common_1.Injectable)()
76311
76311
  ], FastifyLoader);
76312
76312
  }
@@ -76316,7 +76316,7 @@ var require_fastify_loader = __commonJS({
76316
76316
  var require_noop_loader = __commonJS({
76317
76317
  "node_modules/.pnpm/@nestjs+serve-static@4.0.2_@nestjs+common@10.4.22_class-transformer@0.5.1_class-validator@0.1_kmdzv4ihqpcjmuu5h5u36hctmy/node_modules/@nestjs/serve-static/dist/loaders/noop.loader.js"(exports2) {
76318
76318
  "use strict";
76319
- var __decorate75 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
76319
+ var __decorate77 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
76320
76320
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
76321
76321
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
76322
76322
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -76331,7 +76331,7 @@ var require_noop_loader = __commonJS({
76331
76331
  }
76332
76332
  };
76333
76333
  exports2.NoopLoader = NoopLoader;
76334
- exports2.NoopLoader = NoopLoader = __decorate75([
76334
+ exports2.NoopLoader = NoopLoader = __decorate77([
76335
76335
  (0, common_1.Injectable)()
76336
76336
  ], NoopLoader);
76337
76337
  }
@@ -76371,16 +76371,16 @@ var require_serve_static_providers = __commonJS({
76371
76371
  var require_serve_static_module = __commonJS({
76372
76372
  "node_modules/.pnpm/@nestjs+serve-static@4.0.2_@nestjs+common@10.4.22_class-transformer@0.5.1_class-validator@0.1_kmdzv4ihqpcjmuu5h5u36hctmy/node_modules/@nestjs/serve-static/dist/serve-static.module.js"(exports2) {
76373
76373
  "use strict";
76374
- var __decorate75 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
76374
+ var __decorate77 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
76375
76375
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
76376
76376
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
76377
76377
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
76378
76378
  return c > 3 && r && Object.defineProperty(target, key, r), r;
76379
76379
  };
76380
- var __metadata57 = exports2 && exports2.__metadata || function(k, v) {
76380
+ var __metadata58 = exports2 && exports2.__metadata || function(k, v) {
76381
76381
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
76382
76382
  };
76383
- var __param14 = exports2 && exports2.__param || function(paramIndex, decorator) {
76383
+ var __param15 = exports2 && exports2.__param || function(paramIndex, decorator) {
76384
76384
  return function(target, key) {
76385
76385
  decorator(target, key, paramIndex);
76386
76386
  };
@@ -76453,12 +76453,12 @@ var require_serve_static_module = __commonJS({
76453
76453
  }
76454
76454
  };
76455
76455
  exports2.ServeStaticModule = ServeStaticModule2;
76456
- exports2.ServeStaticModule = ServeStaticModule2 = ServeStaticModule_1 = __decorate75([
76456
+ exports2.ServeStaticModule = ServeStaticModule2 = ServeStaticModule_1 = __decorate77([
76457
76457
  (0, common_1.Module)({
76458
76458
  providers: [...serve_static_providers_1.serveStaticProviders]
76459
76459
  }),
76460
- __param14(0, (0, common_1.Inject)(serve_static_constants_1.SERVE_STATIC_MODULE_OPTIONS)),
76461
- __metadata57("design:paramtypes", [
76460
+ __param15(0, (0, common_1.Inject)(serve_static_constants_1.SERVE_STATIC_MODULE_OPTIONS)),
76461
+ __metadata58("design:paramtypes", [
76462
76462
  Array,
76463
76463
  abstract_loader_1.AbstractLoader,
76464
76464
  core_1.HttpAdapterHost
@@ -77725,8 +77725,8 @@ var require_utils_webcrypto = __commonJS({
77725
77725
  return nodeCrypto.createHash("md5").update(string, "utf-8").digest("hex");
77726
77726
  } catch (e) {
77727
77727
  const data = typeof string === "string" ? textEncoder.encode(string) : string;
77728
- const hash2 = await subtleCrypto.digest("MD5", data);
77729
- return Array.from(new Uint8Array(hash2)).map((b) => b.toString(16).padStart(2, "0")).join("");
77728
+ const hash = await subtleCrypto.digest("MD5", data);
77729
+ return Array.from(new Uint8Array(hash)).map((b) => b.toString(16).padStart(2, "0")).join("");
77730
77730
  }
77731
77731
  }
77732
77732
  async function postgresMd5PasswordHash(user, password, salt) {
@@ -86798,7 +86798,7 @@ var require_umd = __commonJS({
86798
86798
  };
86799
86799
  LongPrototype.gte = LongPrototype.greaterThanOrEqual;
86800
86800
  LongPrototype.ge = LongPrototype.greaterThanOrEqual;
86801
- LongPrototype.compare = function compare2(other) {
86801
+ LongPrototype.compare = function compare(other) {
86802
86802
  if (!isLong(other)) other = fromValue(other);
86803
86803
  if (this.eq(other)) return 0;
86804
86804
  var thisNeg = this.isNegative(), otherNeg = other.isNegative();
@@ -92315,15 +92315,15 @@ var require_auth_41 = __commonJS({
92315
92315
  "use strict";
92316
92316
  var crypto3 = __require("crypto");
92317
92317
  function sha1(msg, msg1, msg2) {
92318
- const hash2 = crypto3.createHash("sha1");
92319
- hash2.update(msg);
92318
+ const hash = crypto3.createHash("sha1");
92319
+ hash.update(msg);
92320
92320
  if (msg1) {
92321
- hash2.update(msg1);
92321
+ hash.update(msg1);
92322
92322
  }
92323
92323
  if (msg2) {
92324
- hash2.update(msg2);
92324
+ hash.update(msg2);
92325
92325
  }
92326
- return hash2.digest();
92326
+ return hash.digest();
92327
92327
  }
92328
92328
  function xor(a, b) {
92329
92329
  const result = Buffer.allocUnsafe(a.length);
@@ -94129,9 +94129,9 @@ var require_caching_sha2_password = __commonJS({
94129
94129
  var STATE_WAIT_SERVER_KEY = 2;
94130
94130
  var STATE_FINAL = -1;
94131
94131
  function sha256(msg) {
94132
- const hash2 = crypto3.createHash("sha256");
94133
- hash2.update(msg);
94134
- return hash2.digest();
94132
+ const hash = crypto3.createHash("sha256");
94133
+ hash.update(msg);
94134
+ return hash.digest();
94135
94135
  }
94136
94136
  function calculateToken(password, scramble) {
94137
94137
  if (!password) {
@@ -101388,8 +101388,8 @@ var require_compare = __commonJS({
101388
101388
  "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare.js"(exports2, module2) {
101389
101389
  "use strict";
101390
101390
  var SemVer = require_semver();
101391
- var compare2 = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
101392
- module2.exports = compare2;
101391
+ var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
101392
+ module2.exports = compare;
101393
101393
  }
101394
101394
  });
101395
101395
 
@@ -101397,8 +101397,8 @@ var require_compare = __commonJS({
101397
101397
  var require_rcompare = __commonJS({
101398
101398
  "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rcompare.js"(exports2, module2) {
101399
101399
  "use strict";
101400
- var compare2 = require_compare();
101401
- var rcompare = (a, b, loose) => compare2(b, a, loose);
101400
+ var compare = require_compare();
101401
+ var rcompare = (a, b, loose) => compare(b, a, loose);
101402
101402
  module2.exports = rcompare;
101403
101403
  }
101404
101404
  });
@@ -101407,8 +101407,8 @@ var require_rcompare = __commonJS({
101407
101407
  var require_compare_loose = __commonJS({
101408
101408
  "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-loose.js"(exports2, module2) {
101409
101409
  "use strict";
101410
- var compare2 = require_compare();
101411
- var compareLoose = (a, b) => compare2(a, b, true);
101410
+ var compare = require_compare();
101411
+ var compareLoose = (a, b) => compare(a, b, true);
101412
101412
  module2.exports = compareLoose;
101413
101413
  }
101414
101414
  });
@@ -101451,8 +101451,8 @@ var require_rsort = __commonJS({
101451
101451
  var require_gt = __commonJS({
101452
101452
  "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gt.js"(exports2, module2) {
101453
101453
  "use strict";
101454
- var compare2 = require_compare();
101455
- var gt = (a, b, loose) => compare2(a, b, loose) > 0;
101454
+ var compare = require_compare();
101455
+ var gt = (a, b, loose) => compare(a, b, loose) > 0;
101456
101456
  module2.exports = gt;
101457
101457
  }
101458
101458
  });
@@ -101461,8 +101461,8 @@ var require_gt = __commonJS({
101461
101461
  var require_lt = __commonJS({
101462
101462
  "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lt.js"(exports2, module2) {
101463
101463
  "use strict";
101464
- var compare2 = require_compare();
101465
- var lt = (a, b, loose) => compare2(a, b, loose) < 0;
101464
+ var compare = require_compare();
101465
+ var lt = (a, b, loose) => compare(a, b, loose) < 0;
101466
101466
  module2.exports = lt;
101467
101467
  }
101468
101468
  });
@@ -101471,8 +101471,8 @@ var require_lt = __commonJS({
101471
101471
  var require_eq = __commonJS({
101472
101472
  "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/eq.js"(exports2, module2) {
101473
101473
  "use strict";
101474
- var compare2 = require_compare();
101475
- var eq = (a, b, loose) => compare2(a, b, loose) === 0;
101474
+ var compare = require_compare();
101475
+ var eq = (a, b, loose) => compare(a, b, loose) === 0;
101476
101476
  module2.exports = eq;
101477
101477
  }
101478
101478
  });
@@ -101481,8 +101481,8 @@ var require_eq = __commonJS({
101481
101481
  var require_neq = __commonJS({
101482
101482
  "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/neq.js"(exports2, module2) {
101483
101483
  "use strict";
101484
- var compare2 = require_compare();
101485
- var neq = (a, b, loose) => compare2(a, b, loose) !== 0;
101484
+ var compare = require_compare();
101485
+ var neq = (a, b, loose) => compare(a, b, loose) !== 0;
101486
101486
  module2.exports = neq;
101487
101487
  }
101488
101488
  });
@@ -101491,8 +101491,8 @@ var require_neq = __commonJS({
101491
101491
  var require_gte = __commonJS({
101492
101492
  "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gte.js"(exports2, module2) {
101493
101493
  "use strict";
101494
- var compare2 = require_compare();
101495
- var gte = (a, b, loose) => compare2(a, b, loose) >= 0;
101494
+ var compare = require_compare();
101495
+ var gte = (a, b, loose) => compare(a, b, loose) >= 0;
101496
101496
  module2.exports = gte;
101497
101497
  }
101498
101498
  });
@@ -101501,8 +101501,8 @@ var require_gte = __commonJS({
101501
101501
  var require_lte = __commonJS({
101502
101502
  "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lte.js"(exports2, module2) {
101503
101503
  "use strict";
101504
- var compare2 = require_compare();
101505
- var lte = (a, b, loose) => compare2(a, b, loose) <= 0;
101504
+ var compare = require_compare();
101505
+ var lte = (a, b, loose) => compare(a, b, loose) <= 0;
101506
101506
  module2.exports = lte;
101507
101507
  }
101508
101508
  });
@@ -102399,12 +102399,12 @@ var require_simplify = __commonJS({
102399
102399
  "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/simplify.js"(exports2, module2) {
102400
102400
  "use strict";
102401
102401
  var satisfies = require_satisfies();
102402
- var compare2 = require_compare();
102402
+ var compare = require_compare();
102403
102403
  module2.exports = (versions, range, options) => {
102404
102404
  const set = [];
102405
102405
  let first = null;
102406
102406
  let prev = null;
102407
- const v = versions.sort((a, b) => compare2(a, b, options));
102407
+ const v = versions.sort((a, b) => compare(a, b, options));
102408
102408
  for (const version of v) {
102409
102409
  const included = satisfies(version, range, options);
102410
102410
  if (included) {
@@ -102452,7 +102452,7 @@ var require_subset = __commonJS({
102452
102452
  var Comparator = require_comparator();
102453
102453
  var { ANY } = Comparator;
102454
102454
  var satisfies = require_satisfies();
102455
- var compare2 = require_compare();
102455
+ var compare = require_compare();
102456
102456
  var subset = (sub, dom, options = {}) => {
102457
102457
  if (sub === dom) {
102458
102458
  return true;
@@ -102512,7 +102512,7 @@ var require_subset = __commonJS({
102512
102512
  }
102513
102513
  let gtltComp;
102514
102514
  if (gt && lt) {
102515
- gtltComp = compare2(gt.semver, lt.semver, options);
102515
+ gtltComp = compare(gt.semver, lt.semver, options);
102516
102516
  if (gtltComp > 0) {
102517
102517
  return null;
102518
102518
  } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
@@ -102592,14 +102592,14 @@ var require_subset = __commonJS({
102592
102592
  if (!a) {
102593
102593
  return b;
102594
102594
  }
102595
- const comp = compare2(a.semver, b.semver, options);
102595
+ const comp = compare(a.semver, b.semver, options);
102596
102596
  return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
102597
102597
  };
102598
102598
  var lowerLT = (a, b, options) => {
102599
102599
  if (!a) {
102600
102600
  return b;
102601
102601
  }
102602
- const comp = compare2(a.semver, b.semver, options);
102602
+ const comp = compare(a.semver, b.semver, options);
102603
102603
  return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
102604
102604
  };
102605
102605
  module2.exports = subset;
@@ -102623,7 +102623,7 @@ var require_semver2 = __commonJS({
102623
102623
  var minor = require_minor();
102624
102624
  var patch = require_patch();
102625
102625
  var prerelease = require_prerelease();
102626
- var compare2 = require_compare();
102626
+ var compare = require_compare();
102627
102627
  var rcompare = require_rcompare();
102628
102628
  var compareLoose = require_compare_loose();
102629
102629
  var compareBuild = require_compare_build();
@@ -102661,7 +102661,7 @@ var require_semver2 = __commonJS({
102661
102661
  minor,
102662
102662
  patch,
102663
102663
  prerelease,
102664
- compare: compare2,
102664
+ compare,
102665
102665
  rcompare,
102666
102666
  compareLoose,
102667
102667
  compareBuild,
@@ -103658,16 +103658,16 @@ var require_jsonwebtoken = __commonJS({
103658
103658
  var require_jwt_service = __commonJS({
103659
103659
  "node_modules/.pnpm/@nestjs+jwt@11.0.2_@nestjs+common@10.4.22_class-transformer@0.5.1_class-validator@0.14.3_refl_tb2k3hwaeibzs5qkwqj56q6ttq/node_modules/@nestjs/jwt/dist/jwt.service.js"(exports2) {
103660
103660
  "use strict";
103661
- var __decorate75 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
103661
+ var __decorate77 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
103662
103662
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
103663
103663
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
103664
103664
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
103665
103665
  return c > 3 && r && Object.defineProperty(target, key, r), r;
103666
103666
  };
103667
- var __metadata57 = exports2 && exports2.__metadata || function(k, v) {
103667
+ var __metadata58 = exports2 && exports2.__metadata || function(k, v) {
103668
103668
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
103669
103669
  };
103670
- var __param14 = exports2 && exports2.__param || function(paramIndex, decorator) {
103670
+ var __param15 = exports2 && exports2.__param || function(paramIndex, decorator) {
103671
103671
  return function(target, key) {
103672
103672
  decorator(target, key, paramIndex);
103673
103673
  };
@@ -103755,11 +103755,11 @@ var require_jwt_service = __commonJS({
103755
103755
  }
103756
103756
  };
103757
103757
  exports2.JwtService = JwtService2;
103758
- exports2.JwtService = JwtService2 = __decorate75([
103758
+ exports2.JwtService = JwtService2 = __decorate77([
103759
103759
  (0, common_1.Injectable)(),
103760
- __param14(0, (0, common_1.Optional)()),
103761
- __param14(0, (0, common_1.Inject)(jwt_constants_1.JWT_MODULE_OPTIONS)),
103762
- __metadata57("design:paramtypes", [Object])
103760
+ __param15(0, (0, common_1.Optional)()),
103761
+ __param15(0, (0, common_1.Inject)(jwt_constants_1.JWT_MODULE_OPTIONS)),
103762
+ __metadata58("design:paramtypes", [Object])
103763
103763
  ], JwtService2);
103764
103764
  }
103765
103765
  });
@@ -103768,7 +103768,7 @@ var require_jwt_service = __commonJS({
103768
103768
  var require_jwt_module = __commonJS({
103769
103769
  "node_modules/.pnpm/@nestjs+jwt@11.0.2_@nestjs+common@10.4.22_class-transformer@0.5.1_class-validator@0.14.3_refl_tb2k3hwaeibzs5qkwqj56q6ttq/node_modules/@nestjs/jwt/dist/jwt.module.js"(exports2) {
103770
103770
  "use strict";
103771
- var __decorate75 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
103771
+ var __decorate77 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
103772
103772
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
103773
103773
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
103774
103774
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -103828,7 +103828,7 @@ var require_jwt_module = __commonJS({
103828
103828
  }
103829
103829
  };
103830
103830
  exports2.JwtModule = JwtModule2;
103831
- exports2.JwtModule = JwtModule2 = JwtModule_1 = __decorate75([
103831
+ exports2.JwtModule = JwtModule2 = JwtModule_1 = __decorate77([
103832
103832
  (0, common_1.Module)({
103833
103833
  providers: [jwt_service_1.JwtService],
103834
103834
  exports: [jwt_service_1.JwtService]
@@ -104635,16 +104635,16 @@ var require_memoize_util = __commonJS({
104635
104635
  var require_auth_guard = __commonJS({
104636
104636
  "node_modules/.pnpm/@nestjs+passport@11.0.5_@nestjs+common@10.4.22_class-transformer@0.5.1_class-validator@0.14.3_bz5s6qwi6r6ots5rioaykmbz5a/node_modules/@nestjs/passport/dist/auth.guard.js"(exports2) {
104637
104637
  "use strict";
104638
- var __decorate75 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
104638
+ var __decorate77 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
104639
104639
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
104640
104640
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
104641
104641
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
104642
104642
  return c > 3 && r && Object.defineProperty(target, key, r), r;
104643
104643
  };
104644
- var __metadata57 = exports2 && exports2.__metadata || function(k, v) {
104644
+ var __metadata58 = exports2 && exports2.__metadata || function(k, v) {
104645
104645
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
104646
104646
  };
104647
- var __param14 = exports2 && exports2.__param || function(paramIndex, decorator) {
104647
+ var __param15 = exports2 && exports2.__param || function(paramIndex, decorator) {
104648
104648
  return function(target, key) {
104649
104649
  decorator(target, key, paramIndex);
104650
104650
  };
@@ -104703,14 +104703,14 @@ var require_auth_guard = __commonJS({
104703
104703
  return void 0;
104704
104704
  }
104705
104705
  };
104706
- __decorate75([
104706
+ __decorate77([
104707
104707
  (0, common_1.Optional)(),
104708
104708
  (0, common_1.Inject)(auth_module_options_1.AuthModuleOptions),
104709
- __metadata57("design:type", auth_module_options_1.AuthModuleOptions)
104709
+ __metadata58("design:type", auth_module_options_1.AuthModuleOptions)
104710
104710
  ], MixinAuthGuard.prototype, "options", void 0);
104711
- MixinAuthGuard = __decorate75([
104712
- __param14(0, (0, common_1.Optional)()),
104713
- __metadata57("design:paramtypes", [auth_module_options_1.AuthModuleOptions])
104711
+ MixinAuthGuard = __decorate77([
104712
+ __param15(0, (0, common_1.Optional)()),
104713
+ __metadata58("design:paramtypes", [auth_module_options_1.AuthModuleOptions])
104714
104714
  ], MixinAuthGuard);
104715
104715
  const guard = (0, common_1.mixin)(MixinAuthGuard);
104716
104716
  return guard;
@@ -104764,7 +104764,7 @@ var require_interfaces8 = __commonJS({
104764
104764
  var require_passport_module = __commonJS({
104765
104765
  "node_modules/.pnpm/@nestjs+passport@11.0.5_@nestjs+common@10.4.22_class-transformer@0.5.1_class-validator@0.14.3_bz5s6qwi6r6ots5rioaykmbz5a/node_modules/@nestjs/passport/dist/passport.module.js"(exports2) {
104766
104766
  "use strict";
104767
- var __decorate75 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
104767
+ var __decorate77 = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
104768
104768
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
104769
104769
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
104770
104770
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -104819,7 +104819,7 @@ var require_passport_module = __commonJS({
104819
104819
  }
104820
104820
  };
104821
104821
  exports2.PassportModule = PassportModule2;
104822
- exports2.PassportModule = PassportModule2 = PassportModule_1 = __decorate75([
104822
+ exports2.PassportModule = PassportModule2 = PassportModule_1 = __decorate77([
104823
104823
  (0, common_1.Module)({})
104824
104824
  ], PassportModule2);
104825
104825
  }
@@ -105074,28 +105074,28 @@ var require_bcrypt = __commonJS({
105074
105074
  return false;
105075
105075
  return wrong === 0;
105076
105076
  }
105077
- bcrypt2.compareSync = function(s, hash2) {
105078
- if (typeof s !== "string" || typeof hash2 !== "string")
105079
- throw Error("Illegal arguments: " + typeof s + ", " + typeof hash2);
105080
- if (hash2.length !== 60)
105077
+ bcrypt2.compareSync = function(s, hash) {
105078
+ if (typeof s !== "string" || typeof hash !== "string")
105079
+ throw Error("Illegal arguments: " + typeof s + ", " + typeof hash);
105080
+ if (hash.length !== 60)
105081
105081
  return false;
105082
- return safeStringCompare(bcrypt2.hashSync(s, hash2.substr(0, hash2.length - 31)), hash2);
105082
+ return safeStringCompare(bcrypt2.hashSync(s, hash.substr(0, hash.length - 31)), hash);
105083
105083
  };
105084
- bcrypt2.compare = function(s, hash2, callback, progressCallback) {
105084
+ bcrypt2.compare = function(s, hash, callback, progressCallback) {
105085
105085
  function _async(callback2) {
105086
- if (typeof s !== "string" || typeof hash2 !== "string") {
105087
- nextTick(callback2.bind(this, Error("Illegal arguments: " + typeof s + ", " + typeof hash2)));
105086
+ if (typeof s !== "string" || typeof hash !== "string") {
105087
+ nextTick(callback2.bind(this, Error("Illegal arguments: " + typeof s + ", " + typeof hash)));
105088
105088
  return;
105089
105089
  }
105090
- if (hash2.length !== 60) {
105090
+ if (hash.length !== 60) {
105091
105091
  nextTick(callback2.bind(this, null, false));
105092
105092
  return;
105093
105093
  }
105094
- bcrypt2.hash(s, hash2.substr(0, 29), function(err, comp) {
105094
+ bcrypt2.hash(s, hash.substr(0, 29), function(err, comp) {
105095
105095
  if (err)
105096
105096
  callback2(err);
105097
105097
  else
105098
- callback2(null, safeStringCompare(comp, hash2));
105098
+ callback2(null, safeStringCompare(comp, hash));
105099
105099
  }, progressCallback);
105100
105100
  }
105101
105101
  if (callback) {
@@ -105113,17 +105113,17 @@ var require_bcrypt = __commonJS({
105113
105113
  });
105114
105114
  });
105115
105115
  };
105116
- bcrypt2.getRounds = function(hash2) {
105117
- if (typeof hash2 !== "string")
105118
- throw Error("Illegal arguments: " + typeof hash2);
105119
- return parseInt(hash2.split("$")[2], 10);
105116
+ bcrypt2.getRounds = function(hash) {
105117
+ if (typeof hash !== "string")
105118
+ throw Error("Illegal arguments: " + typeof hash);
105119
+ return parseInt(hash.split("$")[2], 10);
105120
105120
  };
105121
- bcrypt2.getSalt = function(hash2) {
105122
- if (typeof hash2 !== "string")
105123
- throw Error("Illegal arguments: " + typeof hash2);
105124
- if (hash2.length !== 60)
105125
- throw Error("Illegal hash length: " + hash2.length + " != 60");
105126
- return hash2.substring(0, 29);
105121
+ bcrypt2.getSalt = function(hash) {
105122
+ if (typeof hash !== "string")
105123
+ throw Error("Illegal arguments: " + typeof hash);
105124
+ if (hash.length !== 60)
105125
+ throw Error("Illegal hash length: " + hash.length + " != 60");
105126
+ return hash.substring(0, 29);
105127
105127
  };
105128
105128
  var nextTick = typeof process !== "undefined" && process && typeof process.nextTick === "function" ? typeof setImmediate === "function" ? setImmediate : process.nextTick : setTimeout;
105129
105129
  function stringToBytes(str) {
@@ -107036,10 +107036,10 @@ var require_lib14 = __commonJS({
107036
107036
  // apps/api/dist/main.js
107037
107037
  var import_reflect_metadata = __toESM(require_Reflect(), 1);
107038
107038
  var import_core5 = __toESM(require_core3(), 1);
107039
- var import_common49 = __toESM(require_common(), 1);
107039
+ var import_common51 = __toESM(require_common(), 1);
107040
107040
 
107041
107041
  // apps/api/dist/app.module.js
107042
- var import_common48 = __toESM(require_common(), 1);
107042
+ var import_common50 = __toESM(require_common(), 1);
107043
107043
  var import_core4 = __toESM(require_core3(), 1);
107044
107044
  var import_serve_static = __toESM(require_serve_static2(), 1);
107045
107045
  import { join as join4 } from "path";
@@ -107061,7 +107061,7 @@ var import_common = __toESM(require_common(), 1);
107061
107061
  import Database from "better-sqlite3";
107062
107062
 
107063
107063
  // packages/metadata/dist/schema.js
107064
- var SCHEMA_VERSION = 21;
107064
+ var SCHEMA_VERSION = 22;
107065
107065
  var MIGRATIONS = [
107066
107066
  // Version 1: Initial schema
107067
107067
  `
@@ -107546,6 +107546,50 @@ var MIGRATIONS = [
107546
107546
  CREATE INDEX IF NOT EXISTS idx_backups_created_by ON backups(created_by);
107547
107547
 
107548
107548
  UPDATE schema_version SET version = 21;
107549
+ `,
107550
+ // Version 22: Add is_public to resources + rename settings to user_preferences with user_id
107551
+ `
107552
+ -- Create system user for storing system-wide preferences (if not exists)
107553
+ INSERT OR IGNORE INTO users (id, email, password_hash, role, created_at, updated_at)
107554
+ VALUES ('system', 'system@internal', '', 'admin', datetime('now'), datetime('now'));
107555
+
107556
+ -- Ensure settings table exists (even if empty) to avoid errors in migration
107557
+ CREATE TABLE IF NOT EXISTS settings (
107558
+ key TEXT PRIMARY KEY,
107559
+ value TEXT NOT NULL,
107560
+ updated_at TEXT NOT NULL DEFAULT (datetime('now'))
107561
+ );
107562
+
107563
+ -- Create user_preferences table (replaces settings)
107564
+ CREATE TABLE IF NOT EXISTS user_preferences (
107565
+ id TEXT PRIMARY KEY,
107566
+ user_id TEXT NOT NULL,
107567
+ key TEXT NOT NULL,
107568
+ value TEXT NOT NULL,
107569
+ updated_at TEXT NOT NULL DEFAULT (datetime('now')),
107570
+ FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
107571
+ UNIQUE(user_id, key)
107572
+ );
107573
+
107574
+ -- Migrate existing settings as system defaults (user_id = 'system')
107575
+ INSERT OR IGNORE INTO user_preferences (id, user_id, key, value, updated_at)
107576
+ SELECT hex(randomblob(16)), 'system', key, value, updated_at FROM settings;
107577
+
107578
+ -- Drop old settings table
107579
+ DROP TABLE IF EXISTS settings;
107580
+
107581
+ -- Create index for user preferences
107582
+ CREATE INDEX IF NOT EXISTS idx_user_preferences_user ON user_preferences(user_id);
107583
+ CREATE INDEX IF NOT EXISTS idx_user_preferences_key ON user_preferences(user_id, key);
107584
+
107585
+ -- Add is_public to resources (default 0 = private, only owner can see)
107586
+ ALTER TABLE connections ADD COLUMN is_public INTEGER NOT NULL DEFAULT 0;
107587
+ ALTER TABLE servers ADD COLUMN is_public INTEGER NOT NULL DEFAULT 0;
107588
+ ALTER TABLE projects ADD COLUMN is_public INTEGER NOT NULL DEFAULT 0;
107589
+ ALTER TABLE database_groups ADD COLUMN is_public INTEGER NOT NULL DEFAULT 0;
107590
+ ALTER TABLE saved_queries ADD COLUMN is_public INTEGER NOT NULL DEFAULT 0;
107591
+
107592
+ UPDATE schema_version SET version = 22;
107549
107593
  `
107550
107594
  ];
107551
107595
 
@@ -107665,9 +107709,9 @@ var ConnectionRepository = class {
107665
107709
  const encryptedPwd = input.password ? encryptPassword(input.password) : null;
107666
107710
  const connectionType = input.connectionType || this.inferConnectionType(input.host);
107667
107711
  this.db.prepare(`
107668
- INSERT INTO connections (id, name, engine, connection_type, host, port, database, username, encrypted_password, ssl, default_schema, tags, read_only, server_id, project_id, group_id, created_by, created_at, updated_at)
107669
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
107670
- `).run(id, input.name, input.engine, connectionType, input.host, input.port, input.database, input.username, encryptedPwd, input.ssl ? 1 : 0, input.defaultSchema || null, JSON.stringify(input.tags ?? []), input.readOnly ? 1 : 0, input.serverId || null, input.projectId || null, input.groupId || null, userId || null, now, now);
107712
+ INSERT INTO connections (id, name, engine, connection_type, host, port, database, username, encrypted_password, ssl, default_schema, tags, read_only, server_id, project_id, group_id, is_public, created_by, created_at, updated_at)
107713
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
107714
+ `).run(id, input.name, input.engine, connectionType, input.host, input.port, input.database, input.username, encryptedPwd, input.ssl ? 1 : 0, input.defaultSchema || null, JSON.stringify(input.tags ?? []), input.readOnly ? 1 : 0, input.serverId || null, input.projectId || null, input.groupId || null, input.isPublic ? 1 : 0, userId || null, now, now);
107671
107715
  return this.findById(id);
107672
107716
  }
107673
107717
  /**
@@ -107723,7 +107767,7 @@ var ConnectionRepository = class {
107723
107767
  `;
107724
107768
  const params = [];
107725
107769
  if (userContext && !userContext.isAdmin && userContext.userId) {
107726
- query += ` WHERE c.created_by = ? OR c.created_by IS NULL`;
107770
+ query += ` WHERE (c.created_by = ? OR c.created_by IS NULL OR c.is_public = 1)`;
107727
107771
  params.push(userContext.userId);
107728
107772
  }
107729
107773
  query += ` ORDER BY p.name, dg.name, c.name`;
@@ -107748,7 +107792,7 @@ var ConnectionRepository = class {
107748
107792
  `;
107749
107793
  const params = [projectId];
107750
107794
  if (userContext && !userContext.isAdmin && userContext.userId) {
107751
- query += ` AND (c.created_by = ? OR c.created_by IS NULL)`;
107795
+ query += ` AND (c.created_by = ? OR c.created_by IS NULL OR c.is_public = 1)`;
107752
107796
  params.push(userContext.userId);
107753
107797
  }
107754
107798
  query += ` ORDER BY dg.name, c.name`;
@@ -107773,7 +107817,7 @@ var ConnectionRepository = class {
107773
107817
  `;
107774
107818
  const params = [groupId];
107775
107819
  if (userContext && !userContext.isAdmin && userContext.userId) {
107776
- query += ` AND (c.created_by = ? OR c.created_by IS NULL)`;
107820
+ query += ` AND (c.created_by = ? OR c.created_by IS NULL OR c.is_public = 1)`;
107777
107821
  params.push(userContext.userId);
107778
107822
  }
107779
107823
  query += ` ORDER BY c.name`;
@@ -107798,7 +107842,7 @@ var ConnectionRepository = class {
107798
107842
  `;
107799
107843
  const params = [];
107800
107844
  if (userContext && !userContext.isAdmin && userContext.userId) {
107801
- query += ` AND (c.created_by = ? OR c.created_by IS NULL)`;
107845
+ query += ` AND (c.created_by = ? OR c.created_by IS NULL OR c.is_public = 1)`;
107802
107846
  params.push(userContext.userId);
107803
107847
  }
107804
107848
  query += ` ORDER BY c.name`;
@@ -107822,7 +107866,7 @@ var ConnectionRepository = class {
107822
107866
  `;
107823
107867
  const params = [];
107824
107868
  if (userContext && !userContext.isAdmin && userContext.userId) {
107825
- query += ` WHERE c.created_by = ? OR c.created_by IS NULL`;
107869
+ query += ` WHERE (c.created_by = ? OR c.created_by IS NULL OR c.is_public = 1)`;
107826
107870
  params.push(userContext.userId);
107827
107871
  }
107828
107872
  query += ` ORDER BY c.name`;
@@ -107897,6 +107941,10 @@ var ConnectionRepository = class {
107897
107941
  updates.push("server_id = ?");
107898
107942
  values.push(input.serverId);
107899
107943
  }
107944
+ if (input.isPublic !== void 0) {
107945
+ updates.push("is_public = ?");
107946
+ values.push(input.isPublic ? 1 : 0);
107947
+ }
107900
107948
  if (updates.length > 0) {
107901
107949
  updates.push("updated_at = ?");
107902
107950
  values.push((/* @__PURE__ */ new Date()).toISOString());
@@ -107968,21 +108016,23 @@ var ConnectionRepository = class {
107968
108016
  projectId: row.project_id || void 0,
107969
108017
  groupId: row.group_id || void 0,
107970
108018
  createdBy: row.created_by || void 0,
108019
+ isPublic: row.is_public === 1,
107971
108020
  serverName: row.server_name,
107972
108021
  projectName: row.project_name,
107973
108022
  groupName: row.group_name
107974
108023
  };
107975
108024
  }
107976
108025
  /**
107977
- * Check if user can access a connection
108026
+ * Check if user can access (view) a connection
108027
+ * Accessible if: owner, admin, not private, or created_by is null (legacy)
107978
108028
  */
107979
108029
  canAccess(connectionId, userContext) {
107980
108030
  if (userContext.isAdmin)
107981
108031
  return true;
107982
- const row = this.db.prepare("SELECT created_by FROM connections WHERE id = ?").get(connectionId);
108032
+ const row = this.db.prepare("SELECT created_by, is_public FROM connections WHERE id = ?").get(connectionId);
107983
108033
  if (!row)
107984
108034
  return false;
107985
- return row.created_by === null || row.created_by === userContext.userId;
108035
+ return row.created_by === null || row.created_by === userContext.userId || row.is_public === 1;
107986
108036
  }
107987
108037
  /**
107988
108038
  * Find connections by server ID (filtered by user unless admin)
@@ -108001,13 +108051,25 @@ var ConnectionRepository = class {
108001
108051
  `;
108002
108052
  const params = [serverId];
108003
108053
  if (userContext && !userContext.isAdmin && userContext.userId) {
108004
- query += ` AND (c.created_by = ? OR c.created_by IS NULL)`;
108054
+ query += ` AND (c.created_by = ? OR c.created_by IS NULL OR c.is_public = 1)`;
108005
108055
  params.push(userContext.userId);
108006
108056
  }
108007
108057
  query += ` ORDER BY c.name`;
108008
108058
  const rows = this.db.prepare(query).all(...params);
108009
108059
  return rows.map((row) => this.rowToConnection(row));
108010
108060
  }
108061
+ /**
108062
+ * Check if user can modify (update/delete) a connection
108063
+ * Only owner or admin can modify
108064
+ */
108065
+ canModify(connectionId, userContext) {
108066
+ if (userContext.isAdmin)
108067
+ return true;
108068
+ const row = this.db.prepare("SELECT created_by FROM connections WHERE id = ?").get(connectionId);
108069
+ if (!row)
108070
+ return false;
108071
+ return row.created_by === null || row.created_by === userContext.userId;
108072
+ }
108011
108073
  };
108012
108074
 
108013
108075
  // packages/metadata/dist/repositories/query.repository.js
@@ -108034,7 +108096,7 @@ var QueryLogsRepository = class {
108034
108096
  let query = "SELECT * FROM saved_queries";
108035
108097
  const params = [];
108036
108098
  if (userContext && !userContext.isAdmin && userContext.userId) {
108037
- query += " WHERE created_by = ? OR created_by IS NULL";
108099
+ query += " WHERE (created_by = ? OR created_by IS NULL OR is_public = 1)";
108038
108100
  params.push(userContext.userId);
108039
108101
  }
108040
108102
  query += " ORDER BY name";
@@ -108051,7 +108113,7 @@ var QueryLogsRepository = class {
108051
108113
  query += "folder_id IS NULL";
108052
108114
  }
108053
108115
  if (userContext && !userContext.isAdmin && userContext.userId) {
108054
- query += " AND (created_by = ? OR created_by IS NULL)";
108116
+ query += " AND (created_by = ? OR created_by IS NULL OR is_public = 1)";
108055
108117
  params.push(userContext.userId);
108056
108118
  }
108057
108119
  query += " ORDER BY name";
@@ -108059,9 +108121,20 @@ var QueryLogsRepository = class {
108059
108121
  return rows.map((row) => this.rowToSavedQuery(row));
108060
108122
  }
108061
108123
  /**
108062
- * Check if user can access a saved query
108124
+ * Check if user can access (view) a saved query
108063
108125
  */
108064
108126
  canAccessSavedQuery(queryId, userContext) {
108127
+ if (userContext.isAdmin)
108128
+ return true;
108129
+ const row = this.db.prepare("SELECT created_by, is_public FROM saved_queries WHERE id = ?").get(queryId);
108130
+ if (!row)
108131
+ return false;
108132
+ return row.created_by === null || row.created_by === userContext.userId || row.is_public === 1;
108133
+ }
108134
+ /**
108135
+ * Check if user can modify (update/delete) a saved query
108136
+ */
108137
+ canModifySavedQuery(queryId, userContext) {
108065
108138
  if (userContext.isAdmin)
108066
108139
  return true;
108067
108140
  const row = this.db.prepare("SELECT created_by FROM saved_queries WHERE id = ?").get(queryId);
@@ -108088,6 +108161,10 @@ var QueryLogsRepository = class {
108088
108161
  updates.push("folder_id = ?");
108089
108162
  values.push(input.folderId);
108090
108163
  }
108164
+ if (input.isPublic !== void 0) {
108165
+ updates.push("is_public = ?");
108166
+ values.push(input.isPublic ? 1 : 0);
108167
+ }
108091
108168
  if (updates.length > 0) {
108092
108169
  updates.push("updated_at = ?");
108093
108170
  values.push((/* @__PURE__ */ new Date()).toISOString());
@@ -108156,7 +108233,8 @@ var QueryLogsRepository = class {
108156
108233
  folderId: row.folder_id ?? void 0,
108157
108234
  createdAt: new Date(row.created_at),
108158
108235
  updatedAt: new Date(row.updated_at),
108159
- createdBy: row.created_by ?? void 0
108236
+ createdBy: row.created_by ?? void 0,
108237
+ isPublic: row.is_public === 1
108160
108238
  };
108161
108239
  }
108162
108240
  rowToFolder(row) {
@@ -108334,7 +108412,7 @@ var ProjectRepository = class {
108334
108412
  let query = `SELECT * FROM projects`;
108335
108413
  const params = [];
108336
108414
  if (userContext && !userContext.isAdmin && userContext.userId) {
108337
- query += ` WHERE created_by = ? OR created_by IS NULL`;
108415
+ query += ` WHERE (created_by = ? OR created_by IS NULL OR is_public = 1)`;
108338
108416
  params.push(userContext.userId);
108339
108417
  }
108340
108418
  query += ` ORDER BY name`;
@@ -108342,9 +108420,20 @@ var ProjectRepository = class {
108342
108420
  return rows.map((row) => this.rowToProject(row));
108343
108421
  }
108344
108422
  /**
108345
- * Check if user can access a project
108423
+ * Check if user can access (view) a project
108346
108424
  */
108347
108425
  canAccess(projectId, userContext) {
108426
+ if (userContext.isAdmin)
108427
+ return true;
108428
+ const row = this.db.getDb().prepare("SELECT created_by, is_public FROM projects WHERE id = ?").get(projectId);
108429
+ if (!row)
108430
+ return false;
108431
+ return row.created_by === null || row.created_by === userContext.userId || row.is_public === 1;
108432
+ }
108433
+ /**
108434
+ * Check if user can modify (update/delete) a project
108435
+ */
108436
+ canModify(projectId, userContext) {
108348
108437
  if (userContext.isAdmin)
108349
108438
  return true;
108350
108439
  const row = this.db.getDb().prepare("SELECT created_by FROM projects WHERE id = ?").get(projectId);
@@ -108370,6 +108459,10 @@ var ProjectRepository = class {
108370
108459
  updates.push("color = ?");
108371
108460
  values.push(input.color);
108372
108461
  }
108462
+ if (input.isPublic !== void 0) {
108463
+ updates.push("is_public = ?");
108464
+ values.push(input.isPublic ? 1 : 0);
108465
+ }
108373
108466
  if (updates.length === 0) {
108374
108467
  return this.findById(id);
108375
108468
  }
@@ -108398,7 +108491,8 @@ var ProjectRepository = class {
108398
108491
  color: row.color || void 0,
108399
108492
  createdAt: new Date(row.created_at),
108400
108493
  updatedAt: new Date(row.updated_at),
108401
- createdBy: row.created_by || void 0
108494
+ createdBy: row.created_by || void 0,
108495
+ isPublic: row.is_public === 1
108402
108496
  };
108403
108497
  }
108404
108498
  };
@@ -108458,7 +108552,7 @@ var DatabaseGroupRepository = class {
108458
108552
  params.push(projectId);
108459
108553
  }
108460
108554
  if (userContext && !userContext.isAdmin && userContext.userId) {
108461
- conditions.push("(dg.created_by = ? OR dg.created_by IS NULL)");
108555
+ conditions.push("(dg.created_by = ? OR dg.created_by IS NULL OR dg.is_public = 1)");
108462
108556
  params.push(userContext.userId);
108463
108557
  }
108464
108558
  if (conditions.length > 0) {
@@ -108485,7 +108579,7 @@ var DatabaseGroupRepository = class {
108485
108579
  `;
108486
108580
  const params = [];
108487
108581
  if (userContext && !userContext.isAdmin && userContext.userId) {
108488
- query += ` AND (dg.created_by = ? OR dg.created_by IS NULL)`;
108582
+ query += ` AND (dg.created_by = ? OR dg.created_by IS NULL OR dg.is_public = 1)`;
108489
108583
  params.push(userContext.userId);
108490
108584
  }
108491
108585
  query += ` ORDER BY p.name, dg.name`;
@@ -108493,9 +108587,20 @@ var DatabaseGroupRepository = class {
108493
108587
  return rows.map((row) => this.rowToGroup(row));
108494
108588
  }
108495
108589
  /**
108496
- * Check if user can access a database group
108590
+ * Check if user can access (view) a database group
108497
108591
  */
108498
108592
  canAccess(groupId, userContext) {
108593
+ if (userContext.isAdmin)
108594
+ return true;
108595
+ const row = this.db.getDb().prepare("SELECT created_by, is_public FROM database_groups WHERE id = ?").get(groupId);
108596
+ if (!row)
108597
+ return false;
108598
+ return row.created_by === null || row.created_by === userContext.userId || row.is_public === 1;
108599
+ }
108600
+ /**
108601
+ * Check if user can modify (update/delete) a database group
108602
+ */
108603
+ canModify(groupId, userContext) {
108499
108604
  if (userContext.isAdmin)
108500
108605
  return true;
108501
108606
  const row = this.db.getDb().prepare("SELECT created_by FROM database_groups WHERE id = ?").get(groupId);
@@ -108533,6 +108638,10 @@ var DatabaseGroupRepository = class {
108533
108638
  updates.push("sync_target_schema = ?");
108534
108639
  values.push(input.syncTargetSchema);
108535
108640
  }
108641
+ if (input.isPublic !== void 0) {
108642
+ updates.push("is_public = ?");
108643
+ values.push(input.isPublic ? 1 : 0);
108644
+ }
108536
108645
  if (updates.length === 0) {
108537
108646
  return this.findById(id);
108538
108647
  }
@@ -108567,6 +108676,7 @@ var DatabaseGroupRepository = class {
108567
108676
  createdAt: new Date(row.created_at),
108568
108677
  updatedAt: new Date(row.updated_at),
108569
108678
  createdBy: row.created_by || void 0,
108679
+ isPublic: row.is_public === 1,
108570
108680
  projectName: row.project_name,
108571
108681
  sourceConnectionName: row.source_connection_name,
108572
108682
  connectionCount: row.connection_count
@@ -109439,6 +109549,7 @@ var ServerRepository = class {
109439
109549
  createdAt: new Date(row.created_at),
109440
109550
  updatedAt: new Date(row.updated_at),
109441
109551
  createdBy: row.created_by ?? void 0,
109552
+ isPublic: row.is_public === 1,
109442
109553
  databaseCount: row.database_count
109443
109554
  };
109444
109555
  }
@@ -109491,7 +109602,7 @@ var ServerRepository = class {
109491
109602
  `;
109492
109603
  const params = [];
109493
109604
  if (userContext && !userContext.isAdmin && userContext.userId) {
109494
- query += ` WHERE s.created_by = ? OR s.created_by IS NULL`;
109605
+ query += ` WHERE (s.created_by = ? OR s.created_by IS NULL OR s.is_public = 1)`;
109495
109606
  params.push(userContext.userId);
109496
109607
  }
109497
109608
  query += ` ORDER BY s.name`;
@@ -109510,7 +109621,7 @@ var ServerRepository = class {
109510
109621
  `;
109511
109622
  const params = [engine];
109512
109623
  if (userContext && !userContext.isAdmin && userContext.userId) {
109513
- query += ` AND (s.created_by = ? OR s.created_by IS NULL)`;
109624
+ query += ` AND (s.created_by = ? OR s.created_by IS NULL OR s.is_public = 1)`;
109514
109625
  params.push(userContext.userId);
109515
109626
  }
109516
109627
  query += ` ORDER BY s.name`;
@@ -109518,9 +109629,20 @@ var ServerRepository = class {
109518
109629
  return rows.map((row) => this.rowToServer(row));
109519
109630
  }
109520
109631
  /**
109521
- * Check if user can access a server
109632
+ * Check if user can access (view) a server
109522
109633
  */
109523
109634
  canAccess(serverId, userContext) {
109635
+ if (userContext.isAdmin)
109636
+ return true;
109637
+ const row = this.db.prepare("SELECT created_by, is_public FROM servers WHERE id = ?").get(serverId);
109638
+ if (!row)
109639
+ return false;
109640
+ return row.created_by === null || row.created_by === userContext.userId || row.is_public === 1;
109641
+ }
109642
+ /**
109643
+ * Check if user can modify (update/delete) a server
109644
+ */
109645
+ canModify(serverId, userContext) {
109524
109646
  if (userContext.isAdmin)
109525
109647
  return true;
109526
109648
  const row = this.db.prepare("SELECT created_by FROM servers WHERE id = ?").get(serverId);
@@ -109578,6 +109700,10 @@ var ServerRepository = class {
109578
109700
  updates.push("stop_command = ?");
109579
109701
  values.push(input.stopCommand || null);
109580
109702
  }
109703
+ if (input.isPublic !== void 0) {
109704
+ updates.push("is_public = ?");
109705
+ values.push(input.isPublic ? 1 : 0);
109706
+ }
109581
109707
  if (updates.length === 0) {
109582
109708
  return existing;
109583
109709
  }
@@ -109621,25 +109747,26 @@ var ServerRepository = class {
109621
109747
  }
109622
109748
  };
109623
109749
 
109624
- // packages/metadata/dist/repositories/settings.repository.js
109750
+ // packages/metadata/dist/repositories/user-preferences.repository.js
109625
109751
  var DEFAULT_TAGS = [
109626
109752
  { id: "production", name: "production", color: "239, 68, 68" },
109627
109753
  { id: "staging", name: "staging", color: "245, 158, 11" },
109628
109754
  { id: "development", name: "development", color: "16, 185, 129" },
109629
109755
  { id: "read-only", name: "read-only", color: "139, 92, 246" }
109630
109756
  ];
109631
- var SettingsRepository = class {
109757
+ var UserPreferencesRepository = class {
109632
109758
  db;
109633
109759
  constructor(db) {
109634
109760
  this.db = db;
109635
109761
  }
109636
109762
  /**
109637
- * Get a setting value by key
109763
+ * Get a preference value for a specific user
109638
109764
  */
109639
- get(key) {
109640
- const row = this.db.getDb().prepare("SELECT value FROM settings WHERE key = ?").get(key);
109641
- if (!row)
109642
- return null;
109765
+ get(userId, key) {
109766
+ const row = this.db.getDb().prepare("SELECT value FROM user_preferences WHERE user_id = ? AND key = ?").get(userId, key);
109767
+ if (!row) {
109768
+ return this.getSystemDefault(key);
109769
+ }
109643
109770
  try {
109644
109771
  return JSON.parse(row.value);
109645
109772
  } catch {
@@ -109647,52 +109774,91 @@ var SettingsRepository = class {
109647
109774
  }
109648
109775
  }
109649
109776
  /**
109650
- * Set a setting value
109777
+ * Set a preference value for a specific user
109651
109778
  */
109652
- set(key, value) {
109779
+ set(userId, key, value) {
109653
109780
  const jsonValue = typeof value === "string" ? value : JSON.stringify(value);
109781
+ const id = crypto.randomUUID();
109654
109782
  this.db.getDb().prepare(`
109655
- INSERT INTO settings (key, value, updated_at)
109656
- VALUES (?, ?, datetime('now'))
109657
- ON CONFLICT(key) DO UPDATE SET
109658
- value = excluded.value,
109659
- updated_at = datetime('now')
109660
- `).run(key, jsonValue);
109783
+ INSERT INTO user_preferences (id, user_id, key, value, updated_at)
109784
+ VALUES (?, ?, ?, ?, datetime('now'))
109785
+ ON CONFLICT(user_id, key) DO UPDATE SET
109786
+ value = excluded.value,
109787
+ updated_at = datetime('now')
109788
+ `).run(id, userId, key, jsonValue);
109661
109789
  }
109662
109790
  /**
109663
- * Delete a setting
109791
+ * Delete a preference for a specific user
109664
109792
  */
109665
- delete(key) {
109666
- const result = this.db.getDb().prepare("DELETE FROM settings WHERE key = ?").run(key);
109793
+ delete(userId, key) {
109794
+ const result = this.db.getDb().prepare("DELETE FROM user_preferences WHERE user_id = ? AND key = ?").run(userId, key);
109667
109795
  return result.changes > 0;
109668
109796
  }
109669
109797
  /**
109670
- * Get all settings
109798
+ * Get all preferences for a specific user
109799
+ */
109800
+ getAllForUser(userId) {
109801
+ const rows = this.db.getDb().prepare("SELECT key, value FROM user_preferences WHERE user_id = ?").all(userId);
109802
+ const preferences = {};
109803
+ const systemDefaults = this.getAllSystemDefaults();
109804
+ for (const [key, value] of Object.entries(systemDefaults)) {
109805
+ preferences[key] = value;
109806
+ }
109807
+ for (const row of rows) {
109808
+ try {
109809
+ preferences[row.key] = JSON.parse(row.value);
109810
+ } catch {
109811
+ preferences[row.key] = row.value;
109812
+ }
109813
+ }
109814
+ return preferences;
109815
+ }
109816
+ /**
109817
+ * Get a system default value (user_id = 'system')
109818
+ */
109819
+ getSystemDefault(key) {
109820
+ const row = this.db.getDb().prepare("SELECT value FROM user_preferences WHERE user_id = ? AND key = ?").get("system", key);
109821
+ if (!row)
109822
+ return null;
109823
+ try {
109824
+ return JSON.parse(row.value);
109825
+ } catch {
109826
+ return row.value;
109827
+ }
109828
+ }
109829
+ /**
109830
+ * Set a system default value
109671
109831
  */
109672
- getAll() {
109673
- const rows = this.db.getDb().prepare("SELECT key, value FROM settings").all();
109674
- const settings = {};
109832
+ setSystemDefault(key, value) {
109833
+ this.set("system", key, value);
109834
+ }
109835
+ /**
109836
+ * Get all system defaults
109837
+ */
109838
+ getAllSystemDefaults() {
109839
+ const rows = this.db.getDb().prepare("SELECT key, value FROM user_preferences WHERE user_id = ?").all("system");
109840
+ const defaults2 = {};
109675
109841
  for (const row of rows) {
109676
109842
  try {
109677
- settings[row.key] = JSON.parse(row.value);
109843
+ defaults2[row.key] = JSON.parse(row.value);
109678
109844
  } catch {
109679
- settings[row.key] = row.value;
109845
+ defaults2[row.key] = row.value;
109680
109846
  }
109681
109847
  }
109682
- return settings;
109848
+ return defaults2;
109683
109849
  }
109684
- // ============ Tag-specific methods ============
109850
+ // ============ Tag-specific methods (system-wide) ============
109685
109851
  /**
109686
- * Get all tags
109852
+ * Get all tags (system-wide)
109687
109853
  */
109688
109854
  getTags() {
109689
- return this.get("tags") || DEFAULT_TAGS;
109855
+ return this.getSystemDefault("tags") || DEFAULT_TAGS;
109690
109856
  }
109691
109857
  /**
109692
- * Set tags
109858
+ * Set tags (system-wide)
109693
109859
  */
109694
109860
  setTags(tags) {
109695
- this.set("tags", tags);
109861
+ this.setSystemDefault("tags", tags);
109696
109862
  }
109697
109863
  /**
109698
109864
  * Add a new tag
@@ -109960,7 +110126,7 @@ var MetadataService = MetadataService_1 = class MetadataService2 {
109960
110126
  _backupRepository;
109961
110127
  _backupLogsRepository;
109962
110128
  _serverRepository;
109963
- _settingsRepository;
110129
+ _userPreferencesRepository;
109964
110130
  _userRepository;
109965
110131
  onModuleInit() {
109966
110132
  let dbnexusDir;
@@ -109990,7 +110156,7 @@ var MetadataService = MetadataService_1 = class MetadataService2 {
109990
110156
  this._backupRepository = new BackupRepository(this.db.db);
109991
110157
  this._backupLogsRepository = new BackupLogsRepository(this.db.db);
109992
110158
  this._serverRepository = new ServerRepository(this.db);
109993
- this._settingsRepository = new SettingsRepository(this.db);
110159
+ this._userPreferencesRepository = new UserPreferencesRepository(this.db);
109994
110160
  this._userRepository = new UserRepository(this.db.db);
109995
110161
  this.logger.log(`\u{1F4E6} Metadata database initialized at ${dbPath}`);
109996
110162
  }
@@ -110030,8 +110196,8 @@ var MetadataService = MetadataService_1 = class MetadataService2 {
110030
110196
  get serverRepository() {
110031
110197
  return this._serverRepository;
110032
110198
  }
110033
- get settingsRepository() {
110034
- return this._settingsRepository;
110199
+ get userPreferencesRepository() {
110200
+ return this._userPreferencesRepository;
110035
110201
  }
110036
110202
  get userRepository() {
110037
110203
  return this._userRepository;
@@ -110076,7 +110242,7 @@ var PostgresConnector = class {
110076
110242
  port: this.config.port,
110077
110243
  database: this.config.database,
110078
110244
  user: this.config.username,
110079
- password: this.config.password,
110245
+ password: this.config.password ?? "",
110080
110246
  ssl: this.config.ssl ? { rejectUnauthorized: this.config.sslVerify ?? false } : false,
110081
110247
  connectionTimeoutMillis: 5e3,
110082
110248
  max: 1
@@ -110108,7 +110274,7 @@ var PostgresConnector = class {
110108
110274
  port: this.config.port,
110109
110275
  database: this.config.database,
110110
110276
  user: this.config.username,
110111
- password: this.config.password,
110277
+ password: this.config.password ?? "",
110112
110278
  ssl: this.config.ssl ? { rejectUnauthorized: this.config.sslVerify ?? false } : false,
110113
110279
  max: 10,
110114
110280
  idleTimeoutMillis: 3e4,
@@ -110755,7 +110921,7 @@ var MysqlConnector = class {
110755
110921
  port: this.config.port,
110756
110922
  database: this.config.database,
110757
110923
  user: this.config.username,
110758
- password: this.config.password,
110924
+ password: this.config.password ?? "",
110759
110925
  ssl: this.config.ssl ? { rejectUnauthorized: this.config.sslVerify ?? false } : void 0,
110760
110926
  connectTimeout: 5e3
110761
110927
  });
@@ -110784,7 +110950,7 @@ var MysqlConnector = class {
110784
110950
  port: this.config.port,
110785
110951
  database: this.config.database,
110786
110952
  user: this.config.username,
110787
- password: this.config.password,
110953
+ password: this.config.password ?? "",
110788
110954
  ssl: this.config.ssl ? { rejectUnauthorized: this.config.sslVerify ?? false } : void 0,
110789
110955
  waitForConnections: true,
110790
110956
  connectionLimit: 10,
@@ -111201,7 +111367,7 @@ var ConnectionsService = ConnectionsService_1 = class ConnectionsService2 {
111201
111367
  port: settings.port,
111202
111368
  database: settings.database,
111203
111369
  username: settings.username,
111204
- password: settings.password,
111370
+ password: settings.password ?? "",
111205
111371
  ssl: settings.ssl
111206
111372
  };
111207
111373
  if (settings.engine === "mysql") {
@@ -111253,6 +111419,13 @@ var ConnectionsService = ConnectionsService_1 = class ConnectionsService2 {
111253
111419
  const connector = this.connectors.get(id);
111254
111420
  return connector?.isConnected() ?? false;
111255
111421
  }
111422
+ /**
111423
+ * Get the decrypted password for a connection
111424
+ */
111425
+ getPassword(id) {
111426
+ this.findById(id);
111427
+ return this.metadataService.connectionRepository.getPassword(id);
111428
+ }
111256
111429
  /**
111257
111430
  * Create a connector instance
111258
111431
  */
@@ -111319,6 +111492,7 @@ var CreateConnectionDto = class {
111319
111492
  defaultSchema;
111320
111493
  readOnly;
111321
111494
  tags;
111495
+ isPublic;
111322
111496
  };
111323
111497
  __decorate4([
111324
111498
  (0, import_class_validator.IsString)(),
@@ -111358,8 +111532,8 @@ __decorate4([
111358
111532
  __metadata3("design:type", String)
111359
111533
  ], CreateConnectionDto.prototype, "username", void 0);
111360
111534
  __decorate4([
111535
+ (0, import_class_validator.IsOptional)(),
111361
111536
  (0, import_class_validator.IsString)(),
111362
- (0, import_class_validator.IsNotEmpty)({ message: "Password is required" }),
111363
111537
  __metadata3("design:type", String)
111364
111538
  ], CreateConnectionDto.prototype, "password", void 0);
111365
111539
  __decorate4([
@@ -111403,6 +111577,11 @@ __decorate4([
111403
111577
  (0, import_class_validator.IsString)({ each: true }),
111404
111578
  __metadata3("design:type", Array)
111405
111579
  ], CreateConnectionDto.prototype, "tags", void 0);
111580
+ __decorate4([
111581
+ (0, import_class_validator.IsOptional)(),
111582
+ (0, import_class_validator.IsBoolean)(),
111583
+ __metadata3("design:type", Boolean)
111584
+ ], CreateConnectionDto.prototype, "isPublic", void 0);
111406
111585
 
111407
111586
  // apps/api/dist/connections/dto/update-connection.dto.js
111408
111587
  var import_class_validator2 = __toESM(require_cjs(), 1);
@@ -111432,6 +111611,7 @@ var UpdateConnectionDto = class {
111432
111611
  defaultSchema;
111433
111612
  readOnly;
111434
111613
  tags;
111614
+ isPublic;
111435
111615
  };
111436
111616
  __decorate5([
111437
111617
  (0, import_class_validator2.IsOptional)(),
@@ -111519,6 +111699,11 @@ __decorate5([
111519
111699
  (0, import_class_validator2.IsString)({ each: true }),
111520
111700
  __metadata4("design:type", Array)
111521
111701
  ], UpdateConnectionDto.prototype, "tags", void 0);
111702
+ __decorate5([
111703
+ (0, import_class_validator2.IsOptional)(),
111704
+ (0, import_class_validator2.IsBoolean)(),
111705
+ __metadata4("design:type", Boolean)
111706
+ ], UpdateConnectionDto.prototype, "isPublic", void 0);
111522
111707
 
111523
111708
  // apps/api/dist/auth/decorators/current-user.decorator.js
111524
111709
  var import_common3 = __toESM(require_common(), 1);
@@ -111618,6 +111803,14 @@ var ConnectionsController = class ConnectionsController2 {
111618
111803
  const result = await this.connectionsService.test(id);
111619
111804
  return { connected: result?.success ?? false };
111620
111805
  }
111806
+ getPassword(id, user) {
111807
+ const userContext = this.getUserContext(user);
111808
+ if (!this.connectionsService.canAccess(id, userContext)) {
111809
+ throw new import_common4.ForbiddenException("Access denied to this connection");
111810
+ }
111811
+ const password = this.connectionsService.getPassword(id);
111812
+ return { password };
111813
+ }
111621
111814
  };
111622
111815
  __decorate6([
111623
111816
  (0, import_common4.Get)(),
@@ -111698,6 +111891,14 @@ __decorate6([
111698
111891
  __metadata5("design:paramtypes", [String, Object]),
111699
111892
  __metadata5("design:returntype", Promise)
111700
111893
  ], ConnectionsController.prototype, "getStatus", null);
111894
+ __decorate6([
111895
+ (0, import_common4.Get)(":id/password"),
111896
+ __param2(0, (0, import_common4.Param)("id")),
111897
+ __param2(1, CurrentUser()),
111898
+ __metadata5("design:type", Function),
111899
+ __metadata5("design:paramtypes", [String, Object]),
111900
+ __metadata5("design:returntype", Object)
111901
+ ], ConnectionsController.prototype, "getPassword", null);
111701
111902
  ConnectionsController = __decorate6([
111702
111903
  (0, import_common4.Controller)("connections"),
111703
111904
  __metadata5("design:paramtypes", [ConnectionsService])
@@ -111737,6 +111938,7 @@ var __decorate8 = function(decorators, target, key, desc) {
111737
111938
  var __metadata6 = function(k, v) {
111738
111939
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
111739
111940
  };
111941
+ var DEFAULT_ROW_LIMIT = 1e3;
111740
111942
  var QueriesService = class QueriesService2 {
111741
111943
  metadataService;
111742
111944
  connectionsService;
@@ -111756,7 +111958,7 @@ var QueriesService = class QueriesService2 {
111756
111958
  * Execute a query
111757
111959
  */
111758
111960
  async execute(input) {
111759
- const { connectionId, sql, confirmed } = input;
111961
+ const { connectionId, sql, confirmed, noLimit } = input;
111760
111962
  const connection = this.connectionsService.findById(connectionId);
111761
111963
  const validation = this.validator.validate(sql, connection.readOnly);
111762
111964
  if (!validation.isValid) {
@@ -111769,10 +111971,14 @@ var QueriesService = class QueriesService2 {
111769
111971
  dangerousType: validation.dangerousType
111770
111972
  });
111771
111973
  }
111974
+ const { query: finalSql, limitApplied } = this.applyDefaultLimit(sql, noLimit);
111772
111975
  const connector = await this.connectionsService.getConnector(connectionId);
111773
111976
  const startTime = Date.now();
111774
111977
  try {
111775
- const result = await connector.query(sql);
111978
+ const result = await connector.query(finalSql);
111979
+ if (limitApplied) {
111980
+ result.limitApplied = DEFAULT_ROW_LIMIT;
111981
+ }
111776
111982
  this.metadataService.queryLogsRepository.addHistoryEntry({
111777
111983
  connectionId,
111778
111984
  sql,
@@ -111796,6 +112002,26 @@ var QueriesService = class QueriesService2 {
111796
112002
  throw new import_common6.BadRequestException(errorMessage);
111797
112003
  }
111798
112004
  }
112005
+ /**
112006
+ * Apply default LIMIT to SELECT queries without one
112007
+ */
112008
+ applyDefaultLimit(sql, noLimit) {
112009
+ if (noLimit) {
112010
+ return { query: sql, limitApplied: false };
112011
+ }
112012
+ const trimmed = sql.trim();
112013
+ const upper = trimmed.toUpperCase();
112014
+ if (!upper.startsWith("SELECT")) {
112015
+ return { query: sql, limitApplied: false };
112016
+ }
112017
+ if (/\bLIMIT\s+\d+/i.test(trimmed)) {
112018
+ return { query: sql, limitApplied: false };
112019
+ }
112020
+ const endsWithSemicolon = trimmed.endsWith(";");
112021
+ const queryWithoutSemicolon = endsWithSemicolon ? trimmed.slice(0, -1) : trimmed;
112022
+ const limitedQuery = `${queryWithoutSemicolon} LIMIT ${DEFAULT_ROW_LIMIT}${endsWithSemicolon ? ";" : ""}`;
112023
+ return { query: limitedQuery, limitApplied: true };
112024
+ }
111799
112025
  /**
111800
112026
  * Execute maintenance operation with detailed output
111801
112027
  */
@@ -112370,6 +112596,7 @@ var ExecuteQueryDto = class {
112370
112596
  connectionId;
112371
112597
  sql;
112372
112598
  confirmed;
112599
+ noLimit;
112373
112600
  };
112374
112601
  __decorate9([
112375
112602
  (0, import_class_validator3.IsString)(),
@@ -112386,6 +112613,11 @@ __decorate9([
112386
112613
  (0, import_class_validator3.IsBoolean)(),
112387
112614
  __metadata7("design:type", Boolean)
112388
112615
  ], ExecuteQueryDto.prototype, "confirmed", void 0);
112616
+ __decorate9([
112617
+ (0, import_class_validator3.IsOptional)(),
112618
+ (0, import_class_validator3.IsBoolean)(),
112619
+ __metadata7("design:type", Boolean)
112620
+ ], ExecuteQueryDto.prototype, "noLimit", void 0);
112389
112621
 
112390
112622
  // apps/api/dist/queries/dto/maintenance.dto.js
112391
112623
  var import_class_validator4 = __toESM(require_cjs(), 1);
@@ -113372,7 +113604,7 @@ var SchemaDiffService = SchemaDiffService_1 = class SchemaDiffService2 {
113372
113604
  /**
113373
113605
  * Get all migration SQL from a diff
113374
113606
  */
113375
- getMigrationSql(diff) {
113607
+ getMigrationSql(diff, tables) {
113376
113608
  const sql = [];
113377
113609
  const orderedTypes = [
113378
113610
  "fk_removed",
@@ -113389,6 +113621,9 @@ var SchemaDiffService = SchemaDiffService_1 = class SchemaDiffService2 {
113389
113621
  ];
113390
113622
  for (const type of orderedTypes) {
113391
113623
  for (const item of diff.items.filter((i) => i.type === type)) {
113624
+ if (tables && tables.length > 0 && item.table && !tables.includes(item.table)) {
113625
+ continue;
113626
+ }
113392
113627
  if (item.migrationSql) {
113393
113628
  sql.push(...item.migrationSql);
113394
113629
  }
@@ -113427,12 +113662,19 @@ __decorate18([
113427
113662
  ], CreateSchemaDto.prototype, "name", void 0);
113428
113663
  var ApplyMigrationDto = class {
113429
113664
  description;
113665
+ tables;
113430
113666
  };
113431
113667
  __decorate18([
113432
113668
  (0, import_class_validator8.IsOptional)(),
113433
113669
  (0, import_class_validator8.IsString)(),
113434
113670
  __metadata15("design:type", String)
113435
113671
  ], ApplyMigrationDto.prototype, "description", void 0);
113672
+ __decorate18([
113673
+ (0, import_class_validator8.IsOptional)(),
113674
+ (0, import_class_validator8.IsArray)(),
113675
+ (0, import_class_validator8.IsString)({ each: true }),
113676
+ __metadata15("design:type", Array)
113677
+ ], ApplyMigrationDto.prototype, "tables", void 0);
113436
113678
 
113437
113679
  // apps/api/dist/schema/schema.controller.js
113438
113680
  var __decorate19 = function(decorators, target, key, desc) {
@@ -113498,7 +113740,7 @@ var SchemaController = class SchemaController2 {
113498
113740
  const srcSchema = sourceSchema || "public";
113499
113741
  const tgtSchema = targetSchema || "public";
113500
113742
  const diff = await this.schemaDiffService.compareSchemas(sourceConnectionId, targetConnectionId, srcSchema, tgtSchema);
113501
- const sqlStatements = this.schemaDiffService.getMigrationSql(diff);
113743
+ const sqlStatements = this.schemaDiffService.getMigrationSql(diff, body?.tables);
113502
113744
  if (sqlStatements.length === 0) {
113503
113745
  throw new Error("No migration statements to apply - schemas are already in sync");
113504
113746
  }
@@ -113696,10 +113938,10 @@ SchemaModule = __decorate21([
113696
113938
  ], SchemaModule);
113697
113939
 
113698
113940
  // apps/api/dist/projects/projects.module.js
113699
- var import_common15 = __toESM(require_common(), 1);
113941
+ var import_common17 = __toESM(require_common(), 1);
113700
113942
 
113701
113943
  // apps/api/dist/projects/projects.controller.js
113702
- var import_common14 = __toESM(require_common(), 1);
113944
+ var import_common16 = __toESM(require_common(), 1);
113703
113945
 
113704
113946
  // apps/api/dist/projects/dto/project.dto.js
113705
113947
  var import_class_validator9 = __toESM(require_cjs(), 1);
@@ -113736,6 +113978,7 @@ var UpdateProjectDto = class {
113736
113978
  name;
113737
113979
  description;
113738
113980
  color;
113981
+ isPublic;
113739
113982
  };
113740
113983
  __decorate22([
113741
113984
  (0, import_class_validator9.IsOptional)(),
@@ -113753,6 +113996,11 @@ __decorate22([
113753
113996
  (0, import_class_validator9.IsString)(),
113754
113997
  __metadata17("design:type", String)
113755
113998
  ], UpdateProjectDto.prototype, "color", void 0);
113999
+ __decorate22([
114000
+ (0, import_class_validator9.IsOptional)(),
114001
+ (0, import_class_validator9.IsBoolean)(),
114002
+ __metadata17("design:type", Boolean)
114003
+ ], UpdateProjectDto.prototype, "isPublic", void 0);
113756
114004
 
113757
114005
  // apps/api/dist/projects/dto/database-group.dto.js
113758
114006
  var import_class_validator10 = __toESM(require_cjs(), 1);
@@ -113814,6 +114062,7 @@ var UpdateDatabaseGroupDto = class {
113814
114062
  syncSchema;
113815
114063
  syncData;
113816
114064
  syncTargetSchema;
114065
+ isPublic;
113817
114066
  };
113818
114067
  __decorate23([
113819
114068
  (0, import_class_validator10.IsOptional)(),
@@ -113863,6 +114112,21 @@ __decorate23([
113863
114112
  (0, import_class_validator10.IsString)(),
113864
114113
  __metadata18("design:type", Object)
113865
114114
  ], UpdateDatabaseGroupDto.prototype, "syncTargetSchema", void 0);
114115
+ __decorate23([
114116
+ (0, import_class_validator10.IsOptional)(),
114117
+ (0, import_class_validator10.IsBoolean)(),
114118
+ __metadata18("design:type", Boolean)
114119
+ ], UpdateDatabaseGroupDto.prototype, "isPublic", void 0);
114120
+
114121
+ // apps/api/dist/auth/decorators/roles.decorator.js
114122
+ var import_common14 = __toESM(require_common(), 1);
114123
+ var ROLES_KEY = "roles";
114124
+ var Roles = (...roles) => (0, import_common14.SetMetadata)(ROLES_KEY, roles);
114125
+
114126
+ // apps/api/dist/auth/decorators/public.decorator.js
114127
+ var import_common15 = __toESM(require_common(), 1);
114128
+ var IS_PUBLIC_KEY = "isPublic";
114129
+ var Public = () => (0, import_common15.SetMetadata)(IS_PUBLIC_KEY, true);
113866
114130
 
113867
114131
  // apps/api/dist/projects/projects.controller.js
113868
114132
  var __decorate24 = function(decorators, target, key, desc) {
@@ -113885,14 +114149,18 @@ var ProjectsController = class ProjectsController2 {
113885
114149
  this.metadataService = metadataService;
113886
114150
  }
113887
114151
  // ============ Projects ============
113888
- getProjects() {
113889
- return this.metadataService.projectRepository.findAll();
114152
+ getProjects(user) {
114153
+ const userContext = {
114154
+ userId: user?.id ?? null,
114155
+ isAdmin: user?.role === "admin"
114156
+ };
114157
+ return this.metadataService.projectRepository.findAll(userContext);
113890
114158
  }
113891
114159
  getProject(id) {
113892
114160
  return this.metadataService.projectRepository.findById(id);
113893
114161
  }
113894
- createProject(input) {
113895
- const project = this.metadataService.projectRepository.create(input);
114162
+ createProject(input, user) {
114163
+ const project = this.metadataService.projectRepository.create(input, user?.id);
113896
114164
  this.metadataService.auditLogRepository.create({
113897
114165
  action: "project_created",
113898
114166
  entityType: "project",
@@ -113904,7 +114172,14 @@ var ProjectsController = class ProjectsController2 {
113904
114172
  });
113905
114173
  return project;
113906
114174
  }
113907
- updateProject(id, input) {
114175
+ updateProject(id, input, user) {
114176
+ const userContext = {
114177
+ userId: user?.id ?? null,
114178
+ isAdmin: user?.role === "admin"
114179
+ };
114180
+ if (!this.metadataService.projectRepository.canModify(id, userContext)) {
114181
+ throw new import_common16.ForbiddenException("You do not have permission to modify this project");
114182
+ }
113908
114183
  const project = this.metadataService.projectRepository.update(id, input);
113909
114184
  if (project) {
113910
114185
  this.metadataService.auditLogRepository.create({
@@ -113919,7 +114194,14 @@ var ProjectsController = class ProjectsController2 {
113919
114194
  }
113920
114195
  return project;
113921
114196
  }
113922
- deleteProject(id) {
114197
+ deleteProject(id, user) {
114198
+ const userContext = {
114199
+ userId: user?.id ?? null,
114200
+ isAdmin: user?.role === "admin"
114201
+ };
114202
+ if (!this.metadataService.projectRepository.canModify(id, userContext)) {
114203
+ throw new import_common16.ForbiddenException("You do not have permission to delete this project");
114204
+ }
113923
114205
  const project = this.metadataService.projectRepository.findById(id);
113924
114206
  const success = this.metadataService.projectRepository.delete(id);
113925
114207
  if (success && project) {
@@ -113935,17 +114217,21 @@ var ProjectsController = class ProjectsController2 {
113935
114217
  return { success };
113936
114218
  }
113937
114219
  // ============ Database Groups ============
113938
- getGroups(projectId) {
113939
- return this.metadataService.databaseGroupRepository.findAll(projectId);
114220
+ getGroups(projectId, user) {
114221
+ const userContext = {
114222
+ userId: user?.id ?? null,
114223
+ isAdmin: user?.role === "admin"
114224
+ };
114225
+ return this.metadataService.databaseGroupRepository.findAll(projectId, userContext);
113940
114226
  }
113941
114227
  getGroup(_projectId, groupId) {
113942
114228
  return this.metadataService.databaseGroupRepository.findById(groupId);
113943
114229
  }
113944
- createGroup(projectId, input) {
114230
+ createGroup(projectId, input, user) {
113945
114231
  const group = this.metadataService.databaseGroupRepository.create({
113946
114232
  ...input,
113947
114233
  projectId
113948
- });
114234
+ }, user?.id);
113949
114235
  this.metadataService.auditLogRepository.create({
113950
114236
  action: "database_group_created",
113951
114237
  entityType: "database_group",
@@ -113957,7 +114243,14 @@ var ProjectsController = class ProjectsController2 {
113957
114243
  });
113958
114244
  return group;
113959
114245
  }
113960
- updateGroup(_projectId, groupId, input) {
114246
+ updateGroup(_projectId, groupId, input, user) {
114247
+ const userContext = {
114248
+ userId: user?.id ?? null,
114249
+ isAdmin: user?.role === "admin"
114250
+ };
114251
+ if (!this.metadataService.databaseGroupRepository.canModify(groupId, userContext)) {
114252
+ throw new import_common16.ForbiddenException("You do not have permission to modify this group");
114253
+ }
113961
114254
  const group = this.metadataService.databaseGroupRepository.update(groupId, input);
113962
114255
  if (group) {
113963
114256
  this.metadataService.auditLogRepository.create({
@@ -113972,7 +114265,14 @@ var ProjectsController = class ProjectsController2 {
113972
114265
  }
113973
114266
  return group;
113974
114267
  }
113975
- deleteGroup(_projectId, groupId) {
114268
+ deleteGroup(_projectId, groupId, user) {
114269
+ const userContext = {
114270
+ userId: user?.id ?? null,
114271
+ isAdmin: user?.role === "admin"
114272
+ };
114273
+ if (!this.metadataService.databaseGroupRepository.canModify(groupId, userContext)) {
114274
+ throw new import_common16.ForbiddenException("You do not have permission to delete this group");
114275
+ }
113976
114276
  const group = this.metadataService.databaseGroupRepository.findById(groupId);
113977
114277
  const success = this.metadataService.databaseGroupRepository.delete(groupId);
113978
114278
  if (success && group) {
@@ -113988,105 +114288,123 @@ var ProjectsController = class ProjectsController2 {
113988
114288
  return { success };
113989
114289
  }
113990
114290
  // ============ Connections in Project/Group ============
113991
- getProjectConnections(projectId) {
113992
- return this.metadataService.connectionRepository.findByProject(projectId);
114291
+ getProjectConnections(projectId, user) {
114292
+ const userContext = {
114293
+ userId: user?.id ?? null,
114294
+ isAdmin: user?.role === "admin"
114295
+ };
114296
+ return this.metadataService.connectionRepository.findByProject(projectId, userContext);
113993
114297
  }
113994
- getGroupConnections(_projectId, groupId) {
113995
- return this.metadataService.connectionRepository.findByGroup(groupId);
114298
+ getGroupConnections(_projectId, groupId, user) {
114299
+ const userContext = {
114300
+ userId: user?.id ?? null,
114301
+ isAdmin: user?.role === "admin"
114302
+ };
114303
+ return this.metadataService.connectionRepository.findByGroup(groupId, userContext);
113996
114304
  }
113997
114305
  };
113998
114306
  __decorate24([
113999
- (0, import_common14.Get)(),
114307
+ (0, import_common16.Get)(),
114308
+ __param5(0, CurrentUser()),
114000
114309
  __metadata19("design:type", Function),
114001
- __metadata19("design:paramtypes", []),
114310
+ __metadata19("design:paramtypes", [Object]),
114002
114311
  __metadata19("design:returntype", Array)
114003
114312
  ], ProjectsController.prototype, "getProjects", null);
114004
114313
  __decorate24([
114005
- (0, import_common14.Get)(":id"),
114006
- __param5(0, (0, import_common14.Param)("id")),
114314
+ (0, import_common16.Get)(":id"),
114315
+ __param5(0, (0, import_common16.Param)("id")),
114007
114316
  __metadata19("design:type", Function),
114008
114317
  __metadata19("design:paramtypes", [String]),
114009
114318
  __metadata19("design:returntype", Object)
114010
114319
  ], ProjectsController.prototype, "getProject", null);
114011
114320
  __decorate24([
114012
- (0, import_common14.Post)(),
114013
- __param5(0, (0, import_common14.Body)()),
114321
+ (0, import_common16.Post)(),
114322
+ __param5(0, (0, import_common16.Body)()),
114323
+ __param5(1, CurrentUser()),
114014
114324
  __metadata19("design:type", Function),
114015
- __metadata19("design:paramtypes", [CreateProjectDto]),
114325
+ __metadata19("design:paramtypes", [CreateProjectDto, Object]),
114016
114326
  __metadata19("design:returntype", Object)
114017
114327
  ], ProjectsController.prototype, "createProject", null);
114018
114328
  __decorate24([
114019
- (0, import_common14.Put)(":id"),
114020
- __param5(0, (0, import_common14.Param)("id")),
114021
- __param5(1, (0, import_common14.Body)()),
114329
+ (0, import_common16.Put)(":id"),
114330
+ __param5(0, (0, import_common16.Param)("id")),
114331
+ __param5(1, (0, import_common16.Body)()),
114332
+ __param5(2, CurrentUser()),
114022
114333
  __metadata19("design:type", Function),
114023
- __metadata19("design:paramtypes", [String, UpdateProjectDto]),
114334
+ __metadata19("design:paramtypes", [String, UpdateProjectDto, Object]),
114024
114335
  __metadata19("design:returntype", Object)
114025
114336
  ], ProjectsController.prototype, "updateProject", null);
114026
114337
  __decorate24([
114027
- (0, import_common14.Delete)(":id"),
114028
- __param5(0, (0, import_common14.Param)("id")),
114338
+ (0, import_common16.Delete)(":id"),
114339
+ __param5(0, (0, import_common16.Param)("id")),
114340
+ __param5(1, CurrentUser()),
114029
114341
  __metadata19("design:type", Function),
114030
- __metadata19("design:paramtypes", [String]),
114342
+ __metadata19("design:paramtypes", [String, Object]),
114031
114343
  __metadata19("design:returntype", Object)
114032
114344
  ], ProjectsController.prototype, "deleteProject", null);
114033
114345
  __decorate24([
114034
- (0, import_common14.Get)(":projectId/groups"),
114035
- __param5(0, (0, import_common14.Param)("projectId")),
114346
+ (0, import_common16.Get)(":projectId/groups"),
114347
+ __param5(0, (0, import_common16.Param)("projectId")),
114348
+ __param5(1, CurrentUser()),
114036
114349
  __metadata19("design:type", Function),
114037
- __metadata19("design:paramtypes", [String]),
114350
+ __metadata19("design:paramtypes", [String, Object]),
114038
114351
  __metadata19("design:returntype", Array)
114039
114352
  ], ProjectsController.prototype, "getGroups", null);
114040
114353
  __decorate24([
114041
- (0, import_common14.Get)(":projectId/groups/:groupId"),
114042
- __param5(0, (0, import_common14.Param)("projectId")),
114043
- __param5(1, (0, import_common14.Param)("groupId")),
114354
+ (0, import_common16.Get)(":projectId/groups/:groupId"),
114355
+ __param5(0, (0, import_common16.Param)("projectId")),
114356
+ __param5(1, (0, import_common16.Param)("groupId")),
114044
114357
  __metadata19("design:type", Function),
114045
114358
  __metadata19("design:paramtypes", [String, String]),
114046
114359
  __metadata19("design:returntype", Object)
114047
114360
  ], ProjectsController.prototype, "getGroup", null);
114048
114361
  __decorate24([
114049
- (0, import_common14.Post)(":projectId/groups"),
114050
- __param5(0, (0, import_common14.Param)("projectId")),
114051
- __param5(1, (0, import_common14.Body)()),
114362
+ (0, import_common16.Post)(":projectId/groups"),
114363
+ __param5(0, (0, import_common16.Param)("projectId")),
114364
+ __param5(1, (0, import_common16.Body)()),
114365
+ __param5(2, CurrentUser()),
114052
114366
  __metadata19("design:type", Function),
114053
- __metadata19("design:paramtypes", [String, CreateDatabaseGroupDto]),
114367
+ __metadata19("design:paramtypes", [String, CreateDatabaseGroupDto, Object]),
114054
114368
  __metadata19("design:returntype", Object)
114055
114369
  ], ProjectsController.prototype, "createGroup", null);
114056
114370
  __decorate24([
114057
- (0, import_common14.Put)(":projectId/groups/:groupId"),
114058
- __param5(0, (0, import_common14.Param)("projectId")),
114059
- __param5(1, (0, import_common14.Param)("groupId")),
114060
- __param5(2, (0, import_common14.Body)()),
114371
+ (0, import_common16.Put)(":projectId/groups/:groupId"),
114372
+ __param5(0, (0, import_common16.Param)("projectId")),
114373
+ __param5(1, (0, import_common16.Param)("groupId")),
114374
+ __param5(2, (0, import_common16.Body)()),
114375
+ __param5(3, CurrentUser()),
114061
114376
  __metadata19("design:type", Function),
114062
- __metadata19("design:paramtypes", [String, String, UpdateDatabaseGroupDto]),
114377
+ __metadata19("design:paramtypes", [String, String, UpdateDatabaseGroupDto, Object]),
114063
114378
  __metadata19("design:returntype", Object)
114064
114379
  ], ProjectsController.prototype, "updateGroup", null);
114065
114380
  __decorate24([
114066
- (0, import_common14.Delete)(":projectId/groups/:groupId"),
114067
- __param5(0, (0, import_common14.Param)("projectId")),
114068
- __param5(1, (0, import_common14.Param)("groupId")),
114381
+ (0, import_common16.Delete)(":projectId/groups/:groupId"),
114382
+ __param5(0, (0, import_common16.Param)("projectId")),
114383
+ __param5(1, (0, import_common16.Param)("groupId")),
114384
+ __param5(2, CurrentUser()),
114069
114385
  __metadata19("design:type", Function),
114070
- __metadata19("design:paramtypes", [String, String]),
114386
+ __metadata19("design:paramtypes", [String, String, Object]),
114071
114387
  __metadata19("design:returntype", Object)
114072
114388
  ], ProjectsController.prototype, "deleteGroup", null);
114073
114389
  __decorate24([
114074
- (0, import_common14.Get)(":projectId/connections"),
114075
- __param5(0, (0, import_common14.Param)("projectId")),
114390
+ (0, import_common16.Get)(":projectId/connections"),
114391
+ __param5(0, (0, import_common16.Param)("projectId")),
114392
+ __param5(1, CurrentUser()),
114076
114393
  __metadata19("design:type", Function),
114077
- __metadata19("design:paramtypes", [String]),
114394
+ __metadata19("design:paramtypes", [String, Object]),
114078
114395
  __metadata19("design:returntype", Array)
114079
114396
  ], ProjectsController.prototype, "getProjectConnections", null);
114080
114397
  __decorate24([
114081
- (0, import_common14.Get)(":projectId/groups/:groupId/connections"),
114082
- __param5(0, (0, import_common14.Param)("projectId")),
114083
- __param5(1, (0, import_common14.Param)("groupId")),
114398
+ (0, import_common16.Get)(":projectId/groups/:groupId/connections"),
114399
+ __param5(0, (0, import_common16.Param)("projectId")),
114400
+ __param5(1, (0, import_common16.Param)("groupId")),
114401
+ __param5(2, CurrentUser()),
114084
114402
  __metadata19("design:type", Function),
114085
- __metadata19("design:paramtypes", [String, String]),
114403
+ __metadata19("design:paramtypes", [String, String, Object]),
114086
114404
  __metadata19("design:returntype", Array)
114087
114405
  ], ProjectsController.prototype, "getGroupConnections", null);
114088
114406
  ProjectsController = __decorate24([
114089
- (0, import_common14.Controller)("projects"),
114407
+ (0, import_common16.Controller)("projects"),
114090
114408
  __metadata19("design:paramtypes", [MetadataService])
114091
114409
  ], ProjectsController);
114092
114410
  var GroupsController = class GroupsController2 {
@@ -114094,39 +114412,49 @@ var GroupsController = class GroupsController2 {
114094
114412
  constructor(metadataService) {
114095
114413
  this.metadataService = metadataService;
114096
114414
  }
114097
- getAllGroups(projectId) {
114098
- return this.metadataService.databaseGroupRepository.findAll(projectId);
114415
+ getAllGroups(projectId, user) {
114416
+ const userContext = {
114417
+ userId: user?.id ?? null,
114418
+ isAdmin: user?.role === "admin"
114419
+ };
114420
+ return this.metadataService.databaseGroupRepository.findAll(projectId, userContext);
114099
114421
  }
114100
114422
  getGroup(id) {
114101
114423
  return this.metadataService.databaseGroupRepository.findById(id);
114102
114424
  }
114103
- getGroupConnections(groupId) {
114104
- return this.metadataService.connectionRepository.findByGroup(groupId);
114425
+ getGroupConnections(groupId, user) {
114426
+ const userContext = {
114427
+ userId: user?.id ?? null,
114428
+ isAdmin: user?.role === "admin"
114429
+ };
114430
+ return this.metadataService.connectionRepository.findByGroup(groupId, userContext);
114105
114431
  }
114106
114432
  };
114107
114433
  __decorate24([
114108
- (0, import_common14.Get)(),
114109
- __param5(0, (0, import_common14.Query)("projectId")),
114434
+ (0, import_common16.Get)(),
114435
+ __param5(0, (0, import_common16.Query)("projectId")),
114436
+ __param5(1, CurrentUser()),
114110
114437
  __metadata19("design:type", Function),
114111
- __metadata19("design:paramtypes", [String]),
114438
+ __metadata19("design:paramtypes", [String, Object]),
114112
114439
  __metadata19("design:returntype", Array)
114113
114440
  ], GroupsController.prototype, "getAllGroups", null);
114114
114441
  __decorate24([
114115
- (0, import_common14.Get)(":id"),
114116
- __param5(0, (0, import_common14.Param)("id")),
114442
+ (0, import_common16.Get)(":id"),
114443
+ __param5(0, (0, import_common16.Param)("id")),
114117
114444
  __metadata19("design:type", Function),
114118
114445
  __metadata19("design:paramtypes", [String]),
114119
114446
  __metadata19("design:returntype", Object)
114120
114447
  ], GroupsController.prototype, "getGroup", null);
114121
114448
  __decorate24([
114122
- (0, import_common14.Get)(":id/connections"),
114123
- __param5(0, (0, import_common14.Param)("id")),
114449
+ (0, import_common16.Get)(":id/connections"),
114450
+ __param5(0, (0, import_common16.Param)("id")),
114451
+ __param5(1, CurrentUser()),
114124
114452
  __metadata19("design:type", Function),
114125
- __metadata19("design:paramtypes", [String]),
114453
+ __metadata19("design:paramtypes", [String, Object]),
114126
114454
  __metadata19("design:returntype", Array)
114127
114455
  ], GroupsController.prototype, "getGroupConnections", null);
114128
114456
  GroupsController = __decorate24([
114129
- (0, import_common14.Controller)("groups"),
114457
+ (0, import_common16.Controller)("groups"),
114130
114458
  __metadata19("design:paramtypes", [MetadataService])
114131
114459
  ], GroupsController);
114132
114460
 
@@ -114140,20 +114468,20 @@ var __decorate25 = function(decorators, target, key, desc) {
114140
114468
  var ProjectsModule = class ProjectsModule2 {
114141
114469
  };
114142
114470
  ProjectsModule = __decorate25([
114143
- (0, import_common15.Module)({
114471
+ (0, import_common17.Module)({
114144
114472
  imports: [MetadataModule],
114145
114473
  controllers: [ProjectsController, GroupsController]
114146
114474
  })
114147
114475
  ], ProjectsModule);
114148
114476
 
114149
114477
  // apps/api/dist/sync/sync.module.js
114150
- var import_common18 = __toESM(require_common(), 1);
114478
+ var import_common20 = __toESM(require_common(), 1);
114151
114479
 
114152
114480
  // apps/api/dist/sync/sync.controller.js
114153
- var import_common17 = __toESM(require_common(), 1);
114481
+ var import_common19 = __toESM(require_common(), 1);
114154
114482
 
114155
114483
  // apps/api/dist/sync/sync.service.js
114156
- var import_common16 = __toESM(require_common(), 1);
114484
+ var import_common18 = __toESM(require_common(), 1);
114157
114485
  var __decorate26 = function(decorators, target, key, desc) {
114158
114486
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
114159
114487
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -114250,7 +114578,7 @@ var SyncService = SyncService_1 = class SyncService2 {
114250
114578
  metadataService;
114251
114579
  connectionsService;
114252
114580
  schemaDiffService;
114253
- logger = new import_common16.Logger(SyncService_1.name);
114581
+ logger = new import_common18.Logger(SyncService_1.name);
114254
114582
  constructor(metadataService, connectionsService, schemaDiffService) {
114255
114583
  this.metadataService = metadataService;
114256
114584
  this.connectionsService = connectionsService;
@@ -114850,7 +115178,7 @@ var SyncService = SyncService_1 = class SyncService2 {
114850
115178
  }
114851
115179
  };
114852
115180
  SyncService = SyncService_1 = __decorate26([
114853
- (0, import_common16.Injectable)(),
115181
+ (0, import_common18.Injectable)(),
114854
115182
  __metadata20("design:paramtypes", [
114855
115183
  MetadataService,
114856
115184
  ConnectionsService,
@@ -115081,7 +115409,7 @@ var SyncController = class SyncController2 {
115081
115409
  async syncAllTables(groupId, targetConnectionId, schema = "public", body) {
115082
115410
  const status = await this.syncService.getGroupSyncStatus(groupId);
115083
115411
  if (!status?.sourceConnectionId) {
115084
- throw new import_common17.NotFoundException("Group not found or no source connection set");
115412
+ throw new import_common19.NotFoundException("Group not found or no source connection set");
115085
115413
  }
115086
115414
  const tableDiffs = await this.syncService.getTableRowCounts(status.sourceConnectionId, targetConnectionId, schema);
115087
115415
  const results = [];
@@ -115126,96 +115454,96 @@ var SyncController = class SyncController2 {
115126
115454
  }
115127
115455
  };
115128
115456
  __decorate31([
115129
- (0, import_common17.Get)("runs"),
115130
- __param6(0, (0, import_common17.Query)("limit")),
115457
+ (0, import_common19.Get)("runs"),
115458
+ __param6(0, (0, import_common19.Query)("limit")),
115131
115459
  __metadata25("design:type", Function),
115132
115460
  __metadata25("design:paramtypes", [String]),
115133
115461
  __metadata25("design:returntype", void 0)
115134
115462
  ], SyncController.prototype, "getSyncRuns", null);
115135
115463
  __decorate31([
115136
- (0, import_common17.Get)("groups/:groupId/status"),
115137
- __param6(0, (0, import_common17.Param)("groupId")),
115464
+ (0, import_common19.Get)("groups/:groupId/status"),
115465
+ __param6(0, (0, import_common19.Param)("groupId")),
115138
115466
  __metadata25("design:type", Function),
115139
115467
  __metadata25("design:paramtypes", [String]),
115140
115468
  __metadata25("design:returntype", Promise)
115141
115469
  ], SyncController.prototype, "getGroupSyncStatus", null);
115142
115470
  __decorate31([
115143
- (0, import_common17.Get)("groups/:groupId/status/:targetConnectionId"),
115144
- __param6(0, (0, import_common17.Param)("groupId")),
115145
- __param6(1, (0, import_common17.Param)("targetConnectionId")),
115471
+ (0, import_common19.Get)("groups/:groupId/status/:targetConnectionId"),
115472
+ __param6(0, (0, import_common19.Param)("groupId")),
115473
+ __param6(1, (0, import_common19.Param)("targetConnectionId")),
115146
115474
  __metadata25("design:type", Function),
115147
115475
  __metadata25("design:paramtypes", [String, String]),
115148
115476
  __metadata25("design:returntype", Promise)
115149
115477
  ], SyncController.prototype, "checkSingleTargetStatus", null);
115150
115478
  __decorate31([
115151
- (0, import_common17.Get)("groups"),
115479
+ (0, import_common19.Get)("groups"),
115152
115480
  __metadata25("design:type", Function),
115153
115481
  __metadata25("design:paramtypes", []),
115154
115482
  __metadata25("design:returntype", void 0)
115155
115483
  ], SyncController.prototype, "getSyncEnabledGroups", null);
115156
115484
  __decorate31([
115157
- (0, import_common17.Get)("data/:sourceConnectionId/:targetConnectionId/counts"),
115158
- __param6(0, (0, import_common17.Param)("sourceConnectionId")),
115159
- __param6(1, (0, import_common17.Param)("targetConnectionId")),
115160
- __param6(2, (0, import_common17.Query)("schema")),
115485
+ (0, import_common19.Get)("data/:sourceConnectionId/:targetConnectionId/counts"),
115486
+ __param6(0, (0, import_common19.Param)("sourceConnectionId")),
115487
+ __param6(1, (0, import_common19.Param)("targetConnectionId")),
115488
+ __param6(2, (0, import_common19.Query)("schema")),
115161
115489
  __metadata25("design:type", Function),
115162
115490
  __metadata25("design:paramtypes", [String, String, String]),
115163
115491
  __metadata25("design:returntype", Promise)
115164
115492
  ], SyncController.prototype, "getTableRowCounts", null);
115165
115493
  __decorate31([
115166
- (0, import_common17.Get)("data/:sourceConnectionId/:targetConnectionId/diff/:schema/:table"),
115167
- __param6(0, (0, import_common17.Param)("sourceConnectionId")),
115168
- __param6(1, (0, import_common17.Param)("targetConnectionId")),
115169
- __param6(2, (0, import_common17.Param)("schema")),
115170
- __param6(3, (0, import_common17.Param)("table")),
115171
- __param6(4, (0, import_common17.Query)("primaryKeys")),
115494
+ (0, import_common19.Get)("data/:sourceConnectionId/:targetConnectionId/diff/:schema/:table"),
115495
+ __param6(0, (0, import_common19.Param)("sourceConnectionId")),
115496
+ __param6(1, (0, import_common19.Param)("targetConnectionId")),
115497
+ __param6(2, (0, import_common19.Param)("schema")),
115498
+ __param6(3, (0, import_common19.Param)("table")),
115499
+ __param6(4, (0, import_common19.Query)("primaryKeys")),
115172
115500
  __metadata25("design:type", Function),
115173
115501
  __metadata25("design:paramtypes", [String, String, String, String, String]),
115174
115502
  __metadata25("design:returntype", Promise)
115175
115503
  ], SyncController.prototype, "getTableDataDiff", null);
115176
115504
  __decorate31([
115177
- (0, import_common17.Post)("data/:sourceConnectionId/:targetConnectionId/sync/:schema/:table"),
115178
- __param6(0, (0, import_common17.Param)("sourceConnectionId")),
115179
- __param6(1, (0, import_common17.Param)("targetConnectionId")),
115180
- __param6(2, (0, import_common17.Param)("schema")),
115181
- __param6(3, (0, import_common17.Param)("table")),
115182
- __param6(4, (0, import_common17.Body)()),
115505
+ (0, import_common19.Post)("data/:sourceConnectionId/:targetConnectionId/sync/:schema/:table"),
115506
+ __param6(0, (0, import_common19.Param)("sourceConnectionId")),
115507
+ __param6(1, (0, import_common19.Param)("targetConnectionId")),
115508
+ __param6(2, (0, import_common19.Param)("schema")),
115509
+ __param6(3, (0, import_common19.Param)("table")),
115510
+ __param6(4, (0, import_common19.Body)()),
115183
115511
  __metadata25("design:type", Function),
115184
115512
  __metadata25("design:paramtypes", [String, String, String, String, SyncTableDto]),
115185
115513
  __metadata25("design:returntype", Promise)
115186
115514
  ], SyncController.prototype, "syncTableData", null);
115187
115515
  __decorate31([
115188
- (0, import_common17.Post)("rows/:targetConnectionId/:targetSchema/:table"),
115189
- __param6(0, (0, import_common17.Param)("targetConnectionId")),
115190
- __param6(1, (0, import_common17.Param)("targetSchema")),
115191
- __param6(2, (0, import_common17.Param)("table")),
115192
- __param6(3, (0, import_common17.Body)()),
115516
+ (0, import_common19.Post)("rows/:targetConnectionId/:targetSchema/:table"),
115517
+ __param6(0, (0, import_common19.Param)("targetConnectionId")),
115518
+ __param6(1, (0, import_common19.Param)("targetSchema")),
115519
+ __param6(2, (0, import_common19.Param)("table")),
115520
+ __param6(3, (0, import_common19.Body)()),
115193
115521
  __metadata25("design:type", Function),
115194
115522
  __metadata25("design:paramtypes", [String, String, String, SyncRowsDto]),
115195
115523
  __metadata25("design:returntype", Promise)
115196
115524
  ], SyncController.prototype, "syncRows", null);
115197
115525
  __decorate31([
115198
- (0, import_common17.Post)("groups/:groupId/sync-all"),
115199
- __param6(0, (0, import_common17.Param)("groupId")),
115200
- __param6(1, (0, import_common17.Query)("targetConnectionId")),
115201
- __param6(2, (0, import_common17.Query)("schema")),
115202
- __param6(3, (0, import_common17.Body)()),
115526
+ (0, import_common19.Post)("groups/:groupId/sync-all"),
115527
+ __param6(0, (0, import_common19.Param)("groupId")),
115528
+ __param6(1, (0, import_common19.Query)("targetConnectionId")),
115529
+ __param6(2, (0, import_common19.Query)("schema")),
115530
+ __param6(3, (0, import_common19.Body)()),
115203
115531
  __metadata25("design:type", Function),
115204
115532
  __metadata25("design:paramtypes", [String, String, String, SyncAllDto]),
115205
115533
  __metadata25("design:returntype", Promise)
115206
115534
  ], SyncController.prototype, "syncAllTables", null);
115207
115535
  __decorate31([
115208
- (0, import_common17.Post)("dump-restore/:sourceConnectionId/:targetConnectionId"),
115209
- __param6(0, (0, import_common17.Param)("sourceConnectionId")),
115210
- __param6(1, (0, import_common17.Param)("targetConnectionId")),
115211
- __param6(2, (0, import_common17.Query)("schema")),
115212
- __param6(3, (0, import_common17.Body)()),
115536
+ (0, import_common19.Post)("dump-restore/:sourceConnectionId/:targetConnectionId"),
115537
+ __param6(0, (0, import_common19.Param)("sourceConnectionId")),
115538
+ __param6(1, (0, import_common19.Param)("targetConnectionId")),
115539
+ __param6(2, (0, import_common19.Query)("schema")),
115540
+ __param6(3, (0, import_common19.Body)()),
115213
115541
  __metadata25("design:type", Function),
115214
115542
  __metadata25("design:paramtypes", [String, String, String, DumpRestoreDto]),
115215
115543
  __metadata25("design:returntype", Promise)
115216
115544
  ], SyncController.prototype, "dumpAndRestore", null);
115217
115545
  SyncController = __decorate31([
115218
- (0, import_common17.Controller)("sync"),
115546
+ (0, import_common19.Controller)("sync"),
115219
115547
  __metadata25("design:paramtypes", [
115220
115548
  SyncService,
115221
115549
  MetadataService
@@ -115232,7 +115560,7 @@ var __decorate32 = function(decorators, target, key, desc) {
115232
115560
  var SyncModule = class SyncModule2 {
115233
115561
  };
115234
115562
  SyncModule = __decorate32([
115235
- (0, import_common18.Module)({
115563
+ (0, import_common20.Module)({
115236
115564
  imports: [MetadataModule, ConnectionsModule, SchemaModule],
115237
115565
  controllers: [SyncController],
115238
115566
  providers: [SyncService],
@@ -115241,17 +115569,10 @@ SyncModule = __decorate32([
115241
115569
  ], SyncModule);
115242
115570
 
115243
115571
  // apps/api/dist/health/health.module.js
115244
- var import_common21 = __toESM(require_common(), 1);
115245
-
115246
- // apps/api/dist/health/health.controller.js
115247
- var import_common20 = __toESM(require_common(), 1);
115248
-
115249
- // apps/api/dist/auth/decorators/public.decorator.js
115250
- var import_common19 = __toESM(require_common(), 1);
115251
- var IS_PUBLIC_KEY = "isPublic";
115252
- var Public = () => (0, import_common19.SetMetadata)(IS_PUBLIC_KEY, true);
115572
+ var import_common22 = __toESM(require_common(), 1);
115253
115573
 
115254
115574
  // apps/api/dist/health/health.controller.js
115575
+ var import_common21 = __toESM(require_common(), 1);
115255
115576
  var __decorate33 = function(decorators, target, key, desc) {
115256
115577
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
115257
115578
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -115278,25 +115599,25 @@ var HealthController = class HealthController2 {
115278
115599
  }
115279
115600
  };
115280
115601
  __decorate33([
115281
- (0, import_common20.Get)(),
115602
+ (0, import_common21.Get)(),
115282
115603
  __metadata26("design:type", Function),
115283
115604
  __metadata26("design:paramtypes", []),
115284
115605
  __metadata26("design:returntype", void 0)
115285
115606
  ], HealthController.prototype, "check", null);
115286
115607
  __decorate33([
115287
- (0, import_common20.Get)("live"),
115608
+ (0, import_common21.Get)("live"),
115288
115609
  __metadata26("design:type", Function),
115289
115610
  __metadata26("design:paramtypes", []),
115290
115611
  __metadata26("design:returntype", void 0)
115291
115612
  ], HealthController.prototype, "liveness", null);
115292
115613
  __decorate33([
115293
- (0, import_common20.Get)("ready"),
115614
+ (0, import_common21.Get)("ready"),
115294
115615
  __metadata26("design:type", Function),
115295
115616
  __metadata26("design:paramtypes", []),
115296
115617
  __metadata26("design:returntype", void 0)
115297
115618
  ], HealthController.prototype, "readiness", null);
115298
115619
  HealthController = __decorate33([
115299
- (0, import_common20.Controller)("health"),
115620
+ (0, import_common21.Controller)("health"),
115300
115621
  Public()
115301
115622
  ], HealthController);
115302
115623
 
@@ -115310,19 +115631,19 @@ var __decorate34 = function(decorators, target, key, desc) {
115310
115631
  var HealthModule = class HealthModule2 {
115311
115632
  };
115312
115633
  HealthModule = __decorate34([
115313
- (0, import_common21.Module)({
115634
+ (0, import_common22.Module)({
115314
115635
  controllers: [HealthController]
115315
115636
  })
115316
115637
  ], HealthModule);
115317
115638
 
115318
115639
  // apps/api/dist/scanner/scanner.module.js
115319
- var import_common24 = __toESM(require_common(), 1);
115640
+ var import_common25 = __toESM(require_common(), 1);
115320
115641
 
115321
115642
  // apps/api/dist/scanner/scanner.controller.js
115322
- var import_common23 = __toESM(require_common(), 1);
115643
+ var import_common24 = __toESM(require_common(), 1);
115323
115644
 
115324
115645
  // apps/api/dist/scanner/scanner.service.js
115325
- var import_common22 = __toESM(require_common(), 1);
115646
+ var import_common23 = __toESM(require_common(), 1);
115326
115647
  import * as net from "net";
115327
115648
  import * as fs2 from "fs";
115328
115649
  import * as path2 from "path";
@@ -115352,7 +115673,7 @@ var DATABASE_PORTS = {
115352
115673
  3311: { engine: "mysql", name: "MySQL (alt)" }
115353
115674
  };
115354
115675
  var ScannerService = ScannerService_1 = class ScannerService2 {
115355
- logger = new import_common22.Logger(ScannerService_1.name);
115676
+ logger = new import_common23.Logger(ScannerService_1.name);
115356
115677
  async scanAll(workspacePath) {
115357
115678
  const result = {
115358
115679
  connections: [],
@@ -115828,7 +116149,7 @@ var ScannerService = ScannerService_1 = class ScannerService2 {
115828
116149
  }
115829
116150
  };
115830
116151
  ScannerService = ScannerService_1 = __decorate35([
115831
- (0, import_common22.Injectable)()
116152
+ (0, import_common23.Injectable)()
115832
116153
  ], ScannerService);
115833
116154
 
115834
116155
  // apps/api/dist/scanner/scanner.controller.js
@@ -115871,47 +116192,47 @@ var ScannerController = class ScannerController2 {
115871
116192
  }
115872
116193
  };
115873
116194
  __decorate36([
115874
- (0, import_common23.Get)("scan"),
115875
- __param7(0, (0, import_common23.Query)("workspace")),
116195
+ (0, import_common24.Get)("scan"),
116196
+ __param7(0, (0, import_common24.Query)("workspace")),
115876
116197
  __metadata27("design:type", Function),
115877
116198
  __metadata27("design:paramtypes", [String]),
115878
116199
  __metadata27("design:returntype", Promise)
115879
116200
  ], ScannerController.prototype, "scanForConnections", null);
115880
116201
  __decorate36([
115881
- (0, import_common23.Get)("scan/ports"),
116202
+ (0, import_common24.Get)("scan/ports"),
115882
116203
  __metadata27("design:type", Function),
115883
116204
  __metadata27("design:paramtypes", []),
115884
116205
  __metadata27("design:returntype", Promise)
115885
116206
  ], ScannerController.prototype, "scanPorts", null);
115886
116207
  __decorate36([
115887
- (0, import_common23.Get)("scan/docker"),
116208
+ (0, import_common24.Get)("scan/docker"),
115888
116209
  __metadata27("design:type", Function),
115889
116210
  __metadata27("design:paramtypes", []),
115890
116211
  __metadata27("design:returntype", Promise)
115891
116212
  ], ScannerController.prototype, "scanDocker", null);
115892
116213
  __decorate36([
115893
- (0, import_common23.Get)("scan/env"),
115894
- __param7(0, (0, import_common23.Query)("workspace")),
116214
+ (0, import_common24.Get)("scan/env"),
116215
+ __param7(0, (0, import_common24.Query)("workspace")),
115895
116216
  __metadata27("design:type", Function),
115896
116217
  __metadata27("design:paramtypes", [String]),
115897
116218
  __metadata27("design:returntype", Promise)
115898
116219
  ], ScannerController.prototype, "scanEnvFiles", null);
115899
116220
  __decorate36([
115900
- (0, import_common23.Get)("scan/compose"),
115901
- __param7(0, (0, import_common23.Query)("workspace")),
116221
+ (0, import_common24.Get)("scan/compose"),
116222
+ __param7(0, (0, import_common24.Query)("workspace")),
115902
116223
  __metadata27("design:type", Function),
115903
116224
  __metadata27("design:paramtypes", [String]),
115904
116225
  __metadata27("design:returntype", Promise)
115905
116226
  ], ScannerController.prototype, "scanDockerCompose", null);
115906
116227
  __decorate36([
115907
- (0, import_common23.Get)("scan/sqlite"),
115908
- __param7(0, (0, import_common23.Query)("workspace")),
116228
+ (0, import_common24.Get)("scan/sqlite"),
116229
+ __param7(0, (0, import_common24.Query)("workspace")),
115909
116230
  __metadata27("design:type", Function),
115910
116231
  __metadata27("design:paramtypes", [String]),
115911
116232
  __metadata27("design:returntype", Promise)
115912
116233
  ], ScannerController.prototype, "scanSqliteFiles", null);
115913
116234
  ScannerController = __decorate36([
115914
- (0, import_common23.Controller)("scanner"),
116235
+ (0, import_common24.Controller)("scanner"),
115915
116236
  __metadata27("design:paramtypes", [ScannerService])
115916
116237
  ], ScannerController);
115917
116238
 
@@ -115925,7 +116246,7 @@ var __decorate37 = function(decorators, target, key, desc) {
115925
116246
  var ScannerModule = class ScannerModule2 {
115926
116247
  };
115927
116248
  ScannerModule = __decorate37([
115928
- (0, import_common24.Module)({
116249
+ (0, import_common25.Module)({
115929
116250
  controllers: [ScannerController],
115930
116251
  providers: [ScannerService],
115931
116252
  exports: [ScannerService]
@@ -115933,10 +116254,10 @@ ScannerModule = __decorate37([
115933
116254
  ], ScannerModule);
115934
116255
 
115935
116256
  // apps/api/dist/audit/audit.module.js
115936
- var import_common26 = __toESM(require_common(), 1);
116257
+ var import_common27 = __toESM(require_common(), 1);
115937
116258
 
115938
116259
  // apps/api/dist/audit/audit.controller.js
115939
- var import_common25 = __toESM(require_common(), 1);
116260
+ var import_common26 = __toESM(require_common(), 1);
115940
116261
  var __decorate38 = function(decorators, target, key, desc) {
115941
116262
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
115942
116263
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -115970,24 +116291,24 @@ var AuditController = class AuditController2 {
115970
116291
  }
115971
116292
  };
115972
116293
  __decorate38([
115973
- (0, import_common25.Get)("logs"),
115974
- __param8(0, (0, import_common25.Query)("connectionId")),
115975
- __param8(1, (0, import_common25.Query)("entityType")),
115976
- __param8(2, (0, import_common25.Query)("action")),
115977
- __param8(3, (0, import_common25.Query)("limit")),
116294
+ (0, import_common26.Get)("logs"),
116295
+ __param8(0, (0, import_common26.Query)("connectionId")),
116296
+ __param8(1, (0, import_common26.Query)("entityType")),
116297
+ __param8(2, (0, import_common26.Query)("action")),
116298
+ __param8(3, (0, import_common26.Query)("limit")),
115978
116299
  __metadata28("design:type", Function),
115979
116300
  __metadata28("design:paramtypes", [String, String, String, String]),
115980
116301
  __metadata28("design:returntype", Array)
115981
116302
  ], AuditController.prototype, "getAuditLogs", null);
115982
116303
  __decorate38([
115983
- (0, import_common25.Get)("logs/:id"),
115984
- __param8(0, (0, import_common25.Query)("id")),
116304
+ (0, import_common26.Get)("logs/:id"),
116305
+ __param8(0, (0, import_common26.Query)("id")),
115985
116306
  __metadata28("design:type", Function),
115986
116307
  __metadata28("design:paramtypes", [String]),
115987
116308
  __metadata28("design:returntype", Object)
115988
116309
  ], AuditController.prototype, "getAuditLog", null);
115989
116310
  AuditController = __decorate38([
115990
- (0, import_common25.Controller)("audit"),
116311
+ (0, import_common26.Controller)("audit"),
115991
116312
  __metadata28("design:paramtypes", [MetadataService])
115992
116313
  ], AuditController);
115993
116314
 
@@ -116001,22 +116322,22 @@ var __decorate39 = function(decorators, target, key, desc) {
116001
116322
  var AuditModule = class AuditModule2 {
116002
116323
  };
116003
116324
  AuditModule = __decorate39([
116004
- (0, import_common26.Module)({
116325
+ (0, import_common27.Module)({
116005
116326
  imports: [MetadataModule],
116006
116327
  controllers: [AuditController]
116007
116328
  })
116008
116329
  ], AuditModule);
116009
116330
 
116010
116331
  // apps/api/dist/backup/backup.module.js
116011
- var import_common30 = __toESM(require_common(), 1);
116332
+ var import_common31 = __toESM(require_common(), 1);
116012
116333
  var import_platform_express2 = __toESM(require_platform_express(), 1);
116013
116334
 
116014
116335
  // apps/api/dist/backup/backup.controller.js
116015
- var import_common29 = __toESM(require_common(), 1);
116336
+ var import_common30 = __toESM(require_common(), 1);
116016
116337
  var import_platform_express = __toESM(require_platform_express(), 1);
116017
116338
 
116018
116339
  // apps/api/dist/backup/backup.service.js
116019
- var import_common27 = __toESM(require_common(), 1);
116340
+ var import_common28 = __toESM(require_common(), 1);
116020
116341
  import { spawn } from "node:child_process";
116021
116342
  import * as fs3 from "node:fs/promises";
116022
116343
  import * as path3 from "node:path";
@@ -116034,7 +116355,7 @@ var BackupService_1;
116034
116355
  var BackupService = BackupService_1 = class BackupService2 {
116035
116356
  metadataService;
116036
116357
  connectionsService;
116037
- logger = new import_common27.Logger(BackupService_1.name);
116358
+ logger = new import_common28.Logger(BackupService_1.name);
116038
116359
  backupsDir;
116039
116360
  constructor(metadataService, connectionsService) {
116040
116361
  this.metadataService = metadataService;
@@ -116472,7 +116793,7 @@ var BackupService = BackupService_1 = class BackupService2 {
116472
116793
  }
116473
116794
  };
116474
116795
  BackupService = BackupService_1 = __decorate40([
116475
- (0, import_common27.Injectable)(),
116796
+ (0, import_common28.Injectable)(),
116476
116797
  __metadata29("design:paramtypes", [
116477
116798
  MetadataService,
116478
116799
  ConnectionsService
@@ -116480,7 +116801,7 @@ BackupService = BackupService_1 = __decorate40([
116480
116801
  ], BackupService);
116481
116802
 
116482
116803
  // apps/api/dist/backup/restore.service.js
116483
- var import_common28 = __toESM(require_common(), 1);
116804
+ var import_common29 = __toESM(require_common(), 1);
116484
116805
  import { spawn as spawn2 } from "node:child_process";
116485
116806
  import * as fs4 from "node:fs/promises";
116486
116807
  import { createGunzip } from "node:zlib";
@@ -116499,7 +116820,7 @@ var RestoreService_1;
116499
116820
  var RestoreService = RestoreService_1 = class RestoreService2 {
116500
116821
  metadataService;
116501
116822
  connectionsService;
116502
- logger = new import_common28.Logger(RestoreService_1.name);
116823
+ logger = new import_common29.Logger(RestoreService_1.name);
116503
116824
  constructor(metadataService, connectionsService) {
116504
116825
  this.metadataService = metadataService;
116505
116826
  this.connectionsService = connectionsService;
@@ -116987,7 +117308,7 @@ SET FOREIGN_KEY_CHECKS=1;`;
116987
117308
  }
116988
117309
  };
116989
117310
  RestoreService = RestoreService_1 = __decorate41([
116990
- (0, import_common28.Injectable)(),
117311
+ (0, import_common29.Injectable)(),
116991
117312
  __metadata30("design:paramtypes", [
116992
117313
  MetadataService,
116993
117314
  ConnectionsService
@@ -117379,91 +117700,91 @@ var BackupController = class BackupController2 {
117379
117700
  }
117380
117701
  };
117381
117702
  __decorate44([
117382
- (0, import_common29.Post)(),
117383
- __param9(0, (0, import_common29.Body)()),
117703
+ (0, import_common30.Post)(),
117704
+ __param9(0, (0, import_common30.Body)()),
117384
117705
  __metadata33("design:type", Function),
117385
117706
  __metadata33("design:paramtypes", [CreateBackupDto]),
117386
117707
  __metadata33("design:returntype", Promise)
117387
117708
  ], BackupController.prototype, "createBackup", null);
117388
117709
  __decorate44([
117389
- (0, import_common29.Get)(),
117390
- __param9(0, (0, import_common29.Query)("connectionId")),
117710
+ (0, import_common30.Get)(),
117711
+ __param9(0, (0, import_common30.Query)("connectionId")),
117391
117712
  __metadata33("design:type", Function),
117392
117713
  __metadata33("design:paramtypes", [String]),
117393
117714
  __metadata33("design:returntype", Promise)
117394
117715
  ], BackupController.prototype, "getBackups", null);
117395
117716
  __decorate44([
117396
- (0, import_common29.Get)("logs"),
117397
- __param9(0, (0, import_common29.Query)("connectionId")),
117398
- __param9(1, (0, import_common29.Query)("operation")),
117399
- __param9(2, (0, import_common29.Query)("limit")),
117717
+ (0, import_common30.Get)("logs"),
117718
+ __param9(0, (0, import_common30.Query)("connectionId")),
117719
+ __param9(1, (0, import_common30.Query)("operation")),
117720
+ __param9(2, (0, import_common30.Query)("limit")),
117400
117721
  __metadata33("design:type", Function),
117401
117722
  __metadata33("design:paramtypes", [String, String, String]),
117402
117723
  __metadata33("design:returntype", Promise)
117403
117724
  ], BackupController.prototype, "getBackupLogs", null);
117404
117725
  __decorate44([
117405
- (0, import_common29.Get)("logs/:id"),
117406
- __param9(0, (0, import_common29.Param)("id")),
117726
+ (0, import_common30.Get)("logs/:id"),
117727
+ __param9(0, (0, import_common30.Param)("id")),
117407
117728
  __metadata33("design:type", Function),
117408
117729
  __metadata33("design:paramtypes", [String]),
117409
117730
  __metadata33("design:returntype", Promise)
117410
117731
  ], BackupController.prototype, "getBackupLog", null);
117411
117732
  __decorate44([
117412
- (0, import_common29.Get)(":id"),
117413
- __param9(0, (0, import_common29.Param)("id")),
117733
+ (0, import_common30.Get)(":id"),
117734
+ __param9(0, (0, import_common30.Param)("id")),
117414
117735
  __metadata33("design:type", Function),
117415
117736
  __metadata33("design:paramtypes", [String]),
117416
117737
  __metadata33("design:returntype", Promise)
117417
117738
  ], BackupController.prototype, "getBackup", null);
117418
117739
  __decorate44([
117419
- (0, import_common29.Get)(":id/download"),
117420
- __param9(0, (0, import_common29.Param)("id")),
117421
- __param9(1, (0, import_common29.Res)()),
117740
+ (0, import_common30.Get)(":id/download"),
117741
+ __param9(0, (0, import_common30.Param)("id")),
117742
+ __param9(1, (0, import_common30.Res)()),
117422
117743
  __metadata33("design:type", Function),
117423
117744
  __metadata33("design:paramtypes", [String, Object]),
117424
117745
  __metadata33("design:returntype", Promise)
117425
117746
  ], BackupController.prototype, "downloadBackup", null);
117426
117747
  __decorate44([
117427
- (0, import_common29.Post)("upload"),
117428
- (0, import_common29.UseInterceptors)((0, import_platform_express.FileInterceptor)("file")),
117429
- __param9(0, (0, import_common29.UploadedFile)()),
117430
- __param9(1, (0, import_common29.Body)("connectionId")),
117748
+ (0, import_common30.Post)("upload"),
117749
+ (0, import_common30.UseInterceptors)((0, import_platform_express.FileInterceptor)("file")),
117750
+ __param9(0, (0, import_common30.UploadedFile)()),
117751
+ __param9(1, (0, import_common30.Body)("connectionId")),
117431
117752
  __metadata33("design:type", Function),
117432
117753
  __metadata33("design:paramtypes", [Object, String]),
117433
117754
  __metadata33("design:returntype", Promise)
117434
117755
  ], BackupController.prototype, "uploadBackup", null);
117435
117756
  __decorate44([
117436
- (0, import_common29.Post)(":id/restore"),
117437
- (0, import_common29.HttpCode)(import_common29.HttpStatus.OK),
117438
- __param9(0, (0, import_common29.Param)("id")),
117439
- __param9(1, (0, import_common29.Body)()),
117757
+ (0, import_common30.Post)(":id/restore"),
117758
+ (0, import_common30.HttpCode)(import_common30.HttpStatus.OK),
117759
+ __param9(0, (0, import_common30.Param)("id")),
117760
+ __param9(1, (0, import_common30.Body)()),
117440
117761
  __metadata33("design:type", Function),
117441
117762
  __metadata33("design:paramtypes", [String, RestoreBackupDto]),
117442
117763
  __metadata33("design:returntype", Promise)
117443
117764
  ], BackupController.prototype, "restoreBackup", null);
117444
117765
  __decorate44([
117445
- (0, import_common29.Delete)(":id"),
117446
- (0, import_common29.HttpCode)(import_common29.HttpStatus.OK),
117447
- __param9(0, (0, import_common29.Param)("id")),
117766
+ (0, import_common30.Delete)(":id"),
117767
+ (0, import_common30.HttpCode)(import_common30.HttpStatus.OK),
117768
+ __param9(0, (0, import_common30.Param)("id")),
117448
117769
  __metadata33("design:type", Function),
117449
117770
  __metadata33("design:paramtypes", [String]),
117450
117771
  __metadata33("design:returntype", Promise)
117451
117772
  ], BackupController.prototype, "deleteBackup", null);
117452
117773
  __decorate44([
117453
- (0, import_common29.Get)("tools/status"),
117774
+ (0, import_common30.Get)("tools/status"),
117454
117775
  __metadata33("design:type", Function),
117455
117776
  __metadata33("design:paramtypes", []),
117456
117777
  __metadata33("design:returntype", Promise)
117457
117778
  ], BackupController.prototype, "getToolsStatus", null);
117458
117779
  __decorate44([
117459
- (0, import_common29.Post)("tools/install"),
117460
- (0, import_common29.HttpCode)(import_common29.HttpStatus.OK),
117780
+ (0, import_common30.Post)("tools/install"),
117781
+ (0, import_common30.HttpCode)(import_common30.HttpStatus.OK),
117461
117782
  __metadata33("design:type", Function),
117462
117783
  __metadata33("design:paramtypes", []),
117463
117784
  __metadata33("design:returntype", Promise)
117464
117785
  ], BackupController.prototype, "installTools", null);
117465
117786
  BackupController = __decorate44([
117466
- (0, import_common29.Controller)("backups"),
117787
+ (0, import_common30.Controller)("backups"),
117467
117788
  __metadata33("design:paramtypes", [
117468
117789
  BackupService,
117469
117790
  RestoreService,
@@ -117481,7 +117802,7 @@ var __decorate45 = function(decorators, target, key, desc) {
117481
117802
  var BackupModule = class BackupModule2 {
117482
117803
  };
117483
117804
  BackupModule = __decorate45([
117484
- (0, import_common30.Module)({
117805
+ (0, import_common31.Module)({
117485
117806
  imports: [
117486
117807
  MetadataModule,
117487
117808
  ConnectionsModule,
@@ -117499,10 +117820,10 @@ BackupModule = __decorate45([
117499
117820
  ], BackupModule);
117500
117821
 
117501
117822
  // apps/api/dist/servers/servers.module.js
117502
- var import_common32 = __toESM(require_common(), 1);
117823
+ var import_common33 = __toESM(require_common(), 1);
117503
117824
 
117504
117825
  // apps/api/dist/servers/servers.controller.js
117505
- var import_common31 = __toESM(require_common(), 1);
117826
+ var import_common32 = __toESM(require_common(), 1);
117506
117827
  import { exec } from "child_process";
117507
117828
  import { promisify } from "util";
117508
117829
 
@@ -117611,6 +117932,7 @@ var UpdateServerDto = class {
117611
117932
  tags;
117612
117933
  startCommand;
117613
117934
  stopCommand;
117935
+ isPublic;
117614
117936
  };
117615
117937
  __decorate47([
117616
117938
  (0, import_class_validator18.IsOptional)(),
@@ -117668,6 +117990,11 @@ __decorate47([
117668
117990
  (0, import_class_validator18.IsString)(),
117669
117991
  __metadata35("design:type", String)
117670
117992
  ], UpdateServerDto.prototype, "stopCommand", void 0);
117993
+ __decorate47([
117994
+ (0, import_class_validator18.IsOptional)(),
117995
+ (0, import_class_validator18.IsBoolean)(),
117996
+ __metadata35("design:type", Boolean)
117997
+ ], UpdateServerDto.prototype, "isPublic", void 0);
117671
117998
 
117672
117999
  // apps/api/dist/servers/dto/create-database.dto.js
117673
118000
  var import_class_validator19 = __toESM(require_cjs(), 1);
@@ -117762,24 +118089,32 @@ var ServersController = class ServersController2 {
117762
118089
  constructor(metadataService) {
117763
118090
  this.metadataService = metadataService;
117764
118091
  }
117765
- getServers(engine) {
118092
+ getServers(engine, user) {
118093
+ const userContext = {
118094
+ userId: user?.id ?? null,
118095
+ isAdmin: user?.role === "admin"
118096
+ };
117766
118097
  if (engine) {
117767
- return this.metadataService.serverRepository.findByEngine(engine);
118098
+ return this.metadataService.serverRepository.findByEngine(engine, userContext);
117768
118099
  }
117769
- return this.metadataService.serverRepository.findAll();
118100
+ return this.metadataService.serverRepository.findAll(userContext);
117770
118101
  }
117771
118102
  getServer(id) {
117772
118103
  return this.metadataService.serverRepository.findById(id);
117773
118104
  }
117774
- getServerDatabases(id) {
117775
- return this.metadataService.connectionRepository.findByServerId(id);
118105
+ getServerDatabases(id, user) {
118106
+ const userContext = {
118107
+ userId: user?.id ?? null,
118108
+ isAdmin: user?.role === "admin"
118109
+ };
118110
+ return this.metadataService.connectionRepository.findByServerId(id, userContext);
117776
118111
  }
117777
118112
  getServerPassword(id) {
117778
118113
  const password = this.metadataService.serverRepository.getPassword(id);
117779
118114
  return { password };
117780
118115
  }
117781
- createServer(input) {
117782
- const server = this.metadataService.serverRepository.create(input);
118116
+ createServer(input, user) {
118117
+ const server = this.metadataService.serverRepository.create(input, user?.id);
117783
118118
  this.metadataService.auditLogRepository.create({
117784
118119
  action: "server_created",
117785
118120
  entityType: "server",
@@ -117793,7 +118128,14 @@ var ServersController = class ServersController2 {
117793
118128
  });
117794
118129
  return server;
117795
118130
  }
117796
- updateServer(id, input) {
118131
+ updateServer(id, input, user) {
118132
+ const userContext = {
118133
+ userId: user?.id ?? null,
118134
+ isAdmin: user?.role === "admin"
118135
+ };
118136
+ if (!this.metadataService.serverRepository.canModify(id, userContext)) {
118137
+ throw new import_common32.ForbiddenException("You do not have permission to modify this server");
118138
+ }
117797
118139
  const server = this.metadataService.serverRepository.update(id, input);
117798
118140
  if (server) {
117799
118141
  this.metadataService.auditLogRepository.create({
@@ -117808,8 +118150,15 @@ var ServersController = class ServersController2 {
117808
118150
  }
117809
118151
  return server;
117810
118152
  }
117811
- deleteServer(id) {
118153
+ deleteServer(id, user) {
118154
+ const userContext = {
118155
+ userId: user?.id ?? null,
118156
+ isAdmin: user?.role === "admin"
118157
+ };
117812
118158
  const server = this.metadataService.serverRepository.findById(id);
118159
+ if (!this.metadataService.serverRepository.canModify(id, userContext)) {
118160
+ throw new import_common32.ForbiddenException("You do not have permission to delete this server");
118161
+ }
117813
118162
  const linkedDatabases = this.metadataService.connectionRepository.findByServerId(id);
117814
118163
  if (linkedDatabases.length > 0) {
117815
118164
  return {
@@ -118241,110 +118590,115 @@ var ServersController = class ServersController2 {
118241
118590
  }
118242
118591
  };
118243
118592
  __decorate50([
118244
- (0, import_common31.Get)(),
118245
- __param10(0, (0, import_common31.Query)("engine")),
118593
+ (0, import_common32.Get)(),
118594
+ __param10(0, (0, import_common32.Query)("engine")),
118595
+ __param10(1, CurrentUser()),
118246
118596
  __metadata38("design:type", Function),
118247
- __metadata38("design:paramtypes", [String]),
118597
+ __metadata38("design:paramtypes", [String, Object]),
118248
118598
  __metadata38("design:returntype", Array)
118249
118599
  ], ServersController.prototype, "getServers", null);
118250
118600
  __decorate50([
118251
- (0, import_common31.Get)(":id"),
118252
- __param10(0, (0, import_common31.Param)("id")),
118601
+ (0, import_common32.Get)(":id"),
118602
+ __param10(0, (0, import_common32.Param)("id")),
118253
118603
  __metadata38("design:type", Function),
118254
118604
  __metadata38("design:paramtypes", [String]),
118255
118605
  __metadata38("design:returntype", Object)
118256
118606
  ], ServersController.prototype, "getServer", null);
118257
118607
  __decorate50([
118258
- (0, import_common31.Get)(":id/databases"),
118259
- __param10(0, (0, import_common31.Param)("id")),
118608
+ (0, import_common32.Get)(":id/databases"),
118609
+ __param10(0, (0, import_common32.Param)("id")),
118610
+ __param10(1, CurrentUser()),
118260
118611
  __metadata38("design:type", Function),
118261
- __metadata38("design:paramtypes", [String]),
118612
+ __metadata38("design:paramtypes", [String, Object]),
118262
118613
  __metadata38("design:returntype", Array)
118263
118614
  ], ServersController.prototype, "getServerDatabases", null);
118264
118615
  __decorate50([
118265
- (0, import_common31.Get)(":id/password"),
118266
- __param10(0, (0, import_common31.Param)("id")),
118616
+ (0, import_common32.Get)(":id/password"),
118617
+ __param10(0, (0, import_common32.Param)("id")),
118267
118618
  __metadata38("design:type", Function),
118268
118619
  __metadata38("design:paramtypes", [String]),
118269
118620
  __metadata38("design:returntype", Object)
118270
118621
  ], ServersController.prototype, "getServerPassword", null);
118271
118622
  __decorate50([
118272
- (0, import_common31.Post)(),
118273
- __param10(0, (0, import_common31.Body)()),
118623
+ (0, import_common32.Post)(),
118624
+ __param10(0, (0, import_common32.Body)()),
118625
+ __param10(1, CurrentUser()),
118274
118626
  __metadata38("design:type", Function),
118275
- __metadata38("design:paramtypes", [CreateServerDto]),
118627
+ __metadata38("design:paramtypes", [CreateServerDto, Object]),
118276
118628
  __metadata38("design:returntype", Object)
118277
118629
  ], ServersController.prototype, "createServer", null);
118278
118630
  __decorate50([
118279
- (0, import_common31.Put)(":id"),
118280
- __param10(0, (0, import_common31.Param)("id")),
118281
- __param10(1, (0, import_common31.Body)()),
118631
+ (0, import_common32.Put)(":id"),
118632
+ __param10(0, (0, import_common32.Param)("id")),
118633
+ __param10(1, (0, import_common32.Body)()),
118634
+ __param10(2, CurrentUser()),
118282
118635
  __metadata38("design:type", Function),
118283
- __metadata38("design:paramtypes", [String, UpdateServerDto]),
118636
+ __metadata38("design:paramtypes", [String, UpdateServerDto, Object]),
118284
118637
  __metadata38("design:returntype", Object)
118285
118638
  ], ServersController.prototype, "updateServer", null);
118286
118639
  __decorate50([
118287
- (0, import_common31.Delete)(":id"),
118288
- __param10(0, (0, import_common31.Param)("id")),
118640
+ (0, import_common32.Delete)(":id"),
118641
+ __param10(0, (0, import_common32.Param)("id")),
118642
+ __param10(1, CurrentUser()),
118289
118643
  __metadata38("design:type", Function),
118290
- __metadata38("design:paramtypes", [String]),
118644
+ __metadata38("design:paramtypes", [String, Object]),
118291
118645
  __metadata38("design:returntype", Object)
118292
118646
  ], ServersController.prototype, "deleteServer", null);
118293
118647
  __decorate50([
118294
- (0, import_common31.Post)(":id/test"),
118295
- __param10(0, (0, import_common31.Param)("id")),
118648
+ (0, import_common32.Post)(":id/test"),
118649
+ __param10(0, (0, import_common32.Param)("id")),
118296
118650
  __metadata38("design:type", Function),
118297
118651
  __metadata38("design:paramtypes", [String]),
118298
118652
  __metadata38("design:returntype", Promise)
118299
118653
  ], ServersController.prototype, "testServerConnection", null);
118300
118654
  __decorate50([
118301
- (0, import_common31.Post)(":id/create-database"),
118302
- __param10(0, (0, import_common31.Param)("id")),
118303
- __param10(1, (0, import_common31.Body)()),
118655
+ (0, import_common32.Post)(":id/create-database"),
118656
+ __param10(0, (0, import_common32.Param)("id")),
118657
+ __param10(1, (0, import_common32.Body)()),
118304
118658
  __metadata38("design:type", Function),
118305
118659
  __metadata38("design:paramtypes", [String, CreateDatabaseDto]),
118306
118660
  __metadata38("design:returntype", Promise)
118307
118661
  ], ServersController.prototype, "createDatabase", null);
118308
118662
  __decorate50([
118309
- (0, import_common31.Get)(":id/list-databases"),
118310
- __param10(0, (0, import_common31.Param)("id")),
118663
+ (0, import_common32.Get)(":id/list-databases"),
118664
+ __param10(0, (0, import_common32.Param)("id")),
118311
118665
  __metadata38("design:type", Function),
118312
118666
  __metadata38("design:paramtypes", [String]),
118313
118667
  __metadata38("design:returntype", Promise)
118314
118668
  ], ServersController.prototype, "listDatabases", null);
118315
118669
  __decorate50([
118316
- (0, import_common31.Get)(":id/info"),
118317
- __param10(0, (0, import_common31.Param)("id")),
118670
+ (0, import_common32.Get)(":id/info"),
118671
+ __param10(0, (0, import_common32.Param)("id")),
118318
118672
  __metadata38("design:type", Function),
118319
118673
  __metadata38("design:paramtypes", [String]),
118320
118674
  __metadata38("design:returntype", Promise)
118321
118675
  ], ServersController.prototype, "getServerInfo", null);
118322
118676
  __decorate50([
118323
- (0, import_common31.Delete)(":id/databases/:dbName"),
118324
- __param10(0, (0, import_common31.Param)("id")),
118325
- __param10(1, (0, import_common31.Param)("dbName")),
118677
+ (0, import_common32.Delete)(":id/databases/:dbName"),
118678
+ __param10(0, (0, import_common32.Param)("id")),
118679
+ __param10(1, (0, import_common32.Param)("dbName")),
118326
118680
  __metadata38("design:type", Function),
118327
118681
  __metadata38("design:paramtypes", [String, String]),
118328
118682
  __metadata38("design:returntype", Promise)
118329
118683
  ], ServersController.prototype, "dropDatabase", null);
118330
118684
  __decorate50([
118331
- (0, import_common31.Post)(":id/start"),
118332
- __param10(0, (0, import_common31.Param)("id")),
118333
- __param10(1, (0, import_common31.Query)("confirmed")),
118685
+ (0, import_common32.Post)(":id/start"),
118686
+ __param10(0, (0, import_common32.Param)("id")),
118687
+ __param10(1, (0, import_common32.Query)("confirmed")),
118334
118688
  __metadata38("design:type", Function),
118335
118689
  __metadata38("design:paramtypes", [String, String]),
118336
118690
  __metadata38("design:returntype", Promise)
118337
118691
  ], ServersController.prototype, "startServer", null);
118338
118692
  __decorate50([
118339
- (0, import_common31.Post)(":id/stop"),
118340
- __param10(0, (0, import_common31.Param)("id")),
118341
- __param10(1, (0, import_common31.Query)("confirmed")),
118693
+ (0, import_common32.Post)(":id/stop"),
118694
+ __param10(0, (0, import_common32.Param)("id")),
118695
+ __param10(1, (0, import_common32.Query)("confirmed")),
118342
118696
  __metadata38("design:type", Function),
118343
118697
  __metadata38("design:paramtypes", [String, String]),
118344
118698
  __metadata38("design:returntype", Promise)
118345
118699
  ], ServersController.prototype, "stopServer", null);
118346
118700
  ServersController = __decorate50([
118347
- (0, import_common31.Controller)("servers"),
118701
+ (0, import_common32.Controller)("servers"),
118348
118702
  __metadata38("design:paramtypes", [MetadataService])
118349
118703
  ], ServersController);
118350
118704
 
@@ -118358,17 +118712,17 @@ var __decorate51 = function(decorators, target, key, desc) {
118358
118712
  var ServersModule = class ServersModule2 {
118359
118713
  };
118360
118714
  ServersModule = __decorate51([
118361
- (0, import_common32.Module)({
118715
+ (0, import_common33.Module)({
118362
118716
  imports: [MetadataModule],
118363
118717
  controllers: [ServersController]
118364
118718
  })
118365
118719
  ], ServersModule);
118366
118720
 
118367
118721
  // apps/api/dist/settings/settings.module.js
118368
- var import_common34 = __toESM(require_common(), 1);
118722
+ var import_common35 = __toESM(require_common(), 1);
118369
118723
 
118370
118724
  // apps/api/dist/settings/settings.controller.js
118371
- var import_common33 = __toESM(require_common(), 1);
118725
+ var import_common34 = __toESM(require_common(), 1);
118372
118726
 
118373
118727
  // apps/api/dist/settings/dto/setting.dto.js
118374
118728
  var import_class_validator21 = __toESM(require_cjs(), 1);
@@ -118450,103 +118804,103 @@ var SettingsController = class SettingsController2 {
118450
118804
  constructor(metadataService) {
118451
118805
  this.metadataService = metadataService;
118452
118806
  }
118453
- // ============ Generic Settings ============
118807
+ // ============ System Settings (system-wide defaults) ============
118454
118808
  getAllSettings() {
118455
- return this.metadataService.settingsRepository.getAll();
118809
+ return this.metadataService.userPreferencesRepository.getAllForUser("system");
118456
118810
  }
118457
118811
  getSetting(key) {
118458
- return this.metadataService.settingsRepository.get(key);
118812
+ return this.metadataService.userPreferencesRepository.getSystemDefault(key);
118459
118813
  }
118460
118814
  setSetting(key, body) {
118461
- this.metadataService.settingsRepository.set(key, body.value);
118815
+ this.metadataService.userPreferencesRepository.setSystemDefault(key, body.value);
118462
118816
  return { success: true };
118463
118817
  }
118464
118818
  deleteSetting(key) {
118465
- const success = this.metadataService.settingsRepository.delete(key);
118819
+ const success = this.metadataService.userPreferencesRepository.delete("system", key);
118466
118820
  return { success };
118467
118821
  }
118468
- // ============ Tags ============
118822
+ // ============ Tags (system-wide) ============
118469
118823
  getTags() {
118470
- return this.metadataService.settingsRepository.getTags();
118824
+ return this.metadataService.userPreferencesRepository.getTags();
118471
118825
  }
118472
118826
  createTag(input) {
118473
- return this.metadataService.settingsRepository.addTag(input);
118827
+ return this.metadataService.userPreferencesRepository.addTag(input);
118474
118828
  }
118475
118829
  updateTag(id, input) {
118476
- return this.metadataService.settingsRepository.updateTag(id, input);
118830
+ return this.metadataService.userPreferencesRepository.updateTag(id, input);
118477
118831
  }
118478
118832
  deleteTag(id) {
118479
- const success = this.metadataService.settingsRepository.deleteTag(id);
118833
+ const success = this.metadataService.userPreferencesRepository.deleteTag(id);
118480
118834
  return { success };
118481
118835
  }
118482
118836
  resetTags() {
118483
- return this.metadataService.settingsRepository.resetTags();
118837
+ return this.metadataService.userPreferencesRepository.resetTags();
118484
118838
  }
118485
118839
  };
118486
118840
  __decorate54([
118487
- (0, import_common33.Get)(),
118841
+ (0, import_common34.Get)(),
118488
118842
  __metadata41("design:type", Function),
118489
118843
  __metadata41("design:paramtypes", []),
118490
118844
  __metadata41("design:returntype", Object)
118491
118845
  ], SettingsController.prototype, "getAllSettings", null);
118492
118846
  __decorate54([
118493
- (0, import_common33.Get)(":key"),
118494
- __param11(0, (0, import_common33.Param)("key")),
118847
+ (0, import_common34.Get)(":key"),
118848
+ __param11(0, (0, import_common34.Param)("key")),
118495
118849
  __metadata41("design:type", Function),
118496
118850
  __metadata41("design:paramtypes", [String]),
118497
118851
  __metadata41("design:returntype", Object)
118498
118852
  ], SettingsController.prototype, "getSetting", null);
118499
118853
  __decorate54([
118500
- (0, import_common33.Put)(":key"),
118501
- __param11(0, (0, import_common33.Param)("key")),
118502
- __param11(1, (0, import_common33.Body)()),
118854
+ (0, import_common34.Put)(":key"),
118855
+ __param11(0, (0, import_common34.Param)("key")),
118856
+ __param11(1, (0, import_common34.Body)()),
118503
118857
  __metadata41("design:type", Function),
118504
118858
  __metadata41("design:paramtypes", [String, SetSettingDto]),
118505
118859
  __metadata41("design:returntype", Object)
118506
118860
  ], SettingsController.prototype, "setSetting", null);
118507
118861
  __decorate54([
118508
- (0, import_common33.Delete)(":key"),
118509
- __param11(0, (0, import_common33.Param)("key")),
118862
+ (0, import_common34.Delete)(":key"),
118863
+ __param11(0, (0, import_common34.Param)("key")),
118510
118864
  __metadata41("design:type", Function),
118511
118865
  __metadata41("design:paramtypes", [String]),
118512
118866
  __metadata41("design:returntype", Object)
118513
118867
  ], SettingsController.prototype, "deleteSetting", null);
118514
118868
  __decorate54([
118515
- (0, import_common33.Get)("tags/all"),
118869
+ (0, import_common34.Get)("tags/all"),
118516
118870
  __metadata41("design:type", Function),
118517
118871
  __metadata41("design:paramtypes", []),
118518
118872
  __metadata41("design:returntype", Array)
118519
118873
  ], SettingsController.prototype, "getTags", null);
118520
118874
  __decorate54([
118521
- (0, import_common33.Post)("tags"),
118522
- __param11(0, (0, import_common33.Body)()),
118875
+ (0, import_common34.Post)("tags"),
118876
+ __param11(0, (0, import_common34.Body)()),
118523
118877
  __metadata41("design:type", Function),
118524
118878
  __metadata41("design:paramtypes", [CreateTagDto]),
118525
118879
  __metadata41("design:returntype", Object)
118526
118880
  ], SettingsController.prototype, "createTag", null);
118527
118881
  __decorate54([
118528
- (0, import_common33.Put)("tags/:id"),
118529
- __param11(0, (0, import_common33.Param)("id")),
118530
- __param11(1, (0, import_common33.Body)()),
118882
+ (0, import_common34.Put)("tags/:id"),
118883
+ __param11(0, (0, import_common34.Param)("id")),
118884
+ __param11(1, (0, import_common34.Body)()),
118531
118885
  __metadata41("design:type", Function),
118532
118886
  __metadata41("design:paramtypes", [String, UpdateTagDto]),
118533
118887
  __metadata41("design:returntype", Object)
118534
118888
  ], SettingsController.prototype, "updateTag", null);
118535
118889
  __decorate54([
118536
- (0, import_common33.Delete)("tags/:id"),
118537
- __param11(0, (0, import_common33.Param)("id")),
118890
+ (0, import_common34.Delete)("tags/:id"),
118891
+ __param11(0, (0, import_common34.Param)("id")),
118538
118892
  __metadata41("design:type", Function),
118539
118893
  __metadata41("design:paramtypes", [String]),
118540
118894
  __metadata41("design:returntype", Object)
118541
118895
  ], SettingsController.prototype, "deleteTag", null);
118542
118896
  __decorate54([
118543
- (0, import_common33.Post)("tags/reset"),
118897
+ (0, import_common34.Post)("tags/reset"),
118544
118898
  __metadata41("design:type", Function),
118545
118899
  __metadata41("design:paramtypes", []),
118546
118900
  __metadata41("design:returntype", Array)
118547
118901
  ], SettingsController.prototype, "resetTags", null);
118548
118902
  SettingsController = __decorate54([
118549
- (0, import_common33.Controller)("settings"),
118903
+ (0, import_common34.Controller)("settings"),
118550
118904
  __metadata41("design:paramtypes", [MetadataService])
118551
118905
  ], SettingsController);
118552
118906
 
@@ -118560,32 +118914,149 @@ var __decorate55 = function(decorators, target, key, desc) {
118560
118914
  var SettingsModule = class SettingsModule2 {
118561
118915
  };
118562
118916
  SettingsModule = __decorate55([
118563
- (0, import_common34.Module)({
118917
+ (0, import_common35.Module)({
118564
118918
  imports: [MetadataModule],
118565
118919
  controllers: [SettingsController]
118566
118920
  })
118567
118921
  ], SettingsModule);
118568
118922
 
118923
+ // apps/api/dist/preferences/preferences.module.js
118924
+ var import_common37 = __toESM(require_common(), 1);
118925
+
118926
+ // apps/api/dist/preferences/preferences.controller.js
118927
+ var import_common36 = __toESM(require_common(), 1);
118928
+ var __decorate56 = function(decorators, target, key, desc) {
118929
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
118930
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
118931
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
118932
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
118933
+ };
118934
+ var __metadata42 = function(k, v) {
118935
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
118936
+ };
118937
+ var __param12 = function(paramIndex, decorator) {
118938
+ return function(target, key) {
118939
+ decorator(target, key, paramIndex);
118940
+ };
118941
+ };
118942
+ var PreferencesController = class PreferencesController2 {
118943
+ metadataService;
118944
+ constructor(metadataService) {
118945
+ this.metadataService = metadataService;
118946
+ }
118947
+ /**
118948
+ * Get all preferences for the current user
118949
+ */
118950
+ getAllPreferences(userId) {
118951
+ if (!userId) {
118952
+ return {};
118953
+ }
118954
+ return this.metadataService.userPreferencesRepository.getAllForUser(userId);
118955
+ }
118956
+ /**
118957
+ * Get a specific preference for the current user
118958
+ */
118959
+ getPreference(userId, key) {
118960
+ if (!userId) {
118961
+ return { value: null };
118962
+ }
118963
+ const value = this.metadataService.userPreferencesRepository.get(userId, key);
118964
+ return { value };
118965
+ }
118966
+ /**
118967
+ * Set a preference for the current user
118968
+ */
118969
+ setPreference(userId, key, body) {
118970
+ if (!userId) {
118971
+ return { success: false };
118972
+ }
118973
+ this.metadataService.userPreferencesRepository.set(userId, key, body.value);
118974
+ return { success: true };
118975
+ }
118976
+ /**
118977
+ * Delete a preference for the current user
118978
+ */
118979
+ deletePreference(userId, key) {
118980
+ if (!userId) {
118981
+ return { success: false };
118982
+ }
118983
+ const success = this.metadataService.userPreferencesRepository.delete(userId, key);
118984
+ return { success };
118985
+ }
118986
+ };
118987
+ __decorate56([
118988
+ (0, import_common36.Get)(),
118989
+ __param12(0, CurrentUser("id")),
118990
+ __metadata42("design:type", Function),
118991
+ __metadata42("design:paramtypes", [String]),
118992
+ __metadata42("design:returntype", Object)
118993
+ ], PreferencesController.prototype, "getAllPreferences", null);
118994
+ __decorate56([
118995
+ (0, import_common36.Get)(":key"),
118996
+ __param12(0, CurrentUser("id")),
118997
+ __param12(1, (0, import_common36.Param)("key")),
118998
+ __metadata42("design:type", Function),
118999
+ __metadata42("design:paramtypes", [String, String]),
119000
+ __metadata42("design:returntype", Object)
119001
+ ], PreferencesController.prototype, "getPreference", null);
119002
+ __decorate56([
119003
+ (0, import_common36.Put)(":key"),
119004
+ __param12(0, CurrentUser("id")),
119005
+ __param12(1, (0, import_common36.Param)("key")),
119006
+ __param12(2, (0, import_common36.Body)()),
119007
+ __metadata42("design:type", Function),
119008
+ __metadata42("design:paramtypes", [String, String, Object]),
119009
+ __metadata42("design:returntype", Object)
119010
+ ], PreferencesController.prototype, "setPreference", null);
119011
+ __decorate56([
119012
+ (0, import_common36.Delete)(":key"),
119013
+ __param12(0, CurrentUser("id")),
119014
+ __param12(1, (0, import_common36.Param)("key")),
119015
+ __metadata42("design:type", Function),
119016
+ __metadata42("design:paramtypes", [String, String]),
119017
+ __metadata42("design:returntype", Object)
119018
+ ], PreferencesController.prototype, "deletePreference", null);
119019
+ PreferencesController = __decorate56([
119020
+ (0, import_common36.Controller)("preferences"),
119021
+ __metadata42("design:paramtypes", [MetadataService])
119022
+ ], PreferencesController);
119023
+
119024
+ // apps/api/dist/preferences/preferences.module.js
119025
+ var __decorate57 = function(decorators, target, key, desc) {
119026
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
119027
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
119028
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
119029
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
119030
+ };
119031
+ var PreferencesModule = class PreferencesModule2 {
119032
+ };
119033
+ PreferencesModule = __decorate57([
119034
+ (0, import_common37.Module)({
119035
+ imports: [MetadataModule],
119036
+ controllers: [PreferencesController]
119037
+ })
119038
+ ], PreferencesModule);
119039
+
118569
119040
  // apps/api/dist/auth/auth.module.js
118570
- var import_common40 = __toESM(require_common(), 1);
119041
+ var import_common43 = __toESM(require_common(), 1);
118571
119042
  var import_jwt2 = __toESM(require_jwt(), 1);
118572
119043
  var import_passport4 = __toESM(require_passport(), 1);
118573
119044
 
118574
119045
  // apps/api/dist/auth/auth.controller.js
118575
- var import_common36 = __toESM(require_common(), 1);
119046
+ var import_common39 = __toESM(require_common(), 1);
118576
119047
 
118577
119048
  // apps/api/dist/auth/auth.service.js
118578
- var import_common35 = __toESM(require_common(), 1);
119049
+ var import_common38 = __toESM(require_common(), 1);
118579
119050
  var import_jwt = __toESM(require_jwt(), 1);
118580
- var bcrypt = __toESM(require_bcryptjs(), 1);
119051
+ var import_bcryptjs = __toESM(require_bcryptjs(), 1);
118581
119052
  import { createHash as createHash2 } from "crypto";
118582
- var __decorate56 = function(decorators, target, key, desc) {
119053
+ var __decorate58 = function(decorators, target, key, desc) {
118583
119054
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
118584
119055
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
118585
119056
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
118586
119057
  return c > 3 && r && Object.defineProperty(target, key, r), r;
118587
119058
  };
118588
- var __metadata42 = function(k, v) {
119059
+ var __metadata43 = function(k, v) {
118589
119060
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
118590
119061
  };
118591
119062
  var AuthService = class AuthService2 {
@@ -118601,9 +119072,9 @@ var AuthService = class AuthService2 {
118601
119072
  async register(dto) {
118602
119073
  const existingUser = this.metadataService.userRepository.findByEmail(dto.email);
118603
119074
  if (existingUser) {
118604
- throw new import_common35.ConflictException("Email already registered");
119075
+ throw new import_common38.ConflictException("Email already registered");
118605
119076
  }
118606
- const passwordHash = await bcrypt.hash(dto.password, this.SALT_ROUNDS);
119077
+ const passwordHash = await import_bcryptjs.default.hash(dto.password, this.SALT_ROUNDS);
118607
119078
  const isFirstUser = this.metadataService.userRepository.count() === 0;
118608
119079
  const role = isFirstUser ? "admin" : "viewer";
118609
119080
  const user = this.metadataService.userRepository.create({
@@ -118626,12 +119097,12 @@ var AuthService = class AuthService2 {
118626
119097
  email: dto.email,
118627
119098
  reason: "user_not_found"
118628
119099
  });
118629
- throw new import_common35.UnauthorizedException("Invalid credentials");
119100
+ throw new import_common38.UnauthorizedException("Invalid credentials");
118630
119101
  }
118631
- const isPasswordValid = await bcrypt.compare(dto.password, user.passwordHash);
119102
+ const isPasswordValid = await import_bcryptjs.default.compare(dto.password, user.passwordHash);
118632
119103
  if (!isPasswordValid) {
118633
119104
  this.logAuthEvent("login_failed", user.id, { reason: "invalid_password" });
118634
- throw new import_common35.UnauthorizedException("Invalid credentials");
119105
+ throw new import_common38.UnauthorizedException("Invalid credentials");
118635
119106
  }
118636
119107
  const tokens = await this.generateTokens(user);
118637
119108
  this.logAuthEvent("user_logged_in", user.id);
@@ -118644,15 +119115,15 @@ var AuthService = class AuthService2 {
118644
119115
  const tokenHash = this.hashToken(refreshToken);
118645
119116
  const storedToken = this.metadataService.userRepository.findRefreshToken(tokenHash);
118646
119117
  if (!storedToken) {
118647
- throw new import_common35.UnauthorizedException("Invalid refresh token");
119118
+ throw new import_common38.UnauthorizedException("Invalid refresh token");
118648
119119
  }
118649
119120
  if (new Date(storedToken.expiresAt) < /* @__PURE__ */ new Date()) {
118650
119121
  this.metadataService.userRepository.deleteRefreshToken(tokenHash);
118651
- throw new import_common35.UnauthorizedException("Refresh token expired");
119122
+ throw new import_common38.UnauthorizedException("Refresh token expired");
118652
119123
  }
118653
119124
  const user = this.metadataService.userRepository.findById(storedToken.userId);
118654
119125
  if (!user) {
118655
- throw new import_common35.UnauthorizedException("User not found");
119126
+ throw new import_common38.UnauthorizedException("User not found");
118656
119127
  }
118657
119128
  this.metadataService.userRepository.deleteRefreshToken(tokenHash);
118658
119129
  return this.generateTokens(user);
@@ -118705,24 +119176,31 @@ var AuthService = class AuthService2 {
118705
119176
  async changePassword(userId, currentPassword, newPassword) {
118706
119177
  const user = this.metadataService.userRepository.findById(userId);
118707
119178
  if (!user) {
118708
- throw new import_common35.UnauthorizedException("User not found");
119179
+ throw new import_common38.UnauthorizedException("User not found");
118709
119180
  }
118710
- const isPasswordValid = await bcrypt.compare(currentPassword, user.passwordHash);
119181
+ const isPasswordValid = await import_bcryptjs.default.compare(currentPassword, user.passwordHash);
118711
119182
  if (!isPasswordValid) {
118712
119183
  this.logAuthEvent("password_change_failed", userId, {
118713
119184
  reason: "invalid_current_password"
118714
119185
  });
118715
- throw new import_common35.BadRequestException("Current password is incorrect");
119186
+ throw new import_common38.BadRequestException("Current password is incorrect");
118716
119187
  }
118717
- const newPasswordHash = await bcrypt.hash(newPassword, this.SALT_ROUNDS);
119188
+ const newPasswordHash = await import_bcryptjs.default.hash(newPassword, this.SALT_ROUNDS);
118718
119189
  this.metadataService.userRepository.update(userId, { passwordHash: newPasswordHash });
118719
119190
  this.metadataService.userRepository.deleteUserRefreshTokens(userId);
118720
119191
  this.logAuthEvent("password_changed", userId);
118721
119192
  }
119193
+ async verifyPassword(userId, password) {
119194
+ const user = this.metadataService.userRepository.findById(userId);
119195
+ if (!user) {
119196
+ return false;
119197
+ }
119198
+ return import_bcryptjs.default.compare(password, user.passwordHash);
119199
+ }
118722
119200
  async updateProfile(userId, updates) {
118723
119201
  const user = this.metadataService.userRepository.update(userId, updates);
118724
119202
  if (!user) {
118725
- throw new import_common35.UnauthorizedException("User not found");
119203
+ throw new import_common38.UnauthorizedException("User not found");
118726
119204
  }
118727
119205
  return this.sanitizeUser(user);
118728
119206
  }
@@ -118771,9 +119249,9 @@ var AuthService = class AuthService2 {
118771
119249
  return sanitized;
118772
119250
  }
118773
119251
  };
118774
- AuthService = __decorate56([
118775
- (0, import_common35.Injectable)(),
118776
- __metadata42("design:paramtypes", [
119252
+ AuthService = __decorate58([
119253
+ (0, import_common38.Injectable)(),
119254
+ __metadata43("design:paramtypes", [
118777
119255
  MetadataService,
118778
119256
  import_jwt.JwtService
118779
119257
  ])
@@ -118781,13 +119259,13 @@ AuthService = __decorate56([
118781
119259
 
118782
119260
  // apps/api/dist/auth/dto/register.dto.js
118783
119261
  var import_class_validator23 = __toESM(require_cjs(), 1);
118784
- var __decorate57 = function(decorators, target, key, desc) {
119262
+ var __decorate59 = function(decorators, target, key, desc) {
118785
119263
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
118786
119264
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
118787
119265
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
118788
119266
  return c > 3 && r && Object.defineProperty(target, key, r), r;
118789
119267
  };
118790
- var __metadata43 = function(k, v) {
119268
+ var __metadata44 = function(k, v) {
118791
119269
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
118792
119270
  };
118793
119271
  var RegisterDto = class {
@@ -118795,127 +119273,127 @@ var RegisterDto = class {
118795
119273
  password;
118796
119274
  name;
118797
119275
  };
118798
- __decorate57([
119276
+ __decorate59([
118799
119277
  (0, import_class_validator23.IsEmail)({}, { message: "Please provide a valid email address" }),
118800
- __metadata43("design:type", String)
119278
+ __metadata44("design:type", String)
118801
119279
  ], RegisterDto.prototype, "email", void 0);
118802
- __decorate57([
119280
+ __decorate59([
118803
119281
  (0, import_class_validator23.IsString)(),
118804
119282
  (0, import_class_validator23.MinLength)(8, { message: "Password must be at least 8 characters long" }),
118805
- __metadata43("design:type", String)
119283
+ __metadata44("design:type", String)
118806
119284
  ], RegisterDto.prototype, "password", void 0);
118807
- __decorate57([
119285
+ __decorate59([
118808
119286
  (0, import_class_validator23.IsOptional)(),
118809
119287
  (0, import_class_validator23.IsString)(),
118810
- __metadata43("design:type", String)
119288
+ __metadata44("design:type", String)
118811
119289
  ], RegisterDto.prototype, "name", void 0);
118812
119290
 
118813
119291
  // apps/api/dist/auth/dto/login.dto.js
118814
119292
  var import_class_validator24 = __toESM(require_cjs(), 1);
118815
- var __decorate58 = function(decorators, target, key, desc) {
119293
+ var __decorate60 = function(decorators, target, key, desc) {
118816
119294
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
118817
119295
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
118818
119296
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
118819
119297
  return c > 3 && r && Object.defineProperty(target, key, r), r;
118820
119298
  };
118821
- var __metadata44 = function(k, v) {
119299
+ var __metadata45 = function(k, v) {
118822
119300
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
118823
119301
  };
118824
119302
  var LoginDto = class {
118825
119303
  email;
118826
119304
  password;
118827
119305
  };
118828
- __decorate58([
119306
+ __decorate60([
118829
119307
  (0, import_class_validator24.IsEmail)({}, { message: "Please provide a valid email address" }),
118830
- __metadata44("design:type", String)
119308
+ __metadata45("design:type", String)
118831
119309
  ], LoginDto.prototype, "email", void 0);
118832
- __decorate58([
119310
+ __decorate60([
118833
119311
  (0, import_class_validator24.IsString)(),
118834
- __metadata44("design:type", String)
119312
+ __metadata45("design:type", String)
118835
119313
  ], LoginDto.prototype, "password", void 0);
118836
119314
 
118837
119315
  // apps/api/dist/auth/dto/refresh-token.dto.js
118838
119316
  var import_class_validator25 = __toESM(require_cjs(), 1);
118839
- var __decorate59 = function(decorators, target, key, desc) {
119317
+ var __decorate61 = function(decorators, target, key, desc) {
118840
119318
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
118841
119319
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
118842
119320
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
118843
119321
  return c > 3 && r && Object.defineProperty(target, key, r), r;
118844
119322
  };
118845
- var __metadata45 = function(k, v) {
119323
+ var __metadata46 = function(k, v) {
118846
119324
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
118847
119325
  };
118848
119326
  var RefreshTokenDto = class {
118849
119327
  refreshToken;
118850
119328
  };
118851
- __decorate59([
119329
+ __decorate61([
118852
119330
  (0, import_class_validator25.IsString)(),
118853
- __metadata45("design:type", String)
119331
+ __metadata46("design:type", String)
118854
119332
  ], RefreshTokenDto.prototype, "refreshToken", void 0);
118855
119333
 
118856
119334
  // apps/api/dist/auth/dto/create-api-key.dto.js
118857
119335
  var import_class_validator26 = __toESM(require_cjs(), 1);
118858
- var __decorate60 = function(decorators, target, key, desc) {
119336
+ var __decorate62 = function(decorators, target, key, desc) {
118859
119337
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
118860
119338
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
118861
119339
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
118862
119340
  return c > 3 && r && Object.defineProperty(target, key, r), r;
118863
119341
  };
118864
- var __metadata46 = function(k, v) {
119342
+ var __metadata47 = function(k, v) {
118865
119343
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
118866
119344
  };
118867
119345
  var CreateApiKeyDto = class {
118868
119346
  name;
118869
119347
  expiresAt;
118870
119348
  };
118871
- __decorate60([
119349
+ __decorate62([
118872
119350
  (0, import_class_validator26.IsString)(),
118873
119351
  (0, import_class_validator26.MinLength)(1),
118874
119352
  (0, import_class_validator26.MaxLength)(100),
118875
- __metadata46("design:type", String)
119353
+ __metadata47("design:type", String)
118876
119354
  ], CreateApiKeyDto.prototype, "name", void 0);
118877
- __decorate60([
119355
+ __decorate62([
118878
119356
  (0, import_class_validator26.IsOptional)(),
118879
119357
  (0, import_class_validator26.IsDateString)(),
118880
- __metadata46("design:type", String)
119358
+ __metadata47("design:type", String)
118881
119359
  ], CreateApiKeyDto.prototype, "expiresAt", void 0);
118882
119360
 
118883
119361
  // apps/api/dist/auth/dto/change-password.dto.js
118884
119362
  var import_class_validator27 = __toESM(require_cjs(), 1);
118885
- var __decorate61 = function(decorators, target, key, desc) {
119363
+ var __decorate63 = function(decorators, target, key, desc) {
118886
119364
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
118887
119365
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
118888
119366
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
118889
119367
  return c > 3 && r && Object.defineProperty(target, key, r), r;
118890
119368
  };
118891
- var __metadata47 = function(k, v) {
119369
+ var __metadata48 = function(k, v) {
118892
119370
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
118893
119371
  };
118894
119372
  var ChangePasswordDto = class {
118895
119373
  currentPassword;
118896
119374
  newPassword;
118897
119375
  };
118898
- __decorate61([
119376
+ __decorate63([
118899
119377
  (0, import_class_validator27.IsString)(),
118900
- __metadata47("design:type", String)
119378
+ __metadata48("design:type", String)
118901
119379
  ], ChangePasswordDto.prototype, "currentPassword", void 0);
118902
- __decorate61([
119380
+ __decorate63([
118903
119381
  (0, import_class_validator27.IsString)(),
118904
119382
  (0, import_class_validator27.MinLength)(8, { message: "New password must be at least 8 characters long" }),
118905
- __metadata47("design:type", String)
119383
+ __metadata48("design:type", String)
118906
119384
  ], ChangePasswordDto.prototype, "newPassword", void 0);
118907
119385
 
118908
119386
  // apps/api/dist/auth/auth.controller.js
118909
- var __decorate62 = function(decorators, target, key, desc) {
119387
+ var __decorate64 = function(decorators, target, key, desc) {
118910
119388
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
118911
119389
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
118912
119390
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
118913
119391
  return c > 3 && r && Object.defineProperty(target, key, r), r;
118914
119392
  };
118915
- var __metadata48 = function(k, v) {
119393
+ var __metadata49 = function(k, v) {
118916
119394
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
118917
119395
  };
118918
- var __param12 = function(paramIndex, decorator) {
119396
+ var __param13 = function(paramIndex, decorator) {
118919
119397
  return function(target, key) {
118920
119398
  decorator(target, key, paramIndex);
118921
119399
  };
@@ -118950,6 +119428,10 @@ var AuthController = class AuthController2 {
118950
119428
  await this.authService.changePassword(userId, dto.currentPassword, dto.newPassword);
118951
119429
  return { message: "Password changed successfully. Please log in again." };
118952
119430
  }
119431
+ async verifyPassword(userId, dto) {
119432
+ const valid = await this.authService.verifyPassword(userId, dto.password);
119433
+ return { valid };
119434
+ }
118953
119435
  async updateProfile(userId, dto) {
118954
119436
  return this.authService.updateProfile(userId, dto);
118955
119437
  }
@@ -118976,120 +119458,129 @@ var AuthController = class AuthController2 {
118976
119458
  };
118977
119459
  }
118978
119460
  };
118979
- __decorate62([
119461
+ __decorate64([
118980
119462
  Public(),
118981
- (0, import_common36.Post)("register"),
118982
- __param12(0, (0, import_common36.Body)()),
118983
- __metadata48("design:type", Function),
118984
- __metadata48("design:paramtypes", [RegisterDto]),
118985
- __metadata48("design:returntype", Promise)
119463
+ (0, import_common39.Post)("register"),
119464
+ __param13(0, (0, import_common39.Body)()),
119465
+ __metadata49("design:type", Function),
119466
+ __metadata49("design:paramtypes", [RegisterDto]),
119467
+ __metadata49("design:returntype", Promise)
118986
119468
  ], AuthController.prototype, "register", null);
118987
- __decorate62([
119469
+ __decorate64([
118988
119470
  Public(),
118989
- (0, import_common36.Post)("login"),
118990
- (0, import_common36.HttpCode)(import_common36.HttpStatus.OK),
118991
- __param12(0, (0, import_common36.Body)()),
118992
- __metadata48("design:type", Function),
118993
- __metadata48("design:paramtypes", [LoginDto]),
118994
- __metadata48("design:returntype", Promise)
119471
+ (0, import_common39.Post)("login"),
119472
+ (0, import_common39.HttpCode)(import_common39.HttpStatus.OK),
119473
+ __param13(0, (0, import_common39.Body)()),
119474
+ __metadata49("design:type", Function),
119475
+ __metadata49("design:paramtypes", [LoginDto]),
119476
+ __metadata49("design:returntype", Promise)
118995
119477
  ], AuthController.prototype, "login", null);
118996
- __decorate62([
119478
+ __decorate64([
118997
119479
  Public(),
118998
- (0, import_common36.Post)("refresh"),
118999
- (0, import_common36.HttpCode)(import_common36.HttpStatus.OK),
119000
- __param12(0, (0, import_common36.Body)()),
119001
- __metadata48("design:type", Function),
119002
- __metadata48("design:paramtypes", [RefreshTokenDto]),
119003
- __metadata48("design:returntype", Promise)
119480
+ (0, import_common39.Post)("refresh"),
119481
+ (0, import_common39.HttpCode)(import_common39.HttpStatus.OK),
119482
+ __param13(0, (0, import_common39.Body)()),
119483
+ __metadata49("design:type", Function),
119484
+ __metadata49("design:paramtypes", [RefreshTokenDto]),
119485
+ __metadata49("design:returntype", Promise)
119004
119486
  ], AuthController.prototype, "refreshTokens", null);
119005
- __decorate62([
119006
- (0, import_common36.Post)("logout"),
119007
- (0, import_common36.HttpCode)(import_common36.HttpStatus.OK),
119008
- __param12(0, (0, import_common36.Body)()),
119009
- __metadata48("design:type", Function),
119010
- __metadata48("design:paramtypes", [RefreshTokenDto]),
119011
- __metadata48("design:returntype", Promise)
119487
+ __decorate64([
119488
+ (0, import_common39.Post)("logout"),
119489
+ (0, import_common39.HttpCode)(import_common39.HttpStatus.OK),
119490
+ __param13(0, (0, import_common39.Body)()),
119491
+ __metadata49("design:type", Function),
119492
+ __metadata49("design:paramtypes", [RefreshTokenDto]),
119493
+ __metadata49("design:returntype", Promise)
119012
119494
  ], AuthController.prototype, "logout", null);
119013
- __decorate62([
119014
- (0, import_common36.Post)("logout-all"),
119015
- (0, import_common36.HttpCode)(import_common36.HttpStatus.OK),
119016
- __param12(0, CurrentUser("id")),
119017
- __metadata48("design:type", Function),
119018
- __metadata48("design:paramtypes", [String]),
119019
- __metadata48("design:returntype", Promise)
119495
+ __decorate64([
119496
+ (0, import_common39.Post)("logout-all"),
119497
+ (0, import_common39.HttpCode)(import_common39.HttpStatus.OK),
119498
+ __param13(0, CurrentUser("id")),
119499
+ __metadata49("design:type", Function),
119500
+ __metadata49("design:paramtypes", [String]),
119501
+ __metadata49("design:returntype", Promise)
119020
119502
  ], AuthController.prototype, "logoutAll", null);
119021
- __decorate62([
119022
- (0, import_common36.Get)("me"),
119023
- __param12(0, CurrentUser()),
119024
- __metadata48("design:type", Function),
119025
- __metadata48("design:paramtypes", [Object]),
119026
- __metadata48("design:returntype", Object)
119503
+ __decorate64([
119504
+ (0, import_common39.Get)("me"),
119505
+ __param13(0, CurrentUser()),
119506
+ __metadata49("design:type", Function),
119507
+ __metadata49("design:paramtypes", [Object]),
119508
+ __metadata49("design:returntype", Object)
119027
119509
  ], AuthController.prototype, "getMe", null);
119028
- __decorate62([
119029
- (0, import_common36.Post)("change-password"),
119030
- (0, import_common36.HttpCode)(import_common36.HttpStatus.OK),
119031
- __param12(0, CurrentUser("id")),
119032
- __param12(1, (0, import_common36.Body)()),
119033
- __metadata48("design:type", Function),
119034
- __metadata48("design:paramtypes", [String, ChangePasswordDto]),
119035
- __metadata48("design:returntype", Promise)
119510
+ __decorate64([
119511
+ (0, import_common39.Post)("change-password"),
119512
+ (0, import_common39.HttpCode)(import_common39.HttpStatus.OK),
119513
+ __param13(0, CurrentUser("id")),
119514
+ __param13(1, (0, import_common39.Body)()),
119515
+ __metadata49("design:type", Function),
119516
+ __metadata49("design:paramtypes", [String, ChangePasswordDto]),
119517
+ __metadata49("design:returntype", Promise)
119036
119518
  ], AuthController.prototype, "changePassword", null);
119037
- __decorate62([
119038
- (0, import_common36.Post)("update-profile"),
119039
- (0, import_common36.HttpCode)(import_common36.HttpStatus.OK),
119040
- __param12(0, CurrentUser("id")),
119041
- __param12(1, (0, import_common36.Body)()),
119042
- __metadata48("design:type", Function),
119043
- __metadata48("design:paramtypes", [String, Object]),
119044
- __metadata48("design:returntype", Promise)
119519
+ __decorate64([
119520
+ (0, import_common39.Post)("verify-password"),
119521
+ (0, import_common39.HttpCode)(import_common39.HttpStatus.OK),
119522
+ __param13(0, CurrentUser("id")),
119523
+ __param13(1, (0, import_common39.Body)()),
119524
+ __metadata49("design:type", Function),
119525
+ __metadata49("design:paramtypes", [String, Object]),
119526
+ __metadata49("design:returntype", Promise)
119527
+ ], AuthController.prototype, "verifyPassword", null);
119528
+ __decorate64([
119529
+ (0, import_common39.Post)("update-profile"),
119530
+ (0, import_common39.HttpCode)(import_common39.HttpStatus.OK),
119531
+ __param13(0, CurrentUser("id")),
119532
+ __param13(1, (0, import_common39.Body)()),
119533
+ __metadata49("design:type", Function),
119534
+ __metadata49("design:paramtypes", [String, Object]),
119535
+ __metadata49("design:returntype", Promise)
119045
119536
  ], AuthController.prototype, "updateProfile", null);
119046
- __decorate62([
119537
+ __decorate64([
119047
119538
  Public(),
119048
- (0, import_common36.Get)("status"),
119049
- __metadata48("design:type", Function),
119050
- __metadata48("design:paramtypes", []),
119051
- __metadata48("design:returntype", Object)
119539
+ (0, import_common39.Get)("status"),
119540
+ __metadata49("design:type", Function),
119541
+ __metadata49("design:paramtypes", []),
119542
+ __metadata49("design:returntype", Object)
119052
119543
  ], AuthController.prototype, "getAuthStatus", null);
119053
- __decorate62([
119054
- (0, import_common36.Post)("api-keys"),
119055
- __param12(0, CurrentUser("id")),
119056
- __param12(1, (0, import_common36.Body)()),
119057
- __metadata48("design:type", Function),
119058
- __metadata48("design:paramtypes", [String, CreateApiKeyDto]),
119059
- __metadata48("design:returntype", Promise)
119544
+ __decorate64([
119545
+ (0, import_common39.Post)("api-keys"),
119546
+ __param13(0, CurrentUser("id")),
119547
+ __param13(1, (0, import_common39.Body)()),
119548
+ __metadata49("design:type", Function),
119549
+ __metadata49("design:paramtypes", [String, CreateApiKeyDto]),
119550
+ __metadata49("design:returntype", Promise)
119060
119551
  ], AuthController.prototype, "createApiKey", null);
119061
- __decorate62([
119062
- (0, import_common36.Get)("api-keys"),
119063
- __param12(0, CurrentUser("id")),
119064
- __metadata48("design:type", Function),
119065
- __metadata48("design:paramtypes", [String]),
119066
- __metadata48("design:returntype", Promise)
119552
+ __decorate64([
119553
+ (0, import_common39.Get)("api-keys"),
119554
+ __param13(0, CurrentUser("id")),
119555
+ __metadata49("design:type", Function),
119556
+ __metadata49("design:paramtypes", [String]),
119557
+ __metadata49("design:returntype", Promise)
119067
119558
  ], AuthController.prototype, "getApiKeys", null);
119068
- __decorate62([
119069
- (0, import_common36.Delete)("api-keys/:id"),
119070
- (0, import_common36.HttpCode)(import_common36.HttpStatus.OK),
119071
- __param12(0, CurrentUser("id")),
119072
- __param12(1, (0, import_common36.Param)("id")),
119073
- __metadata48("design:type", Function),
119074
- __metadata48("design:paramtypes", [String, String]),
119075
- __metadata48("design:returntype", Promise)
119559
+ __decorate64([
119560
+ (0, import_common39.Delete)("api-keys/:id"),
119561
+ (0, import_common39.HttpCode)(import_common39.HttpStatus.OK),
119562
+ __param13(0, CurrentUser("id")),
119563
+ __param13(1, (0, import_common39.Param)("id")),
119564
+ __metadata49("design:type", Function),
119565
+ __metadata49("design:paramtypes", [String, String]),
119566
+ __metadata49("design:returntype", Promise)
119076
119567
  ], AuthController.prototype, "deleteApiKey", null);
119077
- AuthController = __decorate62([
119078
- (0, import_common36.Controller)("auth"),
119079
- __metadata48("design:paramtypes", [AuthService])
119568
+ AuthController = __decorate64([
119569
+ (0, import_common39.Controller)("auth"),
119570
+ __metadata49("design:paramtypes", [AuthService])
119080
119571
  ], AuthController);
119081
119572
 
119082
119573
  // apps/api/dist/auth/strategies/jwt.strategy.js
119083
- var import_common37 = __toESM(require_common(), 1);
119574
+ var import_common40 = __toESM(require_common(), 1);
119084
119575
  var import_passport = __toESM(require_passport(), 1);
119085
119576
  var import_passport_jwt = __toESM(require_lib13(), 1);
119086
- var __decorate63 = function(decorators, target, key, desc) {
119577
+ var __decorate65 = function(decorators, target, key, desc) {
119087
119578
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
119088
119579
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
119089
119580
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
119090
119581
  return c > 3 && r && Object.defineProperty(target, key, r), r;
119091
119582
  };
119092
- var __metadata49 = function(k, v) {
119583
+ var __metadata50 = function(k, v) {
119093
119584
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
119094
119585
  };
119095
119586
  var JwtStrategy = class JwtStrategy2 extends (0, import_passport.PassportStrategy)(import_passport_jwt.Strategy) {
@@ -119105,28 +119596,28 @@ var JwtStrategy = class JwtStrategy2 extends (0, import_passport.PassportStrateg
119105
119596
  async validate(payload) {
119106
119597
  const user = this.metadataService.userRepository.findById(payload.sub);
119107
119598
  if (!user) {
119108
- throw new import_common37.UnauthorizedException("User not found");
119599
+ throw new import_common40.UnauthorizedException("User not found");
119109
119600
  }
119110
119601
  return user;
119111
119602
  }
119112
119603
  };
119113
- JwtStrategy = __decorate63([
119114
- (0, import_common37.Injectable)(),
119115
- __metadata49("design:paramtypes", [MetadataService])
119604
+ JwtStrategy = __decorate65([
119605
+ (0, import_common40.Injectable)(),
119606
+ __metadata50("design:paramtypes", [MetadataService])
119116
119607
  ], JwtStrategy);
119117
119608
 
119118
119609
  // apps/api/dist/auth/strategies/api-key.strategy.js
119119
- var import_common38 = __toESM(require_common(), 1);
119610
+ var import_common41 = __toESM(require_common(), 1);
119120
119611
  var import_passport2 = __toESM(require_passport(), 1);
119121
119612
  var import_passport_custom = __toESM(require_lib14(), 1);
119122
119613
  import { createHash as createHash3 } from "crypto";
119123
- var __decorate64 = function(decorators, target, key, desc) {
119614
+ var __decorate66 = function(decorators, target, key, desc) {
119124
119615
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
119125
119616
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
119126
119617
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
119127
119618
  return c > 3 && r && Object.defineProperty(target, key, r), r;
119128
119619
  };
119129
- var __metadata50 = function(k, v) {
119620
+ var __metadata51 = function(k, v) {
119130
119621
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
119131
119622
  };
119132
119623
  var ApiKeyStrategy = class ApiKeyStrategy2 extends (0, import_passport2.PassportStrategy)(import_passport_custom.Strategy, "api-key") {
@@ -119138,19 +119629,19 @@ var ApiKeyStrategy = class ApiKeyStrategy2 extends (0, import_passport2.Passport
119138
119629
  async validate(req) {
119139
119630
  const apiKey = this.extractApiKey(req);
119140
119631
  if (!apiKey) {
119141
- throw new import_common38.UnauthorizedException("API key is required");
119632
+ throw new import_common41.UnauthorizedException("API key is required");
119142
119633
  }
119143
119634
  const keyHash = this.hashKey(apiKey);
119144
119635
  const storedKey = this.metadataService.userRepository.findApiKeyByHash(keyHash);
119145
119636
  if (!storedKey) {
119146
- throw new import_common38.UnauthorizedException("Invalid API key");
119637
+ throw new import_common41.UnauthorizedException("Invalid API key");
119147
119638
  }
119148
119639
  if (storedKey.expiresAt && new Date(storedKey.expiresAt) < /* @__PURE__ */ new Date()) {
119149
- throw new import_common38.UnauthorizedException("API key has expired");
119640
+ throw new import_common41.UnauthorizedException("API key has expired");
119150
119641
  }
119151
119642
  const user = this.metadataService.userRepository.findById(storedKey.userId);
119152
119643
  if (!user) {
119153
- throw new import_common38.UnauthorizedException("User not found");
119644
+ throw new import_common41.UnauthorizedException("User not found");
119154
119645
  }
119155
119646
  this.metadataService.userRepository.updateApiKeyLastUsed(storedKey.id);
119156
119647
  return user;
@@ -119173,22 +119664,22 @@ var ApiKeyStrategy = class ApiKeyStrategy2 extends (0, import_passport2.Passport
119173
119664
  return createHash3("sha256").update(key).digest("hex");
119174
119665
  }
119175
119666
  };
119176
- ApiKeyStrategy = __decorate64([
119177
- (0, import_common38.Injectable)(),
119178
- __metadata50("design:paramtypes", [MetadataService])
119667
+ ApiKeyStrategy = __decorate66([
119668
+ (0, import_common41.Injectable)(),
119669
+ __metadata51("design:paramtypes", [MetadataService])
119179
119670
  ], ApiKeyStrategy);
119180
119671
 
119181
119672
  // apps/api/dist/auth/guards/combined-auth.guard.js
119182
- var import_common39 = __toESM(require_common(), 1);
119673
+ var import_common42 = __toESM(require_common(), 1);
119183
119674
  var import_core = __toESM(require_core3(), 1);
119184
119675
  var import_passport3 = __toESM(require_passport(), 1);
119185
- var __decorate65 = function(decorators, target, key, desc) {
119676
+ var __decorate67 = function(decorators, target, key, desc) {
119186
119677
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
119187
119678
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
119188
119679
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
119189
119680
  return c > 3 && r && Object.defineProperty(target, key, r), r;
119190
119681
  };
119191
- var __metadata51 = function(k, v) {
119682
+ var __metadata52 = function(k, v) {
119192
119683
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
119193
119684
  };
119194
119685
  var CombinedAuthGuard = class CombinedAuthGuard2 extends (0, import_passport3.AuthGuard)(["jwt", "api-key"]) {
@@ -119220,7 +119711,7 @@ var CombinedAuthGuard = class CombinedAuthGuard2 extends (0, import_passport3.Au
119220
119711
  if (authHeader?.startsWith("Bearer ")) {
119221
119712
  return this.activateJwt(context);
119222
119713
  }
119223
- throw new import_common39.UnauthorizedException("Authentication required");
119714
+ throw new import_common42.UnauthorizedException("Authentication required");
119224
119715
  }
119225
119716
  async activateJwt(context) {
119226
119717
  const jwtGuard = new ((0, import_passport3.AuthGuard)("jwt"))();
@@ -119228,7 +119719,7 @@ var CombinedAuthGuard = class CombinedAuthGuard2 extends (0, import_passport3.Au
119228
119719
  await jwtGuard.canActivate(context);
119229
119720
  return true;
119230
119721
  } catch {
119231
- throw new import_common39.UnauthorizedException("Invalid or expired token");
119722
+ throw new import_common42.UnauthorizedException("Invalid or expired token");
119232
119723
  }
119233
119724
  }
119234
119725
  async activateApiKey(context) {
@@ -119237,26 +119728,26 @@ var CombinedAuthGuard = class CombinedAuthGuard2 extends (0, import_passport3.Au
119237
119728
  await apiKeyGuard.canActivate(context);
119238
119729
  return true;
119239
119730
  } catch {
119240
- throw new import_common39.UnauthorizedException("Invalid API key");
119731
+ throw new import_common42.UnauthorizedException("Invalid API key");
119241
119732
  }
119242
119733
  }
119243
119734
  handleRequest(err, user) {
119244
119735
  if (err || !user) {
119245
- throw err || new import_common39.UnauthorizedException();
119736
+ throw err || new import_common42.UnauthorizedException();
119246
119737
  }
119247
119738
  return user;
119248
119739
  }
119249
119740
  };
119250
- CombinedAuthGuard = __decorate65([
119251
- (0, import_common39.Injectable)(),
119252
- __metadata51("design:paramtypes", [
119741
+ CombinedAuthGuard = __decorate67([
119742
+ (0, import_common42.Injectable)(),
119743
+ __metadata52("design:paramtypes", [
119253
119744
  import_core.Reflector,
119254
119745
  MetadataService
119255
119746
  ])
119256
119747
  ], CombinedAuthGuard);
119257
119748
 
119258
119749
  // apps/api/dist/auth/auth.module.js
119259
- var __decorate66 = function(decorators, target, key, desc) {
119750
+ var __decorate68 = function(decorators, target, key, desc) {
119260
119751
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
119261
119752
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
119262
119753
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -119264,8 +119755,8 @@ var __decorate66 = function(decorators, target, key, desc) {
119264
119755
  };
119265
119756
  var AuthModule = class AuthModule2 {
119266
119757
  };
119267
- AuthModule = __decorate66([
119268
- (0, import_common40.Module)({
119758
+ AuthModule = __decorate68([
119759
+ (0, import_common43.Module)({
119269
119760
  imports: [
119270
119761
  MetadataModule,
119271
119762
  import_passport4.PassportModule.register({ defaultStrategy: "jwt" }),
@@ -119282,22 +119773,17 @@ AuthModule = __decorate66([
119282
119773
  })
119283
119774
  ], AuthModule);
119284
119775
 
119285
- // apps/api/dist/auth/decorators/roles.decorator.js
119286
- var import_common41 = __toESM(require_common(), 1);
119287
- var ROLES_KEY = "roles";
119288
- var Roles = (...roles) => (0, import_common41.SetMetadata)(ROLES_KEY, roles);
119289
-
119290
119776
  // apps/api/dist/auth/guards/jwt-auth.guard.js
119291
- var import_common42 = __toESM(require_common(), 1);
119777
+ var import_common44 = __toESM(require_common(), 1);
119292
119778
  var import_core2 = __toESM(require_core3(), 1);
119293
119779
  var import_passport5 = __toESM(require_passport(), 1);
119294
- var __decorate67 = function(decorators, target, key, desc) {
119780
+ var __decorate69 = function(decorators, target, key, desc) {
119295
119781
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
119296
119782
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
119297
119783
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
119298
119784
  return c > 3 && r && Object.defineProperty(target, key, r), r;
119299
119785
  };
119300
- var __metadata52 = function(k, v) {
119786
+ var __metadata53 = function(k, v) {
119301
119787
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
119302
119788
  };
119303
119789
  var JwtAuthGuard = class JwtAuthGuard2 extends (0, import_passport5.AuthGuard)("jwt") {
@@ -119317,21 +119803,21 @@ var JwtAuthGuard = class JwtAuthGuard2 extends (0, import_passport5.AuthGuard)("
119317
119803
  return super.canActivate(context);
119318
119804
  }
119319
119805
  };
119320
- JwtAuthGuard = __decorate67([
119321
- (0, import_common42.Injectable)(),
119322
- __metadata52("design:paramtypes", [import_core2.Reflector])
119806
+ JwtAuthGuard = __decorate69([
119807
+ (0, import_common44.Injectable)(),
119808
+ __metadata53("design:paramtypes", [import_core2.Reflector])
119323
119809
  ], JwtAuthGuard);
119324
119810
 
119325
119811
  // apps/api/dist/auth/guards/roles.guard.js
119326
- var import_common43 = __toESM(require_common(), 1);
119812
+ var import_common45 = __toESM(require_common(), 1);
119327
119813
  var import_core3 = __toESM(require_core3(), 1);
119328
- var __decorate68 = function(decorators, target, key, desc) {
119814
+ var __decorate70 = function(decorators, target, key, desc) {
119329
119815
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
119330
119816
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
119331
119817
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
119332
119818
  return c > 3 && r && Object.defineProperty(target, key, r), r;
119333
119819
  };
119334
- var __metadata53 = function(k, v) {
119820
+ var __metadata54 = function(k, v) {
119335
119821
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
119336
119822
  };
119337
119823
  var RolesGuard = class RolesGuard2 {
@@ -119355,15 +119841,15 @@ var RolesGuard = class RolesGuard2 {
119355
119841
  return requiredRoles.includes(user.role);
119356
119842
  }
119357
119843
  };
119358
- RolesGuard = __decorate68([
119359
- (0, import_common43.Injectable)(),
119360
- __metadata53("design:paramtypes", [import_core3.Reflector])
119844
+ RolesGuard = __decorate70([
119845
+ (0, import_common45.Injectable)(),
119846
+ __metadata54("design:paramtypes", [import_core3.Reflector])
119361
119847
  ], RolesGuard);
119362
119848
 
119363
119849
  // apps/api/dist/auth/guards/api-key.guard.js
119364
- var import_common44 = __toESM(require_common(), 1);
119850
+ var import_common46 = __toESM(require_common(), 1);
119365
119851
  var import_passport6 = __toESM(require_passport(), 1);
119366
- var __decorate69 = function(decorators, target, key, desc) {
119852
+ var __decorate71 = function(decorators, target, key, desc) {
119367
119853
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
119368
119854
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
119369
119855
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -119374,25 +119860,25 @@ var ApiKeyGuard = class ApiKeyGuard2 extends (0, import_passport6.AuthGuard)("ap
119374
119860
  return super.canActivate(context);
119375
119861
  }
119376
119862
  };
119377
- ApiKeyGuard = __decorate69([
119378
- (0, import_common44.Injectable)()
119863
+ ApiKeyGuard = __decorate71([
119864
+ (0, import_common46.Injectable)()
119379
119865
  ], ApiKeyGuard);
119380
119866
 
119381
119867
  // apps/api/dist/users/users.module.js
119382
- var import_common47 = __toESM(require_common(), 1);
119868
+ var import_common49 = __toESM(require_common(), 1);
119383
119869
 
119384
119870
  // apps/api/dist/users/users.controller.js
119385
- var import_common46 = __toESM(require_common(), 1);
119871
+ var import_common48 = __toESM(require_common(), 1);
119386
119872
 
119387
119873
  // apps/api/dist/users/users.service.js
119388
- var import_common45 = __toESM(require_common(), 1);
119389
- var __decorate70 = function(decorators, target, key, desc) {
119874
+ var import_common47 = __toESM(require_common(), 1);
119875
+ var __decorate72 = function(decorators, target, key, desc) {
119390
119876
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
119391
119877
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
119392
119878
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
119393
119879
  return c > 3 && r && Object.defineProperty(target, key, r), r;
119394
119880
  };
119395
- var __metadata54 = function(k, v) {
119881
+ var __metadata55 = function(k, v) {
119396
119882
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
119397
119883
  };
119398
119884
  var UsersService = class UsersService2 {
@@ -119411,7 +119897,7 @@ var UsersService = class UsersService2 {
119411
119897
  updateUserRole(id, role) {
119412
119898
  const user = this.metadataService.userRepository.update(id, { role });
119413
119899
  if (!user) {
119414
- throw new import_common45.NotFoundException("User not found");
119900
+ throw new import_common47.NotFoundException("User not found");
119415
119901
  }
119416
119902
  return this.sanitizeUser(user);
119417
119903
  }
@@ -119423,42 +119909,42 @@ var UsersService = class UsersService2 {
119423
119909
  return sanitized;
119424
119910
  }
119425
119911
  };
119426
- UsersService = __decorate70([
119427
- (0, import_common45.Injectable)(),
119428
- __metadata54("design:paramtypes", [MetadataService])
119912
+ UsersService = __decorate72([
119913
+ (0, import_common47.Injectable)(),
119914
+ __metadata55("design:paramtypes", [MetadataService])
119429
119915
  ], UsersService);
119430
119916
 
119431
119917
  // apps/api/dist/users/dto/update-user-role.dto.js
119432
119918
  var import_class_validator28 = __toESM(require_cjs(), 1);
119433
- var __decorate71 = function(decorators, target, key, desc) {
119919
+ var __decorate73 = function(decorators, target, key, desc) {
119434
119920
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
119435
119921
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
119436
119922
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
119437
119923
  return c > 3 && r && Object.defineProperty(target, key, r), r;
119438
119924
  };
119439
- var __metadata55 = function(k, v) {
119925
+ var __metadata56 = function(k, v) {
119440
119926
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
119441
119927
  };
119442
119928
  var UpdateUserRoleDto = class {
119443
119929
  role;
119444
119930
  };
119445
- __decorate71([
119931
+ __decorate73([
119446
119932
  (0, import_class_validator28.IsString)(),
119447
119933
  (0, import_class_validator28.IsIn)(["admin", "editor", "viewer"], { message: "Role must be admin, editor, or viewer" }),
119448
- __metadata55("design:type", String)
119934
+ __metadata56("design:type", String)
119449
119935
  ], UpdateUserRoleDto.prototype, "role", void 0);
119450
119936
 
119451
119937
  // apps/api/dist/users/users.controller.js
119452
- var __decorate72 = function(decorators, target, key, desc) {
119938
+ var __decorate74 = function(decorators, target, key, desc) {
119453
119939
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
119454
119940
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
119455
119941
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
119456
119942
  return c > 3 && r && Object.defineProperty(target, key, r), r;
119457
119943
  };
119458
- var __metadata56 = function(k, v) {
119944
+ var __metadata57 = function(k, v) {
119459
119945
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
119460
119946
  };
119461
- var __param13 = function(paramIndex, decorator) {
119947
+ var __param14 = function(paramIndex, decorator) {
119462
119948
  return function(target, key) {
119463
119949
  decorator(target, key, paramIndex);
119464
119950
  };
@@ -119476,13 +119962,13 @@ var UsersController = class UsersController2 {
119476
119962
  }
119477
119963
  async updateUserRole(userId, dto, currentUserId) {
119478
119964
  if (userId === currentUserId && dto.role !== "admin") {
119479
- throw new import_common46.ForbiddenException("Cannot demote yourself from admin");
119965
+ throw new import_common48.ForbiddenException("Cannot demote yourself from admin");
119480
119966
  }
119481
119967
  return this.usersService.updateUserRole(userId, dto.role);
119482
119968
  }
119483
119969
  async deleteUser(userId, currentUserId) {
119484
119970
  if (userId === currentUserId) {
119485
- throw new import_common46.ForbiddenException("Cannot delete your own account");
119971
+ throw new import_common48.ForbiddenException("Cannot delete your own account");
119486
119972
  }
119487
119973
  const deleted = await this.usersService.deleteUser(userId);
119488
119974
  return {
@@ -119491,48 +119977,48 @@ var UsersController = class UsersController2 {
119491
119977
  };
119492
119978
  }
119493
119979
  };
119494
- __decorate72([
119495
- (0, import_common46.Get)(),
119980
+ __decorate74([
119981
+ (0, import_common48.Get)(),
119496
119982
  Roles("admin"),
119497
- __metadata56("design:type", Function),
119498
- __metadata56("design:paramtypes", []),
119499
- __metadata56("design:returntype", Promise)
119983
+ __metadata57("design:type", Function),
119984
+ __metadata57("design:paramtypes", []),
119985
+ __metadata57("design:returntype", Promise)
119500
119986
  ], UsersController.prototype, "getAllUsers", null);
119501
- __decorate72([
119502
- (0, import_common46.Get)(":id"),
119987
+ __decorate74([
119988
+ (0, import_common48.Get)(":id"),
119503
119989
  Roles("admin"),
119504
- __param13(0, (0, import_common46.Param)("id")),
119505
- __metadata56("design:type", Function),
119506
- __metadata56("design:paramtypes", [String]),
119507
- __metadata56("design:returntype", Promise)
119990
+ __param14(0, (0, import_common48.Param)("id")),
119991
+ __metadata57("design:type", Function),
119992
+ __metadata57("design:paramtypes", [String]),
119993
+ __metadata57("design:returntype", Promise)
119508
119994
  ], UsersController.prototype, "getUser", null);
119509
- __decorate72([
119510
- (0, import_common46.Patch)(":id/role"),
119995
+ __decorate74([
119996
+ (0, import_common48.Patch)(":id/role"),
119511
119997
  Roles("admin"),
119512
- __param13(0, (0, import_common46.Param)("id")),
119513
- __param13(1, (0, import_common46.Body)()),
119514
- __param13(2, CurrentUser("id")),
119515
- __metadata56("design:type", Function),
119516
- __metadata56("design:paramtypes", [String, UpdateUserRoleDto, String]),
119517
- __metadata56("design:returntype", Promise)
119998
+ __param14(0, (0, import_common48.Param)("id")),
119999
+ __param14(1, (0, import_common48.Body)()),
120000
+ __param14(2, CurrentUser("id")),
120001
+ __metadata57("design:type", Function),
120002
+ __metadata57("design:paramtypes", [String, UpdateUserRoleDto, String]),
120003
+ __metadata57("design:returntype", Promise)
119518
120004
  ], UsersController.prototype, "updateUserRole", null);
119519
- __decorate72([
119520
- (0, import_common46.Delete)(":id"),
120005
+ __decorate74([
120006
+ (0, import_common48.Delete)(":id"),
119521
120007
  Roles("admin"),
119522
- (0, import_common46.HttpCode)(import_common46.HttpStatus.OK),
119523
- __param13(0, (0, import_common46.Param)("id")),
119524
- __param13(1, CurrentUser("id")),
119525
- __metadata56("design:type", Function),
119526
- __metadata56("design:paramtypes", [String, String]),
119527
- __metadata56("design:returntype", Promise)
120008
+ (0, import_common48.HttpCode)(import_common48.HttpStatus.OK),
120009
+ __param14(0, (0, import_common48.Param)("id")),
120010
+ __param14(1, CurrentUser("id")),
120011
+ __metadata57("design:type", Function),
120012
+ __metadata57("design:paramtypes", [String, String]),
120013
+ __metadata57("design:returntype", Promise)
119528
120014
  ], UsersController.prototype, "deleteUser", null);
119529
- UsersController = __decorate72([
119530
- (0, import_common46.Controller)("users"),
119531
- __metadata56("design:paramtypes", [UsersService])
120015
+ UsersController = __decorate74([
120016
+ (0, import_common48.Controller)("users"),
120017
+ __metadata57("design:paramtypes", [UsersService])
119532
120018
  ], UsersController);
119533
120019
 
119534
120020
  // apps/api/dist/users/users.module.js
119535
- var __decorate73 = function(decorators, target, key, desc) {
120021
+ var __decorate75 = function(decorators, target, key, desc) {
119536
120022
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
119537
120023
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
119538
120024
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -119540,8 +120026,8 @@ var __decorate73 = function(decorators, target, key, desc) {
119540
120026
  };
119541
120027
  var UsersModule = class UsersModule2 {
119542
120028
  };
119543
- UsersModule = __decorate73([
119544
- (0, import_common47.Module)({
120029
+ UsersModule = __decorate75([
120030
+ (0, import_common49.Module)({
119545
120031
  imports: [MetadataModule],
119546
120032
  controllers: [UsersController],
119547
120033
  providers: [UsersService],
@@ -119550,7 +120036,7 @@ UsersModule = __decorate73([
119550
120036
  ], UsersModule);
119551
120037
 
119552
120038
  // apps/api/dist/app.module.js
119553
- var __decorate74 = function(decorators, target, key, desc) {
120039
+ var __decorate76 = function(decorators, target, key, desc) {
119554
120040
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
119555
120041
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
119556
120042
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -119559,8 +120045,8 @@ var __decorate74 = function(decorators, target, key, desc) {
119559
120045
  var __dirname = fileURLToPath(new URL(".", import.meta.url));
119560
120046
  var AppModule = class AppModule2 {
119561
120047
  };
119562
- AppModule = __decorate74([
119563
- (0, import_common48.Module)({
120048
+ AppModule = __decorate76([
120049
+ (0, import_common50.Module)({
119564
120050
  imports: [
119565
120051
  // Serve static files from web build in production
119566
120052
  ...true ? [
@@ -119582,6 +120068,7 @@ AppModule = __decorate74([
119582
120068
  BackupModule,
119583
120069
  ServersModule,
119584
120070
  SettingsModule,
120071
+ PreferencesModule,
119585
120072
  UsersModule
119586
120073
  ],
119587
120074
  providers: [
@@ -119604,13 +120091,13 @@ import * as fs6 from "node:fs";
119604
120091
  var __filename = fileURLToPath2(import.meta.url);
119605
120092
  var __dirname2 = path4.dirname(__filename);
119606
120093
  async function bootstrap() {
119607
- const logger = new import_common49.Logger("Bootstrap");
120094
+ const logger = new import_common51.Logger("Bootstrap");
119608
120095
  const app = await import_core5.NestFactory.create(AppModule, {
119609
120096
  bodyParser: true
119610
120097
  });
119611
120098
  app.useBodyParser("json", { limit: "50mb" });
119612
120099
  app.useBodyParser("urlencoded", { limit: "50mb", extended: true });
119613
- app.useGlobalPipes(new import_common49.ValidationPipe({
120100
+ app.useGlobalPipes(new import_common51.ValidationPipe({
119614
120101
  whitelist: true,
119615
120102
  // Strip properties not in DTO
119616
120103
  forbidNonWhitelisted: true,