@orpc/server 0.0.0-next.e9dc36e → 0.0.0-next.ed15210
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/chunk-6YJ5NGUE.js +301 -0
- package/dist/chunk-WUOGVGWG.js +1 -0
- package/dist/chunk-XHFINNVL.js +217 -0
- package/dist/fetch.js +12 -678
- package/dist/hono.js +30 -0
- package/dist/index.js +918 -269
- package/dist/next.js +36 -0
- package/dist/node.js +87 -0
- package/dist/src/adapters/fetch/index.d.ts +6 -0
- package/dist/src/adapters/fetch/orpc-handler.d.ts +20 -0
- package/dist/src/adapters/fetch/orpc-payload-codec.d.ts +16 -0
- package/dist/src/adapters/fetch/orpc-procedure-matcher.d.ts +12 -0
- package/dist/src/adapters/fetch/super-json.d.ts +12 -0
- package/dist/src/adapters/fetch/types.d.ts +21 -0
- package/dist/src/adapters/hono/index.d.ts +3 -0
- package/dist/src/adapters/hono/middleware.d.ts +12 -0
- package/dist/src/adapters/next/index.d.ts +3 -0
- package/dist/src/adapters/next/serve.d.ts +19 -0
- package/dist/src/adapters/node/index.d.ts +5 -0
- package/dist/src/adapters/node/orpc-handler.d.ts +12 -0
- package/dist/src/adapters/node/request-listener.d.ts +28 -0
- package/dist/src/adapters/node/types.d.ts +22 -0
- package/dist/src/builder-with-errors-middlewares.d.ts +49 -0
- package/dist/src/builder-with-errors.d.ts +49 -0
- package/dist/src/builder-with-middlewares.d.ts +49 -0
- package/dist/src/builder.d.ts +42 -45
- package/dist/src/config.d.ts +6 -0
- package/dist/src/context.d.ts +10 -0
- package/dist/src/error.d.ts +10 -0
- package/dist/src/hidden.d.ts +4 -0
- package/dist/src/implementer-chainable.d.ts +16 -0
- package/dist/src/index.d.ts +16 -5
- package/dist/src/lazy-decorated.d.ts +8 -0
- package/dist/src/lazy-utils.d.ts +4 -0
- package/dist/src/lazy.d.ts +18 -0
- package/dist/src/middleware-decorated.d.ts +9 -0
- package/dist/src/middleware.d.ts +30 -17
- package/dist/src/procedure-builder-with-input.d.ts +35 -0
- package/dist/src/procedure-builder-with-output.d.ts +34 -0
- package/dist/src/procedure-builder.d.ts +26 -29
- package/dist/src/procedure-client.d.ts +21 -0
- package/dist/src/procedure-decorated.d.ts +25 -0
- package/dist/src/procedure-implementer.d.ts +21 -16
- package/dist/src/procedure-utils.d.ts +17 -0
- package/dist/src/procedure.d.ts +43 -25
- package/dist/src/router-builder.d.ts +31 -20
- package/dist/src/router-client.d.ts +26 -0
- package/dist/src/router-implementer.d.ts +21 -17
- package/dist/src/router-utils.d.ts +15 -0
- package/dist/src/router.d.ts +14 -15
- package/dist/src/types.d.ts +8 -5
- package/package.json +29 -21
- package/dist/chunk-TDFYNRZV.js +0 -190
- package/dist/chunk-TDFYNRZV.js.map +0 -1
- package/dist/fetch.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/src/adapters/fetch.d.ts +0 -42
- package/dist/src/adapters/fetch.d.ts.map +0 -1
- package/dist/src/builder.d.ts.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/middleware.d.ts.map +0 -1
- package/dist/src/procedure-builder.d.ts.map +0 -1
- package/dist/src/procedure-caller.d.ts +0 -19
- package/dist/src/procedure-caller.d.ts.map +0 -1
- package/dist/src/procedure-implementer.d.ts.map +0 -1
- package/dist/src/procedure.d.ts.map +0 -1
- package/dist/src/router-builder.d.ts.map +0 -1
- package/dist/src/router-caller.d.ts +0 -22
- package/dist/src/router-caller.d.ts.map +0 -1
- package/dist/src/router-implementer.d.ts.map +0 -1
- package/dist/src/router.d.ts.map +0 -1
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/utils.d.ts +0 -3
- package/dist/src/utils.d.ts.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/adapters/fetch.test.ts +0 -629
- package/src/adapters/fetch.ts +0 -290
- package/src/builder.test.ts +0 -371
- package/src/builder.ts +0 -238
- package/src/index.ts +0 -16
- package/src/middleware.test.ts +0 -260
- package/src/middleware.ts +0 -136
- package/src/procedure-builder.test.ts +0 -223
- package/src/procedure-builder.ts +0 -158
- package/src/procedure-caller.test.ts +0 -171
- package/src/procedure-caller.ts +0 -138
- package/src/procedure-implementer.test.ts +0 -220
- package/src/procedure-implementer.ts +0 -102
- package/src/procedure.test.ts +0 -317
- package/src/procedure.ts +0 -237
- package/src/router-builder.test.ts +0 -106
- package/src/router-builder.ts +0 -122
- package/src/router-caller.test.ts +0 -126
- package/src/router-caller.ts +0 -64
- package/src/router-implementer.test.ts +0 -116
- package/src/router-implementer.ts +0 -113
- package/src/router.test-d.ts +0 -48
- package/src/router.test.ts +0 -142
- package/src/router.ts +0 -91
- package/src/types.test.ts +0 -18
- package/src/types.ts +0 -13
- package/src/utils.test.ts +0 -16
- package/src/utils.ts +0 -16
@@ -1,20 +1,24 @@
|
|
1
|
+
import type { ContractRouter } from '@orpc/contract';
|
2
|
+
import type { ConflictContextGuard, Context, TypeCurrentContext, TypeInitialContext } from './context';
|
3
|
+
import type { FlattenLazy } from './lazy';
|
1
4
|
import type { Middleware } from './middleware';
|
2
|
-
import type {
|
3
|
-
import type
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
5
|
+
import type { Router, RouterToContract } from './router';
|
6
|
+
import { type UnshiftedMiddlewaresRouter } from './router-utils';
|
7
|
+
export type EqualContractGuard<TContract extends ContractRouter<any>, TRouter extends Router<any, TContract>> = TContract extends RouterToContract<TRouter> ? unknown : never;
|
8
|
+
export interface RouterImplementerDef<TInitialContext extends Context, TCurrentContext extends Context, TContract extends ContractRouter<any>> {
|
9
|
+
__initialContext?: TypeInitialContext<TInitialContext>;
|
10
|
+
__currentContext?: TypeCurrentContext<TCurrentContext>;
|
11
|
+
middlewares: Middleware<any, any, any, any, any>[];
|
12
|
+
contract: TContract;
|
13
|
+
}
|
14
|
+
export declare class RouterImplementer<TInitialContext extends Context, TCurrentContext extends Context, TContract extends ContractRouter<any>> {
|
15
|
+
'~type': "RouterImplementer";
|
16
|
+
'~orpc': RouterImplementerDef<TInitialContext, TCurrentContext, TContract>;
|
17
|
+
constructor(def: RouterImplementerDef<TInitialContext, TCurrentContext, TContract>);
|
18
|
+
use<U extends Context>(middleware: Middleware<TCurrentContext, U, unknown, unknown, Record<never, never>>): ConflictContextGuard<TCurrentContext & U> & RouterImplementer<TInitialContext, TCurrentContext & U, TContract>;
|
19
|
+
router<U extends Router<TCurrentContext, TContract>>(router: U): EqualContractGuard<TContract, U> & UnshiftedMiddlewaresRouter<U, TInitialContext>;
|
20
|
+
lazy<U extends Router<TCurrentContext, TContract>>(loader: () => Promise<{
|
21
|
+
default: U;
|
22
|
+
}>): EqualContractGuard<TContract, U> & UnshiftedMiddlewaresRouter<FlattenLazy<U>, TInitialContext>;
|
14
23
|
}
|
15
|
-
export type ChainedRouterImplementer<TContext extends Context, TContract extends ContractRouter, TExtraContext extends Context> = {
|
16
|
-
[K in keyof TContract]: TContract[K] extends ContractProcedure<infer UInputSchema, infer UOutputSchema> ? ProcedureImplementer<TContext, TExtraContext, UInputSchema, UOutputSchema> : TContract[K] extends ContractRouter ? ChainedRouterImplementer<TContext, TContract[K], TExtraContext> : never;
|
17
|
-
} & RouterImplementer<TContext, TContract>;
|
18
|
-
export declare function chainRouterImplementer<TContext extends Context, TContract extends ContractRouter, TExtraContext extends Context>(contract: TContract, middlewares?: Middleware<any, any, any, any>[]): ChainedRouterImplementer<TContext, TContract, TExtraContext>;
|
19
|
-
export declare function assertRouterImplementation(contract: ContractRouter, router: RouterWithContract<any, any>, path?: string[]): void;
|
20
24
|
//# sourceMappingURL=router-implementer.d.ts.map
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { Context, TypeInitialContext } from './context';
|
2
|
+
import type { Lazy } from './lazy';
|
3
|
+
import type { ANY_MIDDLEWARE } from './middleware';
|
4
|
+
import type { ANY_ROUTER } from './router';
|
5
|
+
import { type DecoratedLazy } from './lazy-decorated';
|
6
|
+
import { type Procedure } from './procedure';
|
7
|
+
import { DecoratedProcedure } from './procedure-decorated';
|
8
|
+
export type UnshiftedMiddlewaresRouter<TRouter extends ANY_ROUTER, TInitialContext extends Context> = TRouter extends Lazy<infer U extends ANY_ROUTER> ? DecoratedLazy<UnshiftedMiddlewaresRouter<U, TInitialContext>> : TRouter extends Procedure<any, infer UCurrentContext, infer UInputSchema, infer UOutputSchema, infer UFuncOutput, infer UErrorMap, infer URoute> ? DecoratedProcedure<TInitialContext, UCurrentContext, UInputSchema, UOutputSchema, UFuncOutput, UErrorMap, URoute> : {
|
9
|
+
[K in keyof TRouter]: TRouter[K] extends ANY_ROUTER ? UnshiftedMiddlewaresRouter<TRouter[K], TInitialContext> : never;
|
10
|
+
};
|
11
|
+
export declare function unshiftMiddlewaresRouter<TRouter extends ANY_ROUTER, TInitialContext extends Context>(router: TRouter, options: {
|
12
|
+
__initialContext?: TypeInitialContext<TInitialContext>;
|
13
|
+
middlewares: ANY_MIDDLEWARE[];
|
14
|
+
}): UnshiftedMiddlewaresRouter<TRouter, TInitialContext>;
|
15
|
+
//# sourceMappingURL=router-utils.d.ts.map
|
package/dist/src/router.d.ts
CHANGED
@@ -1,20 +1,19 @@
|
|
1
1
|
import type { ContractProcedure, ContractRouter, SchemaInput, SchemaOutput } from '@orpc/contract';
|
2
|
-
import type { Context } from './
|
3
|
-
import {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
import type { Context } from './context';
|
3
|
+
import type { ANY_LAZY, Lazy, Lazyable } from './lazy';
|
4
|
+
import type { ANY_PROCEDURE, Procedure } from './procedure';
|
5
|
+
export type Router<TInitialContext extends Context, TContract extends ContractRouter<any>> = Lazyable<TContract extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer URoute> ? Procedure<TInitialContext, any, UInputSchema, UOutputSchema, any, UErrorMap, URoute> : {
|
6
|
+
[K in keyof TContract]: TContract[K] extends ContractRouter<any> ? Router<TInitialContext, TContract[K]> : never;
|
7
|
+
}>;
|
8
|
+
export type RouterToContract<T extends Router<any, any>> = T extends Lazy<infer U extends Router<any, any>> ? RouterToContract<U> : T extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, any, infer UErrorMap, infer URoute> ? ContractProcedure<UInputSchema, UOutputSchema, UErrorMap, URoute> : {
|
9
|
+
[K in keyof T]: T[K] extends Router<any, any> ? RouterToContract<T[K]> : never;
|
9
10
|
};
|
10
|
-
export type
|
11
|
-
|
11
|
+
export type ANY_ROUTER = Router<any, any>;
|
12
|
+
export type InferRouterInputs<T extends ANY_ROUTER> = T extends Lazy<infer U extends ANY_ROUTER> ? InferRouterInputs<U> : T extends Procedure<any, any, infer UInputSchema, any, any, any, any> ? SchemaInput<UInputSchema> : {
|
13
|
+
[K in keyof T]: T[K] extends ANY_ROUTER ? InferRouterInputs<T[K]> : never;
|
12
14
|
};
|
13
|
-
export
|
14
|
-
|
15
|
-
[K in keyof T]: T[K] extends Procedure<any, any, infer UInputSchema, any, any> ? SchemaInput<UInputSchema> : T[K] extends Router<any> ? InferRouterInputs<T[K]> : never;
|
16
|
-
};
|
17
|
-
export type InferRouterOutputs<T extends Router<any>> = {
|
18
|
-
[K in keyof T]: T[K] extends Procedure<any, any, any, infer UOutputSchema, infer UFuncOutput> ? SchemaOutput<UOutputSchema, UFuncOutput> : T[K] extends Router<any> ? InferRouterOutputs<T[K]> : never;
|
15
|
+
export type InferRouterOutputs<T extends ANY_ROUTER> = T extends Lazy<infer U extends ANY_ROUTER> ? InferRouterOutputs<U> : T extends Procedure<any, any, any, infer UOutputSchema, infer UFuncOutput, any, any> ? SchemaOutput<UOutputSchema, UFuncOutput> : {
|
16
|
+
[K in keyof T]: T[K] extends ANY_ROUTER ? InferRouterOutputs<T[K]> : never;
|
19
17
|
};
|
18
|
+
export declare function getRouterChild<T extends ANY_ROUTER | Lazy<undefined>>(router: T, ...path: string[]): T extends ANY_LAZY ? Lazy<ANY_PROCEDURE> | Lazy<Record<string, ANY_ROUTER>> | Lazy<undefined> : ANY_ROUTER | Lazy<undefined> | undefined;
|
20
19
|
//# sourceMappingURL=router.d.ts.map
|
package/dist/src/types.d.ts
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
import type {
|
2
|
-
|
3
|
-
export type
|
4
|
-
export interface
|
1
|
+
import type { FindGlobalInstanceType } from '@orpc/shared';
|
2
|
+
import type { ANY_PROCEDURE } from './procedure';
|
3
|
+
export type AbortSignal = FindGlobalInstanceType<'AbortSignal'>;
|
4
|
+
export interface WithSignal {
|
5
|
+
signal?: AbortSignal;
|
6
|
+
}
|
7
|
+
export interface Meta extends WithSignal {
|
5
8
|
path: string[];
|
6
|
-
procedure:
|
9
|
+
procedure: ANY_PROCEDURE;
|
7
10
|
}
|
8
11
|
//# sourceMappingURL=types.d.ts.map
|
package/package.json
CHANGED
@@ -1,21 +1,17 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/server",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.0-next.
|
5
|
-
"author": {
|
6
|
-
"name": "unnoq",
|
7
|
-
"email": "contact@unnoq.com",
|
8
|
-
"url": "https://unnoq.com"
|
9
|
-
},
|
4
|
+
"version": "0.0.0-next.ed15210",
|
10
5
|
"license": "MIT",
|
11
|
-
"homepage": "https://
|
6
|
+
"homepage": "https://orpc.unnoq.com",
|
12
7
|
"repository": {
|
13
8
|
"type": "git",
|
14
|
-
"url": "https://github.com/unnoq/orpc.git",
|
9
|
+
"url": "git+https://github.com/unnoq/orpc.git",
|
15
10
|
"directory": "packages/server"
|
16
11
|
},
|
17
12
|
"keywords": [
|
18
|
-
"unnoq"
|
13
|
+
"unnoq",
|
14
|
+
"orpc"
|
19
15
|
],
|
20
16
|
"exports": {
|
21
17
|
".": {
|
@@ -24,32 +20,44 @@
|
|
24
20
|
"default": "./dist/index.js"
|
25
21
|
},
|
26
22
|
"./fetch": {
|
27
|
-
"types": "./dist/src/adapters/fetch.d.ts",
|
23
|
+
"types": "./dist/src/adapters/fetch/index.d.ts",
|
28
24
|
"import": "./dist/fetch.js",
|
29
25
|
"default": "./dist/fetch.js"
|
30
26
|
},
|
27
|
+
"./hono": {
|
28
|
+
"types": "./dist/src/adapters/hono/index.d.ts",
|
29
|
+
"import": "./dist/hono.js",
|
30
|
+
"default": "./dist/hono.js"
|
31
|
+
},
|
32
|
+
"./next": {
|
33
|
+
"types": "./dist/src/adapters/next/index.d.ts",
|
34
|
+
"import": "./dist/next.js",
|
35
|
+
"default": "./dist/next.js"
|
36
|
+
},
|
37
|
+
"./node": {
|
38
|
+
"types": "./dist/src/adapters/node/index.d.ts",
|
39
|
+
"import": "./dist/node.js",
|
40
|
+
"default": "./dist/node.js"
|
41
|
+
},
|
31
42
|
"./🔒/*": {
|
32
43
|
"types": "./dist/src/*.d.ts"
|
33
44
|
}
|
34
45
|
},
|
35
46
|
"files": [
|
36
|
-
"
|
37
|
-
"
|
47
|
+
"!**/*.map",
|
48
|
+
"!**/*.tsbuildinfo",
|
49
|
+
"dist"
|
38
50
|
],
|
39
51
|
"peerDependencies": {
|
40
|
-
"
|
41
|
-
"
|
52
|
+
"hono": ">=4.6.0",
|
53
|
+
"next": ">=14.0.0"
|
42
54
|
},
|
43
55
|
"dependencies": {
|
44
|
-
"@orpc/contract": "0.0.0-next.
|
45
|
-
"@orpc/
|
46
|
-
"@orpc/shared": "0.0.0-next.e9dc36e"
|
47
|
-
},
|
48
|
-
"devDependencies": {
|
49
|
-
"hono": "^4.6.3"
|
56
|
+
"@orpc/contract": "0.0.0-next.ed15210",
|
57
|
+
"@orpc/shared": "0.0.0-next.ed15210"
|
50
58
|
},
|
51
59
|
"scripts": {
|
52
|
-
"build": "tsup --
|
60
|
+
"build": "tsup --onSuccess='tsc -b --noCheck'",
|
53
61
|
"build:watch": "pnpm run build --watch",
|
54
62
|
"type:check": "tsc -b"
|
55
63
|
}
|
package/dist/chunk-TDFYNRZV.js
DELETED
@@ -1,190 +0,0 @@
|
|
1
|
-
// src/utils.ts
|
2
|
-
function mergeContext(a, b) {
|
3
|
-
if (!a)
|
4
|
-
return b;
|
5
|
-
if (!b)
|
6
|
-
return a;
|
7
|
-
return {
|
8
|
-
...a,
|
9
|
-
...b
|
10
|
-
};
|
11
|
-
}
|
12
|
-
|
13
|
-
// src/middleware.ts
|
14
|
-
var decoratedMiddlewareSymbol = Symbol("\u{1F512}decoratedMiddleware");
|
15
|
-
function decorateMiddleware(middleware) {
|
16
|
-
if (Reflect.get(middleware, decoratedMiddlewareSymbol)) {
|
17
|
-
return middleware;
|
18
|
-
}
|
19
|
-
const concat = (concatMiddleware, mapInput2) => {
|
20
|
-
const concatMiddleware_ = mapInput2 ? decorateMiddleware(concatMiddleware).mapInput(mapInput2) : concatMiddleware;
|
21
|
-
return decorateMiddleware(async (input, context, meta, ...rest) => {
|
22
|
-
const input_ = input;
|
23
|
-
const context_ = context;
|
24
|
-
const meta_ = meta;
|
25
|
-
const next = async (options) => {
|
26
|
-
return concatMiddleware_(input_, mergeContext(context_, options.context), meta_, ...rest);
|
27
|
-
};
|
28
|
-
const m1 = await middleware(input_, context_, {
|
29
|
-
...meta_,
|
30
|
-
next
|
31
|
-
}, ...rest);
|
32
|
-
return m1;
|
33
|
-
});
|
34
|
-
};
|
35
|
-
const mapInput = (map) => {
|
36
|
-
return decorateMiddleware(
|
37
|
-
(input, ...rest) => middleware(map(input), ...rest)
|
38
|
-
);
|
39
|
-
};
|
40
|
-
return Object.assign(middleware, {
|
41
|
-
[decoratedMiddlewareSymbol]: true,
|
42
|
-
concat,
|
43
|
-
mapInput
|
44
|
-
});
|
45
|
-
}
|
46
|
-
|
47
|
-
// src/procedure-caller.ts
|
48
|
-
import { value } from "@orpc/shared";
|
49
|
-
import { ORPCError } from "@orpc/shared/error";
|
50
|
-
import { OpenAPIDeserializer } from "@orpc/transformer";
|
51
|
-
function createProcedureCaller(options) {
|
52
|
-
const path = options.path ?? [];
|
53
|
-
const procedure = options.procedure;
|
54
|
-
const caller = async (input) => {
|
55
|
-
const input_ = (() => {
|
56
|
-
if (!(input instanceof FormData)) {
|
57
|
-
return input;
|
58
|
-
}
|
59
|
-
const transformer = new OpenAPIDeserializer({
|
60
|
-
schema: procedure.zz$p.contract.zz$cp.InputSchema
|
61
|
-
});
|
62
|
-
return transformer.deserializeAsFormData(input);
|
63
|
-
})();
|
64
|
-
const validInput = (() => {
|
65
|
-
const schema = procedure.zz$p.contract.zz$cp.InputSchema;
|
66
|
-
if (!schema) {
|
67
|
-
return input_;
|
68
|
-
}
|
69
|
-
try {
|
70
|
-
return schema.parse(input_);
|
71
|
-
} catch (e) {
|
72
|
-
throw new ORPCError({
|
73
|
-
message: "Validation input failed",
|
74
|
-
code: "BAD_REQUEST",
|
75
|
-
cause: e
|
76
|
-
});
|
77
|
-
}
|
78
|
-
})();
|
79
|
-
const middlewares = procedure.zz$p.middlewares ?? [];
|
80
|
-
let currentMidIndex = 0;
|
81
|
-
let currentContext = await value(options.context);
|
82
|
-
const next = async (nextOptions) => {
|
83
|
-
const mid = middlewares[currentMidIndex];
|
84
|
-
currentMidIndex += 1;
|
85
|
-
currentContext = mergeContext(currentContext, nextOptions.context);
|
86
|
-
if (mid) {
|
87
|
-
return await mid(validInput, currentContext, {
|
88
|
-
path,
|
89
|
-
procedure,
|
90
|
-
next,
|
91
|
-
output: (output2) => ({ output: output2, context: void 0 })
|
92
|
-
});
|
93
|
-
} else {
|
94
|
-
return {
|
95
|
-
output: await await procedure.zz$p.func(validInput, currentContext, {
|
96
|
-
path,
|
97
|
-
procedure
|
98
|
-
}),
|
99
|
-
context: currentContext
|
100
|
-
};
|
101
|
-
}
|
102
|
-
};
|
103
|
-
const output = (await next({})).output;
|
104
|
-
const validOutput = await (async () => {
|
105
|
-
const schema = procedure.zz$p.contract.zz$cp.OutputSchema;
|
106
|
-
if (!schema) {
|
107
|
-
return output;
|
108
|
-
}
|
109
|
-
const result = await schema.safeParseAsync(output);
|
110
|
-
if (result.error) {
|
111
|
-
throw new ORPCError({
|
112
|
-
message: "Validation output failed",
|
113
|
-
code: "INTERNAL_SERVER_ERROR",
|
114
|
-
cause: result.error
|
115
|
-
});
|
116
|
-
}
|
117
|
-
return result.data;
|
118
|
-
})();
|
119
|
-
return validOutput;
|
120
|
-
};
|
121
|
-
return caller;
|
122
|
-
}
|
123
|
-
|
124
|
-
// src/procedure.ts
|
125
|
-
import {
|
126
|
-
DecoratedContractProcedure,
|
127
|
-
isContractProcedure
|
128
|
-
} from "@orpc/contract";
|
129
|
-
var Procedure = class {
|
130
|
-
constructor(zz$p) {
|
131
|
-
this.zz$p = zz$p;
|
132
|
-
}
|
133
|
-
};
|
134
|
-
var DECORATED_PROCEDURE_SYMBOL = Symbol("DECORATED_PROCEDURE");
|
135
|
-
function decorateProcedure(procedure) {
|
136
|
-
if (DECORATED_PROCEDURE_SYMBOL in procedure) {
|
137
|
-
return procedure;
|
138
|
-
}
|
139
|
-
return Object.assign(createProcedureCaller({
|
140
|
-
procedure,
|
141
|
-
context: void 0
|
142
|
-
}), {
|
143
|
-
[DECORATED_PROCEDURE_SYMBOL]: true,
|
144
|
-
zz$p: procedure.zz$p,
|
145
|
-
prefix(prefix) {
|
146
|
-
return decorateProcedure({
|
147
|
-
zz$p: {
|
148
|
-
...procedure.zz$p,
|
149
|
-
contract: DecoratedContractProcedure.decorate(
|
150
|
-
procedure.zz$p.contract
|
151
|
-
).prefix(prefix)
|
152
|
-
}
|
153
|
-
});
|
154
|
-
},
|
155
|
-
route(opts) {
|
156
|
-
return decorateProcedure({
|
157
|
-
zz$p: {
|
158
|
-
...procedure.zz$p,
|
159
|
-
contract: DecoratedContractProcedure.decorate(
|
160
|
-
procedure.zz$p.contract
|
161
|
-
).route(opts)
|
162
|
-
}
|
163
|
-
});
|
164
|
-
},
|
165
|
-
use(middleware, mapInput) {
|
166
|
-
const middleware_ = mapInput ? decorateMiddleware(middleware).mapInput(mapInput) : middleware;
|
167
|
-
return decorateProcedure({
|
168
|
-
zz$p: {
|
169
|
-
...procedure.zz$p,
|
170
|
-
middlewares: [middleware_, ...procedure.zz$p.middlewares ?? []]
|
171
|
-
}
|
172
|
-
});
|
173
|
-
}
|
174
|
-
});
|
175
|
-
}
|
176
|
-
function isProcedure(item) {
|
177
|
-
if (item instanceof Procedure)
|
178
|
-
return true;
|
179
|
-
return (typeof item === "object" || typeof item === "function") && item !== null && "zz$p" in item && typeof item.zz$p === "object" && item.zz$p !== null && "contract" in item.zz$p && isContractProcedure(item.zz$p.contract) && "func" in item.zz$p && typeof item.zz$p.func === "function";
|
180
|
-
}
|
181
|
-
|
182
|
-
export {
|
183
|
-
mergeContext,
|
184
|
-
decorateMiddleware,
|
185
|
-
createProcedureCaller,
|
186
|
-
Procedure,
|
187
|
-
decorateProcedure,
|
188
|
-
isProcedure
|
189
|
-
};
|
190
|
-
//# sourceMappingURL=chunk-TDFYNRZV.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/utils.ts","../src/middleware.ts","../src/procedure-caller.ts","../src/procedure.ts"],"sourcesContent":["import type { Context, MergeContext } from './types'\n\nexport function mergeContext<A extends Context, B extends Context>(\n a: A,\n b: B,\n): MergeContext<A, B> {\n if (!a)\n return b as any\n if (!b)\n return a as any\n\n return {\n ...a,\n ...b,\n } as any\n}\n","import type { Promisable } from '@orpc/shared'\nimport type { Context, MergeContext, Meta } from './types'\nimport { mergeContext } from './utils'\n\nexport type MiddlewareResult<TExtraContext extends Context, TOutput> = Promisable<{\n output: TOutput\n context: TExtraContext\n}>\n\nexport interface MiddlewareMeta<\n TOutput,\n> extends Meta {\n next: <UExtraContext extends Context = undefined>(\n options: UExtraContext extends undefined ? { context?: UExtraContext } : { context: UExtraContext }\n ) => MiddlewareResult<UExtraContext, TOutput>\n output: <UOutput>(output: UOutput) => MiddlewareResult<undefined, UOutput>\n}\n\nexport interface Middleware<\n TContext extends Context,\n TExtraContext extends Context,\n TInput,\n TOutput,\n> {\n (\n input: TInput,\n context: TContext,\n meta: MiddlewareMeta<TOutput>,\n ): Promisable<\n MiddlewareResult<TExtraContext, TOutput>\n >\n}\n\nexport interface MapInputMiddleware<TInput, TMappedInput> {\n (input: TInput): TMappedInput\n}\n\nexport interface DecoratedMiddleware<\n TContext extends Context,\n TExtraContext extends Context,\n TInput,\n TOutput,\n> extends Middleware<TContext, TExtraContext, TInput, TOutput> {\n concat: (<\n UExtraContext extends Partial<MergeContext<Context, MergeContext<TContext, TExtraContext>>> | undefined = undefined,\n UInput = TInput,\n >(\n middleware: Middleware<\n MergeContext<TContext, TExtraContext>,\n UExtraContext,\n UInput & TInput,\n TOutput\n >,\n ) => DecoratedMiddleware<\n TContext,\n MergeContext<TExtraContext, UExtraContext>,\n TInput & UInput,\n TOutput\n >) & (<\n UExtraContext extends Partial<MergeContext<Context, MergeContext<TContext, TExtraContext>>> | undefined = undefined,\n UInput = TInput,\n UMappedInput = unknown,\n >(\n middleware: Middleware<\n MergeContext<TContext, TExtraContext>,\n UExtraContext,\n UMappedInput,\n TOutput\n >,\n mapInput: MapInputMiddleware<UInput, UMappedInput>,\n ) => DecoratedMiddleware<\n TContext,\n MergeContext<TExtraContext, UExtraContext>,\n TInput & UInput,\n TOutput\n >)\n\n mapInput: <UInput = unknown>(\n map: MapInputMiddleware<UInput, TInput>,\n ) => DecoratedMiddleware<TContext, TExtraContext, UInput, TOutput>\n}\n\nconst decoratedMiddlewareSymbol = Symbol('🔒decoratedMiddleware')\n\nexport function decorateMiddleware<\n TContext extends Context,\n TExtraContext extends Context,\n TInput,\n TOutput,\n>(\n middleware: Middleware<TContext, TExtraContext, TInput, TOutput>,\n): DecoratedMiddleware<TContext, TExtraContext, TInput, TOutput> {\n if (Reflect.get(middleware, decoratedMiddlewareSymbol)) {\n return middleware as any\n }\n\n const concat = (\n concatMiddleware: Middleware<any, any, any, any>,\n mapInput?: MapInputMiddleware<any, any>,\n ): Middleware<any, any, any, any> => {\n const concatMiddleware_ = mapInput\n ? decorateMiddleware(concatMiddleware).mapInput(mapInput)\n : concatMiddleware\n\n return decorateMiddleware(async (input, context, meta, ...rest) => {\n const input_ = input as any\n const context_ = context as any\n const meta_ = meta as any\n\n const next: MiddlewareMeta<any>['next'] = async (options) => {\n return concatMiddleware_(input_, mergeContext(context_, options.context), meta_, ...rest)\n }\n\n const m1 = await middleware(input_, context_, {\n ...meta_,\n next,\n }, ...rest)\n\n return m1\n })\n }\n\n const mapInput = <UInput = unknown>(\n map: MapInputMiddleware<UInput, TInput>,\n ): DecoratedMiddleware<TContext, TExtraContext, UInput, TOutput> => {\n return decorateMiddleware((input, ...rest) =>\n middleware(map(input), ...rest),\n )\n }\n\n return Object.assign(middleware, {\n [decoratedMiddlewareSymbol]: true,\n concat: concat as any,\n mapInput,\n })\n}\n","import type { SchemaInput, SchemaOutput } from '@orpc/contract'\nimport type { MiddlewareMeta } from './middleware'\nimport type { Procedure } from './procedure'\nimport type { Context } from './types'\nimport { type Value, value } from '@orpc/shared'\nimport { ORPCError } from '@orpc/shared/error'\nimport { OpenAPIDeserializer } from '@orpc/transformer'\nimport { mergeContext } from './utils'\n\nexport interface CreateProcedureCallerOptions<\n TProcedure extends Procedure<any, any, any, any, any>,\n> {\n procedure: TProcedure\n\n /**\n * The context used when calling the procedure.\n */\n context: Value<\n TProcedure extends Procedure<infer UContext, any, any, any, any>\n ? UContext\n : never\n >\n\n /**\n * This is helpful for logging and analytics.\n *\n * @internal\n */\n path?: string[]\n}\n\nexport type ProcedureCaller<\n TProcedure extends Procedure<any, any, any, any, any>,\n> = TProcedure extends Procedure<\n any,\n any,\n infer UInputSchema,\n infer UOutputSchema,\n infer UFuncOutput\n>\n ? (\n ...input: [input: SchemaInput<UInputSchema> | FormData] | (undefined extends SchemaInput<UInputSchema> ? [] : never)\n ) => Promise<\n SchemaOutput<UOutputSchema, UFuncOutput>\n >\n : never\n\nexport function createProcedureCaller<\n TProcedure extends Procedure<any, any, any, any, any>,\n>(\n options: CreateProcedureCallerOptions<TProcedure>,\n): ProcedureCaller<TProcedure> {\n const path = options.path ?? []\n const procedure = options.procedure\n\n const caller = async (input: unknown): Promise<unknown> => {\n const input_ = (() => {\n if (!(input instanceof FormData)) {\n return input\n }\n\n const transformer = new OpenAPIDeserializer({\n schema: procedure.zz$p.contract.zz$cp.InputSchema,\n })\n\n return transformer.deserializeAsFormData(input)\n })()\n\n const validInput = (() => {\n const schema = procedure.zz$p.contract.zz$cp.InputSchema\n if (!schema) {\n return input_\n }\n\n try {\n return schema.parse(input_)\n }\n catch (e) {\n throw new ORPCError({\n message: 'Validation input failed',\n code: 'BAD_REQUEST',\n cause: e,\n })\n }\n })()\n\n const middlewares = procedure.zz$p.middlewares ?? []\n let currentMidIndex = 0\n let currentContext: Context = await value(options.context)\n\n const next: MiddlewareMeta<unknown>['next'] = async (nextOptions) => {\n const mid = middlewares[currentMidIndex]\n currentMidIndex += 1\n currentContext = mergeContext(currentContext, nextOptions.context)\n\n if (mid) {\n return await mid(validInput, currentContext, {\n path,\n procedure,\n next,\n output: output => ({ output, context: undefined }),\n })\n }\n else {\n return {\n output: await await procedure.zz$p.func(validInput, currentContext, {\n path,\n procedure,\n }),\n context: currentContext,\n }\n }\n }\n\n const output = (await next({})).output\n\n const validOutput = await (async () => {\n const schema = procedure.zz$p.contract.zz$cp.OutputSchema\n if (!schema) {\n return output\n }\n\n const result = await schema.safeParseAsync(output)\n if (result.error) {\n throw new ORPCError({\n message: 'Validation output failed',\n code: 'INTERNAL_SERVER_ERROR',\n cause: result.error,\n })\n }\n return result.data\n })()\n\n return validOutput\n }\n\n return caller as ProcedureCaller<TProcedure>\n}\n","import type { Promisable } from '@orpc/shared'\nimport type { ProcedureCaller } from './procedure-caller'\nimport type { Context, MergeContext, Meta } from './types'\nimport {\n type ContractProcedure,\n DecoratedContractProcedure,\n type HTTPPath,\n isContractProcedure,\n type RouteOptions,\n type Schema,\n type SchemaInput,\n type SchemaOutput,\n} from '@orpc/contract'\nimport {\n decorateMiddleware,\n type MapInputMiddleware,\n type Middleware,\n} from './middleware'\nimport { createProcedureCaller } from './procedure-caller'\n\nexport class Procedure<\n TContext extends Context,\n TExtraContext extends Context,\n TInputSchema extends Schema,\n TOutputSchema extends Schema,\n TFuncOutput extends SchemaOutput<TOutputSchema>,\n> {\n constructor(\n public zz$p: {\n middlewares?: Middleware<any, any, any, any>[]\n contract: ContractProcedure<TInputSchema, TOutputSchema>\n func: ProcedureFunc<\n TContext,\n TExtraContext,\n TInputSchema,\n TOutputSchema,\n TFuncOutput\n >\n },\n ) {}\n}\n\nexport type DecoratedProcedure<\n TContext extends Context,\n TExtraContext extends Context,\n TInputSchema extends Schema,\n TOutputSchema extends Schema,\n TFuncOutput extends SchemaOutput<TOutputSchema>,\n> = Procedure<\n TContext,\n TExtraContext,\n TInputSchema,\n TOutputSchema,\n TFuncOutput\n> & {\n prefix: (\n prefix: HTTPPath,\n ) => DecoratedProcedure<\n TContext,\n TExtraContext,\n TInputSchema,\n TOutputSchema,\n TFuncOutput\n >\n\n route: (\n opts: RouteOptions,\n ) => DecoratedProcedure<\n TContext,\n TExtraContext,\n TInputSchema,\n TOutputSchema,\n TFuncOutput\n >\n\n use: (<\n UExtraContext extends\n | Partial<MergeContext<Context, MergeContext<TContext, TExtraContext>>>\n | undefined = undefined,\n >(\n middleware: Middleware<\n MergeContext<TContext, TExtraContext>,\n UExtraContext,\n SchemaOutput<TInputSchema>,\n SchemaInput<TOutputSchema, TFuncOutput>\n >,\n ) => DecoratedProcedure<\n TContext,\n MergeContext<TExtraContext, UExtraContext>,\n TInputSchema,\n TOutputSchema,\n TFuncOutput\n >) & (<\n UExtraContext extends\n | Partial<MergeContext<Context, MergeContext<TContext, TExtraContext>>>\n | undefined = undefined,\n UMappedInput = unknown,\n >(\n middleware: Middleware<\n MergeContext<TContext, TExtraContext>,\n UExtraContext,\n UMappedInput,\n SchemaInput<TOutputSchema, TFuncOutput>\n >,\n mapInput: MapInputMiddleware<\n SchemaOutput<TInputSchema, TFuncOutput>,\n UMappedInput\n >,\n ) => DecoratedProcedure<\n TContext,\n MergeContext<TExtraContext, UExtraContext>,\n TInputSchema,\n TOutputSchema,\n TFuncOutput\n >)\n} & (undefined extends TContext\n ? ProcedureCaller<Procedure<\n TContext,\n TExtraContext,\n TInputSchema,\n TOutputSchema,\n TFuncOutput\n >>\n : unknown)\n\nexport interface ProcedureFunc<\n TContext extends Context,\n TExtraContext extends Context,\n TInputSchema extends Schema,\n TOutputSchema extends Schema,\n TOutput extends SchemaOutput<TOutputSchema>,\n> {\n (\n input: SchemaOutput<TInputSchema>,\n context: MergeContext<TContext, TExtraContext>,\n meta: Meta,\n ): Promisable<SchemaInput<TOutputSchema, TOutput>>\n}\n\nconst DECORATED_PROCEDURE_SYMBOL = Symbol('DECORATED_PROCEDURE')\n\nexport function decorateProcedure<\n TContext extends Context,\n TExtraContext extends Context,\n TInputSchema extends Schema,\n TOutputSchema extends Schema,\n TFuncOutput extends SchemaOutput<TOutputSchema>,\n>(\n procedure: Procedure<\n TContext,\n TExtraContext,\n TInputSchema,\n TOutputSchema,\n TFuncOutput\n >,\n): DecoratedProcedure<\n TContext,\n TExtraContext,\n TInputSchema,\n TOutputSchema,\n TFuncOutput\n > {\n if (DECORATED_PROCEDURE_SYMBOL in procedure) {\n return procedure as any\n }\n\n return Object.assign(createProcedureCaller({\n procedure,\n context: undefined as any,\n }), {\n [DECORATED_PROCEDURE_SYMBOL]: true,\n zz$p: procedure.zz$p,\n\n prefix(prefix: HTTPPath) {\n return decorateProcedure({\n zz$p: {\n ...procedure.zz$p,\n contract: DecoratedContractProcedure.decorate(\n procedure.zz$p.contract,\n ).prefix(prefix),\n },\n })\n },\n\n route(opts: RouteOptions) {\n return decorateProcedure({\n zz$p: {\n ...procedure.zz$p,\n contract: DecoratedContractProcedure.decorate(\n procedure.zz$p.contract,\n ).route(opts),\n },\n })\n },\n\n use(\n middleware: Middleware<any, any, any, any>,\n mapInput?: MapInputMiddleware<any, any>,\n ) {\n const middleware_ = mapInput\n ? decorateMiddleware(middleware).mapInput(mapInput)\n : middleware\n\n return decorateProcedure({\n zz$p: {\n ...procedure.zz$p,\n middlewares: [middleware_, ...(procedure.zz$p.middlewares ?? [])],\n },\n })\n },\n }) as any\n}\n\nexport type WELL_DEFINED_PROCEDURE = Procedure<\n Context,\n Context,\n Schema,\n Schema,\n unknown\n>\n\nexport function isProcedure(item: unknown): item is WELL_DEFINED_PROCEDURE {\n if (item instanceof Procedure)\n return true\n\n return (\n (typeof item === 'object' || typeof item === 'function')\n && item !== null\n && 'zz$p' in item\n && typeof item.zz$p === 'object'\n && item.zz$p !== null\n && 'contract' in item.zz$p\n && isContractProcedure(item.zz$p.contract)\n && 'func' in item.zz$p\n && typeof item.zz$p.func === 'function'\n )\n}\n"],"mappings":";AAEO,SAAS,aACd,GACA,GACoB;AACpB,MAAI,CAAC;AACH,WAAO;AACT,MAAI,CAAC;AACH,WAAO;AAET,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;;;ACmEA,IAAM,4BAA4B,OAAO,8BAAuB;AAEzD,SAAS,mBAMd,YAC+D;AAC/D,MAAI,QAAQ,IAAI,YAAY,yBAAyB,GAAG;AACtD,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,CACb,kBACAA,cACmC;AACnC,UAAM,oBAAoBA,YACtB,mBAAmB,gBAAgB,EAAE,SAASA,SAAQ,IACtD;AAEJ,WAAO,mBAAmB,OAAO,OAAO,SAAS,SAAS,SAAS;AACjE,YAAM,SAAS;AACf,YAAM,WAAW;AACjB,YAAM,QAAQ;AAEd,YAAM,OAAoC,OAAO,YAAY;AAC3D,eAAO,kBAAkB,QAAQ,aAAa,UAAU,QAAQ,OAAO,GAAG,OAAO,GAAG,IAAI;AAAA,MAC1F;AAEA,YAAM,KAAK,MAAM,WAAW,QAAQ,UAAU;AAAA,QAC5C,GAAG;AAAA,QACH;AAAA,MACF,GAAG,GAAG,IAAI;AAEV,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,CACf,QACkE;AACl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ACjB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IAEA,MAAM,MAAoB;AACxB,aAAO,kBAAkB;AAAA,QACvB,MAAM;AAAA,UACJ,GAAG,UAAU;AAAA,UACb,UAAU,2BAA2B;AAAA,YACnC,UAAU,KAAK;AAAA,UACjB,EAAE,MAAM,IAAI;AAAA,QACd;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IAEA,IACE,YACA,UACA;AACA,YAAM,cAAc,WAChB,mBAAmB,UAAU,EAAE,SAAS,QAAQ,IAChD;AAEJ,aAAO,kBAAkB;AAAA,QACvB,MAAM;AAAA,UACJ,GAAG,UAAU;AAAA,UACb,aAAa,CAAC,aAAa,GAAI,UAAU,KAAK,eAAe,CAAC,CAAE;AAAA,QAClE;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;AAUO,SAAS,YAAY,MAA+C;AACzE,MAAI,gBAAgB;AAClB,WAAO;AAET,UACG,OAAO,SAAS,YAAY,OAAO,SAAS,eAC1C,SAAS,QACT,UAAU,QACV,OAAO,KAAK,SAAS,YACrB,KAAK,SAAS,QACd,cAAc,KAAK,QACnB,oBAAoB,KAAK,KAAK,QAAQ,KACtC,UAAU,KAAK,QACf,OAAO,KAAK,KAAK,SAAS;AAEjC;","names":["mapInput","output"]}
|
package/dist/fetch.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/adapters/fetch.ts","../../../node_modules/.pnpm/hono@4.6.6/node_modules/hono/dist/router.js","../../../node_modules/.pnpm/hono@4.6.6/node_modules/hono/dist/utils/url.js","../../../node_modules/.pnpm/hono@4.6.6/node_modules/hono/dist/router/linear-router/router.js","../../../node_modules/.pnpm/hono@4.6.6/node_modules/hono/dist/router/reg-exp-router/node.js","../../../node_modules/.pnpm/hono@4.6.6/node_modules/hono/dist/router/reg-exp-router/trie.js","../../../node_modules/.pnpm/hono@4.6.6/node_modules/hono/dist/router/reg-exp-router/router.js"],"sourcesContent":["/// <reference lib=\"dom\" />\n\nimport type {\n PartialOnUndefinedDeep,\n Promisable,\n Value,\n} from '@orpc/shared'\nimport type { Router } from '../router'\nimport {\n type HTTPPath,\n ORPC_HEADER,\n ORPC_HEADER_VALUE,\n standardizeHTTPPath,\n} from '@orpc/contract'\nimport {\n get,\n isPlainObject,\n mapValues,\n trim,\n value,\n} from '@orpc/shared'\nimport { ORPCError } from '@orpc/shared/error'\nimport {\n OpenAPIDeserializer,\n OpenAPISerializer,\n ORPCDeserializer,\n ORPCSerializer,\n zodCoerce,\n} from '@orpc/transformer'\nimport { LinearRouter } from 'hono/router/linear-router'\nimport { RegExpRouter } from 'hono/router/reg-exp-router'\nimport { isProcedure, type WELL_DEFINED_PROCEDURE } from '../procedure'\nimport { createProcedureCaller } from '../procedure-caller'\n\nexport interface FetchHandlerHooks {\n next: () => Promise<Response>\n response: (response: Response) => Response\n}\n\nexport interface CreateFetchHandlerOptions<TRouter extends Router<any>> {\n router: TRouter\n\n /**\n * Hooks for executing logics on lifecycle events.\n */\n hooks?: (\n context: TRouter extends Router<infer UContext> ? UContext : never,\n hooks: FetchHandlerHooks,\n ) => Promisable<Response>\n\n /**\n * It will help improve the cold start time. But it will increase the performance.\n *\n * @default false\n */\n serverless?: boolean\n}\n\nexport function createFetchHandler<TRouter extends Router<any>>(\n options: CreateFetchHandlerOptions<TRouter>,\n): FetchHandler<TRouter> {\n const routing = options.serverless\n ? new LinearRouter<[string[], WELL_DEFINED_PROCEDURE]>()\n : new RegExpRouter<[string[], WELL_DEFINED_PROCEDURE]>()\n\n const addRouteRecursively = (router: Router<any>, basePath: string[]) => {\n for (const key in router) {\n const currentPath = [...basePath, key]\n const item = router[key] as WELL_DEFINED_PROCEDURE | Router<any>\n\n if (isProcedure(item)) {\n if (item.zz$p.contract.zz$cp.path) {\n const method = item.zz$p.contract.zz$cp.method ?? 'POST'\n const path = openAPIPathToRouterPath(item.zz$p.contract.zz$cp.path)\n\n routing.add(method, path, [currentPath, item])\n }\n }\n else {\n addRouteRecursively(item, currentPath)\n }\n }\n }\n\n addRouteRecursively(options.router, [])\n\n return async (requestOptions) => {\n const isORPCTransformer\n = requestOptions.request.headers.get(ORPC_HEADER) === ORPC_HEADER_VALUE\n const accept = requestOptions.request.headers.get('Accept') || undefined\n\n const serializer = isORPCTransformer\n ? new ORPCSerializer()\n : new OpenAPISerializer({ accept })\n\n const context = await value(requestOptions.context)\n\n const handler = async () => {\n const url = new URL(requestOptions.request.url)\n const pathname = `/${trim(url.pathname.replace(requestOptions.prefix ?? '', ''), '/')}`\n\n let path: string[] | undefined\n let procedure: WELL_DEFINED_PROCEDURE | undefined\n let params: Record<string, string> | undefined\n\n if (isORPCTransformer) {\n path = trim(pathname, '/').split('/').map(decodeURIComponent)\n const val = get(options.router, path)\n\n if (isProcedure(val)) {\n procedure = val\n }\n }\n else {\n const customMethod\n = requestOptions.request.method === 'POST'\n ? url.searchParams.get('method')?.toUpperCase()\n : undefined\n const method = customMethod || requestOptions.request.method\n\n const [matches, params_] = routing.match(method, pathname)\n\n const [match] = matches.sort((a, b) => {\n return Object.keys(a[1]).length - Object.keys(b[1]).length\n })\n\n if (match) {\n path = match[0][0]\n procedure = match[0][1]\n\n if (params_) {\n params = mapValues(\n (match as any)[1]!,\n v => params_[v as number]!,\n )\n }\n else {\n params = match[1] as Record<string, string>\n }\n }\n\n if (!path || !procedure) {\n path = trim(pathname, '/').split('/').map(decodeURIComponent)\n\n const val = get(options.router, path)\n\n if (isProcedure(val)) {\n procedure = val\n }\n }\n }\n\n if (!path || !procedure) {\n throw new ORPCError({ code: 'NOT_FOUND', message: 'Not found' })\n }\n\n const deserializer = isORPCTransformer\n ? new ORPCDeserializer()\n : new OpenAPIDeserializer({\n schema: procedure.zz$p.contract.zz$cp.InputSchema,\n })\n\n const input_ = await (async () => {\n try {\n return await deserializer.deserialize(requestOptions.request)\n }\n catch (e) {\n throw new ORPCError({\n code: 'BAD_REQUEST',\n message:\n 'Cannot parse request. Please check the request body and Content-Type header.',\n cause: e,\n })\n }\n })()\n\n const input = (() => {\n if (!params || Object.keys(params).length === 0) {\n return input_\n }\n\n const coercedParams = procedure.zz$p.contract.zz$cp.InputSchema\n ? (zodCoerce(\n procedure.zz$p.contract.zz$cp.InputSchema,\n { ...params },\n {\n bracketNotation: true,\n },\n ) as object)\n : params\n\n if (!isPlainObject(input_)) {\n return coercedParams\n }\n\n return {\n ...coercedParams,\n ...input_,\n }\n })()\n\n const caller = createProcedureCaller({\n context,\n procedure,\n path,\n })\n\n const output = await caller(input)\n\n const { body, headers } = serializer.serialize(output)\n\n return new Response(body, {\n status: 200,\n headers,\n })\n }\n\n try {\n return await options.hooks?.(context as any, {\n next: handler,\n response: response => response,\n }) ?? await handler()\n }\n catch (e) {\n const error = toORPCError(e)\n\n try {\n const { body, headers } = serializer.serialize(error.toJSON())\n\n return new Response(body, {\n status: error.status,\n headers,\n })\n }\n catch (e) {\n const error = toORPCError(e)\n\n // fallback to OpenAPI serializer (without accept) when expected serializer has failed\n const { body, headers } = new OpenAPISerializer().serialize(\n error.toJSON(),\n )\n\n return new Response(body, {\n status: error.status,\n headers,\n })\n }\n }\n }\n}\n\nfunction openAPIPathToRouterPath(path: HTTPPath): string {\n return standardizeHTTPPath(path).replace(/\\{([^}]+)\\}/g, ':$1')\n}\n\nexport type FetchHandlerOptions<TRouter extends Router<any>> = {\n /**\n * The request need to be handled.\n */\n request: Request\n\n /**\n * Remove the prefix from the request path.\n *\n * @example /orpc\n * @example /api\n */\n prefix?: string\n} & PartialOnUndefinedDeep<{\n /**\n * The context used to handle the request.\n */\n context: Value<\n TRouter extends Router<infer UContext> ? UContext : never\n >\n}>\n\nexport interface FetchHandler<TRouter extends Router<any>> {\n (options: FetchHandlerOptions<TRouter>): Promise<Response>\n}\n\nfunction toORPCError(e: unknown): ORPCError<any, any> {\n return e instanceof ORPCError\n ? e\n : new ORPCError({\n code: 'INTERNAL_SERVER_ERROR',\n message: 'Internal server error',\n cause: e,\n })\n}\n","// src/router.ts\nvar METHOD_NAME_ALL = \"ALL\";\nvar METHOD_NAME_ALL_LOWERCASE = \"all\";\nvar METHODS = [\"get\", \"post\", \"put\", \"delete\", \"options\", \"patch\"];\nvar MESSAGE_MATCHER_IS_ALREADY_BUILT = \"Can not add a route since the matcher is already built.\";\nvar UnsupportedPathError = class extends Error {\n};\nexport {\n MESSAGE_MATCHER_IS_ALREADY_BUILT,\n METHODS,\n METHOD_NAME_ALL,\n METHOD_NAME_ALL_LOWERCASE,\n UnsupportedPathError\n};\n","// src/utils/url.ts\nvar splitPath = (path) => {\n const paths = path.split(\"/\");\n if (paths[0] === \"\") {\n paths.shift();\n }\n return paths;\n};\nvar splitRoutingPath = (routePath) => {\n const { groups, path } = extractGroupsFromPath(routePath);\n const paths = splitPath(path);\n return replaceGroupMarks(paths, groups);\n};\nvar extractGroupsFromPath = (path) => {\n const groups = [];\n path = path.replace(/\\{[^}]+\\}/g, (match, index) => {\n const mark = `@${index}`;\n groups.push([mark, match]);\n return mark;\n });\n return { groups, path };\n};\nvar replaceGroupMarks = (paths, groups) => {\n for (let i = groups.length - 1; i >= 0; i--) {\n const [mark] = groups[i];\n for (let j = paths.length - 1; j >= 0; j--) {\n if (paths[j].includes(mark)) {\n paths[j] = paths[j].replace(mark, groups[i][1]);\n break;\n }\n }\n }\n return paths;\n};\nvar patternCache = {};\nvar getPattern = (label) => {\n if (label === \"*\") {\n return \"*\";\n }\n const match = label.match(/^\\:([^\\{\\}]+)(?:\\{(.+)\\})?$/);\n if (match) {\n if (!patternCache[label]) {\n if (match[2]) {\n patternCache[label] = [label, match[1], new RegExp(\"^\" + match[2] + \"$\")];\n } else {\n patternCache[label] = [label, match[1], true];\n }\n }\n return patternCache[label];\n }\n return null;\n};\nvar tryDecodeURI = (str) => {\n try {\n return decodeURI(str);\n } catch {\n return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match) => {\n try {\n return decodeURI(match);\n } catch {\n return match;\n }\n });\n }\n};\nvar getPath = (request) => {\n const url = request.url;\n const start = url.indexOf(\"/\", 8);\n let i = start;\n for (; i < url.length; i++) {\n const charCode = url.charCodeAt(i);\n if (charCode === 37) {\n const queryIndex = url.indexOf(\"?\", i);\n const path = url.slice(start, queryIndex === -1 ? void 0 : queryIndex);\n return tryDecodeURI(path.includes(\"%25\") ? path.replace(/%25/g, \"%2525\") : path);\n } else if (charCode === 63) {\n break;\n }\n }\n return url.slice(start, i);\n};\nvar getQueryStrings = (url) => {\n const queryIndex = url.indexOf(\"?\", 8);\n return queryIndex === -1 ? \"\" : \"?\" + url.slice(queryIndex + 1);\n};\nvar getPathNoStrict = (request) => {\n const result = getPath(request);\n return result.length > 1 && result[result.length - 1] === \"/\" ? result.slice(0, -1) : result;\n};\nvar mergePath = (...paths) => {\n let p = \"\";\n let endsWithSlash = false;\n for (let path of paths) {\n if (p[p.length - 1] === \"/\") {\n p = p.slice(0, -1);\n endsWithSlash = true;\n }\n if (path[0] !== \"/\") {\n path = `/${path}`;\n }\n if (path === \"/\" && endsWithSlash) {\n p = `${p}/`;\n } else if (path !== \"/\") {\n p = `${p}${path}`;\n }\n if (path === \"/\" && p === \"\") {\n p = \"/\";\n }\n }\n return p;\n};\nvar checkOptionalParameter = (path) => {\n if (!path.match(/\\:.+\\?$/)) {\n return null;\n }\n const segments = path.split(\"/\");\n const results = [];\n let basePath = \"\";\n segments.forEach((segment) => {\n if (segment !== \"\" && !/\\:/.test(segment)) {\n basePath += \"/\" + segment;\n } else if (/\\:/.test(segment)) {\n if (/\\?/.test(segment)) {\n if (results.length === 0 && basePath === \"\") {\n results.push(\"/\");\n } else {\n results.push(basePath);\n }\n const optionalSegment = segment.replace(\"?\", \"\");\n basePath += \"/\" + optionalSegment;\n results.push(basePath);\n } else {\n basePath += \"/\" + segment;\n }\n }\n });\n return results.filter((v, i, a) => a.indexOf(v) === i);\n};\nvar _decodeURI = (value) => {\n if (!/[%+]/.test(value)) {\n return value;\n }\n if (value.indexOf(\"+\") !== -1) {\n value = value.replace(/\\+/g, \" \");\n }\n return /%/.test(value) ? decodeURIComponent_(value) : value;\n};\nvar _getQueryParam = (url, key, multiple) => {\n let encoded;\n if (!multiple && key && !/[%+]/.test(key)) {\n let keyIndex2 = url.indexOf(`?${key}`, 8);\n if (keyIndex2 === -1) {\n keyIndex2 = url.indexOf(`&${key}`, 8);\n }\n while (keyIndex2 !== -1) {\n const trailingKeyCode = url.charCodeAt(keyIndex2 + key.length + 1);\n if (trailingKeyCode === 61) {\n const valueIndex = keyIndex2 + key.length + 2;\n const endIndex = url.indexOf(\"&\", valueIndex);\n return _decodeURI(url.slice(valueIndex, endIndex === -1 ? void 0 : endIndex));\n } else if (trailingKeyCode == 38 || isNaN(trailingKeyCode)) {\n return \"\";\n }\n keyIndex2 = url.indexOf(`&${key}`, keyIndex2 + 1);\n }\n encoded = /[%+]/.test(url);\n if (!encoded) {\n return void 0;\n }\n }\n const results = {};\n encoded ??= /[%+]/.test(url);\n let keyIndex = url.indexOf(\"?\", 8);\n while (keyIndex !== -1) {\n const nextKeyIndex = url.indexOf(\"&\", keyIndex + 1);\n let valueIndex = url.indexOf(\"=\", keyIndex);\n if (valueIndex > nextKeyIndex && nextKeyIndex !== -1) {\n valueIndex = -1;\n }\n let name = url.slice(\n keyIndex + 1,\n valueIndex === -1 ? nextKeyIndex === -1 ? void 0 : nextKeyIndex : valueIndex\n );\n if (encoded) {\n name = _decodeURI(name);\n }\n keyIndex = nextKeyIndex;\n if (name === \"\") {\n continue;\n }\n let value;\n if (valueIndex === -1) {\n value = \"\";\n } else {\n value = url.slice(valueIndex + 1, nextKeyIndex === -1 ? void 0 : nextKeyIndex);\n if (encoded) {\n value = _decodeURI(value);\n }\n }\n if (multiple) {\n if (!(results[name] && Array.isArray(results[name]))) {\n results[name] = [];\n }\n ;\n results[name].push(value);\n } else {\n results[name] ??= value;\n }\n }\n return key ? results[key] : results;\n};\nvar getQueryParam = _getQueryParam;\nvar getQueryParams = (url, key) => {\n return _getQueryParam(url, key, true);\n};\nvar decodeURIComponent_ = decodeURIComponent;\nexport {\n checkOptionalParameter,\n decodeURIComponent_,\n getPath,\n getPathNoStrict,\n getPattern,\n getQueryParam,\n getQueryParams,\n getQueryStrings,\n mergePath,\n splitPath,\n splitRoutingPath\n};\n","// src/router/linear-router/router.ts\nimport { METHOD_NAME_ALL, UnsupportedPathError } from \"../../router.js\";\nimport { checkOptionalParameter } from \"../../utils/url.js\";\nvar emptyParams = /* @__PURE__ */ Object.create(null);\nvar splitPathRe = /\\/(:\\w+(?:{(?:(?:{[\\d,]+})|[^}])+})?)|\\/[^\\/\\?]+|(\\?)/g;\nvar splitByStarRe = /\\*/;\nvar LinearRouter = class {\n name = \"LinearRouter\";\n routes = [];\n add(method, path, handler) {\n ;\n (checkOptionalParameter(path) || [path]).forEach((p) => {\n this.routes.push([method, p, handler]);\n });\n }\n match(method, path) {\n const handlers = [];\n ROUTES_LOOP:\n for (let i = 0, len = this.routes.length; i < len; i++) {\n const [routeMethod, routePath, handler] = this.routes[i];\n if (routeMethod !== method && routeMethod !== METHOD_NAME_ALL) {\n continue;\n }\n if (routePath === \"*\" || routePath === \"/*\") {\n handlers.push([handler, emptyParams]);\n continue;\n }\n const hasStar = routePath.indexOf(\"*\") !== -1;\n const hasLabel = routePath.indexOf(\":\") !== -1;\n if (!hasStar && !hasLabel) {\n if (routePath === path || routePath + \"/\" === path) {\n handlers.push([handler, emptyParams]);\n }\n } else if (hasStar && !hasLabel) {\n const endsWithStar = routePath.charCodeAt(routePath.length - 1) === 42;\n const parts = (endsWithStar ? routePath.slice(0, -2) : routePath).split(splitByStarRe);\n const lastIndex = parts.length - 1;\n for (let j = 0, pos = 0, len2 = parts.length; j < len2; j++) {\n const part = parts[j];\n const index = path.indexOf(part, pos);\n if (index !== pos) {\n continue ROUTES_LOOP;\n }\n pos += part.length;\n if (j === lastIndex) {\n if (!endsWithStar && pos !== path.length && !(pos === path.length - 1 && path.charCodeAt(pos) === 47)) {\n continue ROUTES_LOOP;\n }\n } else {\n const index2 = path.indexOf(\"/\", pos);\n if (index2 === -1) {\n continue ROUTES_LOOP;\n }\n pos = index2;\n }\n }\n handlers.push([handler, emptyParams]);\n } else if (hasLabel && !hasStar) {\n const params = /* @__PURE__ */ Object.create(null);\n const parts = routePath.match(splitPathRe);\n const lastIndex = parts.length - 1;\n for (let j = 0, pos = 0, len2 = parts.length; j < len2; j++) {\n if (pos === -1 || pos >= path.length) {\n continue ROUTES_LOOP;\n }\n const part = parts[j];\n if (part.charCodeAt(1) === 58) {\n let name = part.slice(2);\n let value;\n if (name.charCodeAt(name.length - 1) === 125) {\n const openBracePos = name.indexOf(\"{\");\n const pattern = name.slice(openBracePos + 1, -1);\n const restPath = path.slice(pos + 1);\n const match = new RegExp(pattern, \"d\").exec(restPath);\n if (!match || match.indices[0][0] !== 0 || match.indices[0][1] === 0) {\n continue ROUTES_LOOP;\n }\n name = name.slice(0, openBracePos);\n value = restPath.slice(...match.indices[0]);\n pos += match.indices[0][1] + 1;\n } else {\n let endValuePos = path.indexOf(\"/\", pos + 1);\n if (endValuePos === -1) {\n if (pos + 1 === path.length) {\n continue ROUTES_LOOP;\n }\n endValuePos = path.length;\n }\n value = path.slice(pos + 1, endValuePos);\n pos = endValuePos;\n }\n params[name] ||= value;\n } else {\n const index = path.indexOf(part, pos);\n if (index !== pos) {\n continue ROUTES_LOOP;\n }\n pos += part.length;\n }\n if (j === lastIndex) {\n if (pos !== path.length && !(pos === path.length - 1 && path.charCodeAt(pos) === 47)) {\n continue ROUTES_LOOP;\n }\n }\n }\n handlers.push([handler, params]);\n } else if (hasLabel && hasStar) {\n throw new UnsupportedPathError();\n }\n }\n return [handlers];\n }\n};\nexport {\n LinearRouter\n};\n","// src/router/reg-exp-router/node.ts\nvar LABEL_REG_EXP_STR = \"[^/]+\";\nvar ONLY_WILDCARD_REG_EXP_STR = \".*\";\nvar TAIL_WILDCARD_REG_EXP_STR = \"(?:|/.*)\";\nvar PATH_ERROR = Symbol();\nvar regExpMetaChars = new Set(\".\\\\+*[^]$()\");\nfunction compareKey(a, b) {\n if (a.length === 1) {\n return b.length === 1 ? a < b ? -1 : 1 : -1;\n }\n if (b.length === 1) {\n return 1;\n }\n if (a === ONLY_WILDCARD_REG_EXP_STR || a === TAIL_WILDCARD_REG_EXP_STR) {\n return 1;\n } else if (b === ONLY_WILDCARD_REG_EXP_STR || b === TAIL_WILDCARD_REG_EXP_STR) {\n return -1;\n }\n if (a === LABEL_REG_EXP_STR) {\n return 1;\n } else if (b === LABEL_REG_EXP_STR) {\n return -1;\n }\n return a.length === b.length ? a < b ? -1 : 1 : b.length - a.length;\n}\nvar Node = class {\n index;\n varIndex;\n children = /* @__PURE__ */ Object.create(null);\n insert(tokens, index, paramMap, context, pathErrorCheckOnly) {\n if (tokens.length === 0) {\n if (this.index !== void 0) {\n throw PATH_ERROR;\n }\n if (pathErrorCheckOnly) {\n return;\n }\n this.index = index;\n return;\n }\n const [token, ...restTokens] = tokens;\n const pattern = token === \"*\" ? restTokens.length === 0 ? [\"\", \"\", ONLY_WILDCARD_REG_EXP_STR] : [\"\", \"\", LABEL_REG_EXP_STR] : token === \"/*\" ? [\"\", \"\", TAIL_WILDCARD_REG_EXP_STR] : token.match(/^\\:([^\\{\\}]+)(?:\\{(.+)\\})?$/);\n let node;\n if (pattern) {\n const name = pattern[1];\n let regexpStr = pattern[2] || LABEL_REG_EXP_STR;\n if (name && pattern[2]) {\n regexpStr = regexpStr.replace(/^\\((?!\\?:)(?=[^)]+\\)$)/, \"(?:\");\n if (/\\((?!\\?:)/.test(regexpStr)) {\n throw PATH_ERROR;\n }\n }\n node = this.children[regexpStr];\n if (!node) {\n if (Object.keys(this.children).some(\n (k) => k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR\n )) {\n throw PATH_ERROR;\n }\n if (pathErrorCheckOnly) {\n return;\n }\n node = this.children[regexpStr] = new Node();\n if (name !== \"\") {\n node.varIndex = context.varIndex++;\n }\n }\n if (!pathErrorCheckOnly && name !== \"\") {\n paramMap.push([name, node.varIndex]);\n }\n } else {\n node = this.children[token];\n if (!node) {\n if (Object.keys(this.children).some(\n (k) => k.length > 1 && k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR\n )) {\n throw PATH_ERROR;\n }\n if (pathErrorCheckOnly) {\n return;\n }\n node = this.children[token] = new Node();\n }\n }\n node.insert(restTokens, index, paramMap, context, pathErrorCheckOnly);\n }\n buildRegExpStr() {\n const childKeys = Object.keys(this.children).sort(compareKey);\n const strList = childKeys.map((k) => {\n const c = this.children[k];\n return (typeof c.varIndex === \"number\" ? `(${k})@${c.varIndex}` : regExpMetaChars.has(k) ? `\\\\${k}` : k) + c.buildRegExpStr();\n });\n if (typeof this.index === \"number\") {\n strList.unshift(`#${this.index}`);\n }\n if (strList.length === 0) {\n return \"\";\n }\n if (strList.length === 1) {\n return strList[0];\n }\n return \"(?:\" + strList.join(\"|\") + \")\";\n }\n};\nexport {\n Node,\n PATH_ERROR\n};\n","// src/router/reg-exp-router/trie.ts\nimport { Node } from \"./node.js\";\nvar Trie = class {\n context = { varIndex: 0 };\n root = new Node();\n insert(path, index, pathErrorCheckOnly) {\n const paramAssoc = [];\n const groups = [];\n for (let i = 0; ; ) {\n let replaced = false;\n path = path.replace(/\\{[^}]+\\}/g, (m) => {\n const mark = `@\\\\${i}`;\n groups[i] = [mark, m];\n i++;\n replaced = true;\n return mark;\n });\n if (!replaced) {\n break;\n }\n }\n const tokens = path.match(/(?::[^\\/]+)|(?:\\/\\*$)|./g) || [];\n for (let i = groups.length - 1; i >= 0; i--) {\n const [mark] = groups[i];\n for (let j = tokens.length - 1; j >= 0; j--) {\n if (tokens[j].indexOf(mark) !== -1) {\n tokens[j] = tokens[j].replace(mark, groups[i][1]);\n break;\n }\n }\n }\n this.root.insert(tokens, index, paramAssoc, this.context, pathErrorCheckOnly);\n return paramAssoc;\n }\n buildRegExp() {\n let regexp = this.root.buildRegExpStr();\n if (regexp === \"\") {\n return [/^$/, [], []];\n }\n let captureIndex = 0;\n const indexReplacementMap = [];\n const paramReplacementMap = [];\n regexp = regexp.replace(/#(\\d+)|@(\\d+)|\\.\\*\\$/g, (_, handlerIndex, paramIndex) => {\n if (typeof handlerIndex !== \"undefined\") {\n indexReplacementMap[++captureIndex] = Number(handlerIndex);\n return \"$()\";\n }\n if (typeof paramIndex !== \"undefined\") {\n paramReplacementMap[Number(paramIndex)] = ++captureIndex;\n return \"\";\n }\n return \"\";\n });\n return [new RegExp(`^${regexp}`), indexReplacementMap, paramReplacementMap];\n }\n};\nexport {\n Trie\n};\n","// src/router/reg-exp-router/router.ts\nimport {\n MESSAGE_MATCHER_IS_ALREADY_BUILT,\n METHOD_NAME_ALL,\n UnsupportedPathError\n} from \"../../router.js\";\nimport { checkOptionalParameter } from \"../../utils/url.js\";\nimport { PATH_ERROR } from \"./node.js\";\nimport { Trie } from \"./trie.js\";\nvar emptyParam = [];\nvar nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];\nvar wildcardRegExpCache = /* @__PURE__ */ Object.create(null);\nfunction buildWildcardRegExp(path) {\n return wildcardRegExpCache[path] ??= new RegExp(\n path === \"*\" ? \"\" : `^${path.replace(\n /\\/\\*$|([.\\\\+*[^\\]$()])/g,\n (_, metaChar) => metaChar ? `\\\\${metaChar}` : \"(?:|/.*)\"\n )}$`\n );\n}\nfunction clearWildcardRegExpCache() {\n wildcardRegExpCache = /* @__PURE__ */ Object.create(null);\n}\nfunction buildMatcherFromPreprocessedRoutes(routes) {\n const trie = new Trie();\n const handlerData = [];\n if (routes.length === 0) {\n return nullMatcher;\n }\n const routesWithStaticPathFlag = routes.map(\n (route) => [!/\\*|\\/:/.test(route[0]), ...route]\n ).sort(\n ([isStaticA, pathA], [isStaticB, pathB]) => isStaticA ? 1 : isStaticB ? -1 : pathA.length - pathB.length\n );\n const staticMap = /* @__PURE__ */ Object.create(null);\n for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {\n const [pathErrorCheckOnly, path, handlers] = routesWithStaticPathFlag[i];\n if (pathErrorCheckOnly) {\n staticMap[path] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];\n } else {\n j++;\n }\n let paramAssoc;\n try {\n paramAssoc = trie.insert(path, j, pathErrorCheckOnly);\n } catch (e) {\n throw e === PATH_ERROR ? new UnsupportedPathError(path) : e;\n }\n if (pathErrorCheckOnly) {\n continue;\n }\n handlerData[j] = handlers.map(([h, paramCount]) => {\n const paramIndexMap = /* @__PURE__ */ Object.create(null);\n paramCount -= 1;\n for (; paramCount >= 0; paramCount--) {\n const [key, value] = paramAssoc[paramCount];\n paramIndexMap[key] = value;\n }\n return [h, paramIndexMap];\n });\n }\n const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();\n for (let i = 0, len = handlerData.length; i < len; i++) {\n for (let j = 0, len2 = handlerData[i].length; j < len2; j++) {\n const map = handlerData[i][j]?.[1];\n if (!map) {\n continue;\n }\n const keys = Object.keys(map);\n for (let k = 0, len3 = keys.length; k < len3; k++) {\n map[keys[k]] = paramReplacementMap[map[keys[k]]];\n }\n }\n }\n const handlerMap = [];\n for (const i in indexReplacementMap) {\n handlerMap[i] = handlerData[indexReplacementMap[i]];\n }\n return [regexp, handlerMap, staticMap];\n}\nfunction findMiddleware(middleware, path) {\n if (!middleware) {\n return void 0;\n }\n for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {\n if (buildWildcardRegExp(k).test(path)) {\n return [...middleware[k]];\n }\n }\n return void 0;\n}\nvar RegExpRouter = class {\n name = \"RegExpRouter\";\n middleware;\n routes;\n constructor() {\n this.middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };\n this.routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };\n }\n add(method, path, handler) {\n const { middleware, routes } = this;\n if (!middleware || !routes) {\n throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);\n }\n if (!middleware[method]) {\n ;\n [middleware, routes].forEach((handlerMap) => {\n handlerMap[method] = /* @__PURE__ */ Object.create(null);\n Object.keys(handlerMap[METHOD_NAME_ALL]).forEach((p) => {\n handlerMap[method][p] = [...handlerMap[METHOD_NAME_ALL][p]];\n });\n });\n }\n if (path === \"/*\") {\n path = \"*\";\n }\n const paramCount = (path.match(/\\/:/g) || []).length;\n if (/\\*$/.test(path)) {\n const re = buildWildcardRegExp(path);\n if (method === METHOD_NAME_ALL) {\n Object.keys(middleware).forEach((m) => {\n middleware[m][path] ||= findMiddleware(middleware[m], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];\n });\n } else {\n middleware[method][path] ||= findMiddleware(middleware[method], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];\n }\n Object.keys(middleware).forEach((m) => {\n if (method === METHOD_NAME_ALL || method === m) {\n Object.keys(middleware[m]).forEach((p) => {\n re.test(p) && middleware[m][p].push([handler, paramCount]);\n });\n }\n });\n Object.keys(routes).forEach((m) => {\n if (method === METHOD_NAME_ALL || method === m) {\n Object.keys(routes[m]).forEach(\n (p) => re.test(p) && routes[m][p].push([handler, paramCount])\n );\n }\n });\n return;\n }\n const paths = checkOptionalParameter(path) || [path];\n for (let i = 0, len = paths.length; i < len; i++) {\n const path2 = paths[i];\n Object.keys(routes).forEach((m) => {\n if (method === METHOD_NAME_ALL || method === m) {\n routes[m][path2] ||= [\n ...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []\n ];\n routes[m][path2].push([handler, paramCount - len + i + 1]);\n }\n });\n }\n }\n match(method, path) {\n clearWildcardRegExpCache();\n const matchers = this.buildAllMatchers();\n this.match = (method2, path2) => {\n const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];\n const staticMatch = matcher[2][path2];\n if (staticMatch) {\n return staticMatch;\n }\n const match = path2.match(matcher[0]);\n if (!match) {\n return [[], emptyParam];\n }\n const index = match.indexOf(\"\", 1);\n return [matcher[1][index], match];\n };\n return this.match(method, path);\n }\n buildAllMatchers() {\n const matchers = /* @__PURE__ */ Object.create(null);\n [...Object.keys(this.routes), ...Object.keys(this.middleware)].forEach((method) => {\n matchers[method] ||= this.buildMatcher(method);\n });\n this.middleware = this.routes = void 0;\n return matchers;\n }\n buildMatcher(method) {\n const routes = [];\n let hasOwnRoute = method === METHOD_NAME_ALL;\n [this.middleware, this.routes].forEach((r) => {\n const ownRoute = r[method] ? Object.keys(r[method]).map((path) => [path, r[method][path]]) : [];\n if (ownRoute.length !== 0) {\n hasOwnRoute ||= true;\n routes.push(...ownRoute);\n } else if (method !== METHOD_NAME_ALL) {\n routes.push(\n ...Object.keys(r[METHOD_NAME_ALL]).map((path) => [path, r[METHOD_NAME_ALL][path]])\n );\n }\n });\n if (!hasOwnRoute) {\n return null;\n } else {\n return buildMatcherFromPreprocessedRoutes(routes);\n }\n }\n};\nexport {\n RegExpRouter\n};\n"],"mappings":";;;;;;AAQA;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;AC3BP,IAAI,kBAAkB;AAGtB,IAAI,mCAAmC;AACvC,IAAI,uBAAuB,cAAc,MAAM;AAC/C;;;ACyGA,IAAI,yBAAyB,CAAC,SAAS;AACrC,MAAI,CAAC,KAAK,MAAM,SAAS,GAAG;AAC1B,WAAO;AAAA,EACT;AACA,QAAM,WAAW,KAAK,MAAM,GAAG;AAC/B,QAAM,UAAU,CAAC;AACjB,MAAI,WAAW;AACf,WAAS,QAAQ,CAAC,YAAY;AAC5B,QAAI,YAAY,MAAM,CAAC,KAAK,KAAK,OAAO,GAAG;AACzC,kBAAY,MAAM;AAAA,IACpB,WAAW,KAAK,KAAK,OAAO,GAAG;AAC7B,UAAI,KAAK,KAAK,OAAO,GAAG;AACtB,YAAI,QAAQ,WAA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