@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.d.mts +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +16 -11
- package/dist/main.js.map +1 -1
- package/dist/main.mjs +16 -11
- package/dist/main.mjs.map +1 -1
- package/package.json +1 -1
package/dist/main.d.mts
CHANGED
|
@@ -258,6 +258,7 @@ declare class Router {
|
|
|
258
258
|
private readonly routes;
|
|
259
259
|
private readonly rootMiddlewares;
|
|
260
260
|
private readonly lazyRoutes;
|
|
261
|
+
private lazyLoadLock;
|
|
261
262
|
registerController(controllerClass: Type<unknown>, pathPrefix: string, routeGuards?: Guard[], routeMiddlewares?: Middleware[]): this;
|
|
262
263
|
registerLazyRoute(pathPrefix: string, load: () => Promise<unknown>, guards?: Guard[], middlewares?: Middleware[]): this;
|
|
263
264
|
defineRootMiddleware(middleware: Middleware): this;
|
package/dist/main.d.ts
CHANGED
|
@@ -258,6 +258,7 @@ declare class Router {
|
|
|
258
258
|
private readonly routes;
|
|
259
259
|
private readonly rootMiddlewares;
|
|
260
260
|
private readonly lazyRoutes;
|
|
261
|
+
private lazyLoadLock;
|
|
261
262
|
registerController(controllerClass: Type<unknown>, pathPrefix: string, routeGuards?: Guard[], routeMiddlewares?: Middleware[]): this;
|
|
262
263
|
registerLazyRoute(pathPrefix: string, load: () => Promise<unknown>, guards?: Guard[], middlewares?: Middleware[]): this;
|
|
263
264
|
defineRootMiddleware(middleware: Middleware): this;
|
package/dist/main.js
CHANGED
|
@@ -1154,6 +1154,7 @@ var Router = class {
|
|
|
1154
1154
|
this.routes = new RadixTree();
|
|
1155
1155
|
this.rootMiddlewares = [];
|
|
1156
1156
|
this.lazyRoutes = /* @__PURE__ */ new Map();
|
|
1157
|
+
this.lazyLoadLock = Promise.resolve();
|
|
1157
1158
|
}
|
|
1158
1159
|
// -------------------------------------------------------------------------
|
|
1159
1160
|
// Registration
|
|
@@ -1282,15 +1283,19 @@ var Router = class {
|
|
|
1282
1283
|
}
|
|
1283
1284
|
}
|
|
1284
1285
|
}
|
|
1285
|
-
|
|
1286
|
-
const
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1286
|
+
loadLazyModule(prefix, entry) {
|
|
1287
|
+
const task = this.lazyLoadLock.then(async () => {
|
|
1288
|
+
const t0 = performance.now();
|
|
1289
|
+
InjectorExplorer.beginAccumulate();
|
|
1290
|
+
await entry.load?.();
|
|
1291
|
+
entry.load = null;
|
|
1292
|
+
await InjectorExplorer.flushAccumulated(entry.guards, entry.middlewares, prefix);
|
|
1293
|
+
entry.loaded = true;
|
|
1294
|
+
entry.loading = null;
|
|
1295
|
+
Logger.info(`Lazy-loaded module for prefix {${prefix}} in ${Math.round(performance.now() - t0)}ms`);
|
|
1296
|
+
});
|
|
1297
|
+
this.lazyLoadLock = task;
|
|
1298
|
+
return task;
|
|
1294
1299
|
}
|
|
1295
1300
|
// -------------------------------------------------------------------------
|
|
1296
1301
|
// Pipeline
|
|
@@ -1354,13 +1359,13 @@ var Router = class {
|
|
|
1354
1359
|
}
|
|
1355
1360
|
normalizeBatchItem(entry, index) {
|
|
1356
1361
|
if (entry === null || typeof entry !== "object") throw new BadRequestException(`Batch request at index ${index} must be an object.`);
|
|
1357
|
-
const { requestId, path: path2, method, body } = entry;
|
|
1362
|
+
const { requestId, path: path2, method, body, query } = entry;
|
|
1358
1363
|
if (requestId !== void 0 && typeof requestId !== "string") throw new BadRequestException(`Batch request at index ${index} has an invalid requestId.`);
|
|
1359
1364
|
if (typeof path2 !== "string" || !path2.length) throw new BadRequestException(`Batch request at index ${index} must define a non-empty path.`);
|
|
1360
1365
|
if (typeof method !== "string") throw new BadRequestException(`Batch request at index ${index} must define an HTTP method.`);
|
|
1361
1366
|
const normalized = method.toUpperCase();
|
|
1362
1367
|
if (!isAtomicHttpMethod(normalized)) throw new BadRequestException(`Batch request at index ${index} uses unsupported method ${method}.`);
|
|
1363
|
-
return { requestId, path: path2, method: normalized, body };
|
|
1368
|
+
return { requestId, path: path2, method: normalized, body, query };
|
|
1364
1369
|
}
|
|
1365
1370
|
fillErrorResponse(response, error, setCritical) {
|
|
1366
1371
|
response.body = void 0;
|