@noxfly/noxus 3.0.0-dev.10 → 3.0.0-dev.12

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/main.js CHANGED
@@ -10,6 +10,11 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
10
10
  var __getOwnPropNames = Object.getOwnPropertyNames;
11
11
  var __getProtoOf = Object.getPrototypeOf;
12
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
+ var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
14
+ var __typeError = (msg) => {
15
+ throw TypeError(msg);
16
+ };
17
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
18
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
14
19
  var __esm = (fn, res) => function __init() {
15
20
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
@@ -35,14 +40,45 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
35
40
  mod
36
41
  ));
37
42
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
- var __decorateClass = (decorators, target, key, kind) => {
39
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
40
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
41
- if (decorator = decorators[i])
42
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
43
- if (kind && result) __defProp(target, key, result);
44
- return result;
43
+ var __decoratorStart = (base) => [, , , __create(base?.[__knownSymbol("metadata")] ?? null)];
44
+ var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
45
+ var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
46
+ var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
47
+ var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
48
+ var __runInitializers = (array, flags, self, value) => {
49
+ for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
50
+ return value;
45
51
  };
52
+ var __decorateElement = (array, flags, name, decorators, target, extra) => {
53
+ var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
54
+ var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
55
+ var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
56
+ var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
57
+ return __privateGet(this, extra);
58
+ }, set [name](x) {
59
+ return __privateSet(this, extra, x);
60
+ } }, name));
61
+ k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
62
+ for (var i = decorators.length - 1; i >= 0; i--) {
63
+ ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
64
+ if (k) {
65
+ ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
66
+ if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
67
+ if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
68
+ }
69
+ it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
70
+ if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
71
+ else if (typeof it !== "object" || it === null) __typeError("Object expected");
72
+ else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
73
+ }
74
+ return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
75
+ };
76
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
77
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
78
+ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
79
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
80
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
81
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
46
82
 
47
83
  // src/utils/forward-ref.ts
48
84
  function forwardRef(fn) {
@@ -74,6 +110,7 @@ var init_token = __esm({
74
110
  _Token = class _Token {
75
111
  constructor(target) {
76
112
  this.target = target;
113
+ __publicField(this, "description");
77
114
  this.description = typeof target === "string" ? target : target.name;
78
115
  }
79
116
  toString() {
@@ -466,11 +503,11 @@ var init_injector_explorer = __esm({
466
503
  }
467
504
  };
468
505
  __name(_InjectorExplorer, "InjectorExplorer");
469
- _InjectorExplorer.pending = [];
470
- _InjectorExplorer.processed = false;
471
- _InjectorExplorer.accumulating = false;
472
- _InjectorExplorer.loadingLock = Promise.resolve();
473
- _InjectorExplorer.controllerRegistrar = null;
506
+ __publicField(_InjectorExplorer, "pending", []);
507
+ __publicField(_InjectorExplorer, "processed", false);
508
+ __publicField(_InjectorExplorer, "accumulating", false);
509
+ __publicField(_InjectorExplorer, "loadingLock", Promise.resolve());
510
+ __publicField(_InjectorExplorer, "controllerRegistrar", null);
474
511
  InjectorExplorer = _InjectorExplorer;
475
512
  }
476
513
  });
@@ -499,9 +536,9 @@ var init_app_injector = __esm({
499
536
  _AppInjector = class _AppInjector {
500
537
  constructor(name = null) {
501
538
  this.name = name;
502
- this.bindings = /* @__PURE__ */ new Map();
503
- this.singletons = /* @__PURE__ */ new Map();
504
- this.scoped = /* @__PURE__ */ new Map();
539
+ __publicField(this, "bindings", /* @__PURE__ */ new Map());
540
+ __publicField(this, "singletons", /* @__PURE__ */ new Map());
541
+ __publicField(this, "scoped", /* @__PURE__ */ new Map());
505
542
  }
506
543
  /**
507
544
  * Creates a child scope for per-request lifetime resolution.
@@ -657,7 +694,7 @@ init_token();
657
694
  init_injector_explorer();
658
695
  var controllerMetaMap = /* @__PURE__ */ new WeakMap();
659
696
  function Controller(options = {}) {
660
- return (target) => {
697
+ return (target, _context) => {
661
698
  const meta = {
662
699
  deps: options.deps ?? []
663
700
  };
@@ -682,10 +719,7 @@ init_injector_explorer();
682
719
  init_token();
683
720
  function Injectable(options = {}) {
684
721
  const { lifetime = "scope", deps = [] } = options;
685
- return (target) => {
686
- if (typeof target !== "function" || !target.prototype) {
687
- throw new Error(`@Injectable can only be applied to classes, not ${typeof target}`);
688
- }
722
+ return (target, _context) => {
689
723
  const key = target;
690
724
  InjectorExplorer.enqueue({
691
725
  key,
@@ -704,26 +738,34 @@ function isAtomicHttpMethod(m) {
704
738
  return typeof m === "string" && ATOMIC_METHODS.has(m);
705
739
  }
706
740
  __name(isAtomicHttpMethod, "isAtomicHttpMethod");
707
- var routeMetaMap = /* @__PURE__ */ new WeakMap();
741
+ var methodMeta = /* @__PURE__ */ new WeakMap();
708
742
  function createRouteDecorator(verb) {
709
743
  return (path2, options = {}) => {
710
- return (target, propertyKey) => {
711
- const ctor = target.constructor;
712
- const existing = routeMetaMap.get(ctor) ?? [];
713
- existing.push({
744
+ return (value, context) => {
745
+ methodMeta.set(value, {
714
746
  method: verb,
715
747
  path: (path2 ?? "").trim().replace(/^\/|\/$/g, ""),
716
- handler: propertyKey,
748
+ handler: context.name,
717
749
  guards: options.guards ?? [],
718
750
  middlewares: options.middlewares ?? []
719
751
  });
720
- routeMetaMap.set(ctor, existing);
721
752
  };
722
753
  };
723
754
  }
724
755
  __name(createRouteDecorator, "createRouteDecorator");
725
756
  function getRouteMetadata(target) {
726
- return routeMetaMap.get(target) ?? [];
757
+ const routes = [];
758
+ const proto = target.prototype;
759
+ for (const key of Object.getOwnPropertyNames(proto)) {
760
+ const fn = proto[key];
761
+ if (typeof fn === "function" && methodMeta.has(fn)) {
762
+ const meta = methodMeta.get(fn);
763
+ if (meta) {
764
+ routes.push(meta);
765
+ }
766
+ }
767
+ }
768
+ return routes;
727
769
  }
728
770
  __name(getRouteMetadata, "getRouteMetadata");
729
771
  var Get = createRouteDecorator("GET");
@@ -743,7 +785,11 @@ var _RadixNode = class _RadixNode {
743
785
  * @param segment - The segment of the path this node represents.
744
786
  */
745
787
  constructor(segment) {
746
- this.children = [];
788
+ __publicField(this, "segment");
789
+ __publicField(this, "children", []);
790
+ __publicField(this, "value");
791
+ __publicField(this, "isParam");
792
+ __publicField(this, "paramName");
747
793
  this.segment = segment;
748
794
  this.isParam = segment.startsWith(":");
749
795
  if (this.isParam) {
@@ -785,7 +831,7 @@ __name(_RadixNode, "RadixNode");
785
831
  var RadixNode = _RadixNode;
786
832
  var _RadixTree = class _RadixTree {
787
833
  constructor() {
788
- this.root = new RadixNode("");
834
+ __publicField(this, "root", new RadixNode(""));
789
835
  }
790
836
  /**
791
837
  * Inserts a path and its associated value into the Radix Tree.
@@ -918,7 +964,7 @@ var _ResponseException = class _ResponseException extends Error {
918
964
  message = statusOrMessage;
919
965
  }
920
966
  super(message ?? "");
921
- this.status = 0;
967
+ __publicField(this, "status", 0);
922
968
  if (statusCode !== void 0) {
923
969
  this.status = statusCode;
924
970
  }
@@ -930,7 +976,7 @@ var ResponseException = _ResponseException;
930
976
  var _BadRequestException = class _BadRequestException extends ResponseException {
931
977
  constructor() {
932
978
  super(...arguments);
933
- this.status = 400;
979
+ __publicField(this, "status", 400);
934
980
  }
935
981
  };
936
982
  __name(_BadRequestException, "BadRequestException");
@@ -938,7 +984,7 @@ var BadRequestException = _BadRequestException;
938
984
  var _UnauthorizedException = class _UnauthorizedException extends ResponseException {
939
985
  constructor() {
940
986
  super(...arguments);
941
- this.status = 401;
987
+ __publicField(this, "status", 401);
942
988
  }
943
989
  };
944
990
  __name(_UnauthorizedException, "UnauthorizedException");
@@ -946,7 +992,7 @@ var UnauthorizedException = _UnauthorizedException;
946
992
  var _PaymentRequiredException = class _PaymentRequiredException extends ResponseException {
947
993
  constructor() {
948
994
  super(...arguments);
949
- this.status = 402;
995
+ __publicField(this, "status", 402);
950
996
  }
951
997
  };
952
998
  __name(_PaymentRequiredException, "PaymentRequiredException");
@@ -954,7 +1000,7 @@ var PaymentRequiredException = _PaymentRequiredException;
954
1000
  var _ForbiddenException = class _ForbiddenException extends ResponseException {
955
1001
  constructor() {
956
1002
  super(...arguments);
957
- this.status = 403;
1003
+ __publicField(this, "status", 403);
958
1004
  }
959
1005
  };
960
1006
  __name(_ForbiddenException, "ForbiddenException");
@@ -962,7 +1008,7 @@ var ForbiddenException = _ForbiddenException;
962
1008
  var _NotFoundException = class _NotFoundException extends ResponseException {
963
1009
  constructor() {
964
1010
  super(...arguments);
965
- this.status = 404;
1011
+ __publicField(this, "status", 404);
966
1012
  }
967
1013
  };
968
1014
  __name(_NotFoundException, "NotFoundException");
@@ -970,7 +1016,7 @@ var NotFoundException = _NotFoundException;
970
1016
  var _MethodNotAllowedException = class _MethodNotAllowedException extends ResponseException {
971
1017
  constructor() {
972
1018
  super(...arguments);
973
- this.status = 405;
1019
+ __publicField(this, "status", 405);
974
1020
  }
975
1021
  };
976
1022
  __name(_MethodNotAllowedException, "MethodNotAllowedException");
@@ -978,7 +1024,7 @@ var MethodNotAllowedException = _MethodNotAllowedException;
978
1024
  var _NotAcceptableException = class _NotAcceptableException extends ResponseException {
979
1025
  constructor() {
980
1026
  super(...arguments);
981
- this.status = 406;
1027
+ __publicField(this, "status", 406);
982
1028
  }
983
1029
  };
984
1030
  __name(_NotAcceptableException, "NotAcceptableException");
@@ -986,7 +1032,7 @@ var NotAcceptableException = _NotAcceptableException;
986
1032
  var _RequestTimeoutException = class _RequestTimeoutException extends ResponseException {
987
1033
  constructor() {
988
1034
  super(...arguments);
989
- this.status = 408;
1035
+ __publicField(this, "status", 408);
990
1036
  }
991
1037
  };
992
1038
  __name(_RequestTimeoutException, "RequestTimeoutException");
@@ -994,7 +1040,7 @@ var RequestTimeoutException = _RequestTimeoutException;
994
1040
  var _ConflictException = class _ConflictException extends ResponseException {
995
1041
  constructor() {
996
1042
  super(...arguments);
997
- this.status = 409;
1043
+ __publicField(this, "status", 409);
998
1044
  }
999
1045
  };
1000
1046
  __name(_ConflictException, "ConflictException");
@@ -1002,7 +1048,7 @@ var ConflictException = _ConflictException;
1002
1048
  var _UpgradeRequiredException = class _UpgradeRequiredException extends ResponseException {
1003
1049
  constructor() {
1004
1050
  super(...arguments);
1005
- this.status = 426;
1051
+ __publicField(this, "status", 426);
1006
1052
  }
1007
1053
  };
1008
1054
  __name(_UpgradeRequiredException, "UpgradeRequiredException");
@@ -1010,7 +1056,7 @@ var UpgradeRequiredException = _UpgradeRequiredException;
1010
1056
  var _TooManyRequestsException = class _TooManyRequestsException extends ResponseException {
1011
1057
  constructor() {
1012
1058
  super(...arguments);
1013
- this.status = 429;
1059
+ __publicField(this, "status", 429);
1014
1060
  }
1015
1061
  };
1016
1062
  __name(_TooManyRequestsException, "TooManyRequestsException");
@@ -1018,7 +1064,7 @@ var TooManyRequestsException = _TooManyRequestsException;
1018
1064
  var _InternalServerException = class _InternalServerException extends ResponseException {
1019
1065
  constructor() {
1020
1066
  super(...arguments);
1021
- this.status = 500;
1067
+ __publicField(this, "status", 500);
1022
1068
  }
1023
1069
  };
1024
1070
  __name(_InternalServerException, "InternalServerException");
@@ -1026,7 +1072,7 @@ var InternalServerException = _InternalServerException;
1026
1072
  var _NotImplementedException = class _NotImplementedException extends ResponseException {
1027
1073
  constructor() {
1028
1074
  super(...arguments);
1029
- this.status = 501;
1075
+ __publicField(this, "status", 501);
1030
1076
  }
1031
1077
  };
1032
1078
  __name(_NotImplementedException, "NotImplementedException");
@@ -1034,7 +1080,7 @@ var NotImplementedException = _NotImplementedException;
1034
1080
  var _BadGatewayException = class _BadGatewayException extends ResponseException {
1035
1081
  constructor() {
1036
1082
  super(...arguments);
1037
- this.status = 502;
1083
+ __publicField(this, "status", 502);
1038
1084
  }
1039
1085
  };
1040
1086
  __name(_BadGatewayException, "BadGatewayException");
@@ -1042,7 +1088,7 @@ var BadGatewayException = _BadGatewayException;
1042
1088
  var _ServiceUnavailableException = class _ServiceUnavailableException extends ResponseException {
1043
1089
  constructor() {
1044
1090
  super(...arguments);
1045
- this.status = 503;
1091
+ __publicField(this, "status", 503);
1046
1092
  }
1047
1093
  };
1048
1094
  __name(_ServiceUnavailableException, "ServiceUnavailableException");
@@ -1050,7 +1096,7 @@ var ServiceUnavailableException = _ServiceUnavailableException;
1050
1096
  var _GatewayTimeoutException = class _GatewayTimeoutException extends ResponseException {
1051
1097
  constructor() {
1052
1098
  super(...arguments);
1053
- this.status = 504;
1099
+ __publicField(this, "status", 504);
1054
1100
  }
1055
1101
  };
1056
1102
  __name(_GatewayTimeoutException, "GatewayTimeoutException");
@@ -1058,7 +1104,7 @@ var GatewayTimeoutException = _GatewayTimeoutException;
1058
1104
  var _HttpVersionNotSupportedException = class _HttpVersionNotSupportedException extends ResponseException {
1059
1105
  constructor() {
1060
1106
  super(...arguments);
1061
- this.status = 505;
1107
+ __publicField(this, "status", 505);
1062
1108
  }
1063
1109
  };
1064
1110
  __name(_HttpVersionNotSupportedException, "HttpVersionNotSupportedException");
@@ -1066,7 +1112,7 @@ var HttpVersionNotSupportedException = _HttpVersionNotSupportedException;
1066
1112
  var _VariantAlsoNegotiatesException = class _VariantAlsoNegotiatesException extends ResponseException {
1067
1113
  constructor() {
1068
1114
  super(...arguments);
1069
- this.status = 506;
1115
+ __publicField(this, "status", 506);
1070
1116
  }
1071
1117
  };
1072
1118
  __name(_VariantAlsoNegotiatesException, "VariantAlsoNegotiatesException");
@@ -1074,7 +1120,7 @@ var VariantAlsoNegotiatesException = _VariantAlsoNegotiatesException;
1074
1120
  var _InsufficientStorageException = class _InsufficientStorageException extends ResponseException {
1075
1121
  constructor() {
1076
1122
  super(...arguments);
1077
- this.status = 507;
1123
+ __publicField(this, "status", 507);
1078
1124
  }
1079
1125
  };
1080
1126
  __name(_InsufficientStorageException, "InsufficientStorageException");
@@ -1082,7 +1128,7 @@ var InsufficientStorageException = _InsufficientStorageException;
1082
1128
  var _LoopDetectedException = class _LoopDetectedException extends ResponseException {
1083
1129
  constructor() {
1084
1130
  super(...arguments);
1085
- this.status = 508;
1131
+ __publicField(this, "status", 508);
1086
1132
  }
1087
1133
  };
1088
1134
  __name(_LoopDetectedException, "LoopDetectedException");
@@ -1090,7 +1136,7 @@ var LoopDetectedException = _LoopDetectedException;
1090
1136
  var _NotExtendedException = class _NotExtendedException extends ResponseException {
1091
1137
  constructor() {
1092
1138
  super(...arguments);
1093
- this.status = 510;
1139
+ __publicField(this, "status", 510);
1094
1140
  }
1095
1141
  };
1096
1142
  __name(_NotExtendedException, "NotExtendedException");
@@ -1098,7 +1144,7 @@ var NotExtendedException = _NotExtendedException;
1098
1144
  var _NetworkAuthenticationRequiredException = class _NetworkAuthenticationRequiredException extends ResponseException {
1099
1145
  constructor() {
1100
1146
  super(...arguments);
1101
- this.status = 511;
1147
+ __publicField(this, "status", 511);
1102
1148
  }
1103
1149
  };
1104
1150
  __name(_NetworkAuthenticationRequiredException, "NetworkAuthenticationRequiredException");
@@ -1106,7 +1152,7 @@ var NetworkAuthenticationRequiredException = _NetworkAuthenticationRequiredExcep
1106
1152
  var _NetworkConnectTimeoutException = class _NetworkConnectTimeoutException extends ResponseException {
1107
1153
  constructor() {
1108
1154
  super(...arguments);
1109
- this.status = 599;
1155
+ __publicField(this, "status", 599);
1110
1156
  }
1111
1157
  };
1112
1158
  __name(_NetworkConnectTimeoutException, "NetworkConnectTimeoutException");
@@ -1122,8 +1168,9 @@ var _Request = class _Request {
1122
1168
  this.method = method;
1123
1169
  this.path = path2;
1124
1170
  this.body = body;
1125
- this.context = RootInjector.createScope();
1126
- this.params = {};
1171
+ __publicField(this, "context", RootInjector.createScope());
1172
+ __publicField(this, "params", {});
1173
+ __publicField(this, "query");
1127
1174
  this.path = path2.replace(/^\/|\/$/g, "");
1128
1175
  this.query = query ?? {};
1129
1176
  }
@@ -1149,12 +1196,14 @@ function isRendererEventMessage(value) {
1149
1196
  __name(isRendererEventMessage, "isRendererEventMessage");
1150
1197
 
1151
1198
  // src/internal/router.ts
1152
- var Router = class {
1199
+ var _Router_decorators, _init;
1200
+ _Router_decorators = [Injectable({ lifetime: "singleton" })];
1201
+ var _Router = class _Router {
1153
1202
  constructor() {
1154
- this.routes = new RadixTree();
1155
- this.rootMiddlewares = [];
1156
- this.lazyRoutes = /* @__PURE__ */ new Map();
1157
- this.lazyLoadLock = Promise.resolve();
1203
+ __publicField(this, "routes", new RadixTree());
1204
+ __publicField(this, "rootMiddlewares", []);
1205
+ __publicField(this, "lazyRoutes", /* @__PURE__ */ new Map());
1206
+ __publicField(this, "lazyLoadLock", Promise.resolve());
1158
1207
  }
1159
1208
  // -------------------------------------------------------------------------
1160
1209
  // Registration
@@ -1272,17 +1321,31 @@ var Router = class {
1272
1321
  throw new NotFoundException(`No route matches ${request.method} ${request.path}`);
1273
1322
  }
1274
1323
  async tryLoadLazyRoute(requestPath) {
1275
- const firstSegment = requestPath.replace(/^\/+/, "").split("/")[0] ?? "";
1324
+ const normalized = requestPath.replace(/^\/+/, "");
1276
1325
  for (const [prefix, entry] of this.lazyRoutes) {
1277
1326
  if (entry.loaded) continue;
1278
- const normalized = requestPath.replace(/^\/+/, "");
1279
- if (normalized === prefix || normalized.startsWith(prefix + "/") || firstSegment === prefix) {
1327
+ if (this.pathHasPrefix(normalized, prefix)) {
1280
1328
  if (!entry.loading) entry.loading = this.loadLazyModule(prefix, entry);
1281
1329
  await entry.loading;
1282
1330
  return;
1283
1331
  }
1284
1332
  }
1285
1333
  }
1334
+ /**
1335
+ * Returns true when `requestPath` starts with `prefix`, treating `:param`
1336
+ * segments in the prefix as single-segment wildcards.
1337
+ *
1338
+ * @example
1339
+ * pathHasPrefix('contact/123/notes', 'contact/:id/notes') // true
1340
+ * pathHasPrefix('contact/123/notes/get', 'contact/:id/notes') // true
1341
+ * pathHasPrefix('contact/123', 'contact/:id/notes') // false
1342
+ */
1343
+ pathHasPrefix(requestPath, prefix) {
1344
+ const reqSegments = requestPath.split("/");
1345
+ const prefixSegments = prefix.split("/");
1346
+ if (reqSegments.length < prefixSegments.length) return false;
1347
+ return prefixSegments.every((seg, i) => seg.startsWith(":") || seg === reqSegments[i]);
1348
+ }
1286
1349
  loadLazyModule(prefix, entry) {
1287
1350
  const task = this.lazyLoadLock.then(async () => {
1288
1351
  const t0 = performance.now();
@@ -1395,10 +1458,11 @@ var Router = class {
1395
1458
  }
1396
1459
  }
1397
1460
  };
1398
- __name(Router, "Router");
1399
- Router = __decorateClass([
1400
- Injectable({ lifetime: "singleton" })
1401
- ], Router);
1461
+ _init = __decoratorStart(null);
1462
+ _Router = __decorateElement(_init, 0, "Router", _Router_decorators, _Router);
1463
+ __name(_Router, "Router");
1464
+ __runInitializers(_init, 1, _Router);
1465
+ var Router = _Router;
1402
1466
 
1403
1467
  // src/internal/app.ts
1404
1468
  var import_main2 = require("electron/main");
@@ -1409,10 +1473,13 @@ init_logger();
1409
1473
  // src/window/window-manager.ts
1410
1474
  var import_main = require("electron/main");
1411
1475
  init_logger();
1412
- var WindowManager = class {
1476
+ var _WindowManager_decorators, _init2;
1477
+ _WindowManager_decorators = [Injectable({ lifetime: "singleton" })];
1478
+ var _WindowManager = class _WindowManager {
1413
1479
  constructor() {
1414
- this._windows = /* @__PURE__ */ new Map();
1415
- this.listeners = /* @__PURE__ */ new Map();
1480
+ __publicField(this, "_windows", /* @__PURE__ */ new Map());
1481
+ __publicField(this, "listeners", /* @__PURE__ */ new Map());
1482
+ __publicField(this, "_mainWindowId");
1416
1483
  }
1417
1484
  // -------------------------------------------------------------------------
1418
1485
  // Creation
@@ -1597,16 +1664,19 @@ var WindowManager = class {
1597
1664
  });
1598
1665
  }
1599
1666
  };
1600
- __name(WindowManager, "WindowManager");
1601
- WindowManager = __decorateClass([
1602
- Injectable({ lifetime: "singleton" })
1603
- ], WindowManager);
1667
+ _init2 = __decoratorStart(null);
1668
+ _WindowManager = __decorateElement(_init2, 0, "WindowManager", _WindowManager_decorators, _WindowManager);
1669
+ __name(_WindowManager, "WindowManager");
1670
+ __runInitializers(_init2, 1, _WindowManager);
1671
+ var WindowManager = _WindowManager;
1604
1672
 
1605
1673
  // src/internal/socket.ts
1606
1674
  init_logger();
1607
- var NoxSocket = class {
1675
+ var _NoxSocket_decorators, _init3;
1676
+ _NoxSocket_decorators = [Injectable({ lifetime: "singleton" })];
1677
+ var _NoxSocket = class _NoxSocket {
1608
1678
  constructor() {
1609
- this.channels = /* @__PURE__ */ new Map();
1679
+ __publicField(this, "channels", /* @__PURE__ */ new Map());
1610
1680
  }
1611
1681
  register(senderId, requestChannel, socketChannel) {
1612
1682
  this.channels.set(senderId, { request: requestChannel, socket: socketChannel });
@@ -1647,21 +1717,25 @@ var NoxSocket = class {
1647
1717
  return true;
1648
1718
  }
1649
1719
  };
1650
- __name(NoxSocket, "NoxSocket");
1651
- NoxSocket = __decorateClass([
1652
- Injectable({ lifetime: "singleton" })
1653
- ], NoxSocket);
1720
+ _init3 = __decoratorStart(null);
1721
+ _NoxSocket = __decorateElement(_init3, 0, "NoxSocket", _NoxSocket_decorators, _NoxSocket);
1722
+ __name(_NoxSocket, "NoxSocket");
1723
+ __runInitializers(_init3, 1, _NoxSocket);
1724
+ var NoxSocket = _NoxSocket;
1654
1725
 
1655
1726
  // src/internal/app.ts
1656
- var NoxApp = class {
1727
+ var _NoxApp_decorators, _init4;
1728
+ _NoxApp_decorators = [Injectable({ lifetime: "singleton", deps: [Router, NoxSocket, WindowManager] })];
1729
+ var _NoxApp = class _NoxApp {
1657
1730
  constructor(router, socket, windowManager) {
1658
1731
  this.router = router;
1659
1732
  this.socket = socket;
1660
1733
  this.windowManager = windowManager;
1734
+ __publicField(this, "appService");
1661
1735
  // -------------------------------------------------------------------------
1662
1736
  // IPC
1663
1737
  // -------------------------------------------------------------------------
1664
- this.onRendererMessage = /* @__PURE__ */ __name(async (event) => {
1738
+ __publicField(this, "onRendererMessage", /* @__PURE__ */ __name(async (event) => {
1665
1739
  const { senderId, requestId, path: path2, method, body, query } = event.data;
1666
1740
  const channels = this.socket.get(senderId);
1667
1741
  if (!channels) {
@@ -1681,7 +1755,7 @@ var NoxApp = class {
1681
1755
  };
1682
1756
  channels.request.port1.postMessage(response);
1683
1757
  }
1684
- }, "onRendererMessage");
1758
+ }, "onRendererMessage"));
1685
1759
  }
1686
1760
  // -------------------------------------------------------------------------
1687
1761
  // Initialisation
@@ -1789,10 +1863,11 @@ var NoxApp = class {
1789
1863
  this.socket.unregister(channelSenderId);
1790
1864
  }
1791
1865
  };
1792
- __name(NoxApp, "NoxApp");
1793
- NoxApp = __decorateClass([
1794
- Injectable({ lifetime: "singleton", deps: [Router, NoxSocket, WindowManager] })
1795
- ], NoxApp);
1866
+ _init4 = __decoratorStart(null);
1867
+ _NoxApp = __decorateElement(_init4, 0, "NoxApp", _NoxApp_decorators, _NoxApp);
1868
+ __name(_NoxApp, "NoxApp");
1869
+ __runInitializers(_init4, 1, _NoxApp);
1870
+ var NoxApp = _NoxApp;
1796
1871
 
1797
1872
  // src/internal/bootstrap.ts
1798
1873
  var import_main3 = require("electron/main");