@orpc/server 0.0.0-next.7b09958 → 0.0.0-next.7d3bd71
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-47YYO5JS.js +32 -0
- package/dist/{chunk-BFGSRNYZ.js → chunk-77FU7QSO.js} +20 -158
- package/dist/{chunk-EDQKEHUX.js → chunk-MHVECKBC.js} +51 -7
- package/dist/{chunk-XFBAK67J.js → chunk-WQNNSBXW.js} +7 -15
- package/dist/fetch.js +6 -12
- package/dist/hono.js +6 -12
- package/dist/index.js +16 -7
- package/dist/next.js +6 -12
- package/dist/node.js +7 -146
- package/dist/plugins.js +1 -1
- package/dist/src/adapters/fetch/index.d.ts +0 -1
- package/dist/src/adapters/fetch/rpc-handler.d.ts +3 -2
- package/dist/src/adapters/fetch/types.d.ts +3 -2
- package/dist/src/adapters/hono/middleware.d.ts +2 -3
- package/dist/src/adapters/next/serve.d.ts +2 -3
- package/dist/src/adapters/node/index.d.ts +0 -1
- package/dist/src/adapters/node/rpc-handler.d.ts +3 -2
- package/dist/src/adapters/node/types.d.ts +3 -2
- package/dist/src/adapters/standard/handler.d.ts +15 -13
- package/dist/src/adapters/standard/index.d.ts +0 -1
- package/dist/src/adapters/standard/rpc-codec.d.ts +4 -3
- package/dist/src/adapters/standard/types.d.ts +3 -26
- package/dist/src/builder-variants.d.ts +2 -1
- package/dist/src/builder.d.ts +2 -1
- package/dist/src/context.d.ts +0 -1
- package/dist/src/error.d.ts +12 -0
- package/dist/src/implementer-procedure.d.ts +7 -4
- package/dist/src/implementer-variants.d.ts +2 -1
- package/dist/src/implementer.d.ts +2 -1
- package/dist/src/index.d.ts +3 -1
- package/dist/src/middleware-decorated.d.ts +2 -1
- package/dist/src/middleware.d.ts +5 -4
- package/dist/src/plugins/base.d.ts +1 -3
- package/dist/src/procedure-client.d.ts +8 -6
- package/dist/src/procedure-decorated.d.ts +7 -4
- package/dist/src/procedure-utils.d.ts +5 -3
- package/dist/src/procedure.d.ts +5 -3
- package/dist/src/router-client.d.ts +6 -5
- package/dist/src/router.d.ts +1 -0
- package/dist/standard.js +5 -9
- package/package.json +7 -4
- package/dist/chunk-2OH4QMZ4.js +0 -145
- package/dist/src/adapters/fetch/utils.d.ts +0 -5
- package/dist/src/adapters/node/utils.d.ts +0 -5
- package/dist/src/adapters/standard/rpc-serializer.d.ts +0 -16
@@ -0,0 +1,32 @@
|
|
1
|
+
import {
|
2
|
+
RPCCodec,
|
3
|
+
RPCMatcher,
|
4
|
+
StandardHandler
|
5
|
+
} from "./chunk-77FU7QSO.js";
|
6
|
+
|
7
|
+
// src/adapters/fetch/rpc-handler.ts
|
8
|
+
import { toFetchResponse, toStandardRequest } from "@orpc/server-standard-fetch";
|
9
|
+
var RPCHandler = class {
|
10
|
+
standardHandler;
|
11
|
+
constructor(router, options) {
|
12
|
+
const matcher = options?.matcher ?? new RPCMatcher();
|
13
|
+
const codec = options?.codec ?? new RPCCodec();
|
14
|
+
this.standardHandler = new StandardHandler(router, matcher, codec, options);
|
15
|
+
}
|
16
|
+
async handle(request, ...rest) {
|
17
|
+
const standardRequest = toStandardRequest(request);
|
18
|
+
const result = await this.standardHandler.handle(standardRequest, ...rest);
|
19
|
+
if (!result.matched) {
|
20
|
+
return result;
|
21
|
+
}
|
22
|
+
return {
|
23
|
+
matched: true,
|
24
|
+
response: toFetchResponse(result.response)
|
25
|
+
};
|
26
|
+
}
|
27
|
+
};
|
28
|
+
|
29
|
+
export {
|
30
|
+
RPCHandler
|
31
|
+
};
|
32
|
+
//# sourceMappingURL=chunk-47YYO5JS.js.map
|
@@ -6,27 +6,27 @@ import {
|
|
6
6
|
getRouterChild,
|
7
7
|
isProcedure,
|
8
8
|
unlazy
|
9
|
-
} from "./chunk-
|
9
|
+
} from "./chunk-MHVECKBC.js";
|
10
10
|
import {
|
11
11
|
CompositePlugin
|
12
|
-
} from "./chunk-
|
12
|
+
} from "./chunk-WQNNSBXW.js";
|
13
13
|
|
14
14
|
// src/adapters/standard/handler.ts
|
15
|
-
import { toORPCError } from "@orpc/
|
15
|
+
import { ORPCError, toORPCError } from "@orpc/client";
|
16
16
|
import { intercept, trim } from "@orpc/shared";
|
17
17
|
var StandardHandler = class {
|
18
18
|
constructor(router, matcher, codec, options = {}) {
|
19
19
|
this.matcher = matcher;
|
20
20
|
this.codec = codec;
|
21
21
|
this.options = options;
|
22
|
-
this.plugin = new CompositePlugin(options
|
22
|
+
this.plugin = new CompositePlugin(options.plugins);
|
23
23
|
this.plugin.init(this.options);
|
24
24
|
this.matcher.init(router);
|
25
25
|
}
|
26
26
|
plugin;
|
27
27
|
handle(request, ...[options]) {
|
28
28
|
return intercept(
|
29
|
-
this.options.
|
29
|
+
this.options.rootInterceptors ?? [],
|
30
30
|
{
|
31
31
|
request,
|
32
32
|
...options,
|
@@ -34,6 +34,7 @@ var StandardHandler = class {
|
|
34
34
|
// context is optional only when all fields are optional so we can safely force it to have a context
|
35
35
|
},
|
36
36
|
async (interceptorOptions) => {
|
37
|
+
let isDecoding = false;
|
37
38
|
try {
|
38
39
|
return await intercept(
|
39
40
|
this.options.interceptors ?? [],
|
@@ -46,14 +47,16 @@ var StandardHandler = class {
|
|
46
47
|
if (!match) {
|
47
48
|
return { matched: false, response: void 0 };
|
48
49
|
}
|
49
|
-
const
|
50
|
+
const client = createProcedureClient(match.procedure, {
|
50
51
|
context: interceptorOptions2.context,
|
51
|
-
path: match.path
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
path: match.path,
|
53
|
+
interceptors: this.options.clientInterceptors
|
54
|
+
});
|
55
|
+
isDecoding = true;
|
55
56
|
const input = await this.codec.decode(request, match.params, match.procedure);
|
56
|
-
|
57
|
+
isDecoding = false;
|
58
|
+
const lastEventId = Array.isArray(request.headers["last-event-id"]) ? request.headers["last-event-id"].at(-1) : request.headers["last-event-id"];
|
59
|
+
const output = await client(input, { signal: request.signal, lastEventId });
|
57
60
|
const response = this.codec.encode(output, match.procedure);
|
58
61
|
return {
|
59
62
|
matched: true,
|
@@ -62,7 +65,10 @@ var StandardHandler = class {
|
|
62
65
|
}
|
63
66
|
);
|
64
67
|
} catch (e) {
|
65
|
-
const error =
|
68
|
+
const error = isDecoding ? new ORPCError("BAD_REQUEST", {
|
69
|
+
message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
|
70
|
+
cause: e
|
71
|
+
}) : toORPCError(e);
|
66
72
|
const response = this.codec.encodeError(error);
|
67
73
|
return {
|
68
74
|
matched: true,
|
@@ -74,150 +80,8 @@ var StandardHandler = class {
|
|
74
80
|
}
|
75
81
|
};
|
76
82
|
|
77
|
-
// src/adapters/standard/rpc-serializer.ts
|
78
|
-
import { findDeepMatches, isObject, set } from "@orpc/shared";
|
79
|
-
var RPCSerializer = class {
|
80
|
-
serialize(data) {
|
81
|
-
if (data === void 0) {
|
82
|
-
return void 0;
|
83
|
-
}
|
84
|
-
if (data instanceof Blob) {
|
85
|
-
return data;
|
86
|
-
}
|
87
|
-
const serializedJSON = serializeRPCJson(data);
|
88
|
-
const { maps, values: blobs } = findDeepMatches((v) => v instanceof Blob, serializedJSON.json);
|
89
|
-
if (blobs.length === 0) {
|
90
|
-
return serializedJSON;
|
91
|
-
}
|
92
|
-
const form = new FormData();
|
93
|
-
form.set("data", JSON.stringify(serializedJSON));
|
94
|
-
form.set("maps", JSON.stringify(maps));
|
95
|
-
for (const i in blobs) {
|
96
|
-
form.set(i, blobs[i]);
|
97
|
-
}
|
98
|
-
return form;
|
99
|
-
}
|
100
|
-
deserialize(serialized) {
|
101
|
-
if (serialized === void 0) {
|
102
|
-
return void 0;
|
103
|
-
}
|
104
|
-
if (serialized instanceof Blob) {
|
105
|
-
return serialized;
|
106
|
-
}
|
107
|
-
if (!(serialized instanceof FormData)) {
|
108
|
-
return deserializeRPCJson(serialized);
|
109
|
-
}
|
110
|
-
const data = JSON.parse(serialized.get("data"));
|
111
|
-
const maps = JSON.parse(serialized.get("maps"));
|
112
|
-
for (const i in maps) {
|
113
|
-
data.json = set(data.json, maps[i], serialized.get(i));
|
114
|
-
}
|
115
|
-
return deserializeRPCJson(data);
|
116
|
-
}
|
117
|
-
};
|
118
|
-
function serializeRPCJson(value, segments = [], meta = []) {
|
119
|
-
if (typeof value === "bigint") {
|
120
|
-
meta.push(["bigint", segments]);
|
121
|
-
return { json: value.toString(), meta };
|
122
|
-
}
|
123
|
-
if (value instanceof Date) {
|
124
|
-
meta.push(["date", segments]);
|
125
|
-
const data = Number.isNaN(value.getTime()) ? "Invalid Date" : value.toISOString();
|
126
|
-
return { json: data, meta };
|
127
|
-
}
|
128
|
-
if (Number.isNaN(value)) {
|
129
|
-
meta.push(["nan", segments]);
|
130
|
-
return { json: "NaN", meta };
|
131
|
-
}
|
132
|
-
if (value instanceof RegExp) {
|
133
|
-
meta.push(["regexp", segments]);
|
134
|
-
return { json: value.toString(), meta };
|
135
|
-
}
|
136
|
-
if (value instanceof URL) {
|
137
|
-
meta.push(["url", segments]);
|
138
|
-
return { json: value.toString(), meta };
|
139
|
-
}
|
140
|
-
if (isObject(value)) {
|
141
|
-
const json = {};
|
142
|
-
for (const k in value) {
|
143
|
-
json[k] = serializeRPCJson(value[k], [...segments, k], meta).json;
|
144
|
-
}
|
145
|
-
return { json, meta };
|
146
|
-
}
|
147
|
-
if (Array.isArray(value)) {
|
148
|
-
const json = value.map((v, i) => {
|
149
|
-
if (v === void 0) {
|
150
|
-
meta.push(["undefined", [...segments, i]]);
|
151
|
-
return null;
|
152
|
-
}
|
153
|
-
return serializeRPCJson(v, [...segments, i], meta).json;
|
154
|
-
});
|
155
|
-
return { json, meta };
|
156
|
-
}
|
157
|
-
if (value instanceof Set) {
|
158
|
-
const result = serializeRPCJson(Array.from(value), segments, meta);
|
159
|
-
meta.push(["set", segments]);
|
160
|
-
return result;
|
161
|
-
}
|
162
|
-
if (value instanceof Map) {
|
163
|
-
const result = serializeRPCJson(Array.from(value.entries()), segments, meta);
|
164
|
-
meta.push(["map", segments]);
|
165
|
-
return result;
|
166
|
-
}
|
167
|
-
return { json: value, meta };
|
168
|
-
}
|
169
|
-
function deserializeRPCJson({
|
170
|
-
json,
|
171
|
-
meta
|
172
|
-
}) {
|
173
|
-
if (meta.length === 0) {
|
174
|
-
return json;
|
175
|
-
}
|
176
|
-
const ref = { data: json };
|
177
|
-
for (const [type, segments] of meta) {
|
178
|
-
let currentRef = ref;
|
179
|
-
let preSegment = "data";
|
180
|
-
for (let i = 0; i < segments.length; i++) {
|
181
|
-
currentRef = currentRef[preSegment];
|
182
|
-
preSegment = segments[i];
|
183
|
-
}
|
184
|
-
switch (type) {
|
185
|
-
case "nan":
|
186
|
-
currentRef[preSegment] = Number.NaN;
|
187
|
-
break;
|
188
|
-
case "bigint":
|
189
|
-
currentRef[preSegment] = BigInt(currentRef[preSegment]);
|
190
|
-
break;
|
191
|
-
case "date":
|
192
|
-
currentRef[preSegment] = new Date(currentRef[preSegment]);
|
193
|
-
break;
|
194
|
-
case "regexp": {
|
195
|
-
const [, pattern, flags] = currentRef[preSegment].match(/^\/(.*)\/([a-z]*)$/);
|
196
|
-
currentRef[preSegment] = new RegExp(pattern, flags);
|
197
|
-
break;
|
198
|
-
}
|
199
|
-
case "url":
|
200
|
-
currentRef[preSegment] = new URL(currentRef[preSegment]);
|
201
|
-
break;
|
202
|
-
case "undefined":
|
203
|
-
currentRef[preSegment] = void 0;
|
204
|
-
break;
|
205
|
-
case "map":
|
206
|
-
currentRef[preSegment] = new Map(currentRef[preSegment]);
|
207
|
-
break;
|
208
|
-
case "set":
|
209
|
-
currentRef[preSegment] = new Set(currentRef[preSegment]);
|
210
|
-
break;
|
211
|
-
/* v8 ignore next 3 */
|
212
|
-
default: {
|
213
|
-
const _expected = type;
|
214
|
-
}
|
215
|
-
}
|
216
|
-
}
|
217
|
-
return ref.data;
|
218
|
-
}
|
219
|
-
|
220
83
|
// src/adapters/standard/rpc-codec.ts
|
84
|
+
import { RPCSerializer } from "@orpc/client/rpc";
|
221
85
|
var RPCCodec = class {
|
222
86
|
serializer;
|
223
87
|
constructor(options = {}) {
|
@@ -311,9 +175,7 @@ var RPCMatcher = class {
|
|
311
175
|
|
312
176
|
export {
|
313
177
|
StandardHandler,
|
314
|
-
RPCSerializer,
|
315
|
-
serializeRPCJson,
|
316
178
|
RPCCodec,
|
317
179
|
RPCMatcher
|
318
180
|
};
|
319
|
-
//# sourceMappingURL=chunk-
|
181
|
+
//# sourceMappingURL=chunk-77FU7QSO.js.map
|
@@ -62,13 +62,56 @@ function middlewareOutputFn(output) {
|
|
62
62
|
}
|
63
63
|
|
64
64
|
// src/procedure-client.ts
|
65
|
-
import {
|
65
|
+
import { ORPCError as ORPCError2 } from "@orpc/client";
|
66
|
+
import { ValidationError } from "@orpc/contract";
|
66
67
|
import { intercept, toError, value } from "@orpc/shared";
|
68
|
+
|
69
|
+
// src/error.ts
|
70
|
+
import { fallbackORPCErrorStatus, ORPCError } from "@orpc/client";
|
71
|
+
function createORPCErrorConstructorMap(errors) {
|
72
|
+
const proxy = new Proxy(errors, {
|
73
|
+
get(target, code) {
|
74
|
+
if (typeof code !== "string") {
|
75
|
+
return Reflect.get(target, code);
|
76
|
+
}
|
77
|
+
const item = (...[options]) => {
|
78
|
+
const config = errors[code];
|
79
|
+
return new ORPCError(code, {
|
80
|
+
defined: Boolean(config),
|
81
|
+
status: config?.status,
|
82
|
+
message: options?.message ?? config?.message,
|
83
|
+
data: options?.data,
|
84
|
+
cause: options?.cause
|
85
|
+
});
|
86
|
+
};
|
87
|
+
return item;
|
88
|
+
}
|
89
|
+
});
|
90
|
+
return proxy;
|
91
|
+
}
|
92
|
+
async function validateORPCError(map, error) {
|
93
|
+
const { code, status, message, data, cause, defined } = error;
|
94
|
+
const config = map?.[error.code];
|
95
|
+
if (!config || fallbackORPCErrorStatus(error.code, config.status) !== error.status) {
|
96
|
+
return defined ? new ORPCError(code, { defined: false, status, message, data, cause }) : error;
|
97
|
+
}
|
98
|
+
if (!config.data) {
|
99
|
+
return defined ? error : new ORPCError(code, { defined: true, status, message, data, cause });
|
100
|
+
}
|
101
|
+
const validated = await config.data["~standard"].validate(error.data);
|
102
|
+
if (validated.issues) {
|
103
|
+
return defined ? new ORPCError(code, { defined: false, status, message, data, cause }) : error;
|
104
|
+
}
|
105
|
+
return new ORPCError(code, { defined: true, status, message, data: validated.value, cause });
|
106
|
+
}
|
107
|
+
|
108
|
+
// src/procedure-client.ts
|
67
109
|
function createProcedureClient(lazyableProcedure, ...[options]) {
|
68
110
|
return async (...[input, callerOptions]) => {
|
69
111
|
const path = options?.path ?? [];
|
70
112
|
const { default: procedure } = await unlazy(lazyableProcedure);
|
71
|
-
const
|
113
|
+
const clientContext = callerOptions?.context ?? {};
|
114
|
+
const context = await value(options?.context ?? {}, clientContext);
|
72
115
|
const errors = createORPCErrorConstructorMap(procedure["~orpc"].errorMap);
|
73
116
|
try {
|
74
117
|
return await intercept(
|
@@ -80,12 +123,13 @@ function createProcedureClient(lazyableProcedure, ...[options]) {
|
|
80
123
|
errors,
|
81
124
|
path,
|
82
125
|
procedure,
|
83
|
-
signal: callerOptions?.signal
|
126
|
+
signal: callerOptions?.signal,
|
127
|
+
lastEventId: callerOptions?.lastEventId
|
84
128
|
},
|
85
129
|
(interceptorOptions) => executeProcedureInternal(interceptorOptions.procedure, interceptorOptions)
|
86
130
|
);
|
87
131
|
} catch (e) {
|
88
|
-
if (!(e instanceof
|
132
|
+
if (!(e instanceof ORPCError2)) {
|
89
133
|
throw toError(e);
|
90
134
|
}
|
91
135
|
const validated = await validateORPCError(procedure["~orpc"].errorMap, e);
|
@@ -100,7 +144,7 @@ async function validateInput(procedure, input) {
|
|
100
144
|
}
|
101
145
|
const result = await schema["~standard"].validate(input);
|
102
146
|
if (result.issues) {
|
103
|
-
throw new
|
147
|
+
throw new ORPCError2("BAD_REQUEST", {
|
104
148
|
message: "Input validation failed",
|
105
149
|
data: {
|
106
150
|
issues: result.issues
|
@@ -117,7 +161,7 @@ async function validateOutput(procedure, output) {
|
|
117
161
|
}
|
118
162
|
const result = await schema["~standard"].validate(output);
|
119
163
|
if (result.issues) {
|
120
|
-
throw new
|
164
|
+
throw new ORPCError2("INTERNAL_SERVER_ERROR", {
|
121
165
|
message: "Output validation failed",
|
122
166
|
cause: new ValidationError({ message: "Output validation failed", issues: result.issues })
|
123
167
|
});
|
@@ -374,4 +418,4 @@ export {
|
|
374
418
|
convertPathToHttpPath,
|
375
419
|
createContractedProcedure
|
376
420
|
};
|
377
|
-
//# sourceMappingURL=chunk-
|
421
|
+
//# sourceMappingURL=chunk-MHVECKBC.js.map
|
@@ -8,11 +8,6 @@ var CompositePlugin = class {
|
|
8
8
|
plugin.init?.(options);
|
9
9
|
}
|
10
10
|
}
|
11
|
-
beforeCreateProcedureClient(clientOptions, interceptorOptions) {
|
12
|
-
for (const plugin of this.plugins) {
|
13
|
-
plugin.beforeCreateProcedureClient?.(clientOptions, interceptorOptions);
|
14
|
-
}
|
15
|
-
}
|
16
11
|
};
|
17
12
|
|
18
13
|
// src/plugins/cors.ts
|
@@ -21,20 +16,17 @@ var CORSPlugin = class {
|
|
21
16
|
options;
|
22
17
|
constructor(options) {
|
23
18
|
const defaults = {
|
24
|
-
origin:
|
19
|
+
origin: (origin) => origin,
|
25
20
|
allowMethods: ["GET", "HEAD", "PUT", "POST", "DELETE", "PATCH"]
|
26
21
|
};
|
27
|
-
if (options?.credentials) {
|
28
|
-
defaults.origin = (origin) => origin;
|
29
|
-
}
|
30
22
|
this.options = {
|
31
23
|
...defaults,
|
32
24
|
...options
|
33
25
|
};
|
34
26
|
}
|
35
27
|
init(options) {
|
36
|
-
options.
|
37
|
-
options.
|
28
|
+
options.rootInterceptors ??= [];
|
29
|
+
options.rootInterceptors.unshift(async (interceptorOptions) => {
|
38
30
|
if (interceptorOptions.request.method === "OPTIONS") {
|
39
31
|
const resHeaders = {};
|
40
32
|
if (this.options.maxAge !== void 0) {
|
@@ -60,7 +52,7 @@ var CORSPlugin = class {
|
|
60
52
|
}
|
61
53
|
return interceptorOptions.next();
|
62
54
|
});
|
63
|
-
options.
|
55
|
+
options.rootInterceptors.unshift(async (interceptorOptions) => {
|
64
56
|
const result = await interceptorOptions.next();
|
65
57
|
if (!result.matched) {
|
66
58
|
return result;
|
@@ -97,8 +89,8 @@ var CORSPlugin = class {
|
|
97
89
|
// src/plugins/response-headers.ts
|
98
90
|
var ResponseHeadersPlugin = class {
|
99
91
|
init(options) {
|
100
|
-
options.
|
101
|
-
options.
|
92
|
+
options.rootInterceptors ??= [];
|
93
|
+
options.rootInterceptors.push(async (interceptorOptions) => {
|
102
94
|
const headers = new Headers();
|
103
95
|
interceptorOptions.context.resHeaders = headers;
|
104
96
|
const result = await interceptorOptions.next();
|
@@ -125,4 +117,4 @@ export {
|
|
125
117
|
CORSPlugin,
|
126
118
|
ResponseHeadersPlugin
|
127
119
|
};
|
128
|
-
//# sourceMappingURL=chunk-
|
120
|
+
//# sourceMappingURL=chunk-WQNNSBXW.js.map
|
package/dist/fetch.js
CHANGED
@@ -1,16 +1,10 @@
|
|
1
1
|
import {
|
2
|
-
RPCHandler
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
import "./chunk-BFGSRNYZ.js";
|
8
|
-
import "./chunk-EDQKEHUX.js";
|
9
|
-
import "./chunk-XFBAK67J.js";
|
2
|
+
RPCHandler
|
3
|
+
} from "./chunk-47YYO5JS.js";
|
4
|
+
import "./chunk-77FU7QSO.js";
|
5
|
+
import "./chunk-MHVECKBC.js";
|
6
|
+
import "./chunk-WQNNSBXW.js";
|
10
7
|
export {
|
11
|
-
RPCHandler
|
12
|
-
fetchReToStandardBody,
|
13
|
-
fetchRequestToStandardRequest,
|
14
|
-
standardResponseToFetchResponse
|
8
|
+
RPCHandler
|
15
9
|
};
|
16
10
|
//# sourceMappingURL=fetch.js.map
|
package/dist/hono.js
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
import {
|
2
|
-
RPCHandler
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
import "./chunk-BFGSRNYZ.js";
|
8
|
-
import "./chunk-EDQKEHUX.js";
|
9
|
-
import "./chunk-XFBAK67J.js";
|
2
|
+
RPCHandler
|
3
|
+
} from "./chunk-47YYO5JS.js";
|
4
|
+
import "./chunk-77FU7QSO.js";
|
5
|
+
import "./chunk-MHVECKBC.js";
|
6
|
+
import "./chunk-WQNNSBXW.js";
|
10
7
|
|
11
8
|
// src/adapters/hono/middleware.ts
|
12
9
|
import { value } from "@orpc/shared";
|
@@ -32,9 +29,6 @@ function createMiddleware(handler, ...[options]) {
|
|
32
29
|
}
|
33
30
|
export {
|
34
31
|
RPCHandler,
|
35
|
-
createMiddleware
|
36
|
-
fetchReToStandardBody,
|
37
|
-
fetchRequestToStandardRequest,
|
38
|
-
standardResponseToFetchResponse
|
32
|
+
createMiddleware
|
39
33
|
};
|
40
34
|
//# sourceMappingURL=hono.js.map
|
package/dist/index.js
CHANGED
@@ -21,7 +21,7 @@ import {
|
|
21
21
|
middlewareOutputFn,
|
22
22
|
setRouterContract,
|
23
23
|
unlazy
|
24
|
-
} from "./chunk-
|
24
|
+
} from "./chunk-MHVECKBC.js";
|
25
25
|
|
26
26
|
// src/builder.ts
|
27
27
|
import { mergeErrorMap as mergeErrorMap2, mergeMeta as mergeMeta2, mergePrefix, mergeRoute as mergeRoute2, mergeTags } from "@orpc/contract";
|
@@ -50,10 +50,14 @@ function decorateMiddleware(middleware) {
|
|
50
50
|
decorated.concat = (concatMiddleware, mapInput) => {
|
51
51
|
const mapped = mapInput ? decorateMiddleware(concatMiddleware).mapInput(mapInput) : concatMiddleware;
|
52
52
|
const concatted = decorateMiddleware((options, input, output, ...rest) => {
|
53
|
-
const
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
const merged = middleware({
|
54
|
+
...options,
|
55
|
+
next: (...[nextOptions1]) => mapped({
|
56
|
+
...options,
|
57
|
+
context: { ...options.context, ...nextOptions1?.context },
|
58
|
+
next: (...[nextOptions2]) => options.next({ context: { ...nextOptions1?.context, ...nextOptions2?.context } })
|
59
|
+
}, input, output, ...rest)
|
60
|
+
}, input, output, ...rest);
|
57
61
|
return merged;
|
58
62
|
});
|
59
63
|
return concatted;
|
@@ -357,7 +361,9 @@ function createRouterClient(router, ...rest) {
|
|
357
361
|
}
|
358
362
|
|
359
363
|
// src/index.ts
|
360
|
-
import { isDefinedError, ORPCError, safe
|
364
|
+
import { isDefinedError, ORPCError, safe } from "@orpc/client";
|
365
|
+
import { eventIterator, type, ValidationError } from "@orpc/contract";
|
366
|
+
import { getEventMeta, withEventMeta } from "@orpc/server-standard";
|
361
367
|
import { onError, onFinish, onStart, onSuccess } from "@orpc/shared";
|
362
368
|
export {
|
363
369
|
Builder,
|
@@ -378,8 +384,10 @@ export {
|
|
378
384
|
deepSetLazyRouterPrefix,
|
379
385
|
eachAllContractProcedure,
|
380
386
|
eachContractProcedure,
|
387
|
+
eventIterator,
|
381
388
|
fallbackConfig,
|
382
389
|
flatLazy,
|
390
|
+
getEventMeta,
|
383
391
|
getLazyRouterPrefix,
|
384
392
|
getRouterChild,
|
385
393
|
getRouterContract,
|
@@ -399,6 +407,7 @@ export {
|
|
399
407
|
safe,
|
400
408
|
setRouterContract,
|
401
409
|
type,
|
402
|
-
unlazy
|
410
|
+
unlazy,
|
411
|
+
withEventMeta
|
403
412
|
};
|
404
413
|
//# sourceMappingURL=index.js.map
|
package/dist/next.js
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
import {
|
2
|
-
RPCHandler
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
import "./chunk-BFGSRNYZ.js";
|
8
|
-
import "./chunk-EDQKEHUX.js";
|
9
|
-
import "./chunk-XFBAK67J.js";
|
2
|
+
RPCHandler
|
3
|
+
} from "./chunk-47YYO5JS.js";
|
4
|
+
import "./chunk-77FU7QSO.js";
|
5
|
+
import "./chunk-MHVECKBC.js";
|
6
|
+
import "./chunk-WQNNSBXW.js";
|
10
7
|
|
11
8
|
// src/adapters/next/serve.ts
|
12
9
|
import { value } from "@orpc/shared";
|
@@ -29,9 +26,6 @@ function serve(handler, ...[options]) {
|
|
29
26
|
}
|
30
27
|
export {
|
31
28
|
RPCHandler,
|
32
|
-
|
33
|
-
fetchRequestToStandardRequest,
|
34
|
-
serve,
|
35
|
-
standardResponseToFetchResponse
|
29
|
+
serve
|
36
30
|
};
|
37
31
|
//# sourceMappingURL=next.js.map
|