@noxfly/noxus 3.0.0-dev.7 → 3.0.0-dev.9

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.mjs CHANGED
@@ -1086,6 +1086,7 @@ var Router = class {
1086
1086
  this.routes = new RadixTree();
1087
1087
  this.rootMiddlewares = [];
1088
1088
  this.lazyRoutes = /* @__PURE__ */ new Map();
1089
+ this.lazyLoadLock = Promise.resolve();
1089
1090
  }
1090
1091
  // -------------------------------------------------------------------------
1091
1092
  // Registration
@@ -1214,15 +1215,19 @@ var Router = class {
1214
1215
  }
1215
1216
  }
1216
1217
  }
1217
- async loadLazyModule(prefix, entry) {
1218
- const t0 = performance.now();
1219
- InjectorExplorer.beginAccumulate();
1220
- await entry.load?.();
1221
- entry.loading = null;
1222
- entry.load = null;
1223
- await InjectorExplorer.flushAccumulated(entry.guards, entry.middlewares, prefix);
1224
- entry.loaded = true;
1225
- Logger.info(`Lazy-loaded module for prefix {${prefix}} in ${Math.round(performance.now() - t0)}ms`);
1218
+ loadLazyModule(prefix, entry) {
1219
+ const task = this.lazyLoadLock.then(async () => {
1220
+ const t0 = performance.now();
1221
+ InjectorExplorer.beginAccumulate();
1222
+ await entry.load?.();
1223
+ entry.load = null;
1224
+ await InjectorExplorer.flushAccumulated(entry.guards, entry.middlewares, prefix);
1225
+ entry.loaded = true;
1226
+ entry.loading = null;
1227
+ Logger.info(`Lazy-loaded module for prefix {${prefix}} in ${Math.round(performance.now() - t0)}ms`);
1228
+ });
1229
+ this.lazyLoadLock = task;
1230
+ return task;
1226
1231
  }
1227
1232
  // -------------------------------------------------------------------------
1228
1233
  // Pipeline
@@ -1286,13 +1291,13 @@ var Router = class {
1286
1291
  }
1287
1292
  normalizeBatchItem(entry, index) {
1288
1293
  if (entry === null || typeof entry !== "object") throw new BadRequestException(`Batch request at index ${index} must be an object.`);
1289
- const { requestId, path: path2, method, body } = entry;
1294
+ const { requestId, path: path2, method, body, query } = entry;
1290
1295
  if (requestId !== void 0 && typeof requestId !== "string") throw new BadRequestException(`Batch request at index ${index} has an invalid requestId.`);
1291
1296
  if (typeof path2 !== "string" || !path2.length) throw new BadRequestException(`Batch request at index ${index} must define a non-empty path.`);
1292
1297
  if (typeof method !== "string") throw new BadRequestException(`Batch request at index ${index} must define an HTTP method.`);
1293
1298
  const normalized = method.toUpperCase();
1294
1299
  if (!isAtomicHttpMethod(normalized)) throw new BadRequestException(`Batch request at index ${index} uses unsupported method ${method}.`);
1295
- return { requestId, path: path2, method: normalized, body };
1300
+ return { requestId, path: path2, method: normalized, body, query };
1296
1301
  }
1297
1302
  fillErrorResponse(response, error, setCritical) {
1298
1303
  response.body = void 0;