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