@sortsys/v2-client 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2268 -220
- package/package.json +13 -16
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,1768 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
3
|
+
import { EventEmitter } from 'events';
|
|
4
|
+
import * as http from 'http';
|
|
5
|
+
import { SendOptions } from 'send';
|
|
6
6
|
|
|
7
|
+
interface ConnectionStateBase<TError> {
|
|
8
|
+
type: "state";
|
|
9
|
+
data?: never;
|
|
10
|
+
error: TError | null;
|
|
11
|
+
}
|
|
12
|
+
interface ConnectionIdleState extends ConnectionStateBase<null> {
|
|
13
|
+
state: "idle";
|
|
14
|
+
}
|
|
15
|
+
interface ConnectionConnectingState<TError> extends ConnectionStateBase<TError | null> {
|
|
16
|
+
state: "connecting";
|
|
17
|
+
}
|
|
18
|
+
interface ConnectionPendingState extends ConnectionStateBase<null> {
|
|
19
|
+
state: "pending";
|
|
20
|
+
}
|
|
21
|
+
type TRPCConnectionState<TError> = ConnectionIdleState | ConnectionConnectingState<TError> | ConnectionPendingState;
|
|
22
|
+
interface Unsubscribable {
|
|
23
|
+
unsubscribe(): void;
|
|
24
|
+
}
|
|
25
|
+
interface Subscribable<TValue, TError> {
|
|
26
|
+
subscribe(observer: Partial<Observer<TValue, TError>>): Unsubscribable;
|
|
27
|
+
}
|
|
28
|
+
interface Observable<TValue, TError> extends Subscribable<TValue, TError> {
|
|
29
|
+
pipe(): Observable<TValue, TError>;
|
|
30
|
+
pipe<TValue1, TError1>(op1: OperatorFunction<TValue, TError, TValue1, TError1>): Observable<TValue1, TError1>;
|
|
31
|
+
pipe<TValue1, TError1, TValue2, TError2>(op1: OperatorFunction<TValue, TError, TValue1, TError1>, op2: OperatorFunction<TValue1, TError1, TValue2, TError2>): Observable<TValue2, TError2>;
|
|
32
|
+
pipe<TValue1, TError1, TValue2, TError2, TValue3, TError3>(op1: OperatorFunction<TValue, TError, TValue1, TError1>, op2: OperatorFunction<TValue1, TError1, TValue2, TError2>, op3: OperatorFunction<TValue2, TError2, TValue3, TError3>): Observable<TValue2, TError2>;
|
|
33
|
+
pipe<TValue1, TError1, TValue2, TError2, TValue3, TError3, TValue4, TError4>(op1: OperatorFunction<TValue, TError, TValue1, TError1>, op2: OperatorFunction<TValue1, TError1, TValue2, TError2>, op3: OperatorFunction<TValue2, TError2, TValue3, TError3>, op4: OperatorFunction<TValue3, TError3, TValue4, TError4>): Observable<TValue2, TError2>;
|
|
34
|
+
pipe<TValue1, TError1, TValue2, TError2, TValue3, TError3, TValue4, TError4, TValue5, TError5>(op1: OperatorFunction<TValue, TError, TValue1, TError1>, op2: OperatorFunction<TValue1, TError1, TValue2, TError2>, op3: OperatorFunction<TValue2, TError2, TValue3, TError3>, op4: OperatorFunction<TValue3, TError3, TValue4, TError4>, op5: OperatorFunction<TValue4, TError4, TValue5, TError5>): Observable<TValue2, TError2>;
|
|
35
|
+
}
|
|
36
|
+
interface Observer<TValue, TError> {
|
|
37
|
+
next: (value: TValue) => void;
|
|
38
|
+
error: (err: TError) => void;
|
|
39
|
+
complete: () => void;
|
|
40
|
+
}
|
|
41
|
+
type UnaryFunction<TSource, TReturn> = (source: TSource) => TReturn;
|
|
42
|
+
type OperatorFunction<TValueBefore, TErrorBefore, TValueAfter, TErrorAfter> = UnaryFunction<Subscribable<TValueBefore, TErrorBefore>, Subscribable<TValueAfter, TErrorAfter>>;
|
|
43
|
+
type Maybe<TType> = TType | null | undefined;
|
|
44
|
+
type Simplify<TType> = TType extends any[] | Date ? TType : {
|
|
45
|
+
[K in keyof TType]: TType[K];
|
|
46
|
+
};
|
|
47
|
+
type MaybePromise<TType> = Promise<TType> | TType;
|
|
48
|
+
type WithoutIndexSignature<TObj> = {
|
|
49
|
+
[K in keyof TObj as string extends K ? never : number extends K ? never : K]: TObj[K];
|
|
50
|
+
};
|
|
51
|
+
type GetRawInputFn = () => Promise<unknown>;
|
|
52
|
+
declare const _errorSymbol: unique symbol;
|
|
53
|
+
type TypeError$1<TMessage extends string> = TMessage & {
|
|
54
|
+
_: typeof _errorSymbol;
|
|
55
|
+
};
|
|
56
|
+
type ValueOf<TObj> = TObj[keyof TObj];
|
|
57
|
+
type inferAsyncIterableYield<T> = T extends AsyncIterable<infer U> ? U : T;
|
|
58
|
+
declare const TRPC_ERROR_CODES_BY_KEY: {
|
|
59
|
+
/**
|
|
60
|
+
* Invalid JSON was received by the server.
|
|
61
|
+
* An error occurred on the server while parsing the JSON text.
|
|
62
|
+
*/
|
|
63
|
+
readonly PARSE_ERROR: -32700;
|
|
64
|
+
/**
|
|
65
|
+
* The JSON sent is not a valid Request object.
|
|
66
|
+
*/
|
|
67
|
+
readonly BAD_REQUEST: -32600;
|
|
68
|
+
readonly INTERNAL_SERVER_ERROR: -32603;
|
|
69
|
+
readonly NOT_IMPLEMENTED: -32603;
|
|
70
|
+
readonly BAD_GATEWAY: -32603;
|
|
71
|
+
readonly SERVICE_UNAVAILABLE: -32603;
|
|
72
|
+
readonly GATEWAY_TIMEOUT: -32603;
|
|
73
|
+
readonly UNAUTHORIZED: -32001;
|
|
74
|
+
readonly PAYMENT_REQUIRED: -32002;
|
|
75
|
+
readonly FORBIDDEN: -32003;
|
|
76
|
+
readonly NOT_FOUND: -32004;
|
|
77
|
+
readonly METHOD_NOT_SUPPORTED: -32005;
|
|
78
|
+
readonly TIMEOUT: -32008;
|
|
79
|
+
readonly CONFLICT: -32009;
|
|
80
|
+
readonly PRECONDITION_FAILED: -32012;
|
|
81
|
+
readonly PAYLOAD_TOO_LARGE: -32013;
|
|
82
|
+
readonly UNSUPPORTED_MEDIA_TYPE: -32015;
|
|
83
|
+
readonly UNPROCESSABLE_CONTENT: -32022;
|
|
84
|
+
readonly PRECONDITION_REQUIRED: -32028;
|
|
85
|
+
readonly TOO_MANY_REQUESTS: -32029;
|
|
86
|
+
readonly CLIENT_CLOSED_REQUEST: -32099;
|
|
87
|
+
};
|
|
88
|
+
type TRPC_ERROR_CODE_NUMBER = ValueOf<typeof TRPC_ERROR_CODES_BY_KEY>;
|
|
89
|
+
type TRPC_ERROR_CODE_KEY = keyof typeof TRPC_ERROR_CODES_BY_KEY;
|
|
90
|
+
declare class TRPCError extends Error {
|
|
91
|
+
readonly cause?: Error;
|
|
92
|
+
readonly code: "PARSE_ERROR" | "BAD_REQUEST" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_SUPPORTED" | "TIMEOUT" | "CONFLICT" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "UNSUPPORTED_MEDIA_TYPE" | "UNPROCESSABLE_CONTENT" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "CLIENT_CLOSED_REQUEST";
|
|
93
|
+
constructor(opts: {
|
|
94
|
+
message?: string;
|
|
95
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
96
|
+
cause?: unknown;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
100
|
+
/** The Standard Schema properties. */
|
|
101
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
102
|
+
}
|
|
103
|
+
declare namespace StandardSchemaV1 {
|
|
104
|
+
/** The Standard Schema properties interface. */
|
|
105
|
+
interface Props<Input = unknown, Output = Input> {
|
|
106
|
+
/** The version number of the standard. */
|
|
107
|
+
readonly version: 1;
|
|
108
|
+
/** The vendor name of the schema library. */
|
|
109
|
+
readonly vendor: string;
|
|
110
|
+
/** Validates unknown input values. */
|
|
111
|
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
112
|
+
/** Inferred types associated with the schema. */
|
|
113
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
114
|
+
}
|
|
115
|
+
/** The result interface of the validate function. */
|
|
116
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
117
|
+
/** The result interface if validation succeeds. */
|
|
118
|
+
interface SuccessResult<Output> {
|
|
119
|
+
/** The typed output value. */
|
|
120
|
+
readonly value: Output;
|
|
121
|
+
/** The non-existent issues. */
|
|
122
|
+
readonly issues?: undefined;
|
|
123
|
+
}
|
|
124
|
+
/** The result interface if validation fails. */
|
|
125
|
+
interface FailureResult {
|
|
126
|
+
/** The issues of failed validation. */
|
|
127
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
128
|
+
}
|
|
129
|
+
/** The issue interface of the failure output. */
|
|
130
|
+
interface Issue {
|
|
131
|
+
/** The error message of the issue. */
|
|
132
|
+
readonly message: string;
|
|
133
|
+
/** The path of the issue, if any. */
|
|
134
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
135
|
+
}
|
|
136
|
+
/** The path segment interface of the issue. */
|
|
137
|
+
interface PathSegment {
|
|
138
|
+
/** The key representing a path segment. */
|
|
139
|
+
readonly key: PropertyKey;
|
|
140
|
+
}
|
|
141
|
+
/** The Standard Schema types interface. */
|
|
142
|
+
interface Types<Input = unknown, Output = Input> {
|
|
143
|
+
/** The input type of the schema. */
|
|
144
|
+
readonly input: Input;
|
|
145
|
+
/** The output type of the schema. */
|
|
146
|
+
readonly output: Output;
|
|
147
|
+
}
|
|
148
|
+
/** Infers the input type of a Standard Schema. */
|
|
149
|
+
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
150
|
+
/** Infers the output type of a Standard Schema. */
|
|
151
|
+
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
152
|
+
}
|
|
153
|
+
type ParserZodEsque<TInput, TParsedInput> = {
|
|
154
|
+
_input: TInput;
|
|
155
|
+
_output: TParsedInput;
|
|
156
|
+
};
|
|
157
|
+
type ParserValibotEsque<TInput, TParsedInput> = {
|
|
158
|
+
schema: {
|
|
159
|
+
_types?: {
|
|
160
|
+
input: TInput;
|
|
161
|
+
output: TParsedInput;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
type ParserArkTypeEsque<TInput, TParsedInput> = {
|
|
166
|
+
inferIn: TInput;
|
|
167
|
+
infer: TParsedInput;
|
|
168
|
+
};
|
|
169
|
+
type ParserStandardSchemaEsque<TInput, TParsedInput> = StandardSchemaV1<TInput, TParsedInput>;
|
|
170
|
+
type ParserMyZodEsque<TInput> = {
|
|
171
|
+
parse: (input: any) => TInput;
|
|
172
|
+
};
|
|
173
|
+
type ParserSuperstructEsque<TInput> = {
|
|
174
|
+
create: (input: unknown) => TInput;
|
|
175
|
+
};
|
|
176
|
+
type ParserCustomValidatorEsque<TInput> = (input: unknown) => Promise<TInput> | TInput;
|
|
177
|
+
type ParserYupEsque<TInput> = {
|
|
178
|
+
validateSync: (input: unknown) => TInput;
|
|
179
|
+
};
|
|
180
|
+
type ParserScaleEsque<TInput> = {
|
|
181
|
+
assert(value: unknown): asserts value is TInput;
|
|
182
|
+
};
|
|
183
|
+
type ParserWithoutInput<TInput> = ParserCustomValidatorEsque<TInput> | ParserMyZodEsque<TInput> | ParserScaleEsque<TInput> | ParserSuperstructEsque<TInput> | ParserYupEsque<TInput>;
|
|
184
|
+
type ParserWithInputOutput<TInput, TParsedInput> = ParserZodEsque<TInput, TParsedInput> | ParserValibotEsque<TInput, TParsedInput> | ParserArkTypeEsque<TInput, TParsedInput> | ParserStandardSchemaEsque<TInput, TParsedInput>;
|
|
185
|
+
type Parser = ParserWithInputOutput<any, any> | ParserWithoutInput<any>;
|
|
186
|
+
interface ProcedureCallOptions<TContext> {
|
|
187
|
+
ctx: TContext;
|
|
188
|
+
getRawInput: GetRawInputFn;
|
|
189
|
+
input?: unknown;
|
|
190
|
+
path: string;
|
|
191
|
+
type: ProcedureType;
|
|
192
|
+
signal: AbortSignal | undefined;
|
|
193
|
+
}
|
|
194
|
+
declare const procedureTypes: readonly [
|
|
195
|
+
"query",
|
|
196
|
+
"mutation",
|
|
197
|
+
"subscription"
|
|
198
|
+
];
|
|
199
|
+
type ProcedureType = (typeof procedureTypes)[number];
|
|
200
|
+
interface BuiltProcedureDef {
|
|
201
|
+
meta: unknown;
|
|
202
|
+
input: unknown;
|
|
203
|
+
output: unknown;
|
|
204
|
+
}
|
|
205
|
+
interface Procedure<TType extends ProcedureType, TDef extends BuiltProcedureDef> {
|
|
206
|
+
_def: {
|
|
207
|
+
/**
|
|
208
|
+
* These are just types, they can't be used at runtime
|
|
209
|
+
* @internal
|
|
210
|
+
*/
|
|
211
|
+
$types: {
|
|
212
|
+
input: TDef["input"];
|
|
213
|
+
output: TDef["output"];
|
|
214
|
+
};
|
|
215
|
+
procedure: true;
|
|
216
|
+
type: TType;
|
|
217
|
+
/**
|
|
218
|
+
* @internal
|
|
219
|
+
* Meta is not inferrable on individual procedures, only on the router
|
|
220
|
+
*/
|
|
221
|
+
meta: unknown;
|
|
222
|
+
experimental_caller: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* The input parsers for the procedure
|
|
225
|
+
*/
|
|
226
|
+
inputs: Parser[];
|
|
227
|
+
};
|
|
228
|
+
meta: TDef["meta"];
|
|
229
|
+
/**
|
|
230
|
+
* @internal
|
|
231
|
+
*/
|
|
232
|
+
(opts: ProcedureCallOptions<unknown>): Promise<TDef["output"]>;
|
|
233
|
+
}
|
|
234
|
+
interface QueryProcedure<TDef extends BuiltProcedureDef> extends Procedure<"query", TDef> {
|
|
235
|
+
}
|
|
236
|
+
interface MutationProcedure<TDef extends BuiltProcedureDef> extends Procedure<"mutation", TDef> {
|
|
237
|
+
}
|
|
238
|
+
interface SubscriptionProcedure<TDef extends BuiltProcedureDef> extends Procedure<"subscription", TDef> {
|
|
239
|
+
}
|
|
240
|
+
interface LegacyObservableSubscriptionProcedure<TDef extends BuiltProcedureDef> extends SubscriptionProcedure<TDef> {
|
|
241
|
+
_observable: true;
|
|
242
|
+
}
|
|
243
|
+
type AnyQueryProcedure = QueryProcedure<any>;
|
|
244
|
+
type AnyMutationProcedure = MutationProcedure<any>;
|
|
245
|
+
type AnySubscriptionProcedure = SubscriptionProcedure<any> | LegacyObservableSubscriptionProcedure<any>;
|
|
246
|
+
type AnyProcedure = AnyQueryProcedure | AnyMutationProcedure | AnySubscriptionProcedure;
|
|
247
|
+
type inferProcedureInput<TProcedure extends AnyProcedure> = undefined extends inferProcedureParams<TProcedure>["$types"]["input"] ? void | inferProcedureParams<TProcedure>["$types"]["input"] : inferProcedureParams<TProcedure>["$types"]["input"];
|
|
248
|
+
type inferProcedureParams<TProcedure> = TProcedure extends AnyProcedure ? TProcedure["_def"] : never;
|
|
249
|
+
type inferProcedureOutput<TProcedure> = inferProcedureParams<TProcedure>["$types"]["output"];
|
|
250
|
+
interface ErrorHandlerOptions<TContext> {
|
|
251
|
+
error: TRPCError;
|
|
252
|
+
type: ProcedureType | "unknown";
|
|
253
|
+
path: string | undefined;
|
|
254
|
+
input: unknown;
|
|
255
|
+
ctx: TContext | undefined;
|
|
256
|
+
}
|
|
257
|
+
interface TRPCErrorShape<TData extends object = object> {
|
|
258
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
259
|
+
message: string;
|
|
260
|
+
data: TData;
|
|
261
|
+
}
|
|
262
|
+
declare namespace JSONRPC2 {
|
|
263
|
+
type RequestId = number | string | null;
|
|
264
|
+
/**
|
|
265
|
+
* All requests/responses extends this shape
|
|
266
|
+
*/
|
|
267
|
+
interface BaseEnvelope {
|
|
268
|
+
id?: RequestId;
|
|
269
|
+
jsonrpc?: "2.0";
|
|
270
|
+
}
|
|
271
|
+
interface BaseRequest<TMethod extends string = string> extends BaseEnvelope {
|
|
272
|
+
method: TMethod;
|
|
273
|
+
}
|
|
274
|
+
interface Request<TMethod extends string = string, TParams = unknown> extends BaseRequest<TMethod> {
|
|
275
|
+
params: TParams;
|
|
276
|
+
}
|
|
277
|
+
interface ResultResponse<TResult = unknown> extends BaseEnvelope {
|
|
278
|
+
result: TResult;
|
|
279
|
+
}
|
|
280
|
+
interface ErrorResponse<TError extends TRPCErrorShape = TRPCErrorShape> extends BaseEnvelope {
|
|
281
|
+
error: TError;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
interface TRPCResult<TData = unknown> {
|
|
285
|
+
data: TData;
|
|
286
|
+
type?: "data";
|
|
287
|
+
/**
|
|
288
|
+
* The id of the message to keep track of in case of a reconnect
|
|
289
|
+
*/
|
|
290
|
+
id?: string;
|
|
291
|
+
}
|
|
292
|
+
interface TRPCSuccessResponse<TData> extends JSONRPC2.ResultResponse<TRPCResult<TData>> {
|
|
293
|
+
}
|
|
294
|
+
interface TRPCErrorResponse<TError extends TRPCErrorShape = TRPCErrorShape> extends JSONRPC2.ErrorResponse<TError> {
|
|
295
|
+
}
|
|
296
|
+
interface TRPCResultMessage<TData> extends JSONRPC2.ResultResponse<{
|
|
297
|
+
type: "started";
|
|
298
|
+
data?: never;
|
|
299
|
+
} | {
|
|
300
|
+
type: "stopped";
|
|
301
|
+
data?: never;
|
|
302
|
+
} | TRPCResult<TData>> {
|
|
303
|
+
}
|
|
304
|
+
interface DataTransformer {
|
|
305
|
+
serialize(object: any): any;
|
|
306
|
+
deserialize(object: any): any;
|
|
307
|
+
}
|
|
308
|
+
interface InputDataTransformer extends DataTransformer {
|
|
309
|
+
/**
|
|
310
|
+
* This function runs **on the client** before sending the data to the server.
|
|
311
|
+
*/
|
|
312
|
+
serialize(object: any): any;
|
|
313
|
+
/**
|
|
314
|
+
* This function runs **on the server** to transform the data before it is passed to the resolver
|
|
315
|
+
*/
|
|
316
|
+
deserialize(object: any): any;
|
|
317
|
+
}
|
|
318
|
+
interface OutputDataTransformer extends DataTransformer {
|
|
319
|
+
/**
|
|
320
|
+
* This function runs **on the server** before sending the data to the client.
|
|
321
|
+
*/
|
|
322
|
+
serialize(object: any): any;
|
|
323
|
+
/**
|
|
324
|
+
* This function runs **only on the client** to transform the data sent from the server.
|
|
325
|
+
*/
|
|
326
|
+
deserialize(object: any): any;
|
|
327
|
+
}
|
|
328
|
+
interface CombinedDataTransformer {
|
|
329
|
+
/**
|
|
330
|
+
* Specify how the data sent from the client to the server should be transformed.
|
|
331
|
+
*/
|
|
332
|
+
input: InputDataTransformer;
|
|
333
|
+
/**
|
|
334
|
+
* Specify how the data sent from the server to the client should be transformed.
|
|
335
|
+
*/
|
|
336
|
+
output: OutputDataTransformer;
|
|
337
|
+
}
|
|
338
|
+
type ErrorFormatter<TContext, TShape extends TRPCErrorShape> = (opts: {
|
|
339
|
+
error: TRPCError;
|
|
340
|
+
type: ProcedureType | "unknown";
|
|
341
|
+
path: string | undefined;
|
|
342
|
+
input: unknown;
|
|
343
|
+
ctx: TContext | undefined;
|
|
344
|
+
shape: DefaultErrorShape;
|
|
345
|
+
}) => TShape;
|
|
346
|
+
type DefaultErrorData = {
|
|
347
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
348
|
+
httpStatus: number;
|
|
349
|
+
/**
|
|
350
|
+
* Path to the procedure that threw the error
|
|
351
|
+
*/
|
|
352
|
+
path?: string;
|
|
353
|
+
/**
|
|
354
|
+
* Stack trace of the error (only in development)
|
|
355
|
+
*/
|
|
356
|
+
stack?: string;
|
|
357
|
+
};
|
|
358
|
+
interface DefaultErrorShape extends TRPCErrorShape<DefaultErrorData> {
|
|
359
|
+
message: string;
|
|
360
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
361
|
+
}
|
|
362
|
+
type Serialize$2 = (value: any) => any;
|
|
363
|
+
type PathArray = readonly (string | number)[];
|
|
364
|
+
type ProducerOnError = (opts: {
|
|
365
|
+
error: unknown;
|
|
366
|
+
path: PathArray;
|
|
367
|
+
}) => void;
|
|
368
|
+
interface JSONLProducerOptions {
|
|
369
|
+
serialize?: Serialize$2;
|
|
370
|
+
data: Record<string, unknown> | unknown[];
|
|
371
|
+
onError?: ProducerOnError;
|
|
372
|
+
formatError?: (opts: {
|
|
373
|
+
error: unknown;
|
|
374
|
+
path: PathArray;
|
|
375
|
+
}) => unknown;
|
|
376
|
+
maxDepth?: number;
|
|
377
|
+
/**
|
|
378
|
+
* Interval in milliseconds to send a ping to the client to keep the connection alive
|
|
379
|
+
* This will be sent as a whitespace character
|
|
380
|
+
* @default undefined
|
|
381
|
+
*/
|
|
382
|
+
pingMs?: number;
|
|
383
|
+
}
|
|
384
|
+
type Serialize$1 = (value: any) => any;
|
|
385
|
+
interface SSEPingOptions {
|
|
386
|
+
/**
|
|
387
|
+
* Enable ping comments sent from the server
|
|
388
|
+
* @default false
|
|
389
|
+
*/
|
|
390
|
+
enabled: boolean;
|
|
391
|
+
/**
|
|
392
|
+
* Interval in milliseconds
|
|
393
|
+
* @default 1000
|
|
394
|
+
*/
|
|
395
|
+
intervalMs?: number;
|
|
396
|
+
}
|
|
397
|
+
interface SSEClientOptions {
|
|
398
|
+
/**
|
|
399
|
+
* Timeout and reconnect after inactivity in milliseconds
|
|
400
|
+
* @default undefined
|
|
401
|
+
*/
|
|
402
|
+
reconnectAfterInactivityMs?: number;
|
|
403
|
+
}
|
|
404
|
+
interface SSEStreamProducerOptions<TValue = unknown> {
|
|
405
|
+
serialize?: Serialize$1;
|
|
406
|
+
data: AsyncIterable<TValue>;
|
|
407
|
+
maxDepth?: number;
|
|
408
|
+
ping?: SSEPingOptions;
|
|
409
|
+
/**
|
|
410
|
+
* Maximum duration in milliseconds for the request before ending the stream
|
|
411
|
+
* @default undefined
|
|
412
|
+
*/
|
|
413
|
+
maxDurationMs?: number;
|
|
414
|
+
/**
|
|
415
|
+
* End the request immediately after data is sent
|
|
416
|
+
* Only useful for serverless runtimes that do not support streaming responses
|
|
417
|
+
* @default false
|
|
418
|
+
*/
|
|
419
|
+
emitAndEndImmediately?: boolean;
|
|
420
|
+
formatError?: (opts: {
|
|
421
|
+
error: unknown;
|
|
422
|
+
}) => unknown;
|
|
423
|
+
/**
|
|
424
|
+
* Client-specific options - these will be sent to the client as part of the first message
|
|
425
|
+
* @default {}
|
|
426
|
+
*/
|
|
427
|
+
client?: SSEClientOptions;
|
|
428
|
+
}
|
|
429
|
+
interface RootTypes {
|
|
430
|
+
ctx: object;
|
|
431
|
+
meta: object;
|
|
432
|
+
errorShape: DefaultErrorShape;
|
|
433
|
+
transformer: boolean;
|
|
434
|
+
}
|
|
435
|
+
interface RootConfig<TTypes extends RootTypes> {
|
|
436
|
+
/**
|
|
437
|
+
* The types that are used in the config
|
|
438
|
+
* @internal
|
|
439
|
+
*/
|
|
440
|
+
$types: TTypes;
|
|
441
|
+
/**
|
|
442
|
+
* Use a data transformer
|
|
443
|
+
* @see https://trpc.io/docs/v11/data-transformers
|
|
444
|
+
*/
|
|
445
|
+
transformer: CombinedDataTransformer;
|
|
446
|
+
/**
|
|
447
|
+
* Use custom error formatting
|
|
448
|
+
* @see https://trpc.io/docs/v11/error-formatting
|
|
449
|
+
*/
|
|
450
|
+
errorFormatter: ErrorFormatter<TTypes["ctx"], TTypes["errorShape"]>;
|
|
451
|
+
/**
|
|
452
|
+
* Allow `@trpc/server` to run in non-server environments
|
|
453
|
+
* @warning **Use with caution**, this should likely mainly be used within testing.
|
|
454
|
+
* @default false
|
|
455
|
+
*/
|
|
456
|
+
allowOutsideOfServer: boolean;
|
|
457
|
+
/**
|
|
458
|
+
* Is this a server environment?
|
|
459
|
+
* @warning **Use with caution**, this should likely mainly be used within testing.
|
|
460
|
+
* @default typeof window === 'undefined' || 'Deno' in window || process.env.NODE_ENV === 'test'
|
|
461
|
+
*/
|
|
462
|
+
isServer: boolean;
|
|
463
|
+
/**
|
|
464
|
+
* Is this development?
|
|
465
|
+
* Will be used to decide if the API should return stack traces
|
|
466
|
+
* @default process.env.NODE_ENV !== 'production'
|
|
467
|
+
*/
|
|
468
|
+
isDev: boolean;
|
|
469
|
+
defaultMeta?: TTypes["meta"] extends object ? TTypes["meta"] : never;
|
|
470
|
+
/**
|
|
471
|
+
* Options for server-sent events (SSE) subscriptions
|
|
472
|
+
* @see https://trpc.io/docs/client/links/httpSubscriptionLink
|
|
473
|
+
*/
|
|
474
|
+
sse?: {
|
|
475
|
+
/**
|
|
476
|
+
* Enable server-sent events (SSE) subscriptions
|
|
477
|
+
* @default true
|
|
478
|
+
*/
|
|
479
|
+
enabled?: boolean;
|
|
480
|
+
} & Pick<SSEStreamProducerOptions, "ping" | "emitAndEndImmediately" | "maxDurationMs" | "client">;
|
|
481
|
+
/**
|
|
482
|
+
* Options for batch stream
|
|
483
|
+
* @see https://trpc.io/docs/client/links/httpBatchStreamLink
|
|
484
|
+
*/
|
|
485
|
+
jsonl?: Pick<JSONLProducerOptions, "pingMs">;
|
|
486
|
+
experimental?: {};
|
|
487
|
+
}
|
|
488
|
+
type CreateRootTypes<TGenerics extends RootTypes> = TGenerics;
|
|
489
|
+
type AnyRootTypes = CreateRootTypes<{
|
|
490
|
+
ctx: any;
|
|
491
|
+
meta: any;
|
|
492
|
+
errorShape: any;
|
|
493
|
+
transformer: any;
|
|
494
|
+
}>;
|
|
495
|
+
interface RouterRecord {
|
|
496
|
+
[key: string]: AnyProcedure | RouterRecord;
|
|
497
|
+
}
|
|
498
|
+
type DecorateProcedure<TProcedure extends AnyProcedure> = (input: inferProcedureInput<TProcedure>) => Promise<TProcedure["_def"]["type"] extends "subscription" ? TProcedure extends LegacyObservableSubscriptionProcedure<any> ? Observable<inferProcedureOutput<TProcedure>, TRPCError> : inferProcedureOutput<TProcedure> : inferProcedureOutput<TProcedure>>;
|
|
499
|
+
type DecorateRouterRecord<TRecord extends RouterRecord> = {
|
|
500
|
+
[TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends AnyProcedure ? DecorateProcedure<$Value> : $Value extends RouterRecord ? DecorateRouterRecord<$Value> : never : never;
|
|
501
|
+
};
|
|
502
|
+
type RouterCallerErrorHandler<TContext> = (opts: ErrorHandlerOptions<TContext>) => void;
|
|
503
|
+
type RouterCaller<TRoot extends AnyRootTypes, TRecord extends RouterRecord> = (
|
|
504
|
+
/**
|
|
505
|
+
* @note
|
|
506
|
+
* If passing a function, we recommend it's a cached function
|
|
507
|
+
* e.g. wrapped in `React.cache` to avoid unnecessary computations
|
|
508
|
+
*/
|
|
509
|
+
ctx: TRoot["ctx"] | (() => MaybePromise<TRoot["ctx"]>), options?: {
|
|
510
|
+
onError?: RouterCallerErrorHandler<TRoot["ctx"]>;
|
|
511
|
+
signal?: AbortSignal;
|
|
512
|
+
}) => DecorateRouterRecord<TRecord>;
|
|
513
|
+
type Lazy<TAny> = (() => Promise<TAny>) & {};
|
|
514
|
+
type LazyLoader<TAny> = {
|
|
515
|
+
load: () => Promise<void>;
|
|
516
|
+
ref: Lazy<TAny>;
|
|
517
|
+
};
|
|
518
|
+
interface RouterDef<TRoot extends AnyRootTypes, TRecord extends RouterRecord> {
|
|
519
|
+
_config: RootConfig<TRoot>;
|
|
520
|
+
router: true;
|
|
521
|
+
procedure?: never;
|
|
522
|
+
procedures: TRecord;
|
|
523
|
+
record: TRecord;
|
|
524
|
+
lazy: Record<string, LazyLoader<AnyRouter>>;
|
|
525
|
+
}
|
|
526
|
+
interface Router<TRoot extends AnyRootTypes, TRecord extends RouterRecord> {
|
|
527
|
+
_def: RouterDef<TRoot, TRecord>;
|
|
528
|
+
/**
|
|
529
|
+
* @see https://trpc.io/docs/v11/server/server-side-calls
|
|
530
|
+
*/
|
|
531
|
+
createCaller: RouterCaller<TRoot, TRecord>;
|
|
532
|
+
}
|
|
533
|
+
type BuiltRouter<TRoot extends AnyRootTypes, TRecord extends RouterRecord> = Router<TRoot, TRecord> & TRecord;
|
|
534
|
+
type AnyRouter = Router<any, any>;
|
|
535
|
+
type CreateRouterOptions = {
|
|
536
|
+
[key: string]: AnyProcedure | AnyRouter | CreateRouterOptions | Lazy<AnyRouter>;
|
|
537
|
+
};
|
|
538
|
+
type DecorateCreateRouterOptions<TRouterOptions extends CreateRouterOptions> = {
|
|
539
|
+
[K in keyof TRouterOptions]: TRouterOptions[K] extends infer $Value ? $Value extends AnyProcedure ? $Value : $Value extends Router<any, infer TRecord> ? TRecord : $Value extends Lazy<Router<any, infer TRecord>> ? TRecord : $Value extends CreateRouterOptions ? DecorateCreateRouterOptions<$Value> : never : never;
|
|
540
|
+
};
|
|
541
|
+
type AnyClientTypes = Pick<AnyRootTypes, "errorShape" | "transformer">;
|
|
542
|
+
type InitLike = {
|
|
543
|
+
_config: {
|
|
544
|
+
$types: AnyClientTypes;
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
type RouterLike = {
|
|
548
|
+
_def: InitLike;
|
|
549
|
+
};
|
|
550
|
+
type RootConfigLike = {
|
|
551
|
+
$types: AnyClientTypes;
|
|
552
|
+
};
|
|
553
|
+
type InferrableClientTypes = RouterLike | InitLike | RootConfigLike | AnyClientTypes;
|
|
554
|
+
type PickTypes<T extends AnyClientTypes> = {
|
|
555
|
+
transformer: T["transformer"];
|
|
556
|
+
errorShape: T["errorShape"];
|
|
557
|
+
};
|
|
558
|
+
type inferClientTypes<TInferrable extends InferrableClientTypes> = TInferrable extends AnyClientTypes ? PickTypes<TInferrable> : TInferrable extends RootConfigLike ? PickTypes<TInferrable["$types"]> : TInferrable extends InitLike ? PickTypes<TInferrable["_config"]["$types"]> : TInferrable extends RouterLike ? PickTypes<TInferrable["_def"]["_config"]["$types"]> : never;
|
|
559
|
+
type JsonPrimitive = boolean | number | string | null;
|
|
560
|
+
type JsonArray = JsonValue[] | readonly JsonValue[];
|
|
561
|
+
type JsonObject = {
|
|
562
|
+
readonly [key: string | number]: JsonValue;
|
|
563
|
+
[key: symbol]: never;
|
|
564
|
+
};
|
|
565
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
566
|
+
type IsJson<T> = T extends JsonValue ? true : false;
|
|
567
|
+
type NonJsonPrimitive = Function | symbol | undefined;
|
|
568
|
+
type IsAny<T> = 0 extends T & 1 ? true : false;
|
|
569
|
+
type JsonReturnable = JsonPrimitive | undefined;
|
|
570
|
+
type IsRecord<T extends object> = keyof WithoutIndexSignature<T> extends never ? true : false;
|
|
571
|
+
type Serialize<T> = IsAny<T> extends true ? any : unknown extends T ? unknown : IsJson<T> extends true ? T : T extends AsyncIterable<infer $T, infer $Return, infer $Next> ? AsyncIterable<Serialize<$T>, Serialize<$Return>, Serialize<$Next>> : T extends PromiseLike<infer $T> ? Promise<Serialize<$T>> : T extends JsonReturnable ? T : T extends Map<any, any> | Set<any> ? object : T extends NonJsonPrimitive ? never : T extends {
|
|
572
|
+
toJSON(): infer U;
|
|
573
|
+
} ? U : T extends [
|
|
574
|
+
] ? [
|
|
575
|
+
] : T extends [
|
|
576
|
+
unknown,
|
|
577
|
+
...unknown[]
|
|
578
|
+
] ? SerializeTuple<T> : T extends readonly (infer U)[] ? (U extends NonJsonPrimitive ? null : Serialize<U>)[] : T extends object ? IsRecord<T> extends true ? Record<keyof T, Serialize<T[keyof T]>> : Simplify<SerializeObject<UndefinedToOptional<T>>> : never;
|
|
579
|
+
type SerializeTuple<T extends [
|
|
580
|
+
unknown,
|
|
581
|
+
...unknown[]
|
|
582
|
+
]> = {
|
|
583
|
+
[K in keyof T]: T[K] extends NonJsonPrimitive ? null : Serialize<T[K]>;
|
|
584
|
+
};
|
|
585
|
+
type SerializeObjectKey<T extends Record<any, any>, K> = K extends symbol ? never : IsAny<T[K]> extends true ? K : unknown extends T[K] ? K : T[K] extends NonJsonPrimitive ? never : K;
|
|
586
|
+
type SerializeObject<T extends object> = {
|
|
587
|
+
[K in keyof T as SerializeObjectKey<T, K>]: Serialize<T[K]>;
|
|
588
|
+
};
|
|
589
|
+
type FilterDefinedKeys<T extends object> = Exclude<{
|
|
590
|
+
[K in keyof T]: undefined extends T[K] ? never : K;
|
|
591
|
+
}[keyof T], undefined>;
|
|
592
|
+
type ExactOptionalPropertyTypes = {
|
|
593
|
+
a?: 0 | undefined;
|
|
594
|
+
} extends {
|
|
595
|
+
a?: 0;
|
|
596
|
+
} ? false : true;
|
|
597
|
+
type HasIndexSignature<T extends object> = string extends keyof T ? true : false;
|
|
598
|
+
type HandleIndexSignature<T extends object> = {
|
|
599
|
+
[K in keyof Omit<T, keyof WithoutIndexSignature<T>>]: Exclude<T[K], undefined>;
|
|
600
|
+
};
|
|
601
|
+
type HandleUndefined<T extends object> = {
|
|
602
|
+
[K in keyof Omit<T, FilterDefinedKeys<T>>]?: Exclude<T[K], undefined>;
|
|
603
|
+
};
|
|
604
|
+
type UndefinedToOptional<T extends object> = Pick<WithoutIndexSignature<T>, FilterDefinedKeys<WithoutIndexSignature<T>>> & (ExactOptionalPropertyTypes extends true ? HandleIndexSignature<T> & HandleUndefined<WithoutIndexSignature<T>> : HasIndexSignature<T> extends true ? HandleIndexSignature<T> : HandleUndefined<T>);
|
|
605
|
+
type inferTransformedProcedureOutput<TInferrable extends InferrableClientTypes, TProcedure extends AnyProcedure> = inferClientTypes<TInferrable>["transformer"] extends false ? Serialize<inferProcedureOutput<TProcedure>> : inferProcedureOutput<TProcedure>;
|
|
606
|
+
type ClientContext = Record<string, unknown>;
|
|
607
|
+
interface TRPCProcedureOptions {
|
|
608
|
+
/**
|
|
609
|
+
* Client-side context
|
|
610
|
+
*/
|
|
611
|
+
context?: ClientContext;
|
|
612
|
+
signal?: AbortSignal;
|
|
613
|
+
}
|
|
614
|
+
type inferErrorShape<TInferrable extends InferrableClientTypes> = inferClientTypes<TInferrable>["errorShape"];
|
|
615
|
+
interface TRPCClientErrorBase<TShape extends DefaultErrorShape> {
|
|
616
|
+
readonly message: string;
|
|
617
|
+
readonly shape: Maybe<TShape>;
|
|
618
|
+
readonly data: Maybe<TShape["data"]>;
|
|
619
|
+
}
|
|
620
|
+
declare class TRPCClientError<TRouterOrProcedure extends InferrableClientTypes> extends Error implements TRPCClientErrorBase<inferErrorShape<TRouterOrProcedure>> {
|
|
621
|
+
readonly cause: Error | undefined;
|
|
622
|
+
readonly shape: Maybe<inferErrorShape<TRouterOrProcedure>>;
|
|
623
|
+
readonly data: Maybe<inferErrorShape<TRouterOrProcedure>["data"]>;
|
|
624
|
+
/**
|
|
625
|
+
* Additional meta data about the error
|
|
626
|
+
* In the case of HTTP-errors, we'll have `response` and potentially `responseJSON` here
|
|
627
|
+
*/
|
|
628
|
+
meta: Record<string, unknown> | undefined;
|
|
629
|
+
constructor(message: string, opts?: {
|
|
630
|
+
result?: Maybe<TRPCErrorResponse<inferErrorShape<TRouterOrProcedure>>>;
|
|
631
|
+
cause?: Error;
|
|
632
|
+
meta?: Record<string, unknown>;
|
|
633
|
+
});
|
|
634
|
+
static from<TRouterOrProcedure extends InferrableClientTypes>(_cause: Error | TRPCErrorResponse<any> | object, opts?: {
|
|
635
|
+
meta?: Record<string, unknown>;
|
|
636
|
+
}): TRPCClientError<TRouterOrProcedure>;
|
|
637
|
+
}
|
|
638
|
+
interface OperationContext extends Record<string, unknown> {
|
|
639
|
+
}
|
|
640
|
+
type Operation<TInput = unknown> = {
|
|
641
|
+
id: number;
|
|
642
|
+
type: "mutation" | "query" | "subscription";
|
|
643
|
+
input: TInput;
|
|
644
|
+
path: string;
|
|
645
|
+
context: OperationContext;
|
|
646
|
+
signal: Maybe<AbortSignal>;
|
|
647
|
+
};
|
|
648
|
+
interface TRPCClientRuntime {
|
|
649
|
+
}
|
|
650
|
+
interface OperationResultEnvelope<TOutput, TError> {
|
|
651
|
+
result: TRPCResultMessage<TOutput>["result"] | TRPCSuccessResponse<TOutput>["result"] | TRPCConnectionState<TError>;
|
|
652
|
+
context?: OperationContext;
|
|
653
|
+
}
|
|
654
|
+
type OperationResultObservable<TInferrable extends InferrableClientTypes, TOutput> = Observable<OperationResultEnvelope<TOutput, TRPCClientError<TInferrable>>, TRPCClientError<TInferrable>>;
|
|
655
|
+
type OperationLink<TInferrable extends InferrableClientTypes, TInput = unknown, TOutput = unknown> = (opts: {
|
|
656
|
+
op: Operation<TInput>;
|
|
657
|
+
next: (op: Operation<TInput>) => OperationResultObservable<TInferrable, TOutput>;
|
|
658
|
+
}) => OperationResultObservable<TInferrable, TOutput>;
|
|
659
|
+
type TRPCLink<TInferrable extends InferrableClientTypes> = (opts: TRPCClientRuntime) => OperationLink<TInferrable>;
|
|
660
|
+
interface TRPCRequestOptions {
|
|
661
|
+
/**
|
|
662
|
+
* Pass additional context to links
|
|
663
|
+
*/
|
|
664
|
+
context?: OperationContext;
|
|
665
|
+
signal?: AbortSignal;
|
|
666
|
+
}
|
|
667
|
+
interface TRPCSubscriptionObserver<TValue, TError> {
|
|
668
|
+
onStarted: (opts: {
|
|
669
|
+
context: OperationContext | undefined;
|
|
670
|
+
}) => void;
|
|
671
|
+
onData: (value: inferAsyncIterableYield<TValue>) => void;
|
|
672
|
+
onError: (err: TError) => void;
|
|
673
|
+
onStopped: () => void;
|
|
674
|
+
onComplete: () => void;
|
|
675
|
+
onConnectionStateChange: (state: TRPCConnectionState<TError>) => void;
|
|
676
|
+
}
|
|
677
|
+
type CreateTRPCClientOptions<TRouter extends InferrableClientTypes> = {
|
|
678
|
+
links: TRPCLink<TRouter>[];
|
|
679
|
+
transformer?: TypeError$1<"The transformer property has moved to httpLink/httpBatchLink/wsLink">;
|
|
680
|
+
};
|
|
681
|
+
declare class TRPCUntypedClient<TInferrable extends InferrableClientTypes> {
|
|
682
|
+
private readonly links;
|
|
683
|
+
readonly runtime: TRPCClientRuntime;
|
|
684
|
+
private requestId;
|
|
685
|
+
constructor(opts: CreateTRPCClientOptions<TInferrable>);
|
|
686
|
+
private $request;
|
|
687
|
+
private requestAsPromise;
|
|
688
|
+
query(path: string, input?: unknown, opts?: TRPCRequestOptions): Promise<unknown>;
|
|
689
|
+
mutation(path: string, input?: unknown, opts?: TRPCRequestOptions): Promise<unknown>;
|
|
690
|
+
subscription(path: string, input: unknown, opts: Partial<TRPCSubscriptionObserver<unknown, TRPCClientError<AnyRouter>>> & TRPCRequestOptions): Unsubscribable;
|
|
691
|
+
}
|
|
692
|
+
declare const untypedClientSymbol: unique symbol;
|
|
693
|
+
type TRPCClient<TRouter extends AnyRouter> = DecoratedProcedureRecord<{
|
|
694
|
+
transformer: TRouter["_def"]["_config"]["$types"]["transformer"];
|
|
695
|
+
errorShape: TRouter["_def"]["_config"]["$types"]["errorShape"];
|
|
696
|
+
}, TRouter["_def"]["record"]> & {
|
|
697
|
+
[untypedClientSymbol]: TRPCUntypedClient<TRouter>;
|
|
698
|
+
};
|
|
699
|
+
type ResolverDef = {
|
|
700
|
+
input: any;
|
|
701
|
+
output: any;
|
|
702
|
+
transformer: boolean;
|
|
703
|
+
errorShape: any;
|
|
704
|
+
};
|
|
705
|
+
type coerceAsyncGeneratorToIterable<T> = T extends AsyncGenerator<infer $T, infer $Return, infer $Next> ? AsyncIterable<$T, $Return, $Next> : T;
|
|
706
|
+
type Resolver<TDef extends ResolverDef> = (input: TDef["input"], opts?: TRPCProcedureOptions) => Promise<coerceAsyncGeneratorToIterable<TDef["output"]>>;
|
|
707
|
+
type SubscriptionResolver<TDef extends ResolverDef> = (input: TDef["input"], opts: Partial<TRPCSubscriptionObserver<TDef["output"], TRPCClientError<TDef>>> & TRPCProcedureOptions) => Unsubscribable;
|
|
708
|
+
type DecorateProcedure$1<TType extends ProcedureType, TDef extends ResolverDef> = TType extends "query" ? {
|
|
709
|
+
query: Resolver<TDef>;
|
|
710
|
+
} : TType extends "mutation" ? {
|
|
711
|
+
mutate: Resolver<TDef>;
|
|
712
|
+
} : TType extends "subscription" ? {
|
|
713
|
+
subscribe: SubscriptionResolver<TDef>;
|
|
714
|
+
} : never;
|
|
715
|
+
type DecoratedProcedureRecord<TRoot extends InferrableClientTypes, TRecord extends RouterRecord> = {
|
|
716
|
+
[TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends AnyProcedure ? DecorateProcedure$1<$Value["_def"]["type"], {
|
|
717
|
+
input: inferProcedureInput<$Value>;
|
|
718
|
+
output: inferTransformedProcedureOutput<inferClientTypes<TRoot>, $Value>;
|
|
719
|
+
errorShape: inferClientTypes<TRoot>["errorShape"];
|
|
720
|
+
transformer: inferClientTypes<TRoot>["transformer"];
|
|
721
|
+
}> : $Value extends RouterRecord ? DecoratedProcedureRecord<TRoot, $Value> : never : never;
|
|
722
|
+
};
|
|
723
|
+
declare namespace QueryString {
|
|
724
|
+
type defaultEncoder = (str: any, defaultEncoder?: any, charset?: string) => string;
|
|
725
|
+
type defaultDecoder = (str: string, decoder?: any, charset?: string) => string;
|
|
726
|
+
type BooleanOptional = boolean | undefined;
|
|
727
|
+
interface IStringifyBaseOptions {
|
|
728
|
+
delimiter?: string | undefined;
|
|
729
|
+
strictNullHandling?: boolean | undefined;
|
|
730
|
+
skipNulls?: boolean | undefined;
|
|
731
|
+
encode?: boolean | undefined;
|
|
732
|
+
encoder?: ((str: any, defaultEncoder: defaultEncoder, charset: string, type: "key" | "value") => string) | undefined;
|
|
733
|
+
filter?: Array<string | number> | ((prefix: string, value: any) => any) | undefined;
|
|
734
|
+
arrayFormat?: "indices" | "brackets" | "repeat" | "comma" | undefined;
|
|
735
|
+
indices?: boolean | undefined;
|
|
736
|
+
sort?: ((a: string, b: string) => number) | undefined;
|
|
737
|
+
serializeDate?: ((d: Date) => string) | undefined;
|
|
738
|
+
format?: "RFC1738" | "RFC3986" | undefined;
|
|
739
|
+
encodeValuesOnly?: boolean | undefined;
|
|
740
|
+
addQueryPrefix?: boolean | undefined;
|
|
741
|
+
charset?: "utf-8" | "iso-8859-1" | undefined;
|
|
742
|
+
charsetSentinel?: boolean | undefined;
|
|
743
|
+
allowEmptyArrays?: boolean | undefined;
|
|
744
|
+
commaRoundTrip?: boolean | undefined;
|
|
745
|
+
}
|
|
746
|
+
type IStringifyDynamicOptions<AllowDots extends BooleanOptional> = AllowDots extends true ? {
|
|
747
|
+
allowDots?: AllowDots;
|
|
748
|
+
encodeDotInKeys?: boolean;
|
|
749
|
+
} : {
|
|
750
|
+
allowDots?: boolean;
|
|
751
|
+
encodeDotInKeys?: false;
|
|
752
|
+
};
|
|
753
|
+
type IStringifyOptions<AllowDots extends BooleanOptional = undefined> = IStringifyBaseOptions & IStringifyDynamicOptions<AllowDots>;
|
|
754
|
+
interface IParseBaseOptions {
|
|
755
|
+
comma?: boolean | undefined;
|
|
756
|
+
delimiter?: string | RegExp | undefined;
|
|
757
|
+
depth?: number | false | undefined;
|
|
758
|
+
decoder?: ((str: string, defaultDecoder: defaultDecoder, charset: string, type: "key" | "value") => any) | undefined;
|
|
759
|
+
arrayLimit?: number | undefined;
|
|
760
|
+
parseArrays?: boolean | undefined;
|
|
761
|
+
plainObjects?: boolean | undefined;
|
|
762
|
+
allowPrototypes?: boolean | undefined;
|
|
763
|
+
allowSparse?: boolean | undefined;
|
|
764
|
+
parameterLimit?: number | undefined;
|
|
765
|
+
strictNullHandling?: boolean | undefined;
|
|
766
|
+
ignoreQueryPrefix?: boolean | undefined;
|
|
767
|
+
charset?: "utf-8" | "iso-8859-1" | undefined;
|
|
768
|
+
charsetSentinel?: boolean | undefined;
|
|
769
|
+
interpretNumericEntities?: boolean | undefined;
|
|
770
|
+
allowEmptyArrays?: boolean | undefined;
|
|
771
|
+
duplicates?: "combine" | "first" | "last" | undefined;
|
|
772
|
+
strictDepth?: boolean | undefined;
|
|
773
|
+
throwOnLimitExceeded?: boolean | undefined;
|
|
774
|
+
}
|
|
775
|
+
type IParseDynamicOptions<AllowDots extends BooleanOptional> = AllowDots extends true ? {
|
|
776
|
+
allowDots?: AllowDots;
|
|
777
|
+
decodeDotInKeys?: boolean;
|
|
778
|
+
} : {
|
|
779
|
+
allowDots?: boolean;
|
|
780
|
+
decodeDotInKeys?: false;
|
|
781
|
+
};
|
|
782
|
+
type IParseOptions<AllowDots extends BooleanOptional = undefined> = IParseBaseOptions & IParseDynamicOptions<AllowDots>;
|
|
783
|
+
interface ParsedQs {
|
|
784
|
+
[key: string]: undefined | string | ParsedQs | (string | ParsedQs)[];
|
|
785
|
+
}
|
|
786
|
+
function stringify(obj: any, options?: IStringifyOptions<BooleanOptional>): string;
|
|
787
|
+
function parse(str: string, options?: IParseOptions<BooleanOptional> & {
|
|
788
|
+
decoder?: never | undefined;
|
|
789
|
+
}): ParsedQs;
|
|
790
|
+
function parse(str: string | Record<string, string>, options?: IParseOptions<BooleanOptional>): {
|
|
791
|
+
[key: string]: unknown;
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
declare function RangeParser(size: number, str: string, options?: RangeParser.Options): RangeParser.Result | RangeParser.Ranges;
|
|
795
|
+
declare namespace RangeParser {
|
|
796
|
+
interface Ranges extends Array<Range> {
|
|
797
|
+
type: string;
|
|
798
|
+
}
|
|
799
|
+
interface Range {
|
|
800
|
+
start: number;
|
|
801
|
+
end: number;
|
|
802
|
+
}
|
|
803
|
+
interface Options {
|
|
804
|
+
/**
|
|
805
|
+
* The "combine" option can be set to `true` and overlapping & adjacent ranges
|
|
806
|
+
* will be combined into a single range.
|
|
807
|
+
*/
|
|
808
|
+
combine?: boolean | undefined;
|
|
809
|
+
}
|
|
810
|
+
type ResultUnsatisfiable = -1;
|
|
811
|
+
type ResultInvalid = -2;
|
|
812
|
+
type Result = ResultUnsatisfiable | ResultInvalid;
|
|
813
|
+
}
|
|
814
|
+
interface NextFunction {
|
|
815
|
+
(err?: any): void;
|
|
816
|
+
/**
|
|
817
|
+
* "Break-out" of a router by calling {next('router')};
|
|
818
|
+
* @see {https://expressjs.com/en/guide/using-middleware.html#middleware.router}
|
|
819
|
+
*/
|
|
820
|
+
(deferToNext: "router"): void;
|
|
821
|
+
/**
|
|
822
|
+
* "Break-out" of a route by calling {next('route')};
|
|
823
|
+
* @see {https://expressjs.com/en/guide/using-middleware.html#middleware.application}
|
|
824
|
+
*/
|
|
825
|
+
(deferToNext: "route"): void;
|
|
826
|
+
}
|
|
827
|
+
interface ParamsDictionary {
|
|
828
|
+
[key: string]: string;
|
|
829
|
+
}
|
|
830
|
+
interface Locals extends Express.Locals {
|
|
831
|
+
}
|
|
832
|
+
interface RequestHandler<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = QueryString.ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>> {
|
|
833
|
+
// tslint:disable-next-line callable-types (This is extended from and can't extend from a type alias in ts<2.2)
|
|
834
|
+
(req: Request$1<P, ResBody, ReqBody, ReqQuery, LocalsObj>, res: Response$1<ResBody, LocalsObj>, next: NextFunction): unknown;
|
|
835
|
+
}
|
|
836
|
+
type ErrorRequestHandler<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = QueryString.ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>> = (err: any, req: Request$1<P, ResBody, ReqBody, ReqQuery, LocalsObj>, res: Response$1<ResBody, LocalsObj>, next: NextFunction) => unknown;
|
|
837
|
+
type PathParams = string | RegExp | Array<string | RegExp>;
|
|
838
|
+
type RequestHandlerParams<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = QueryString.ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>> = RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj> | ErrorRequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj> | Array<RequestHandler<P> | ErrorRequestHandler<P>>;
|
|
839
|
+
type RemoveTail<S extends string, Tail extends string> = S extends `${infer P}${Tail}` ? P : S;
|
|
840
|
+
type GetRouteParameter<S extends string> = RemoveTail<RemoveTail<RemoveTail<S, `/${string}`>, `-${string}`>, `.${string}`>;
|
|
841
|
+
type RouteParameters<Route extends string> = Route extends `${infer Required}{${infer Optional}}${infer Next}` ? ParseRouteParameters<Required> & Partial<ParseRouteParameters<Optional>> & RouteParameters<Next> : ParseRouteParameters<Route>;
|
|
842
|
+
type ParseRouteParameters<Route extends string> = string extends Route ? ParamsDictionary : Route extends `${string}(${string}` ? ParamsDictionary // TODO: handling for regex parameters
|
|
843
|
+
: Route extends `${string}:${infer Rest}` ? (GetRouteParameter<Rest> extends never ? ParamsDictionary : GetRouteParameter<Rest> extends `${infer ParamName}?` ? {
|
|
844
|
+
[P in ParamName]?: string;
|
|
845
|
+
} // TODO: Remove old `?` handling when Express 5 is promoted to "latest"
|
|
846
|
+
: {
|
|
847
|
+
[P in GetRouteParameter<Rest>]: string;
|
|
848
|
+
}) & (Rest extends `${GetRouteParameter<Rest>}${infer Next}` ? RouteParameters<Next> : unknown) : {};
|
|
849
|
+
interface IRouterMatcher<T, Method extends "all" | "get" | "post" | "put" | "delete" | "patch" | "options" | "head" = any> {
|
|
850
|
+
<Route extends string, P = RouteParameters<Route>, ResBody = any, ReqBody = any, ReqQuery = QueryString.ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>>(
|
|
851
|
+
// (it's used as the default type parameter for P)
|
|
852
|
+
path: Route,
|
|
853
|
+
// (This generic is meant to be passed explicitly.)
|
|
854
|
+
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>): T;
|
|
855
|
+
<Path extends string, P = RouteParameters<Path>, ResBody = any, ReqBody = any, ReqQuery = QueryString.ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>>(
|
|
856
|
+
// (it's used as the default type parameter for P)
|
|
857
|
+
path: Path,
|
|
858
|
+
// (This generic is meant to be passed explicitly.)
|
|
859
|
+
...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>): T;
|
|
860
|
+
<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = QueryString.ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>>(path: PathParams,
|
|
861
|
+
// (This generic is meant to be passed explicitly.)
|
|
862
|
+
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>): T;
|
|
863
|
+
<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = QueryString.ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>>(path: PathParams,
|
|
864
|
+
// (This generic is meant to be passed explicitly.)
|
|
865
|
+
...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>): T;
|
|
866
|
+
(path: PathParams, subApplication: Application): T;
|
|
867
|
+
}
|
|
868
|
+
interface IRouterHandler<T, Route extends string = string> {
|
|
869
|
+
(...handlers: Array<RequestHandler<RouteParameters<Route>>>): T;
|
|
870
|
+
(...handlers: Array<RequestHandlerParams<RouteParameters<Route>>>): T;
|
|
871
|
+
<P = RouteParameters<Route>, ResBody = any, ReqBody = any, ReqQuery = QueryString.ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>>(
|
|
872
|
+
// (This generic is meant to be passed explicitly.)
|
|
873
|
+
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
874
|
+
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>): T;
|
|
875
|
+
<P = RouteParameters<Route>, ResBody = any, ReqBody = any, ReqQuery = QueryString.ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>>(
|
|
876
|
+
// (This generic is meant to be passed explicitly.)
|
|
877
|
+
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
878
|
+
...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>): T;
|
|
879
|
+
<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = QueryString.ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>>(
|
|
880
|
+
// (This generic is meant to be passed explicitly.)
|
|
881
|
+
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
882
|
+
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>): T;
|
|
883
|
+
<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = QueryString.ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>>(
|
|
884
|
+
// (This generic is meant to be passed explicitly.)
|
|
885
|
+
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
886
|
+
...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>): T;
|
|
887
|
+
}
|
|
888
|
+
interface IRouter extends RequestHandler {
|
|
889
|
+
/**
|
|
890
|
+
* Map the given param placeholder `name`(s) to the given callback(s).
|
|
891
|
+
*
|
|
892
|
+
* Parameter mapping is used to provide pre-conditions to routes
|
|
893
|
+
* which use normalized placeholders. For example a _:user_id_ parameter
|
|
894
|
+
* could automatically load a user's information from the database without
|
|
895
|
+
* any additional code,
|
|
896
|
+
*
|
|
897
|
+
* The callback uses the samesignature as middleware, the only differencing
|
|
898
|
+
* being that the value of the placeholder is passed, in this case the _id_
|
|
899
|
+
* of the user. Once the `next()` function is invoked, just like middleware
|
|
900
|
+
* it will continue on to execute the route, or subsequent parameter functions.
|
|
901
|
+
*
|
|
902
|
+
* app.param('user_id', function(req, res, next, id){
|
|
903
|
+
* User.find(id, function(err, user){
|
|
904
|
+
* if (err) {
|
|
905
|
+
* next(err);
|
|
906
|
+
* } else if (user) {
|
|
907
|
+
* req.user = user;
|
|
908
|
+
* next();
|
|
909
|
+
* } else {
|
|
910
|
+
* next(new Error('failed to load user'));
|
|
911
|
+
* }
|
|
912
|
+
* });
|
|
913
|
+
* });
|
|
914
|
+
*/
|
|
915
|
+
param(name: string, handler: RequestParamHandler): this;
|
|
916
|
+
/**
|
|
917
|
+
* Special-cased "all" method, applying the given route `path`,
|
|
918
|
+
* middleware, and callback to _every_ HTTP method.
|
|
919
|
+
*/
|
|
920
|
+
all: IRouterMatcher<this, "all">;
|
|
921
|
+
get: IRouterMatcher<this, "get">;
|
|
922
|
+
post: IRouterMatcher<this, "post">;
|
|
923
|
+
put: IRouterMatcher<this, "put">;
|
|
924
|
+
delete: IRouterMatcher<this, "delete">;
|
|
925
|
+
patch: IRouterMatcher<this, "patch">;
|
|
926
|
+
options: IRouterMatcher<this, "options">;
|
|
927
|
+
head: IRouterMatcher<this, "head">;
|
|
928
|
+
checkout: IRouterMatcher<this>;
|
|
929
|
+
connect: IRouterMatcher<this>;
|
|
930
|
+
copy: IRouterMatcher<this>;
|
|
931
|
+
lock: IRouterMatcher<this>;
|
|
932
|
+
merge: IRouterMatcher<this>;
|
|
933
|
+
mkactivity: IRouterMatcher<this>;
|
|
934
|
+
mkcol: IRouterMatcher<this>;
|
|
935
|
+
move: IRouterMatcher<this>;
|
|
936
|
+
"m-search": IRouterMatcher<this>;
|
|
937
|
+
notify: IRouterMatcher<this>;
|
|
938
|
+
propfind: IRouterMatcher<this>;
|
|
939
|
+
proppatch: IRouterMatcher<this>;
|
|
940
|
+
purge: IRouterMatcher<this>;
|
|
941
|
+
report: IRouterMatcher<this>;
|
|
942
|
+
search: IRouterMatcher<this>;
|
|
943
|
+
subscribe: IRouterMatcher<this>;
|
|
944
|
+
trace: IRouterMatcher<this>;
|
|
945
|
+
unlock: IRouterMatcher<this>;
|
|
946
|
+
unsubscribe: IRouterMatcher<this>;
|
|
947
|
+
link: IRouterMatcher<this>;
|
|
948
|
+
unlink: IRouterMatcher<this>;
|
|
949
|
+
use: IRouterHandler<this> & IRouterMatcher<this>;
|
|
950
|
+
route<T extends string>(prefix: T): IRoute<T>;
|
|
951
|
+
route(prefix: PathParams): IRoute;
|
|
952
|
+
/**
|
|
953
|
+
* Stack of configured routes
|
|
954
|
+
*/
|
|
955
|
+
stack: ILayer[];
|
|
956
|
+
}
|
|
957
|
+
interface ILayer {
|
|
958
|
+
route?: IRoute;
|
|
959
|
+
name: string | "<anonymous>";
|
|
960
|
+
params?: Record<string, any>;
|
|
961
|
+
keys: string[];
|
|
962
|
+
path?: string;
|
|
963
|
+
method: string;
|
|
964
|
+
regexp: RegExp;
|
|
965
|
+
handle: (req: Request$1, res: Response$1, next: NextFunction) => any;
|
|
966
|
+
}
|
|
967
|
+
interface IRoute<Route extends string = string> {
|
|
968
|
+
path: string;
|
|
969
|
+
stack: ILayer[];
|
|
970
|
+
all: IRouterHandler<this, Route>;
|
|
971
|
+
get: IRouterHandler<this, Route>;
|
|
972
|
+
post: IRouterHandler<this, Route>;
|
|
973
|
+
put: IRouterHandler<this, Route>;
|
|
974
|
+
delete: IRouterHandler<this, Route>;
|
|
975
|
+
patch: IRouterHandler<this, Route>;
|
|
976
|
+
options: IRouterHandler<this, Route>;
|
|
977
|
+
head: IRouterHandler<this, Route>;
|
|
978
|
+
checkout: IRouterHandler<this, Route>;
|
|
979
|
+
copy: IRouterHandler<this, Route>;
|
|
980
|
+
lock: IRouterHandler<this, Route>;
|
|
981
|
+
merge: IRouterHandler<this, Route>;
|
|
982
|
+
mkactivity: IRouterHandler<this, Route>;
|
|
983
|
+
mkcol: IRouterHandler<this, Route>;
|
|
984
|
+
move: IRouterHandler<this, Route>;
|
|
985
|
+
"m-search": IRouterHandler<this, Route>;
|
|
986
|
+
notify: IRouterHandler<this, Route>;
|
|
987
|
+
purge: IRouterHandler<this, Route>;
|
|
988
|
+
report: IRouterHandler<this, Route>;
|
|
989
|
+
search: IRouterHandler<this, Route>;
|
|
990
|
+
subscribe: IRouterHandler<this, Route>;
|
|
991
|
+
trace: IRouterHandler<this, Route>;
|
|
992
|
+
unlock: IRouterHandler<this, Route>;
|
|
993
|
+
unsubscribe: IRouterHandler<this, Route>;
|
|
994
|
+
}
|
|
995
|
+
interface Router$1 extends IRouter {
|
|
996
|
+
}
|
|
997
|
+
interface CookieOptions {
|
|
998
|
+
/** Convenient option for setting the expiry time relative to the current time in **milliseconds**. */
|
|
999
|
+
maxAge?: number | undefined;
|
|
1000
|
+
/** Indicates if the cookie should be signed. */
|
|
1001
|
+
signed?: boolean | undefined;
|
|
1002
|
+
/** Expiry date of the cookie in GMT. If not specified (undefined), creates a session cookie. */
|
|
1003
|
+
expires?: Date | undefined;
|
|
1004
|
+
/** Flags the cookie to be accessible only by the web server. */
|
|
1005
|
+
httpOnly?: boolean | undefined;
|
|
1006
|
+
/** Path for the cookie. Defaults to “/”. */
|
|
1007
|
+
path?: string | undefined;
|
|
1008
|
+
/** Domain name for the cookie. Defaults to the domain name of the app. */
|
|
1009
|
+
domain?: string | undefined;
|
|
1010
|
+
/** Marks the cookie to be used with HTTPS only. */
|
|
1011
|
+
secure?: boolean | undefined;
|
|
1012
|
+
/** A synchronous function used for cookie value encoding. Defaults to encodeURIComponent. */
|
|
1013
|
+
encode?: ((val: string) => string) | undefined;
|
|
1014
|
+
/**
|
|
1015
|
+
* Value of the “SameSite” Set-Cookie attribute.
|
|
1016
|
+
* @link https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-4.1.1.
|
|
1017
|
+
*/
|
|
1018
|
+
sameSite?: boolean | "lax" | "strict" | "none" | undefined;
|
|
1019
|
+
/**
|
|
1020
|
+
* Value of the “Priority” Set-Cookie attribute.
|
|
1021
|
+
* @link https://datatracker.ietf.org/doc/html/draft-west-cookie-priority-00#section-4.3
|
|
1022
|
+
*/
|
|
1023
|
+
priority?: "low" | "medium" | "high";
|
|
1024
|
+
/** Marks the cookie to use partioned storage. */
|
|
1025
|
+
partitioned?: boolean | undefined;
|
|
1026
|
+
}
|
|
1027
|
+
type Errback = (err: Error) => void;
|
|
1028
|
+
interface Request$1<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = QueryString.ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>> extends http.IncomingMessage, Express.Request {
|
|
1029
|
+
/**
|
|
1030
|
+
* Return request header.
|
|
1031
|
+
*
|
|
1032
|
+
* The `Referrer` header field is special-cased,
|
|
1033
|
+
* both `Referrer` and `Referer` are interchangeable.
|
|
1034
|
+
*
|
|
1035
|
+
* Examples:
|
|
1036
|
+
*
|
|
1037
|
+
* req.get('Content-Type');
|
|
1038
|
+
* // => "text/plain"
|
|
1039
|
+
*
|
|
1040
|
+
* req.get('content-type');
|
|
1041
|
+
* // => "text/plain"
|
|
1042
|
+
*
|
|
1043
|
+
* req.get('Something');
|
|
1044
|
+
* // => undefined
|
|
1045
|
+
*
|
|
1046
|
+
* Aliased as `req.header()`.
|
|
1047
|
+
*/
|
|
1048
|
+
get(name: "set-cookie"): string[] | undefined;
|
|
1049
|
+
get(name: string): string | undefined;
|
|
1050
|
+
header(name: "set-cookie"): string[] | undefined;
|
|
1051
|
+
header(name: string): string | undefined;
|
|
1052
|
+
/**
|
|
1053
|
+
* Check if the given `type(s)` is acceptable, returning
|
|
1054
|
+
* the best match when true, otherwise `undefined`, in which
|
|
1055
|
+
* case you should respond with 406 "Not Acceptable".
|
|
1056
|
+
*
|
|
1057
|
+
* The `type` value may be a single mime type string
|
|
1058
|
+
* such as "application/json", the extension name
|
|
1059
|
+
* such as "json", a comma-delimted list such as "json, html, text/plain",
|
|
1060
|
+
* or an array `["json", "html", "text/plain"]`. When a list
|
|
1061
|
+
* or array is given the _best_ match, if any is returned.
|
|
1062
|
+
*
|
|
1063
|
+
* Examples:
|
|
1064
|
+
*
|
|
1065
|
+
* // Accept: text/html
|
|
1066
|
+
* req.accepts('html');
|
|
1067
|
+
* // => "html"
|
|
1068
|
+
*
|
|
1069
|
+
* // Accept: text/*, application/json
|
|
1070
|
+
* req.accepts('html');
|
|
1071
|
+
* // => "html"
|
|
1072
|
+
* req.accepts('text/html');
|
|
1073
|
+
* // => "text/html"
|
|
1074
|
+
* req.accepts('json, text');
|
|
1075
|
+
* // => "json"
|
|
1076
|
+
* req.accepts('application/json');
|
|
1077
|
+
* // => "application/json"
|
|
1078
|
+
*
|
|
1079
|
+
* // Accept: text/*, application/json
|
|
1080
|
+
* req.accepts('image/png');
|
|
1081
|
+
* req.accepts('png');
|
|
1082
|
+
* // => false
|
|
1083
|
+
*
|
|
1084
|
+
* // Accept: text/*;q=.5, application/json
|
|
1085
|
+
* req.accepts(['html', 'json']);
|
|
1086
|
+
* req.accepts('html, json');
|
|
1087
|
+
* // => "json"
|
|
1088
|
+
*/
|
|
1089
|
+
accepts(): string[];
|
|
1090
|
+
accepts(type: string): string | false;
|
|
1091
|
+
accepts(type: string[]): string | false;
|
|
1092
|
+
accepts(...type: string[]): string | false;
|
|
1093
|
+
/**
|
|
1094
|
+
* Returns the first accepted charset of the specified character sets,
|
|
1095
|
+
* based on the request's Accept-Charset HTTP header field.
|
|
1096
|
+
* If none of the specified charsets is accepted, returns false.
|
|
1097
|
+
*
|
|
1098
|
+
* For more information, or if you have issues or concerns, see accepts.
|
|
1099
|
+
*/
|
|
1100
|
+
acceptsCharsets(): string[];
|
|
1101
|
+
acceptsCharsets(charset: string): string | false;
|
|
1102
|
+
acceptsCharsets(charset: string[]): string | false;
|
|
1103
|
+
acceptsCharsets(...charset: string[]): string | false;
|
|
1104
|
+
/**
|
|
1105
|
+
* Returns the first accepted encoding of the specified encodings,
|
|
1106
|
+
* based on the request's Accept-Encoding HTTP header field.
|
|
1107
|
+
* If none of the specified encodings is accepted, returns false.
|
|
1108
|
+
*
|
|
1109
|
+
* For more information, or if you have issues or concerns, see accepts.
|
|
1110
|
+
*/
|
|
1111
|
+
acceptsEncodings(): string[];
|
|
1112
|
+
acceptsEncodings(encoding: string): string | false;
|
|
1113
|
+
acceptsEncodings(encoding: string[]): string | false;
|
|
1114
|
+
acceptsEncodings(...encoding: string[]): string | false;
|
|
1115
|
+
/**
|
|
1116
|
+
* Returns the first accepted language of the specified languages,
|
|
1117
|
+
* based on the request's Accept-Language HTTP header field.
|
|
1118
|
+
* If none of the specified languages is accepted, returns false.
|
|
1119
|
+
*
|
|
1120
|
+
* For more information, or if you have issues or concerns, see accepts.
|
|
1121
|
+
*/
|
|
1122
|
+
acceptsLanguages(): string[];
|
|
1123
|
+
acceptsLanguages(lang: string): string | false;
|
|
1124
|
+
acceptsLanguages(lang: string[]): string | false;
|
|
1125
|
+
acceptsLanguages(...lang: string[]): string | false;
|
|
1126
|
+
/**
|
|
1127
|
+
* Parse Range header field, capping to the given `size`.
|
|
1128
|
+
*
|
|
1129
|
+
* Unspecified ranges such as "0-" require knowledge of your resource length. In
|
|
1130
|
+
* the case of a byte range this is of course the total number of bytes.
|
|
1131
|
+
* If the Range header field is not given `undefined` is returned.
|
|
1132
|
+
* If the Range header field is given, return value is a result of range-parser.
|
|
1133
|
+
* See more ./types/range-parser/index.d.ts
|
|
1134
|
+
*
|
|
1135
|
+
* NOTE: remember that ranges are inclusive, so for example "Range: users=0-3"
|
|
1136
|
+
* should respond with 4 users when available, not 3.
|
|
1137
|
+
*/
|
|
1138
|
+
range(size: number, options?: RangeParser.RangeParserOptions): RangeParser.RangeParserRanges | RangeParser.RangeParserResult | undefined;
|
|
1139
|
+
/**
|
|
1140
|
+
* Return an array of Accepted media types
|
|
1141
|
+
* ordered from highest quality to lowest.
|
|
1142
|
+
*/
|
|
1143
|
+
accepted: MediaType[];
|
|
1144
|
+
/**
|
|
1145
|
+
* Check if the incoming request contains the "Content-Type"
|
|
1146
|
+
* header field, and it contains the give mime `type`.
|
|
1147
|
+
*
|
|
1148
|
+
* Examples:
|
|
1149
|
+
*
|
|
1150
|
+
* // With Content-Type: text/html; charset=utf-8
|
|
1151
|
+
* req.is('html');
|
|
1152
|
+
* req.is('text/html');
|
|
1153
|
+
* req.is('text/*');
|
|
1154
|
+
* // => true
|
|
1155
|
+
*
|
|
1156
|
+
* // When Content-Type is application/json
|
|
1157
|
+
* req.is('json');
|
|
1158
|
+
* req.is('application/json');
|
|
1159
|
+
* req.is('application/*');
|
|
1160
|
+
* // => true
|
|
1161
|
+
*
|
|
1162
|
+
* req.is('html');
|
|
1163
|
+
* // => false
|
|
1164
|
+
*/
|
|
1165
|
+
is(type: string | string[]): string | false | null;
|
|
1166
|
+
/**
|
|
1167
|
+
* Return the protocol string "http" or "https"
|
|
1168
|
+
* when requested with TLS. When the "trust proxy"
|
|
1169
|
+
* setting is enabled the "X-Forwarded-Proto" header
|
|
1170
|
+
* field will be trusted. If you're running behind
|
|
1171
|
+
* a reverse proxy that supplies https for you this
|
|
1172
|
+
* may be enabled.
|
|
1173
|
+
*/
|
|
1174
|
+
readonly protocol: string;
|
|
1175
|
+
/**
|
|
1176
|
+
* Short-hand for:
|
|
1177
|
+
*
|
|
1178
|
+
* req.protocol == 'https'
|
|
1179
|
+
*/
|
|
1180
|
+
readonly secure: boolean;
|
|
1181
|
+
/**
|
|
1182
|
+
* Return the remote address, or when
|
|
1183
|
+
* "trust proxy" is `true` return
|
|
1184
|
+
* the upstream addr.
|
|
1185
|
+
*
|
|
1186
|
+
* Value may be undefined if the `req.socket` is destroyed
|
|
1187
|
+
* (for example, if the client disconnected).
|
|
1188
|
+
*/
|
|
1189
|
+
readonly ip: string | undefined;
|
|
1190
|
+
/**
|
|
1191
|
+
* When "trust proxy" is `true`, parse
|
|
1192
|
+
* the "X-Forwarded-For" ip address list.
|
|
1193
|
+
*
|
|
1194
|
+
* For example if the value were "client, proxy1, proxy2"
|
|
1195
|
+
* you would receive the array `["client", "proxy1", "proxy2"]`
|
|
1196
|
+
* where "proxy2" is the furthest down-stream.
|
|
1197
|
+
*/
|
|
1198
|
+
readonly ips: string[];
|
|
1199
|
+
/**
|
|
1200
|
+
* Return subdomains as an array.
|
|
1201
|
+
*
|
|
1202
|
+
* Subdomains are the dot-separated parts of the host before the main domain of
|
|
1203
|
+
* the app. By default, the domain of the app is assumed to be the last two
|
|
1204
|
+
* parts of the host. This can be changed by setting "subdomain offset".
|
|
1205
|
+
*
|
|
1206
|
+
* For example, if the domain is "tobi.ferrets.example.com":
|
|
1207
|
+
* If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`.
|
|
1208
|
+
* If "subdomain offset" is 3, req.subdomains is `["tobi"]`.
|
|
1209
|
+
*/
|
|
1210
|
+
readonly subdomains: string[];
|
|
1211
|
+
/**
|
|
1212
|
+
* Short-hand for `url.parse(req.url).pathname`.
|
|
1213
|
+
*/
|
|
1214
|
+
readonly path: string;
|
|
1215
|
+
/**
|
|
1216
|
+
* Contains the hostname derived from the `Host` HTTP header.
|
|
1217
|
+
*/
|
|
1218
|
+
readonly hostname: string;
|
|
1219
|
+
/**
|
|
1220
|
+
* Contains the host derived from the `Host` HTTP header.
|
|
1221
|
+
*/
|
|
1222
|
+
readonly host: string;
|
|
1223
|
+
/**
|
|
1224
|
+
* Check if the request is fresh, aka
|
|
1225
|
+
* Last-Modified and/or the ETag
|
|
1226
|
+
* still match.
|
|
1227
|
+
*/
|
|
1228
|
+
readonly fresh: boolean;
|
|
1229
|
+
/**
|
|
1230
|
+
* Check if the request is stale, aka
|
|
1231
|
+
* "Last-Modified" and / or the "ETag" for the
|
|
1232
|
+
* resource has changed.
|
|
1233
|
+
*/
|
|
1234
|
+
readonly stale: boolean;
|
|
1235
|
+
/**
|
|
1236
|
+
* Check if the request was an _XMLHttpRequest_.
|
|
1237
|
+
*/
|
|
1238
|
+
readonly xhr: boolean;
|
|
1239
|
+
// body: { username: string; password: string; remember: boolean; title: string; };
|
|
1240
|
+
body: ReqBody;
|
|
1241
|
+
// cookies: { string; remember: boolean; };
|
|
1242
|
+
cookies: any;
|
|
1243
|
+
method: string;
|
|
1244
|
+
params: P;
|
|
1245
|
+
query: ReqQuery;
|
|
1246
|
+
route: any;
|
|
1247
|
+
signedCookies: any;
|
|
1248
|
+
originalUrl: string;
|
|
1249
|
+
url: string;
|
|
1250
|
+
baseUrl: string;
|
|
1251
|
+
app: Application;
|
|
1252
|
+
/**
|
|
1253
|
+
* After middleware.init executed, Request will contain res and next properties
|
|
1254
|
+
* See: express/lib/middleware/init.js
|
|
1255
|
+
*/
|
|
1256
|
+
res?: Response$1<ResBody, LocalsObj> | undefined;
|
|
1257
|
+
next?: NextFunction | undefined;
|
|
1258
|
+
}
|
|
1259
|
+
interface MediaType {
|
|
1260
|
+
value: string;
|
|
1261
|
+
quality: number;
|
|
1262
|
+
type: string;
|
|
1263
|
+
subtype: string;
|
|
1264
|
+
}
|
|
1265
|
+
type Send<ResBody = any, T = Response$1<ResBody>> = (body?: ResBody) => T;
|
|
1266
|
+
interface SendFileOptions extends SendOptions {
|
|
1267
|
+
/** Object containing HTTP headers to serve with the file. */
|
|
1268
|
+
headers?: Record<string, unknown>;
|
|
1269
|
+
}
|
|
1270
|
+
interface DownloadOptions extends SendOptions {
|
|
1271
|
+
/** Object containing HTTP headers to serve with the file. The header `Content-Disposition` will be overridden by the filename argument. */
|
|
1272
|
+
headers?: Record<string, unknown>;
|
|
1273
|
+
}
|
|
1274
|
+
interface Response$1<ResBody = any, LocalsObj extends Record<string, any> = Record<string, any>, StatusCode extends number = number> extends http.ServerResponse, Express.Response {
|
|
1275
|
+
/**
|
|
1276
|
+
* Set status `code`.
|
|
1277
|
+
*/
|
|
1278
|
+
status(code: StatusCode): this;
|
|
1279
|
+
/**
|
|
1280
|
+
* Set the response HTTP status code to `statusCode` and send its string representation as the response body.
|
|
1281
|
+
* @link http://expressjs.com/4x/api.html#res.sendStatus
|
|
1282
|
+
*
|
|
1283
|
+
* Examples:
|
|
1284
|
+
*
|
|
1285
|
+
* res.sendStatus(200); // equivalent to res.status(200).send('OK')
|
|
1286
|
+
* res.sendStatus(403); // equivalent to res.status(403).send('Forbidden')
|
|
1287
|
+
* res.sendStatus(404); // equivalent to res.status(404).send('Not Found')
|
|
1288
|
+
* res.sendStatus(500); // equivalent to res.status(500).send('Internal Server Error')
|
|
1289
|
+
*/
|
|
1290
|
+
sendStatus(code: StatusCode): this;
|
|
1291
|
+
/**
|
|
1292
|
+
* Set Link header field with the given `links`.
|
|
1293
|
+
*
|
|
1294
|
+
* Examples:
|
|
1295
|
+
*
|
|
1296
|
+
* res.links({
|
|
1297
|
+
* next: 'http://api.example.com/users?page=2',
|
|
1298
|
+
* last: 'http://api.example.com/users?page=5'
|
|
1299
|
+
* });
|
|
1300
|
+
*/
|
|
1301
|
+
links(links: any): this;
|
|
1302
|
+
/**
|
|
1303
|
+
* Send a response.
|
|
1304
|
+
*
|
|
1305
|
+
* Examples:
|
|
1306
|
+
*
|
|
1307
|
+
* res.send(new Buffer('wahoo'));
|
|
1308
|
+
* res.send({ some: 'json' });
|
|
1309
|
+
* res.send('<p>some html</p>');
|
|
1310
|
+
* res.status(404).send('Sorry, cant find that');
|
|
1311
|
+
*/
|
|
1312
|
+
send: Send<ResBody, this>;
|
|
1313
|
+
/**
|
|
1314
|
+
* Send JSON response.
|
|
1315
|
+
*
|
|
1316
|
+
* Examples:
|
|
1317
|
+
*
|
|
1318
|
+
* res.json(null);
|
|
1319
|
+
* res.json({ user: 'tj' });
|
|
1320
|
+
* res.status(500).json('oh noes!');
|
|
1321
|
+
* res.status(404).json('I dont have that');
|
|
1322
|
+
*/
|
|
1323
|
+
json: Send<ResBody, this>;
|
|
1324
|
+
/**
|
|
1325
|
+
* Send JSON response with JSONP callback support.
|
|
1326
|
+
*
|
|
1327
|
+
* Examples:
|
|
1328
|
+
*
|
|
1329
|
+
* res.jsonp(null);
|
|
1330
|
+
* res.jsonp({ user: 'tj' });
|
|
1331
|
+
* res.status(500).jsonp('oh noes!');
|
|
1332
|
+
* res.status(404).jsonp('I dont have that');
|
|
1333
|
+
*/
|
|
1334
|
+
jsonp: Send<ResBody, this>;
|
|
1335
|
+
/**
|
|
1336
|
+
* Transfer the file at the given `path`.
|
|
1337
|
+
*
|
|
1338
|
+
* Automatically sets the _Content-Type_ response header field.
|
|
1339
|
+
* The callback `fn(err)` is invoked when the transfer is complete
|
|
1340
|
+
* or when an error occurs. Be sure to check `res.headersSent`
|
|
1341
|
+
* if you wish to attempt responding, as the header and some data
|
|
1342
|
+
* may have already been transferred.
|
|
1343
|
+
*
|
|
1344
|
+
* Options:
|
|
1345
|
+
*
|
|
1346
|
+
* - `maxAge` defaulting to 0 (can be string converted by `ms`)
|
|
1347
|
+
* - `root` root directory for relative filenames
|
|
1348
|
+
* - `headers` object of headers to serve with file
|
|
1349
|
+
* - `dotfiles` serve dotfiles, defaulting to false; can be `"allow"` to send them
|
|
1350
|
+
*
|
|
1351
|
+
* Other options are passed along to `send`.
|
|
1352
|
+
*
|
|
1353
|
+
* Examples:
|
|
1354
|
+
*
|
|
1355
|
+
* The following example illustrates how `res.sendFile()` may
|
|
1356
|
+
* be used as an alternative for the `static()` middleware for
|
|
1357
|
+
* dynamic situations. The code backing `res.sendFile()` is actually
|
|
1358
|
+
* the same code, so HTTP cache support etc is identical.
|
|
1359
|
+
*
|
|
1360
|
+
* app.get('/user/:uid/photos/:file', function(req, res){
|
|
1361
|
+
* var uid = req.params.uid
|
|
1362
|
+
* , file = req.params.file;
|
|
1363
|
+
*
|
|
1364
|
+
* req.user.mayViewFilesFrom(uid, function(yes){
|
|
1365
|
+
* if (yes) {
|
|
1366
|
+
* res.sendFile('/uploads/' + uid + '/' + file);
|
|
1367
|
+
* } else {
|
|
1368
|
+
* res.send(403, 'Sorry! you cant see that.');
|
|
1369
|
+
* }
|
|
1370
|
+
* });
|
|
1371
|
+
* });
|
|
1372
|
+
*
|
|
1373
|
+
* @api public
|
|
1374
|
+
*/
|
|
1375
|
+
sendFile(path: string, fn?: Errback): void;
|
|
1376
|
+
sendFile(path: string, options: SendFileOptions, fn?: Errback): void;
|
|
1377
|
+
/**
|
|
1378
|
+
* Transfer the file at the given `path` as an attachment.
|
|
1379
|
+
*
|
|
1380
|
+
* Optionally providing an alternate attachment `filename`,
|
|
1381
|
+
* and optional callback `fn(err)`. The callback is invoked
|
|
1382
|
+
* when the data transfer is complete, or when an error has
|
|
1383
|
+
* ocurred. Be sure to check `res.headersSent` if you plan to respond.
|
|
1384
|
+
*
|
|
1385
|
+
* The optional options argument passes through to the underlying
|
|
1386
|
+
* res.sendFile() call, and takes the exact same parameters.
|
|
1387
|
+
*
|
|
1388
|
+
* This method uses `res.sendFile()`.
|
|
1389
|
+
*/
|
|
1390
|
+
download(path: string, fn?: Errback): void;
|
|
1391
|
+
download(path: string, filename: string, fn?: Errback): void;
|
|
1392
|
+
download(path: string, filename: string, options: DownloadOptions, fn?: Errback): void;
|
|
1393
|
+
/**
|
|
1394
|
+
* Set _Content-Type_ response header with `type` through `mime.lookup()`
|
|
1395
|
+
* when it does not contain "/", or set the Content-Type to `type` otherwise.
|
|
1396
|
+
*
|
|
1397
|
+
* Examples:
|
|
1398
|
+
*
|
|
1399
|
+
* res.type('.html');
|
|
1400
|
+
* res.type('html');
|
|
1401
|
+
* res.type('json');
|
|
1402
|
+
* res.type('application/json');
|
|
1403
|
+
* res.type('png');
|
|
1404
|
+
*/
|
|
1405
|
+
contentType(type: string): this;
|
|
1406
|
+
/**
|
|
1407
|
+
* Set _Content-Type_ response header with `type` through `mime.lookup()`
|
|
1408
|
+
* when it does not contain "/", or set the Content-Type to `type` otherwise.
|
|
1409
|
+
*
|
|
1410
|
+
* Examples:
|
|
1411
|
+
*
|
|
1412
|
+
* res.type('.html');
|
|
1413
|
+
* res.type('html');
|
|
1414
|
+
* res.type('json');
|
|
1415
|
+
* res.type('application/json');
|
|
1416
|
+
* res.type('png');
|
|
1417
|
+
*/
|
|
1418
|
+
type(type: string): this;
|
|
1419
|
+
/**
|
|
1420
|
+
* Respond to the Acceptable formats using an `obj`
|
|
1421
|
+
* of mime-type callbacks.
|
|
1422
|
+
*
|
|
1423
|
+
* This method uses `req.accepted`, an array of
|
|
1424
|
+
* acceptable types ordered by their quality values.
|
|
1425
|
+
* When "Accept" is not present the _first_ callback
|
|
1426
|
+
* is invoked, otherwise the first match is used. When
|
|
1427
|
+
* no match is performed the server responds with
|
|
1428
|
+
* 406 "Not Acceptable".
|
|
1429
|
+
*
|
|
1430
|
+
* Content-Type is set for you, however if you choose
|
|
1431
|
+
* you may alter this within the callback using `res.type()`
|
|
1432
|
+
* or `res.set('Content-Type', ...)`.
|
|
1433
|
+
*
|
|
1434
|
+
* res.format({
|
|
1435
|
+
* 'text/plain': function(){
|
|
1436
|
+
* res.send('hey');
|
|
1437
|
+
* },
|
|
1438
|
+
*
|
|
1439
|
+
* 'text/html': function(){
|
|
1440
|
+
* res.send('<p>hey</p>');
|
|
1441
|
+
* },
|
|
1442
|
+
*
|
|
1443
|
+
* 'appliation/json': function(){
|
|
1444
|
+
* res.send({ message: 'hey' });
|
|
1445
|
+
* }
|
|
1446
|
+
* });
|
|
1447
|
+
*
|
|
1448
|
+
* In addition to canonicalized MIME types you may
|
|
1449
|
+
* also use extnames mapped to these types:
|
|
1450
|
+
*
|
|
1451
|
+
* res.format({
|
|
1452
|
+
* text: function(){
|
|
1453
|
+
* res.send('hey');
|
|
1454
|
+
* },
|
|
1455
|
+
*
|
|
1456
|
+
* html: function(){
|
|
1457
|
+
* res.send('<p>hey</p>');
|
|
1458
|
+
* },
|
|
1459
|
+
*
|
|
1460
|
+
* json: function(){
|
|
1461
|
+
* res.send({ message: 'hey' });
|
|
1462
|
+
* }
|
|
1463
|
+
* });
|
|
1464
|
+
*
|
|
1465
|
+
* By default Express passes an `Error`
|
|
1466
|
+
* with a `.status` of 406 to `next(err)`
|
|
1467
|
+
* if a match is not made. If you provide
|
|
1468
|
+
* a `.default` callback it will be invoked
|
|
1469
|
+
* instead.
|
|
1470
|
+
*/
|
|
1471
|
+
format(obj: any): this;
|
|
1472
|
+
/**
|
|
1473
|
+
* Set _Content-Disposition_ header to _attachment_ with optional `filename`.
|
|
1474
|
+
*/
|
|
1475
|
+
attachment(filename?: string): this;
|
|
1476
|
+
/**
|
|
1477
|
+
* Set header `field` to `val`, or pass
|
|
1478
|
+
* an object of header fields.
|
|
1479
|
+
*
|
|
1480
|
+
* Examples:
|
|
1481
|
+
*
|
|
1482
|
+
* res.set('Foo', ['bar', 'baz']);
|
|
1483
|
+
* res.set('Accept', 'application/json');
|
|
1484
|
+
* res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
|
|
1485
|
+
*
|
|
1486
|
+
* Aliased as `res.header()`.
|
|
1487
|
+
*/
|
|
1488
|
+
set(field: any): this;
|
|
1489
|
+
set(field: string, value?: string | string[]): this;
|
|
1490
|
+
header(field: any): this;
|
|
1491
|
+
header(field: string, value?: string | string[]): this;
|
|
1492
|
+
// Property indicating if HTTP headers has been sent for the response.
|
|
1493
|
+
headersSent: boolean;
|
|
1494
|
+
/** Get value for header `field`. */
|
|
1495
|
+
get(field: string): string | undefined;
|
|
1496
|
+
/** Clear cookie `name`. */
|
|
1497
|
+
clearCookie(name: string, options?: CookieOptions): this;
|
|
1498
|
+
/**
|
|
1499
|
+
* Set cookie `name` to `val`, with the given `options`.
|
|
1500
|
+
*
|
|
1501
|
+
* Options:
|
|
1502
|
+
*
|
|
1503
|
+
* - `maxAge` max-age in milliseconds, converted to `expires`
|
|
1504
|
+
* - `signed` sign the cookie
|
|
1505
|
+
* - `path` defaults to "/"
|
|
1506
|
+
*
|
|
1507
|
+
* Examples:
|
|
1508
|
+
*
|
|
1509
|
+
* // "Remember Me" for 15 minutes
|
|
1510
|
+
* res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true });
|
|
1511
|
+
*
|
|
1512
|
+
* // save as above
|
|
1513
|
+
* res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true })
|
|
1514
|
+
*/
|
|
1515
|
+
cookie(name: string, val: string, options: CookieOptions): this;
|
|
1516
|
+
cookie(name: string, val: any, options: CookieOptions): this;
|
|
1517
|
+
cookie(name: string, val: any): this;
|
|
1518
|
+
/**
|
|
1519
|
+
* Set the location header to `url`.
|
|
1520
|
+
*
|
|
1521
|
+
* Examples:
|
|
1522
|
+
*
|
|
1523
|
+
* res.location('/foo/bar').;
|
|
1524
|
+
* res.location('http://example.com');
|
|
1525
|
+
* res.location('../login'); // /blog/post/1 -> /blog/login
|
|
1526
|
+
*
|
|
1527
|
+
* Mounting:
|
|
1528
|
+
*
|
|
1529
|
+
* When an application is mounted and `res.location()`
|
|
1530
|
+
* is given a path that does _not_ lead with "/" it becomes
|
|
1531
|
+
* relative to the mount-point. For example if the application
|
|
1532
|
+
* is mounted at "/blog", the following would become "/blog/login".
|
|
1533
|
+
*
|
|
1534
|
+
* res.location('login');
|
|
1535
|
+
*
|
|
1536
|
+
* While the leading slash would result in a location of "/login":
|
|
1537
|
+
*
|
|
1538
|
+
* res.location('/login');
|
|
1539
|
+
*/
|
|
1540
|
+
location(url: string): this;
|
|
1541
|
+
/**
|
|
1542
|
+
* Redirect to the given `url` with optional response `status`
|
|
1543
|
+
* defaulting to 302.
|
|
1544
|
+
*
|
|
1545
|
+
* The resulting `url` is determined by `res.location()`, so
|
|
1546
|
+
* it will play nicely with mounted apps, relative paths, etc.
|
|
1547
|
+
*
|
|
1548
|
+
* Examples:
|
|
1549
|
+
*
|
|
1550
|
+
* res.redirect('/foo/bar');
|
|
1551
|
+
* res.redirect('http://example.com');
|
|
1552
|
+
* res.redirect(301, 'http://example.com');
|
|
1553
|
+
* res.redirect('../login'); // /blog/post/1 -> /blog/login
|
|
1554
|
+
*/
|
|
1555
|
+
redirect(url: string): void;
|
|
1556
|
+
redirect(status: number, url: string): void;
|
|
1557
|
+
/**
|
|
1558
|
+
* Render `view` with the given `options` and optional callback `fn`.
|
|
1559
|
+
* When a callback function is given a response will _not_ be made
|
|
1560
|
+
* automatically, otherwise a response of _200_ and _text/html_ is given.
|
|
1561
|
+
*
|
|
1562
|
+
* Options:
|
|
1563
|
+
*
|
|
1564
|
+
* - `cache` boolean hinting to the engine it should cache
|
|
1565
|
+
* - `filename` filename of the view being rendered
|
|
1566
|
+
*/
|
|
1567
|
+
render(view: string, options?: object, callback?: (err: Error, html: string) => void): void;
|
|
1568
|
+
render(view: string, callback?: (err: Error, html: string) => void): void;
|
|
1569
|
+
locals: LocalsObj & Locals;
|
|
1570
|
+
charset: string;
|
|
1571
|
+
/**
|
|
1572
|
+
* Adds the field to the Vary response header, if it is not there already.
|
|
1573
|
+
* Examples:
|
|
1574
|
+
*
|
|
1575
|
+
* res.vary('User-Agent').render('docs');
|
|
1576
|
+
*/
|
|
1577
|
+
vary(field: string): this;
|
|
1578
|
+
app: Application;
|
|
1579
|
+
/**
|
|
1580
|
+
* Appends the specified value to the HTTP response header field.
|
|
1581
|
+
* If the header is not already set, it creates the header with the specified value.
|
|
1582
|
+
* The value parameter can be a string or an array.
|
|
1583
|
+
*
|
|
1584
|
+
* Note: calling res.set() after res.append() will reset the previously-set header value.
|
|
1585
|
+
*
|
|
1586
|
+
* @since 4.11.0
|
|
1587
|
+
*/
|
|
1588
|
+
append(field: string, value?: string[] | string): this;
|
|
1589
|
+
/**
|
|
1590
|
+
* After middleware.init executed, Response will contain req property
|
|
1591
|
+
* See: express/lib/middleware/init.js
|
|
1592
|
+
*/
|
|
1593
|
+
req: Request$1;
|
|
1594
|
+
}
|
|
1595
|
+
type RequestParamHandler = (req: Request$1, res: Response$1, next: NextFunction, value: any, name: string) => any;
|
|
1596
|
+
type ApplicationRequestHandler<T> = IRouterHandler<T> & IRouterMatcher<T> & ((...handlers: RequestHandlerParams[]) => T);
|
|
1597
|
+
interface Application<LocalsObj extends Record<string, any> = Record<string, any>> extends EventEmitter, IRouter, Express.Application {
|
|
1598
|
+
/**
|
|
1599
|
+
* Express instance itself is a request handler, which could be invoked without
|
|
1600
|
+
* third argument.
|
|
1601
|
+
*/
|
|
1602
|
+
(req: Request$1 | http.IncomingMessage, res: Response$1 | http.ServerResponse): any;
|
|
1603
|
+
/**
|
|
1604
|
+
* Initialize the server.
|
|
1605
|
+
*
|
|
1606
|
+
* - setup default configuration
|
|
1607
|
+
* - setup default middleware
|
|
1608
|
+
* - setup route reflection methods
|
|
1609
|
+
*/
|
|
1610
|
+
init(): void;
|
|
1611
|
+
/**
|
|
1612
|
+
* Initialize application configuration.
|
|
1613
|
+
*/
|
|
1614
|
+
defaultConfiguration(): void;
|
|
1615
|
+
/**
|
|
1616
|
+
* Register the given template engine callback `fn`
|
|
1617
|
+
* as `ext`.
|
|
1618
|
+
*
|
|
1619
|
+
* By default will `require()` the engine based on the
|
|
1620
|
+
* file extension. For example if you try to render
|
|
1621
|
+
* a "foo.jade" file Express will invoke the following internally:
|
|
1622
|
+
*
|
|
1623
|
+
* app.engine('jade', require('jade').__express);
|
|
1624
|
+
*
|
|
1625
|
+
* For engines that do not provide `.__express` out of the box,
|
|
1626
|
+
* or if you wish to "map" a different extension to the template engine
|
|
1627
|
+
* you may use this method. For example mapping the EJS template engine to
|
|
1628
|
+
* ".html" files:
|
|
1629
|
+
*
|
|
1630
|
+
* app.engine('html', require('ejs').renderFile);
|
|
1631
|
+
*
|
|
1632
|
+
* In this case EJS provides a `.renderFile()` method with
|
|
1633
|
+
* the same signature that Express expects: `(path, options, callback)`,
|
|
1634
|
+
* though note that it aliases this method as `ejs.__express` internally
|
|
1635
|
+
* so if you're using ".ejs" extensions you dont need to do anything.
|
|
1636
|
+
*
|
|
1637
|
+
* Some template engines do not follow this convention, the
|
|
1638
|
+
* [Consolidate.js](https://github.com/visionmedia/consolidate.js)
|
|
1639
|
+
* library was created to map all of node's popular template
|
|
1640
|
+
* engines to follow this convention, thus allowing them to
|
|
1641
|
+
* work seamlessly within Express.
|
|
1642
|
+
*/
|
|
1643
|
+
engine(ext: string, fn: (path: string, options: object, callback: (e: any, rendered?: string) => void) => void): this;
|
|
1644
|
+
/**
|
|
1645
|
+
* Assign `setting` to `val`, or return `setting`'s value.
|
|
1646
|
+
*
|
|
1647
|
+
* app.set('foo', 'bar');
|
|
1648
|
+
* app.get('foo');
|
|
1649
|
+
* // => "bar"
|
|
1650
|
+
* app.set('foo', ['bar', 'baz']);
|
|
1651
|
+
* app.get('foo');
|
|
1652
|
+
* // => ["bar", "baz"]
|
|
1653
|
+
*
|
|
1654
|
+
* Mounted servers inherit their parent server's settings.
|
|
1655
|
+
*/
|
|
1656
|
+
set(setting: string, val: any): this;
|
|
1657
|
+
get: ((name: string) => any) & IRouterMatcher<this>;
|
|
1658
|
+
param(name: string | string[], handler: RequestParamHandler): this;
|
|
1659
|
+
/**
|
|
1660
|
+
* Return the app's absolute pathname
|
|
1661
|
+
* based on the parent(s) that have
|
|
1662
|
+
* mounted it.
|
|
1663
|
+
*
|
|
1664
|
+
* For example if the application was
|
|
1665
|
+
* mounted as "/admin", which itself
|
|
1666
|
+
* was mounted as "/blog" then the
|
|
1667
|
+
* return value would be "/blog/admin".
|
|
1668
|
+
*/
|
|
1669
|
+
path(): string;
|
|
1670
|
+
/**
|
|
1671
|
+
* Check if `setting` is enabled (truthy).
|
|
1672
|
+
*
|
|
1673
|
+
* app.enabled('foo')
|
|
1674
|
+
* // => false
|
|
1675
|
+
*
|
|
1676
|
+
* app.enable('foo')
|
|
1677
|
+
* app.enabled('foo')
|
|
1678
|
+
* // => true
|
|
1679
|
+
*/
|
|
1680
|
+
enabled(setting: string): boolean;
|
|
1681
|
+
/**
|
|
1682
|
+
* Check if `setting` is disabled.
|
|
1683
|
+
*
|
|
1684
|
+
* app.disabled('foo')
|
|
1685
|
+
* // => true
|
|
1686
|
+
*
|
|
1687
|
+
* app.enable('foo')
|
|
1688
|
+
* app.disabled('foo')
|
|
1689
|
+
* // => false
|
|
1690
|
+
*/
|
|
1691
|
+
disabled(setting: string): boolean;
|
|
1692
|
+
/** Enable `setting`. */
|
|
1693
|
+
enable(setting: string): this;
|
|
1694
|
+
/** Disable `setting`. */
|
|
1695
|
+
disable(setting: string): this;
|
|
1696
|
+
/**
|
|
1697
|
+
* Render the given view `name` name with `options`
|
|
1698
|
+
* and a callback accepting an error and the
|
|
1699
|
+
* rendered template string.
|
|
1700
|
+
*
|
|
1701
|
+
* Example:
|
|
1702
|
+
*
|
|
1703
|
+
* app.render('email', { name: 'Tobi' }, function(err, html){
|
|
1704
|
+
* // ...
|
|
1705
|
+
* })
|
|
1706
|
+
*/
|
|
1707
|
+
render(name: string, options?: object, callback?: (err: Error, html: string) => void): void;
|
|
1708
|
+
render(name: string, callback: (err: Error, html: string) => void): void;
|
|
1709
|
+
/**
|
|
1710
|
+
* Listen for connections.
|
|
1711
|
+
*
|
|
1712
|
+
* A node `http.Server` is returned, with this
|
|
1713
|
+
* application (which is a `Function`) as its
|
|
1714
|
+
* callback. If you wish to create both an HTTP
|
|
1715
|
+
* and HTTPS server you may do so with the "http"
|
|
1716
|
+
* and "https" modules as shown here:
|
|
1717
|
+
*
|
|
1718
|
+
* var http = require('http')
|
|
1719
|
+
* , https = require('https')
|
|
1720
|
+
* , express = require('express')
|
|
1721
|
+
* , app = express();
|
|
1722
|
+
*
|
|
1723
|
+
* http.createServer(app).listen(80);
|
|
1724
|
+
* https.createServer({ ... }, app).listen(443);
|
|
1725
|
+
*/
|
|
1726
|
+
listen(port: number, hostname: string, backlog: number, callback?: (error?: Error) => void): http.Server;
|
|
1727
|
+
listen(port: number, hostname: string, callback?: (error?: Error) => void): http.Server;
|
|
1728
|
+
listen(port: number, callback?: (error?: Error) => void): http.Server;
|
|
1729
|
+
listen(callback?: (error?: Error) => void): http.Server;
|
|
1730
|
+
listen(path: string, callback?: (error?: Error) => void): http.Server;
|
|
1731
|
+
listen(handle: any, listeningListener?: (error?: Error) => void): http.Server;
|
|
1732
|
+
router: Router$1;
|
|
1733
|
+
settings: any;
|
|
1734
|
+
resource: any;
|
|
1735
|
+
map: any;
|
|
1736
|
+
locals: LocalsObj & Locals;
|
|
1737
|
+
/**
|
|
1738
|
+
* The app.routes object houses all of the routes defined mapped by the
|
|
1739
|
+
* associated HTTP verb. This object may be used for introspection
|
|
1740
|
+
* capabilities, for example Express uses this internally not only for
|
|
1741
|
+
* routing but to provide default OPTIONS behaviour unless app.options()
|
|
1742
|
+
* is used. Your application or framework may also remove routes by
|
|
1743
|
+
* simply by removing them from this object.
|
|
1744
|
+
*/
|
|
1745
|
+
routes: any;
|
|
1746
|
+
/**
|
|
1747
|
+
* Used to get all registered routes in Express Application
|
|
1748
|
+
*/
|
|
1749
|
+
_router: any;
|
|
1750
|
+
use: ApplicationRequestHandler<this>;
|
|
1751
|
+
/**
|
|
1752
|
+
* The mount event is fired on a sub-app, when it is mounted on a parent app.
|
|
1753
|
+
* The parent app is passed to the callback function.
|
|
1754
|
+
*
|
|
1755
|
+
* NOTE:
|
|
1756
|
+
* Sub-apps will:
|
|
1757
|
+
* - Not inherit the value of settings that have a default value. You must set the value in the sub-app.
|
|
1758
|
+
* - Inherit the value of settings with no default value.
|
|
1759
|
+
*/
|
|
1760
|
+
on: (event: "mount", callback: (parent: Application) => void) => this;
|
|
1761
|
+
/**
|
|
1762
|
+
* The app.mountpath property contains one or more path patterns on which a sub-app was mounted.
|
|
1763
|
+
*/
|
|
1764
|
+
mountpath: string | string[];
|
|
1765
|
+
}
|
|
7
1766
|
declare const ROLES: readonly [
|
|
8
1767
|
":admin",
|
|
9
1768
|
"view:users",
|
|
@@ -43,7 +1802,7 @@ declare const ROLES: readonly [
|
|
|
43
1802
|
"manage:customers",
|
|
44
1803
|
"delete:customers"
|
|
45
1804
|
];
|
|
46
|
-
|
|
1805
|
+
type Role = (typeof ROLES)[number];
|
|
47
1806
|
declare namespace auth {
|
|
48
1807
|
const JWT_ALG: "HS512";
|
|
49
1808
|
class AuthResult {
|
|
@@ -253,50 +2012,50 @@ declare namespace error {
|
|
|
253
2012
|
function statusCodeText(statusCode: StatusCode): string;
|
|
254
2013
|
}
|
|
255
2014
|
}
|
|
256
|
-
|
|
2015
|
+
type TrpcContext = {
|
|
257
2016
|
req: Request$1;
|
|
258
2017
|
res: Response$1;
|
|
259
2018
|
authResult?: auth.AuthResult;
|
|
260
2019
|
adminFor?: "+all" | string;
|
|
261
2020
|
};
|
|
262
|
-
declare const appRouter:
|
|
2021
|
+
declare const appRouter: BuiltRouter<{
|
|
263
2022
|
ctx: TrpcContext;
|
|
264
2023
|
meta: object;
|
|
265
|
-
errorShape:
|
|
2024
|
+
errorShape: DefaultErrorShape | {
|
|
266
2025
|
message: string;
|
|
267
2026
|
data: {
|
|
268
2027
|
httpCode: error.http.StatusCodeCode;
|
|
269
|
-
code:
|
|
2028
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
270
2029
|
httpStatus: number;
|
|
271
2030
|
path?: string;
|
|
272
2031
|
stack?: string;
|
|
273
2032
|
};
|
|
274
|
-
code:
|
|
2033
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
275
2034
|
};
|
|
276
2035
|
transformer: true;
|
|
277
|
-
},
|
|
278
|
-
ping:
|
|
2036
|
+
}, DecorateCreateRouterOptions<{
|
|
2037
|
+
ping: QueryProcedure<{
|
|
279
2038
|
input: void;
|
|
280
2039
|
output: string;
|
|
281
2040
|
meta: object;
|
|
282
2041
|
}>;
|
|
283
|
-
auth:
|
|
2042
|
+
auth: BuiltRouter<{
|
|
284
2043
|
ctx: TrpcContext;
|
|
285
2044
|
meta: object;
|
|
286
|
-
errorShape:
|
|
2045
|
+
errorShape: DefaultErrorShape | {
|
|
287
2046
|
message: string;
|
|
288
2047
|
data: {
|
|
289
2048
|
httpCode: error.http.StatusCodeCode;
|
|
290
|
-
code:
|
|
2049
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
291
2050
|
httpStatus: number;
|
|
292
2051
|
path?: string;
|
|
293
2052
|
stack?: string;
|
|
294
2053
|
};
|
|
295
|
-
code:
|
|
2054
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
296
2055
|
};
|
|
297
2056
|
transformer: true;
|
|
298
|
-
},
|
|
299
|
-
login:
|
|
2057
|
+
}, DecorateCreateRouterOptions<{
|
|
2058
|
+
login: MutationProcedure<{
|
|
300
2059
|
input: {
|
|
301
2060
|
tenant: string;
|
|
302
2061
|
username: string;
|
|
@@ -307,21 +2066,21 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
307
2066
|
};
|
|
308
2067
|
meta: object;
|
|
309
2068
|
}>;
|
|
310
|
-
logout:
|
|
2069
|
+
logout: MutationProcedure<{
|
|
311
2070
|
input: void;
|
|
312
2071
|
output: {
|
|
313
2072
|
success: true;
|
|
314
2073
|
};
|
|
315
2074
|
meta: object;
|
|
316
2075
|
}>;
|
|
317
|
-
check:
|
|
2076
|
+
check: QueryProcedure<{
|
|
318
2077
|
input: void;
|
|
319
2078
|
output: {
|
|
320
2079
|
success: true;
|
|
321
2080
|
};
|
|
322
2081
|
meta: object;
|
|
323
2082
|
}>;
|
|
324
|
-
sessionInfo:
|
|
2083
|
+
sessionInfo: QueryProcedure<{
|
|
325
2084
|
input: void;
|
|
326
2085
|
output: {
|
|
327
2086
|
user: {
|
|
@@ -345,7 +2104,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
345
2104
|
};
|
|
346
2105
|
meta: object;
|
|
347
2106
|
}>;
|
|
348
|
-
setPassword:
|
|
2107
|
+
setPassword: MutationProcedure<{
|
|
349
2108
|
input: {
|
|
350
2109
|
username: string;
|
|
351
2110
|
password: string;
|
|
@@ -356,23 +2115,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
356
2115
|
meta: object;
|
|
357
2116
|
}>;
|
|
358
2117
|
}>>;
|
|
359
|
-
admin:
|
|
2118
|
+
admin: BuiltRouter<{
|
|
360
2119
|
ctx: TrpcContext;
|
|
361
2120
|
meta: object;
|
|
362
|
-
errorShape:
|
|
2121
|
+
errorShape: DefaultErrorShape | {
|
|
363
2122
|
message: string;
|
|
364
2123
|
data: {
|
|
365
2124
|
httpCode: error.http.StatusCodeCode;
|
|
366
|
-
code:
|
|
2125
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
367
2126
|
httpStatus: number;
|
|
368
2127
|
path?: string;
|
|
369
2128
|
stack?: string;
|
|
370
2129
|
};
|
|
371
|
-
code:
|
|
2130
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
372
2131
|
};
|
|
373
2132
|
transformer: true;
|
|
374
|
-
},
|
|
375
|
-
login:
|
|
2133
|
+
}, DecorateCreateRouterOptions<{
|
|
2134
|
+
login: MutationProcedure<{
|
|
376
2135
|
input: {
|
|
377
2136
|
password: string;
|
|
378
2137
|
tenant?: string | null | undefined;
|
|
@@ -382,23 +2141,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
382
2141
|
};
|
|
383
2142
|
meta: object;
|
|
384
2143
|
}>;
|
|
385
|
-
tenants:
|
|
2144
|
+
tenants: BuiltRouter<{
|
|
386
2145
|
ctx: TrpcContext;
|
|
387
2146
|
meta: object;
|
|
388
|
-
errorShape:
|
|
2147
|
+
errorShape: DefaultErrorShape | {
|
|
389
2148
|
message: string;
|
|
390
2149
|
data: {
|
|
391
2150
|
httpCode: error.http.StatusCodeCode;
|
|
392
|
-
code:
|
|
2151
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
393
2152
|
httpStatus: number;
|
|
394
2153
|
path?: string;
|
|
395
2154
|
stack?: string;
|
|
396
2155
|
};
|
|
397
|
-
code:
|
|
2156
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
398
2157
|
};
|
|
399
2158
|
transformer: true;
|
|
400
|
-
},
|
|
401
|
-
list:
|
|
2159
|
+
}, DecorateCreateRouterOptions<{
|
|
2160
|
+
list: QueryProcedure<{
|
|
402
2161
|
input: void;
|
|
403
2162
|
output: {
|
|
404
2163
|
name: string;
|
|
@@ -434,7 +2193,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
434
2193
|
}[];
|
|
435
2194
|
meta: object;
|
|
436
2195
|
}>;
|
|
437
|
-
create:
|
|
2196
|
+
create: MutationProcedure<{
|
|
438
2197
|
input: {
|
|
439
2198
|
name: string;
|
|
440
2199
|
contact_details: {
|
|
@@ -469,7 +2228,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
469
2228
|
};
|
|
470
2229
|
meta: object;
|
|
471
2230
|
}>;
|
|
472
|
-
get:
|
|
2231
|
+
get: QueryProcedure<{
|
|
473
2232
|
input: {
|
|
474
2233
|
name: string;
|
|
475
2234
|
};
|
|
@@ -507,7 +2266,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
507
2266
|
};
|
|
508
2267
|
meta: object;
|
|
509
2268
|
}>;
|
|
510
|
-
update:
|
|
2269
|
+
update: MutationProcedure<{
|
|
511
2270
|
input: {
|
|
512
2271
|
name: string;
|
|
513
2272
|
data: {
|
|
@@ -544,7 +2303,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
544
2303
|
};
|
|
545
2304
|
meta: object;
|
|
546
2305
|
}>;
|
|
547
|
-
activate:
|
|
2306
|
+
activate: MutationProcedure<{
|
|
548
2307
|
input: {
|
|
549
2308
|
name: string;
|
|
550
2309
|
};
|
|
@@ -553,7 +2312,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
553
2312
|
};
|
|
554
2313
|
meta: object;
|
|
555
2314
|
}>;
|
|
556
|
-
deactivate:
|
|
2315
|
+
deactivate: MutationProcedure<{
|
|
557
2316
|
input: {
|
|
558
2317
|
name: string;
|
|
559
2318
|
};
|
|
@@ -562,7 +2321,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
562
2321
|
};
|
|
563
2322
|
meta: object;
|
|
564
2323
|
}>;
|
|
565
|
-
delete:
|
|
2324
|
+
delete: MutationProcedure<{
|
|
566
2325
|
input: {
|
|
567
2326
|
name: string;
|
|
568
2327
|
};
|
|
@@ -571,7 +2330,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
571
2330
|
};
|
|
572
2331
|
meta: object;
|
|
573
2332
|
}>;
|
|
574
|
-
deleteForever:
|
|
2333
|
+
deleteForever: MutationProcedure<{
|
|
575
2334
|
input: {
|
|
576
2335
|
name: string;
|
|
577
2336
|
};
|
|
@@ -580,7 +2339,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
580
2339
|
};
|
|
581
2340
|
meta: object;
|
|
582
2341
|
}>;
|
|
583
|
-
lock:
|
|
2342
|
+
lock: MutationProcedure<{
|
|
584
2343
|
input: {
|
|
585
2344
|
name: string;
|
|
586
2345
|
};
|
|
@@ -589,7 +2348,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
589
2348
|
};
|
|
590
2349
|
meta: object;
|
|
591
2350
|
}>;
|
|
592
|
-
unlock:
|
|
2351
|
+
unlock: MutationProcedure<{
|
|
593
2352
|
input: {
|
|
594
2353
|
name: string;
|
|
595
2354
|
};
|
|
@@ -598,7 +2357,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
598
2357
|
};
|
|
599
2358
|
meta: object;
|
|
600
2359
|
}>;
|
|
601
|
-
undelete:
|
|
2360
|
+
undelete: MutationProcedure<{
|
|
602
2361
|
input: {
|
|
603
2362
|
name: string;
|
|
604
2363
|
};
|
|
@@ -609,23 +2368,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
609
2368
|
}>;
|
|
610
2369
|
}>>;
|
|
611
2370
|
}>>;
|
|
612
|
-
customers:
|
|
2371
|
+
customers: BuiltRouter<{
|
|
613
2372
|
ctx: TrpcContext;
|
|
614
2373
|
meta: object;
|
|
615
|
-
errorShape:
|
|
2374
|
+
errorShape: DefaultErrorShape | {
|
|
616
2375
|
message: string;
|
|
617
2376
|
data: {
|
|
618
2377
|
httpCode: error.http.StatusCodeCode;
|
|
619
|
-
code:
|
|
2378
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
620
2379
|
httpStatus: number;
|
|
621
2380
|
path?: string;
|
|
622
2381
|
stack?: string;
|
|
623
2382
|
};
|
|
624
|
-
code:
|
|
2383
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
625
2384
|
};
|
|
626
2385
|
transformer: true;
|
|
627
|
-
},
|
|
628
|
-
list:
|
|
2386
|
+
}, DecorateCreateRouterOptions<{
|
|
2387
|
+
list: QueryProcedure<{
|
|
629
2388
|
input: {
|
|
630
2389
|
search?: string | null | undefined;
|
|
631
2390
|
};
|
|
@@ -644,7 +2403,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
644
2403
|
}[];
|
|
645
2404
|
meta: object;
|
|
646
2405
|
}>;
|
|
647
|
-
get:
|
|
2406
|
+
get: QueryProcedure<{
|
|
648
2407
|
input: {
|
|
649
2408
|
id: string;
|
|
650
2409
|
};
|
|
@@ -663,7 +2422,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
663
2422
|
};
|
|
664
2423
|
meta: object;
|
|
665
2424
|
}>;
|
|
666
|
-
create:
|
|
2425
|
+
create: MutationProcedure<{
|
|
667
2426
|
input: {
|
|
668
2427
|
name: string;
|
|
669
2428
|
salutation?: string | null | undefined;
|
|
@@ -679,7 +2438,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
679
2438
|
};
|
|
680
2439
|
meta: object;
|
|
681
2440
|
}>;
|
|
682
|
-
update:
|
|
2441
|
+
update: MutationProcedure<{
|
|
683
2442
|
input: {
|
|
684
2443
|
id: string;
|
|
685
2444
|
data: {
|
|
@@ -698,7 +2457,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
698
2457
|
};
|
|
699
2458
|
meta: object;
|
|
700
2459
|
}>;
|
|
701
|
-
delete:
|
|
2460
|
+
delete: MutationProcedure<{
|
|
702
2461
|
input: {
|
|
703
2462
|
id: string;
|
|
704
2463
|
};
|
|
@@ -707,23 +2466,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
707
2466
|
};
|
|
708
2467
|
meta: object;
|
|
709
2468
|
}>;
|
|
710
|
-
contacts:
|
|
2469
|
+
contacts: BuiltRouter<{
|
|
711
2470
|
ctx: TrpcContext;
|
|
712
2471
|
meta: object;
|
|
713
|
-
errorShape:
|
|
2472
|
+
errorShape: DefaultErrorShape | {
|
|
714
2473
|
message: string;
|
|
715
2474
|
data: {
|
|
716
2475
|
httpCode: error.http.StatusCodeCode;
|
|
717
|
-
code:
|
|
2476
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
718
2477
|
httpStatus: number;
|
|
719
2478
|
path?: string;
|
|
720
2479
|
stack?: string;
|
|
721
2480
|
};
|
|
722
|
-
code:
|
|
2481
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
723
2482
|
};
|
|
724
2483
|
transformer: true;
|
|
725
|
-
},
|
|
726
|
-
list:
|
|
2484
|
+
}, DecorateCreateRouterOptions<{
|
|
2485
|
+
list: QueryProcedure<{
|
|
727
2486
|
input: {
|
|
728
2487
|
customerId: string;
|
|
729
2488
|
};
|
|
@@ -744,7 +2503,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
744
2503
|
}[];
|
|
745
2504
|
meta: object;
|
|
746
2505
|
}>;
|
|
747
|
-
add:
|
|
2506
|
+
add: MutationProcedure<{
|
|
748
2507
|
input: {
|
|
749
2508
|
customerId: string;
|
|
750
2509
|
contactId: string;
|
|
@@ -754,7 +2513,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
754
2513
|
};
|
|
755
2514
|
meta: object;
|
|
756
2515
|
}>;
|
|
757
|
-
remove:
|
|
2516
|
+
remove: MutationProcedure<{
|
|
758
2517
|
input: {
|
|
759
2518
|
customerId: string;
|
|
760
2519
|
contactId: string;
|
|
@@ -766,23 +2525,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
766
2525
|
}>;
|
|
767
2526
|
}>>;
|
|
768
2527
|
}>>;
|
|
769
|
-
projects:
|
|
2528
|
+
projects: BuiltRouter<{
|
|
770
2529
|
ctx: TrpcContext;
|
|
771
2530
|
meta: object;
|
|
772
|
-
errorShape:
|
|
2531
|
+
errorShape: DefaultErrorShape | {
|
|
773
2532
|
message: string;
|
|
774
2533
|
data: {
|
|
775
2534
|
httpCode: error.http.StatusCodeCode;
|
|
776
|
-
code:
|
|
2535
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
777
2536
|
httpStatus: number;
|
|
778
2537
|
path?: string;
|
|
779
2538
|
stack?: string;
|
|
780
2539
|
};
|
|
781
|
-
code:
|
|
2540
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
782
2541
|
};
|
|
783
2542
|
transformer: true;
|
|
784
|
-
},
|
|
785
|
-
list:
|
|
2543
|
+
}, DecorateCreateRouterOptions<{
|
|
2544
|
+
list: QueryProcedure<{
|
|
786
2545
|
input: {
|
|
787
2546
|
search?: string | null | undefined;
|
|
788
2547
|
finished?: boolean | null | undefined;
|
|
@@ -803,7 +2562,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
803
2562
|
}[];
|
|
804
2563
|
meta: object;
|
|
805
2564
|
}>;
|
|
806
|
-
get:
|
|
2565
|
+
get: QueryProcedure<{
|
|
807
2566
|
input: {
|
|
808
2567
|
id: string;
|
|
809
2568
|
};
|
|
@@ -823,7 +2582,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
823
2582
|
};
|
|
824
2583
|
meta: object;
|
|
825
2584
|
}>;
|
|
826
|
-
create:
|
|
2585
|
+
create: MutationProcedure<{
|
|
827
2586
|
input: {
|
|
828
2587
|
title: string;
|
|
829
2588
|
address?: {
|
|
@@ -839,7 +2598,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
839
2598
|
};
|
|
840
2599
|
meta: object;
|
|
841
2600
|
}>;
|
|
842
|
-
update:
|
|
2601
|
+
update: MutationProcedure<{
|
|
843
2602
|
input: {
|
|
844
2603
|
id: string;
|
|
845
2604
|
data: {
|
|
@@ -858,7 +2617,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
858
2617
|
};
|
|
859
2618
|
meta: object;
|
|
860
2619
|
}>;
|
|
861
|
-
finish:
|
|
2620
|
+
finish: MutationProcedure<{
|
|
862
2621
|
input: {
|
|
863
2622
|
id: string;
|
|
864
2623
|
};
|
|
@@ -867,7 +2626,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
867
2626
|
};
|
|
868
2627
|
meta: object;
|
|
869
2628
|
}>;
|
|
870
|
-
resume:
|
|
2629
|
+
resume: MutationProcedure<{
|
|
871
2630
|
input: {
|
|
872
2631
|
id: string;
|
|
873
2632
|
};
|
|
@@ -876,7 +2635,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
876
2635
|
};
|
|
877
2636
|
meta: object;
|
|
878
2637
|
}>;
|
|
879
|
-
delete:
|
|
2638
|
+
delete: MutationProcedure<{
|
|
880
2639
|
input: {
|
|
881
2640
|
id: string;
|
|
882
2641
|
};
|
|
@@ -885,23 +2644,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
885
2644
|
};
|
|
886
2645
|
meta: object;
|
|
887
2646
|
}>;
|
|
888
|
-
deployments:
|
|
2647
|
+
deployments: BuiltRouter<{
|
|
889
2648
|
ctx: TrpcContext;
|
|
890
2649
|
meta: object;
|
|
891
|
-
errorShape:
|
|
2650
|
+
errorShape: DefaultErrorShape | {
|
|
892
2651
|
message: string;
|
|
893
2652
|
data: {
|
|
894
2653
|
httpCode: error.http.StatusCodeCode;
|
|
895
|
-
code:
|
|
2654
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
896
2655
|
httpStatus: number;
|
|
897
2656
|
path?: string;
|
|
898
2657
|
stack?: string;
|
|
899
2658
|
};
|
|
900
|
-
code:
|
|
2659
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
901
2660
|
};
|
|
902
2661
|
transformer: true;
|
|
903
|
-
},
|
|
904
|
-
list:
|
|
2662
|
+
}, DecorateCreateRouterOptions<{
|
|
2663
|
+
list: QueryProcedure<{
|
|
905
2664
|
input: {
|
|
906
2665
|
projectId?: string | null | undefined;
|
|
907
2666
|
userId?: string | null | undefined;
|
|
@@ -924,7 +2683,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
924
2683
|
}[];
|
|
925
2684
|
meta: object;
|
|
926
2685
|
}>;
|
|
927
|
-
create:
|
|
2686
|
+
create: MutationProcedure<{
|
|
928
2687
|
input: {
|
|
929
2688
|
projectId: string;
|
|
930
2689
|
userId: string;
|
|
@@ -937,7 +2696,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
937
2696
|
};
|
|
938
2697
|
meta: object;
|
|
939
2698
|
}>;
|
|
940
|
-
update:
|
|
2699
|
+
update: MutationProcedure<{
|
|
941
2700
|
input: {
|
|
942
2701
|
id: string;
|
|
943
2702
|
data: {
|
|
@@ -953,7 +2712,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
953
2712
|
};
|
|
954
2713
|
meta: object;
|
|
955
2714
|
}>;
|
|
956
|
-
delete:
|
|
2715
|
+
delete: MutationProcedure<{
|
|
957
2716
|
input: {
|
|
958
2717
|
id: string;
|
|
959
2718
|
};
|
|
@@ -963,23 +2722,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
963
2722
|
meta: object;
|
|
964
2723
|
}>;
|
|
965
2724
|
}>>;
|
|
966
|
-
contacts:
|
|
2725
|
+
contacts: BuiltRouter<{
|
|
967
2726
|
ctx: TrpcContext;
|
|
968
2727
|
meta: object;
|
|
969
|
-
errorShape:
|
|
2728
|
+
errorShape: DefaultErrorShape | {
|
|
970
2729
|
message: string;
|
|
971
2730
|
data: {
|
|
972
2731
|
httpCode: error.http.StatusCodeCode;
|
|
973
|
-
code:
|
|
2732
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
974
2733
|
httpStatus: number;
|
|
975
2734
|
path?: string;
|
|
976
2735
|
stack?: string;
|
|
977
2736
|
};
|
|
978
|
-
code:
|
|
2737
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
979
2738
|
};
|
|
980
2739
|
transformer: true;
|
|
981
|
-
},
|
|
982
|
-
list:
|
|
2740
|
+
}, DecorateCreateRouterOptions<{
|
|
2741
|
+
list: QueryProcedure<{
|
|
983
2742
|
input: {
|
|
984
2743
|
projectId: string;
|
|
985
2744
|
};
|
|
@@ -1000,7 +2759,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1000
2759
|
}[];
|
|
1001
2760
|
meta: object;
|
|
1002
2761
|
}>;
|
|
1003
|
-
add:
|
|
2762
|
+
add: MutationProcedure<{
|
|
1004
2763
|
input: {
|
|
1005
2764
|
projectId: string;
|
|
1006
2765
|
contactId: string;
|
|
@@ -1010,7 +2769,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1010
2769
|
};
|
|
1011
2770
|
meta: object;
|
|
1012
2771
|
}>;
|
|
1013
|
-
remove:
|
|
2772
|
+
remove: MutationProcedure<{
|
|
1014
2773
|
input: {
|
|
1015
2774
|
projectId: string;
|
|
1016
2775
|
contactId: string;
|
|
@@ -1022,23 +2781,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1022
2781
|
}>;
|
|
1023
2782
|
}>>;
|
|
1024
2783
|
}>>;
|
|
1025
|
-
contacts:
|
|
2784
|
+
contacts: BuiltRouter<{
|
|
1026
2785
|
ctx: TrpcContext;
|
|
1027
2786
|
meta: object;
|
|
1028
|
-
errorShape:
|
|
2787
|
+
errorShape: DefaultErrorShape | {
|
|
1029
2788
|
message: string;
|
|
1030
2789
|
data: {
|
|
1031
2790
|
httpCode: error.http.StatusCodeCode;
|
|
1032
|
-
code:
|
|
2791
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
1033
2792
|
httpStatus: number;
|
|
1034
2793
|
path?: string;
|
|
1035
2794
|
stack?: string;
|
|
1036
2795
|
};
|
|
1037
|
-
code:
|
|
2796
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
1038
2797
|
};
|
|
1039
2798
|
transformer: true;
|
|
1040
|
-
},
|
|
1041
|
-
list:
|
|
2799
|
+
}, DecorateCreateRouterOptions<{
|
|
2800
|
+
list: QueryProcedure<{
|
|
1042
2801
|
input: {
|
|
1043
2802
|
search?: string | null | undefined;
|
|
1044
2803
|
};
|
|
@@ -1059,7 +2818,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1059
2818
|
}[];
|
|
1060
2819
|
meta: object;
|
|
1061
2820
|
}>;
|
|
1062
|
-
get:
|
|
2821
|
+
get: QueryProcedure<{
|
|
1063
2822
|
input: {
|
|
1064
2823
|
id: string;
|
|
1065
2824
|
};
|
|
@@ -1080,7 +2839,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1080
2839
|
};
|
|
1081
2840
|
meta: object;
|
|
1082
2841
|
}>;
|
|
1083
|
-
create:
|
|
2842
|
+
create: MutationProcedure<{
|
|
1084
2843
|
input: {
|
|
1085
2844
|
firstName: string;
|
|
1086
2845
|
lastName?: string | null | undefined;
|
|
@@ -1098,7 +2857,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1098
2857
|
};
|
|
1099
2858
|
meta: object;
|
|
1100
2859
|
}>;
|
|
1101
|
-
update:
|
|
2860
|
+
update: MutationProcedure<{
|
|
1102
2861
|
input: {
|
|
1103
2862
|
id: string;
|
|
1104
2863
|
data: {
|
|
@@ -1119,7 +2878,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1119
2878
|
};
|
|
1120
2879
|
meta: object;
|
|
1121
2880
|
}>;
|
|
1122
|
-
delete:
|
|
2881
|
+
delete: MutationProcedure<{
|
|
1123
2882
|
input: {
|
|
1124
2883
|
id: string;
|
|
1125
2884
|
};
|
|
@@ -1129,23 +2888,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1129
2888
|
meta: object;
|
|
1130
2889
|
}>;
|
|
1131
2890
|
}>>;
|
|
1132
|
-
products:
|
|
2891
|
+
products: BuiltRouter<{
|
|
1133
2892
|
ctx: TrpcContext;
|
|
1134
2893
|
meta: object;
|
|
1135
|
-
errorShape:
|
|
2894
|
+
errorShape: DefaultErrorShape | {
|
|
1136
2895
|
message: string;
|
|
1137
2896
|
data: {
|
|
1138
2897
|
httpCode: error.http.StatusCodeCode;
|
|
1139
|
-
code:
|
|
2898
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
1140
2899
|
httpStatus: number;
|
|
1141
2900
|
path?: string;
|
|
1142
2901
|
stack?: string;
|
|
1143
2902
|
};
|
|
1144
|
-
code:
|
|
2903
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
1145
2904
|
};
|
|
1146
2905
|
transformer: true;
|
|
1147
|
-
},
|
|
1148
|
-
list:
|
|
2906
|
+
}, DecorateCreateRouterOptions<{
|
|
2907
|
+
list: QueryProcedure<{
|
|
1149
2908
|
input: {
|
|
1150
2909
|
category?: string | null | undefined;
|
|
1151
2910
|
search?: string | null | undefined;
|
|
@@ -1162,7 +2921,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1162
2921
|
}[];
|
|
1163
2922
|
meta: object;
|
|
1164
2923
|
}>;
|
|
1165
|
-
get:
|
|
2924
|
+
get: QueryProcedure<{
|
|
1166
2925
|
input: {
|
|
1167
2926
|
id: string;
|
|
1168
2927
|
};
|
|
@@ -1178,7 +2937,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1178
2937
|
};
|
|
1179
2938
|
meta: object;
|
|
1180
2939
|
}>;
|
|
1181
|
-
create:
|
|
2940
|
+
create: MutationProcedure<{
|
|
1182
2941
|
input: {
|
|
1183
2942
|
customId: number;
|
|
1184
2943
|
name: string;
|
|
@@ -1192,7 +2951,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1192
2951
|
};
|
|
1193
2952
|
meta: object;
|
|
1194
2953
|
}>;
|
|
1195
|
-
update:
|
|
2954
|
+
update: MutationProcedure<{
|
|
1196
2955
|
input: {
|
|
1197
2956
|
id: string;
|
|
1198
2957
|
data: {
|
|
@@ -1209,7 +2968,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1209
2968
|
};
|
|
1210
2969
|
meta: object;
|
|
1211
2970
|
}>;
|
|
1212
|
-
delete:
|
|
2971
|
+
delete: MutationProcedure<{
|
|
1213
2972
|
input: {
|
|
1214
2973
|
id: string;
|
|
1215
2974
|
};
|
|
@@ -1218,28 +2977,28 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1218
2977
|
};
|
|
1219
2978
|
meta: object;
|
|
1220
2979
|
}>;
|
|
1221
|
-
categories:
|
|
2980
|
+
categories: BuiltRouter<{
|
|
1222
2981
|
ctx: TrpcContext;
|
|
1223
2982
|
meta: object;
|
|
1224
|
-
errorShape:
|
|
2983
|
+
errorShape: DefaultErrorShape | {
|
|
1225
2984
|
message: string;
|
|
1226
2985
|
data: {
|
|
1227
2986
|
httpCode: error.http.StatusCodeCode;
|
|
1228
|
-
code:
|
|
2987
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
1229
2988
|
httpStatus: number;
|
|
1230
2989
|
path?: string;
|
|
1231
2990
|
stack?: string;
|
|
1232
2991
|
};
|
|
1233
|
-
code:
|
|
2992
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
1234
2993
|
};
|
|
1235
2994
|
transformer: true;
|
|
1236
|
-
},
|
|
1237
|
-
list:
|
|
2995
|
+
}, DecorateCreateRouterOptions<{
|
|
2996
|
+
list: QueryProcedure<{
|
|
1238
2997
|
input: void;
|
|
1239
2998
|
output: string[];
|
|
1240
2999
|
meta: object;
|
|
1241
3000
|
}>;
|
|
1242
|
-
tag:
|
|
3001
|
+
tag: MutationProcedure<{
|
|
1243
3002
|
input: {
|
|
1244
3003
|
id: string;
|
|
1245
3004
|
category: string;
|
|
@@ -1249,7 +3008,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1249
3008
|
};
|
|
1250
3009
|
meta: object;
|
|
1251
3010
|
}>;
|
|
1252
|
-
untag:
|
|
3011
|
+
untag: MutationProcedure<{
|
|
1253
3012
|
input: {
|
|
1254
3013
|
id: string;
|
|
1255
3014
|
category: string;
|
|
@@ -1260,45 +3019,45 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1260
3019
|
meta: object;
|
|
1261
3020
|
}>;
|
|
1262
3021
|
}>>;
|
|
1263
|
-
units:
|
|
3022
|
+
units: BuiltRouter<{
|
|
1264
3023
|
ctx: TrpcContext;
|
|
1265
3024
|
meta: object;
|
|
1266
|
-
errorShape:
|
|
3025
|
+
errorShape: DefaultErrorShape | {
|
|
1267
3026
|
message: string;
|
|
1268
3027
|
data: {
|
|
1269
3028
|
httpCode: error.http.StatusCodeCode;
|
|
1270
|
-
code:
|
|
3029
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
1271
3030
|
httpStatus: number;
|
|
1272
3031
|
path?: string;
|
|
1273
3032
|
stack?: string;
|
|
1274
3033
|
};
|
|
1275
|
-
code:
|
|
3034
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
1276
3035
|
};
|
|
1277
3036
|
transformer: true;
|
|
1278
|
-
},
|
|
1279
|
-
list:
|
|
3037
|
+
}, DecorateCreateRouterOptions<{
|
|
3038
|
+
list: QueryProcedure<{
|
|
1280
3039
|
input: void;
|
|
1281
3040
|
output: string[];
|
|
1282
3041
|
meta: object;
|
|
1283
3042
|
}>;
|
|
1284
3043
|
}>>;
|
|
1285
|
-
vendors:
|
|
3044
|
+
vendors: BuiltRouter<{
|
|
1286
3045
|
ctx: TrpcContext;
|
|
1287
3046
|
meta: object;
|
|
1288
|
-
errorShape:
|
|
3047
|
+
errorShape: DefaultErrorShape | {
|
|
1289
3048
|
message: string;
|
|
1290
3049
|
data: {
|
|
1291
3050
|
httpCode: error.http.StatusCodeCode;
|
|
1292
|
-
code:
|
|
3051
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
1293
3052
|
httpStatus: number;
|
|
1294
3053
|
path?: string;
|
|
1295
3054
|
stack?: string;
|
|
1296
3055
|
};
|
|
1297
|
-
code:
|
|
3056
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
1298
3057
|
};
|
|
1299
3058
|
transformer: true;
|
|
1300
|
-
},
|
|
1301
|
-
list:
|
|
3059
|
+
}, DecorateCreateRouterOptions<{
|
|
3060
|
+
list: QueryProcedure<{
|
|
1302
3061
|
input: {
|
|
1303
3062
|
search?: string | null | undefined;
|
|
1304
3063
|
};
|
|
@@ -1311,7 +3070,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1311
3070
|
}[];
|
|
1312
3071
|
meta: object;
|
|
1313
3072
|
}>;
|
|
1314
|
-
get:
|
|
3073
|
+
get: QueryProcedure<{
|
|
1315
3074
|
input: {
|
|
1316
3075
|
id: string;
|
|
1317
3076
|
};
|
|
@@ -1324,7 +3083,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1324
3083
|
};
|
|
1325
3084
|
meta: object;
|
|
1326
3085
|
}>;
|
|
1327
|
-
create:
|
|
3086
|
+
create: MutationProcedure<{
|
|
1328
3087
|
input: {
|
|
1329
3088
|
name: string;
|
|
1330
3089
|
description?: string | null | undefined;
|
|
@@ -1334,7 +3093,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1334
3093
|
};
|
|
1335
3094
|
meta: object;
|
|
1336
3095
|
}>;
|
|
1337
|
-
update:
|
|
3096
|
+
update: MutationProcedure<{
|
|
1338
3097
|
input: {
|
|
1339
3098
|
id: string;
|
|
1340
3099
|
data: {
|
|
@@ -1347,7 +3106,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1347
3106
|
};
|
|
1348
3107
|
meta: object;
|
|
1349
3108
|
}>;
|
|
1350
|
-
delete:
|
|
3109
|
+
delete: MutationProcedure<{
|
|
1351
3110
|
input: {
|
|
1352
3111
|
id: string;
|
|
1353
3112
|
};
|
|
@@ -1357,23 +3116,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1357
3116
|
meta: object;
|
|
1358
3117
|
}>;
|
|
1359
3118
|
}>>;
|
|
1360
|
-
priceRecords:
|
|
3119
|
+
priceRecords: BuiltRouter<{
|
|
1361
3120
|
ctx: TrpcContext;
|
|
1362
3121
|
meta: object;
|
|
1363
|
-
errorShape:
|
|
3122
|
+
errorShape: DefaultErrorShape | {
|
|
1364
3123
|
message: string;
|
|
1365
3124
|
data: {
|
|
1366
3125
|
httpCode: error.http.StatusCodeCode;
|
|
1367
|
-
code:
|
|
3126
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
1368
3127
|
httpStatus: number;
|
|
1369
3128
|
path?: string;
|
|
1370
3129
|
stack?: string;
|
|
1371
3130
|
};
|
|
1372
|
-
code:
|
|
3131
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
1373
3132
|
};
|
|
1374
3133
|
transformer: true;
|
|
1375
|
-
},
|
|
1376
|
-
list:
|
|
3134
|
+
}, DecorateCreateRouterOptions<{
|
|
3135
|
+
list: QueryProcedure<{
|
|
1377
3136
|
input: {
|
|
1378
3137
|
productId?: string | null | undefined;
|
|
1379
3138
|
vendorId?: string | null | undefined;
|
|
@@ -1390,7 +3149,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1390
3149
|
}[];
|
|
1391
3150
|
meta: object;
|
|
1392
3151
|
}>;
|
|
1393
|
-
create:
|
|
3152
|
+
create: MutationProcedure<{
|
|
1394
3153
|
input: {
|
|
1395
3154
|
productId: string;
|
|
1396
3155
|
price: number;
|
|
@@ -1403,7 +3162,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1403
3162
|
};
|
|
1404
3163
|
meta: object;
|
|
1405
3164
|
}>;
|
|
1406
|
-
update:
|
|
3165
|
+
update: MutationProcedure<{
|
|
1407
3166
|
input: {
|
|
1408
3167
|
id: string;
|
|
1409
3168
|
data: {
|
|
@@ -1419,7 +3178,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1419
3178
|
};
|
|
1420
3179
|
meta: object;
|
|
1421
3180
|
}>;
|
|
1422
|
-
delete:
|
|
3181
|
+
delete: MutationProcedure<{
|
|
1423
3182
|
input: {
|
|
1424
3183
|
id: string;
|
|
1425
3184
|
};
|
|
@@ -1429,23 +3188,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1429
3188
|
meta: object;
|
|
1430
3189
|
}>;
|
|
1431
3190
|
}>>;
|
|
1432
|
-
deliveryNotes:
|
|
3191
|
+
deliveryNotes: BuiltRouter<{
|
|
1433
3192
|
ctx: TrpcContext;
|
|
1434
3193
|
meta: object;
|
|
1435
|
-
errorShape:
|
|
3194
|
+
errorShape: DefaultErrorShape | {
|
|
1436
3195
|
message: string;
|
|
1437
3196
|
data: {
|
|
1438
3197
|
httpCode: error.http.StatusCodeCode;
|
|
1439
|
-
code:
|
|
3198
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
1440
3199
|
httpStatus: number;
|
|
1441
3200
|
path?: string;
|
|
1442
3201
|
stack?: string;
|
|
1443
3202
|
};
|
|
1444
|
-
code:
|
|
3203
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
1445
3204
|
};
|
|
1446
3205
|
transformer: true;
|
|
1447
|
-
},
|
|
1448
|
-
list:
|
|
3206
|
+
}, DecorateCreateRouterOptions<{
|
|
3207
|
+
list: QueryProcedure<{
|
|
1449
3208
|
input: {
|
|
1450
3209
|
projectId?: string | null | undefined;
|
|
1451
3210
|
createdByUserId?: string | null | undefined;
|
|
@@ -1465,7 +3224,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1465
3224
|
}[];
|
|
1466
3225
|
meta: object;
|
|
1467
3226
|
}>;
|
|
1468
|
-
create:
|
|
3227
|
+
create: MutationProcedure<{
|
|
1469
3228
|
input: {
|
|
1470
3229
|
projectId: string;
|
|
1471
3230
|
records: {
|
|
@@ -1480,7 +3239,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1480
3239
|
};
|
|
1481
3240
|
meta: object;
|
|
1482
3241
|
}>;
|
|
1483
|
-
get:
|
|
3242
|
+
get: QueryProcedure<{
|
|
1484
3243
|
input: {
|
|
1485
3244
|
id: string;
|
|
1486
3245
|
};
|
|
@@ -1499,7 +3258,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1499
3258
|
};
|
|
1500
3259
|
meta: object;
|
|
1501
3260
|
}>;
|
|
1502
|
-
delete:
|
|
3261
|
+
delete: MutationProcedure<{
|
|
1503
3262
|
input: {
|
|
1504
3263
|
id: string;
|
|
1505
3264
|
};
|
|
@@ -1509,29 +3268,29 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1509
3268
|
meta: object;
|
|
1510
3269
|
}>;
|
|
1511
3270
|
}>>;
|
|
1512
|
-
suggestNextCustomId:
|
|
3271
|
+
suggestNextCustomId: QueryProcedure<{
|
|
1513
3272
|
input: void;
|
|
1514
3273
|
output: number;
|
|
1515
3274
|
meta: object;
|
|
1516
3275
|
}>;
|
|
1517
3276
|
}>>;
|
|
1518
|
-
users:
|
|
3277
|
+
users: BuiltRouter<{
|
|
1519
3278
|
ctx: TrpcContext;
|
|
1520
3279
|
meta: object;
|
|
1521
|
-
errorShape:
|
|
3280
|
+
errorShape: DefaultErrorShape | {
|
|
1522
3281
|
message: string;
|
|
1523
3282
|
data: {
|
|
1524
3283
|
httpCode: error.http.StatusCodeCode;
|
|
1525
|
-
code:
|
|
3284
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
1526
3285
|
httpStatus: number;
|
|
1527
3286
|
path?: string;
|
|
1528
3287
|
stack?: string;
|
|
1529
3288
|
};
|
|
1530
|
-
code:
|
|
3289
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
1531
3290
|
};
|
|
1532
3291
|
transformer: true;
|
|
1533
|
-
},
|
|
1534
|
-
list:
|
|
3292
|
+
}, DecorateCreateRouterOptions<{
|
|
3293
|
+
list: QueryProcedure<{
|
|
1535
3294
|
input: {
|
|
1536
3295
|
search?: string | null | undefined;
|
|
1537
3296
|
deactivated?: boolean | null | undefined;
|
|
@@ -1552,7 +3311,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1552
3311
|
}[];
|
|
1553
3312
|
meta: object;
|
|
1554
3313
|
}>;
|
|
1555
|
-
get:
|
|
3314
|
+
get: QueryProcedure<{
|
|
1556
3315
|
input: {
|
|
1557
3316
|
id: string;
|
|
1558
3317
|
};
|
|
@@ -1571,7 +3330,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1571
3330
|
};
|
|
1572
3331
|
meta: object;
|
|
1573
3332
|
}>;
|
|
1574
|
-
create:
|
|
3333
|
+
create: MutationProcedure<{
|
|
1575
3334
|
input: {
|
|
1576
3335
|
username: string;
|
|
1577
3336
|
firstName: string;
|
|
@@ -1585,7 +3344,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1585
3344
|
};
|
|
1586
3345
|
meta: object;
|
|
1587
3346
|
}>;
|
|
1588
|
-
update:
|
|
3347
|
+
update: MutationProcedure<{
|
|
1589
3348
|
input: {
|
|
1590
3349
|
id: string;
|
|
1591
3350
|
data: {
|
|
@@ -1602,7 +3361,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1602
3361
|
};
|
|
1603
3362
|
meta: object;
|
|
1604
3363
|
}>;
|
|
1605
|
-
delete:
|
|
3364
|
+
delete: MutationProcedure<{
|
|
1606
3365
|
input: {
|
|
1607
3366
|
id: string;
|
|
1608
3367
|
};
|
|
@@ -1611,7 +3370,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1611
3370
|
};
|
|
1612
3371
|
meta: object;
|
|
1613
3372
|
}>;
|
|
1614
|
-
archive:
|
|
3373
|
+
archive: MutationProcedure<{
|
|
1615
3374
|
input: {
|
|
1616
3375
|
id: string;
|
|
1617
3376
|
};
|
|
@@ -1620,7 +3379,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1620
3379
|
};
|
|
1621
3380
|
meta: object;
|
|
1622
3381
|
}>;
|
|
1623
|
-
unarchive:
|
|
3382
|
+
unarchive: MutationProcedure<{
|
|
1624
3383
|
input: {
|
|
1625
3384
|
id: string;
|
|
1626
3385
|
};
|
|
@@ -1629,7 +3388,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1629
3388
|
};
|
|
1630
3389
|
meta: object;
|
|
1631
3390
|
}>;
|
|
1632
|
-
activate:
|
|
3391
|
+
activate: MutationProcedure<{
|
|
1633
3392
|
input: {
|
|
1634
3393
|
id: string;
|
|
1635
3394
|
};
|
|
@@ -1638,7 +3397,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1638
3397
|
};
|
|
1639
3398
|
meta: object;
|
|
1640
3399
|
}>;
|
|
1641
|
-
deactivate:
|
|
3400
|
+
deactivate: MutationProcedure<{
|
|
1642
3401
|
input: {
|
|
1643
3402
|
id: string;
|
|
1644
3403
|
};
|
|
@@ -1647,12 +3406,12 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1647
3406
|
};
|
|
1648
3407
|
meta: object;
|
|
1649
3408
|
}>;
|
|
1650
|
-
roles:
|
|
3409
|
+
roles: QueryProcedure<{
|
|
1651
3410
|
input: void;
|
|
1652
3411
|
output: (":admin" | "view:users" | "manage:users" | "delete:users" | "view:projects" | "manage:projects" | "delete:projects" | "view:projectDeployments" | "manage:projectDeployments" | "delete:projectDeployments" | "view:tools" | "manage:tools" | "delete:tools" | "view:toolTrackings" | "manage:toolTrackings" | "delete:toolTrackings" | "view:toolInventories" | "manage:toolInventories" | "delete:toolInventories" | "view:products" | "manage:products" | "delete:products" | "view:deliveryNotes" | "manage:deliveryNotes" | "delete:deliveryNotes" | "view:productVendors" | "manage:productVendors" | "delete:productVendors" | "view:contacts" | "manage:contacts" | "delete:contacts" | "view:productPriceRecords" | "manage:productPriceRecords" | "delete:productPriceRecords" | "view:customers" | "manage:customers" | "delete:customers")[];
|
|
1653
3412
|
meta: object;
|
|
1654
3413
|
}>;
|
|
1655
|
-
setRoles:
|
|
3414
|
+
setRoles: MutationProcedure<{
|
|
1656
3415
|
input: {
|
|
1657
3416
|
userId: string;
|
|
1658
3417
|
assignments: Record<":admin" | "view:users" | "manage:users" | "delete:users" | "view:projects" | "manage:projects" | "delete:projects" | "view:projectDeployments" | "manage:projectDeployments" | "delete:projectDeployments" | "view:tools" | "manage:tools" | "delete:tools" | "view:toolTrackings" | "manage:toolTrackings" | "delete:toolTrackings" | "view:toolInventories" | "manage:toolInventories" | "delete:toolInventories" | "view:products" | "manage:products" | "delete:products" | "view:deliveryNotes" | "manage:deliveryNotes" | "delete:deliveryNotes" | "view:productVendors" | "manage:productVendors" | "delete:productVendors" | "view:contacts" | "manage:contacts" | "delete:contacts" | "view:productPriceRecords" | "manage:productPriceRecords" | "delete:productPriceRecords" | "view:customers" | "manage:customers" | "delete:customers", boolean | null | undefined>;
|
|
@@ -1663,23 +3422,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1663
3422
|
meta: object;
|
|
1664
3423
|
}>;
|
|
1665
3424
|
}>>;
|
|
1666
|
-
tools:
|
|
3425
|
+
tools: BuiltRouter<{
|
|
1667
3426
|
ctx: TrpcContext;
|
|
1668
3427
|
meta: object;
|
|
1669
|
-
errorShape:
|
|
3428
|
+
errorShape: DefaultErrorShape | {
|
|
1670
3429
|
message: string;
|
|
1671
3430
|
data: {
|
|
1672
3431
|
httpCode: error.http.StatusCodeCode;
|
|
1673
|
-
code:
|
|
3432
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
1674
3433
|
httpStatus: number;
|
|
1675
3434
|
path?: string;
|
|
1676
3435
|
stack?: string;
|
|
1677
3436
|
};
|
|
1678
|
-
code:
|
|
3437
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
1679
3438
|
};
|
|
1680
3439
|
transformer: true;
|
|
1681
|
-
},
|
|
1682
|
-
list:
|
|
3440
|
+
}, DecorateCreateRouterOptions<{
|
|
3441
|
+
list: QueryProcedure<{
|
|
1683
3442
|
input: {
|
|
1684
3443
|
search?: string | null | undefined;
|
|
1685
3444
|
status?: "lost" | "broken" | "available" | "unavailable" | null | undefined;
|
|
@@ -1700,7 +3459,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1700
3459
|
}[];
|
|
1701
3460
|
meta: object;
|
|
1702
3461
|
}>;
|
|
1703
|
-
get:
|
|
3462
|
+
get: QueryProcedure<{
|
|
1704
3463
|
input: {
|
|
1705
3464
|
id: string;
|
|
1706
3465
|
};
|
|
@@ -1718,7 +3477,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1718
3477
|
};
|
|
1719
3478
|
meta: object;
|
|
1720
3479
|
}>;
|
|
1721
|
-
create:
|
|
3480
|
+
create: MutationProcedure<{
|
|
1722
3481
|
input: {
|
|
1723
3482
|
customId: number;
|
|
1724
3483
|
brand: string;
|
|
@@ -1731,7 +3490,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1731
3490
|
};
|
|
1732
3491
|
meta: object;
|
|
1733
3492
|
}>;
|
|
1734
|
-
update:
|
|
3493
|
+
update: MutationProcedure<{
|
|
1735
3494
|
input: {
|
|
1736
3495
|
id: string;
|
|
1737
3496
|
data: {
|
|
@@ -1745,7 +3504,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1745
3504
|
};
|
|
1746
3505
|
meta: object;
|
|
1747
3506
|
}>;
|
|
1748
|
-
delete:
|
|
3507
|
+
delete: MutationProcedure<{
|
|
1749
3508
|
input: {
|
|
1750
3509
|
id: string;
|
|
1751
3510
|
};
|
|
@@ -1754,7 +3513,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1754
3513
|
};
|
|
1755
3514
|
meta: object;
|
|
1756
3515
|
}>;
|
|
1757
|
-
track:
|
|
3516
|
+
track: MutationProcedure<{
|
|
1758
3517
|
input: {
|
|
1759
3518
|
id: string;
|
|
1760
3519
|
data: {
|
|
@@ -1769,7 +3528,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1769
3528
|
};
|
|
1770
3529
|
meta: object;
|
|
1771
3530
|
}>;
|
|
1772
|
-
untrack:
|
|
3531
|
+
untrack: MutationProcedure<{
|
|
1773
3532
|
input: {
|
|
1774
3533
|
id: string;
|
|
1775
3534
|
};
|
|
@@ -1778,23 +3537,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1778
3537
|
};
|
|
1779
3538
|
meta: object;
|
|
1780
3539
|
}>;
|
|
1781
|
-
trackings:
|
|
3540
|
+
trackings: BuiltRouter<{
|
|
1782
3541
|
ctx: TrpcContext;
|
|
1783
3542
|
meta: object;
|
|
1784
|
-
errorShape:
|
|
3543
|
+
errorShape: DefaultErrorShape | {
|
|
1785
3544
|
message: string;
|
|
1786
3545
|
data: {
|
|
1787
3546
|
httpCode: error.http.StatusCodeCode;
|
|
1788
|
-
code:
|
|
3547
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
1789
3548
|
httpStatus: number;
|
|
1790
3549
|
path?: string;
|
|
1791
3550
|
stack?: string;
|
|
1792
3551
|
};
|
|
1793
|
-
code:
|
|
3552
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
1794
3553
|
};
|
|
1795
3554
|
transformer: true;
|
|
1796
|
-
},
|
|
1797
|
-
list:
|
|
3555
|
+
}, DecorateCreateRouterOptions<{
|
|
3556
|
+
list: QueryProcedure<{
|
|
1798
3557
|
input: {
|
|
1799
3558
|
finished?: boolean | null | undefined;
|
|
1800
3559
|
toolId?: string | null | undefined;
|
|
@@ -1821,23 +3580,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1821
3580
|
}[];
|
|
1822
3581
|
meta: object;
|
|
1823
3582
|
}>;
|
|
1824
|
-
requests:
|
|
3583
|
+
requests: BuiltRouter<{
|
|
1825
3584
|
ctx: TrpcContext;
|
|
1826
3585
|
meta: object;
|
|
1827
|
-
errorShape:
|
|
3586
|
+
errorShape: DefaultErrorShape | {
|
|
1828
3587
|
message: string;
|
|
1829
3588
|
data: {
|
|
1830
3589
|
httpCode: error.http.StatusCodeCode;
|
|
1831
|
-
code:
|
|
3590
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
1832
3591
|
httpStatus: number;
|
|
1833
3592
|
path?: string;
|
|
1834
3593
|
stack?: string;
|
|
1835
3594
|
};
|
|
1836
|
-
code:
|
|
3595
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
1837
3596
|
};
|
|
1838
3597
|
transformer: true;
|
|
1839
|
-
},
|
|
1840
|
-
list:
|
|
3598
|
+
}, DecorateCreateRouterOptions<{
|
|
3599
|
+
list: QueryProcedure<{
|
|
1841
3600
|
input: {
|
|
1842
3601
|
toolId?: string | null | undefined;
|
|
1843
3602
|
status?: "open" | "accepted" | "denied" | null | undefined;
|
|
@@ -1861,7 +3620,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1861
3620
|
}[];
|
|
1862
3621
|
meta: object;
|
|
1863
3622
|
}>;
|
|
1864
|
-
request:
|
|
3623
|
+
request: MutationProcedure<{
|
|
1865
3624
|
input: {
|
|
1866
3625
|
toolTrackingId: string;
|
|
1867
3626
|
transferToUserId?: string | null | undefined;
|
|
@@ -1873,7 +3632,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1873
3632
|
};
|
|
1874
3633
|
meta: object;
|
|
1875
3634
|
}>;
|
|
1876
|
-
accept:
|
|
3635
|
+
accept: MutationProcedure<{
|
|
1877
3636
|
input: {
|
|
1878
3637
|
id: string;
|
|
1879
3638
|
projectId?: string | null | undefined;
|
|
@@ -1883,7 +3642,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1883
3642
|
};
|
|
1884
3643
|
meta: object;
|
|
1885
3644
|
}>;
|
|
1886
|
-
deny:
|
|
3645
|
+
deny: MutationProcedure<{
|
|
1887
3646
|
input: {
|
|
1888
3647
|
id: string;
|
|
1889
3648
|
};
|
|
@@ -1894,23 +3653,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1894
3653
|
}>;
|
|
1895
3654
|
}>>;
|
|
1896
3655
|
}>>;
|
|
1897
|
-
inventories:
|
|
3656
|
+
inventories: BuiltRouter<{
|
|
1898
3657
|
ctx: TrpcContext;
|
|
1899
3658
|
meta: object;
|
|
1900
|
-
errorShape:
|
|
3659
|
+
errorShape: DefaultErrorShape | {
|
|
1901
3660
|
message: string;
|
|
1902
3661
|
data: {
|
|
1903
3662
|
httpCode: error.http.StatusCodeCode;
|
|
1904
|
-
code:
|
|
3663
|
+
code: TRPC_ERROR_CODE_KEY;
|
|
1905
3664
|
httpStatus: number;
|
|
1906
3665
|
path?: string;
|
|
1907
3666
|
stack?: string;
|
|
1908
3667
|
};
|
|
1909
|
-
code:
|
|
3668
|
+
code: TRPC_ERROR_CODE_NUMBER;
|
|
1910
3669
|
};
|
|
1911
3670
|
transformer: true;
|
|
1912
|
-
},
|
|
1913
|
-
list:
|
|
3671
|
+
}, DecorateCreateRouterOptions<{
|
|
3672
|
+
list: QueryProcedure<{
|
|
1914
3673
|
input: {
|
|
1915
3674
|
toolId?: string | null | undefined;
|
|
1916
3675
|
};
|
|
@@ -1922,7 +3681,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1922
3681
|
}[];
|
|
1923
3682
|
meta: object;
|
|
1924
3683
|
}>;
|
|
1925
|
-
create:
|
|
3684
|
+
create: MutationProcedure<{
|
|
1926
3685
|
input: {
|
|
1927
3686
|
toolId: string;
|
|
1928
3687
|
comment?: string | null | undefined;
|
|
@@ -1932,7 +3691,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1932
3691
|
};
|
|
1933
3692
|
meta: object;
|
|
1934
3693
|
}>;
|
|
1935
|
-
delete:
|
|
3694
|
+
delete: MutationProcedure<{
|
|
1936
3695
|
input: {
|
|
1937
3696
|
id: string;
|
|
1938
3697
|
};
|
|
@@ -1942,17 +3701,17 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1942
3701
|
meta: object;
|
|
1943
3702
|
}>;
|
|
1944
3703
|
}>>;
|
|
1945
|
-
categories:
|
|
3704
|
+
categories: QueryProcedure<{
|
|
1946
3705
|
input: void;
|
|
1947
3706
|
output: string[];
|
|
1948
3707
|
meta: object;
|
|
1949
3708
|
}>;
|
|
1950
|
-
brands:
|
|
3709
|
+
brands: QueryProcedure<{
|
|
1951
3710
|
input: void;
|
|
1952
3711
|
output: string[];
|
|
1953
3712
|
meta: object;
|
|
1954
3713
|
}>;
|
|
1955
|
-
suggestNextCustomId:
|
|
3714
|
+
suggestNextCustomId: QueryProcedure<{
|
|
1956
3715
|
input: void;
|
|
1957
3716
|
output: number;
|
|
1958
3717
|
meta: object;
|
|
@@ -1967,29 +3726,318 @@ interface Cache$1 {
|
|
|
1967
3726
|
clear(): Promise<void>;
|
|
1968
3727
|
keys(): Promise<Set<string>>;
|
|
1969
3728
|
}
|
|
3729
|
+
declare class Subscription implements SubscriptionLike {
|
|
3730
|
+
private initialTeardown?;
|
|
3731
|
+
static EMPTY: Subscription;
|
|
3732
|
+
/**
|
|
3733
|
+
* A flag to indicate whether this Subscription has already been unsubscribed.
|
|
3734
|
+
*/
|
|
3735
|
+
closed: boolean;
|
|
3736
|
+
private _parentage;
|
|
3737
|
+
/**
|
|
3738
|
+
* The list of registered finalizers to execute upon unsubscription. Adding and removing from this
|
|
3739
|
+
* list occurs in the {@link #add} and {@link #remove} methods.
|
|
3740
|
+
*/
|
|
3741
|
+
private _finalizers;
|
|
3742
|
+
/**
|
|
3743
|
+
* @param initialTeardown A function executed first as part of the finalization
|
|
3744
|
+
* process that is kicked off when {@link #unsubscribe} is called.
|
|
3745
|
+
*/
|
|
3746
|
+
constructor(initialTeardown?: (() => void) | undefined);
|
|
3747
|
+
/**
|
|
3748
|
+
* Disposes the resources held by the subscription. May, for instance, cancel
|
|
3749
|
+
* an ongoing Observable execution or cancel any other type of work that
|
|
3750
|
+
* started when the Subscription was created.
|
|
3751
|
+
*/
|
|
3752
|
+
unsubscribe(): void;
|
|
3753
|
+
/**
|
|
3754
|
+
* Adds a finalizer to this subscription, so that finalization will be unsubscribed/called
|
|
3755
|
+
* when this subscription is unsubscribed. If this subscription is already {@link #closed},
|
|
3756
|
+
* because it has already been unsubscribed, then whatever finalizer is passed to it
|
|
3757
|
+
* will automatically be executed (unless the finalizer itself is also a closed subscription).
|
|
3758
|
+
*
|
|
3759
|
+
* Closed Subscriptions cannot be added as finalizers to any subscription. Adding a closed
|
|
3760
|
+
* subscription to a any subscription will result in no operation. (A noop).
|
|
3761
|
+
*
|
|
3762
|
+
* Adding a subscription to itself, or adding `null` or `undefined` will not perform any
|
|
3763
|
+
* operation at all. (A noop).
|
|
3764
|
+
*
|
|
3765
|
+
* `Subscription` instances that are added to this instance will automatically remove themselves
|
|
3766
|
+
* if they are unsubscribed. Functions and {@link Unsubscribable} objects that you wish to remove
|
|
3767
|
+
* will need to be removed manually with {@link #remove}
|
|
3768
|
+
*
|
|
3769
|
+
* @param teardown The finalization logic to add to this subscription.
|
|
3770
|
+
*/
|
|
3771
|
+
add(teardown: TeardownLogic): void;
|
|
3772
|
+
/**
|
|
3773
|
+
* Checks to see if a this subscription already has a particular parent.
|
|
3774
|
+
* This will signal that this subscription has already been added to the parent in question.
|
|
3775
|
+
* @param parent the parent to check for
|
|
3776
|
+
*/
|
|
3777
|
+
private _hasParent;
|
|
3778
|
+
/**
|
|
3779
|
+
* Adds a parent to this subscription so it can be removed from the parent if it
|
|
3780
|
+
* unsubscribes on it's own.
|
|
3781
|
+
*
|
|
3782
|
+
* NOTE: THIS ASSUMES THAT {@link _hasParent} HAS ALREADY BEEN CHECKED.
|
|
3783
|
+
* @param parent The parent subscription to add
|
|
3784
|
+
*/
|
|
3785
|
+
private _addParent;
|
|
3786
|
+
/**
|
|
3787
|
+
* Called on a child when it is removed via {@link #remove}.
|
|
3788
|
+
* @param parent The parent to remove
|
|
3789
|
+
*/
|
|
3790
|
+
private _removeParent;
|
|
3791
|
+
/**
|
|
3792
|
+
* Removes a finalizer from this subscription that was previously added with the {@link #add} method.
|
|
3793
|
+
*
|
|
3794
|
+
* Note that `Subscription` instances, when unsubscribed, will automatically remove themselves
|
|
3795
|
+
* from every other `Subscription` they have been added to. This means that using the `remove` method
|
|
3796
|
+
* is not a common thing and should be used thoughtfully.
|
|
3797
|
+
*
|
|
3798
|
+
* If you add the same finalizer instance of a function or an unsubscribable object to a `Subscription` instance
|
|
3799
|
+
* more than once, you will need to call `remove` the same number of times to remove all instances.
|
|
3800
|
+
*
|
|
3801
|
+
* All finalizer instances are removed to free up memory upon unsubscription.
|
|
3802
|
+
*
|
|
3803
|
+
* @param teardown The finalizer to remove from this subscription
|
|
3804
|
+
*/
|
|
3805
|
+
remove(teardown: Exclude<TeardownLogic, void>): void;
|
|
3806
|
+
}
|
|
3807
|
+
declare class Subscriber<T> extends Subscription implements Observer$1<T> {
|
|
3808
|
+
/**
|
|
3809
|
+
* A static factory for a Subscriber, given a (potentially partial) definition
|
|
3810
|
+
* of an Observer.
|
|
3811
|
+
* @param next The `next` callback of an Observer.
|
|
3812
|
+
* @param error The `error` callback of an
|
|
3813
|
+
* Observer.
|
|
3814
|
+
* @param complete The `complete` callback of an
|
|
3815
|
+
* Observer.
|
|
3816
|
+
* @return A Subscriber wrapping the (partially defined)
|
|
3817
|
+
* Observer represented by the given arguments.
|
|
3818
|
+
* @deprecated Do not use. Will be removed in v8. There is no replacement for this
|
|
3819
|
+
* method, and there is no reason to be creating instances of `Subscriber` directly.
|
|
3820
|
+
* If you have a specific use case, please file an issue.
|
|
3821
|
+
*/
|
|
3822
|
+
static create<T>(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber<T>;
|
|
3823
|
+
/** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
|
|
3824
|
+
protected isStopped: boolean;
|
|
3825
|
+
/** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
|
|
3826
|
+
protected destination: Subscriber<any> | Observer$1<any>;
|
|
3827
|
+
/**
|
|
3828
|
+
* @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
|
|
3829
|
+
* There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons.
|
|
3830
|
+
*/
|
|
3831
|
+
constructor(destination?: Subscriber<any> | Observer$1<any>);
|
|
3832
|
+
/**
|
|
3833
|
+
* The {@link Observer} callback to receive notifications of type `next` from
|
|
3834
|
+
* the Observable, with a value. The Observable may call this method 0 or more
|
|
3835
|
+
* times.
|
|
3836
|
+
* @param value The `next` value.
|
|
3837
|
+
*/
|
|
3838
|
+
next(value: T): void;
|
|
3839
|
+
/**
|
|
3840
|
+
* The {@link Observer} callback to receive notifications of type `error` from
|
|
3841
|
+
* the Observable, with an attached `Error`. Notifies the Observer that
|
|
3842
|
+
* the Observable has experienced an error condition.
|
|
3843
|
+
* @param err The `error` exception.
|
|
3844
|
+
*/
|
|
3845
|
+
error(err?: any): void;
|
|
3846
|
+
/**
|
|
3847
|
+
* The {@link Observer} callback to receive a valueless notification of type
|
|
3848
|
+
* `complete` from the Observable. Notifies the Observer that the Observable
|
|
3849
|
+
* has finished sending push-based notifications.
|
|
3850
|
+
*/
|
|
3851
|
+
complete(): void;
|
|
3852
|
+
unsubscribe(): void;
|
|
3853
|
+
protected _next(value: T): void;
|
|
3854
|
+
protected _error(err: any): void;
|
|
3855
|
+
protected _complete(): void;
|
|
3856
|
+
}
|
|
3857
|
+
interface Operator<T, R> {
|
|
3858
|
+
call(subscriber: Subscriber<R>, source: any): TeardownLogic;
|
|
3859
|
+
}
|
|
3860
|
+
declare class Observable$1<T> implements Subscribable$1<T> {
|
|
3861
|
+
/**
|
|
3862
|
+
* @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
|
|
3863
|
+
*/
|
|
3864
|
+
source: Observable$1<any> | undefined;
|
|
3865
|
+
/**
|
|
3866
|
+
* @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
|
|
3867
|
+
*/
|
|
3868
|
+
operator: Operator<any, T> | undefined;
|
|
3869
|
+
/**
|
|
3870
|
+
* @param subscribe The function that is called when the Observable is
|
|
3871
|
+
* initially subscribed to. This function is given a Subscriber, to which new values
|
|
3872
|
+
* can be `next`ed, or an `error` method can be called to raise an error, or
|
|
3873
|
+
* `complete` can be called to notify of a successful completion.
|
|
3874
|
+
*/
|
|
3875
|
+
constructor(subscribe?: (this: Observable$1<T>, subscriber: Subscriber<T>) => TeardownLogic);
|
|
3876
|
+
/**
|
|
3877
|
+
* Creates a new Observable by calling the Observable constructor
|
|
3878
|
+
* @param subscribe the subscriber function to be passed to the Observable constructor
|
|
3879
|
+
* @return A new observable.
|
|
3880
|
+
* @deprecated Use `new Observable()` instead. Will be removed in v8.
|
|
3881
|
+
*/
|
|
3882
|
+
static create: (...args: any[]) => any;
|
|
3883
|
+
/**
|
|
3884
|
+
* Creates a new Observable, with this Observable instance as the source, and the passed
|
|
3885
|
+
* operator defined as the new observable's operator.
|
|
3886
|
+
* @param operator the operator defining the operation to take on the observable
|
|
3887
|
+
* @return A new observable with the Operator applied.
|
|
3888
|
+
* @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
|
|
3889
|
+
* If you have implemented an operator using `lift`, it is recommended that you create an
|
|
3890
|
+
* operator by simply returning `new Observable()` directly. See "Creating new operators from
|
|
3891
|
+
* scratch" section here: https://rxjs.dev/guide/operators
|
|
3892
|
+
*/
|
|
3893
|
+
lift<R>(operator?: Operator<T, R>): Observable$1<R>;
|
|
3894
|
+
subscribe(observerOrNext?: Partial<Observer$1<T>> | ((value: T) => void)): Subscription;
|
|
3895
|
+
/** @deprecated Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments */
|
|
3896
|
+
subscribe(next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null): Subscription;
|
|
3897
|
+
/**
|
|
3898
|
+
* Used as a NON-CANCELLABLE means of subscribing to an observable, for use with
|
|
3899
|
+
* APIs that expect promises, like `async/await`. You cannot unsubscribe from this.
|
|
3900
|
+
*
|
|
3901
|
+
* **WARNING**: Only use this with observables you *know* will complete. If the source
|
|
3902
|
+
* observable does not complete, you will end up with a promise that is hung up, and
|
|
3903
|
+
* potentially all of the state of an async function hanging out in memory. To avoid
|
|
3904
|
+
* this situation, look into adding something like {@link timeout}, {@link take},
|
|
3905
|
+
* {@link takeWhile}, or {@link takeUntil} amongst others.
|
|
3906
|
+
*
|
|
3907
|
+
* #### Example
|
|
3908
|
+
*
|
|
3909
|
+
* ```ts
|
|
3910
|
+
* import { interval, take } from 'rxjs';
|
|
3911
|
+
*
|
|
3912
|
+
* const source$ = interval(1000).pipe(take(4));
|
|
3913
|
+
*
|
|
3914
|
+
* async function getTotal() {
|
|
3915
|
+
* let total = 0;
|
|
3916
|
+
*
|
|
3917
|
+
* await source$.forEach(value => {
|
|
3918
|
+
* total += value;
|
|
3919
|
+
* console.log('observable -> ' + value);
|
|
3920
|
+
* });
|
|
3921
|
+
*
|
|
3922
|
+
* return total;
|
|
3923
|
+
* }
|
|
3924
|
+
*
|
|
3925
|
+
* getTotal().then(
|
|
3926
|
+
* total => console.log('Total: ' + total)
|
|
3927
|
+
* );
|
|
3928
|
+
*
|
|
3929
|
+
* // Expected:
|
|
3930
|
+
* // 'observable -> 0'
|
|
3931
|
+
* // 'observable -> 1'
|
|
3932
|
+
* // 'observable -> 2'
|
|
3933
|
+
* // 'observable -> 3'
|
|
3934
|
+
* // 'Total: 6'
|
|
3935
|
+
* ```
|
|
3936
|
+
*
|
|
3937
|
+
* @param next A handler for each value emitted by the observable.
|
|
3938
|
+
* @return A promise that either resolves on observable completion or
|
|
3939
|
+
* rejects with the handled error.
|
|
3940
|
+
*/
|
|
3941
|
+
forEach(next: (value: T) => void): Promise<void>;
|
|
3942
|
+
/**
|
|
3943
|
+
* @param next a handler for each value emitted by the observable
|
|
3944
|
+
* @param promiseCtor a constructor function used to instantiate the Promise
|
|
3945
|
+
* @return a promise that either resolves on observable completion or
|
|
3946
|
+
* rejects with the handled error
|
|
3947
|
+
* @deprecated Passing a Promise constructor will no longer be available
|
|
3948
|
+
* in upcoming versions of RxJS. This is because it adds weight to the library, for very
|
|
3949
|
+
* little benefit. If you need this functionality, it is recommended that you either
|
|
3950
|
+
* polyfill Promise, or you create an adapter to convert the returned native promise
|
|
3951
|
+
* to whatever promise implementation you wanted. Will be removed in v8.
|
|
3952
|
+
*/
|
|
3953
|
+
forEach(next: (value: T) => void, promiseCtor: PromiseConstructorLike): Promise<void>;
|
|
3954
|
+
pipe(): Observable$1<T>;
|
|
3955
|
+
pipe<A>(op1: OperatorFunction$1<T, A>): Observable$1<A>;
|
|
3956
|
+
pipe<A, B>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>): Observable$1<B>;
|
|
3957
|
+
pipe<A, B, C>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>): Observable$1<C>;
|
|
3958
|
+
pipe<A, B, C, D>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>, op4: OperatorFunction$1<C, D>): Observable$1<D>;
|
|
3959
|
+
pipe<A, B, C, D, E>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>, op4: OperatorFunction$1<C, D>, op5: OperatorFunction$1<D, E>): Observable$1<E>;
|
|
3960
|
+
pipe<A, B, C, D, E, F>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>, op4: OperatorFunction$1<C, D>, op5: OperatorFunction$1<D, E>, op6: OperatorFunction$1<E, F>): Observable$1<F>;
|
|
3961
|
+
pipe<A, B, C, D, E, F, G>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>, op4: OperatorFunction$1<C, D>, op5: OperatorFunction$1<D, E>, op6: OperatorFunction$1<E, F>, op7: OperatorFunction$1<F, G>): Observable$1<G>;
|
|
3962
|
+
pipe<A, B, C, D, E, F, G, H>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>, op4: OperatorFunction$1<C, D>, op5: OperatorFunction$1<D, E>, op6: OperatorFunction$1<E, F>, op7: OperatorFunction$1<F, G>, op8: OperatorFunction$1<G, H>): Observable$1<H>;
|
|
3963
|
+
pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>, op4: OperatorFunction$1<C, D>, op5: OperatorFunction$1<D, E>, op6: OperatorFunction$1<E, F>, op7: OperatorFunction$1<F, G>, op8: OperatorFunction$1<G, H>, op9: OperatorFunction$1<H, I>): Observable$1<I>;
|
|
3964
|
+
pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>, op4: OperatorFunction$1<C, D>, op5: OperatorFunction$1<D, E>, op6: OperatorFunction$1<E, F>, op7: OperatorFunction$1<F, G>, op8: OperatorFunction$1<G, H>, op9: OperatorFunction$1<H, I>, ...operations: OperatorFunction$1<any, any>[]): Observable$1<unknown>;
|
|
3965
|
+
/** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */
|
|
3966
|
+
toPromise(): Promise<T | undefined>;
|
|
3967
|
+
/** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */
|
|
3968
|
+
toPromise(PromiseCtor: typeof Promise): Promise<T | undefined>;
|
|
3969
|
+
/** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */
|
|
3970
|
+
toPromise(PromiseCtor: PromiseConstructorLike): Promise<T | undefined>;
|
|
3971
|
+
}
|
|
3972
|
+
interface UnaryFunction$1<T, R> {
|
|
3973
|
+
(source: T): R;
|
|
3974
|
+
}
|
|
3975
|
+
interface OperatorFunction$1<T, R> extends UnaryFunction$1<Observable$1<T>, Observable$1<R>> {
|
|
3976
|
+
}
|
|
3977
|
+
interface Unsubscribable$1 {
|
|
3978
|
+
unsubscribe(): void;
|
|
3979
|
+
}
|
|
3980
|
+
declare type TeardownLogic = Subscription | Unsubscribable$1 | (() => void) | void;
|
|
3981
|
+
interface SubscriptionLike extends Unsubscribable$1 {
|
|
3982
|
+
unsubscribe(): void;
|
|
3983
|
+
readonly closed: boolean;
|
|
3984
|
+
}
|
|
3985
|
+
interface Subscribable$1<T> {
|
|
3986
|
+
subscribe(observer: Partial<Observer$1<T>>): Unsubscribable$1;
|
|
3987
|
+
}
|
|
3988
|
+
interface Observer$1<T> {
|
|
3989
|
+
/**
|
|
3990
|
+
* A callback function that gets called by the producer during the subscription when
|
|
3991
|
+
* the producer "has" the `value`. It won't be called if `error` or `complete` callback
|
|
3992
|
+
* functions have been called, nor after the consumer has unsubscribed.
|
|
3993
|
+
*
|
|
3994
|
+
* For more info, please refer to {@link guide/glossary-and-semantics#next this guide}.
|
|
3995
|
+
*/
|
|
3996
|
+
next: (value: T) => void;
|
|
3997
|
+
/**
|
|
3998
|
+
* A callback function that gets called by the producer if and when it encountered a
|
|
3999
|
+
* problem of any kind. The errored value will be provided through the `err` parameter.
|
|
4000
|
+
* This callback can't be called more than one time, it can't be called if the
|
|
4001
|
+
* `complete` callback function have been called previously, nor it can't be called if
|
|
4002
|
+
* the consumer has unsubscribed.
|
|
4003
|
+
*
|
|
4004
|
+
* For more info, please refer to {@link guide/glossary-and-semantics#error this guide}.
|
|
4005
|
+
*/
|
|
4006
|
+
error: (err: any) => void;
|
|
4007
|
+
/**
|
|
4008
|
+
* A callback function that gets called by the producer if and when it has no more
|
|
4009
|
+
* values to provide (by calling `next` callback function). This means that no error
|
|
4010
|
+
* has happened. This callback can't be called more than one time, it can't be called
|
|
4011
|
+
* if the `error` callback function have been called previously, nor it can't be called
|
|
4012
|
+
* if the consumer has unsubscribed.
|
|
4013
|
+
*
|
|
4014
|
+
* For more info, please refer to {@link guide/glossary-and-semantics#complete this guide}.
|
|
4015
|
+
*/
|
|
4016
|
+
complete: () => void;
|
|
4017
|
+
}
|
|
1970
4018
|
/**
|
|
1971
4019
|
* Streaming/caching modes consistent with your REST client.
|
|
1972
4020
|
*/
|
|
1973
4021
|
export type CacheMode = "cache-first" | "cache-only" | "network-first" | "network-only";
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
4022
|
+
type MyTRPCClient = TRPCClient<AppRouter>;
|
|
4023
|
+
type PathValue<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? PathValue<T[K], Rest> : never : P extends keyof T ? T[P] : never;
|
|
4024
|
+
type Join<P extends string, K extends string> = P extends "" ? K : `${P}.${K}`;
|
|
4025
|
+
type IsFn<T> = T extends (...args: any[]) => any ? true : false;
|
|
4026
|
+
type TRPCPaths<TClient, Method extends string, P extends string = ""> = TClient extends object ? (Method extends keyof TClient ? IsFn<TClient[Method]> extends true ? P : {
|
|
1979
4027
|
[K in Extract<keyof TClient, string>]: TRPCPaths<TClient[K], Method, Join<P, K>>;
|
|
1980
4028
|
}[Extract<keyof TClient, string>] : {
|
|
1981
4029
|
[K in Extract<keyof TClient, string>]: TRPCPaths<TClient[K], Method, Join<P, K>>;
|
|
1982
4030
|
}[Extract<keyof TClient, string>]) : never;
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
4031
|
+
type TRPCQueryPaths<TClient> = TRPCPaths<TClient, "query">;
|
|
4032
|
+
type TRPCMutatePaths<TClient> = TRPCPaths<TClient, "mutate">;
|
|
4033
|
+
type QueryPaths = TRPCQueryPaths<MyTRPCClient>;
|
|
4034
|
+
type MutatePaths = TRPCMutatePaths<MyTRPCClient>;
|
|
4035
|
+
type AnyFn = (...args: any[]) => any;
|
|
4036
|
+
type FirstParam<F> = F extends AnyFn ? Parameters<F> extends [
|
|
1989
4037
|
infer A,
|
|
1990
4038
|
...any[]
|
|
1991
4039
|
] ? A : void : never;
|
|
1992
|
-
|
|
4040
|
+
type RetType<F> = F extends AnyFn ? ReturnType<F> : never;
|
|
1993
4041
|
export interface Client {
|
|
1994
4042
|
/**
|
|
1995
4043
|
* Convenient wrapper for query execution. This wrapper automatically handles:
|
|
@@ -2006,7 +4054,7 @@ export interface Client {
|
|
|
2006
4054
|
]>;
|
|
2007
4055
|
streamQuery<PathT extends QueryPaths, QueryResolverT = PathValue<MyTRPCClient, `${PathT}.query`>>(path: PathT, input: FirstParam<QueryResolverT>, opts?: {
|
|
2008
4056
|
strategy?: CacheMode;
|
|
2009
|
-
}): Observable<[
|
|
4057
|
+
}): Observable$1<[
|
|
2010
4058
|
Awaited<RetType<QueryResolverT>> | null,
|
|
2011
4059
|
TRPCClientError<any> | null
|
|
2012
4060
|
]>;
|