@bepalo/spine 3.12.26 → 3.13.28

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.
@@ -131,7 +131,7 @@ class Router {
131
131
  * Respond to a request according to the defined routes.
132
132
  *
133
133
  * @param {Request} request An http request object
134
- * @param {RespondContext<ExtendContext>} ctxInit Context pre-initialization.
134
+ * @param {RespondContext<_ExtendContext>} ctxInit Context pre-initialization.
135
135
  * Only headers and timestamps are allowed.
136
136
  * But timestamps properties will not be overridden but rather extended.
137
137
  * @returns {Response} An http response object
@@ -366,8 +366,10 @@ class Router {
366
366
  }
367
367
  }
368
368
  if (!(response instanceof Response)) {
369
- const status = ctx.error && ctx.error instanceof types_ts_1.HttpError
370
- ? ctx.error.status
369
+ const status = ctx.error &&
370
+ ctx.error instanceof types_ts_1.HttpError
371
+ ? ctx.error
372
+ .status
371
373
  : status_ts_1.Status._500_InternalServerError;
372
374
  response = new Response(null, {
373
375
  status,
@@ -429,6 +431,20 @@ class Router {
429
431
  });
430
432
  }
431
433
  /**
434
+ * Register routes defined in the other router to this router.
435
+ *
436
+ * @param {Router<_ExtendContext,ExtendContext>} router The router to append routes definitions from.
437
+ * @param {{overwrite:boolean}} options Options to apply to each route definition.
438
+ * @param {boolean} [options.overwrite] Overwrite each route definition. This overrides the route specific options.
439
+ */
440
+ append(router, options) {
441
+ const overwrite = options === null || options === void 0 ? void 0 : options.overwrite;
442
+ for (const { handlerType, methodPaths, pipe, options: setterOptions, } of __classPrivateFieldGet(router, _Router_setters, "f")) {
443
+ this.register(handlerType, methodPaths, pipe, Object.assign(Object.assign({}, setterOptions), { overwrite: (setterOptions === null || setterOptions === void 0 ? void 0 : setterOptions.overwrite) || overwrite }));
444
+ }
445
+ }
446
+ /**
447
+ * Register routes defined in the other router to this router under the prefix path.
432
448
  *
433
449
  * @param {string} prefix Path prefix to prepend to paths.
434
450
  * @param {Router<_ExtendContext,ExtendContext>} router The router to append routes definitions from.
@@ -1011,7 +1027,7 @@ class Router {
1011
1027
  * Define handlers for all http methods ["Head","Get","Query","Post","Put","Patch","Delete","Options","Trace","Connect"] and the specified paths.
1012
1028
  *
1013
1029
  * @param {Path} paths One or more valid route paths
1014
- * @param pipe One or more request handlers
1030
+ * @param pipe One or more main handlers
1015
1031
  * @param {RegisterPipelineOptions} options Register pipeline options
1016
1032
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1017
1033
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1031,7 +1047,7 @@ class Router {
1031
1047
  * Define handlers for CRUD http methods ["Get","Query","Post","Put","Patch","Delete"] and the specified paths.
1032
1048
  *
1033
1049
  * @param {Path} paths One or more valid route paths
1034
- * @param pipe One or more request handlers
1050
+ * @param pipe One or more main handlers
1035
1051
  * @param {RegisterPipelineOptions} options Register pipeline options
1036
1052
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1037
1053
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1051,7 +1067,7 @@ class Router {
1051
1067
  * Define handlers for Head http method and the specified paths.
1052
1068
  *
1053
1069
  * @param {Path} paths One or more valid route paths
1054
- * @param pipe One or more request handlers
1070
+ * @param pipe One or more main handlers
1055
1071
  * @param {RegisterPipelineOptions} options Register pipeline options
1056
1072
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1057
1073
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1066,7 +1082,7 @@ class Router {
1066
1082
  * Define handlers for Get http method and the specified paths.
1067
1083
  *
1068
1084
  * @param {Path} paths One or more valid route paths
1069
- * @param pipe One or more request handlers
1085
+ * @param pipe One or more main handlers
1070
1086
  * @param {RegisterPipelineOptions} options Register pipeline options
1071
1087
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1072
1088
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1081,7 +1097,7 @@ class Router {
1081
1097
  * Define handlers for Query http method and the specified paths.
1082
1098
  *
1083
1099
  * @param {Path} paths One or more valid route paths
1084
- * @param pipe One or more request handlers
1100
+ * @param pipe One or more main handlers
1085
1101
  * @param {RegisterPipelineOptions} options Register pipeline options
1086
1102
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1087
1103
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1096,7 +1112,7 @@ class Router {
1096
1112
  * Define handlers for Post http method and the specified paths.
1097
1113
  *
1098
1114
  * @param {Path} paths One or more valid route paths
1099
- * @param pipe One or more request handlers
1115
+ * @param pipe One or more main handlers
1100
1116
  * @param {RegisterPipelineOptions} options Register pipeline options
1101
1117
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1102
1118
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1111,7 +1127,7 @@ class Router {
1111
1127
  * Define handlers for Put http method and the specified paths.
1112
1128
  *
1113
1129
  * @param {Path} paths One or more valid route paths
1114
- * @param pipe One or more request handlers
1130
+ * @param pipe One or more main handlers
1115
1131
  * @param {RegisterPipelineOptions} options Register pipeline options
1116
1132
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1117
1133
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1126,7 +1142,7 @@ class Router {
1126
1142
  * Define handlers for Patch http method and the specified paths.
1127
1143
  *
1128
1144
  * @param {Path} paths One or more valid route paths
1129
- * @param pipe One or more request handlers
1145
+ * @param pipe One or more main handlers
1130
1146
  * @param {RegisterPipelineOptions} options Register pipeline options
1131
1147
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1132
1148
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1141,7 +1157,7 @@ class Router {
1141
1157
  * Define handlers for Head Delete method and the specified paths.
1142
1158
  *
1143
1159
  * @param {Path} paths One or more valid route paths
1144
- * @param pipe One or more request handlers
1160
+ * @param pipe One or more main handlers
1145
1161
  * @param {RegisterPipelineOptions} options Register pipeline options
1146
1162
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1147
1163
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1156,7 +1172,7 @@ class Router {
1156
1172
  * Define handlers for Options http method and the specified paths.
1157
1173
  *
1158
1174
  * @param {Path} paths One or more valid route paths
1159
- * @param pipe One or more request handlers
1175
+ * @param pipe One or more main handlers
1160
1176
  * @param {RegisterPipelineOptions} options Register pipeline options
1161
1177
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1162
1178
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1171,7 +1187,7 @@ class Router {
1171
1187
  * Define handlers for Trace http method and the specified paths.
1172
1188
  *
1173
1189
  * @param {Path} paths One or more valid route paths
1174
- * @param pipe One or more request handlers
1190
+ * @param pipe One or more main handlers
1175
1191
  * @param {RegisterPipelineOptions} options Register pipeline options
1176
1192
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1177
1193
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1186,7 +1202,7 @@ class Router {
1186
1202
  * Define handlers for Connect http method and the specified paths.
1187
1203
  *
1188
1204
  * @param {Path} paths One or more valid route paths
1189
- * @param pipe One or more request handlers
1205
+ * @param pipe One or more main handlers
1190
1206
  * @param {RegisterPipelineOptions} options Register pipeline options
1191
1207
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1192
1208
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1201,7 +1217,7 @@ class Router {
1201
1217
  * Define filters for all http methods ["Head","Get","Query","Post","Put","Patch","Delete","Options","Trace","Connect"] and the specified paths.
1202
1218
  *
1203
1219
  * @param {Path} paths One or more valid route paths
1204
- * @param pipe One or more request handlers
1220
+ * @param pipe One or more filtering handlers
1205
1221
  * @param {RegisterPipelineOptions} options Register pipeline options
1206
1222
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1207
1223
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1221,7 +1237,7 @@ class Router {
1221
1237
  * Define filters for CRUD http methods ["Get","Query","Post","Put","Patch","Delete"] and the specified paths.
1222
1238
  *
1223
1239
  * @param {Path} paths One or more valid route paths
1224
- * @param pipe One or more request handlers
1240
+ * @param pipe One or more filtering handlers
1225
1241
  * @param {RegisterPipelineOptions} options Register pipeline options
1226
1242
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1227
1243
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1241,7 +1257,7 @@ class Router {
1241
1257
  * Define filters for Head http method and the specified paths.
1242
1258
  *
1243
1259
  * @param {Path} paths One or more valid route paths
1244
- * @param pipe One or more request handlers
1260
+ * @param pipe One or more filtering handlers
1245
1261
  * @param {RegisterPipelineOptions} options Register pipeline options
1246
1262
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1247
1263
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1256,7 +1272,7 @@ class Router {
1256
1272
  * Define filters for Get http method and the specified paths.
1257
1273
  *
1258
1274
  * @param {Path} paths One or more valid route paths
1259
- * @param pipe One or more request handlers
1275
+ * @param pipe One or more filtering handlers
1260
1276
  * @param {RegisterPipelineOptions} options Register pipeline options
1261
1277
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1262
1278
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1271,7 +1287,7 @@ class Router {
1271
1287
  * Define filters for Query http method and the specified paths.
1272
1288
  *
1273
1289
  * @param {Path} paths One or more valid route paths
1274
- * @param pipe One or more request handlers
1290
+ * @param pipe One or more filtering handlers
1275
1291
  * @param {RegisterPipelineOptions} options Register pipeline options
1276
1292
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1277
1293
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1286,7 +1302,7 @@ class Router {
1286
1302
  * Define filters for Post http method and the specified paths.
1287
1303
  *
1288
1304
  * @param {Path} paths One or more valid route paths
1289
- * @param pipe One or more request handlers
1305
+ * @param pipe One or more filtering handlers
1290
1306
  * @param {RegisterPipelineOptions} options Register pipeline options
1291
1307
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1292
1308
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1301,7 +1317,7 @@ class Router {
1301
1317
  * Define filters for Put http method and the specified paths.
1302
1318
  *
1303
1319
  * @param {Path} paths One or more valid route paths
1304
- * @param pipe One or more request handlers
1320
+ * @param pipe One or more filtering handlers
1305
1321
  * @param {RegisterPipelineOptions} options Register pipeline options
1306
1322
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1307
1323
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1316,7 +1332,7 @@ class Router {
1316
1332
  * Define filters for Patch http method and the specified paths.
1317
1333
  *
1318
1334
  * @param {Path} paths One or more valid route paths
1319
- * @param pipe One or more request handlers
1335
+ * @param pipe One or more filtering handlers
1320
1336
  * @param {RegisterPipelineOptions} options Register pipeline options
1321
1337
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1322
1338
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1331,7 +1347,7 @@ class Router {
1331
1347
  * Define filters for Head Delete method and the specified paths.
1332
1348
  *
1333
1349
  * @param {Path} paths One or more valid route paths
1334
- * @param pipe One or more request handlers
1350
+ * @param pipe One or more filtering handlers
1335
1351
  * @param {RegisterPipelineOptions} options Register pipeline options
1336
1352
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1337
1353
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1346,7 +1362,7 @@ class Router {
1346
1362
  * Define filters for Options http method and the specified paths.
1347
1363
  *
1348
1364
  * @param {Path} paths One or more valid route paths
1349
- * @param pipe One or more request handlers
1365
+ * @param pipe One or more filtering handlers
1350
1366
  * @param {RegisterPipelineOptions} options Register pipeline options
1351
1367
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1352
1368
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1361,7 +1377,7 @@ class Router {
1361
1377
  * Define filters for Trace http method and the specified paths.
1362
1378
  *
1363
1379
  * @param {Path} paths One or more valid route paths
1364
- * @param pipe One or more request handlers
1380
+ * @param pipe One or more filtering handlers
1365
1381
  * @param {RegisterPipelineOptions} options Register pipeline options
1366
1382
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1367
1383
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1376,7 +1392,7 @@ class Router {
1376
1392
  * Define filters for Connect http method and the specified paths.
1377
1393
  *
1378
1394
  * @param {Path} paths One or more valid route paths
1379
- * @param pipe One or more request handlers
1395
+ * @param pipe One or more filtering handlers
1380
1396
  * @param {RegisterPipelineOptions} options Register pipeline options
1381
1397
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1382
1398
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1391,7 +1407,7 @@ class Router {
1391
1407
  * Define handlers for all http methods ["Head","Get","Query","Post","Put","Patch","Delete","Options","Trace","Connect"] and the specified paths.
1392
1408
  *
1393
1409
  * @param {Path} paths One or more valid route paths
1394
- * @param pipe One or more request handlers
1410
+ * @param pipe One or more main handlers
1395
1411
  * @param {RegisterPipelineOptions} options Register pipeline options
1396
1412
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1397
1413
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1411,7 +1427,7 @@ class Router {
1411
1427
  * Define handlers for CRUD http methods ["Get","Query","Post","Put","Patch","Delete"] and the specified paths.
1412
1428
  *
1413
1429
  * @param {Path} paths One or more valid route paths
1414
- * @param pipe One or more request handlers
1430
+ * @param pipe One or more main handlers
1415
1431
  * @param {RegisterPipelineOptions} options Register pipeline options
1416
1432
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1417
1433
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1431,7 +1447,7 @@ class Router {
1431
1447
  * Define handlers for Head http method and the specified paths.
1432
1448
  *
1433
1449
  * @param {Path} paths One or more valid route paths
1434
- * @param pipe One or more request handlers
1450
+ * @param pipe One or more main handlers
1435
1451
  * @param {RegisterPipelineOptions} options Register pipeline options
1436
1452
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1437
1453
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1446,7 +1462,7 @@ class Router {
1446
1462
  * Define handlers for Get http method and the specified paths.
1447
1463
  *
1448
1464
  * @param {Path} paths One or more valid route paths
1449
- * @param pipe One or more request handlers
1465
+ * @param pipe One or more main handlers
1450
1466
  * @param {RegisterPipelineOptions} options Register pipeline options
1451
1467
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1452
1468
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1461,7 +1477,7 @@ class Router {
1461
1477
  * Define handlers for Query http method and the specified paths.
1462
1478
  *
1463
1479
  * @param {Path} paths One or more valid route paths
1464
- * @param pipe One or more request handlers
1480
+ * @param pipe One or more main handlers
1465
1481
  * @param {RegisterPipelineOptions} options Register pipeline options
1466
1482
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1467
1483
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1476,7 +1492,7 @@ class Router {
1476
1492
  * Define handlers for Post http method and the specified paths.
1477
1493
  *
1478
1494
  * @param {Path} paths One or more valid route paths
1479
- * @param pipe One or more request handlers
1495
+ * @param pipe One or more main handlers
1480
1496
  * @param {RegisterPipelineOptions} options Register pipeline options
1481
1497
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1482
1498
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1491,7 +1507,7 @@ class Router {
1491
1507
  * Define handlers for Put http method and the specified paths.
1492
1508
  *
1493
1509
  * @param {Path} paths One or more valid route paths
1494
- * @param pipe One or more request handlers
1510
+ * @param pipe One or more main handlers
1495
1511
  * @param {RegisterPipelineOptions} options Register pipeline options
1496
1512
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1497
1513
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1506,7 +1522,7 @@ class Router {
1506
1522
  * Define handlers for Patch http method and the specified paths.
1507
1523
  *
1508
1524
  * @param {Path} paths One or more valid route paths
1509
- * @param pipe One or more request handlers
1525
+ * @param pipe One or more main handlers
1510
1526
  * @param {RegisterPipelineOptions} options Register pipeline options
1511
1527
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1512
1528
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1521,7 +1537,7 @@ class Router {
1521
1537
  * Define handlers for Head Delete method and the specified paths.
1522
1538
  *
1523
1539
  * @param {Path} paths One or more valid route paths
1524
- * @param pipe One or more request handlers
1540
+ * @param pipe One or more main handlers
1525
1541
  * @param {RegisterPipelineOptions} options Register pipeline options
1526
1542
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1527
1543
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1536,7 +1552,7 @@ class Router {
1536
1552
  * Define handlers for Options http method and the specified paths.
1537
1553
  *
1538
1554
  * @param {Path} paths One or more valid route paths
1539
- * @param pipe One or more request handlers
1555
+ * @param pipe One or more main handlers
1540
1556
  * @param {RegisterPipelineOptions} options Register pipeline options
1541
1557
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1542
1558
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1551,7 +1567,7 @@ class Router {
1551
1567
  * Define handlers for Trace http method and the specified paths.
1552
1568
  *
1553
1569
  * @param {Path} paths One or more valid route paths
1554
- * @param pipe One or more request handlers
1570
+ * @param pipe One or more main handlers
1555
1571
  * @param {RegisterPipelineOptions} options Register pipeline options
1556
1572
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1557
1573
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1566,7 +1582,7 @@ class Router {
1566
1582
  * Define handlers for Connect http method and the specified paths.
1567
1583
  *
1568
1584
  * @param {Path} paths One or more valid route paths
1569
- * @param pipe One or more request handlers
1585
+ * @param pipe One or more main handlers
1570
1586
  * @param {RegisterPipelineOptions} options Register pipeline options
1571
1587
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1572
1588
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1581,7 +1597,7 @@ class Router {
1581
1597
  * Define fallbacks for all http methods ["Head","Get","Query","Post","Put","Patch","Delete","Options","Trace","Connect"] and the specified paths.
1582
1598
  *
1583
1599
  * @param {Path} paths One or more valid route paths
1584
- * @param pipe One or more request handlers
1600
+ * @param pipe One or more fallback handlers
1585
1601
  * @param {RegisterPipelineOptions} options Register pipeline options
1586
1602
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1587
1603
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1601,7 +1617,7 @@ class Router {
1601
1617
  * Define fallbacks for CRUD http methods ["Get","Query","Post","Put","Patch","Delete"] and the specified paths.
1602
1618
  *
1603
1619
  * @param {Path} paths One or more valid route paths
1604
- * @param pipe One or more request handlers
1620
+ * @param pipe One or more fallback handlers
1605
1621
  * @param {RegisterPipelineOptions} options Register pipeline options
1606
1622
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1607
1623
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1621,7 +1637,7 @@ class Router {
1621
1637
  * Define fallbacks for Head http method and the specified paths.
1622
1638
  *
1623
1639
  * @param {Path} paths One or more valid route paths
1624
- * @param pipe One or more request handlers
1640
+ * @param pipe One or more fallback handlers
1625
1641
  * @param {RegisterPipelineOptions} options Register pipeline options
1626
1642
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1627
1643
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1636,7 +1652,7 @@ class Router {
1636
1652
  * Define fallbacks for Get http method and the specified paths.
1637
1653
  *
1638
1654
  * @param {Path} paths One or more valid route paths
1639
- * @param pipe One or more request handlers
1655
+ * @param pipe One or more fallback handlers
1640
1656
  * @param {RegisterPipelineOptions} options Register pipeline options
1641
1657
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1642
1658
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1651,7 +1667,7 @@ class Router {
1651
1667
  * Define fallbacks for Query http method and the specified paths.
1652
1668
  *
1653
1669
  * @param {Path} paths One or more valid route paths
1654
- * @param pipe One or more request handlers
1670
+ * @param pipe One or more fallback handlers
1655
1671
  * @param {RegisterPipelineOptions} options Register pipeline options
1656
1672
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1657
1673
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1666,7 +1682,7 @@ class Router {
1666
1682
  * Define fallbacks for Post http method and the specified paths.
1667
1683
  *
1668
1684
  * @param {Path} paths One or more valid route paths
1669
- * @param pipe One or more request handlers
1685
+ * @param pipe One or more fallback handlers
1670
1686
  * @param {RegisterPipelineOptions} options Register pipeline options
1671
1687
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1672
1688
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1681,7 +1697,7 @@ class Router {
1681
1697
  * Define fallbacks for Put http method and the specified paths.
1682
1698
  *
1683
1699
  * @param {Path} paths One or more valid route paths
1684
- * @param pipe One or more request handlers
1700
+ * @param pipe One or more fallback handlers
1685
1701
  * @param {RegisterPipelineOptions} options Register pipeline options
1686
1702
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1687
1703
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1696,7 +1712,7 @@ class Router {
1696
1712
  * Define fallbacks for Patch http method and the specified paths.
1697
1713
  *
1698
1714
  * @param {Path} paths One or more valid route paths
1699
- * @param pipe One or more request handlers
1715
+ * @param pipe One or more fallback handlers
1700
1716
  * @param {RegisterPipelineOptions} options Register pipeline options
1701
1717
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1702
1718
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1711,7 +1727,7 @@ class Router {
1711
1727
  * Define fallbacks for Head Delete method and the specified paths.
1712
1728
  *
1713
1729
  * @param {Path} paths One or more valid route paths
1714
- * @param pipe One or more request handlers
1730
+ * @param pipe One or more fallback handlers
1715
1731
  * @param {RegisterPipelineOptions} options Register pipeline options
1716
1732
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1717
1733
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1726,7 +1742,7 @@ class Router {
1726
1742
  * Define fallbacks for Options http method and the specified paths.
1727
1743
  *
1728
1744
  * @param {Path} paths One or more valid route paths
1729
- * @param pipe One or more request handlers
1745
+ * @param pipe One or more fallback handlers
1730
1746
  * @param {RegisterPipelineOptions} options Register pipeline options
1731
1747
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1732
1748
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1741,7 +1757,7 @@ class Router {
1741
1757
  * Define fallbacks for Trace http method and the specified paths.
1742
1758
  *
1743
1759
  * @param {Path} paths One or more valid route paths
1744
- * @param pipe One or more request handlers
1760
+ * @param pipe One or more fallback handlers
1745
1761
  * @param {RegisterPipelineOptions} options Register pipeline options
1746
1762
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1747
1763
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1756,7 +1772,7 @@ class Router {
1756
1772
  * Define fallbacks for Connect http method and the specified paths.
1757
1773
  *
1758
1774
  * @param {Path} paths One or more valid route paths
1759
- * @param pipe One or more request handlers
1775
+ * @param pipe One or more fallback handlers
1760
1776
  * @param {RegisterPipelineOptions} options Register pipeline options
1761
1777
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1762
1778
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1771,7 +1787,7 @@ class Router {
1771
1787
  * Define afters for all http methods ["Head","Get","Query","Post","Put","Patch","Delete","Options","Trace","Connect"] and the specified paths.
1772
1788
  *
1773
1789
  * @param {Path} paths One or more valid route paths
1774
- * @param pipe One or more request handlers
1790
+ * @param pipe One or more after handlers
1775
1791
  * @param {RegisterPipelineOptions} options Register pipeline options
1776
1792
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1777
1793
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1791,7 +1807,7 @@ class Router {
1791
1807
  * Define afters for CRUD http methods ["Get","Query","Post","Put","Patch","Delete"] and the specified paths.
1792
1808
  *
1793
1809
  * @param {Path} paths One or more valid route paths
1794
- * @param pipe One or more request handlers
1810
+ * @param pipe One or more after handlers
1795
1811
  * @param {RegisterPipelineOptions} options Register pipeline options
1796
1812
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1797
1813
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1811,7 +1827,7 @@ class Router {
1811
1827
  * Define afters for Head http method and the specified paths.
1812
1828
  *
1813
1829
  * @param {Path} paths One or more valid route paths
1814
- * @param pipe One or more request handlers
1830
+ * @param pipe One or more after handlers
1815
1831
  * @param {RegisterPipelineOptions} options Register pipeline options
1816
1832
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1817
1833
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1826,7 +1842,7 @@ class Router {
1826
1842
  * Define afters for Get http method and the specified paths.
1827
1843
  *
1828
1844
  * @param {Path} paths One or more valid route paths
1829
- * @param pipe One or more request handlers
1845
+ * @param pipe One or more after handlers
1830
1846
  * @param {RegisterPipelineOptions} options Register pipeline options
1831
1847
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1832
1848
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1841,7 +1857,7 @@ class Router {
1841
1857
  * Define afters for Query http method and the specified paths.
1842
1858
  *
1843
1859
  * @param {Path} paths One or more valid route paths
1844
- * @param pipe One or more request handlers
1860
+ * @param pipe One or more after handlers
1845
1861
  * @param {RegisterPipelineOptions} options Register pipeline options
1846
1862
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1847
1863
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1856,7 +1872,7 @@ class Router {
1856
1872
  * Define afters for Post http method and the specified paths.
1857
1873
  *
1858
1874
  * @param {Path} paths One or more valid route paths
1859
- * @param pipe One or more request handlers
1875
+ * @param pipe One or more after handlers
1860
1876
  * @param {RegisterPipelineOptions} options Register pipeline options
1861
1877
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1862
1878
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1871,7 +1887,7 @@ class Router {
1871
1887
  * Define afters for Put http method and the specified paths.
1872
1888
  *
1873
1889
  * @param {Path} paths One or more valid route paths
1874
- * @param pipe One or more request handlers
1890
+ * @param pipe One or more after handlers
1875
1891
  * @param {RegisterPipelineOptions} options Register pipeline options
1876
1892
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1877
1893
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1886,7 +1902,7 @@ class Router {
1886
1902
  * Define afters for Patch http method and the specified paths.
1887
1903
  *
1888
1904
  * @param {Path} paths One or more valid route paths
1889
- * @param pipe One or more request handlers
1905
+ * @param pipe One or more after handlers
1890
1906
  * @param {RegisterPipelineOptions} options Register pipeline options
1891
1907
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1892
1908
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1901,7 +1917,7 @@ class Router {
1901
1917
  * Define afters for Head Delete method and the specified paths.
1902
1918
  *
1903
1919
  * @param {Path} paths One or more valid route paths
1904
- * @param pipe One or more request handlers
1920
+ * @param pipe One or more after handlers
1905
1921
  * @param {RegisterPipelineOptions} options Register pipeline options
1906
1922
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1907
1923
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1916,7 +1932,7 @@ class Router {
1916
1932
  * Define afters for Options http method and the specified paths.
1917
1933
  *
1918
1934
  * @param {Path} paths One or more valid route paths
1919
- * @param pipe One or more request handlers
1935
+ * @param pipe One or more after handlers
1920
1936
  * @param {RegisterPipelineOptions} options Register pipeline options
1921
1937
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1922
1938
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1931,7 +1947,7 @@ class Router {
1931
1947
  * Define afters for Trace http method and the specified paths.
1932
1948
  *
1933
1949
  * @param {Path} paths One or more valid route paths
1934
- * @param pipe One or more request handlers
1950
+ * @param pipe One or more after handlers
1935
1951
  * @param {RegisterPipelineOptions} options Register pipeline options
1936
1952
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1937
1953
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1946,7 +1962,7 @@ class Router {
1946
1962
  * Define afters for Connect http method and the specified paths.
1947
1963
  *
1948
1964
  * @param {Path} paths One or more valid route paths
1949
- * @param pipe One or more request handlers
1965
+ * @param pipe One or more after handlers
1950
1966
  * @param {RegisterPipelineOptions} options Register pipeline options
1951
1967
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1952
1968
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1961,7 +1977,7 @@ class Router {
1961
1977
  * Define catchers for all http methods ["Head","Get","Query","Post","Put","Patch","Delete","Options","Trace","Connect"] and the specified paths.
1962
1978
  *
1963
1979
  * @param {Path} paths One or more valid route paths
1964
- * @param pipe One or more request handlers
1980
+ * @param pipe One or more error handlers
1965
1981
  * @param {RegisterPipelineOptions} options Register pipeline options
1966
1982
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1967
1983
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -1981,7 +1997,7 @@ class Router {
1981
1997
  * Define catchers for CRUD http methods ["Get","Query","Post","Put","Patch","Delete"] and the specified paths.
1982
1998
  *
1983
1999
  * @param {Path} paths One or more valid route paths
1984
- * @param pipe One or more request handlers
2000
+ * @param pipe One or more error handlers
1985
2001
  * @param {RegisterPipelineOptions} options Register pipeline options
1986
2002
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
1987
2003
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -2001,7 +2017,7 @@ class Router {
2001
2017
  * Define catchers for Head http method and the specified paths.
2002
2018
  *
2003
2019
  * @param {Path} paths One or more valid route paths
2004
- * @param pipe One or more request handlers
2020
+ * @param pipe One or more error handlers
2005
2021
  * @param {RegisterPipelineOptions} options Register pipeline options
2006
2022
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2007
2023
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -2016,7 +2032,7 @@ class Router {
2016
2032
  * Define catchers for Get http method and the specified paths.
2017
2033
  *
2018
2034
  * @param {Path} paths One or more valid route paths
2019
- * @param pipe One or more request handlers
2035
+ * @param pipe One or more error handlers
2020
2036
  * @param {RegisterPipelineOptions} options Register pipeline options
2021
2037
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2022
2038
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -2031,7 +2047,7 @@ class Router {
2031
2047
  * Define catchers for Query http method and the specified paths.
2032
2048
  *
2033
2049
  * @param {Path} paths One or more valid route paths
2034
- * @param pipe One or more request handlers
2050
+ * @param pipe One or more error handlers
2035
2051
  * @param {RegisterPipelineOptions} options Register pipeline options
2036
2052
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2037
2053
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -2046,7 +2062,7 @@ class Router {
2046
2062
  * Define catchers for Post http method and the specified paths.
2047
2063
  *
2048
2064
  * @param {Path} paths One or more valid route paths
2049
- * @param pipe One or more request handlers
2065
+ * @param pipe One or more error handlers
2050
2066
  * @param {RegisterPipelineOptions} options Register pipeline options
2051
2067
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2052
2068
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -2061,7 +2077,7 @@ class Router {
2061
2077
  * Define catchers for Put http method and the specified paths.
2062
2078
  *
2063
2079
  * @param {Path} paths One or more valid route paths
2064
- * @param pipe One or more request handlers
2080
+ * @param pipe One or more error handlers
2065
2081
  * @param {RegisterPipelineOptions} options Register pipeline options
2066
2082
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2067
2083
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -2076,7 +2092,7 @@ class Router {
2076
2092
  * Define catchers for Patch http method and the specified paths.
2077
2093
  *
2078
2094
  * @param {Path} paths One or more valid route paths
2079
- * @param pipe One or more request handlers
2095
+ * @param pipe One or more error handlers
2080
2096
  * @param {RegisterPipelineOptions} options Register pipeline options
2081
2097
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2082
2098
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -2091,7 +2107,7 @@ class Router {
2091
2107
  * Define catchers for Head Delete method and the specified paths.
2092
2108
  *
2093
2109
  * @param {Path} paths One or more valid route paths
2094
- * @param pipe One or more request handlers
2110
+ * @param pipe One or more error handlers
2095
2111
  * @param {RegisterPipelineOptions} options Register pipeline options
2096
2112
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2097
2113
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -2106,7 +2122,7 @@ class Router {
2106
2122
  * Define catchers for Options http method and the specified paths.
2107
2123
  *
2108
2124
  * @param {Path} paths One or more valid route paths
2109
- * @param pipe One or more request handlers
2125
+ * @param pipe One or more error handlers
2110
2126
  * @param {RegisterPipelineOptions} options Register pipeline options
2111
2127
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2112
2128
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -2121,7 +2137,7 @@ class Router {
2121
2137
  * Define catchers for Trace http method and the specified paths.
2122
2138
  *
2123
2139
  * @param {Path} paths One or more valid route paths
2124
- * @param pipe One or more request handlers
2140
+ * @param pipe One or more error handlers
2125
2141
  * @param {RegisterPipelineOptions} options Register pipeline options
2126
2142
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2127
2143
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -2136,7 +2152,7 @@ class Router {
2136
2152
  * Define catchers for Connect http method and the specified paths.
2137
2153
  *
2138
2154
  * @param {Path} paths One or more valid route paths
2139
- * @param pipe One or more request handlers
2155
+ * @param pipe One or more error handlers
2140
2156
  * @param {RegisterPipelineOptions} options Register pipeline options
2141
2157
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2142
2158
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -2151,7 +2167,7 @@ class Router {
2151
2167
  * Define filters for the specified method paths.
2152
2168
  *
2153
2169
  * @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
2170
+ * @param pipe One or more filtering handlers
2155
2171
  * @param {RegisterPipelineOptions} options Register pipeline options
2156
2172
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2157
2173
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -2168,6 +2184,9 @@ class Router {
2168
2184
  !methodPaths[0].every((mp) => typeof mp === "string")) {
2169
2185
  throw new types_ts_1.RouterError("Invalid method type. Allowed [[Methods...], ...Paths]");
2170
2186
  }
2187
+ if (firstElementIsArray && methodPaths[0].length === 0) {
2188
+ throw new types_ts_1.RouterError("Empty method. Allowed [[Methods...], ...Paths]");
2189
+ }
2171
2190
  if (methodPathIsArray &&
2172
2191
  !firstElementIsArray &&
2173
2192
  !methodPaths.every((mp) => typeof mp === "string")) {
@@ -2191,7 +2210,7 @@ class Router {
2191
2210
  * Define handlers for the specified method paths.
2192
2211
  *
2193
2212
  * @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
2213
+ * @param pipe One or more main handlers
2195
2214
  * @param {RegisterPipelineOptions} options Register pipeline options
2196
2215
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2197
2216
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -2208,6 +2227,9 @@ class Router {
2208
2227
  !methodPaths[0].every((mp) => typeof mp === "string")) {
2209
2228
  throw new types_ts_1.RouterError("Invalid method type. Allowed [[Methods...], ...Paths]");
2210
2229
  }
2230
+ if (firstElementIsArray && methodPaths[0].length === 0) {
2231
+ throw new types_ts_1.RouterError("Empty method. Allowed [[Methods...], ...Paths]");
2232
+ }
2211
2233
  if (methodPathIsArray &&
2212
2234
  !firstElementIsArray &&
2213
2235
  !methodPaths.every((mp) => typeof mp === "string")) {
@@ -2231,7 +2253,7 @@ class Router {
2231
2253
  * Define fallbacks for the specified method paths.
2232
2254
  *
2233
2255
  * @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
2256
+ * @param pipe One or more fallback handlers
2235
2257
  * @param {RegisterPipelineOptions} options Register pipeline options
2236
2258
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2237
2259
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -2248,6 +2270,9 @@ class Router {
2248
2270
  !methodPaths[0].every((mp) => typeof mp === "string")) {
2249
2271
  throw new types_ts_1.RouterError("Invalid method type. Allowed [[Methods...], ...Paths]");
2250
2272
  }
2273
+ if (firstElementIsArray && methodPaths[0].length === 0) {
2274
+ throw new types_ts_1.RouterError("Empty method. Allowed [[Methods...], ...Paths]");
2275
+ }
2251
2276
  if (methodPathIsArray &&
2252
2277
  !firstElementIsArray &&
2253
2278
  !methodPaths.every((mp) => typeof mp === "string")) {
@@ -2271,7 +2296,7 @@ class Router {
2271
2296
  * Define afters for the specified method paths.
2272
2297
  *
2273
2298
  * @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
2299
+ * @param pipe One or more after handlers
2275
2300
  * @param {RegisterPipelineOptions} options Register pipeline options
2276
2301
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2277
2302
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -2288,6 +2313,9 @@ class Router {
2288
2313
  !methodPaths[0].every((mp) => typeof mp === "string")) {
2289
2314
  throw new types_ts_1.RouterError("Invalid method type. Allowed [[Methods...], ...Paths]");
2290
2315
  }
2316
+ if (firstElementIsArray && methodPaths[0].length === 0) {
2317
+ throw new types_ts_1.RouterError("Empty method. Allowed [[Methods...], ...Paths]");
2318
+ }
2291
2319
  if (methodPathIsArray &&
2292
2320
  !firstElementIsArray &&
2293
2321
  !methodPaths.every((mp) => typeof mp === "string")) {
@@ -2311,7 +2339,7 @@ class Router {
2311
2339
  * Define catchers for the specified method paths.
2312
2340
  *
2313
2341
  * @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
2342
+ * @param pipe One or more error handlers
2315
2343
  * @param {RegisterPipelineOptions} options Register pipeline options
2316
2344
  * @param {boolean} [options.overwrite] Overwrite colliding route definitions.
2317
2345
  * @param {OpenApiDesc|false} [options.openApi] OpenApi definition
@@ -2328,6 +2356,9 @@ class Router {
2328
2356
  !methodPaths[0].every((mp) => typeof mp === "string")) {
2329
2357
  throw new types_ts_1.RouterError("Invalid method type. Allowed [[Methods...], ...Paths]");
2330
2358
  }
2359
+ if (firstElementIsArray && methodPaths[0].length === 0) {
2360
+ throw new types_ts_1.RouterError("Empty method. Allowed [[Methods...], ...Paths]");
2361
+ }
2331
2362
  if (methodPathIsArray &&
2332
2363
  !firstElementIsArray &&
2333
2364
  !methodPaths.every((mp) => typeof mp === "string")) {
@@ -2446,6 +2477,9 @@ class Router {
2446
2477
  if (superGlobEntries == null) {
2447
2478
  superGlobEntries = new Map();
2448
2479
  routes.superGlobs[parts_len_1] = superGlobEntries;
2480
+ if (routes.superGlobsIndices.indexOf(parts_len_1) === -1) {
2481
+ routes.superGlobsIndices.push(parts_len_1);
2482
+ }
2449
2483
  }
2450
2484
  superGlobEntries.set(basePath, entry);
2451
2485
  }
@@ -2477,6 +2511,9 @@ class Router {
2477
2511
  if (globEntries == null) {
2478
2512
  globEntries = new Map();
2479
2513
  routes.globs[parts.length] = globEntries;
2514
+ if (routes.globsIndices.indexOf(parts.length) === -1) {
2515
+ routes.globsIndices.push(parts.length);
2516
+ }
2480
2517
  }
2481
2518
  globEntries.set(path, entry);
2482
2519
  }
@@ -2488,6 +2525,9 @@ class Router {
2488
2525
  if (entries == null) {
2489
2526
  entries = new Map();
2490
2527
  routes.entries[parts.length] = entries;
2528
+ if (routes.entriesIndices.indexOf(parts.length) === -1) {
2529
+ routes.entriesIndices.push(parts.length);
2530
+ }
2491
2531
  }
2492
2532
  entries.set(path, entry);
2493
2533
  }
@@ -2497,9 +2537,11 @@ class Router {
2497
2537
  if (!__classPrivateFieldGet(this, _Router_config, "f").doNotStoreSetters) {
2498
2538
  __classPrivateFieldGet(this, _Router_setters, "f").push(Object.freeze({
2499
2539
  handlerType,
2500
- methodPaths,
2501
- pipe,
2502
- options,
2540
+ methodPaths: Array.isArray(methodPaths)
2541
+ ? Object.freeze(methodPaths)
2542
+ : methodPaths,
2543
+ pipe: Array.isArray(pipe) ? Object.freeze(pipe) : pipe,
2544
+ options: typeof options === "object" ? Object.freeze(options) : options,
2503
2545
  }));
2504
2546
  }
2505
2547
  return this;
@@ -2540,6 +2582,408 @@ class Router {
2540
2582
  }
2541
2583
  return count;
2542
2584
  }
2585
+ /**
2586
+ * Generates a routes object keyed by pathname then by method then by handler-type.
2587
+ *
2588
+ * @returns Routes object
2589
+ */
2590
+ getRoutesByPathnameThenMethod() {
2591
+ const routes = {};
2592
+ for (const handlerType of Object.keys(__classPrivateFieldGet(this, _Router_routes, "f"))) {
2593
+ const entry0 = __classPrivateFieldGet(this, _Router_routes, "f")[handlerType];
2594
+ for (const methodUpper of Object.keys(entry0)) {
2595
+ const entry1 = entry0[methodUpper];
2596
+ // super-globs
2597
+ for (const superGlobEntryIdx of entry1.superGlobsIndices) {
2598
+ const superGlobEntries = entry1.superGlobs[superGlobEntryIdx];
2599
+ for (const [, entry] of superGlobEntries) {
2600
+ if (!entry.pipe) {
2601
+ continue;
2602
+ }
2603
+ if (!routes[entry.standardPath]) {
2604
+ routes[entry.standardPath] = {};
2605
+ }
2606
+ if (!routes[entry.standardPath][methodUpper]) {
2607
+ routes[entry.standardPath][methodUpper] = {};
2608
+ }
2609
+ routes[entry.standardPath][methodUpper][handlerType] = Array.isArray(entry.pipe) ? [...entry.pipe] : entry.pipe;
2610
+ }
2611
+ }
2612
+ // globs
2613
+ for (const globEntryIdx of entry1.globsIndices) {
2614
+ const globEntries = entry1.globs[globEntryIdx];
2615
+ for (const [, entry] of globEntries) {
2616
+ if (!entry.pipe) {
2617
+ continue;
2618
+ }
2619
+ if (!routes[entry.standardPath]) {
2620
+ routes[entry.standardPath] = {};
2621
+ }
2622
+ if (!routes[entry.standardPath][methodUpper]) {
2623
+ routes[entry.standardPath][methodUpper] = {};
2624
+ }
2625
+ routes[entry.standardPath][methodUpper][handlerType] = Array.isArray(entry.pipe) ? [...entry.pipe] : entry.pipe;
2626
+ }
2627
+ }
2628
+ // normal paths
2629
+ for (const entryIdx of entry1.entriesIndices) {
2630
+ const entries = entry1.entries[entryIdx];
2631
+ for (const [, entry] of entries) {
2632
+ if (!entry.pipe) {
2633
+ continue;
2634
+ }
2635
+ if (!routes[entry.standardPath]) {
2636
+ routes[entry.standardPath] = {};
2637
+ }
2638
+ if (!routes[entry.standardPath][methodUpper]) {
2639
+ routes[entry.standardPath][methodUpper] = {};
2640
+ }
2641
+ routes[entry.standardPath][methodUpper][handlerType] = Array.isArray(entry.pipe) ? [...entry.pipe] : entry.pipe;
2642
+ }
2643
+ }
2644
+ }
2645
+ }
2646
+ return routes;
2647
+ }
2648
+ /**
2649
+ * Generates a routes object keyed by pathname then by handler-type then by method.
2650
+ *
2651
+ * @returns Routes object
2652
+ */
2653
+ getRoutesByPathnameThenHandlerType() {
2654
+ const routes = {};
2655
+ for (const handlerType of Object.keys(__classPrivateFieldGet(this, _Router_routes, "f"))) {
2656
+ const entry0 = __classPrivateFieldGet(this, _Router_routes, "f")[handlerType];
2657
+ for (const methodUpper of Object.keys(entry0)) {
2658
+ const entry1 = entry0[methodUpper];
2659
+ // super-globs
2660
+ for (const superGlobEntryIdx of entry1.superGlobsIndices) {
2661
+ const superGlobEntries = entry1.superGlobs[superGlobEntryIdx];
2662
+ for (const [, entry] of superGlobEntries) {
2663
+ if (!entry.pipe) {
2664
+ continue;
2665
+ }
2666
+ if (!routes[entry.standardPath]) {
2667
+ routes[entry.standardPath] = {};
2668
+ }
2669
+ if (!routes[entry.standardPath][handlerType]) {
2670
+ routes[entry.standardPath][handlerType] =
2671
+ {};
2672
+ }
2673
+ routes[entry.standardPath][handlerType][methodUpper] = Array.isArray(entry.pipe) ? [...entry.pipe] : entry.pipe;
2674
+ }
2675
+ }
2676
+ // globs
2677
+ for (const globEntryIdx of entry1.globsIndices) {
2678
+ const globEntries = entry1.globs[globEntryIdx];
2679
+ for (const [, entry] of globEntries) {
2680
+ if (!entry.pipe) {
2681
+ continue;
2682
+ }
2683
+ if (!routes[entry.standardPath]) {
2684
+ routes[entry.standardPath] = {};
2685
+ }
2686
+ if (!routes[entry.standardPath][handlerType]) {
2687
+ routes[entry.standardPath][handlerType] =
2688
+ {};
2689
+ }
2690
+ routes[entry.standardPath][handlerType][methodUpper] = Array.isArray(entry.pipe) ? [...entry.pipe] : entry.pipe;
2691
+ }
2692
+ }
2693
+ // normal paths
2694
+ for (const entryIdx of entry1.entriesIndices) {
2695
+ const entries = entry1.entries[entryIdx];
2696
+ for (const [, entry] of entries) {
2697
+ if (!entry.pipe) {
2698
+ continue;
2699
+ }
2700
+ if (!routes[entry.standardPath]) {
2701
+ routes[entry.standardPath] = {};
2702
+ }
2703
+ if (!routes[entry.standardPath][handlerType]) {
2704
+ routes[entry.standardPath][handlerType] =
2705
+ {};
2706
+ }
2707
+ routes[entry.standardPath][handlerType][methodUpper] = Array.isArray(entry.pipe) ? [...entry.pipe] : entry.pipe;
2708
+ }
2709
+ }
2710
+ }
2711
+ }
2712
+ return routes;
2713
+ }
2714
+ /**
2715
+ * Generates a routes object keyed by method then by pathname then by handler-type.
2716
+ *
2717
+ * @returns Routes object
2718
+ */
2719
+ getRoutesByMethodThenPathname() {
2720
+ const routes = {};
2721
+ for (const handlerType of Object.keys(__classPrivateFieldGet(this, _Router_routes, "f"))) {
2722
+ const entry0 = __classPrivateFieldGet(this, _Router_routes, "f")[handlerType];
2723
+ for (const methodUpper of Object.keys(entry0)) {
2724
+ const entry1 = entry0[methodUpper];
2725
+ // super-globs
2726
+ for (const superGlobEntryIdx of entry1.superGlobsIndices) {
2727
+ const superGlobEntries = entry1.superGlobs[superGlobEntryIdx];
2728
+ for (const [, entry] of superGlobEntries) {
2729
+ if (!entry.pipe) {
2730
+ continue;
2731
+ }
2732
+ if (!routes[methodUpper]) {
2733
+ routes[methodUpper] = {};
2734
+ }
2735
+ if (!routes[methodUpper][entry.standardPath]) {
2736
+ routes[methodUpper][entry.standardPath] = {};
2737
+ }
2738
+ routes[methodUpper][entry.standardPath][handlerType] = Array.isArray(entry.pipe)
2739
+ ? [...entry.pipe]
2740
+ : entry.pipe;
2741
+ }
2742
+ }
2743
+ // globs
2744
+ for (const globEntryIdx of entry1.globsIndices) {
2745
+ const globEntries = entry1.globs[globEntryIdx];
2746
+ for (const [, entry] of globEntries) {
2747
+ if (!entry.pipe) {
2748
+ continue;
2749
+ }
2750
+ if (!routes[methodUpper]) {
2751
+ routes[methodUpper] = {};
2752
+ }
2753
+ if (!routes[methodUpper][entry.standardPath]) {
2754
+ routes[methodUpper][entry.standardPath] = {};
2755
+ }
2756
+ routes[methodUpper][entry.standardPath][handlerType] = Array.isArray(entry.pipe)
2757
+ ? [...entry.pipe]
2758
+ : entry.pipe;
2759
+ }
2760
+ }
2761
+ // normal paths
2762
+ for (const entryIdx of entry1.entriesIndices) {
2763
+ const entries = entry1.entries[entryIdx];
2764
+ for (const [, entry] of entries) {
2765
+ if (!entry.pipe) {
2766
+ continue;
2767
+ }
2768
+ if (!routes[methodUpper]) {
2769
+ routes[methodUpper] = {};
2770
+ }
2771
+ if (!routes[methodUpper][entry.standardPath]) {
2772
+ routes[methodUpper][entry.standardPath] = {};
2773
+ }
2774
+ routes[methodUpper][entry.standardPath][handlerType] = Array.isArray(entry.pipe)
2775
+ ? [...entry.pipe]
2776
+ : entry.pipe;
2777
+ }
2778
+ }
2779
+ }
2780
+ }
2781
+ return routes;
2782
+ }
2783
+ /**
2784
+ * Generates a routes object keyed by method then by handler-type then by pathname.
2785
+ *
2786
+ * @returns Routes object
2787
+ */
2788
+ getRoutesByMethodThenHandlerType() {
2789
+ const routes = {};
2790
+ for (const handlerType of Object.keys(__classPrivateFieldGet(this, _Router_routes, "f"))) {
2791
+ const entry0 = __classPrivateFieldGet(this, _Router_routes, "f")[handlerType];
2792
+ for (const methodUpper of Object.keys(entry0)) {
2793
+ const entry1 = entry0[methodUpper];
2794
+ // super-globs
2795
+ for (const superGlobEntryIdx of entry1.superGlobsIndices) {
2796
+ const superGlobEntries = entry1.superGlobs[superGlobEntryIdx];
2797
+ for (const [, entry] of superGlobEntries) {
2798
+ if (!entry.pipe) {
2799
+ continue;
2800
+ }
2801
+ if (!routes[methodUpper]) {
2802
+ routes[methodUpper] = {};
2803
+ }
2804
+ if (!routes[methodUpper][handlerType]) {
2805
+ routes[methodUpper][handlerType] = {};
2806
+ }
2807
+ routes[methodUpper][handlerType][entry.standardPath] = Array.isArray(entry.pipe)
2808
+ ? [...entry.pipe]
2809
+ : entry.pipe;
2810
+ }
2811
+ }
2812
+ // globs
2813
+ for (const globEntryIdx of entry1.globsIndices) {
2814
+ const globEntries = entry1.globs[globEntryIdx];
2815
+ for (const [, entry] of globEntries) {
2816
+ if (!entry.pipe) {
2817
+ continue;
2818
+ }
2819
+ if (!routes[methodUpper]) {
2820
+ routes[methodUpper] = {};
2821
+ }
2822
+ if (!routes[methodUpper][handlerType]) {
2823
+ routes[methodUpper][handlerType] = {};
2824
+ }
2825
+ routes[methodUpper][handlerType][entry.standardPath] = Array.isArray(entry.pipe)
2826
+ ? [...entry.pipe]
2827
+ : entry.pipe;
2828
+ }
2829
+ }
2830
+ // normal paths
2831
+ for (const entryIdx of entry1.entriesIndices) {
2832
+ const entries = entry1.entries[entryIdx];
2833
+ for (const [, entry] of entries) {
2834
+ if (!entry.pipe) {
2835
+ continue;
2836
+ }
2837
+ if (!routes[methodUpper]) {
2838
+ routes[methodUpper] = {};
2839
+ }
2840
+ if (!routes[methodUpper][handlerType]) {
2841
+ routes[methodUpper][handlerType] = {};
2842
+ }
2843
+ routes[methodUpper][handlerType][entry.standardPath] = Array.isArray(entry.pipe)
2844
+ ? [...entry.pipe]
2845
+ : entry.pipe;
2846
+ }
2847
+ }
2848
+ }
2849
+ }
2850
+ return routes;
2851
+ }
2852
+ /**
2853
+ * Generates a routes object keyed by handler-type then by method then by pathname.
2854
+ *
2855
+ * @returns Routes object
2856
+ */
2857
+ getRoutesByHandlerTypeThenMethod() {
2858
+ const routes = {};
2859
+ for (const handlerType of Object.keys(__classPrivateFieldGet(this, _Router_routes, "f"))) {
2860
+ const entry0 = __classPrivateFieldGet(this, _Router_routes, "f")[handlerType];
2861
+ for (const methodUpper of Object.keys(entry0)) {
2862
+ const entry1 = entry0[methodUpper];
2863
+ // super-globs
2864
+ for (const superGlobEntryIdx of entry1.superGlobsIndices) {
2865
+ const superGlobEntries = entry1.superGlobs[superGlobEntryIdx];
2866
+ for (const [, entry] of superGlobEntries) {
2867
+ if (!entry.pipe) {
2868
+ continue;
2869
+ }
2870
+ if (!routes[handlerType]) {
2871
+ routes[handlerType] = {};
2872
+ }
2873
+ if (!routes[handlerType][methodUpper]) {
2874
+ routes[handlerType][methodUpper] = {};
2875
+ }
2876
+ routes[handlerType][methodUpper][entry.standardPath] = Array.isArray(entry.pipe)
2877
+ ? [...entry.pipe]
2878
+ : entry.pipe;
2879
+ }
2880
+ }
2881
+ // globs
2882
+ for (const globEntryIdx of entry1.globsIndices) {
2883
+ const globEntries = entry1.globs[globEntryIdx];
2884
+ for (const [, entry] of globEntries) {
2885
+ if (!entry.pipe) {
2886
+ continue;
2887
+ }
2888
+ if (!routes[handlerType]) {
2889
+ routes[handlerType] = {};
2890
+ }
2891
+ if (!routes[handlerType][methodUpper]) {
2892
+ routes[handlerType][methodUpper] = {};
2893
+ }
2894
+ routes[handlerType][methodUpper][entry.standardPath] = Array.isArray(entry.pipe)
2895
+ ? [...entry.pipe]
2896
+ : entry.pipe;
2897
+ }
2898
+ }
2899
+ // normal paths
2900
+ for (const entryIdx of entry1.entriesIndices) {
2901
+ const entries = entry1.entries[entryIdx];
2902
+ for (const [, entry] of entries) {
2903
+ if (!entry.pipe) {
2904
+ continue;
2905
+ }
2906
+ if (!routes[handlerType]) {
2907
+ routes[handlerType] = {};
2908
+ }
2909
+ if (!routes[handlerType][methodUpper]) {
2910
+ routes[handlerType][methodUpper] = {};
2911
+ }
2912
+ routes[handlerType][methodUpper][entry.standardPath] = Array.isArray(entry.pipe)
2913
+ ? [...entry.pipe]
2914
+ : entry.pipe;
2915
+ }
2916
+ }
2917
+ }
2918
+ }
2919
+ return routes;
2920
+ }
2921
+ /**
2922
+ * Generates a routes object keyed by handler-type then by pathname then by method.
2923
+ *
2924
+ * @returns Routes object
2925
+ */
2926
+ getRoutesByHandlerTypeThenPathname() {
2927
+ const routes = {};
2928
+ for (const handlerType of Object.keys(__classPrivateFieldGet(this, _Router_routes, "f"))) {
2929
+ const entry0 = __classPrivateFieldGet(this, _Router_routes, "f")[handlerType];
2930
+ for (const methodUpper of Object.keys(entry0)) {
2931
+ const entry1 = entry0[methodUpper];
2932
+ // super-globs
2933
+ for (const superGlobEntryIdx of entry1.superGlobsIndices) {
2934
+ const superGlobEntries = entry1.superGlobs[superGlobEntryIdx];
2935
+ for (const [, entry] of superGlobEntries) {
2936
+ if (!entry.pipe) {
2937
+ continue;
2938
+ }
2939
+ if (!routes[handlerType]) {
2940
+ routes[handlerType] = {};
2941
+ }
2942
+ if (!routes[handlerType][entry.standardPath]) {
2943
+ routes[handlerType][entry.standardPath] =
2944
+ {};
2945
+ }
2946
+ routes[handlerType][entry.standardPath][methodUpper] = Array.isArray(entry.pipe) ? [...entry.pipe] : entry.pipe;
2947
+ }
2948
+ }
2949
+ // globs
2950
+ for (const globEntryIdx of entry1.globsIndices) {
2951
+ const globEntries = entry1.globs[globEntryIdx];
2952
+ for (const [, entry] of globEntries) {
2953
+ if (!entry.pipe) {
2954
+ continue;
2955
+ }
2956
+ if (!routes[handlerType]) {
2957
+ routes[handlerType] = {};
2958
+ }
2959
+ if (!routes[handlerType][entry.standardPath]) {
2960
+ routes[handlerType][entry.standardPath] =
2961
+ {};
2962
+ }
2963
+ routes[handlerType][entry.standardPath][methodUpper] = Array.isArray(entry.pipe) ? [...entry.pipe] : entry.pipe;
2964
+ }
2965
+ }
2966
+ // normal paths
2967
+ for (const entryIdx of entry1.entriesIndices) {
2968
+ const entries = entry1.entries[entryIdx];
2969
+ for (const [, entry] of entries) {
2970
+ if (!entry.pipe) {
2971
+ continue;
2972
+ }
2973
+ if (!routes[handlerType]) {
2974
+ routes[handlerType] = {};
2975
+ }
2976
+ if (!routes[handlerType][entry.standardPath]) {
2977
+ routes[handlerType][entry.standardPath] =
2978
+ {};
2979
+ }
2980
+ routes[handlerType][entry.standardPath][methodUpper] = Array.isArray(entry.pipe) ? [...entry.pipe] : entry.pipe;
2981
+ }
2982
+ }
2983
+ }
2984
+ }
2985
+ return routes;
2986
+ }
2543
2987
  }
2544
2988
  exports.Router = Router;
2545
2989
  _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) {
@@ -2740,6 +3184,9 @@ _Router_config = new WeakMap(), _Router_routes = new WeakMap(), _Router_setters
2740
3184
  entries: new Array(__classPrivateFieldGet(this, _Router_config, "f").maxPath + 1),
2741
3185
  globs: new Array(__classPrivateFieldGet(this, _Router_config, "f").maxPath + 1),
2742
3186
  superGlobs: new Array(__classPrivateFieldGet(this, _Router_config, "f").maxPath + 1),
3187
+ entriesIndices: [],
3188
+ globsIndices: [],
3189
+ superGlobsIndices: [],
2743
3190
  };
2744
3191
  }, _Router_initRoutes = function _Router_initRoutes() {
2745
3192
  const routes = {};