@temporary-name/server 1.9.3-alpha.03e17aa3340f4b261a549bf9e3fe948b084e2309
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/LICENSE +21 -0
- package/README.md +31 -0
- package/dist/adapters/aws-lambda/index.d.mts +30 -0
- package/dist/adapters/aws-lambda/index.d.ts +30 -0
- package/dist/adapters/aws-lambda/index.mjs +33 -0
- package/dist/adapters/fetch/index.d.mts +108 -0
- package/dist/adapters/fetch/index.d.ts +108 -0
- package/dist/adapters/fetch/index.mjs +174 -0
- package/dist/adapters/node/index.d.mts +83 -0
- package/dist/adapters/node/index.d.ts +83 -0
- package/dist/adapters/node/index.mjs +139 -0
- package/dist/adapters/standard/index.d.mts +42 -0
- package/dist/adapters/standard/index.d.ts +42 -0
- package/dist/adapters/standard/index.mjs +11 -0
- package/dist/helpers/index.d.mts +149 -0
- package/dist/helpers/index.d.ts +149 -0
- package/dist/helpers/index.mjs +168 -0
- package/dist/index.d.mts +603 -0
- package/dist/index.d.ts +603 -0
- package/dist/index.mjs +617 -0
- package/dist/openapi/index.d.mts +220 -0
- package/dist/openapi/index.d.ts +220 -0
- package/dist/openapi/index.mjs +776 -0
- package/dist/plugins/index.d.mts +160 -0
- package/dist/plugins/index.d.ts +160 -0
- package/dist/plugins/index.mjs +288 -0
- package/dist/shared/server.BEHw7Eyx.mjs +247 -0
- package/dist/shared/server.BKSOrA6h.d.mts +192 -0
- package/dist/shared/server.BKSOrA6h.d.ts +192 -0
- package/dist/shared/server.BKh8I1Ny.mjs +239 -0
- package/dist/shared/server.BeuTpcmO.d.mts +23 -0
- package/dist/shared/server.C1fnTLq0.d.mts +57 -0
- package/dist/shared/server.CQyYNJ1H.d.ts +57 -0
- package/dist/shared/server.DLsti1Pv.mjs +293 -0
- package/dist/shared/server.SLLuK6_v.d.ts +23 -0
- package/package.json +95 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { isObject, NullProtoObj, isAsyncIteratorObject, isORPCErrorJson, createORPCErrorFromJson, toORPCError } from '@temporary-name/shared';
|
|
2
|
+
import { mapEventIterator, ErrorEvent } from '@temporary-name/standard-server';
|
|
3
|
+
|
|
4
|
+
function bracketNotationSerialize(data, segments = [], result = []) {
|
|
5
|
+
if (Array.isArray(data)) {
|
|
6
|
+
data.forEach((item, i) => {
|
|
7
|
+
bracketNotationSerialize(item, [...segments, i], result);
|
|
8
|
+
});
|
|
9
|
+
} else if (isObject(data)) {
|
|
10
|
+
for (const key in data) {
|
|
11
|
+
bracketNotationSerialize(data[key], [...segments, key], result);
|
|
12
|
+
}
|
|
13
|
+
} else {
|
|
14
|
+
result.push([stringifyPath(segments), data]);
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
function bracketNotationDeserialize(serialized, { maxArrayIndex = 9999 } = {}) {
|
|
19
|
+
if (serialized.length === 0) {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
const arrayPushStyles = /* @__PURE__ */ new WeakSet();
|
|
23
|
+
const ref = { value: [] };
|
|
24
|
+
for (const [path, value] of serialized) {
|
|
25
|
+
const segments = parsePath(path);
|
|
26
|
+
let currentRef = ref;
|
|
27
|
+
let nextSegment = "value";
|
|
28
|
+
segments.forEach((segment, i) => {
|
|
29
|
+
if (!Array.isArray(currentRef[nextSegment]) && !isObject(currentRef[nextSegment])) {
|
|
30
|
+
currentRef[nextSegment] = [];
|
|
31
|
+
}
|
|
32
|
+
if (i !== segments.length - 1) {
|
|
33
|
+
if (Array.isArray(currentRef[nextSegment]) && !isValidArrayIndex(segment, maxArrayIndex)) {
|
|
34
|
+
if (arrayPushStyles.has(currentRef[nextSegment])) {
|
|
35
|
+
arrayPushStyles.delete(currentRef[nextSegment]);
|
|
36
|
+
currentRef[nextSegment] = pushStyleArrayToObject(currentRef[nextSegment]);
|
|
37
|
+
} else {
|
|
38
|
+
currentRef[nextSegment] = arrayToObject(currentRef[nextSegment]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
if (Array.isArray(currentRef[nextSegment])) {
|
|
43
|
+
if (segment === "") {
|
|
44
|
+
if (currentRef[nextSegment].length && !arrayPushStyles.has(currentRef[nextSegment])) {
|
|
45
|
+
currentRef[nextSegment] = arrayToObject(currentRef[nextSegment]);
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
if (arrayPushStyles.has(currentRef[nextSegment])) {
|
|
49
|
+
arrayPushStyles.delete(currentRef[nextSegment]);
|
|
50
|
+
currentRef[nextSegment] = pushStyleArrayToObject(currentRef[nextSegment]);
|
|
51
|
+
} else if (!isValidArrayIndex(segment, maxArrayIndex)) {
|
|
52
|
+
currentRef[nextSegment] = arrayToObject(currentRef[nextSegment]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
currentRef = currentRef[nextSegment];
|
|
58
|
+
nextSegment = segment;
|
|
59
|
+
});
|
|
60
|
+
if (Array.isArray(currentRef) && nextSegment === "") {
|
|
61
|
+
arrayPushStyles.add(currentRef);
|
|
62
|
+
currentRef.push(value);
|
|
63
|
+
} else if (nextSegment in currentRef) {
|
|
64
|
+
if (Array.isArray(currentRef[nextSegment])) {
|
|
65
|
+
currentRef[nextSegment].push(value);
|
|
66
|
+
} else {
|
|
67
|
+
currentRef[nextSegment] = [currentRef[nextSegment], value];
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
currentRef[nextSegment] = value;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return ref.value;
|
|
74
|
+
}
|
|
75
|
+
function stringifyPath(segments) {
|
|
76
|
+
return segments.map((segment) => {
|
|
77
|
+
return segment.toString().replace(/[\\[\]]/g, (match) => {
|
|
78
|
+
switch (match) {
|
|
79
|
+
case "\\":
|
|
80
|
+
return "\\\\";
|
|
81
|
+
case "[":
|
|
82
|
+
return "\\[";
|
|
83
|
+
case "]":
|
|
84
|
+
return "\\]";
|
|
85
|
+
/* v8 ignore next 2 */
|
|
86
|
+
default:
|
|
87
|
+
return match;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}).reduce((result, segment, i) => {
|
|
91
|
+
if (i === 0) {
|
|
92
|
+
return segment;
|
|
93
|
+
}
|
|
94
|
+
return `${result}[${segment}]`;
|
|
95
|
+
}, "");
|
|
96
|
+
}
|
|
97
|
+
function parsePath(path) {
|
|
98
|
+
const segments = [];
|
|
99
|
+
let inBrackets = false;
|
|
100
|
+
let currentSegment = "";
|
|
101
|
+
let backslashCount = 0;
|
|
102
|
+
for (let i = 0; i < path.length; i++) {
|
|
103
|
+
const char = path[i];
|
|
104
|
+
const nextChar = path[i + 1];
|
|
105
|
+
if (inBrackets && char === "]" && (nextChar === void 0 || nextChar === "[") && backslashCount % 2 === 0) {
|
|
106
|
+
if (nextChar === void 0) {
|
|
107
|
+
inBrackets = false;
|
|
108
|
+
}
|
|
109
|
+
segments.push(currentSegment);
|
|
110
|
+
currentSegment = "";
|
|
111
|
+
i++;
|
|
112
|
+
} else if (segments.length === 0 && char === "[" && backslashCount % 2 === 0) {
|
|
113
|
+
inBrackets = true;
|
|
114
|
+
segments.push(currentSegment);
|
|
115
|
+
currentSegment = "";
|
|
116
|
+
} else if (char === "\\") {
|
|
117
|
+
backslashCount++;
|
|
118
|
+
} else {
|
|
119
|
+
currentSegment += "\\".repeat(backslashCount / 2) + char;
|
|
120
|
+
backslashCount = 0;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return inBrackets || segments.length === 0 ? [path] : segments;
|
|
124
|
+
}
|
|
125
|
+
function isValidArrayIndex(value, maxIndex) {
|
|
126
|
+
return /^0$|^[1-9]\d*$/.test(value) && Number(value) <= maxIndex;
|
|
127
|
+
}
|
|
128
|
+
function arrayToObject(array) {
|
|
129
|
+
const obj = new NullProtoObj();
|
|
130
|
+
array.forEach((item, i) => {
|
|
131
|
+
obj[i] = item;
|
|
132
|
+
});
|
|
133
|
+
return obj;
|
|
134
|
+
}
|
|
135
|
+
function pushStyleArrayToObject(array) {
|
|
136
|
+
const obj = new NullProtoObj();
|
|
137
|
+
obj[""] = array.length === 1 ? array[0] : array;
|
|
138
|
+
return obj;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function jsonSerialize(data, hasBlobRef = { value: false }) {
|
|
142
|
+
if (data instanceof Blob) {
|
|
143
|
+
hasBlobRef.value = true;
|
|
144
|
+
return [data, hasBlobRef.value];
|
|
145
|
+
}
|
|
146
|
+
if (data instanceof Set) {
|
|
147
|
+
return jsonSerialize(Array.from(data), hasBlobRef);
|
|
148
|
+
}
|
|
149
|
+
if (data instanceof Map) {
|
|
150
|
+
return jsonSerialize(Array.from(data.entries()), hasBlobRef);
|
|
151
|
+
}
|
|
152
|
+
if (Array.isArray(data)) {
|
|
153
|
+
const json = data.map((v) => v === void 0 ? null : jsonSerialize(v, hasBlobRef)[0]);
|
|
154
|
+
return [json, hasBlobRef.value];
|
|
155
|
+
}
|
|
156
|
+
if (isObject(data)) {
|
|
157
|
+
const json = {};
|
|
158
|
+
for (const k in data) {
|
|
159
|
+
if (k === "toJSON" && typeof data[k] === "function") {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
json[k] = jsonSerialize(data[k], hasBlobRef)[0];
|
|
163
|
+
}
|
|
164
|
+
return [json, hasBlobRef.value];
|
|
165
|
+
}
|
|
166
|
+
if (typeof data === "bigint" || data instanceof RegExp || data instanceof URL) {
|
|
167
|
+
return [data.toString(), hasBlobRef.value];
|
|
168
|
+
}
|
|
169
|
+
if (data instanceof Date) {
|
|
170
|
+
return [Number.isNaN(data.getTime()) ? null : data.toISOString(), hasBlobRef.value];
|
|
171
|
+
}
|
|
172
|
+
if (Number.isNaN(data)) {
|
|
173
|
+
return [null, hasBlobRef.value];
|
|
174
|
+
}
|
|
175
|
+
return [data, hasBlobRef.value];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function serialize(data, options = {}) {
|
|
179
|
+
if (isAsyncIteratorObject(data) && !options.outputFormat) {
|
|
180
|
+
return mapEventIterator(data, {
|
|
181
|
+
value: async (value) => _serialize(value, { outputFormat: "plain" }),
|
|
182
|
+
error: async (e) => {
|
|
183
|
+
return new ErrorEvent({
|
|
184
|
+
data: _serialize(toORPCError(e).toJSON(), { outputFormat: "plain" }),
|
|
185
|
+
cause: e
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
return _serialize(data, options);
|
|
191
|
+
}
|
|
192
|
+
function _serialize(data, options) {
|
|
193
|
+
const [json, hasBlob] = jsonSerialize(data);
|
|
194
|
+
if (options.outputFormat === "plain") {
|
|
195
|
+
return json;
|
|
196
|
+
}
|
|
197
|
+
if (options.outputFormat === "URLSearchParams") {
|
|
198
|
+
const params = new URLSearchParams();
|
|
199
|
+
for (const [path, value] of bracketNotationSerialize(json)) {
|
|
200
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
201
|
+
params.append(path, value.toString());
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return params;
|
|
205
|
+
}
|
|
206
|
+
if (json instanceof Blob || json === void 0 || !hasBlob) {
|
|
207
|
+
return json;
|
|
208
|
+
}
|
|
209
|
+
const form = new FormData();
|
|
210
|
+
for (const [path, value] of bracketNotationSerialize(json)) {
|
|
211
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
212
|
+
form.append(path, value.toString());
|
|
213
|
+
} else if (value instanceof Blob) {
|
|
214
|
+
form.append(path, value);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return form;
|
|
218
|
+
}
|
|
219
|
+
function deserialize(data) {
|
|
220
|
+
if (data instanceof URLSearchParams || data instanceof FormData) {
|
|
221
|
+
return bracketNotationDeserialize(Array.from(data.entries()));
|
|
222
|
+
}
|
|
223
|
+
if (isAsyncIteratorObject(data)) {
|
|
224
|
+
return mapEventIterator(data, {
|
|
225
|
+
value: async (value) => value,
|
|
226
|
+
error: async (e) => {
|
|
227
|
+
if (e instanceof ErrorEvent && isORPCErrorJson(e.data)) {
|
|
228
|
+
return createORPCErrorFromJson(e.data, { cause: e });
|
|
229
|
+
}
|
|
230
|
+
return e;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
return data;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function standardizeHTTPPath(path) {
|
|
238
|
+
return `/${path.replace(/\/{2,}/g, "/").replace(/^\/|\/$/g, "")}`;
|
|
239
|
+
}
|
|
240
|
+
function getDynamicParams(path) {
|
|
241
|
+
return path ? standardizeHTTPPath(path).match(/\/\{[^}]+\}/g)?.map((v) => ({
|
|
242
|
+
raw: v,
|
|
243
|
+
name: v.match(/\{\+?([^}]+)\}/)[1]
|
|
244
|
+
})) : void 0;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export { standardizeHTTPPath as a, deserialize as d, getDynamicParams as g, jsonSerialize as j, serialize as s };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { ErrorMap, ErrorMapItem, InferSchemaInput, AnySchema, Meta, ContractProcedureDef, InferSchemaOutput, ErrorFromErrorMap, AnyContractRouter, ContractProcedure } from '@temporary-name/contract';
|
|
2
|
+
import { ORPCErrorCode, MaybeOptionalOptions, ORPCErrorOptions, ORPCError, HTTPPath, Promisable, ClientContext, Interceptor, PromiseWithError, Value, Client } from '@temporary-name/shared';
|
|
3
|
+
|
|
4
|
+
type Context = Record<PropertyKey, any>;
|
|
5
|
+
type MergedInitialContext<TInitial extends Context, TAdditional extends Context, TCurrent extends Context> = TInitial & Omit<TAdditional, keyof TCurrent>;
|
|
6
|
+
type MergedCurrentContext<T extends Context, U extends Context> = Omit<T, keyof U> & U;
|
|
7
|
+
declare function mergeCurrentContext<T extends Context, U extends Context>(context: T, other: U): MergedCurrentContext<T, U>;
|
|
8
|
+
|
|
9
|
+
type ORPCErrorConstructorMapItemOptions<TData> = Omit<ORPCErrorOptions<TData>, 'defined' | 'status'>;
|
|
10
|
+
type ORPCErrorConstructorMapItem<TCode extends ORPCErrorCode, TInData> = (...rest: MaybeOptionalOptions<ORPCErrorConstructorMapItemOptions<TInData>>) => ORPCError<TCode, TInData>;
|
|
11
|
+
type ORPCErrorConstructorMap<T extends ErrorMap> = {
|
|
12
|
+
[K in keyof T]: K extends ORPCErrorCode ? T[K] extends ErrorMapItem<infer UInputSchema> ? ORPCErrorConstructorMapItem<K, InferSchemaInput<UInputSchema>> : never : never;
|
|
13
|
+
};
|
|
14
|
+
declare function createORPCErrorConstructorMap<T extends ErrorMap>(errors: T): ORPCErrorConstructorMap<T>;
|
|
15
|
+
|
|
16
|
+
declare const LAZY_SYMBOL: unique symbol;
|
|
17
|
+
interface LazyMeta {
|
|
18
|
+
prefix?: HTTPPath;
|
|
19
|
+
}
|
|
20
|
+
interface Lazy<T> {
|
|
21
|
+
[LAZY_SYMBOL]: {
|
|
22
|
+
loader: () => Promise<{
|
|
23
|
+
default: T;
|
|
24
|
+
}>;
|
|
25
|
+
meta: LazyMeta;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
type Lazyable<T> = T | Lazy<T>;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a lazy-loaded item.
|
|
31
|
+
*
|
|
32
|
+
* @warning The `prefix` in `meta` only holds metadata and does not apply the prefix to the lazy router, use `os.prefix(...).lazyRoute(...)` instead.
|
|
33
|
+
*/
|
|
34
|
+
declare function lazy<T>(loader: () => Promise<{
|
|
35
|
+
default: T;
|
|
36
|
+
}>, meta?: LazyMeta): Lazy<T>;
|
|
37
|
+
declare function isLazy(item: unknown): item is Lazy<any>;
|
|
38
|
+
declare function getLazyMeta(lazied: Lazy<any>): LazyMeta;
|
|
39
|
+
declare function unlazy<T extends Lazyable<any>>(lazied: T): Promise<{
|
|
40
|
+
default: T extends Lazy<infer U> ? U : T;
|
|
41
|
+
}>;
|
|
42
|
+
|
|
43
|
+
interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
|
44
|
+
context: TCurrentContext;
|
|
45
|
+
input: TInput;
|
|
46
|
+
path: readonly string[];
|
|
47
|
+
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
|
|
48
|
+
signal?: AbortSignal;
|
|
49
|
+
lastEventId: string | undefined;
|
|
50
|
+
errors: TErrorConstructorMap;
|
|
51
|
+
}
|
|
52
|
+
interface ProcedureHandler<TCurrentContext extends Context, TInput, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
53
|
+
(opt: ProcedureHandlerOptions<TCurrentContext, TInput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): Promisable<THandlerOutput>;
|
|
54
|
+
}
|
|
55
|
+
interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
|
56
|
+
__initialContext?: (type: TInitialContext) => unknown;
|
|
57
|
+
middlewares: readonly AnyMiddleware[];
|
|
58
|
+
inputValidationIndex: number;
|
|
59
|
+
outputValidationIndex: number;
|
|
60
|
+
handler: ProcedureHandler<TCurrentContext, any, any, any, any>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* This class represents a procedure.
|
|
64
|
+
*
|
|
65
|
+
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
66
|
+
*/
|
|
67
|
+
declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
68
|
+
/**
|
|
69
|
+
* This property holds the defined options.
|
|
70
|
+
*/
|
|
71
|
+
'~orpc': ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
72
|
+
constructor(def: ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>);
|
|
73
|
+
}
|
|
74
|
+
type AnyProcedure = Procedure<any, any, any, any, any, any>;
|
|
75
|
+
declare function isProcedure(item: unknown): item is AnyProcedure;
|
|
76
|
+
|
|
77
|
+
type MiddlewareResult<TOutContext extends Context, TOutput> = Promisable<{
|
|
78
|
+
output: TOutput;
|
|
79
|
+
context: TOutContext;
|
|
80
|
+
}>;
|
|
81
|
+
type MiddlewareNextFnOptions<TOutContext extends Context> = Record<never, never> extends TOutContext ? {
|
|
82
|
+
context?: TOutContext;
|
|
83
|
+
} : {
|
|
84
|
+
context: TOutContext;
|
|
85
|
+
};
|
|
86
|
+
interface MiddlewareNextFn<TOutput> {
|
|
87
|
+
<U extends Context = Record<never, never>>(...rest: MaybeOptionalOptions<MiddlewareNextFnOptions<U>>): MiddlewareResult<U, TOutput>;
|
|
88
|
+
}
|
|
89
|
+
interface MiddlewareOutputFn<TOutput> {
|
|
90
|
+
(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
|
|
91
|
+
}
|
|
92
|
+
interface MiddlewareOptions<TInContext extends Context, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
|
93
|
+
context: TInContext;
|
|
94
|
+
path: readonly string[];
|
|
95
|
+
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
|
|
96
|
+
signal?: AbortSignal;
|
|
97
|
+
lastEventId: string | undefined;
|
|
98
|
+
next: MiddlewareNextFn<TOutput>;
|
|
99
|
+
errors: TErrorConstructorMap;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A function that represents a middleware.
|
|
103
|
+
*
|
|
104
|
+
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
105
|
+
*/
|
|
106
|
+
interface Middleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
|
107
|
+
(options: MiddlewareOptions<TInContext, TOutput, TErrorConstructorMap, TMeta>, input: TInput, output: MiddlewareOutputFn<TOutput>): Promisable<MiddlewareResult<TOutContext, TOutput>>;
|
|
108
|
+
}
|
|
109
|
+
type AnyMiddleware = Middleware<any, any, any, any, any, any>;
|
|
110
|
+
interface MapInputMiddleware<TInput, TMappedInput> {
|
|
111
|
+
(input: TInput): TMappedInput;
|
|
112
|
+
}
|
|
113
|
+
declare function middlewareOutputFn<TOutput>(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
|
|
114
|
+
|
|
115
|
+
type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
|
|
116
|
+
interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
117
|
+
context: TInitialContext;
|
|
118
|
+
input: unknown;
|
|
119
|
+
errors: ORPCErrorConstructorMap<TErrorMap>;
|
|
120
|
+
path: readonly string[];
|
|
121
|
+
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
|
|
122
|
+
signal?: AbortSignal;
|
|
123
|
+
lastEventId: string | undefined;
|
|
124
|
+
}
|
|
125
|
+
type CreateProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext> = {
|
|
126
|
+
/**
|
|
127
|
+
* This is helpful for logging and analytics.
|
|
128
|
+
*/
|
|
129
|
+
path?: readonly string[];
|
|
130
|
+
interceptors?: Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap, TMeta>, PromiseWithError<InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>>[];
|
|
131
|
+
} & (Record<never, never> extends TInitialContext ? {
|
|
132
|
+
context?: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
|
|
133
|
+
} : {
|
|
134
|
+
context: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
|
|
135
|
+
});
|
|
136
|
+
/**
|
|
137
|
+
* Create Server-side client from a procedure.
|
|
138
|
+
*
|
|
139
|
+
* @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
|
|
140
|
+
*/
|
|
141
|
+
declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap>;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Represents a router, which defines a hierarchical structure of procedures.
|
|
145
|
+
*
|
|
146
|
+
* @info A procedure is a router too.
|
|
147
|
+
* @see {@link https://orpc.unnoq.com/docs/contract-first/define-contract#contract-router Contract Router Docs}
|
|
148
|
+
*/
|
|
149
|
+
type Router<T extends AnyContractRouter, TInitialContext extends Context> = T extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? Procedure<TInitialContext, any, UInputSchema, UOutputSchema, UErrorMap, UMeta> : {
|
|
150
|
+
[K in keyof T]: T[K] extends AnyContractRouter ? Lazyable<Router<T[K], TInitialContext>> : never;
|
|
151
|
+
};
|
|
152
|
+
type AnyRouter = Router<any, any>;
|
|
153
|
+
type InferRouterInitialContext<T extends AnyRouter> = T extends Router<any, infer UInitialContext> ? UInitialContext : never;
|
|
154
|
+
/**
|
|
155
|
+
* Infer all initial context of the router.
|
|
156
|
+
*
|
|
157
|
+
* @info A procedure is a router too.
|
|
158
|
+
* @see {@link https://orpc.unnoq.com/docs/router#utilities Router Utilities Docs}
|
|
159
|
+
*/
|
|
160
|
+
type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any, any> ? UInitialContext : {
|
|
161
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInitialContexts<U> : never;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Infer all current context of the router.
|
|
165
|
+
*
|
|
166
|
+
* @info A procedure is a router too.
|
|
167
|
+
* @see {@link https://orpc.unnoq.com/docs/router#utilities Router Utilities Docs}
|
|
168
|
+
*/
|
|
169
|
+
type InferRouterCurrentContexts<T extends AnyRouter> = T extends Procedure<any, infer UCurrentContext, any, any, any, any> ? UCurrentContext : {
|
|
170
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterCurrentContexts<U> : never;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Infer all router inputs
|
|
174
|
+
*
|
|
175
|
+
* @info A procedure is a router too.
|
|
176
|
+
* @see {@link https://orpc.unnoq.com/docs/router#utilities Router Utilities Docs}
|
|
177
|
+
*/
|
|
178
|
+
type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any, any> ? InferSchemaInput<UInputSchema> : {
|
|
179
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInputs<U> : never;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Infer all router outputs
|
|
183
|
+
*
|
|
184
|
+
* @info A procedure is a router too.
|
|
185
|
+
* @see {@link https://orpc.unnoq.com/docs/router#utilities Router Utilities Docs}
|
|
186
|
+
*/
|
|
187
|
+
type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any, any> ? InferSchemaOutput<UOutputSchema> : {
|
|
188
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export { isProcedure as D, createProcedureClient as F, Procedure as P, createORPCErrorConstructorMap as l, mergeCurrentContext as m, LAZY_SYMBOL as n, lazy as p, isLazy as q, getLazyMeta as r, unlazy as u, middlewareOutputFn as y };
|
|
192
|
+
export type { AnyMiddleware as A, ProcedureDef as B, Context as C, ProcedureClientInterceptorOptions as E, InferRouterInitialContexts as G, InferRouterCurrentContexts as H, InferRouterInitialContext as I, InferRouterInputs as J, InferRouterOutputs as K, Lazyable as L, Middleware as M, ORPCErrorConstructorMap as O, Router as R, MergedInitialContext as a, MergedCurrentContext as b, MapInputMiddleware as c, CreateProcedureClientOptions as d, ProcedureClient as e, AnyRouter as f, Lazy as g, AnyProcedure as h, ProcedureHandler as i, ORPCErrorConstructorMapItemOptions as j, ORPCErrorConstructorMapItem as k, LazyMeta as o, MiddlewareResult as s, MiddlewareNextFnOptions as t, MiddlewareNextFn as v, MiddlewareOutputFn as w, MiddlewareOptions as x, ProcedureHandlerOptions as z };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { ErrorMap, ErrorMapItem, InferSchemaInput, AnySchema, Meta, ContractProcedureDef, InferSchemaOutput, ErrorFromErrorMap, AnyContractRouter, ContractProcedure } from '@temporary-name/contract';
|
|
2
|
+
import { ORPCErrorCode, MaybeOptionalOptions, ORPCErrorOptions, ORPCError, HTTPPath, Promisable, ClientContext, Interceptor, PromiseWithError, Value, Client } from '@temporary-name/shared';
|
|
3
|
+
|
|
4
|
+
type Context = Record<PropertyKey, any>;
|
|
5
|
+
type MergedInitialContext<TInitial extends Context, TAdditional extends Context, TCurrent extends Context> = TInitial & Omit<TAdditional, keyof TCurrent>;
|
|
6
|
+
type MergedCurrentContext<T extends Context, U extends Context> = Omit<T, keyof U> & U;
|
|
7
|
+
declare function mergeCurrentContext<T extends Context, U extends Context>(context: T, other: U): MergedCurrentContext<T, U>;
|
|
8
|
+
|
|
9
|
+
type ORPCErrorConstructorMapItemOptions<TData> = Omit<ORPCErrorOptions<TData>, 'defined' | 'status'>;
|
|
10
|
+
type ORPCErrorConstructorMapItem<TCode extends ORPCErrorCode, TInData> = (...rest: MaybeOptionalOptions<ORPCErrorConstructorMapItemOptions<TInData>>) => ORPCError<TCode, TInData>;
|
|
11
|
+
type ORPCErrorConstructorMap<T extends ErrorMap> = {
|
|
12
|
+
[K in keyof T]: K extends ORPCErrorCode ? T[K] extends ErrorMapItem<infer UInputSchema> ? ORPCErrorConstructorMapItem<K, InferSchemaInput<UInputSchema>> : never : never;
|
|
13
|
+
};
|
|
14
|
+
declare function createORPCErrorConstructorMap<T extends ErrorMap>(errors: T): ORPCErrorConstructorMap<T>;
|
|
15
|
+
|
|
16
|
+
declare const LAZY_SYMBOL: unique symbol;
|
|
17
|
+
interface LazyMeta {
|
|
18
|
+
prefix?: HTTPPath;
|
|
19
|
+
}
|
|
20
|
+
interface Lazy<T> {
|
|
21
|
+
[LAZY_SYMBOL]: {
|
|
22
|
+
loader: () => Promise<{
|
|
23
|
+
default: T;
|
|
24
|
+
}>;
|
|
25
|
+
meta: LazyMeta;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
type Lazyable<T> = T | Lazy<T>;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a lazy-loaded item.
|
|
31
|
+
*
|
|
32
|
+
* @warning The `prefix` in `meta` only holds metadata and does not apply the prefix to the lazy router, use `os.prefix(...).lazyRoute(...)` instead.
|
|
33
|
+
*/
|
|
34
|
+
declare function lazy<T>(loader: () => Promise<{
|
|
35
|
+
default: T;
|
|
36
|
+
}>, meta?: LazyMeta): Lazy<T>;
|
|
37
|
+
declare function isLazy(item: unknown): item is Lazy<any>;
|
|
38
|
+
declare function getLazyMeta(lazied: Lazy<any>): LazyMeta;
|
|
39
|
+
declare function unlazy<T extends Lazyable<any>>(lazied: T): Promise<{
|
|
40
|
+
default: T extends Lazy<infer U> ? U : T;
|
|
41
|
+
}>;
|
|
42
|
+
|
|
43
|
+
interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
|
44
|
+
context: TCurrentContext;
|
|
45
|
+
input: TInput;
|
|
46
|
+
path: readonly string[];
|
|
47
|
+
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
|
|
48
|
+
signal?: AbortSignal;
|
|
49
|
+
lastEventId: string | undefined;
|
|
50
|
+
errors: TErrorConstructorMap;
|
|
51
|
+
}
|
|
52
|
+
interface ProcedureHandler<TCurrentContext extends Context, TInput, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
53
|
+
(opt: ProcedureHandlerOptions<TCurrentContext, TInput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): Promisable<THandlerOutput>;
|
|
54
|
+
}
|
|
55
|
+
interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
|
56
|
+
__initialContext?: (type: TInitialContext) => unknown;
|
|
57
|
+
middlewares: readonly AnyMiddleware[];
|
|
58
|
+
inputValidationIndex: number;
|
|
59
|
+
outputValidationIndex: number;
|
|
60
|
+
handler: ProcedureHandler<TCurrentContext, any, any, any, any>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* This class represents a procedure.
|
|
64
|
+
*
|
|
65
|
+
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
66
|
+
*/
|
|
67
|
+
declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
68
|
+
/**
|
|
69
|
+
* This property holds the defined options.
|
|
70
|
+
*/
|
|
71
|
+
'~orpc': ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
72
|
+
constructor(def: ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>);
|
|
73
|
+
}
|
|
74
|
+
type AnyProcedure = Procedure<any, any, any, any, any, any>;
|
|
75
|
+
declare function isProcedure(item: unknown): item is AnyProcedure;
|
|
76
|
+
|
|
77
|
+
type MiddlewareResult<TOutContext extends Context, TOutput> = Promisable<{
|
|
78
|
+
output: TOutput;
|
|
79
|
+
context: TOutContext;
|
|
80
|
+
}>;
|
|
81
|
+
type MiddlewareNextFnOptions<TOutContext extends Context> = Record<never, never> extends TOutContext ? {
|
|
82
|
+
context?: TOutContext;
|
|
83
|
+
} : {
|
|
84
|
+
context: TOutContext;
|
|
85
|
+
};
|
|
86
|
+
interface MiddlewareNextFn<TOutput> {
|
|
87
|
+
<U extends Context = Record<never, never>>(...rest: MaybeOptionalOptions<MiddlewareNextFnOptions<U>>): MiddlewareResult<U, TOutput>;
|
|
88
|
+
}
|
|
89
|
+
interface MiddlewareOutputFn<TOutput> {
|
|
90
|
+
(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
|
|
91
|
+
}
|
|
92
|
+
interface MiddlewareOptions<TInContext extends Context, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
|
93
|
+
context: TInContext;
|
|
94
|
+
path: readonly string[];
|
|
95
|
+
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
|
|
96
|
+
signal?: AbortSignal;
|
|
97
|
+
lastEventId: string | undefined;
|
|
98
|
+
next: MiddlewareNextFn<TOutput>;
|
|
99
|
+
errors: TErrorConstructorMap;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A function that represents a middleware.
|
|
103
|
+
*
|
|
104
|
+
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
105
|
+
*/
|
|
106
|
+
interface Middleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
|
107
|
+
(options: MiddlewareOptions<TInContext, TOutput, TErrorConstructorMap, TMeta>, input: TInput, output: MiddlewareOutputFn<TOutput>): Promisable<MiddlewareResult<TOutContext, TOutput>>;
|
|
108
|
+
}
|
|
109
|
+
type AnyMiddleware = Middleware<any, any, any, any, any, any>;
|
|
110
|
+
interface MapInputMiddleware<TInput, TMappedInput> {
|
|
111
|
+
(input: TInput): TMappedInput;
|
|
112
|
+
}
|
|
113
|
+
declare function middlewareOutputFn<TOutput>(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
|
|
114
|
+
|
|
115
|
+
type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
|
|
116
|
+
interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
117
|
+
context: TInitialContext;
|
|
118
|
+
input: unknown;
|
|
119
|
+
errors: ORPCErrorConstructorMap<TErrorMap>;
|
|
120
|
+
path: readonly string[];
|
|
121
|
+
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
|
|
122
|
+
signal?: AbortSignal;
|
|
123
|
+
lastEventId: string | undefined;
|
|
124
|
+
}
|
|
125
|
+
type CreateProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext> = {
|
|
126
|
+
/**
|
|
127
|
+
* This is helpful for logging and analytics.
|
|
128
|
+
*/
|
|
129
|
+
path?: readonly string[];
|
|
130
|
+
interceptors?: Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap, TMeta>, PromiseWithError<InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>>[];
|
|
131
|
+
} & (Record<never, never> extends TInitialContext ? {
|
|
132
|
+
context?: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
|
|
133
|
+
} : {
|
|
134
|
+
context: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
|
|
135
|
+
});
|
|
136
|
+
/**
|
|
137
|
+
* Create Server-side client from a procedure.
|
|
138
|
+
*
|
|
139
|
+
* @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
|
|
140
|
+
*/
|
|
141
|
+
declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap>;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Represents a router, which defines a hierarchical structure of procedures.
|
|
145
|
+
*
|
|
146
|
+
* @info A procedure is a router too.
|
|
147
|
+
* @see {@link https://orpc.unnoq.com/docs/contract-first/define-contract#contract-router Contract Router Docs}
|
|
148
|
+
*/
|
|
149
|
+
type Router<T extends AnyContractRouter, TInitialContext extends Context> = T extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? Procedure<TInitialContext, any, UInputSchema, UOutputSchema, UErrorMap, UMeta> : {
|
|
150
|
+
[K in keyof T]: T[K] extends AnyContractRouter ? Lazyable<Router<T[K], TInitialContext>> : never;
|
|
151
|
+
};
|
|
152
|
+
type AnyRouter = Router<any, any>;
|
|
153
|
+
type InferRouterInitialContext<T extends AnyRouter> = T extends Router<any, infer UInitialContext> ? UInitialContext : never;
|
|
154
|
+
/**
|
|
155
|
+
* Infer all initial context of the router.
|
|
156
|
+
*
|
|
157
|
+
* @info A procedure is a router too.
|
|
158
|
+
* @see {@link https://orpc.unnoq.com/docs/router#utilities Router Utilities Docs}
|
|
159
|
+
*/
|
|
160
|
+
type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any, any> ? UInitialContext : {
|
|
161
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInitialContexts<U> : never;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Infer all current context of the router.
|
|
165
|
+
*
|
|
166
|
+
* @info A procedure is a router too.
|
|
167
|
+
* @see {@link https://orpc.unnoq.com/docs/router#utilities Router Utilities Docs}
|
|
168
|
+
*/
|
|
169
|
+
type InferRouterCurrentContexts<T extends AnyRouter> = T extends Procedure<any, infer UCurrentContext, any, any, any, any> ? UCurrentContext : {
|
|
170
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterCurrentContexts<U> : never;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Infer all router inputs
|
|
174
|
+
*
|
|
175
|
+
* @info A procedure is a router too.
|
|
176
|
+
* @see {@link https://orpc.unnoq.com/docs/router#utilities Router Utilities Docs}
|
|
177
|
+
*/
|
|
178
|
+
type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any, any> ? InferSchemaInput<UInputSchema> : {
|
|
179
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInputs<U> : never;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Infer all router outputs
|
|
183
|
+
*
|
|
184
|
+
* @info A procedure is a router too.
|
|
185
|
+
* @see {@link https://orpc.unnoq.com/docs/router#utilities Router Utilities Docs}
|
|
186
|
+
*/
|
|
187
|
+
type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any, any> ? InferSchemaOutput<UOutputSchema> : {
|
|
188
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export { isProcedure as D, createProcedureClient as F, Procedure as P, createORPCErrorConstructorMap as l, mergeCurrentContext as m, LAZY_SYMBOL as n, lazy as p, isLazy as q, getLazyMeta as r, unlazy as u, middlewareOutputFn as y };
|
|
192
|
+
export type { AnyMiddleware as A, ProcedureDef as B, Context as C, ProcedureClientInterceptorOptions as E, InferRouterInitialContexts as G, InferRouterCurrentContexts as H, InferRouterInitialContext as I, InferRouterInputs as J, InferRouterOutputs as K, Lazyable as L, Middleware as M, ORPCErrorConstructorMap as O, Router as R, MergedInitialContext as a, MergedCurrentContext as b, MapInputMiddleware as c, CreateProcedureClientOptions as d, ProcedureClient as e, AnyRouter as f, Lazy as g, AnyProcedure as h, ProcedureHandler as i, ORPCErrorConstructorMapItemOptions as j, ORPCErrorConstructorMapItem as k, LazyMeta as o, MiddlewareResult as s, MiddlewareNextFnOptions as t, MiddlewareNextFn as v, MiddlewareOutputFn as w, MiddlewareOptions as x, ProcedureHandlerOptions as z };
|