@bepalo/spine 3.10.23 → 3.11.24

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.
@@ -27,7 +27,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
27
27
  function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
28
28
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
29
29
  };
30
- var _Router_instances, _Router_config, _Router_routes, _Router_generateUniqueOperationId, _Router_processPath, _Router_getRouteEntries, _Router_InitEntries, _Router_initRoutes;
30
+ var _Router_instances, _Router_config, _Router_routes, _Router_setters, _Router_generateUniqueOperationId, _Router_processPath, _Router_getRouteEntries, _Router_InitEntries, _Router_initRoutes;
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
32
  exports.translateRouteFilePath = exports.Router = exports.HANDLER_TYPES = exports.HTTP_METHODS_UPPER = exports.CRUD_METHODS = exports.HTTP_METHODS = exports.REGISTER_PATH_REGEX = exports.PATH_PART_REGEX = exports.EMPTY_PARAMS = void 0;
33
33
  const status_ts_1 = require("./status.js");
@@ -51,6 +51,7 @@ exports.HTTP_METHODS = new Set([
51
51
  ]);
52
52
  exports.CRUD_METHODS = new Set([
53
53
  "Get",
54
+ "Query",
54
55
  "Post",
55
56
  "Put",
56
57
  "Patch",
@@ -87,19 +88,54 @@ class Router {
87
88
  get enable() {
88
89
  return Object.assign({}, __classPrivateFieldGet(this, _Router_config, "f").enable);
89
90
  }
91
+ get doNotStoreSetters() {
92
+ return __classPrivateFieldGet(this, _Router_config, "f").doNotStoreSetters;
93
+ }
94
+ get setters() {
95
+ return [...__classPrivateFieldGet(this, _Router_setters, "f")];
96
+ }
97
+ /**
98
+ * Create a new Router
99
+ *
100
+ * @param {RouterConfig<ExtendContext>} config Router configs
101
+ */
90
102
  constructor(config) {
91
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
103
+ var _a, _b, _c, _d;
92
104
  _Router_instances.add(this);
93
105
  _Router_config.set(this, void 0);
94
106
  _Router_routes.set(this, void 0);
95
- __classPrivateFieldSet(this, _Router_config, Object.assign(Object.assign({}, config), { maxPath: (_a = config === null || config === void 0 ? void 0 : config.maxPath) !== null && _a !== void 0 ? _a : 24, enable: {
96
- filter: (_d = (!((_b = config === null || config === void 0 ? void 0 : config.disable) === null || _b === void 0 ? void 0 : _b.filter) && ((_c = config === null || config === void 0 ? void 0 : config.enable) === null || _c === void 0 ? void 0 : _c.filter))) !== null && _d !== void 0 ? _d : true,
97
- fallback: (_g = (!((_e = config === null || config === void 0 ? void 0 : config.disable) === null || _e === void 0 ? void 0 : _e.fallback) && ((_f = config === null || config === void 0 ? void 0 : config.enable) === null || _f === void 0 ? void 0 : _f.fallback))) !== null && _g !== void 0 ? _g : true,
98
- after: (_k = (!((_h = config === null || config === void 0 ? void 0 : config.disable) === null || _h === void 0 ? void 0 : _h.after) && ((_j = config === null || config === void 0 ? void 0 : config.enable) === null || _j === void 0 ? void 0 : _j.after))) !== null && _k !== void 0 ? _k : true,
99
- catcher: (_o = (!((_l = config === null || config === void 0 ? void 0 : config.disable) === null || _l === void 0 ? void 0 : _l.catcher) && ((_m = config === null || config === void 0 ? void 0 : config.enable) === null || _m === void 0 ? void 0 : _m.catcher))) !== null && _o !== void 0 ? _o : true,
100
- } }), "f");
107
+ _Router_setters.set(this, []);
108
+ const { maxPath, doNotStoreSetters, enable, disable, defaultFilter, defaultHandler, defaultFallback, defaultCatcher, defaultAfter, afterCatcher, } = config;
109
+ if (typeof maxPath !== "number" || maxPath <= 0 || maxPath >= 1024) {
110
+ throw new types_ts_1.RouterError("Invalid maxPath. Use range 1 upto 1024");
111
+ }
112
+ __classPrivateFieldSet(this, _Router_config, {
113
+ maxPath,
114
+ doNotStoreSetters: Boolean(doNotStoreSetters),
115
+ enable: {
116
+ filter: (_a = (!(disable === null || disable === void 0 ? void 0 : disable.filter) && (enable === null || enable === void 0 ? void 0 : enable.filter))) !== null && _a !== void 0 ? _a : true,
117
+ fallback: (_b = (!(disable === null || disable === void 0 ? void 0 : disable.fallback) && (enable === null || enable === void 0 ? void 0 : enable.fallback))) !== null && _b !== void 0 ? _b : true,
118
+ after: (_c = (!(disable === null || disable === void 0 ? void 0 : disable.after) && (enable === null || enable === void 0 ? void 0 : enable.after))) !== null && _c !== void 0 ? _c : true,
119
+ catcher: (_d = (!(disable === null || disable === void 0 ? void 0 : disable.catcher) && (enable === null || enable === void 0 ? void 0 : enable.catcher))) !== null && _d !== void 0 ? _d : true,
120
+ },
121
+ defaultFilter,
122
+ defaultHandler,
123
+ defaultFallback,
124
+ defaultCatcher,
125
+ defaultAfter,
126
+ afterCatcher,
127
+ }, "f");
101
128
  __classPrivateFieldSet(this, _Router_routes, __classPrivateFieldGet(this, _Router_instances, "m", _Router_initRoutes).call(this), "f");
102
129
  }
130
+ /**
131
+ * Respond to a request according to the defined routes.
132
+ *
133
+ * @param {Request} request An http request object
134
+ * @param {RespondContext<ExtendContext>} ctxInit Context pre-initialization.
135
+ * Only headers and timestamps are allowed.
136
+ * But timestamps properties will not be overridden but rather extended.
137
+ * @returns {Response} An http response object
138
+ */
103
139
  respond(request, ctxInit) {
104
140
  return __awaiter(this, void 0, void 0, function* () {
105
141
  var _a;
@@ -321,7 +357,7 @@ class Router {
321
357
  }
322
358
  }
323
359
  }
324
- // default cathcer
360
+ // default catcher
325
361
  if (__classPrivateFieldGet(this, _Router_config, "f").defaultCatcher && !(response instanceof Response)) {
326
362
  ctx.error = error;
327
363
  const resp = yield __classPrivateFieldGet(this, _Router_config, "f").defaultCatcher(ctx);
@@ -383,23 +419,60 @@ class Router {
383
419
  }
384
420
  catch (_error) {
385
421
  const error = _error instanceof Error ? _error : Error(String(_error));
386
- // default after cathcer
387
- if (__classPrivateFieldGet(this, _Router_config, "f").defaultAfterCatcher) {
422
+ // after catcher
423
+ if (__classPrivateFieldGet(this, _Router_config, "f").afterCatcher) {
388
424
  ctx.error = error;
389
- yield __classPrivateFieldGet(this, _Router_config, "f").defaultAfterCatcher(ctx);
425
+ yield __classPrivateFieldGet(this, _Router_config, "f").afterCatcher(ctx);
390
426
  }
391
427
  }
392
428
  return response;
393
429
  });
394
430
  }
395
- load(_a) {
396
- return __awaiter(this, arguments, void 0, function* ({ routesPath, pattern = /\.(js|ts|mjs|cjs)$/, dirPattern = /.*/, processName = (name) => name.substring(0, name.lastIndexOf(".")), }) {
397
- var _b, e_1, _c, _d;
431
+ /**
432
+ *
433
+ * @param {string} prefix Path prefix to prepend to paths.
434
+ * @param {Router<_ExtendContext,ExtendContext>} router The router to append routes definitions from.
435
+ * @param {{overwrite:boolean}} options Options to apply to each route definition.
436
+ * @param {boolean} [options.overwrite] Overwrite each route definition. This overrides the route specific options.
437
+ */
438
+ appendTo(prefix, router, options) {
439
+ const overwrite = options === null || options === void 0 ? void 0 : options.overwrite;
440
+ for (const { handlerType, methodPaths, pipe, options: setterOptions, } of __classPrivateFieldGet(router, _Router_setters, "f")) {
441
+ if (Array.isArray(methodPaths)) {
442
+ const appendedMethodPaths = methodPaths.map((methodPath) => {
443
+ const [method, path] = methodPath.split(" ", 2);
444
+ return `${method} ${prefix}${path}`;
445
+ });
446
+ this.register(handlerType, appendedMethodPaths, pipe, Object.assign(Object.assign({}, setterOptions), { overwrite: (setterOptions === null || setterOptions === void 0 ? void 0 : setterOptions.overwrite) || overwrite }));
447
+ }
448
+ else {
449
+ const [method, path] = methodPaths.split(" ", 2);
450
+ const appendedMethodPaths = `${method} ${prefix}${path}`;
451
+ this.register(handlerType, appendedMethodPaths, pipe, Object.assign(Object.assign({}, setterOptions), { overwrite: (setterOptions === null || setterOptions === void 0 ? void 0 : setterOptions.overwrite) || overwrite }));
452
+ }
453
+ }
454
+ }
455
+ /**
456
+ * Dynamically load route definition files
457
+ *
458
+ * @param options
459
+ * @param {string} [options.routesPath] The root path of the route definitions
460
+ * @param {RegExp} [options.pattern] Regex pattern to use for matching and filtering route definition files.
461
+ * @param {RegExp} [options.dirPattern] Regex pattern to use for matching and filtering route definition folders.
462
+ * @param {(name:string)=>string} [options.processName] Route file name processor to decide the route path from filename.
463
+ * This is used for removing filename extensions and other appendages.
464
+ * The default removes only file extension.
465
+ * You can override this to remove custom appendages like '.route.ts'
466
+ */
467
+ load(options) {
468
+ return __awaiter(this, void 0, void 0, function* () {
469
+ var _a, e_1, _b, _c;
470
+ const { routesPath, pattern = /\.(js|ts|mjs|cjs)$/, dirPattern = /.*/, processName = (name) => name.substring(0, name.lastIndexOf(".")), } = options;
398
471
  try {
399
- for (var _e = true, _f = __asyncValues((0, utils_node_ts_1.walk)(routesPath)), _g; _g = yield _f.next(), _b = _g.done, !_b; _e = true) {
400
- _d = _g.value;
401
- _e = false;
402
- const node = _d;
472
+ for (var _d = true, _e = __asyncValues((0, utils_node_ts_1.walk)(routesPath)), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
473
+ _c = _f.value;
474
+ _d = false;
475
+ const node = _c;
403
476
  if (node.type === "file") {
404
477
  if (!pattern.test(node.name)) {
405
478
  continue;
@@ -496,7 +569,7 @@ class Router {
496
569
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
497
570
  finally {
498
571
  try {
499
- if (!_e && !_b && (_c = _f.return)) yield _c.call(_f);
572
+ if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
500
573
  }
501
574
  finally { if (e_1) throw e_1.error; }
502
575
  }
@@ -530,7 +603,7 @@ class Router {
530
603
  * - Receives one `GenerateOpenAPISortParam` parameter: `{ method, path, parts, tags }`
531
604
  * - Return true to include, false to exclude
532
605
  * @param options.routeSorter - Custom route sorter.
533
- * - Recieves two `GenerateOpenAPISortParam` parameters: `{ method, path, parts, tags }`
606
+ * - Receives two `GenerateOpenAPISortParam` parameters: `{ method, path, parts, tags }`
534
607
  * - Return -1, 0, 1
535
608
  * @param options.includeOperationId - Whether to generate operationId for each operation (default: true)
536
609
  * @param options.autoTag - Automatically tag operations based on path (default: true)
@@ -934,6 +1007,16 @@ class Router {
934
1007
  resolve(result);
935
1008
  });
936
1009
  }
1010
+ /**
1011
+ * Define handlers for all http methods ["Head","Get","Query","Post","Put","Patch","Delete","Options","Trace","Connect"] and the specified paths.
1012
+ *
1013
+ * @param {Path} paths One or more valid route paths
1014
+ * @param pipe One or more request handlers
1015
+ * @param {RegisterPipelineOptions} options Register pipeline options
1016
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1017
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1018
+ * @returns This router instance.
1019
+ */
937
1020
  all(paths, pipe, options) {
938
1021
  paths = Array.isArray(paths) ? paths : [paths];
939
1022
  const methodPaths = [];
@@ -944,6 +1027,16 @@ class Router {
944
1027
  }
945
1028
  return this.register("handler", methodPaths, pipe, options);
946
1029
  }
1030
+ /**
1031
+ * Define handlers for CRUD http methods ["Get","Query","Post","Put","Patch","Delete"] and the specified paths.
1032
+ *
1033
+ * @param {Path} paths One or more valid route paths
1034
+ * @param pipe One or more request handlers
1035
+ * @param {RegisterPipelineOptions} options Register pipeline options
1036
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1037
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1038
+ * @returns This router instance.
1039
+ */
947
1040
  crud(paths, pipe, options) {
948
1041
  paths = Array.isArray(paths) ? paths : [paths];
949
1042
  const methodPaths = [];
@@ -954,56 +1047,166 @@ class Router {
954
1047
  }
955
1048
  return this.register("handler", methodPaths, pipe, options);
956
1049
  }
1050
+ /**
1051
+ * Define handlers for Head http method and the specified paths.
1052
+ *
1053
+ * @param {Path} paths One or more valid route paths
1054
+ * @param pipe One or more request handlers
1055
+ * @param {RegisterPipelineOptions} options Register pipeline options
1056
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1057
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1058
+ * @returns This router instance.
1059
+ */
957
1060
  head(paths, pipe, options) {
958
1061
  paths = Array.isArray(paths) ? paths : [paths];
959
1062
  const methodPaths = paths.map((p) => `Head ${p}`);
960
1063
  return this.register("handler", methodPaths, pipe, options);
961
1064
  }
1065
+ /**
1066
+ * Define handlers for Get http method and the specified paths.
1067
+ *
1068
+ * @param {Path} paths One or more valid route paths
1069
+ * @param pipe One or more request handlers
1070
+ * @param {RegisterPipelineOptions} options Register pipeline options
1071
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1072
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1073
+ * @returns This router instance.
1074
+ */
962
1075
  get(paths, pipe, options) {
963
1076
  paths = Array.isArray(paths) ? paths : [paths];
964
1077
  const methodPaths = paths.map((p) => `Get ${p}`);
965
1078
  return this.register("handler", methodPaths, pipe, options);
966
1079
  }
1080
+ /**
1081
+ * Define handlers for Query http method and the specified paths.
1082
+ *
1083
+ * @param {Path} paths One or more valid route paths
1084
+ * @param pipe One or more request handlers
1085
+ * @param {RegisterPipelineOptions} options Register pipeline options
1086
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1087
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1088
+ * @returns This router instance.
1089
+ */
967
1090
  query(paths, pipe, options) {
968
1091
  paths = Array.isArray(paths) ? paths : [paths];
969
1092
  const methodPaths = paths.map((p) => `Query ${p}`);
970
1093
  return this.register("handler", methodPaths, pipe, options);
971
1094
  }
1095
+ /**
1096
+ * Define handlers for Post http method and the specified paths.
1097
+ *
1098
+ * @param {Path} paths One or more valid route paths
1099
+ * @param pipe One or more request handlers
1100
+ * @param {RegisterPipelineOptions} options Register pipeline options
1101
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1102
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1103
+ * @returns This router instance.
1104
+ */
972
1105
  post(paths, pipe, options) {
973
1106
  paths = Array.isArray(paths) ? paths : [paths];
974
1107
  const methodPaths = paths.map((p) => `Post ${p}`);
975
1108
  return this.register("handler", methodPaths, pipe, options);
976
1109
  }
1110
+ /**
1111
+ * Define handlers for Put http method and the specified paths.
1112
+ *
1113
+ * @param {Path} paths One or more valid route paths
1114
+ * @param pipe One or more request handlers
1115
+ * @param {RegisterPipelineOptions} options Register pipeline options
1116
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1117
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1118
+ * @returns This router instance.
1119
+ */
977
1120
  put(paths, pipe, options) {
978
1121
  paths = Array.isArray(paths) ? paths : [paths];
979
1122
  const methodPaths = paths.map((p) => `Put ${p}`);
980
1123
  return this.register("handler", methodPaths, pipe, options);
981
1124
  }
1125
+ /**
1126
+ * Define handlers for Patch http method and the specified paths.
1127
+ *
1128
+ * @param {Path} paths One or more valid route paths
1129
+ * @param pipe One or more request handlers
1130
+ * @param {RegisterPipelineOptions} options Register pipeline options
1131
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1132
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1133
+ * @returns This router instance.
1134
+ */
982
1135
  patch(paths, pipe, options) {
983
1136
  paths = Array.isArray(paths) ? paths : [paths];
984
1137
  const methodPaths = paths.map((p) => `Patch ${p}`);
985
1138
  return this.register("handler", methodPaths, pipe, options);
986
1139
  }
1140
+ /**
1141
+ * Define handlers for Head Delete method and the specified paths.
1142
+ *
1143
+ * @param {Path} paths One or more valid route paths
1144
+ * @param pipe One or more request handlers
1145
+ * @param {RegisterPipelineOptions} options Register pipeline options
1146
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1147
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1148
+ * @returns This router instance.
1149
+ */
987
1150
  delete(paths, pipe, options) {
988
1151
  paths = Array.isArray(paths) ? paths : [paths];
989
1152
  const methodPaths = paths.map((p) => `Delete ${p}`);
990
1153
  return this.register("handler", methodPaths, pipe, options);
991
1154
  }
1155
+ /**
1156
+ * Define handlers for Options http method and the specified paths.
1157
+ *
1158
+ * @param {Path} paths One or more valid route paths
1159
+ * @param pipe One or more request handlers
1160
+ * @param {RegisterPipelineOptions} options Register pipeline options
1161
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1162
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1163
+ * @returns This router instance.
1164
+ */
992
1165
  options(paths, pipe, options) {
993
1166
  paths = Array.isArray(paths) ? paths : [paths];
994
1167
  const methodPaths = paths.map((p) => `Options ${p}`);
995
1168
  return this.register("handler", methodPaths, pipe, options);
996
1169
  }
1170
+ /**
1171
+ * Define handlers for Trace http method and the specified paths.
1172
+ *
1173
+ * @param {Path} paths One or more valid route paths
1174
+ * @param pipe One or more request handlers
1175
+ * @param {RegisterPipelineOptions} options Register pipeline options
1176
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1177
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1178
+ * @returns This router instance.
1179
+ */
997
1180
  trace(paths, pipe, options) {
998
1181
  paths = Array.isArray(paths) ? paths : [paths];
999
1182
  const methodPaths = paths.map((p) => `Trace ${p}`);
1000
1183
  return this.register("handler", methodPaths, pipe, options);
1001
1184
  }
1185
+ /**
1186
+ * Define handlers for Connect http method and the specified paths.
1187
+ *
1188
+ * @param {Path} paths One or more valid route paths
1189
+ * @param pipe One or more request handlers
1190
+ * @param {RegisterPipelineOptions} options Register pipeline options
1191
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1192
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1193
+ * @returns This router instance.
1194
+ */
1002
1195
  connect(paths, pipe, options) {
1003
1196
  paths = Array.isArray(paths) ? paths : [paths];
1004
1197
  const methodPaths = paths.map((p) => `Connect ${p}`);
1005
1198
  return this.register("handler", methodPaths, pipe, options);
1006
1199
  }
1200
+ /**
1201
+ * Define filters for all http methods ["Head","Get","Query","Post","Put","Patch","Delete","Options","Trace","Connect"] and the specified paths.
1202
+ *
1203
+ * @param {Path} paths One or more valid route paths
1204
+ * @param pipe One or more request handlers
1205
+ * @param {RegisterPipelineOptions} options Register pipeline options
1206
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1207
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1208
+ * @returns This router instance.
1209
+ */
1007
1210
  filterAll(paths, pipe, options) {
1008
1211
  paths = Array.isArray(paths) ? paths : [paths];
1009
1212
  const methodPaths = [];
@@ -1014,6 +1217,16 @@ class Router {
1014
1217
  }
1015
1218
  return this.register("filter", methodPaths, pipe, options);
1016
1219
  }
1220
+ /**
1221
+ * Define filters for CRUD http methods ["Get","Query","Post","Put","Patch","Delete"] and the specified paths.
1222
+ *
1223
+ * @param {Path} paths One or more valid route paths
1224
+ * @param pipe One or more request handlers
1225
+ * @param {RegisterPipelineOptions} options Register pipeline options
1226
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1227
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1228
+ * @returns This router instance.
1229
+ */
1017
1230
  filterCrud(paths, pipe, options) {
1018
1231
  paths = Array.isArray(paths) ? paths : [paths];
1019
1232
  const methodPaths = [];
@@ -1024,56 +1237,166 @@ class Router {
1024
1237
  }
1025
1238
  return this.register("filter", methodPaths, pipe, options);
1026
1239
  }
1240
+ /**
1241
+ * Define filters for Head http method and the specified paths.
1242
+ *
1243
+ * @param {Path} paths One or more valid route paths
1244
+ * @param pipe One or more request handlers
1245
+ * @param {RegisterPipelineOptions} options Register pipeline options
1246
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1247
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1248
+ * @returns This router instance.
1249
+ */
1027
1250
  filterHead(paths, pipe, options) {
1028
1251
  paths = Array.isArray(paths) ? paths : [paths];
1029
1252
  const methodPaths = paths.map((p) => `Head ${p}`);
1030
1253
  return this.register("filter", methodPaths, pipe, options);
1031
1254
  }
1255
+ /**
1256
+ * Define filters for Get http method and the specified paths.
1257
+ *
1258
+ * @param {Path} paths One or more valid route paths
1259
+ * @param pipe One or more request handlers
1260
+ * @param {RegisterPipelineOptions} options Register pipeline options
1261
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1262
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1263
+ * @returns This router instance.
1264
+ */
1032
1265
  filterGet(paths, pipe, options) {
1033
1266
  paths = Array.isArray(paths) ? paths : [paths];
1034
1267
  const methodPaths = paths.map((p) => `Get ${p}`);
1035
1268
  return this.register("filter", methodPaths, pipe, options);
1036
1269
  }
1270
+ /**
1271
+ * Define filters for Query http method and the specified paths.
1272
+ *
1273
+ * @param {Path} paths One or more valid route paths
1274
+ * @param pipe One or more request handlers
1275
+ * @param {RegisterPipelineOptions} options Register pipeline options
1276
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1277
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1278
+ * @returns This router instance.
1279
+ */
1037
1280
  filterQuery(paths, pipe, options) {
1038
1281
  paths = Array.isArray(paths) ? paths : [paths];
1039
1282
  const methodPaths = paths.map((p) => `Query ${p}`);
1040
1283
  return this.register("filter", methodPaths, pipe, options);
1041
1284
  }
1285
+ /**
1286
+ * Define filters for Post http method and the specified paths.
1287
+ *
1288
+ * @param {Path} paths One or more valid route paths
1289
+ * @param pipe One or more request handlers
1290
+ * @param {RegisterPipelineOptions} options Register pipeline options
1291
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1292
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1293
+ * @returns This router instance.
1294
+ */
1042
1295
  filterPost(paths, pipe, options) {
1043
1296
  paths = Array.isArray(paths) ? paths : [paths];
1044
1297
  const methodPaths = paths.map((p) => `Post ${p}`);
1045
1298
  return this.register("filter", methodPaths, pipe, options);
1046
1299
  }
1300
+ /**
1301
+ * Define filters for Put http method and the specified paths.
1302
+ *
1303
+ * @param {Path} paths One or more valid route paths
1304
+ * @param pipe One or more request handlers
1305
+ * @param {RegisterPipelineOptions} options Register pipeline options
1306
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1307
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1308
+ * @returns This router instance.
1309
+ */
1047
1310
  filterPut(paths, pipe, options) {
1048
1311
  paths = Array.isArray(paths) ? paths : [paths];
1049
1312
  const methodPaths = paths.map((p) => `Put ${p}`);
1050
1313
  return this.register("filter", methodPaths, pipe, options);
1051
1314
  }
1315
+ /**
1316
+ * Define filters for Patch http method and the specified paths.
1317
+ *
1318
+ * @param {Path} paths One or more valid route paths
1319
+ * @param pipe One or more request handlers
1320
+ * @param {RegisterPipelineOptions} options Register pipeline options
1321
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1322
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1323
+ * @returns This router instance.
1324
+ */
1052
1325
  filterPatch(paths, pipe, options) {
1053
1326
  paths = Array.isArray(paths) ? paths : [paths];
1054
1327
  const methodPaths = paths.map((p) => `Patch ${p}`);
1055
1328
  return this.register("filter", methodPaths, pipe, options);
1056
1329
  }
1330
+ /**
1331
+ * Define filters for Head Delete method and the specified paths.
1332
+ *
1333
+ * @param {Path} paths One or more valid route paths
1334
+ * @param pipe One or more request handlers
1335
+ * @param {RegisterPipelineOptions} options Register pipeline options
1336
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1337
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1338
+ * @returns This router instance.
1339
+ */
1057
1340
  filterDelete(paths, pipe, options) {
1058
1341
  paths = Array.isArray(paths) ? paths : [paths];
1059
1342
  const methodPaths = paths.map((p) => `Delete ${p}`);
1060
1343
  return this.register("filter", methodPaths, pipe, options);
1061
1344
  }
1345
+ /**
1346
+ * Define filters for Options http method and the specified paths.
1347
+ *
1348
+ * @param {Path} paths One or more valid route paths
1349
+ * @param pipe One or more request handlers
1350
+ * @param {RegisterPipelineOptions} options Register pipeline options
1351
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1352
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1353
+ * @returns This router instance.
1354
+ */
1062
1355
  filterOptions(paths, pipe, options) {
1063
1356
  paths = Array.isArray(paths) ? paths : [paths];
1064
1357
  const methodPaths = paths.map((p) => `Options ${p}`);
1065
1358
  return this.register("filter", methodPaths, pipe, options);
1066
1359
  }
1360
+ /**
1361
+ * Define filters for Trace http method and the specified paths.
1362
+ *
1363
+ * @param {Path} paths One or more valid route paths
1364
+ * @param pipe One or more request handlers
1365
+ * @param {RegisterPipelineOptions} options Register pipeline options
1366
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1367
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1368
+ * @returns This router instance.
1369
+ */
1067
1370
  filterTrace(paths, pipe, options) {
1068
1371
  paths = Array.isArray(paths) ? paths : [paths];
1069
1372
  const methodPaths = paths.map((p) => `Trace ${p}`);
1070
1373
  return this.register("filter", methodPaths, pipe, options);
1071
1374
  }
1375
+ /**
1376
+ * Define filters for Connect http method and the specified paths.
1377
+ *
1378
+ * @param {Path} paths One or more valid route paths
1379
+ * @param pipe One or more request handlers
1380
+ * @param {RegisterPipelineOptions} options Register pipeline options
1381
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1382
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1383
+ * @returns This router instance.
1384
+ */
1072
1385
  filterConnect(paths, pipe, options) {
1073
1386
  paths = Array.isArray(paths) ? paths : [paths];
1074
1387
  const methodPaths = paths.map((p) => `Connect ${p}`);
1075
1388
  return this.register("filter", methodPaths, pipe, options);
1076
1389
  }
1390
+ /**
1391
+ * Define handlers for all http methods ["Head","Get","Query","Post","Put","Patch","Delete","Options","Trace","Connect"] and the specified paths.
1392
+ *
1393
+ * @param {Path} paths One or more valid route paths
1394
+ * @param pipe One or more request handlers
1395
+ * @param {RegisterPipelineOptions} options Register pipeline options
1396
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1397
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1398
+ * @returns This router instance.
1399
+ */
1077
1400
  handleAll(paths, pipe, options) {
1078
1401
  paths = Array.isArray(paths) ? paths : [paths];
1079
1402
  const methodPaths = [];
@@ -1084,6 +1407,16 @@ class Router {
1084
1407
  }
1085
1408
  return this.register("handler", methodPaths, pipe, options);
1086
1409
  }
1410
+ /**
1411
+ * Define handlers for CRUD http methods ["Get","Query","Post","Put","Patch","Delete"] and the specified paths.
1412
+ *
1413
+ * @param {Path} paths One or more valid route paths
1414
+ * @param pipe One or more request handlers
1415
+ * @param {RegisterPipelineOptions} options Register pipeline options
1416
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1417
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1418
+ * @returns This router instance.
1419
+ */
1087
1420
  handleCrud(paths, pipe, options) {
1088
1421
  paths = Array.isArray(paths) ? paths : [paths];
1089
1422
  const methodPaths = [];
@@ -1094,56 +1427,166 @@ class Router {
1094
1427
  }
1095
1428
  return this.register("handler", methodPaths, pipe, options);
1096
1429
  }
1430
+ /**
1431
+ * Define handlers for Head http method and the specified paths.
1432
+ *
1433
+ * @param {Path} paths One or more valid route paths
1434
+ * @param pipe One or more request handlers
1435
+ * @param {RegisterPipelineOptions} options Register pipeline options
1436
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1437
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1438
+ * @returns This router instance.
1439
+ */
1097
1440
  handleHead(paths, pipe, options) {
1098
1441
  paths = Array.isArray(paths) ? paths : [paths];
1099
1442
  const methodPaths = paths.map((p) => `Head ${p}`);
1100
1443
  return this.register("handler", methodPaths, pipe, options);
1101
1444
  }
1445
+ /**
1446
+ * Define handlers for Get http method and the specified paths.
1447
+ *
1448
+ * @param {Path} paths One or more valid route paths
1449
+ * @param pipe One or more request handlers
1450
+ * @param {RegisterPipelineOptions} options Register pipeline options
1451
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1452
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1453
+ * @returns This router instance.
1454
+ */
1102
1455
  handleGet(paths, pipe, options) {
1103
1456
  paths = Array.isArray(paths) ? paths : [paths];
1104
1457
  const methodPaths = paths.map((p) => `Get ${p}`);
1105
1458
  return this.register("handler", methodPaths, pipe, options);
1106
1459
  }
1460
+ /**
1461
+ * Define handlers for Query http method and the specified paths.
1462
+ *
1463
+ * @param {Path} paths One or more valid route paths
1464
+ * @param pipe One or more request handlers
1465
+ * @param {RegisterPipelineOptions} options Register pipeline options
1466
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1467
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1468
+ * @returns This router instance.
1469
+ */
1107
1470
  handleQuery(paths, pipe, options) {
1108
1471
  paths = Array.isArray(paths) ? paths : [paths];
1109
1472
  const methodPaths = paths.map((p) => `Query ${p}`);
1110
1473
  return this.register("handler", methodPaths, pipe, options);
1111
1474
  }
1475
+ /**
1476
+ * Define handlers for Post http method and the specified paths.
1477
+ *
1478
+ * @param {Path} paths One or more valid route paths
1479
+ * @param pipe One or more request handlers
1480
+ * @param {RegisterPipelineOptions} options Register pipeline options
1481
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1482
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1483
+ * @returns This router instance.
1484
+ */
1112
1485
  handlePost(paths, pipe, options) {
1113
1486
  paths = Array.isArray(paths) ? paths : [paths];
1114
1487
  const methodPaths = paths.map((p) => `Post ${p}`);
1115
1488
  return this.register("handler", methodPaths, pipe, options);
1116
1489
  }
1490
+ /**
1491
+ * Define handlers for Put http method and the specified paths.
1492
+ *
1493
+ * @param {Path} paths One or more valid route paths
1494
+ * @param pipe One or more request handlers
1495
+ * @param {RegisterPipelineOptions} options Register pipeline options
1496
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1497
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1498
+ * @returns This router instance.
1499
+ */
1117
1500
  handlePut(paths, pipe, options) {
1118
1501
  paths = Array.isArray(paths) ? paths : [paths];
1119
1502
  const methodPaths = paths.map((p) => `Put ${p}`);
1120
1503
  return this.register("handler", methodPaths, pipe, options);
1121
1504
  }
1505
+ /**
1506
+ * Define handlers for Patch http method and the specified paths.
1507
+ *
1508
+ * @param {Path} paths One or more valid route paths
1509
+ * @param pipe One or more request handlers
1510
+ * @param {RegisterPipelineOptions} options Register pipeline options
1511
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1512
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1513
+ * @returns This router instance.
1514
+ */
1122
1515
  handlePatch(paths, pipe, options) {
1123
1516
  paths = Array.isArray(paths) ? paths : [paths];
1124
1517
  const methodPaths = paths.map((p) => `Patch ${p}`);
1125
1518
  return this.register("handler", methodPaths, pipe, options);
1126
1519
  }
1520
+ /**
1521
+ * Define handlers for Head Delete method and the specified paths.
1522
+ *
1523
+ * @param {Path} paths One or more valid route paths
1524
+ * @param pipe One or more request handlers
1525
+ * @param {RegisterPipelineOptions} options Register pipeline options
1526
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1527
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1528
+ * @returns This router instance.
1529
+ */
1127
1530
  handleDelete(paths, pipe, options) {
1128
1531
  paths = Array.isArray(paths) ? paths : [paths];
1129
1532
  const methodPaths = paths.map((p) => `Delete ${p}`);
1130
1533
  return this.register("handler", methodPaths, pipe, options);
1131
1534
  }
1535
+ /**
1536
+ * Define handlers for Options http method and the specified paths.
1537
+ *
1538
+ * @param {Path} paths One or more valid route paths
1539
+ * @param pipe One or more request handlers
1540
+ * @param {RegisterPipelineOptions} options Register pipeline options
1541
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1542
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1543
+ * @returns This router instance.
1544
+ */
1132
1545
  handleOptions(paths, pipe, options) {
1133
1546
  paths = Array.isArray(paths) ? paths : [paths];
1134
1547
  const methodPaths = paths.map((p) => `Options ${p}`);
1135
1548
  return this.register("handler", methodPaths, pipe, options);
1136
1549
  }
1550
+ /**
1551
+ * Define handlers for Trace http method and the specified paths.
1552
+ *
1553
+ * @param {Path} paths One or more valid route paths
1554
+ * @param pipe One or more request handlers
1555
+ * @param {RegisterPipelineOptions} options Register pipeline options
1556
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1557
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1558
+ * @returns This router instance.
1559
+ */
1137
1560
  handleTrace(paths, pipe, options) {
1138
1561
  paths = Array.isArray(paths) ? paths : [paths];
1139
1562
  const methodPaths = paths.map((p) => `Trace ${p}`);
1140
1563
  return this.register("handler", methodPaths, pipe, options);
1141
1564
  }
1565
+ /**
1566
+ * Define handlers for Connect http method and the specified paths.
1567
+ *
1568
+ * @param {Path} paths One or more valid route paths
1569
+ * @param pipe One or more request handlers
1570
+ * @param {RegisterPipelineOptions} options Register pipeline options
1571
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1572
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1573
+ * @returns This router instance.
1574
+ */
1142
1575
  handleConnect(paths, pipe, options) {
1143
1576
  paths = Array.isArray(paths) ? paths : [paths];
1144
1577
  const methodPaths = paths.map((p) => `Connect ${p}`);
1145
1578
  return this.register("handler", methodPaths, pipe, options);
1146
1579
  }
1580
+ /**
1581
+ * Define fallbacks for all http methods ["Head","Get","Query","Post","Put","Patch","Delete","Options","Trace","Connect"] and the specified paths.
1582
+ *
1583
+ * @param {Path} paths One or more valid route paths
1584
+ * @param pipe One or more request handlers
1585
+ * @param {RegisterPipelineOptions} options Register pipeline options
1586
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1587
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1588
+ * @returns This router instance.
1589
+ */
1147
1590
  fallbackAll(paths, pipe, options) {
1148
1591
  paths = Array.isArray(paths) ? paths : [paths];
1149
1592
  const methodPaths = [];
@@ -1154,6 +1597,16 @@ class Router {
1154
1597
  }
1155
1598
  return this.register("fallback", methodPaths, pipe, options);
1156
1599
  }
1600
+ /**
1601
+ * Define fallbacks for CRUD http methods ["Get","Query","Post","Put","Patch","Delete"] and the specified paths.
1602
+ *
1603
+ * @param {Path} paths One or more valid route paths
1604
+ * @param pipe One or more request handlers
1605
+ * @param {RegisterPipelineOptions} options Register pipeline options
1606
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1607
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1608
+ * @returns This router instance.
1609
+ */
1157
1610
  fallbackCrud(paths, pipe, options) {
1158
1611
  paths = Array.isArray(paths) ? paths : [paths];
1159
1612
  const methodPaths = [];
@@ -1164,56 +1617,166 @@ class Router {
1164
1617
  }
1165
1618
  return this.register("fallback", methodPaths, pipe, options);
1166
1619
  }
1620
+ /**
1621
+ * Define fallbacks for Head http method and the specified paths.
1622
+ *
1623
+ * @param {Path} paths One or more valid route paths
1624
+ * @param pipe One or more request handlers
1625
+ * @param {RegisterPipelineOptions} options Register pipeline options
1626
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1627
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1628
+ * @returns This router instance.
1629
+ */
1167
1630
  fallbackHead(paths, pipe, options) {
1168
1631
  paths = Array.isArray(paths) ? paths : [paths];
1169
1632
  const methodPaths = paths.map((p) => `Head ${p}`);
1170
1633
  return this.register("fallback", methodPaths, pipe, options);
1171
1634
  }
1635
+ /**
1636
+ * Define fallbacks for Get http method and the specified paths.
1637
+ *
1638
+ * @param {Path} paths One or more valid route paths
1639
+ * @param pipe One or more request handlers
1640
+ * @param {RegisterPipelineOptions} options Register pipeline options
1641
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1642
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1643
+ * @returns This router instance.
1644
+ */
1172
1645
  fallbackGet(paths, pipe, options) {
1173
1646
  paths = Array.isArray(paths) ? paths : [paths];
1174
1647
  const methodPaths = paths.map((p) => `Get ${p}`);
1175
1648
  return this.register("fallback", methodPaths, pipe, options);
1176
1649
  }
1650
+ /**
1651
+ * Define fallbacks for Query http method and the specified paths.
1652
+ *
1653
+ * @param {Path} paths One or more valid route paths
1654
+ * @param pipe One or more request handlers
1655
+ * @param {RegisterPipelineOptions} options Register pipeline options
1656
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1657
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1658
+ * @returns This router instance.
1659
+ */
1177
1660
  fallbackQuery(paths, pipe, options) {
1178
1661
  paths = Array.isArray(paths) ? paths : [paths];
1179
1662
  const methodPaths = paths.map((p) => `Query ${p}`);
1180
1663
  return this.register("fallback", methodPaths, pipe, options);
1181
1664
  }
1665
+ /**
1666
+ * Define fallbacks for Post http method and the specified paths.
1667
+ *
1668
+ * @param {Path} paths One or more valid route paths
1669
+ * @param pipe One or more request handlers
1670
+ * @param {RegisterPipelineOptions} options Register pipeline options
1671
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1672
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1673
+ * @returns This router instance.
1674
+ */
1182
1675
  fallbackPost(paths, pipe, options) {
1183
1676
  paths = Array.isArray(paths) ? paths : [paths];
1184
1677
  const methodPaths = paths.map((p) => `Post ${p}`);
1185
1678
  return this.register("fallback", methodPaths, pipe, options);
1186
1679
  }
1680
+ /**
1681
+ * Define fallbacks for Put http method and the specified paths.
1682
+ *
1683
+ * @param {Path} paths One or more valid route paths
1684
+ * @param pipe One or more request handlers
1685
+ * @param {RegisterPipelineOptions} options Register pipeline options
1686
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1687
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1688
+ * @returns This router instance.
1689
+ */
1187
1690
  fallbackPut(paths, pipe, options) {
1188
1691
  paths = Array.isArray(paths) ? paths : [paths];
1189
1692
  const methodPaths = paths.map((p) => `Put ${p}`);
1190
1693
  return this.register("fallback", methodPaths, pipe, options);
1191
1694
  }
1695
+ /**
1696
+ * Define fallbacks for Patch http method and the specified paths.
1697
+ *
1698
+ * @param {Path} paths One or more valid route paths
1699
+ * @param pipe One or more request handlers
1700
+ * @param {RegisterPipelineOptions} options Register pipeline options
1701
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1702
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1703
+ * @returns This router instance.
1704
+ */
1192
1705
  fallbackPatch(paths, pipe, options) {
1193
1706
  paths = Array.isArray(paths) ? paths : [paths];
1194
1707
  const methodPaths = paths.map((p) => `Patch ${p}`);
1195
1708
  return this.register("fallback", methodPaths, pipe, options);
1196
1709
  }
1710
+ /**
1711
+ * Define fallbacks for Head Delete method and the specified paths.
1712
+ *
1713
+ * @param {Path} paths One or more valid route paths
1714
+ * @param pipe One or more request handlers
1715
+ * @param {RegisterPipelineOptions} options Register pipeline options
1716
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1717
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1718
+ * @returns This router instance.
1719
+ */
1197
1720
  fallbackDelete(paths, pipe, options) {
1198
1721
  paths = Array.isArray(paths) ? paths : [paths];
1199
1722
  const methodPaths = paths.map((p) => `Delete ${p}`);
1200
1723
  return this.register("fallback", methodPaths, pipe, options);
1201
1724
  }
1725
+ /**
1726
+ * Define fallbacks for Options http method and the specified paths.
1727
+ *
1728
+ * @param {Path} paths One or more valid route paths
1729
+ * @param pipe One or more request handlers
1730
+ * @param {RegisterPipelineOptions} options Register pipeline options
1731
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1732
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1733
+ * @returns This router instance.
1734
+ */
1202
1735
  fallbackOptions(paths, pipe, options) {
1203
1736
  paths = Array.isArray(paths) ? paths : [paths];
1204
1737
  const methodPaths = paths.map((p) => `Options ${p}`);
1205
1738
  return this.register("fallback", methodPaths, pipe, options);
1206
1739
  }
1740
+ /**
1741
+ * Define fallbacks for Trace http method and the specified paths.
1742
+ *
1743
+ * @param {Path} paths One or more valid route paths
1744
+ * @param pipe One or more request handlers
1745
+ * @param {RegisterPipelineOptions} options Register pipeline options
1746
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1747
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1748
+ * @returns This router instance.
1749
+ */
1207
1750
  fallbackTrace(paths, pipe, options) {
1208
1751
  paths = Array.isArray(paths) ? paths : [paths];
1209
1752
  const methodPaths = paths.map((p) => `Trace ${p}`);
1210
1753
  return this.register("fallback", methodPaths, pipe, options);
1211
1754
  }
1755
+ /**
1756
+ * Define fallbacks for Connect http method and the specified paths.
1757
+ *
1758
+ * @param {Path} paths One or more valid route paths
1759
+ * @param pipe One or more request handlers
1760
+ * @param {RegisterPipelineOptions} options Register pipeline options
1761
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1762
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1763
+ * @returns This router instance.
1764
+ */
1212
1765
  fallbackConnect(paths, pipe, options) {
1213
1766
  paths = Array.isArray(paths) ? paths : [paths];
1214
1767
  const methodPaths = paths.map((p) => `Connect ${p}`);
1215
1768
  return this.register("fallback", methodPaths, pipe, options);
1216
1769
  }
1770
+ /**
1771
+ * Define afters for all http methods ["Head","Get","Query","Post","Put","Patch","Delete","Options","Trace","Connect"] and the specified paths.
1772
+ *
1773
+ * @param {Path} paths One or more valid route paths
1774
+ * @param pipe One or more request handlers
1775
+ * @param {RegisterPipelineOptions} options Register pipeline options
1776
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1777
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1778
+ * @returns This router instance.
1779
+ */
1217
1780
  afterAll(paths, pipe, options) {
1218
1781
  paths = Array.isArray(paths) ? paths : [paths];
1219
1782
  const methodPaths = [];
@@ -1224,6 +1787,16 @@ class Router {
1224
1787
  }
1225
1788
  return this.register("after", methodPaths, pipe, options);
1226
1789
  }
1790
+ /**
1791
+ * Define afters for CRUD http methods ["Get","Query","Post","Put","Patch","Delete"] and the specified paths.
1792
+ *
1793
+ * @param {Path} paths One or more valid route paths
1794
+ * @param pipe One or more request handlers
1795
+ * @param {RegisterPipelineOptions} options Register pipeline options
1796
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1797
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1798
+ * @returns This router instance.
1799
+ */
1227
1800
  afterCrud(paths, pipe, options) {
1228
1801
  paths = Array.isArray(paths) ? paths : [paths];
1229
1802
  const methodPaths = [];
@@ -1234,56 +1807,166 @@ class Router {
1234
1807
  }
1235
1808
  return this.register("after", methodPaths, pipe, options);
1236
1809
  }
1810
+ /**
1811
+ * Define afters for Head http method and the specified paths.
1812
+ *
1813
+ * @param {Path} paths One or more valid route paths
1814
+ * @param pipe One or more request handlers
1815
+ * @param {RegisterPipelineOptions} options Register pipeline options
1816
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1817
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1818
+ * @returns This router instance.
1819
+ */
1237
1820
  afterHead(paths, pipe, options) {
1238
1821
  paths = Array.isArray(paths) ? paths : [paths];
1239
1822
  const methodPaths = paths.map((p) => `Head ${p}`);
1240
1823
  return this.register("after", methodPaths, pipe, options);
1241
1824
  }
1825
+ /**
1826
+ * Define afters for Get http method and the specified paths.
1827
+ *
1828
+ * @param {Path} paths One or more valid route paths
1829
+ * @param pipe One or more request handlers
1830
+ * @param {RegisterPipelineOptions} options Register pipeline options
1831
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1832
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1833
+ * @returns This router instance.
1834
+ */
1242
1835
  afterGet(paths, pipe, options) {
1243
1836
  paths = Array.isArray(paths) ? paths : [paths];
1244
1837
  const methodPaths = paths.map((p) => `Get ${p}`);
1245
1838
  return this.register("after", methodPaths, pipe, options);
1246
1839
  }
1840
+ /**
1841
+ * Define afters for Query http method and the specified paths.
1842
+ *
1843
+ * @param {Path} paths One or more valid route paths
1844
+ * @param pipe One or more request handlers
1845
+ * @param {RegisterPipelineOptions} options Register pipeline options
1846
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1847
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1848
+ * @returns This router instance.
1849
+ */
1247
1850
  afterQuery(paths, pipe, options) {
1248
1851
  paths = Array.isArray(paths) ? paths : [paths];
1249
1852
  const methodPaths = paths.map((p) => `Query ${p}`);
1250
1853
  return this.register("after", methodPaths, pipe, options);
1251
1854
  }
1855
+ /**
1856
+ * Define afters for Post http method and the specified paths.
1857
+ *
1858
+ * @param {Path} paths One or more valid route paths
1859
+ * @param pipe One or more request handlers
1860
+ * @param {RegisterPipelineOptions} options Register pipeline options
1861
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1862
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1863
+ * @returns This router instance.
1864
+ */
1252
1865
  afterPost(paths, pipe, options) {
1253
1866
  paths = Array.isArray(paths) ? paths : [paths];
1254
1867
  const methodPaths = paths.map((p) => `Post ${p}`);
1255
1868
  return this.register("after", methodPaths, pipe, options);
1256
1869
  }
1870
+ /**
1871
+ * Define afters for Put http method and the specified paths.
1872
+ *
1873
+ * @param {Path} paths One or more valid route paths
1874
+ * @param pipe One or more request handlers
1875
+ * @param {RegisterPipelineOptions} options Register pipeline options
1876
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1877
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1878
+ * @returns This router instance.
1879
+ */
1257
1880
  afterPut(paths, pipe, options) {
1258
1881
  paths = Array.isArray(paths) ? paths : [paths];
1259
1882
  const methodPaths = paths.map((p) => `Put ${p}`);
1260
1883
  return this.register("after", methodPaths, pipe, options);
1261
1884
  }
1885
+ /**
1886
+ * Define afters for Patch http method and the specified paths.
1887
+ *
1888
+ * @param {Path} paths One or more valid route paths
1889
+ * @param pipe One or more request handlers
1890
+ * @param {RegisterPipelineOptions} options Register pipeline options
1891
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1892
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1893
+ * @returns This router instance.
1894
+ */
1262
1895
  afterPatch(paths, pipe, options) {
1263
1896
  paths = Array.isArray(paths) ? paths : [paths];
1264
1897
  const methodPaths = paths.map((p) => `Patch ${p}`);
1265
1898
  return this.register("after", methodPaths, pipe, options);
1266
1899
  }
1900
+ /**
1901
+ * Define afters for Head Delete method and the specified paths.
1902
+ *
1903
+ * @param {Path} paths One or more valid route paths
1904
+ * @param pipe One or more request handlers
1905
+ * @param {RegisterPipelineOptions} options Register pipeline options
1906
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1907
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1908
+ * @returns This router instance.
1909
+ */
1267
1910
  afterDelete(paths, pipe, options) {
1268
1911
  paths = Array.isArray(paths) ? paths : [paths];
1269
1912
  const methodPaths = paths.map((p) => `Delete ${p}`);
1270
1913
  return this.register("after", methodPaths, pipe, options);
1271
1914
  }
1915
+ /**
1916
+ * Define afters for Options http method and the specified paths.
1917
+ *
1918
+ * @param {Path} paths One or more valid route paths
1919
+ * @param pipe One or more request handlers
1920
+ * @param {RegisterPipelineOptions} options Register pipeline options
1921
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1922
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1923
+ * @returns This router instance.
1924
+ */
1272
1925
  afterOptions(paths, pipe, options) {
1273
1926
  paths = Array.isArray(paths) ? paths : [paths];
1274
1927
  const methodPaths = paths.map((p) => `Options ${p}`);
1275
1928
  return this.register("after", methodPaths, pipe, options);
1276
1929
  }
1930
+ /**
1931
+ * Define afters for Trace http method and the specified paths.
1932
+ *
1933
+ * @param {Path} paths One or more valid route paths
1934
+ * @param pipe One or more request handlers
1935
+ * @param {RegisterPipelineOptions} options Register pipeline options
1936
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1937
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1938
+ * @returns This router instance.
1939
+ */
1277
1940
  afterTrace(paths, pipe, options) {
1278
1941
  paths = Array.isArray(paths) ? paths : [paths];
1279
1942
  const methodPaths = paths.map((p) => `Trace ${p}`);
1280
1943
  return this.register("after", methodPaths, pipe, options);
1281
1944
  }
1945
+ /**
1946
+ * Define afters for Connect http method and the specified paths.
1947
+ *
1948
+ * @param {Path} paths One or more valid route paths
1949
+ * @param pipe One or more request handlers
1950
+ * @param {RegisterPipelineOptions} options Register pipeline options
1951
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1952
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1953
+ * @returns This router instance.
1954
+ */
1282
1955
  afterConnect(paths, pipe, options) {
1283
1956
  paths = Array.isArray(paths) ? paths : [paths];
1284
1957
  const methodPaths = paths.map((p) => `Connect ${p}`);
1285
1958
  return this.register("after", methodPaths, pipe, options);
1286
1959
  }
1960
+ /**
1961
+ * Define catchers for all http methods ["Head","Get","Query","Post","Put","Patch","Delete","Options","Trace","Connect"] and the specified paths.
1962
+ *
1963
+ * @param {Path} paths One or more valid route paths
1964
+ * @param pipe One or more request handlers
1965
+ * @param {RegisterPipelineOptions} options Register pipeline options
1966
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1967
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1968
+ * @returns This router instance.
1969
+ */
1287
1970
  catchAll(paths, pipe, options) {
1288
1971
  paths = Array.isArray(paths) ? paths : [paths];
1289
1972
  const methodPaths = [];
@@ -1294,6 +1977,16 @@ class Router {
1294
1977
  }
1295
1978
  return this.register("catcher", methodPaths, pipe, options);
1296
1979
  }
1980
+ /**
1981
+ * Define catchers for CRUD http methods ["Get","Query","Post","Put","Patch","Delete"] and the specified paths.
1982
+ *
1983
+ * @param {Path} paths One or more valid route paths
1984
+ * @param pipe One or more request handlers
1985
+ * @param {RegisterPipelineOptions} options Register pipeline options
1986
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1987
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
1988
+ * @returns This router instance.
1989
+ */
1297
1990
  catchCrud(paths, pipe, options) {
1298
1991
  paths = Array.isArray(paths) ? paths : [paths];
1299
1992
  const methodPaths = [];
@@ -1304,56 +1997,166 @@ class Router {
1304
1997
  }
1305
1998
  return this.register("catcher", methodPaths, pipe, options);
1306
1999
  }
2000
+ /**
2001
+ * Define catchers for Head http method and the specified paths.
2002
+ *
2003
+ * @param {Path} paths One or more valid route paths
2004
+ * @param pipe One or more request handlers
2005
+ * @param {RegisterPipelineOptions} options Register pipeline options
2006
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2007
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
2008
+ * @returns This router instance.
2009
+ */
1307
2010
  catchHead(paths, pipe, options) {
1308
2011
  paths = Array.isArray(paths) ? paths : [paths];
1309
2012
  const methodPaths = paths.map((p) => `Head ${p}`);
1310
2013
  return this.register("catcher", methodPaths, pipe, options);
1311
2014
  }
2015
+ /**
2016
+ * Define catchers for Get http method and the specified paths.
2017
+ *
2018
+ * @param {Path} paths One or more valid route paths
2019
+ * @param pipe One or more request handlers
2020
+ * @param {RegisterPipelineOptions} options Register pipeline options
2021
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2022
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
2023
+ * @returns This router instance.
2024
+ */
1312
2025
  catchGet(paths, pipe, options) {
1313
2026
  paths = Array.isArray(paths) ? paths : [paths];
1314
2027
  const methodPaths = paths.map((p) => `Get ${p}`);
1315
2028
  return this.register("catcher", methodPaths, pipe, options);
1316
2029
  }
2030
+ /**
2031
+ * Define catchers for Query http method and the specified paths.
2032
+ *
2033
+ * @param {Path} paths One or more valid route paths
2034
+ * @param pipe One or more request handlers
2035
+ * @param {RegisterPipelineOptions} options Register pipeline options
2036
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2037
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
2038
+ * @returns This router instance.
2039
+ */
1317
2040
  catchQuery(paths, pipe, options) {
1318
2041
  paths = Array.isArray(paths) ? paths : [paths];
1319
2042
  const methodPaths = paths.map((p) => `Query ${p}`);
1320
2043
  return this.register("catcher", methodPaths, pipe, options);
1321
2044
  }
2045
+ /**
2046
+ * Define catchers for Post http method and the specified paths.
2047
+ *
2048
+ * @param {Path} paths One or more valid route paths
2049
+ * @param pipe One or more request handlers
2050
+ * @param {RegisterPipelineOptions} options Register pipeline options
2051
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2052
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
2053
+ * @returns This router instance.
2054
+ */
1322
2055
  catchPost(paths, pipe, options) {
1323
2056
  paths = Array.isArray(paths) ? paths : [paths];
1324
2057
  const methodPaths = paths.map((p) => `Post ${p}`);
1325
2058
  return this.register("catcher", methodPaths, pipe, options);
1326
2059
  }
2060
+ /**
2061
+ * Define catchers for Put http method and the specified paths.
2062
+ *
2063
+ * @param {Path} paths One or more valid route paths
2064
+ * @param pipe One or more request handlers
2065
+ * @param {RegisterPipelineOptions} options Register pipeline options
2066
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2067
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
2068
+ * @returns This router instance.
2069
+ */
1327
2070
  catchPut(paths, pipe, options) {
1328
2071
  paths = Array.isArray(paths) ? paths : [paths];
1329
2072
  const methodPaths = paths.map((p) => `Put ${p}`);
1330
2073
  return this.register("catcher", methodPaths, pipe, options);
1331
2074
  }
2075
+ /**
2076
+ * Define catchers for Patch http method and the specified paths.
2077
+ *
2078
+ * @param {Path} paths One or more valid route paths
2079
+ * @param pipe One or more request handlers
2080
+ * @param {RegisterPipelineOptions} options Register pipeline options
2081
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2082
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
2083
+ * @returns This router instance.
2084
+ */
1332
2085
  catchPatch(paths, pipe, options) {
1333
2086
  paths = Array.isArray(paths) ? paths : [paths];
1334
2087
  const methodPaths = paths.map((p) => `Patch ${p}`);
1335
2088
  return this.register("catcher", methodPaths, pipe, options);
1336
2089
  }
2090
+ /**
2091
+ * Define catchers for Head Delete method and the specified paths.
2092
+ *
2093
+ * @param {Path} paths One or more valid route paths
2094
+ * @param pipe One or more request handlers
2095
+ * @param {RegisterPipelineOptions} options Register pipeline options
2096
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2097
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
2098
+ * @returns This router instance.
2099
+ */
1337
2100
  catchDelete(paths, pipe, options) {
1338
2101
  paths = Array.isArray(paths) ? paths : [paths];
1339
2102
  const methodPaths = paths.map((p) => `Delete ${p}`);
1340
2103
  return this.register("catcher", methodPaths, pipe, options);
1341
2104
  }
2105
+ /**
2106
+ * Define catchers for Options http method and the specified paths.
2107
+ *
2108
+ * @param {Path} paths One or more valid route paths
2109
+ * @param pipe One or more request handlers
2110
+ * @param {RegisterPipelineOptions} options Register pipeline options
2111
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2112
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
2113
+ * @returns This router instance.
2114
+ */
1342
2115
  catchOptions(paths, pipe, options) {
1343
2116
  paths = Array.isArray(paths) ? paths : [paths];
1344
2117
  const methodPaths = paths.map((p) => `Options ${p}`);
1345
2118
  return this.register("catcher", methodPaths, pipe, options);
1346
2119
  }
2120
+ /**
2121
+ * Define catchers for Trace http method and the specified paths.
2122
+ *
2123
+ * @param {Path} paths One or more valid route paths
2124
+ * @param pipe One or more request handlers
2125
+ * @param {RegisterPipelineOptions} options Register pipeline options
2126
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2127
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
2128
+ * @returns This router instance.
2129
+ */
1347
2130
  catchTrace(paths, pipe, options) {
1348
2131
  paths = Array.isArray(paths) ? paths : [paths];
1349
2132
  const methodPaths = paths.map((p) => `Trace ${p}`);
1350
2133
  return this.register("catcher", methodPaths, pipe, options);
1351
2134
  }
2135
+ /**
2136
+ * Define catchers for Connect http method and the specified paths.
2137
+ *
2138
+ * @param {Path} paths One or more valid route paths
2139
+ * @param pipe One or more request handlers
2140
+ * @param {RegisterPipelineOptions} options Register pipeline options
2141
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2142
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
2143
+ * @returns This router instance.
2144
+ */
1352
2145
  catchConnect(paths, pipe, options) {
1353
2146
  paths = Array.isArray(paths) ? paths : [paths];
1354
2147
  const methodPaths = paths.map((p) => `Connect ${p}`);
1355
2148
  return this.register("catcher", methodPaths, pipe, options);
1356
2149
  }
2150
+ /**
2151
+ * Define filters for the specified method paths.
2152
+ *
2153
+ * @param {MethodPath|Array<MethodPath>} methodPaths Method-path definitions in the form of: `Method /Path`, or [`Method /Path`, ...] or [[`Method`, ...], `/Path`, ...]
2154
+ * @param pipe One or more request handlers
2155
+ * @param {RegisterPipelineOptions} options Register pipeline options
2156
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2157
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
2158
+ * @returns This router instance.
2159
+ */
1357
2160
  filter(methodPaths, pipe, options) {
1358
2161
  const methodPathIsArray = Array.isArray(methodPaths);
1359
2162
  if (methodPathIsArray &&
@@ -1384,6 +2187,16 @@ class Router {
1384
2187
  : methodPaths;
1385
2188
  return this.register("filter", methodPaths_, pipe, options);
1386
2189
  }
2190
+ /**
2191
+ * Define handlers for the specified method paths.
2192
+ *
2193
+ * @param {MethodPath|Array<MethodPath>} methodPaths Method-path definitions in the form of: `Method /Path`, or [`Method /Path`, ...] or [[`Method`, ...], `/Path`, ...]
2194
+ * @param pipe One or more request handlers
2195
+ * @param {RegisterPipelineOptions} options Register pipeline options
2196
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2197
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
2198
+ * @returns This router instance.
2199
+ */
1387
2200
  handle(methodPaths, pipe, options) {
1388
2201
  const methodPathIsArray = Array.isArray(methodPaths);
1389
2202
  if (methodPathIsArray &&
@@ -1414,6 +2227,16 @@ class Router {
1414
2227
  : methodPaths;
1415
2228
  return this.register("handler", methodPaths_, pipe, options);
1416
2229
  }
2230
+ /**
2231
+ * Define fallbacks for the specified method paths.
2232
+ *
2233
+ * @param {MethodPath|Array<MethodPath>} methodPaths Method-path definitions in the form of: `Method /Path`, or [`Method /Path`, ...] or [[`Method`, ...], `/Path`, ...]
2234
+ * @param pipe One or more request handlers
2235
+ * @param {RegisterPipelineOptions} options Register pipeline options
2236
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2237
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
2238
+ * @returns This router instance.
2239
+ */
1417
2240
  fallback(methodPaths, pipe, options) {
1418
2241
  const methodPathIsArray = Array.isArray(methodPaths);
1419
2242
  if (methodPathIsArray &&
@@ -1444,6 +2267,16 @@ class Router {
1444
2267
  : methodPaths;
1445
2268
  return this.register("fallback", methodPaths_, pipe, options);
1446
2269
  }
2270
+ /**
2271
+ * Define afters for the specified method paths.
2272
+ *
2273
+ * @param {MethodPath|Array<MethodPath>} methodPaths Method-path definitions in the form of: `Method /Path`, or [`Method /Path`, ...] or [[`Method`, ...], `/Path`, ...]
2274
+ * @param pipe One or more request handlers
2275
+ * @param {RegisterPipelineOptions} options Register pipeline options
2276
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2277
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
2278
+ * @returns This router instance.
2279
+ */
1447
2280
  after(methodPaths, pipe, options) {
1448
2281
  const methodPathIsArray = Array.isArray(methodPaths);
1449
2282
  if (methodPathIsArray &&
@@ -1474,6 +2307,16 @@ class Router {
1474
2307
  : methodPaths;
1475
2308
  return this.register("after", methodPaths_, pipe, options);
1476
2309
  }
2310
+ /**
2311
+ * Define catchers for the specified method paths.
2312
+ *
2313
+ * @param {MethodPath|Array<MethodPath>} methodPaths Method-path definitions in the form of: `Method /Path`, or [`Method /Path`, ...] or [[`Method`, ...], `/Path`, ...]
2314
+ * @param pipe One or more request handlers
2315
+ * @param {RegisterPipelineOptions} options Register pipeline options
2316
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2317
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
2318
+ * @returns This router instance.
2319
+ */
1477
2320
  catch(methodPaths, pipe, options) {
1478
2321
  const methodPathIsArray = Array.isArray(methodPaths);
1479
2322
  if (methodPathIsArray &&
@@ -1504,11 +2347,24 @@ class Router {
1504
2347
  : methodPaths;
1505
2348
  return this.register("catcher", methodPaths_, pipe, options);
1506
2349
  }
2350
+ /**
2351
+ * Register route handlers for the specified handler type and method paths.
2352
+ *
2353
+ * @param {HandlerType} handlerType Handler type. `"handler"`, `"filter"`, `"fallback"`, `"after"`, `"catcher"`
2354
+ * @param {MethodPath|Array<MethodPath>} methodPaths Method-path definitions in the form of: `Method /Path`, or [`Method /Path`, ...] or [[`Method`, ...], `/Path`, ...]
2355
+ * @param pipe One or more request handlers
2356
+ * @param {RegisterPipelineOptions} options Register pipeline options
2357
+ * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2358
+ * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
2359
+ * @returns This router instance.
2360
+ */
1507
2361
  register(handlerType, methodPaths, pipe, options) {
1508
2362
  const overwrite = (options === null || options === void 0 ? void 0 : options.overwrite) === true;
1509
- methodPaths = Array.isArray(methodPaths) ? methodPaths : [methodPaths];
2363
+ const methodPaths_ = Array.isArray(methodPaths)
2364
+ ? methodPaths
2365
+ : [methodPaths];
1510
2366
  const pipe_ = Array.isArray(pipe) ? pipe : [pipe];
1511
- for (const methodPath of methodPaths) {
2367
+ for (const methodPath of methodPaths_) {
1512
2368
  const separator1Idx = methodPath.indexOf(" ");
1513
2369
  const method = methodPath.substring(0, separator1Idx);
1514
2370
  const originalPath = methodPath.substring(separator1Idx + 1);
@@ -1637,8 +2493,25 @@ class Router {
1637
2493
  }
1638
2494
  }
1639
2495
  }
2496
+ // register setters for later use like append.
2497
+ if (!__classPrivateFieldGet(this, _Router_config, "f").doNotStoreSetters) {
2498
+ __classPrivateFieldGet(this, _Router_setters, "f").push(Object.freeze({
2499
+ handlerType,
2500
+ methodPaths,
2501
+ pipe,
2502
+ options,
2503
+ }));
2504
+ }
1640
2505
  return this;
1641
2506
  }
2507
+ /**
2508
+ *
2509
+ * @param pathname Valid url pathname
2510
+ * @param parts Destination parts array to push path parts to.
2511
+ * @param maxPath The max path part count limit.
2512
+ * @returns count of path parts if valid.
2513
+ * @returns -count if path parts are greater than maxPath.
2514
+ */
1642
2515
  splitPath(pathname, parts, maxPath) {
1643
2516
  const path_len_1 = pathname.length - 1;
1644
2517
  let count = 0;
@@ -1669,7 +2542,7 @@ class Router {
1669
2542
  }
1670
2543
  }
1671
2544
  exports.Router = Router;
1672
- _Router_config = new WeakMap(), _Router_routes = new WeakMap(), _Router_instances = new WeakSet(), _Router_generateUniqueOperationId = function _Router_generateUniqueOperationId(method, path, clean, usedIds) {
2545
+ _Router_config = new WeakMap(), _Router_routes = new WeakMap(), _Router_setters = new WeakMap(), _Router_instances = new WeakSet(), _Router_generateUniqueOperationId = function _Router_generateUniqueOperationId(method, path, clean, usedIds) {
1673
2546
  let baseId = generateOperationId(method, path, clean);
1674
2547
  let operationId = baseId;
1675
2548
  let counter = 1;
@@ -1920,8 +2793,20 @@ const parseParams = (superGlobIndex, params, pathname, parts, paramsRef) => {
1920
2793
  }
1921
2794
  return paramsRec;
1922
2795
  };
1923
- const translateRouteFilePath = (pathname, maxPath = 64) => {
2796
+ /**
2797
+ * Translate route definition file pathname into valid route pathname.
2798
+ *
2799
+ * @param pathname The file path name of the route definition.
2800
+ * @param maxPath The max path part count limit.
2801
+ * @returns {string} Valid route pathname.
2802
+ * @throws {RouterError} `Invalid path ${pathname} -> ${part}` if invalid path encountered.
2803
+ * @throws {RouterError} `Max path exceeded` if maxPath is exceeded.
2804
+ */
2805
+ const translateRouteFilePath = (pathname, maxPath) => {
1924
2806
  const parts = pathname.split("/", maxPath + 1);
2807
+ if (parts.length > maxPath) {
2808
+ throw new types_ts_1.RouterError("Max path exceeded");
2809
+ }
1925
2810
  const parts_len_1 = parts.length - 1;
1926
2811
  let lastPartIsEscaped = false;
1927
2812
  for (let i = 1; i < parts.length; i++) {