@temporary-name/server 1.9.3-alpha.4275e976ddda4d8be107c2cfde9899bdea9a337d → 1.9.3-alpha.4c6c68e5af7355d5a6dff1179055586e1093ac2d
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/adapters/aws-lambda/index.d.mts +12 -8
- package/dist/adapters/aws-lambda/index.d.ts +12 -8
- package/dist/adapters/aws-lambda/index.mjs +12 -4
- package/dist/adapters/fetch/index.d.mts +15 -87
- package/dist/adapters/fetch/index.d.ts +15 -87
- package/dist/adapters/fetch/index.mjs +23 -161
- package/dist/adapters/node/index.d.mts +15 -64
- package/dist/adapters/node/index.d.ts +15 -64
- package/dist/adapters/node/index.mjs +21 -126
- package/dist/adapters/standard/index.d.mts +27 -14
- package/dist/adapters/standard/index.d.ts +27 -14
- package/dist/adapters/standard/index.mjs +9 -101
- package/dist/helpers/index.mjs +3 -29
- package/dist/index.d.mts +120 -583
- package/dist/index.d.ts +120 -583
- package/dist/index.mjs +213 -449
- package/dist/openapi/index.d.mts +204 -0
- package/dist/openapi/index.d.ts +204 -0
- package/dist/openapi/index.mjs +692 -0
- package/dist/shared/server.BbUmcWIW.d.mts +41 -0
- package/dist/shared/server.BfraJHay.d.mts +373 -0
- package/dist/shared/server.BfraJHay.d.ts +373 -0
- package/dist/shared/server.C1RJffw4.mjs +30 -0
- package/dist/shared/server.CHugaZ_Y.d.ts +41 -0
- package/dist/shared/server.CQIFwyhc.mjs +40 -0
- package/dist/shared/server.CYa9puL2.mjs +403 -0
- package/dist/shared/server.ChOv1yG3.mjs +319 -0
- package/dist/shared/server.Cza0RB3u.mjs +160 -0
- package/dist/shared/server.YUvuxHty.mjs +48 -0
- package/package.json +18 -30
- package/dist/plugins/index.d.mts +0 -160
- package/dist/plugins/index.d.ts +0 -160
- package/dist/plugins/index.mjs +0 -288
- package/dist/shared/server.BEQrAa3A.mjs +0 -207
- package/dist/shared/server.Bo94xDTv.d.mts +0 -73
- package/dist/shared/server.Btxrgkj5.d.ts +0 -73
- package/dist/shared/server.C1YnHvvf.d.mts +0 -192
- package/dist/shared/server.C1YnHvvf.d.ts +0 -192
- package/dist/shared/server.D6K9uoPI.mjs +0 -35
- package/dist/shared/server.DZ5BIITo.mjs +0 -9
- package/dist/shared/server.X0YaZxSJ.mjs +0 -13
|
@@ -1,77 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Interceptor, MaybeOptionalOptions } from '@temporary-name/shared';
|
|
1
|
+
import { MaybeOptionalOptions } from '@temporary-name/shared';
|
|
3
2
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@temporary-name/standard-server-node';
|
|
4
|
-
import {
|
|
5
|
-
import { FriendlyStandardHandleOptions } from '
|
|
6
|
-
import
|
|
7
|
-
import '@temporary-name/contract';
|
|
8
|
-
import '@temporary-name/standard-server';
|
|
9
|
-
|
|
10
|
-
interface NodeHttpHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
|
11
|
-
initRuntimeAdapter?(options: NodeHttpHandlerOptions<T>): void;
|
|
12
|
-
}
|
|
13
|
-
declare class CompositeNodeHttpHandlerPlugin<T extends Context, TPlugin extends NodeHttpHandlerPlugin<T>> extends CompositeStandardHandlerPlugin<T, TPlugin> implements NodeHttpHandlerPlugin<T> {
|
|
14
|
-
initRuntimeAdapter(options: NodeHttpHandlerOptions<T>): void;
|
|
15
|
-
}
|
|
3
|
+
import { C as Context, m as Router } from '../../shared/server.BfraJHay.js';
|
|
4
|
+
import { b as StandardHandlerOptions, F as FriendlyStandardHandleOptions } from '../../shared/server.CHugaZ_Y.js';
|
|
5
|
+
import '@temporary-name/zod';
|
|
16
6
|
|
|
17
7
|
type NodeHttpHandleResult = {
|
|
18
8
|
matched: true;
|
|
19
9
|
} | {
|
|
20
10
|
matched: false;
|
|
21
11
|
};
|
|
22
|
-
interface
|
|
23
|
-
request: NodeHttpRequest;
|
|
24
|
-
response: NodeHttpResponse;
|
|
25
|
-
sendStandardResponseOptions: SendStandardResponseOptions;
|
|
26
|
-
}
|
|
27
|
-
interface NodeHttpHandlerOptions<T extends Context> extends SendStandardResponseOptions {
|
|
28
|
-
adapterInterceptors?: Interceptor<NodeHttpHandlerInterceptorOptions<T>, Promise<NodeHttpHandleResult>>[];
|
|
29
|
-
plugins?: NodeHttpHandlerPlugin<T>[];
|
|
30
|
-
}
|
|
31
|
-
declare class NodeHttpHandler<T extends Context> implements NodeHttpHandler<T> {
|
|
32
|
-
private readonly standardHandler;
|
|
33
|
-
private readonly sendStandardResponseOptions;
|
|
34
|
-
private readonly adapterInterceptors;
|
|
35
|
-
constructor(standardHandler: StandardHandler<T>, options?: NoInfer<NodeHttpHandlerOptions<T>>);
|
|
36
|
-
handle(request: NodeHttpRequest, response: NodeHttpResponse, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<NodeHttpHandleResult>;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
interface BodyLimitPluginOptions {
|
|
40
|
-
/**
|
|
41
|
-
* The maximum size of the body in bytes.
|
|
42
|
-
*/
|
|
43
|
-
maxBodySize: number;
|
|
12
|
+
interface NodeHttpHandlerOptions<T extends Context> extends SendStandardResponseOptions, StandardHandlerOptions<T> {
|
|
44
13
|
}
|
|
45
14
|
/**
|
|
46
|
-
*
|
|
15
|
+
* OpenAPI Handler for Node Server
|
|
47
16
|
*
|
|
48
|
-
* @see {@link https://orpc.unnoq.com/docs/
|
|
17
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
18
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
49
19
|
*/
|
|
50
|
-
declare class
|
|
51
|
-
private readonly
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
interface CompressionPluginOptions extends compression.CompressionOptions {
|
|
57
|
-
/**
|
|
58
|
-
* Override the default content-type filter used to determine which responses should be compressed.
|
|
59
|
-
*
|
|
60
|
-
* @warning [Event Iterator](https://orpc.unnoq.com/docs/event-iterator) responses are never compressed, regardless of this filter's return value.
|
|
61
|
-
* @default only responses with compressible content types are compressed.
|
|
62
|
-
*/
|
|
63
|
-
filter?: (req: NodeHttpRequest, res: NodeHttpResponse) => boolean;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* The Compression Plugin adds response compression to the Node.js HTTP Server.
|
|
67
|
-
*
|
|
68
|
-
* @see {@link https://orpc.unnoq.com/docs/plugins/compression Compression Plugin Docs}
|
|
69
|
-
*/
|
|
70
|
-
declare class CompressionPlugin<T extends Context> implements NodeHttpHandlerPlugin<T> {
|
|
71
|
-
private readonly compressionHandler;
|
|
72
|
-
constructor(options?: CompressionPluginOptions);
|
|
73
|
-
initRuntimeAdapter(options: NodeHttpHandlerOptions<T>): void;
|
|
20
|
+
declare class NodeHttpHandler<T extends Context> implements NodeHttpHandler<T> {
|
|
21
|
+
private readonly sendStandardResponseOptions;
|
|
22
|
+
private readonly standardHandler;
|
|
23
|
+
constructor(router: Router<T>, options?: NoInfer<NodeHttpHandlerOptions<T>>);
|
|
24
|
+
handle(request: NodeHttpRequest, response: NodeHttpResponse, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<NodeHttpHandleResult>;
|
|
74
25
|
}
|
|
75
26
|
|
|
76
|
-
export {
|
|
77
|
-
export type {
|
|
27
|
+
export { NodeHttpHandler };
|
|
28
|
+
export type { NodeHttpHandleResult, NodeHttpHandlerOptions };
|
|
@@ -1,136 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import compression from '@temporary-name/interop/compression';
|
|
1
|
+
import { resolveMaybeOptionalOptions } from '@temporary-name/shared';
|
|
3
2
|
import { toStandardLazyRequest, sendStandardResponse } from '@temporary-name/standard-server-node';
|
|
4
|
-
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.
|
|
3
|
+
import { S as StandardHandler, r as resolveFriendlyStandardHandleOptions } from '../../shared/server.CYa9puL2.mjs';
|
|
5
4
|
import '@temporary-name/standard-server';
|
|
6
|
-
import '@temporary-name/
|
|
7
|
-
import '
|
|
8
|
-
import
|
|
9
|
-
import '
|
|
10
|
-
import '
|
|
11
|
-
import '
|
|
12
|
-
|
|
13
|
-
class BodyLimitPlugin {
|
|
14
|
-
maxBodySize;
|
|
15
|
-
constructor(options) {
|
|
16
|
-
this.maxBodySize = options.maxBodySize;
|
|
17
|
-
}
|
|
18
|
-
initRuntimeAdapter(options) {
|
|
19
|
-
options.adapterInterceptors ??= [];
|
|
20
|
-
options.adapterInterceptors.push(async (options2) => {
|
|
21
|
-
const checkHeader = once(() => {
|
|
22
|
-
if (Number(options2.request.headers["content-length"]) > this.maxBodySize) {
|
|
23
|
-
throw new ORPCError("PAYLOAD_TOO_LARGE");
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
const originalEmit = options2.request.emit;
|
|
27
|
-
let currentBodySize = 0;
|
|
28
|
-
options2.request.emit = (event, ...args) => {
|
|
29
|
-
if (event === "data") {
|
|
30
|
-
checkHeader();
|
|
31
|
-
currentBodySize += args[0].length;
|
|
32
|
-
if (currentBodySize > this.maxBodySize) {
|
|
33
|
-
throw new ORPCError("PAYLOAD_TOO_LARGE");
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return originalEmit.call(options2.request, event, ...args);
|
|
37
|
-
};
|
|
38
|
-
try {
|
|
39
|
-
return await options2.next(options2);
|
|
40
|
-
} finally {
|
|
41
|
-
options2.request.emit = originalEmit;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
class CompressionPlugin {
|
|
48
|
-
compressionHandler;
|
|
49
|
-
constructor(options = {}) {
|
|
50
|
-
this.compressionHandler = compression({
|
|
51
|
-
...options,
|
|
52
|
-
filter: (req, res) => {
|
|
53
|
-
const hasContentDisposition = res.hasHeader("content-disposition");
|
|
54
|
-
const contentType = res.getHeader("content-type")?.toString();
|
|
55
|
-
if (!hasContentDisposition && contentType?.startsWith("text/event-stream")) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
return options.filter ? options.filter(req, res) : compression.filter(req, res);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
initRuntimeAdapter(options) {
|
|
63
|
-
options.adapterInterceptors ??= [];
|
|
64
|
-
options.adapterInterceptors.unshift(async (options2) => {
|
|
65
|
-
let resolve;
|
|
66
|
-
let reject;
|
|
67
|
-
const promise = new Promise((res, rej) => {
|
|
68
|
-
resolve = res;
|
|
69
|
-
reject = rej;
|
|
70
|
-
});
|
|
71
|
-
const originalWrite = options2.response.write;
|
|
72
|
-
const originalEnd = options2.response.end;
|
|
73
|
-
const originalOn = options2.response.on;
|
|
74
|
-
this.compressionHandler(options2.request, options2.response, async (err) => {
|
|
75
|
-
if (err) {
|
|
76
|
-
reject(err);
|
|
77
|
-
} else {
|
|
78
|
-
try {
|
|
79
|
-
resolve(await options2.next());
|
|
80
|
-
} catch (error) {
|
|
81
|
-
reject(error);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
try {
|
|
86
|
-
return await promise;
|
|
87
|
-
} finally {
|
|
88
|
-
options2.response.write = originalWrite;
|
|
89
|
-
options2.response.end = originalEnd;
|
|
90
|
-
options2.response.on = originalOn;
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
class CompositeNodeHttpHandlerPlugin extends CompositeStandardHandlerPlugin {
|
|
97
|
-
initRuntimeAdapter(options) {
|
|
98
|
-
for (const plugin of this.plugins) {
|
|
99
|
-
plugin.initRuntimeAdapter?.(options);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
5
|
+
import '@temporary-name/server';
|
|
6
|
+
import 'rou3';
|
|
7
|
+
import '../../shared/server.Cza0RB3u.mjs';
|
|
8
|
+
import '@temporary-name/zod';
|
|
9
|
+
import '../../shared/server.ChOv1yG3.mjs';
|
|
10
|
+
import '../../shared/server.CQIFwyhc.mjs';
|
|
103
11
|
|
|
104
12
|
class NodeHttpHandler {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this.adapterInterceptors = toArray(options.adapterInterceptors);
|
|
13
|
+
sendStandardResponseOptions;
|
|
14
|
+
standardHandler;
|
|
15
|
+
constructor(router, options = {}) {
|
|
16
|
+
this.standardHandler = new StandardHandler(router, options);
|
|
110
17
|
this.sendStandardResponseOptions = options;
|
|
111
18
|
}
|
|
112
|
-
sendStandardResponseOptions;
|
|
113
|
-
adapterInterceptors;
|
|
114
19
|
async handle(request, response, ...rest) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
async ({ request: request2, response: response2, sendStandardResponseOptions, ...options }) => {
|
|
124
|
-
const standardRequest = toStandardLazyRequest(request2, response2);
|
|
125
|
-
const result = await this.standardHandler.handle(standardRequest, options);
|
|
126
|
-
if (!result.matched) {
|
|
127
|
-
return { matched: false };
|
|
128
|
-
}
|
|
129
|
-
await sendStandardResponse(response2, result.response, sendStandardResponseOptions);
|
|
130
|
-
return { matched: true };
|
|
131
|
-
}
|
|
132
|
-
);
|
|
20
|
+
const options = resolveFriendlyStandardHandleOptions(resolveMaybeOptionalOptions(rest));
|
|
21
|
+
const standardRequest = toStandardLazyRequest(request, response);
|
|
22
|
+
const result = await this.standardHandler.handle(standardRequest, options);
|
|
23
|
+
if (!result.matched) {
|
|
24
|
+
return { matched: false };
|
|
25
|
+
}
|
|
26
|
+
await sendStandardResponse(response, result.response, this.sendStandardResponseOptions);
|
|
27
|
+
return { matched: true };
|
|
133
28
|
}
|
|
134
29
|
}
|
|
135
30
|
|
|
136
|
-
export {
|
|
31
|
+
export { NodeHttpHandler };
|
|
@@ -1,16 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import '
|
|
5
|
-
import '@temporary-name/
|
|
6
|
-
import '@temporary-name/standard-server';
|
|
1
|
+
export { F as FriendlyStandardHandleOptions, S as StandardHandleOptions, a as StandardHandleResult, c as StandardHandler, b as StandardHandlerOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.BbUmcWIW.mjs';
|
|
2
|
+
import { AnyProcedure, AnyRouter } from '@temporary-name/server';
|
|
3
|
+
import { StandardLazyRequest, StandardResponse, ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
4
|
+
import '../../shared/server.BfraJHay.mjs';
|
|
5
|
+
import '@temporary-name/zod';
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<{
|
|
8
|
+
path: unknown;
|
|
9
|
+
query: unknown;
|
|
10
|
+
headers: Headers;
|
|
11
|
+
body: unknown;
|
|
12
|
+
}>;
|
|
13
|
+
declare function encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
14
|
+
declare function encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
type StandardMatchResult = {
|
|
17
|
+
path: readonly string[];
|
|
18
|
+
procedure: AnyProcedure;
|
|
19
|
+
params?: Record<string, string>;
|
|
20
|
+
} | undefined;
|
|
21
|
+
declare class StandardOpenAPIMatcher {
|
|
22
|
+
private readonly tree;
|
|
23
|
+
private pendingRouters;
|
|
24
|
+
init(router: AnyRouter, path?: readonly string[]): void;
|
|
25
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { StandardOpenAPIMatcher, decode, encode, encodeError };
|
|
29
|
+
export type { StandardMatchResult };
|
|
@@ -1,16 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import '
|
|
5
|
-
import '@temporary-name/
|
|
6
|
-
import '@temporary-name/standard-server';
|
|
1
|
+
export { F as FriendlyStandardHandleOptions, S as StandardHandleOptions, a as StandardHandleResult, c as StandardHandler, b as StandardHandlerOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.CHugaZ_Y.js';
|
|
2
|
+
import { AnyProcedure, AnyRouter } from '@temporary-name/server';
|
|
3
|
+
import { StandardLazyRequest, StandardResponse, ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
4
|
+
import '../../shared/server.BfraJHay.js';
|
|
5
|
+
import '@temporary-name/zod';
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<{
|
|
8
|
+
path: unknown;
|
|
9
|
+
query: unknown;
|
|
10
|
+
headers: Headers;
|
|
11
|
+
body: unknown;
|
|
12
|
+
}>;
|
|
13
|
+
declare function encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
14
|
+
declare function encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
type StandardMatchResult = {
|
|
17
|
+
path: readonly string[];
|
|
18
|
+
procedure: AnyProcedure;
|
|
19
|
+
params?: Record<string, string>;
|
|
20
|
+
} | undefined;
|
|
21
|
+
declare class StandardOpenAPIMatcher {
|
|
22
|
+
private readonly tree;
|
|
23
|
+
private pendingRouters;
|
|
24
|
+
init(router: AnyRouter, path?: readonly string[]): void;
|
|
25
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { StandardOpenAPIMatcher, decode, encode, encodeError };
|
|
29
|
+
export type { StandardMatchResult };
|
|
@@ -1,101 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import '
|
|
7
|
-
import '../../shared/server.
|
|
8
|
-
import '
|
|
9
|
-
import '
|
|
10
|
-
import 'zod/v4/core';
|
|
11
|
-
|
|
12
|
-
class StandardHandler {
|
|
13
|
-
constructor(router, matcher, codec, options) {
|
|
14
|
-
this.matcher = matcher;
|
|
15
|
-
this.codec = codec;
|
|
16
|
-
const plugins = new CompositeStandardHandlerPlugin(options.plugins);
|
|
17
|
-
plugins.init(options, router);
|
|
18
|
-
this.interceptors = toArray(options.interceptors);
|
|
19
|
-
this.clientInterceptors = toArray(options.clientInterceptors);
|
|
20
|
-
this.rootInterceptors = toArray(options.rootInterceptors);
|
|
21
|
-
this.matcher.init(router);
|
|
22
|
-
}
|
|
23
|
-
interceptors;
|
|
24
|
-
clientInterceptors;
|
|
25
|
-
rootInterceptors;
|
|
26
|
-
async handle(request, options) {
|
|
27
|
-
const prefix = options.prefix?.replace(/\/$/, "") || void 0;
|
|
28
|
-
if (prefix && !request.url.pathname.startsWith(`${prefix}/`) && request.url.pathname !== prefix) {
|
|
29
|
-
return { matched: false, response: void 0 };
|
|
30
|
-
}
|
|
31
|
-
return intercept(this.rootInterceptors, { ...options, request, prefix }, async (interceptorOptions) => {
|
|
32
|
-
return runWithSpan({ name: `${request.method} ${request.url.pathname}` }, async (span) => {
|
|
33
|
-
let step;
|
|
34
|
-
try {
|
|
35
|
-
return await intercept(
|
|
36
|
-
this.interceptors,
|
|
37
|
-
interceptorOptions,
|
|
38
|
-
async ({ request: request2, context, prefix: prefix2 }) => {
|
|
39
|
-
const method = request2.method;
|
|
40
|
-
const url = request2.url;
|
|
41
|
-
const pathname = prefix2 ? url.pathname.replace(prefix2, "") : url.pathname;
|
|
42
|
-
const match = await runWithSpan(
|
|
43
|
-
{ name: "find_procedure" },
|
|
44
|
-
() => this.matcher.match(method, `/${pathname.replace(/^\/|\/$/g, "")}`)
|
|
45
|
-
);
|
|
46
|
-
if (!match) {
|
|
47
|
-
return { matched: false, response: void 0 };
|
|
48
|
-
}
|
|
49
|
-
span?.updateName(`${ORPC_NAME}.${match.path.join("/")}`);
|
|
50
|
-
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
51
|
-
span?.setAttribute("rpc.method", match.path.join("."));
|
|
52
|
-
step = "decode_input";
|
|
53
|
-
let input = await runWithSpan(
|
|
54
|
-
{ name: "decode_input" },
|
|
55
|
-
() => this.codec.decode(request2, match.params, match.procedure)
|
|
56
|
-
);
|
|
57
|
-
step = void 0;
|
|
58
|
-
if (isAsyncIteratorObject(input)) {
|
|
59
|
-
input = asyncIteratorWithSpan(
|
|
60
|
-
{ name: "consume_event_iterator_input", signal: request2.signal },
|
|
61
|
-
input
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
const client = createProcedureClient(match.procedure, {
|
|
65
|
-
context,
|
|
66
|
-
path: match.path,
|
|
67
|
-
interceptors: this.clientInterceptors
|
|
68
|
-
});
|
|
69
|
-
step = "call_procedure";
|
|
70
|
-
const output = await client(input, {
|
|
71
|
-
signal: request2.signal,
|
|
72
|
-
lastEventId: flattenHeader(request2.headers["last-event-id"])
|
|
73
|
-
});
|
|
74
|
-
step = void 0;
|
|
75
|
-
const response = this.codec.encode(output, match.procedure);
|
|
76
|
-
return {
|
|
77
|
-
matched: true,
|
|
78
|
-
response
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
);
|
|
82
|
-
} catch (e) {
|
|
83
|
-
if (step !== "call_procedure") {
|
|
84
|
-
setSpanError(span, e);
|
|
85
|
-
}
|
|
86
|
-
const error = step === "decode_input" && !(e instanceof ORPCError) ? new ORPCError("BAD_REQUEST", {
|
|
87
|
-
message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
|
|
88
|
-
cause: e
|
|
89
|
-
}) : toORPCError(e);
|
|
90
|
-
const response = this.codec.encodeError(error);
|
|
91
|
-
return {
|
|
92
|
-
matched: true,
|
|
93
|
-
response
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export { CompositeStandardHandlerPlugin, StandardHandler };
|
|
1
|
+
export { S as StandardHandler, b as StandardOpenAPIMatcher, d as decode, c as decodeParams, e as encode, a as encodeError, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.CYa9puL2.mjs';
|
|
2
|
+
import '@temporary-name/shared';
|
|
3
|
+
import '../../shared/server.Cza0RB3u.mjs';
|
|
4
|
+
import '@temporary-name/standard-server';
|
|
5
|
+
import '@temporary-name/zod';
|
|
6
|
+
import '../../shared/server.ChOv1yG3.mjs';
|
|
7
|
+
import '../../shared/server.CQIFwyhc.mjs';
|
|
8
|
+
import '@temporary-name/server';
|
|
9
|
+
import 'rou3';
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
export { d as deleteCookie, g as getCookie, s as setCookie } from '../shared/server.C1RJffw4.mjs';
|
|
2
|
+
import 'cookie';
|
|
2
3
|
|
|
3
4
|
function encodeBase64url(data) {
|
|
4
5
|
const chunkSize = 8192;
|
|
@@ -30,33 +31,6 @@ function decodeBase64url(base64url) {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
function setCookie(headers, name, value, options = {}) {
|
|
34
|
-
if (headers === void 0) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const cookieString = serialize(name, value, {
|
|
38
|
-
path: "/",
|
|
39
|
-
...options
|
|
40
|
-
});
|
|
41
|
-
headers.append("Set-Cookie", cookieString);
|
|
42
|
-
}
|
|
43
|
-
function getCookie(headers, name, options = {}) {
|
|
44
|
-
if (headers === void 0) {
|
|
45
|
-
return void 0;
|
|
46
|
-
}
|
|
47
|
-
const cookieHeader = headers.get("cookie");
|
|
48
|
-
if (cookieHeader === null) {
|
|
49
|
-
return void 0;
|
|
50
|
-
}
|
|
51
|
-
return parse(cookieHeader, options)[name];
|
|
52
|
-
}
|
|
53
|
-
function deleteCookie(headers, name, options = {}) {
|
|
54
|
-
return setCookie(headers, name, "", {
|
|
55
|
-
...options,
|
|
56
|
-
maxAge: 0
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
34
|
const PBKDF2_CONFIG = {
|
|
61
35
|
name: "PBKDF2",
|
|
62
36
|
iterations: 6e4,
|
|
@@ -165,4 +139,4 @@ function getSignedValue(signedValue) {
|
|
|
165
139
|
return signedValue.slice(0, lastDotIndex);
|
|
166
140
|
}
|
|
167
141
|
|
|
168
|
-
export { decodeBase64url, decrypt,
|
|
142
|
+
export { decodeBase64url, decrypt, encodeBase64url, encrypt, getSignedValue, sign, unsign };
|