@cimplify/sdk 0.52.0 → 0.52.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.js +23 -22
- package/dist/advanced.mjs +4 -3
- package/dist/chunk-3G6RQLXK.mjs +21 -0
- package/dist/{chunk-MBR2DBEN.mjs → chunk-4QDCMYYB.mjs} +2 -2
- package/dist/{chunk-D22UVSFN.js → chunk-7A3D3LFI.js} +4 -4
- package/dist/{chunk-6RP6OPYO.js → chunk-7Y2O3E4D.js} +3 -3
- package/dist/{chunk-Z2AYLZDF.mjs → chunk-AMZXALF6.mjs} +1 -21
- package/dist/{chunk-DR4UPU6P.js → chunk-EQLT46ZR.js} +22 -22
- package/dist/{chunk-OFNVLUH4.mjs → chunk-GLAVTDDE.mjs} +2 -2
- package/dist/chunk-OWW5GUSB.js +28 -0
- package/dist/{chunk-GEWFWQYK.js → chunk-Q5VGDCQF.js} +235 -234
- package/dist/{chunk-632JEJUS.mjs → chunk-R3F55BRN.mjs} +2 -1
- package/dist/{chunk-24FK7VFL.mjs → chunk-RDORJT7Y.mjs} +2 -2
- package/dist/{chunk-XY2DFX5K.mjs → chunk-TD3AY34U.mjs} +1 -1
- package/dist/{chunk-CYGLTD7D.js → chunk-W6CCBNGL.js} +60 -60
- package/dist/{chunk-TKOTACKZ.js → chunk-XA3ZNR75.js} +0 -26
- package/dist/index.js +110 -109
- package/dist/index.mjs +5 -4
- package/dist/react.js +86 -85
- package/dist/react.mjs +5 -4
- package/dist/server/evict.d.mts +31 -0
- package/dist/server/evict.d.ts +31 -0
- package/dist/server/evict.js +75 -0
- package/dist/server/evict.mjs +73 -0
- package/dist/server.d.mts +1 -30
- package/dist/server.d.ts +1 -30
- package/dist/server.js +7 -76
- package/dist/server.mjs +6 -74
- package/dist/testing/msw.js +4 -3
- package/dist/testing/msw.mjs +3 -2
- package/dist/testing/suite.js +26 -25
- package/dist/testing/suite.mjs +7 -6
- package/dist/testing.js +82 -81
- package/dist/testing.mjs +8 -7
- package/dist/utils.js +30 -29
- package/dist/utils.mjs +3 -2
- package/package.json +7 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkXA3ZNR75_js = require('./chunk-XA3ZNR75.js');
|
|
4
|
+
var chunkOWW5GUSB_js = require('./chunk-OWW5GUSB.js');
|
|
4
5
|
|
|
5
6
|
// ../node_modules/.bun/hono@4.12.16/node_modules/hono/dist/compose.js
|
|
6
7
|
var compose = (middleware, onError, onNotFound) => {
|
|
@@ -328,7 +329,7 @@ var tryDecodeURIComponent = (str) => tryDecode(str, decodeURIComponent_);
|
|
|
328
329
|
var _validatedData, _matchResult, _HonoRequest_instances, getDecodedParam_fn, getAllDecodedParams_fn, getParamValue_fn, _cachedBody, _a;
|
|
329
330
|
var HonoRequest = (_a = class {
|
|
330
331
|
constructor(request, path = "/", matchResult = [[]]) {
|
|
331
|
-
|
|
332
|
+
chunkOWW5GUSB_js.__privateAdd(this, _HonoRequest_instances);
|
|
332
333
|
/**
|
|
333
334
|
* `.raw` can get the raw Request object.
|
|
334
335
|
*
|
|
@@ -343,11 +344,11 @@ var HonoRequest = (_a = class {
|
|
|
343
344
|
* })
|
|
344
345
|
* ```
|
|
345
346
|
*/
|
|
346
|
-
|
|
347
|
-
|
|
347
|
+
chunkOWW5GUSB_js.__publicField(this, "raw");
|
|
348
|
+
chunkOWW5GUSB_js.__privateAdd(this, _validatedData);
|
|
348
349
|
// Short name of validatedData
|
|
349
|
-
|
|
350
|
-
|
|
350
|
+
chunkOWW5GUSB_js.__privateAdd(this, _matchResult);
|
|
351
|
+
chunkOWW5GUSB_js.__publicField(this, "routeIndex", 0);
|
|
351
352
|
/**
|
|
352
353
|
* `.path` can get the pathname of the request.
|
|
353
354
|
*
|
|
@@ -360,9 +361,9 @@ var HonoRequest = (_a = class {
|
|
|
360
361
|
* })
|
|
361
362
|
* ```
|
|
362
363
|
*/
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
364
|
+
chunkOWW5GUSB_js.__publicField(this, "path");
|
|
365
|
+
chunkOWW5GUSB_js.__publicField(this, "bodyCache", {});
|
|
366
|
+
chunkOWW5GUSB_js.__privateAdd(this, _cachedBody, (key) => {
|
|
366
367
|
const { bodyCache, raw: raw2 } = this;
|
|
367
368
|
const cachedBody = bodyCache[key];
|
|
368
369
|
if (cachedBody) {
|
|
@@ -381,11 +382,11 @@ var HonoRequest = (_a = class {
|
|
|
381
382
|
});
|
|
382
383
|
this.raw = request;
|
|
383
384
|
this.path = path;
|
|
384
|
-
|
|
385
|
-
|
|
385
|
+
chunkOWW5GUSB_js.__privateSet(this, _matchResult, matchResult);
|
|
386
|
+
chunkOWW5GUSB_js.__privateSet(this, _validatedData, {});
|
|
386
387
|
}
|
|
387
388
|
param(key) {
|
|
388
|
-
return key ?
|
|
389
|
+
return key ? chunkOWW5GUSB_js.__privateMethod(this, _HonoRequest_instances, getDecodedParam_fn).call(this, key) : chunkOWW5GUSB_js.__privateMethod(this, _HonoRequest_instances, getAllDecodedParams_fn).call(this);
|
|
389
390
|
}
|
|
390
391
|
query(key) {
|
|
391
392
|
return getQueryParam(this.url, key);
|
|
@@ -419,7 +420,7 @@ var HonoRequest = (_a = class {
|
|
|
419
420
|
* ```
|
|
420
421
|
*/
|
|
421
422
|
json() {
|
|
422
|
-
return
|
|
423
|
+
return chunkOWW5GUSB_js.__privateGet(this, _cachedBody).call(this, "text").then((text) => JSON.parse(text));
|
|
423
424
|
}
|
|
424
425
|
/**
|
|
425
426
|
* `.text()` can parse Request body of type `text/plain`
|
|
@@ -434,7 +435,7 @@ var HonoRequest = (_a = class {
|
|
|
434
435
|
* ```
|
|
435
436
|
*/
|
|
436
437
|
text() {
|
|
437
|
-
return
|
|
438
|
+
return chunkOWW5GUSB_js.__privateGet(this, _cachedBody).call(this, "text");
|
|
438
439
|
}
|
|
439
440
|
/**
|
|
440
441
|
* `.arrayBuffer()` parse Request body as an `ArrayBuffer`
|
|
@@ -449,7 +450,7 @@ var HonoRequest = (_a = class {
|
|
|
449
450
|
* ```
|
|
450
451
|
*/
|
|
451
452
|
arrayBuffer() {
|
|
452
|
-
return
|
|
453
|
+
return chunkOWW5GUSB_js.__privateGet(this, _cachedBody).call(this, "arrayBuffer");
|
|
453
454
|
}
|
|
454
455
|
/**
|
|
455
456
|
* Parses the request body as a `Blob`.
|
|
@@ -462,7 +463,7 @@ var HonoRequest = (_a = class {
|
|
|
462
463
|
* @see https://hono.dev/docs/api/request#blob
|
|
463
464
|
*/
|
|
464
465
|
blob() {
|
|
465
|
-
return
|
|
466
|
+
return chunkOWW5GUSB_js.__privateGet(this, _cachedBody).call(this, "blob");
|
|
466
467
|
}
|
|
467
468
|
/**
|
|
468
469
|
* Parses the request body as `FormData`.
|
|
@@ -475,7 +476,7 @@ var HonoRequest = (_a = class {
|
|
|
475
476
|
* @see https://hono.dev/docs/api/request#formdata
|
|
476
477
|
*/
|
|
477
478
|
formData() {
|
|
478
|
-
return
|
|
479
|
+
return chunkOWW5GUSB_js.__privateGet(this, _cachedBody).call(this, "formData");
|
|
479
480
|
}
|
|
480
481
|
/**
|
|
481
482
|
* Adds validated data to the request.
|
|
@@ -484,10 +485,10 @@ var HonoRequest = (_a = class {
|
|
|
484
485
|
* @param data - The validated data to add.
|
|
485
486
|
*/
|
|
486
487
|
addValidatedData(target, data) {
|
|
487
|
-
|
|
488
|
+
chunkOWW5GUSB_js.__privateGet(this, _validatedData)[target] = data;
|
|
488
489
|
}
|
|
489
490
|
valid(target) {
|
|
490
|
-
return
|
|
491
|
+
return chunkOWW5GUSB_js.__privateGet(this, _validatedData)[target];
|
|
491
492
|
}
|
|
492
493
|
/**
|
|
493
494
|
* `.url()` can get the request url strings.
|
|
@@ -521,7 +522,7 @@ var HonoRequest = (_a = class {
|
|
|
521
522
|
return this.raw.method;
|
|
522
523
|
}
|
|
523
524
|
get [GET_MATCH_RESULT]() {
|
|
524
|
-
return
|
|
525
|
+
return chunkOWW5GUSB_js.__privateGet(this, _matchResult);
|
|
525
526
|
}
|
|
526
527
|
/**
|
|
527
528
|
* `.matchedRoutes()` can return a matched route in the handler
|
|
@@ -551,7 +552,7 @@ var HonoRequest = (_a = class {
|
|
|
551
552
|
* ```
|
|
552
553
|
*/
|
|
553
554
|
get matchedRoutes() {
|
|
554
|
-
return
|
|
555
|
+
return chunkOWW5GUSB_js.__privateGet(this, _matchResult)[0].map(([[, route]]) => route);
|
|
555
556
|
}
|
|
556
557
|
/**
|
|
557
558
|
* `routePath()` can retrieve the path registered within the handler
|
|
@@ -570,24 +571,24 @@ var HonoRequest = (_a = class {
|
|
|
570
571
|
* ```
|
|
571
572
|
*/
|
|
572
573
|
get routePath() {
|
|
573
|
-
return
|
|
574
|
+
return chunkOWW5GUSB_js.__privateGet(this, _matchResult)[0].map(([[, route]]) => route)[this.routeIndex].path;
|
|
574
575
|
}
|
|
575
576
|
}, _validatedData = new WeakMap(), _matchResult = new WeakMap(), _HonoRequest_instances = new WeakSet(), getDecodedParam_fn = function(key) {
|
|
576
|
-
const paramKey =
|
|
577
|
-
const param =
|
|
577
|
+
const paramKey = chunkOWW5GUSB_js.__privateGet(this, _matchResult)[0][this.routeIndex][1][key];
|
|
578
|
+
const param = chunkOWW5GUSB_js.__privateMethod(this, _HonoRequest_instances, getParamValue_fn).call(this, paramKey);
|
|
578
579
|
return param && /\%/.test(param) ? tryDecodeURIComponent(param) : param;
|
|
579
580
|
}, getAllDecodedParams_fn = function() {
|
|
580
581
|
const decoded = {};
|
|
581
|
-
const keys = Object.keys(
|
|
582
|
+
const keys = Object.keys(chunkOWW5GUSB_js.__privateGet(this, _matchResult)[0][this.routeIndex][1]);
|
|
582
583
|
for (const key of keys) {
|
|
583
|
-
const value =
|
|
584
|
+
const value = chunkOWW5GUSB_js.__privateMethod(this, _HonoRequest_instances, getParamValue_fn).call(this, chunkOWW5GUSB_js.__privateGet(this, _matchResult)[0][this.routeIndex][1][key]);
|
|
584
585
|
if (value !== void 0) {
|
|
585
586
|
decoded[key] = /\%/.test(value) ? tryDecodeURIComponent(value) : value;
|
|
586
587
|
}
|
|
587
588
|
}
|
|
588
589
|
return decoded;
|
|
589
590
|
}, getParamValue_fn = function(paramKey) {
|
|
590
|
-
return
|
|
591
|
+
return chunkOWW5GUSB_js.__privateGet(this, _matchResult)[1] ? chunkOWW5GUSB_js.__privateGet(this, _matchResult)[1][paramKey] : paramKey;
|
|
591
592
|
}, _cachedBody = new WeakMap(), _a);
|
|
592
593
|
|
|
593
594
|
// ../node_modules/.bun/hono@4.12.16/node_modules/hono/dist/utils/html.js
|
|
@@ -639,9 +640,9 @@ var Context = (_a2 = class {
|
|
|
639
640
|
* @param options - Optional configuration options for the context.
|
|
640
641
|
*/
|
|
641
642
|
constructor(req, options) {
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
643
|
+
chunkOWW5GUSB_js.__privateAdd(this, _Context_instances);
|
|
644
|
+
chunkOWW5GUSB_js.__privateAdd(this, _rawRequest);
|
|
645
|
+
chunkOWW5GUSB_js.__privateAdd(this, _req);
|
|
645
646
|
/**
|
|
646
647
|
* `.env` can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.
|
|
647
648
|
*
|
|
@@ -655,9 +656,9 @@ var Context = (_a2 = class {
|
|
|
655
656
|
* })
|
|
656
657
|
* ```
|
|
657
658
|
*/
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
659
|
+
chunkOWW5GUSB_js.__publicField(this, "env", {});
|
|
660
|
+
chunkOWW5GUSB_js.__privateAdd(this, _var);
|
|
661
|
+
chunkOWW5GUSB_js.__publicField(this, "finalized", false);
|
|
661
662
|
/**
|
|
662
663
|
* `.error` can get the error object from the middleware if the Handler throws an error.
|
|
663
664
|
*
|
|
@@ -673,16 +674,16 @@ var Context = (_a2 = class {
|
|
|
673
674
|
* })
|
|
674
675
|
* ```
|
|
675
676
|
*/
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
677
|
+
chunkOWW5GUSB_js.__publicField(this, "error");
|
|
678
|
+
chunkOWW5GUSB_js.__privateAdd(this, _status);
|
|
679
|
+
chunkOWW5GUSB_js.__privateAdd(this, _executionCtx);
|
|
680
|
+
chunkOWW5GUSB_js.__privateAdd(this, _res);
|
|
681
|
+
chunkOWW5GUSB_js.__privateAdd(this, _layout);
|
|
682
|
+
chunkOWW5GUSB_js.__privateAdd(this, _renderer);
|
|
683
|
+
chunkOWW5GUSB_js.__privateAdd(this, _notFoundHandler);
|
|
684
|
+
chunkOWW5GUSB_js.__privateAdd(this, _preparedHeaders);
|
|
685
|
+
chunkOWW5GUSB_js.__privateAdd(this, _matchResult2);
|
|
686
|
+
chunkOWW5GUSB_js.__privateAdd(this, _path);
|
|
686
687
|
/**
|
|
687
688
|
* `.render()` can create a response within a layout.
|
|
688
689
|
*
|
|
@@ -695,9 +696,9 @@ var Context = (_a2 = class {
|
|
|
695
696
|
* })
|
|
696
697
|
* ```
|
|
697
698
|
*/
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
return
|
|
699
|
+
chunkOWW5GUSB_js.__publicField(this, "render", (...args) => {
|
|
700
|
+
chunkOWW5GUSB_js.__privateGet(this, _renderer) ?? chunkOWW5GUSB_js.__privateSet(this, _renderer, (content) => this.html(content));
|
|
701
|
+
return chunkOWW5GUSB_js.__privateGet(this, _renderer).call(this, ...args);
|
|
701
702
|
});
|
|
702
703
|
/**
|
|
703
704
|
* Sets the layout for the response.
|
|
@@ -705,13 +706,13 @@ var Context = (_a2 = class {
|
|
|
705
706
|
* @param layout - The layout to set.
|
|
706
707
|
* @returns The layout function.
|
|
707
708
|
*/
|
|
708
|
-
|
|
709
|
+
chunkOWW5GUSB_js.__publicField(this, "setLayout", (layout) => chunkOWW5GUSB_js.__privateSet(this, _layout, layout));
|
|
709
710
|
/**
|
|
710
711
|
* Gets the current layout for the response.
|
|
711
712
|
*
|
|
712
713
|
* @returns The current layout function.
|
|
713
714
|
*/
|
|
714
|
-
|
|
715
|
+
chunkOWW5GUSB_js.__publicField(this, "getLayout", () => chunkOWW5GUSB_js.__privateGet(this, _layout));
|
|
715
716
|
/**
|
|
716
717
|
* `.setRenderer()` can set the layout in the custom middleware.
|
|
717
718
|
*
|
|
@@ -733,8 +734,8 @@ var Context = (_a2 = class {
|
|
|
733
734
|
* })
|
|
734
735
|
* ```
|
|
735
736
|
*/
|
|
736
|
-
|
|
737
|
-
|
|
737
|
+
chunkOWW5GUSB_js.__publicField(this, "setRenderer", (renderer) => {
|
|
738
|
+
chunkOWW5GUSB_js.__privateSet(this, _renderer, renderer);
|
|
738
739
|
});
|
|
739
740
|
/**
|
|
740
741
|
* `.header()` can set headers.
|
|
@@ -752,11 +753,11 @@ var Context = (_a2 = class {
|
|
|
752
753
|
* })
|
|
753
754
|
* ```
|
|
754
755
|
*/
|
|
755
|
-
|
|
756
|
+
chunkOWW5GUSB_js.__publicField(this, "header", (name, value, options) => {
|
|
756
757
|
if (this.finalized) {
|
|
757
|
-
|
|
758
|
+
chunkOWW5GUSB_js.__privateSet(this, _res, createResponseInstance(chunkOWW5GUSB_js.__privateGet(this, _res).body, chunkOWW5GUSB_js.__privateGet(this, _res)));
|
|
758
759
|
}
|
|
759
|
-
const headers =
|
|
760
|
+
const headers = chunkOWW5GUSB_js.__privateGet(this, _res) ? chunkOWW5GUSB_js.__privateGet(this, _res).headers : chunkOWW5GUSB_js.__privateGet(this, _preparedHeaders) ?? chunkOWW5GUSB_js.__privateSet(this, _preparedHeaders, new Headers());
|
|
760
761
|
if (value === void 0) {
|
|
761
762
|
headers.delete(name);
|
|
762
763
|
} else if (options?.append) {
|
|
@@ -765,8 +766,8 @@ var Context = (_a2 = class {
|
|
|
765
766
|
headers.set(name, value);
|
|
766
767
|
}
|
|
767
768
|
});
|
|
768
|
-
|
|
769
|
-
|
|
769
|
+
chunkOWW5GUSB_js.__publicField(this, "status", (status) => {
|
|
770
|
+
chunkOWW5GUSB_js.__privateSet(this, _status, status);
|
|
770
771
|
});
|
|
771
772
|
/**
|
|
772
773
|
* `.set()` can set the value specified by the key.
|
|
@@ -781,9 +782,9 @@ var Context = (_a2 = class {
|
|
|
781
782
|
* })
|
|
782
783
|
* ```
|
|
783
784
|
*/
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
785
|
+
chunkOWW5GUSB_js.__publicField(this, "set", (key, value) => {
|
|
786
|
+
chunkOWW5GUSB_js.__privateGet(this, _var) ?? chunkOWW5GUSB_js.__privateSet(this, _var, /* @__PURE__ */ new Map());
|
|
787
|
+
chunkOWW5GUSB_js.__privateGet(this, _var).set(key, value);
|
|
787
788
|
});
|
|
788
789
|
/**
|
|
789
790
|
* `.get()` can use the value specified by the key.
|
|
@@ -798,10 +799,10 @@ var Context = (_a2 = class {
|
|
|
798
799
|
* })
|
|
799
800
|
* ```
|
|
800
801
|
*/
|
|
801
|
-
|
|
802
|
-
return
|
|
802
|
+
chunkOWW5GUSB_js.__publicField(this, "get", (key) => {
|
|
803
|
+
return chunkOWW5GUSB_js.__privateGet(this, _var) ? chunkOWW5GUSB_js.__privateGet(this, _var).get(key) : void 0;
|
|
803
804
|
});
|
|
804
|
-
|
|
805
|
+
chunkOWW5GUSB_js.__publicField(this, "newResponse", (...args) => chunkOWW5GUSB_js.__privateMethod(this, _Context_instances, newResponse_fn).call(this, ...args));
|
|
805
806
|
/**
|
|
806
807
|
* `.body()` can return the HTTP response.
|
|
807
808
|
* You can set headers with `.header()` and set HTTP status code with `.status`.
|
|
@@ -823,7 +824,7 @@ var Context = (_a2 = class {
|
|
|
823
824
|
* })
|
|
824
825
|
* ```
|
|
825
826
|
*/
|
|
826
|
-
|
|
827
|
+
chunkOWW5GUSB_js.__publicField(this, "body", (data, arg, headers) => chunkOWW5GUSB_js.__privateMethod(this, _Context_instances, newResponse_fn).call(this, data, arg, headers));
|
|
827
828
|
/**
|
|
828
829
|
* `.text()` can render text as `Content-Type:text/plain`.
|
|
829
830
|
*
|
|
@@ -836,8 +837,8 @@ var Context = (_a2 = class {
|
|
|
836
837
|
* })
|
|
837
838
|
* ```
|
|
838
839
|
*/
|
|
839
|
-
|
|
840
|
-
return !
|
|
840
|
+
chunkOWW5GUSB_js.__publicField(this, "text", (text, arg, headers) => {
|
|
841
|
+
return !chunkOWW5GUSB_js.__privateGet(this, _preparedHeaders) && !chunkOWW5GUSB_js.__privateGet(this, _status) && !arg && !headers && !this.finalized ? new Response(text) : chunkOWW5GUSB_js.__privateMethod(this, _Context_instances, newResponse_fn).call(this, text, arg, setDefaultContentType(TEXT_PLAIN, headers));
|
|
841
842
|
});
|
|
842
843
|
/**
|
|
843
844
|
* `.json()` can render JSON as `Content-Type:application/json`.
|
|
@@ -851,11 +852,11 @@ var Context = (_a2 = class {
|
|
|
851
852
|
* })
|
|
852
853
|
* ```
|
|
853
854
|
*/
|
|
854
|
-
|
|
855
|
-
return
|
|
855
|
+
chunkOWW5GUSB_js.__publicField(this, "json", (object, arg, headers) => {
|
|
856
|
+
return chunkOWW5GUSB_js.__privateMethod(this, _Context_instances, newResponse_fn).call(this, JSON.stringify(object), arg, setDefaultContentType("application/json", headers));
|
|
856
857
|
});
|
|
857
|
-
|
|
858
|
-
const res = (html2) =>
|
|
858
|
+
chunkOWW5GUSB_js.__publicField(this, "html", (html, arg, headers) => {
|
|
859
|
+
const res = (html2) => chunkOWW5GUSB_js.__privateMethod(this, _Context_instances, newResponse_fn).call(this, html2, arg, setDefaultContentType("text/html; charset=UTF-8", headers));
|
|
859
860
|
return typeof html === "object" ? resolveCallback(html, HtmlEscapedCallbackPhase.Stringify, false, {}).then(res) : res(html);
|
|
860
861
|
});
|
|
861
862
|
/**
|
|
@@ -873,7 +874,7 @@ var Context = (_a2 = class {
|
|
|
873
874
|
* })
|
|
874
875
|
* ```
|
|
875
876
|
*/
|
|
876
|
-
|
|
877
|
+
chunkOWW5GUSB_js.__publicField(this, "redirect", (location, status) => {
|
|
877
878
|
const locationString = String(location);
|
|
878
879
|
this.header(
|
|
879
880
|
"Location",
|
|
@@ -895,25 +896,25 @@ var Context = (_a2 = class {
|
|
|
895
896
|
* })
|
|
896
897
|
* ```
|
|
897
898
|
*/
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
return
|
|
899
|
+
chunkOWW5GUSB_js.__publicField(this, "notFound", () => {
|
|
900
|
+
chunkOWW5GUSB_js.__privateGet(this, _notFoundHandler) ?? chunkOWW5GUSB_js.__privateSet(this, _notFoundHandler, () => createResponseInstance());
|
|
901
|
+
return chunkOWW5GUSB_js.__privateGet(this, _notFoundHandler).call(this, this);
|
|
901
902
|
});
|
|
902
|
-
|
|
903
|
+
chunkOWW5GUSB_js.__privateSet(this, _rawRequest, req);
|
|
903
904
|
if (options) {
|
|
904
|
-
|
|
905
|
+
chunkOWW5GUSB_js.__privateSet(this, _executionCtx, options.executionCtx);
|
|
905
906
|
this.env = options.env;
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
907
|
+
chunkOWW5GUSB_js.__privateSet(this, _notFoundHandler, options.notFoundHandler);
|
|
908
|
+
chunkOWW5GUSB_js.__privateSet(this, _path, options.path);
|
|
909
|
+
chunkOWW5GUSB_js.__privateSet(this, _matchResult2, options.matchResult);
|
|
909
910
|
}
|
|
910
911
|
}
|
|
911
912
|
/**
|
|
912
913
|
* `.req` is the instance of {@link HonoRequest}.
|
|
913
914
|
*/
|
|
914
915
|
get req() {
|
|
915
|
-
|
|
916
|
-
return
|
|
916
|
+
chunkOWW5GUSB_js.__privateGet(this, _req) ?? chunkOWW5GUSB_js.__privateSet(this, _req, new HonoRequest(chunkOWW5GUSB_js.__privateGet(this, _rawRequest), chunkOWW5GUSB_js.__privateGet(this, _path), chunkOWW5GUSB_js.__privateGet(this, _matchResult2)));
|
|
917
|
+
return chunkOWW5GUSB_js.__privateGet(this, _req);
|
|
917
918
|
}
|
|
918
919
|
/**
|
|
919
920
|
* @see {@link https://hono.dev/docs/api/context#event}
|
|
@@ -922,8 +923,8 @@ var Context = (_a2 = class {
|
|
|
922
923
|
* @throws Will throw an error if the context does not have a FetchEvent.
|
|
923
924
|
*/
|
|
924
925
|
get event() {
|
|
925
|
-
if (
|
|
926
|
-
return
|
|
926
|
+
if (chunkOWW5GUSB_js.__privateGet(this, _executionCtx) && "respondWith" in chunkOWW5GUSB_js.__privateGet(this, _executionCtx)) {
|
|
927
|
+
return chunkOWW5GUSB_js.__privateGet(this, _executionCtx);
|
|
927
928
|
} else {
|
|
928
929
|
throw Error("This context has no FetchEvent");
|
|
929
930
|
}
|
|
@@ -935,8 +936,8 @@ var Context = (_a2 = class {
|
|
|
935
936
|
* @throws Will throw an error if the context does not have an ExecutionContext.
|
|
936
937
|
*/
|
|
937
938
|
get executionCtx() {
|
|
938
|
-
if (
|
|
939
|
-
return
|
|
939
|
+
if (chunkOWW5GUSB_js.__privateGet(this, _executionCtx)) {
|
|
940
|
+
return chunkOWW5GUSB_js.__privateGet(this, _executionCtx);
|
|
940
941
|
} else {
|
|
941
942
|
throw Error("This context has no ExecutionContext");
|
|
942
943
|
}
|
|
@@ -946,8 +947,8 @@ var Context = (_a2 = class {
|
|
|
946
947
|
* The Response object for the current request.
|
|
947
948
|
*/
|
|
948
949
|
get res() {
|
|
949
|
-
return
|
|
950
|
-
headers:
|
|
950
|
+
return chunkOWW5GUSB_js.__privateGet(this, _res) || chunkOWW5GUSB_js.__privateSet(this, _res, createResponseInstance(null, {
|
|
951
|
+
headers: chunkOWW5GUSB_js.__privateGet(this, _preparedHeaders) ?? chunkOWW5GUSB_js.__privateSet(this, _preparedHeaders, new Headers())
|
|
951
952
|
}));
|
|
952
953
|
}
|
|
953
954
|
/**
|
|
@@ -956,14 +957,14 @@ var Context = (_a2 = class {
|
|
|
956
957
|
* @param _res - The Response object to set.
|
|
957
958
|
*/
|
|
958
959
|
set res(_res2) {
|
|
959
|
-
if (
|
|
960
|
+
if (chunkOWW5GUSB_js.__privateGet(this, _res) && _res2) {
|
|
960
961
|
_res2 = createResponseInstance(_res2.body, _res2);
|
|
961
|
-
for (const [k, v] of
|
|
962
|
+
for (const [k, v] of chunkOWW5GUSB_js.__privateGet(this, _res).headers.entries()) {
|
|
962
963
|
if (k === "content-type") {
|
|
963
964
|
continue;
|
|
964
965
|
}
|
|
965
966
|
if (k === "set-cookie") {
|
|
966
|
-
const cookies =
|
|
967
|
+
const cookies = chunkOWW5GUSB_js.__privateGet(this, _res).headers.getSetCookie();
|
|
967
968
|
_res2.headers.delete("set-cookie");
|
|
968
969
|
for (const cookie of cookies) {
|
|
969
970
|
_res2.headers.append("set-cookie", cookie);
|
|
@@ -973,7 +974,7 @@ var Context = (_a2 = class {
|
|
|
973
974
|
}
|
|
974
975
|
}
|
|
975
976
|
}
|
|
976
|
-
|
|
977
|
+
chunkOWW5GUSB_js.__privateSet(this, _res, _res2);
|
|
977
978
|
this.finalized = true;
|
|
978
979
|
}
|
|
979
980
|
/**
|
|
@@ -988,13 +989,13 @@ var Context = (_a2 = class {
|
|
|
988
989
|
*/
|
|
989
990
|
// c.var.propName is a read-only
|
|
990
991
|
get var() {
|
|
991
|
-
if (!
|
|
992
|
+
if (!chunkOWW5GUSB_js.__privateGet(this, _var)) {
|
|
992
993
|
return {};
|
|
993
994
|
}
|
|
994
|
-
return Object.fromEntries(
|
|
995
|
+
return Object.fromEntries(chunkOWW5GUSB_js.__privateGet(this, _var));
|
|
995
996
|
}
|
|
996
997
|
}, _rawRequest = new WeakMap(), _req = new WeakMap(), _var = new WeakMap(), _status = new WeakMap(), _executionCtx = new WeakMap(), _res = new WeakMap(), _layout = new WeakMap(), _renderer = new WeakMap(), _notFoundHandler = new WeakMap(), _preparedHeaders = new WeakMap(), _matchResult2 = new WeakMap(), _path = new WeakMap(), _Context_instances = new WeakSet(), newResponse_fn = function(data, arg, headers) {
|
|
997
|
-
const responseHeaders =
|
|
998
|
+
const responseHeaders = chunkOWW5GUSB_js.__privateGet(this, _res) ? new Headers(chunkOWW5GUSB_js.__privateGet(this, _res).headers) : chunkOWW5GUSB_js.__privateGet(this, _preparedHeaders) ?? new Headers();
|
|
998
999
|
if (typeof arg === "object" && "headers" in arg) {
|
|
999
1000
|
const argHeaders = arg.headers instanceof Headers ? arg.headers : new Headers(arg.headers);
|
|
1000
1001
|
for (const [key, value] of argHeaders) {
|
|
@@ -1017,7 +1018,7 @@ var Context = (_a2 = class {
|
|
|
1017
1018
|
}
|
|
1018
1019
|
}
|
|
1019
1020
|
}
|
|
1020
|
-
const status = typeof arg === "number" ? arg : arg?.status ??
|
|
1021
|
+
const status = typeof arg === "number" ? arg : arg?.status ?? chunkOWW5GUSB_js.__privateGet(this, _status);
|
|
1021
1022
|
return createResponseInstance(data, { status, headers: responseHeaders });
|
|
1022
1023
|
}, _a2);
|
|
1023
1024
|
|
|
@@ -1047,29 +1048,29 @@ var errorHandler = (err, c) => {
|
|
|
1047
1048
|
var _path2, __Hono_instances, clone_fn, _notFoundHandler2, addRoute_fn, handleError_fn, dispatch_fn, _a3;
|
|
1048
1049
|
var Hono = (_a3 = class {
|
|
1049
1050
|
constructor(options = {}) {
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1051
|
+
chunkOWW5GUSB_js.__privateAdd(this, __Hono_instances);
|
|
1052
|
+
chunkOWW5GUSB_js.__publicField(this, "get");
|
|
1053
|
+
chunkOWW5GUSB_js.__publicField(this, "post");
|
|
1054
|
+
chunkOWW5GUSB_js.__publicField(this, "put");
|
|
1055
|
+
chunkOWW5GUSB_js.__publicField(this, "delete");
|
|
1056
|
+
chunkOWW5GUSB_js.__publicField(this, "options");
|
|
1057
|
+
chunkOWW5GUSB_js.__publicField(this, "patch");
|
|
1058
|
+
chunkOWW5GUSB_js.__publicField(this, "all");
|
|
1059
|
+
chunkOWW5GUSB_js.__publicField(this, "on");
|
|
1060
|
+
chunkOWW5GUSB_js.__publicField(this, "use");
|
|
1060
1061
|
/*
|
|
1061
1062
|
This class is like an abstract class and does not have a router.
|
|
1062
1063
|
To use it, inherit the class and implement router in the constructor.
|
|
1063
1064
|
*/
|
|
1064
|
-
|
|
1065
|
-
|
|
1065
|
+
chunkOWW5GUSB_js.__publicField(this, "router");
|
|
1066
|
+
chunkOWW5GUSB_js.__publicField(this, "getPath");
|
|
1066
1067
|
// Cannot use `#` because it requires visibility at JavaScript runtime.
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1068
|
+
chunkOWW5GUSB_js.__publicField(this, "_basePath", "/");
|
|
1069
|
+
chunkOWW5GUSB_js.__privateAdd(this, _path2, "/");
|
|
1070
|
+
chunkOWW5GUSB_js.__publicField(this, "routes", []);
|
|
1071
|
+
chunkOWW5GUSB_js.__privateAdd(this, _notFoundHandler2, notFoundHandler);
|
|
1071
1072
|
// Cannot use `#` because it requires visibility at JavaScript runtime.
|
|
1072
|
-
|
|
1073
|
+
chunkOWW5GUSB_js.__publicField(this, "errorHandler", errorHandler);
|
|
1073
1074
|
/**
|
|
1074
1075
|
* `.onError()` handles an error and returns a customized Response.
|
|
1075
1076
|
*
|
|
@@ -1086,7 +1087,7 @@ var Hono = (_a3 = class {
|
|
|
1086
1087
|
* })
|
|
1087
1088
|
* ```
|
|
1088
1089
|
*/
|
|
1089
|
-
|
|
1090
|
+
chunkOWW5GUSB_js.__publicField(this, "onError", (handler) => {
|
|
1090
1091
|
this.errorHandler = handler;
|
|
1091
1092
|
return this;
|
|
1092
1093
|
});
|
|
@@ -1105,8 +1106,8 @@ var Hono = (_a3 = class {
|
|
|
1105
1106
|
* })
|
|
1106
1107
|
* ```
|
|
1107
1108
|
*/
|
|
1108
|
-
|
|
1109
|
-
|
|
1109
|
+
chunkOWW5GUSB_js.__publicField(this, "notFound", (handler) => {
|
|
1110
|
+
chunkOWW5GUSB_js.__privateSet(this, _notFoundHandler2, handler);
|
|
1110
1111
|
return this;
|
|
1111
1112
|
});
|
|
1112
1113
|
/**
|
|
@@ -1120,8 +1121,8 @@ var Hono = (_a3 = class {
|
|
|
1120
1121
|
* @returns {Response | Promise<Response>} response of request
|
|
1121
1122
|
*
|
|
1122
1123
|
*/
|
|
1123
|
-
|
|
1124
|
-
return
|
|
1124
|
+
chunkOWW5GUSB_js.__publicField(this, "fetch", (request, ...rest) => {
|
|
1125
|
+
return chunkOWW5GUSB_js.__privateMethod(this, __Hono_instances, dispatch_fn).call(this, request, rest[1], rest[0], request.method);
|
|
1125
1126
|
});
|
|
1126
1127
|
/**
|
|
1127
1128
|
* `.request()` is a useful method for testing.
|
|
@@ -1135,7 +1136,7 @@ var Hono = (_a3 = class {
|
|
|
1135
1136
|
* ```
|
|
1136
1137
|
* @see https://hono.dev/docs/api/hono#request
|
|
1137
1138
|
*/
|
|
1138
|
-
|
|
1139
|
+
chunkOWW5GUSB_js.__publicField(this, "request", (input, requestInit, Env, executionCtx) => {
|
|
1139
1140
|
if (input instanceof Request) {
|
|
1140
1141
|
return this.fetch(requestInit ? new Request(input, requestInit) : input, Env, executionCtx);
|
|
1141
1142
|
}
|
|
@@ -1166,31 +1167,31 @@ var Hono = (_a3 = class {
|
|
|
1166
1167
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API
|
|
1167
1168
|
* @see https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/
|
|
1168
1169
|
*/
|
|
1169
|
-
|
|
1170
|
+
chunkOWW5GUSB_js.__publicField(this, "fire", () => {
|
|
1170
1171
|
addEventListener("fetch", (event) => {
|
|
1171
|
-
event.respondWith(
|
|
1172
|
+
event.respondWith(chunkOWW5GUSB_js.__privateMethod(this, __Hono_instances, dispatch_fn).call(this, event.request, event, void 0, event.request.method));
|
|
1172
1173
|
});
|
|
1173
1174
|
});
|
|
1174
1175
|
const allMethods = [...METHODS, METHOD_NAME_ALL_LOWERCASE];
|
|
1175
1176
|
allMethods.forEach((method) => {
|
|
1176
1177
|
this[method] = (args1, ...args) => {
|
|
1177
1178
|
if (typeof args1 === "string") {
|
|
1178
|
-
|
|
1179
|
+
chunkOWW5GUSB_js.__privateSet(this, _path2, args1);
|
|
1179
1180
|
} else {
|
|
1180
|
-
|
|
1181
|
+
chunkOWW5GUSB_js.__privateMethod(this, __Hono_instances, addRoute_fn).call(this, method, chunkOWW5GUSB_js.__privateGet(this, _path2), args1);
|
|
1181
1182
|
}
|
|
1182
1183
|
args.forEach((handler) => {
|
|
1183
|
-
|
|
1184
|
+
chunkOWW5GUSB_js.__privateMethod(this, __Hono_instances, addRoute_fn).call(this, method, chunkOWW5GUSB_js.__privateGet(this, _path2), handler);
|
|
1184
1185
|
});
|
|
1185
1186
|
return this;
|
|
1186
1187
|
};
|
|
1187
1188
|
});
|
|
1188
1189
|
this.on = (method, path, ...handlers) => {
|
|
1189
1190
|
for (const p of [path].flat()) {
|
|
1190
|
-
|
|
1191
|
+
chunkOWW5GUSB_js.__privateSet(this, _path2, p);
|
|
1191
1192
|
for (const m of [method].flat()) {
|
|
1192
1193
|
handlers.map((handler) => {
|
|
1193
|
-
|
|
1194
|
+
chunkOWW5GUSB_js.__privateMethod(this, __Hono_instances, addRoute_fn).call(this, m.toUpperCase(), chunkOWW5GUSB_js.__privateGet(this, _path2), handler);
|
|
1194
1195
|
});
|
|
1195
1196
|
}
|
|
1196
1197
|
}
|
|
@@ -1198,13 +1199,13 @@ var Hono = (_a3 = class {
|
|
|
1198
1199
|
};
|
|
1199
1200
|
this.use = (arg1, ...handlers) => {
|
|
1200
1201
|
if (typeof arg1 === "string") {
|
|
1201
|
-
|
|
1202
|
+
chunkOWW5GUSB_js.__privateSet(this, _path2, arg1);
|
|
1202
1203
|
} else {
|
|
1203
|
-
|
|
1204
|
+
chunkOWW5GUSB_js.__privateSet(this, _path2, "*");
|
|
1204
1205
|
handlers.unshift(arg1);
|
|
1205
1206
|
}
|
|
1206
1207
|
handlers.forEach((handler) => {
|
|
1207
|
-
|
|
1208
|
+
chunkOWW5GUSB_js.__privateMethod(this, __Hono_instances, addRoute_fn).call(this, METHOD_NAME_ALL, chunkOWW5GUSB_js.__privateGet(this, _path2), handler);
|
|
1208
1209
|
});
|
|
1209
1210
|
return this;
|
|
1210
1211
|
};
|
|
@@ -1241,7 +1242,7 @@ var Hono = (_a3 = class {
|
|
|
1241
1242
|
handler = async (c, next) => (await compose([], app.errorHandler)(c, () => r.handler(c, next))).res;
|
|
1242
1243
|
handler[COMPOSED_HANDLER] = r.handler;
|
|
1243
1244
|
}
|
|
1244
|
-
|
|
1245
|
+
chunkOWW5GUSB_js.__privateMethod(_a10 = subApp, __Hono_instances, addRoute_fn).call(_a10, r.method, r.path, handler);
|
|
1245
1246
|
});
|
|
1246
1247
|
return this;
|
|
1247
1248
|
}
|
|
@@ -1259,7 +1260,7 @@ var Hono = (_a3 = class {
|
|
|
1259
1260
|
* ```
|
|
1260
1261
|
*/
|
|
1261
1262
|
basePath(path) {
|
|
1262
|
-
const subApp =
|
|
1263
|
+
const subApp = chunkOWW5GUSB_js.__privateMethod(this, __Hono_instances, clone_fn).call(this);
|
|
1263
1264
|
subApp._basePath = mergePath(this._basePath, path);
|
|
1264
1265
|
return subApp;
|
|
1265
1266
|
}
|
|
@@ -1337,7 +1338,7 @@ var Hono = (_a3 = class {
|
|
|
1337
1338
|
}
|
|
1338
1339
|
await next();
|
|
1339
1340
|
};
|
|
1340
|
-
|
|
1341
|
+
chunkOWW5GUSB_js.__privateMethod(this, __Hono_instances, addRoute_fn).call(this, METHOD_NAME_ALL, mergePath(path, "*"), handler);
|
|
1341
1342
|
return this;
|
|
1342
1343
|
}
|
|
1343
1344
|
}, _path2 = new WeakMap(), __Hono_instances = new WeakSet(), clone_fn = function() {
|
|
@@ -1346,7 +1347,7 @@ var Hono = (_a3 = class {
|
|
|
1346
1347
|
getPath: this.getPath
|
|
1347
1348
|
});
|
|
1348
1349
|
clone.errorHandler = this.errorHandler;
|
|
1349
|
-
|
|
1350
|
+
chunkOWW5GUSB_js.__privateSet(clone, _notFoundHandler2, chunkOWW5GUSB_js.__privateGet(this, _notFoundHandler2));
|
|
1350
1351
|
clone.routes = this.routes;
|
|
1351
1352
|
return clone;
|
|
1352
1353
|
}, _notFoundHandler2 = new WeakMap(), addRoute_fn = function(method, path, handler) {
|
|
@@ -1362,7 +1363,7 @@ var Hono = (_a3 = class {
|
|
|
1362
1363
|
throw err;
|
|
1363
1364
|
}, dispatch_fn = function(request, executionCtx, env, method) {
|
|
1364
1365
|
if (method === "HEAD") {
|
|
1365
|
-
return (async () => new Response(null, await
|
|
1366
|
+
return (async () => new Response(null, await chunkOWW5GUSB_js.__privateMethod(this, __Hono_instances, dispatch_fn).call(this, request, executionCtx, env, "GET")))();
|
|
1366
1367
|
}
|
|
1367
1368
|
const path = this.getPath(request, { env });
|
|
1368
1369
|
const matchResult = this.router.match(method, path);
|
|
@@ -1371,22 +1372,22 @@ var Hono = (_a3 = class {
|
|
|
1371
1372
|
matchResult,
|
|
1372
1373
|
env,
|
|
1373
1374
|
executionCtx,
|
|
1374
|
-
notFoundHandler:
|
|
1375
|
+
notFoundHandler: chunkOWW5GUSB_js.__privateGet(this, _notFoundHandler2)
|
|
1375
1376
|
});
|
|
1376
1377
|
if (matchResult[0].length === 1) {
|
|
1377
1378
|
let res;
|
|
1378
1379
|
try {
|
|
1379
1380
|
res = matchResult[0][0][0][0](c, async () => {
|
|
1380
|
-
c.res = await
|
|
1381
|
+
c.res = await chunkOWW5GUSB_js.__privateGet(this, _notFoundHandler2).call(this, c);
|
|
1381
1382
|
});
|
|
1382
1383
|
} catch (err) {
|
|
1383
|
-
return
|
|
1384
|
+
return chunkOWW5GUSB_js.__privateMethod(this, __Hono_instances, handleError_fn).call(this, err, c);
|
|
1384
1385
|
}
|
|
1385
1386
|
return res instanceof Promise ? res.then(
|
|
1386
|
-
(resolved) => resolved || (c.finalized ? c.res :
|
|
1387
|
-
).catch((err) =>
|
|
1387
|
+
(resolved) => resolved || (c.finalized ? c.res : chunkOWW5GUSB_js.__privateGet(this, _notFoundHandler2).call(this, c))
|
|
1388
|
+
).catch((err) => chunkOWW5GUSB_js.__privateMethod(this, __Hono_instances, handleError_fn).call(this, err, c)) : res ?? chunkOWW5GUSB_js.__privateGet(this, _notFoundHandler2).call(this, c);
|
|
1388
1389
|
}
|
|
1389
|
-
const composed = compose(matchResult[0], this.errorHandler,
|
|
1390
|
+
const composed = compose(matchResult[0], this.errorHandler, chunkOWW5GUSB_js.__privateGet(this, _notFoundHandler2));
|
|
1390
1391
|
return (async () => {
|
|
1391
1392
|
try {
|
|
1392
1393
|
const context = await composed(c);
|
|
@@ -1397,7 +1398,7 @@ var Hono = (_a3 = class {
|
|
|
1397
1398
|
}
|
|
1398
1399
|
return context.res;
|
|
1399
1400
|
} catch (err) {
|
|
1400
|
-
return
|
|
1401
|
+
return chunkOWW5GUSB_js.__privateMethod(this, __Hono_instances, handleError_fn).call(this, err, c);
|
|
1401
1402
|
}
|
|
1402
1403
|
})();
|
|
1403
1404
|
}, _a3);
|
|
@@ -1451,19 +1452,19 @@ function compareKey(a, b) {
|
|
|
1451
1452
|
var _index, _varIndex, _children, _a4;
|
|
1452
1453
|
var Node = (_a4 = class {
|
|
1453
1454
|
constructor() {
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1455
|
+
chunkOWW5GUSB_js.__privateAdd(this, _index);
|
|
1456
|
+
chunkOWW5GUSB_js.__privateAdd(this, _varIndex);
|
|
1457
|
+
chunkOWW5GUSB_js.__privateAdd(this, _children, /* @__PURE__ */ Object.create(null));
|
|
1457
1458
|
}
|
|
1458
1459
|
insert(tokens, index, paramMap, context, pathErrorCheckOnly) {
|
|
1459
1460
|
if (tokens.length === 0) {
|
|
1460
|
-
if (
|
|
1461
|
+
if (chunkOWW5GUSB_js.__privateGet(this, _index) !== void 0) {
|
|
1461
1462
|
throw PATH_ERROR;
|
|
1462
1463
|
}
|
|
1463
1464
|
if (pathErrorCheckOnly) {
|
|
1464
1465
|
return;
|
|
1465
1466
|
}
|
|
1466
|
-
|
|
1467
|
+
chunkOWW5GUSB_js.__privateSet(this, _index, index);
|
|
1467
1468
|
return;
|
|
1468
1469
|
}
|
|
1469
1470
|
const [token, ...restTokens] = tokens;
|
|
@@ -1481,9 +1482,9 @@ var Node = (_a4 = class {
|
|
|
1481
1482
|
throw PATH_ERROR;
|
|
1482
1483
|
}
|
|
1483
1484
|
}
|
|
1484
|
-
node =
|
|
1485
|
+
node = chunkOWW5GUSB_js.__privateGet(this, _children)[regexpStr];
|
|
1485
1486
|
if (!node) {
|
|
1486
|
-
if (Object.keys(
|
|
1487
|
+
if (Object.keys(chunkOWW5GUSB_js.__privateGet(this, _children)).some(
|
|
1487
1488
|
(k) => k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR
|
|
1488
1489
|
)) {
|
|
1489
1490
|
throw PATH_ERROR;
|
|
@@ -1491,18 +1492,18 @@ var Node = (_a4 = class {
|
|
|
1491
1492
|
if (pathErrorCheckOnly) {
|
|
1492
1493
|
return;
|
|
1493
1494
|
}
|
|
1494
|
-
node =
|
|
1495
|
+
node = chunkOWW5GUSB_js.__privateGet(this, _children)[regexpStr] = new _a4();
|
|
1495
1496
|
if (name !== "") {
|
|
1496
|
-
|
|
1497
|
+
chunkOWW5GUSB_js.__privateSet(node, _varIndex, context.varIndex++);
|
|
1497
1498
|
}
|
|
1498
1499
|
}
|
|
1499
1500
|
if (!pathErrorCheckOnly && name !== "") {
|
|
1500
|
-
paramMap.push([name,
|
|
1501
|
+
paramMap.push([name, chunkOWW5GUSB_js.__privateGet(node, _varIndex)]);
|
|
1501
1502
|
}
|
|
1502
1503
|
} else {
|
|
1503
|
-
node =
|
|
1504
|
+
node = chunkOWW5GUSB_js.__privateGet(this, _children)[token];
|
|
1504
1505
|
if (!node) {
|
|
1505
|
-
if (Object.keys(
|
|
1506
|
+
if (Object.keys(chunkOWW5GUSB_js.__privateGet(this, _children)).some(
|
|
1506
1507
|
(k) => k.length > 1 && k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR
|
|
1507
1508
|
)) {
|
|
1508
1509
|
throw PATH_ERROR;
|
|
@@ -1510,19 +1511,19 @@ var Node = (_a4 = class {
|
|
|
1510
1511
|
if (pathErrorCheckOnly) {
|
|
1511
1512
|
return;
|
|
1512
1513
|
}
|
|
1513
|
-
node =
|
|
1514
|
+
node = chunkOWW5GUSB_js.__privateGet(this, _children)[token] = new _a4();
|
|
1514
1515
|
}
|
|
1515
1516
|
}
|
|
1516
1517
|
node.insert(restTokens, index, paramMap, context, pathErrorCheckOnly);
|
|
1517
1518
|
}
|
|
1518
1519
|
buildRegExpStr() {
|
|
1519
|
-
const childKeys = Object.keys(
|
|
1520
|
+
const childKeys = Object.keys(chunkOWW5GUSB_js.__privateGet(this, _children)).sort(compareKey);
|
|
1520
1521
|
const strList = childKeys.map((k) => {
|
|
1521
|
-
const c =
|
|
1522
|
-
return (typeof
|
|
1522
|
+
const c = chunkOWW5GUSB_js.__privateGet(this, _children)[k];
|
|
1523
|
+
return (typeof chunkOWW5GUSB_js.__privateGet(c, _varIndex) === "number" ? `(${k})@${chunkOWW5GUSB_js.__privateGet(c, _varIndex)}` : regExpMetaChars.has(k) ? `\\${k}` : k) + c.buildRegExpStr();
|
|
1523
1524
|
});
|
|
1524
|
-
if (typeof
|
|
1525
|
-
strList.unshift(`#${
|
|
1525
|
+
if (typeof chunkOWW5GUSB_js.__privateGet(this, _index) === "number") {
|
|
1526
|
+
strList.unshift(`#${chunkOWW5GUSB_js.__privateGet(this, _index)}`);
|
|
1526
1527
|
}
|
|
1527
1528
|
if (strList.length === 0) {
|
|
1528
1529
|
return "";
|
|
@@ -1538,8 +1539,8 @@ var Node = (_a4 = class {
|
|
|
1538
1539
|
var _context, _root, _a5;
|
|
1539
1540
|
var Trie = (_a5 = class {
|
|
1540
1541
|
constructor() {
|
|
1541
|
-
|
|
1542
|
-
|
|
1542
|
+
chunkOWW5GUSB_js.__privateAdd(this, _context, { varIndex: 0 });
|
|
1543
|
+
chunkOWW5GUSB_js.__privateAdd(this, _root, new Node());
|
|
1543
1544
|
}
|
|
1544
1545
|
insert(path, index, pathErrorCheckOnly) {
|
|
1545
1546
|
const paramAssoc = [];
|
|
@@ -1567,11 +1568,11 @@ var Trie = (_a5 = class {
|
|
|
1567
1568
|
}
|
|
1568
1569
|
}
|
|
1569
1570
|
}
|
|
1570
|
-
|
|
1571
|
+
chunkOWW5GUSB_js.__privateGet(this, _root).insert(tokens, index, paramAssoc, chunkOWW5GUSB_js.__privateGet(this, _context), pathErrorCheckOnly);
|
|
1571
1572
|
return paramAssoc;
|
|
1572
1573
|
}
|
|
1573
1574
|
buildRegExp() {
|
|
1574
|
-
let regexp =
|
|
1575
|
+
let regexp = chunkOWW5GUSB_js.__privateGet(this, _root).buildRegExpStr();
|
|
1575
1576
|
if (regexp === "") {
|
|
1576
1577
|
return [/^$/, [], []];
|
|
1577
1578
|
}
|
|
@@ -1678,18 +1679,18 @@ function findMiddleware(middleware, path) {
|
|
|
1678
1679
|
var _middleware, _routes, _RegExpRouter_instances, buildMatcher_fn, _a6;
|
|
1679
1680
|
var RegExpRouter = (_a6 = class {
|
|
1680
1681
|
constructor() {
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1682
|
+
chunkOWW5GUSB_js.__privateAdd(this, _RegExpRouter_instances);
|
|
1683
|
+
chunkOWW5GUSB_js.__publicField(this, "name", "RegExpRouter");
|
|
1684
|
+
chunkOWW5GUSB_js.__privateAdd(this, _middleware);
|
|
1685
|
+
chunkOWW5GUSB_js.__privateAdd(this, _routes);
|
|
1686
|
+
chunkOWW5GUSB_js.__publicField(this, "match", match);
|
|
1687
|
+
chunkOWW5GUSB_js.__privateSet(this, _middleware, { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) });
|
|
1688
|
+
chunkOWW5GUSB_js.__privateSet(this, _routes, { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) });
|
|
1688
1689
|
}
|
|
1689
1690
|
add(method, path, handler) {
|
|
1690
1691
|
var _a10;
|
|
1691
|
-
const middleware =
|
|
1692
|
-
const routes =
|
|
1692
|
+
const middleware = chunkOWW5GUSB_js.__privateGet(this, _middleware);
|
|
1693
|
+
const routes = chunkOWW5GUSB_js.__privateGet(this, _routes);
|
|
1693
1694
|
if (!middleware || !routes) {
|
|
1694
1695
|
throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
|
|
1695
1696
|
}
|
|
@@ -1747,17 +1748,17 @@ var RegExpRouter = (_a6 = class {
|
|
|
1747
1748
|
}
|
|
1748
1749
|
buildAllMatchers() {
|
|
1749
1750
|
const matchers = /* @__PURE__ */ Object.create(null);
|
|
1750
|
-
Object.keys(
|
|
1751
|
-
matchers[method] || (matchers[method] =
|
|
1751
|
+
Object.keys(chunkOWW5GUSB_js.__privateGet(this, _routes)).concat(Object.keys(chunkOWW5GUSB_js.__privateGet(this, _middleware))).forEach((method) => {
|
|
1752
|
+
matchers[method] || (matchers[method] = chunkOWW5GUSB_js.__privateMethod(this, _RegExpRouter_instances, buildMatcher_fn).call(this, method));
|
|
1752
1753
|
});
|
|
1753
|
-
|
|
1754
|
+
chunkOWW5GUSB_js.__privateSet(this, _middleware, chunkOWW5GUSB_js.__privateSet(this, _routes, void 0));
|
|
1754
1755
|
clearWildcardRegExpCache();
|
|
1755
1756
|
return matchers;
|
|
1756
1757
|
}
|
|
1757
1758
|
}, _middleware = new WeakMap(), _routes = new WeakMap(), _RegExpRouter_instances = new WeakSet(), buildMatcher_fn = function(method) {
|
|
1758
1759
|
const routes = [];
|
|
1759
1760
|
let hasOwnRoute = method === METHOD_NAME_ALL;
|
|
1760
|
-
[
|
|
1761
|
+
[chunkOWW5GUSB_js.__privateGet(this, _middleware), chunkOWW5GUSB_js.__privateGet(this, _routes)].forEach((r) => {
|
|
1761
1762
|
const ownRoute = r[method] ? Object.keys(r[method]).map((path) => [path, r[method][path]]) : [];
|
|
1762
1763
|
if (ownRoute.length !== 0) {
|
|
1763
1764
|
hasOwnRoute || (hasOwnRoute = true);
|
|
@@ -1779,23 +1780,23 @@ var RegExpRouter = (_a6 = class {
|
|
|
1779
1780
|
var _routers, _routes2, _a7;
|
|
1780
1781
|
var SmartRouter = (_a7 = class {
|
|
1781
1782
|
constructor(init) {
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1783
|
+
chunkOWW5GUSB_js.__publicField(this, "name", "SmartRouter");
|
|
1784
|
+
chunkOWW5GUSB_js.__privateAdd(this, _routers, []);
|
|
1785
|
+
chunkOWW5GUSB_js.__privateAdd(this, _routes2, []);
|
|
1786
|
+
chunkOWW5GUSB_js.__privateSet(this, _routers, init.routers);
|
|
1786
1787
|
}
|
|
1787
1788
|
add(method, path, handler) {
|
|
1788
|
-
if (!
|
|
1789
|
+
if (!chunkOWW5GUSB_js.__privateGet(this, _routes2)) {
|
|
1789
1790
|
throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
|
|
1790
1791
|
}
|
|
1791
|
-
|
|
1792
|
+
chunkOWW5GUSB_js.__privateGet(this, _routes2).push([method, path, handler]);
|
|
1792
1793
|
}
|
|
1793
1794
|
match(method, path) {
|
|
1794
|
-
if (!
|
|
1795
|
+
if (!chunkOWW5GUSB_js.__privateGet(this, _routes2)) {
|
|
1795
1796
|
throw new Error("Fatal error");
|
|
1796
1797
|
}
|
|
1797
|
-
const routers =
|
|
1798
|
-
const routes =
|
|
1798
|
+
const routers = chunkOWW5GUSB_js.__privateGet(this, _routers);
|
|
1799
|
+
const routes = chunkOWW5GUSB_js.__privateGet(this, _routes2);
|
|
1799
1800
|
const len = routers.length;
|
|
1800
1801
|
let i = 0;
|
|
1801
1802
|
let res;
|
|
@@ -1813,8 +1814,8 @@ var SmartRouter = (_a7 = class {
|
|
|
1813
1814
|
throw e;
|
|
1814
1815
|
}
|
|
1815
1816
|
this.match = router.match.bind(router);
|
|
1816
|
-
|
|
1817
|
-
|
|
1817
|
+
chunkOWW5GUSB_js.__privateSet(this, _routers, [router]);
|
|
1818
|
+
chunkOWW5GUSB_js.__privateSet(this, _routes2, void 0);
|
|
1818
1819
|
break;
|
|
1819
1820
|
}
|
|
1820
1821
|
if (i === len) {
|
|
@@ -1824,10 +1825,10 @@ var SmartRouter = (_a7 = class {
|
|
|
1824
1825
|
return res;
|
|
1825
1826
|
}
|
|
1826
1827
|
get activeRouter() {
|
|
1827
|
-
if (
|
|
1828
|
+
if (chunkOWW5GUSB_js.__privateGet(this, _routes2) || chunkOWW5GUSB_js.__privateGet(this, _routers).length !== 1) {
|
|
1828
1829
|
throw new Error("No active router has been determined yet.");
|
|
1829
1830
|
}
|
|
1830
|
-
return
|
|
1831
|
+
return chunkOWW5GUSB_js.__privateGet(this, _routers)[0];
|
|
1831
1832
|
}
|
|
1832
1833
|
}, _routers = new WeakMap(), _routes2 = new WeakMap(), _a7);
|
|
1833
1834
|
|
|
@@ -1842,23 +1843,23 @@ var hasChildren = (children) => {
|
|
|
1842
1843
|
var _methods, _children2, _patterns, _order, _params, __Node_instances, pushHandlerSets_fn, _a8;
|
|
1843
1844
|
var Node2 = (_a8 = class {
|
|
1844
1845
|
constructor(method, handler, children) {
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1846
|
+
chunkOWW5GUSB_js.__privateAdd(this, __Node_instances);
|
|
1847
|
+
chunkOWW5GUSB_js.__privateAdd(this, _methods);
|
|
1848
|
+
chunkOWW5GUSB_js.__privateAdd(this, _children2);
|
|
1849
|
+
chunkOWW5GUSB_js.__privateAdd(this, _patterns);
|
|
1850
|
+
chunkOWW5GUSB_js.__privateAdd(this, _order, 0);
|
|
1851
|
+
chunkOWW5GUSB_js.__privateAdd(this, _params, emptyParams);
|
|
1852
|
+
chunkOWW5GUSB_js.__privateSet(this, _children2, children || /* @__PURE__ */ Object.create(null));
|
|
1853
|
+
chunkOWW5GUSB_js.__privateSet(this, _methods, []);
|
|
1853
1854
|
if (method && handler) {
|
|
1854
1855
|
const m = /* @__PURE__ */ Object.create(null);
|
|
1855
1856
|
m[method] = { handler, possibleKeys: [], score: 0 };
|
|
1856
|
-
|
|
1857
|
+
chunkOWW5GUSB_js.__privateSet(this, _methods, [m]);
|
|
1857
1858
|
}
|
|
1858
|
-
|
|
1859
|
+
chunkOWW5GUSB_js.__privateSet(this, _patterns, []);
|
|
1859
1860
|
}
|
|
1860
1861
|
insert(method, path, handler) {
|
|
1861
|
-
|
|
1862
|
+
chunkOWW5GUSB_js.__privateSet(this, _order, ++chunkOWW5GUSB_js.__privateWrapper(this, _order)._);
|
|
1862
1863
|
let curNode = this;
|
|
1863
1864
|
const parts = splitRoutingPath(path);
|
|
1864
1865
|
const possibleKeys = [];
|
|
@@ -1867,32 +1868,32 @@ var Node2 = (_a8 = class {
|
|
|
1867
1868
|
const nextP = parts[i + 1];
|
|
1868
1869
|
const pattern = getPattern(p, nextP);
|
|
1869
1870
|
const key = Array.isArray(pattern) ? pattern[0] : p;
|
|
1870
|
-
if (key in
|
|
1871
|
-
curNode =
|
|
1871
|
+
if (key in chunkOWW5GUSB_js.__privateGet(curNode, _children2)) {
|
|
1872
|
+
curNode = chunkOWW5GUSB_js.__privateGet(curNode, _children2)[key];
|
|
1872
1873
|
if (pattern) {
|
|
1873
1874
|
possibleKeys.push(pattern[1]);
|
|
1874
1875
|
}
|
|
1875
1876
|
continue;
|
|
1876
1877
|
}
|
|
1877
|
-
|
|
1878
|
+
chunkOWW5GUSB_js.__privateGet(curNode, _children2)[key] = new _a8();
|
|
1878
1879
|
if (pattern) {
|
|
1879
|
-
|
|
1880
|
+
chunkOWW5GUSB_js.__privateGet(curNode, _patterns).push(pattern);
|
|
1880
1881
|
possibleKeys.push(pattern[1]);
|
|
1881
1882
|
}
|
|
1882
|
-
curNode =
|
|
1883
|
+
curNode = chunkOWW5GUSB_js.__privateGet(curNode, _children2)[key];
|
|
1883
1884
|
}
|
|
1884
|
-
|
|
1885
|
+
chunkOWW5GUSB_js.__privateGet(curNode, _methods).push({
|
|
1885
1886
|
[method]: {
|
|
1886
1887
|
handler,
|
|
1887
1888
|
possibleKeys: possibleKeys.filter((v, i, a) => a.indexOf(v) === i),
|
|
1888
|
-
score:
|
|
1889
|
+
score: chunkOWW5GUSB_js.__privateGet(this, _order)
|
|
1889
1890
|
}
|
|
1890
1891
|
});
|
|
1891
1892
|
return curNode;
|
|
1892
1893
|
}
|
|
1893
1894
|
search(method, path) {
|
|
1894
1895
|
const handlerSets = [];
|
|
1895
|
-
|
|
1896
|
+
chunkOWW5GUSB_js.__privateSet(this, _params, emptyParams);
|
|
1896
1897
|
const curNode = this;
|
|
1897
1898
|
let curNodes = [curNode];
|
|
1898
1899
|
const parts = splitPath(path);
|
|
@@ -1905,26 +1906,26 @@ var Node2 = (_a8 = class {
|
|
|
1905
1906
|
const tempNodes = [];
|
|
1906
1907
|
for (let j = 0, len2 = curNodes.length; j < len2; j++) {
|
|
1907
1908
|
const node = curNodes[j];
|
|
1908
|
-
const nextNode =
|
|
1909
|
+
const nextNode = chunkOWW5GUSB_js.__privateGet(node, _children2)[part];
|
|
1909
1910
|
if (nextNode) {
|
|
1910
|
-
|
|
1911
|
+
chunkOWW5GUSB_js.__privateSet(nextNode, _params, chunkOWW5GUSB_js.__privateGet(node, _params));
|
|
1911
1912
|
if (isLast) {
|
|
1912
|
-
if (
|
|
1913
|
-
|
|
1913
|
+
if (chunkOWW5GUSB_js.__privateGet(nextNode, _children2)["*"]) {
|
|
1914
|
+
chunkOWW5GUSB_js.__privateMethod(this, __Node_instances, pushHandlerSets_fn).call(this, handlerSets, chunkOWW5GUSB_js.__privateGet(nextNode, _children2)["*"], method, chunkOWW5GUSB_js.__privateGet(node, _params));
|
|
1914
1915
|
}
|
|
1915
|
-
|
|
1916
|
+
chunkOWW5GUSB_js.__privateMethod(this, __Node_instances, pushHandlerSets_fn).call(this, handlerSets, nextNode, method, chunkOWW5GUSB_js.__privateGet(node, _params));
|
|
1916
1917
|
} else {
|
|
1917
1918
|
tempNodes.push(nextNode);
|
|
1918
1919
|
}
|
|
1919
1920
|
}
|
|
1920
|
-
for (let k = 0, len3 =
|
|
1921
|
-
const pattern =
|
|
1922
|
-
const params =
|
|
1921
|
+
for (let k = 0, len3 = chunkOWW5GUSB_js.__privateGet(node, _patterns).length; k < len3; k++) {
|
|
1922
|
+
const pattern = chunkOWW5GUSB_js.__privateGet(node, _patterns)[k];
|
|
1923
|
+
const params = chunkOWW5GUSB_js.__privateGet(node, _params) === emptyParams ? {} : { ...chunkOWW5GUSB_js.__privateGet(node, _params) };
|
|
1923
1924
|
if (pattern === "*") {
|
|
1924
|
-
const astNode =
|
|
1925
|
+
const astNode = chunkOWW5GUSB_js.__privateGet(node, _children2)["*"];
|
|
1925
1926
|
if (astNode) {
|
|
1926
|
-
|
|
1927
|
-
|
|
1927
|
+
chunkOWW5GUSB_js.__privateMethod(this, __Node_instances, pushHandlerSets_fn).call(this, handlerSets, astNode, method, chunkOWW5GUSB_js.__privateGet(node, _params));
|
|
1928
|
+
chunkOWW5GUSB_js.__privateSet(astNode, _params, params);
|
|
1928
1929
|
tempNodes.push(astNode);
|
|
1929
1930
|
}
|
|
1930
1931
|
continue;
|
|
@@ -1933,7 +1934,7 @@ var Node2 = (_a8 = class {
|
|
|
1933
1934
|
if (!part && !(matcher instanceof RegExp)) {
|
|
1934
1935
|
continue;
|
|
1935
1936
|
}
|
|
1936
|
-
const child =
|
|
1937
|
+
const child = chunkOWW5GUSB_js.__privateGet(node, _children2)[key];
|
|
1937
1938
|
if (matcher instanceof RegExp) {
|
|
1938
1939
|
if (partOffsets === null) {
|
|
1939
1940
|
partOffsets = new Array(len);
|
|
@@ -1947,9 +1948,9 @@ var Node2 = (_a8 = class {
|
|
|
1947
1948
|
const m = matcher.exec(restPathString);
|
|
1948
1949
|
if (m) {
|
|
1949
1950
|
params[name] = m[0];
|
|
1950
|
-
|
|
1951
|
-
if (hasChildren(
|
|
1952
|
-
|
|
1951
|
+
chunkOWW5GUSB_js.__privateMethod(this, __Node_instances, pushHandlerSets_fn).call(this, handlerSets, child, method, chunkOWW5GUSB_js.__privateGet(node, _params), params);
|
|
1952
|
+
if (hasChildren(chunkOWW5GUSB_js.__privateGet(child, _children2))) {
|
|
1953
|
+
chunkOWW5GUSB_js.__privateSet(child, _params, params);
|
|
1953
1954
|
const componentCount = m[0].match(/\//)?.length ?? 0;
|
|
1954
1955
|
const targetCurNodes = curNodesQueue[componentCount] || (curNodesQueue[componentCount] = []);
|
|
1955
1956
|
targetCurNodes.push(child);
|
|
@@ -1960,12 +1961,12 @@ var Node2 = (_a8 = class {
|
|
|
1960
1961
|
if (matcher === true || matcher.test(part)) {
|
|
1961
1962
|
params[name] = part;
|
|
1962
1963
|
if (isLast) {
|
|
1963
|
-
|
|
1964
|
-
if (
|
|
1965
|
-
|
|
1964
|
+
chunkOWW5GUSB_js.__privateMethod(this, __Node_instances, pushHandlerSets_fn).call(this, handlerSets, child, method, params, chunkOWW5GUSB_js.__privateGet(node, _params));
|
|
1965
|
+
if (chunkOWW5GUSB_js.__privateGet(child, _children2)["*"]) {
|
|
1966
|
+
chunkOWW5GUSB_js.__privateMethod(this, __Node_instances, pushHandlerSets_fn).call(this, handlerSets, chunkOWW5GUSB_js.__privateGet(child, _children2)["*"], method, params, chunkOWW5GUSB_js.__privateGet(node, _params));
|
|
1966
1967
|
}
|
|
1967
1968
|
} else {
|
|
1968
|
-
|
|
1969
|
+
chunkOWW5GUSB_js.__privateSet(child, _params, params);
|
|
1969
1970
|
tempNodes.push(child);
|
|
1970
1971
|
}
|
|
1971
1972
|
}
|
|
@@ -1982,8 +1983,8 @@ var Node2 = (_a8 = class {
|
|
|
1982
1983
|
return [handlerSets.map(({ handler, params }) => [handler, params])];
|
|
1983
1984
|
}
|
|
1984
1985
|
}, _methods = new WeakMap(), _children2 = new WeakMap(), _patterns = new WeakMap(), _order = new WeakMap(), _params = new WeakMap(), __Node_instances = new WeakSet(), pushHandlerSets_fn = function(handlerSets, node, method, nodeParams, params) {
|
|
1985
|
-
for (let i = 0, len =
|
|
1986
|
-
const m =
|
|
1986
|
+
for (let i = 0, len = chunkOWW5GUSB_js.__privateGet(node, _methods).length; i < len; i++) {
|
|
1987
|
+
const m = chunkOWW5GUSB_js.__privateGet(node, _methods)[i];
|
|
1987
1988
|
const handlerSet = m[method] || m[METHOD_NAME_ALL];
|
|
1988
1989
|
const processedSet = {};
|
|
1989
1990
|
if (handlerSet !== void 0) {
|
|
@@ -2005,22 +2006,22 @@ var Node2 = (_a8 = class {
|
|
|
2005
2006
|
var _node, _a9;
|
|
2006
2007
|
var TrieRouter = (_a9 = class {
|
|
2007
2008
|
constructor() {
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2009
|
+
chunkOWW5GUSB_js.__publicField(this, "name", "TrieRouter");
|
|
2010
|
+
chunkOWW5GUSB_js.__privateAdd(this, _node);
|
|
2011
|
+
chunkOWW5GUSB_js.__privateSet(this, _node, new Node2());
|
|
2011
2012
|
}
|
|
2012
2013
|
add(method, path, handler) {
|
|
2013
2014
|
const results = checkOptionalParameter(path);
|
|
2014
2015
|
if (results) {
|
|
2015
2016
|
for (let i = 0, len = results.length; i < len; i++) {
|
|
2016
|
-
|
|
2017
|
+
chunkOWW5GUSB_js.__privateGet(this, _node).insert(method, results[i], handler);
|
|
2017
2018
|
}
|
|
2018
2019
|
return;
|
|
2019
2020
|
}
|
|
2020
|
-
|
|
2021
|
+
chunkOWW5GUSB_js.__privateGet(this, _node).insert(method, path, handler);
|
|
2021
2022
|
}
|
|
2022
2023
|
match(method, path) {
|
|
2023
|
-
return
|
|
2024
|
+
return chunkOWW5GUSB_js.__privateGet(this, _node).search(method, path);
|
|
2024
2025
|
}
|
|
2025
2026
|
}, _node = new WeakMap(), _a9);
|
|
2026
2027
|
|
|
@@ -2055,8 +2056,8 @@ var MockError = class extends Error {
|
|
|
2055
2056
|
};
|
|
2056
2057
|
}
|
|
2057
2058
|
};
|
|
2058
|
-
var notFound = (msg) => new MockError(
|
|
2059
|
-
var validation = (msg, ctx) => new MockError(
|
|
2059
|
+
var notFound = (msg) => new MockError(chunkXA3ZNR75_js.ErrorCode.NOT_FOUND, msg, 404);
|
|
2060
|
+
var validation = (msg, ctx) => new MockError(chunkXA3ZNR75_js.ErrorCode.VALIDATION_ERROR, msg, 400, ctx);
|
|
2060
2061
|
|
|
2061
2062
|
// src/mock/routes/_helpers.ts
|
|
2062
2063
|
function authMiddleware(deps) {
|