@emeryld/rrroutes-server 2.6.1 → 2.6.3

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.
@@ -242,6 +242,16 @@ export type RouteServerConfig<Ctx = unknown, Names extends string = string> = {
242
242
  debug?: RouteServerDebugOptions<Names>;
243
243
  };
244
244
  /** Runtime helpers returned by `createRRRoute`. */
245
+ export type RouteInvokeArgs<Ctx = unknown> = {
246
+ req: express.Request;
247
+ res: express.Response;
248
+ next?: express.NextFunction;
249
+ params?: unknown;
250
+ query?: unknown;
251
+ body?: unknown;
252
+ bodyFiles?: BodyFilesMap | undefined;
253
+ ctx?: CtxWithRoutesLogger<Ctx>;
254
+ };
245
255
  export type RouteServer<Ctx = unknown, Names extends string = string> = {
246
256
  router: Router;
247
257
  register<L extends AnyLeafLowProfile>(leaf: L, def: RouteDef<L, Ctx, Names>): void;
@@ -255,6 +265,7 @@ export type RouteServer<Ctx = unknown, Names extends string = string> = {
255
265
  }>(registry: R, logger: {
256
266
  warn: (...args: any[]) => void;
257
267
  }): void;
268
+ invoke(key: string, args: RouteInvokeArgs<Ctx>): Promise<unknown>;
258
269
  getRegisteredKeys(): string[];
259
270
  };
260
271
  /**
@@ -291,6 +302,28 @@ export declare function bindAll<R extends {
291
302
  }, Ctx = unknown, Names extends string = string>(router: Router, registry: R, controllers: {
292
303
  [K in KeysOfRegistry<R>]: RouteDef<LeafFromKey<R, K>, Ctx, Names>;
293
304
  }, config: RouteServerConfig<Ctx, Names>): express.Router;
305
+ export type BatchLeafEntryInput = {
306
+ encodedLeaf: string;
307
+ params?: unknown;
308
+ query?: unknown;
309
+ body?: unknown;
310
+ bodyFiles?: BodyFilesMap | undefined;
311
+ };
312
+ export type BatchLeafRequestBody = Record<string, BatchLeafEntryInput>;
313
+ export type BatchLeafOptions = {
314
+ method?: HttpMethod | Uppercase<HttpMethod>;
315
+ };
316
+ /**
317
+ * Register a batch endpoint that dispatches to existing registered route controllers.
318
+ * Request body shape:
319
+ * {
320
+ * [alias]: { encodedLeaf, params?, query?, body?, bodyFiles? }
321
+ * }
322
+ */
323
+ export declare function batchLeaf<R extends {
324
+ all: readonly AnyLeafLowProfile[];
325
+ byKey: Record<string, AnyLeafLowProfile>;
326
+ }, Ctx = unknown, Names extends string = string>(server: RouteServer<Ctx, Names>, path: string, registry: R, options?: BatchLeafOptions): express.Router;
294
327
  /**
295
328
  * Helper for great IntelliSense when authoring controller maps.
296
329
  * @returns Function that enforces key names while preserving partial flexibility.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emeryld/rrroutes-server",
3
- "version": "2.6.1",
3
+ "version": "2.6.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",