@sortsys/v2-client 0.1.2 → 0.1.4

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +2275 -226
  2. package/dist/index.js +3 -3
  3. 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 { TRPCClient, TRPCClientError } from '@trpc/client';
4
- import { Request as Request$1, Response as Response$1 } from 'express-serve-static-core';
5
- import { Observable } from 'rxjs';
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
- export type Role = (typeof ROLES)[number];
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
- export type TrpcContext = {
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: import("@trpc/server").TRPCBuiltRouter<{
2021
+ declare const appRouter: BuiltRouter<{
263
2022
  ctx: TrpcContext;
264
2023
  meta: object;
265
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
2024
+ errorShape: DefaultErrorShape | {
266
2025
  message: string;
267
2026
  data: {
268
2027
  httpCode: error.http.StatusCodeCode;
269
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
2028
+ code: TRPC_ERROR_CODE_KEY;
270
2029
  httpStatus: number;
271
2030
  path?: string;
272
2031
  stack?: string;
273
2032
  };
274
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
2033
+ code: TRPC_ERROR_CODE_NUMBER;
275
2034
  };
276
2035
  transformer: true;
277
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
278
- ping: import("@trpc/server").TRPCQueryProcedure<{
2036
+ }, DecorateCreateRouterOptions<{
2037
+ ping: QueryProcedure<{
279
2038
  input: void;
280
2039
  output: string;
281
2040
  meta: object;
282
2041
  }>;
283
- auth: import("@trpc/server").TRPCBuiltRouter<{
2042
+ auth: BuiltRouter<{
284
2043
  ctx: TrpcContext;
285
2044
  meta: object;
286
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
2045
+ errorShape: DefaultErrorShape | {
287
2046
  message: string;
288
2047
  data: {
289
2048
  httpCode: error.http.StatusCodeCode;
290
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
2049
+ code: TRPC_ERROR_CODE_KEY;
291
2050
  httpStatus: number;
292
2051
  path?: string;
293
2052
  stack?: string;
294
2053
  };
295
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
2054
+ code: TRPC_ERROR_CODE_NUMBER;
296
2055
  };
297
2056
  transformer: true;
298
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
299
- login: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
2069
+ logout: MutationProcedure<{
311
2070
  input: void;
312
2071
  output: {
313
2072
  success: true;
314
2073
  };
315
2074
  meta: object;
316
2075
  }>;
317
- check: import("@trpc/server").TRPCQueryProcedure<{
2076
+ check: QueryProcedure<{
318
2077
  input: void;
319
2078
  output: {
320
2079
  success: true;
321
2080
  };
322
2081
  meta: object;
323
2082
  }>;
324
- sessionInfo: import("@trpc/server").TRPCQueryProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCBuiltRouter<{
2118
+ admin: BuiltRouter<{
360
2119
  ctx: TrpcContext;
361
2120
  meta: object;
362
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
2121
+ errorShape: DefaultErrorShape | {
363
2122
  message: string;
364
2123
  data: {
365
2124
  httpCode: error.http.StatusCodeCode;
366
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
2125
+ code: TRPC_ERROR_CODE_KEY;
367
2126
  httpStatus: number;
368
2127
  path?: string;
369
2128
  stack?: string;
370
2129
  };
371
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
2130
+ code: TRPC_ERROR_CODE_NUMBER;
372
2131
  };
373
2132
  transformer: true;
374
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
375
- login: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCBuiltRouter<{
2144
+ tenants: BuiltRouter<{
386
2145
  ctx: TrpcContext;
387
2146
  meta: object;
388
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
2147
+ errorShape: DefaultErrorShape | {
389
2148
  message: string;
390
2149
  data: {
391
2150
  httpCode: error.http.StatusCodeCode;
392
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
2151
+ code: TRPC_ERROR_CODE_KEY;
393
2152
  httpStatus: number;
394
2153
  path?: string;
395
2154
  stack?: string;
396
2155
  };
397
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
2156
+ code: TRPC_ERROR_CODE_NUMBER;
398
2157
  };
399
2158
  transformer: true;
400
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
401
- list: import("@trpc/server").TRPCQueryProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCQueryProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCBuiltRouter<{
2371
+ customers: BuiltRouter<{
613
2372
  ctx: TrpcContext;
614
2373
  meta: object;
615
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
2374
+ errorShape: DefaultErrorShape | {
616
2375
  message: string;
617
2376
  data: {
618
2377
  httpCode: error.http.StatusCodeCode;
619
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
2378
+ code: TRPC_ERROR_CODE_KEY;
620
2379
  httpStatus: number;
621
2380
  path?: string;
622
2381
  stack?: string;
623
2382
  };
624
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
2383
+ code: TRPC_ERROR_CODE_NUMBER;
625
2384
  };
626
2385
  transformer: true;
627
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
628
- list: import("@trpc/server").TRPCQueryProcedure<{
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: import("@trpc/server").TRPCQueryProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCBuiltRouter<{
2469
+ contacts: BuiltRouter<{
711
2470
  ctx: TrpcContext;
712
2471
  meta: object;
713
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
2472
+ errorShape: DefaultErrorShape | {
714
2473
  message: string;
715
2474
  data: {
716
2475
  httpCode: error.http.StatusCodeCode;
717
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
2476
+ code: TRPC_ERROR_CODE_KEY;
718
2477
  httpStatus: number;
719
2478
  path?: string;
720
2479
  stack?: string;
721
2480
  };
722
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
2481
+ code: TRPC_ERROR_CODE_NUMBER;
723
2482
  };
724
2483
  transformer: true;
725
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
726
- list: import("@trpc/server").TRPCQueryProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCBuiltRouter<{
2528
+ projects: BuiltRouter<{
770
2529
  ctx: TrpcContext;
771
2530
  meta: object;
772
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
2531
+ errorShape: DefaultErrorShape | {
773
2532
  message: string;
774
2533
  data: {
775
2534
  httpCode: error.http.StatusCodeCode;
776
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
2535
+ code: TRPC_ERROR_CODE_KEY;
777
2536
  httpStatus: number;
778
2537
  path?: string;
779
2538
  stack?: string;
780
2539
  };
781
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
2540
+ code: TRPC_ERROR_CODE_NUMBER;
782
2541
  };
783
2542
  transformer: true;
784
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
785
- list: import("@trpc/server").TRPCQueryProcedure<{
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: import("@trpc/server").TRPCQueryProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCBuiltRouter<{
2647
+ deployments: BuiltRouter<{
889
2648
  ctx: TrpcContext;
890
2649
  meta: object;
891
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
2650
+ errorShape: DefaultErrorShape | {
892
2651
  message: string;
893
2652
  data: {
894
2653
  httpCode: error.http.StatusCodeCode;
895
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
2654
+ code: TRPC_ERROR_CODE_KEY;
896
2655
  httpStatus: number;
897
2656
  path?: string;
898
2657
  stack?: string;
899
2658
  };
900
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
2659
+ code: TRPC_ERROR_CODE_NUMBER;
901
2660
  };
902
2661
  transformer: true;
903
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
904
- list: import("@trpc/server").TRPCQueryProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCBuiltRouter<{
2725
+ contacts: BuiltRouter<{
967
2726
  ctx: TrpcContext;
968
2727
  meta: object;
969
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
2728
+ errorShape: DefaultErrorShape | {
970
2729
  message: string;
971
2730
  data: {
972
2731
  httpCode: error.http.StatusCodeCode;
973
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
2732
+ code: TRPC_ERROR_CODE_KEY;
974
2733
  httpStatus: number;
975
2734
  path?: string;
976
2735
  stack?: string;
977
2736
  };
978
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
2737
+ code: TRPC_ERROR_CODE_NUMBER;
979
2738
  };
980
2739
  transformer: true;
981
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
982
- list: import("@trpc/server").TRPCQueryProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCBuiltRouter<{
2784
+ contacts: BuiltRouter<{
1026
2785
  ctx: TrpcContext;
1027
2786
  meta: object;
1028
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
2787
+ errorShape: DefaultErrorShape | {
1029
2788
  message: string;
1030
2789
  data: {
1031
2790
  httpCode: error.http.StatusCodeCode;
1032
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
2791
+ code: TRPC_ERROR_CODE_KEY;
1033
2792
  httpStatus: number;
1034
2793
  path?: string;
1035
2794
  stack?: string;
1036
2795
  };
1037
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
2796
+ code: TRPC_ERROR_CODE_NUMBER;
1038
2797
  };
1039
2798
  transformer: true;
1040
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1041
- list: import("@trpc/server").TRPCQueryProcedure<{
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: import("@trpc/server").TRPCQueryProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCBuiltRouter<{
2891
+ products: BuiltRouter<{
1133
2892
  ctx: TrpcContext;
1134
2893
  meta: object;
1135
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
2894
+ errorShape: DefaultErrorShape | {
1136
2895
  message: string;
1137
2896
  data: {
1138
2897
  httpCode: error.http.StatusCodeCode;
1139
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
2898
+ code: TRPC_ERROR_CODE_KEY;
1140
2899
  httpStatus: number;
1141
2900
  path?: string;
1142
2901
  stack?: string;
1143
2902
  };
1144
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
2903
+ code: TRPC_ERROR_CODE_NUMBER;
1145
2904
  };
1146
2905
  transformer: true;
1147
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1148
- list: import("@trpc/server").TRPCQueryProcedure<{
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: import("@trpc/server").TRPCQueryProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCBuiltRouter<{
2980
+ categories: BuiltRouter<{
1222
2981
  ctx: TrpcContext;
1223
2982
  meta: object;
1224
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
2983
+ errorShape: DefaultErrorShape | {
1225
2984
  message: string;
1226
2985
  data: {
1227
2986
  httpCode: error.http.StatusCodeCode;
1228
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
2987
+ code: TRPC_ERROR_CODE_KEY;
1229
2988
  httpStatus: number;
1230
2989
  path?: string;
1231
2990
  stack?: string;
1232
2991
  };
1233
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
2992
+ code: TRPC_ERROR_CODE_NUMBER;
1234
2993
  };
1235
2994
  transformer: true;
1236
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1237
- list: import("@trpc/server").TRPCQueryProcedure<{
2995
+ }, DecorateCreateRouterOptions<{
2996
+ list: QueryProcedure<{
1238
2997
  input: void;
1239
2998
  output: string[];
1240
2999
  meta: object;
1241
3000
  }>;
1242
- tag: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCBuiltRouter<{
3022
+ units: BuiltRouter<{
1264
3023
  ctx: TrpcContext;
1265
3024
  meta: object;
1266
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
3025
+ errorShape: DefaultErrorShape | {
1267
3026
  message: string;
1268
3027
  data: {
1269
3028
  httpCode: error.http.StatusCodeCode;
1270
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
3029
+ code: TRPC_ERROR_CODE_KEY;
1271
3030
  httpStatus: number;
1272
3031
  path?: string;
1273
3032
  stack?: string;
1274
3033
  };
1275
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
3034
+ code: TRPC_ERROR_CODE_NUMBER;
1276
3035
  };
1277
3036
  transformer: true;
1278
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1279
- list: import("@trpc/server").TRPCQueryProcedure<{
3037
+ }, DecorateCreateRouterOptions<{
3038
+ list: QueryProcedure<{
1280
3039
  input: void;
1281
3040
  output: string[];
1282
3041
  meta: object;
1283
3042
  }>;
1284
3043
  }>>;
1285
- vendors: import("@trpc/server").TRPCBuiltRouter<{
3044
+ vendors: BuiltRouter<{
1286
3045
  ctx: TrpcContext;
1287
3046
  meta: object;
1288
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
3047
+ errorShape: DefaultErrorShape | {
1289
3048
  message: string;
1290
3049
  data: {
1291
3050
  httpCode: error.http.StatusCodeCode;
1292
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
3051
+ code: TRPC_ERROR_CODE_KEY;
1293
3052
  httpStatus: number;
1294
3053
  path?: string;
1295
3054
  stack?: string;
1296
3055
  };
1297
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
3056
+ code: TRPC_ERROR_CODE_NUMBER;
1298
3057
  };
1299
3058
  transformer: true;
1300
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1301
- list: import("@trpc/server").TRPCQueryProcedure<{
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: import("@trpc/server").TRPCQueryProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCMutationProcedure<{
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: import("@trpc/server").TRPCBuiltRouter<{
3119
+ priceRecords: BuiltRouter<{
1361
3120
  ctx: TrpcContext;
1362
3121
  meta: object;
1363
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
3122
+ errorShape: DefaultErrorShape | {
1364
3123
  message: string;
1365
3124
  data: {
1366
3125
  httpCode: error.http.StatusCodeCode;
1367
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
3126
+ code: TRPC_ERROR_CODE_KEY;
1368
3127
  httpStatus: number;
1369
3128
  path?: string;
1370
3129
  stack?: string;
1371
3130
  };
1372
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
3131
+ code: TRPC_ERROR_CODE_NUMBER;
1373
3132
  };
1374
3133
  transformer: true;
1375
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1376
- list: import("@trpc/server").TRPCQueryProcedure<{
3134
+ }, DecorateCreateRouterOptions<{
3135
+ list: QueryProcedure<{
1377
3136
  input: {
1378
3137
  productId?: string | null | undefined;
1379
3138
  vendorId?: string | null | undefined;
@@ -1384,16 +3143,17 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1384
3143
  productId: string;
1385
3144
  vendorId: string | null;
1386
3145
  timestamp: Date;
1387
- price: number;
3146
+ pricePerBaseUnit: number;
1388
3147
  isRealPurchase: boolean;
1389
3148
  comment: string | null;
1390
3149
  }[];
1391
3150
  meta: object;
1392
3151
  }>;
1393
- create: import("@trpc/server").TRPCMutationProcedure<{
3152
+ create: MutationProcedure<{
1394
3153
  input: {
1395
3154
  productId: string;
1396
- price: number;
3155
+ pricePerBaseUnit: number;
3156
+ timestamp: Date;
1397
3157
  isRealPurchase: boolean;
1398
3158
  vendorId?: string | null | undefined;
1399
3159
  comment?: string | null | undefined;
@@ -1403,13 +3163,14 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1403
3163
  };
1404
3164
  meta: object;
1405
3165
  }>;
1406
- update: import("@trpc/server").TRPCMutationProcedure<{
3166
+ update: MutationProcedure<{
1407
3167
  input: {
1408
3168
  id: string;
1409
3169
  data: {
1410
3170
  productId?: string | undefined;
1411
3171
  vendorId?: string | null | undefined;
1412
- price?: number | undefined;
3172
+ pricePerBaseUnit?: number | undefined;
3173
+ timestamp?: Date | undefined;
1413
3174
  isRealPurchase?: boolean | undefined;
1414
3175
  comment?: string | null | undefined;
1415
3176
  };
@@ -1419,7 +3180,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1419
3180
  };
1420
3181
  meta: object;
1421
3182
  }>;
1422
- delete: import("@trpc/server").TRPCMutationProcedure<{
3183
+ delete: MutationProcedure<{
1423
3184
  input: {
1424
3185
  id: string;
1425
3186
  };
@@ -1429,23 +3190,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1429
3190
  meta: object;
1430
3191
  }>;
1431
3192
  }>>;
1432
- deliveryNotes: import("@trpc/server").TRPCBuiltRouter<{
3193
+ deliveryNotes: BuiltRouter<{
1433
3194
  ctx: TrpcContext;
1434
3195
  meta: object;
1435
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
3196
+ errorShape: DefaultErrorShape | {
1436
3197
  message: string;
1437
3198
  data: {
1438
3199
  httpCode: error.http.StatusCodeCode;
1439
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
3200
+ code: TRPC_ERROR_CODE_KEY;
1440
3201
  httpStatus: number;
1441
3202
  path?: string;
1442
3203
  stack?: string;
1443
3204
  };
1444
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
3205
+ code: TRPC_ERROR_CODE_NUMBER;
1445
3206
  };
1446
3207
  transformer: true;
1447
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1448
- list: import("@trpc/server").TRPCQueryProcedure<{
3208
+ }, DecorateCreateRouterOptions<{
3209
+ list: QueryProcedure<{
1449
3210
  input: {
1450
3211
  projectId?: string | null | undefined;
1451
3212
  createdByUserId?: string | null | undefined;
@@ -1465,7 +3226,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1465
3226
  }[];
1466
3227
  meta: object;
1467
3228
  }>;
1468
- create: import("@trpc/server").TRPCMutationProcedure<{
3229
+ create: MutationProcedure<{
1469
3230
  input: {
1470
3231
  projectId: string;
1471
3232
  records: {
@@ -1480,7 +3241,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1480
3241
  };
1481
3242
  meta: object;
1482
3243
  }>;
1483
- get: import("@trpc/server").TRPCQueryProcedure<{
3244
+ get: QueryProcedure<{
1484
3245
  input: {
1485
3246
  id: string;
1486
3247
  };
@@ -1499,7 +3260,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1499
3260
  };
1500
3261
  meta: object;
1501
3262
  }>;
1502
- delete: import("@trpc/server").TRPCMutationProcedure<{
3263
+ delete: MutationProcedure<{
1503
3264
  input: {
1504
3265
  id: string;
1505
3266
  };
@@ -1509,29 +3270,29 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1509
3270
  meta: object;
1510
3271
  }>;
1511
3272
  }>>;
1512
- suggestNextCustomId: import("@trpc/server").TRPCQueryProcedure<{
3273
+ suggestNextCustomId: QueryProcedure<{
1513
3274
  input: void;
1514
3275
  output: number;
1515
3276
  meta: object;
1516
3277
  }>;
1517
3278
  }>>;
1518
- users: import("@trpc/server").TRPCBuiltRouter<{
3279
+ users: BuiltRouter<{
1519
3280
  ctx: TrpcContext;
1520
3281
  meta: object;
1521
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
3282
+ errorShape: DefaultErrorShape | {
1522
3283
  message: string;
1523
3284
  data: {
1524
3285
  httpCode: error.http.StatusCodeCode;
1525
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
3286
+ code: TRPC_ERROR_CODE_KEY;
1526
3287
  httpStatus: number;
1527
3288
  path?: string;
1528
3289
  stack?: string;
1529
3290
  };
1530
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
3291
+ code: TRPC_ERROR_CODE_NUMBER;
1531
3292
  };
1532
3293
  transformer: true;
1533
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1534
- list: import("@trpc/server").TRPCQueryProcedure<{
3294
+ }, DecorateCreateRouterOptions<{
3295
+ list: QueryProcedure<{
1535
3296
  input: {
1536
3297
  search?: string | null | undefined;
1537
3298
  deactivated?: boolean | null | undefined;
@@ -1552,7 +3313,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1552
3313
  }[];
1553
3314
  meta: object;
1554
3315
  }>;
1555
- get: import("@trpc/server").TRPCQueryProcedure<{
3316
+ get: QueryProcedure<{
1556
3317
  input: {
1557
3318
  id: string;
1558
3319
  };
@@ -1571,7 +3332,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1571
3332
  };
1572
3333
  meta: object;
1573
3334
  }>;
1574
- create: import("@trpc/server").TRPCMutationProcedure<{
3335
+ create: MutationProcedure<{
1575
3336
  input: {
1576
3337
  username: string;
1577
3338
  firstName: string;
@@ -1585,7 +3346,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1585
3346
  };
1586
3347
  meta: object;
1587
3348
  }>;
1588
- update: import("@trpc/server").TRPCMutationProcedure<{
3349
+ update: MutationProcedure<{
1589
3350
  input: {
1590
3351
  id: string;
1591
3352
  data: {
@@ -1602,7 +3363,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1602
3363
  };
1603
3364
  meta: object;
1604
3365
  }>;
1605
- delete: import("@trpc/server").TRPCMutationProcedure<{
3366
+ delete: MutationProcedure<{
1606
3367
  input: {
1607
3368
  id: string;
1608
3369
  };
@@ -1611,7 +3372,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1611
3372
  };
1612
3373
  meta: object;
1613
3374
  }>;
1614
- archive: import("@trpc/server").TRPCMutationProcedure<{
3375
+ archive: MutationProcedure<{
1615
3376
  input: {
1616
3377
  id: string;
1617
3378
  };
@@ -1620,7 +3381,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1620
3381
  };
1621
3382
  meta: object;
1622
3383
  }>;
1623
- unarchive: import("@trpc/server").TRPCMutationProcedure<{
3384
+ unarchive: MutationProcedure<{
1624
3385
  input: {
1625
3386
  id: string;
1626
3387
  };
@@ -1629,7 +3390,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1629
3390
  };
1630
3391
  meta: object;
1631
3392
  }>;
1632
- activate: import("@trpc/server").TRPCMutationProcedure<{
3393
+ activate: MutationProcedure<{
1633
3394
  input: {
1634
3395
  id: string;
1635
3396
  };
@@ -1638,7 +3399,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1638
3399
  };
1639
3400
  meta: object;
1640
3401
  }>;
1641
- deactivate: import("@trpc/server").TRPCMutationProcedure<{
3402
+ deactivate: MutationProcedure<{
1642
3403
  input: {
1643
3404
  id: string;
1644
3405
  };
@@ -1647,12 +3408,12 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1647
3408
  };
1648
3409
  meta: object;
1649
3410
  }>;
1650
- roles: import("@trpc/server").TRPCQueryProcedure<{
3411
+ roles: QueryProcedure<{
1651
3412
  input: void;
1652
3413
  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
3414
  meta: object;
1654
3415
  }>;
1655
- setRoles: import("@trpc/server").TRPCMutationProcedure<{
3416
+ setRoles: MutationProcedure<{
1656
3417
  input: {
1657
3418
  userId: string;
1658
3419
  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 +3424,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1663
3424
  meta: object;
1664
3425
  }>;
1665
3426
  }>>;
1666
- tools: import("@trpc/server").TRPCBuiltRouter<{
3427
+ tools: BuiltRouter<{
1667
3428
  ctx: TrpcContext;
1668
3429
  meta: object;
1669
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
3430
+ errorShape: DefaultErrorShape | {
1670
3431
  message: string;
1671
3432
  data: {
1672
3433
  httpCode: error.http.StatusCodeCode;
1673
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
3434
+ code: TRPC_ERROR_CODE_KEY;
1674
3435
  httpStatus: number;
1675
3436
  path?: string;
1676
3437
  stack?: string;
1677
3438
  };
1678
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
3439
+ code: TRPC_ERROR_CODE_NUMBER;
1679
3440
  };
1680
3441
  transformer: true;
1681
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1682
- list: import("@trpc/server").TRPCQueryProcedure<{
3442
+ }, DecorateCreateRouterOptions<{
3443
+ list: QueryProcedure<{
1683
3444
  input: {
1684
3445
  search?: string | null | undefined;
1685
3446
  status?: "lost" | "broken" | "available" | "unavailable" | null | undefined;
@@ -1700,7 +3461,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1700
3461
  }[];
1701
3462
  meta: object;
1702
3463
  }>;
1703
- get: import("@trpc/server").TRPCQueryProcedure<{
3464
+ get: QueryProcedure<{
1704
3465
  input: {
1705
3466
  id: string;
1706
3467
  };
@@ -1718,7 +3479,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1718
3479
  };
1719
3480
  meta: object;
1720
3481
  }>;
1721
- create: import("@trpc/server").TRPCMutationProcedure<{
3482
+ create: MutationProcedure<{
1722
3483
  input: {
1723
3484
  customId: number;
1724
3485
  brand: string;
@@ -1731,7 +3492,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1731
3492
  };
1732
3493
  meta: object;
1733
3494
  }>;
1734
- update: import("@trpc/server").TRPCMutationProcedure<{
3495
+ update: MutationProcedure<{
1735
3496
  input: {
1736
3497
  id: string;
1737
3498
  data: {
@@ -1745,7 +3506,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1745
3506
  };
1746
3507
  meta: object;
1747
3508
  }>;
1748
- delete: import("@trpc/server").TRPCMutationProcedure<{
3509
+ delete: MutationProcedure<{
1749
3510
  input: {
1750
3511
  id: string;
1751
3512
  };
@@ -1754,7 +3515,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1754
3515
  };
1755
3516
  meta: object;
1756
3517
  }>;
1757
- track: import("@trpc/server").TRPCMutationProcedure<{
3518
+ track: MutationProcedure<{
1758
3519
  input: {
1759
3520
  id: string;
1760
3521
  data: {
@@ -1769,7 +3530,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1769
3530
  };
1770
3531
  meta: object;
1771
3532
  }>;
1772
- untrack: import("@trpc/server").TRPCMutationProcedure<{
3533
+ untrack: MutationProcedure<{
1773
3534
  input: {
1774
3535
  id: string;
1775
3536
  };
@@ -1778,23 +3539,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1778
3539
  };
1779
3540
  meta: object;
1780
3541
  }>;
1781
- trackings: import("@trpc/server").TRPCBuiltRouter<{
3542
+ trackings: BuiltRouter<{
1782
3543
  ctx: TrpcContext;
1783
3544
  meta: object;
1784
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
3545
+ errorShape: DefaultErrorShape | {
1785
3546
  message: string;
1786
3547
  data: {
1787
3548
  httpCode: error.http.StatusCodeCode;
1788
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
3549
+ code: TRPC_ERROR_CODE_KEY;
1789
3550
  httpStatus: number;
1790
3551
  path?: string;
1791
3552
  stack?: string;
1792
3553
  };
1793
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
3554
+ code: TRPC_ERROR_CODE_NUMBER;
1794
3555
  };
1795
3556
  transformer: true;
1796
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1797
- list: import("@trpc/server").TRPCQueryProcedure<{
3557
+ }, DecorateCreateRouterOptions<{
3558
+ list: QueryProcedure<{
1798
3559
  input: {
1799
3560
  finished?: boolean | null | undefined;
1800
3561
  toolId?: string | null | undefined;
@@ -1821,23 +3582,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1821
3582
  }[];
1822
3583
  meta: object;
1823
3584
  }>;
1824
- requests: import("@trpc/server").TRPCBuiltRouter<{
3585
+ requests: BuiltRouter<{
1825
3586
  ctx: TrpcContext;
1826
3587
  meta: object;
1827
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
3588
+ errorShape: DefaultErrorShape | {
1828
3589
  message: string;
1829
3590
  data: {
1830
3591
  httpCode: error.http.StatusCodeCode;
1831
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
3592
+ code: TRPC_ERROR_CODE_KEY;
1832
3593
  httpStatus: number;
1833
3594
  path?: string;
1834
3595
  stack?: string;
1835
3596
  };
1836
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
3597
+ code: TRPC_ERROR_CODE_NUMBER;
1837
3598
  };
1838
3599
  transformer: true;
1839
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1840
- list: import("@trpc/server").TRPCQueryProcedure<{
3600
+ }, DecorateCreateRouterOptions<{
3601
+ list: QueryProcedure<{
1841
3602
  input: {
1842
3603
  toolId?: string | null | undefined;
1843
3604
  status?: "open" | "accepted" | "denied" | null | undefined;
@@ -1861,7 +3622,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1861
3622
  }[];
1862
3623
  meta: object;
1863
3624
  }>;
1864
- request: import("@trpc/server").TRPCMutationProcedure<{
3625
+ request: MutationProcedure<{
1865
3626
  input: {
1866
3627
  toolTrackingId: string;
1867
3628
  transferToUserId?: string | null | undefined;
@@ -1873,7 +3634,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1873
3634
  };
1874
3635
  meta: object;
1875
3636
  }>;
1876
- accept: import("@trpc/server").TRPCMutationProcedure<{
3637
+ accept: MutationProcedure<{
1877
3638
  input: {
1878
3639
  id: string;
1879
3640
  projectId?: string | null | undefined;
@@ -1883,7 +3644,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1883
3644
  };
1884
3645
  meta: object;
1885
3646
  }>;
1886
- deny: import("@trpc/server").TRPCMutationProcedure<{
3647
+ deny: MutationProcedure<{
1887
3648
  input: {
1888
3649
  id: string;
1889
3650
  };
@@ -1894,23 +3655,23 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1894
3655
  }>;
1895
3656
  }>>;
1896
3657
  }>>;
1897
- inventories: import("@trpc/server").TRPCBuiltRouter<{
3658
+ inventories: BuiltRouter<{
1898
3659
  ctx: TrpcContext;
1899
3660
  meta: object;
1900
- errorShape: import("@trpc/server").TRPCDefaultErrorShape | {
3661
+ errorShape: DefaultErrorShape | {
1901
3662
  message: string;
1902
3663
  data: {
1903
3664
  httpCode: error.http.StatusCodeCode;
1904
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
3665
+ code: TRPC_ERROR_CODE_KEY;
1905
3666
  httpStatus: number;
1906
3667
  path?: string;
1907
3668
  stack?: string;
1908
3669
  };
1909
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
3670
+ code: TRPC_ERROR_CODE_NUMBER;
1910
3671
  };
1911
3672
  transformer: true;
1912
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1913
- list: import("@trpc/server").TRPCQueryProcedure<{
3673
+ }, DecorateCreateRouterOptions<{
3674
+ list: QueryProcedure<{
1914
3675
  input: {
1915
3676
  toolId?: string | null | undefined;
1916
3677
  };
@@ -1922,7 +3683,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1922
3683
  }[];
1923
3684
  meta: object;
1924
3685
  }>;
1925
- create: import("@trpc/server").TRPCMutationProcedure<{
3686
+ create: MutationProcedure<{
1926
3687
  input: {
1927
3688
  toolId: string;
1928
3689
  comment?: string | null | undefined;
@@ -1932,7 +3693,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1932
3693
  };
1933
3694
  meta: object;
1934
3695
  }>;
1935
- delete: import("@trpc/server").TRPCMutationProcedure<{
3696
+ delete: MutationProcedure<{
1936
3697
  input: {
1937
3698
  id: string;
1938
3699
  };
@@ -1942,17 +3703,17 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1942
3703
  meta: object;
1943
3704
  }>;
1944
3705
  }>>;
1945
- categories: import("@trpc/server").TRPCQueryProcedure<{
3706
+ categories: QueryProcedure<{
1946
3707
  input: void;
1947
3708
  output: string[];
1948
3709
  meta: object;
1949
3710
  }>;
1950
- brands: import("@trpc/server").TRPCQueryProcedure<{
3711
+ brands: QueryProcedure<{
1951
3712
  input: void;
1952
3713
  output: string[];
1953
3714
  meta: object;
1954
3715
  }>;
1955
- suggestNextCustomId: import("@trpc/server").TRPCQueryProcedure<{
3716
+ suggestNextCustomId: QueryProcedure<{
1956
3717
  input: void;
1957
3718
  output: number;
1958
3719
  meta: object;
@@ -1967,29 +3728,318 @@ interface Cache$1 {
1967
3728
  clear(): Promise<void>;
1968
3729
  keys(): Promise<Set<string>>;
1969
3730
  }
3731
+ declare class Subscription implements SubscriptionLike {
3732
+ private initialTeardown?;
3733
+ static EMPTY: Subscription;
3734
+ /**
3735
+ * A flag to indicate whether this Subscription has already been unsubscribed.
3736
+ */
3737
+ closed: boolean;
3738
+ private _parentage;
3739
+ /**
3740
+ * The list of registered finalizers to execute upon unsubscription. Adding and removing from this
3741
+ * list occurs in the {@link #add} and {@link #remove} methods.
3742
+ */
3743
+ private _finalizers;
3744
+ /**
3745
+ * @param initialTeardown A function executed first as part of the finalization
3746
+ * process that is kicked off when {@link #unsubscribe} is called.
3747
+ */
3748
+ constructor(initialTeardown?: (() => void) | undefined);
3749
+ /**
3750
+ * Disposes the resources held by the subscription. May, for instance, cancel
3751
+ * an ongoing Observable execution or cancel any other type of work that
3752
+ * started when the Subscription was created.
3753
+ */
3754
+ unsubscribe(): void;
3755
+ /**
3756
+ * Adds a finalizer to this subscription, so that finalization will be unsubscribed/called
3757
+ * when this subscription is unsubscribed. If this subscription is already {@link #closed},
3758
+ * because it has already been unsubscribed, then whatever finalizer is passed to it
3759
+ * will automatically be executed (unless the finalizer itself is also a closed subscription).
3760
+ *
3761
+ * Closed Subscriptions cannot be added as finalizers to any subscription. Adding a closed
3762
+ * subscription to a any subscription will result in no operation. (A noop).
3763
+ *
3764
+ * Adding a subscription to itself, or adding `null` or `undefined` will not perform any
3765
+ * operation at all. (A noop).
3766
+ *
3767
+ * `Subscription` instances that are added to this instance will automatically remove themselves
3768
+ * if they are unsubscribed. Functions and {@link Unsubscribable} objects that you wish to remove
3769
+ * will need to be removed manually with {@link #remove}
3770
+ *
3771
+ * @param teardown The finalization logic to add to this subscription.
3772
+ */
3773
+ add(teardown: TeardownLogic): void;
3774
+ /**
3775
+ * Checks to see if a this subscription already has a particular parent.
3776
+ * This will signal that this subscription has already been added to the parent in question.
3777
+ * @param parent the parent to check for
3778
+ */
3779
+ private _hasParent;
3780
+ /**
3781
+ * Adds a parent to this subscription so it can be removed from the parent if it
3782
+ * unsubscribes on it's own.
3783
+ *
3784
+ * NOTE: THIS ASSUMES THAT {@link _hasParent} HAS ALREADY BEEN CHECKED.
3785
+ * @param parent The parent subscription to add
3786
+ */
3787
+ private _addParent;
3788
+ /**
3789
+ * Called on a child when it is removed via {@link #remove}.
3790
+ * @param parent The parent to remove
3791
+ */
3792
+ private _removeParent;
3793
+ /**
3794
+ * Removes a finalizer from this subscription that was previously added with the {@link #add} method.
3795
+ *
3796
+ * Note that `Subscription` instances, when unsubscribed, will automatically remove themselves
3797
+ * from every other `Subscription` they have been added to. This means that using the `remove` method
3798
+ * is not a common thing and should be used thoughtfully.
3799
+ *
3800
+ * If you add the same finalizer instance of a function or an unsubscribable object to a `Subscription` instance
3801
+ * more than once, you will need to call `remove` the same number of times to remove all instances.
3802
+ *
3803
+ * All finalizer instances are removed to free up memory upon unsubscription.
3804
+ *
3805
+ * @param teardown The finalizer to remove from this subscription
3806
+ */
3807
+ remove(teardown: Exclude<TeardownLogic, void>): void;
3808
+ }
3809
+ declare class Subscriber<T> extends Subscription implements Observer$1<T> {
3810
+ /**
3811
+ * A static factory for a Subscriber, given a (potentially partial) definition
3812
+ * of an Observer.
3813
+ * @param next The `next` callback of an Observer.
3814
+ * @param error The `error` callback of an
3815
+ * Observer.
3816
+ * @param complete The `complete` callback of an
3817
+ * Observer.
3818
+ * @return A Subscriber wrapping the (partially defined)
3819
+ * Observer represented by the given arguments.
3820
+ * @deprecated Do not use. Will be removed in v8. There is no replacement for this
3821
+ * method, and there is no reason to be creating instances of `Subscriber` directly.
3822
+ * If you have a specific use case, please file an issue.
3823
+ */
3824
+ static create<T>(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber<T>;
3825
+ /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
3826
+ protected isStopped: boolean;
3827
+ /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
3828
+ protected destination: Subscriber<any> | Observer$1<any>;
3829
+ /**
3830
+ * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
3831
+ * There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons.
3832
+ */
3833
+ constructor(destination?: Subscriber<any> | Observer$1<any>);
3834
+ /**
3835
+ * The {@link Observer} callback to receive notifications of type `next` from
3836
+ * the Observable, with a value. The Observable may call this method 0 or more
3837
+ * times.
3838
+ * @param value The `next` value.
3839
+ */
3840
+ next(value: T): void;
3841
+ /**
3842
+ * The {@link Observer} callback to receive notifications of type `error` from
3843
+ * the Observable, with an attached `Error`. Notifies the Observer that
3844
+ * the Observable has experienced an error condition.
3845
+ * @param err The `error` exception.
3846
+ */
3847
+ error(err?: any): void;
3848
+ /**
3849
+ * The {@link Observer} callback to receive a valueless notification of type
3850
+ * `complete` from the Observable. Notifies the Observer that the Observable
3851
+ * has finished sending push-based notifications.
3852
+ */
3853
+ complete(): void;
3854
+ unsubscribe(): void;
3855
+ protected _next(value: T): void;
3856
+ protected _error(err: any): void;
3857
+ protected _complete(): void;
3858
+ }
3859
+ interface Operator<T, R> {
3860
+ call(subscriber: Subscriber<R>, source: any): TeardownLogic;
3861
+ }
3862
+ declare class Observable$1<T> implements Subscribable$1<T> {
3863
+ /**
3864
+ * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
3865
+ */
3866
+ source: Observable$1<any> | undefined;
3867
+ /**
3868
+ * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
3869
+ */
3870
+ operator: Operator<any, T> | undefined;
3871
+ /**
3872
+ * @param subscribe The function that is called when the Observable is
3873
+ * initially subscribed to. This function is given a Subscriber, to which new values
3874
+ * can be `next`ed, or an `error` method can be called to raise an error, or
3875
+ * `complete` can be called to notify of a successful completion.
3876
+ */
3877
+ constructor(subscribe?: (this: Observable$1<T>, subscriber: Subscriber<T>) => TeardownLogic);
3878
+ /**
3879
+ * Creates a new Observable by calling the Observable constructor
3880
+ * @param subscribe the subscriber function to be passed to the Observable constructor
3881
+ * @return A new observable.
3882
+ * @deprecated Use `new Observable()` instead. Will be removed in v8.
3883
+ */
3884
+ static create: (...args: any[]) => any;
3885
+ /**
3886
+ * Creates a new Observable, with this Observable instance as the source, and the passed
3887
+ * operator defined as the new observable's operator.
3888
+ * @param operator the operator defining the operation to take on the observable
3889
+ * @return A new observable with the Operator applied.
3890
+ * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
3891
+ * If you have implemented an operator using `lift`, it is recommended that you create an
3892
+ * operator by simply returning `new Observable()` directly. See "Creating new operators from
3893
+ * scratch" section here: https://rxjs.dev/guide/operators
3894
+ */
3895
+ lift<R>(operator?: Operator<T, R>): Observable$1<R>;
3896
+ subscribe(observerOrNext?: Partial<Observer$1<T>> | ((value: T) => void)): Subscription;
3897
+ /** @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 */
3898
+ subscribe(next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null): Subscription;
3899
+ /**
3900
+ * Used as a NON-CANCELLABLE means of subscribing to an observable, for use with
3901
+ * APIs that expect promises, like `async/await`. You cannot unsubscribe from this.
3902
+ *
3903
+ * **WARNING**: Only use this with observables you *know* will complete. If the source
3904
+ * observable does not complete, you will end up with a promise that is hung up, and
3905
+ * potentially all of the state of an async function hanging out in memory. To avoid
3906
+ * this situation, look into adding something like {@link timeout}, {@link take},
3907
+ * {@link takeWhile}, or {@link takeUntil} amongst others.
3908
+ *
3909
+ * #### Example
3910
+ *
3911
+ * ```ts
3912
+ * import { interval, take } from 'rxjs';
3913
+ *
3914
+ * const source$ = interval(1000).pipe(take(4));
3915
+ *
3916
+ * async function getTotal() {
3917
+ * let total = 0;
3918
+ *
3919
+ * await source$.forEach(value => {
3920
+ * total += value;
3921
+ * console.log('observable -> ' + value);
3922
+ * });
3923
+ *
3924
+ * return total;
3925
+ * }
3926
+ *
3927
+ * getTotal().then(
3928
+ * total => console.log('Total: ' + total)
3929
+ * );
3930
+ *
3931
+ * // Expected:
3932
+ * // 'observable -> 0'
3933
+ * // 'observable -> 1'
3934
+ * // 'observable -> 2'
3935
+ * // 'observable -> 3'
3936
+ * // 'Total: 6'
3937
+ * ```
3938
+ *
3939
+ * @param next A handler for each value emitted by the observable.
3940
+ * @return A promise that either resolves on observable completion or
3941
+ * rejects with the handled error.
3942
+ */
3943
+ forEach(next: (value: T) => void): Promise<void>;
3944
+ /**
3945
+ * @param next a handler for each value emitted by the observable
3946
+ * @param promiseCtor a constructor function used to instantiate the Promise
3947
+ * @return a promise that either resolves on observable completion or
3948
+ * rejects with the handled error
3949
+ * @deprecated Passing a Promise constructor will no longer be available
3950
+ * in upcoming versions of RxJS. This is because it adds weight to the library, for very
3951
+ * little benefit. If you need this functionality, it is recommended that you either
3952
+ * polyfill Promise, or you create an adapter to convert the returned native promise
3953
+ * to whatever promise implementation you wanted. Will be removed in v8.
3954
+ */
3955
+ forEach(next: (value: T) => void, promiseCtor: PromiseConstructorLike): Promise<void>;
3956
+ pipe(): Observable$1<T>;
3957
+ pipe<A>(op1: OperatorFunction$1<T, A>): Observable$1<A>;
3958
+ pipe<A, B>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>): Observable$1<B>;
3959
+ pipe<A, B, C>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>): Observable$1<C>;
3960
+ 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>;
3961
+ 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>;
3962
+ 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>;
3963
+ 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>;
3964
+ 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>;
3965
+ 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>;
3966
+ 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>;
3967
+ /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */
3968
+ toPromise(): 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: typeof Promise): Promise<T | undefined>;
3971
+ /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */
3972
+ toPromise(PromiseCtor: PromiseConstructorLike): Promise<T | undefined>;
3973
+ }
3974
+ interface UnaryFunction$1<T, R> {
3975
+ (source: T): R;
3976
+ }
3977
+ interface OperatorFunction$1<T, R> extends UnaryFunction$1<Observable$1<T>, Observable$1<R>> {
3978
+ }
3979
+ interface Unsubscribable$1 {
3980
+ unsubscribe(): void;
3981
+ }
3982
+ declare type TeardownLogic = Subscription | Unsubscribable$1 | (() => void) | void;
3983
+ interface SubscriptionLike extends Unsubscribable$1 {
3984
+ unsubscribe(): void;
3985
+ readonly closed: boolean;
3986
+ }
3987
+ interface Subscribable$1<T> {
3988
+ subscribe(observer: Partial<Observer$1<T>>): Unsubscribable$1;
3989
+ }
3990
+ interface Observer$1<T> {
3991
+ /**
3992
+ * A callback function that gets called by the producer during the subscription when
3993
+ * the producer "has" the `value`. It won't be called if `error` or `complete` callback
3994
+ * functions have been called, nor after the consumer has unsubscribed.
3995
+ *
3996
+ * For more info, please refer to {@link guide/glossary-and-semantics#next this guide}.
3997
+ */
3998
+ next: (value: T) => void;
3999
+ /**
4000
+ * A callback function that gets called by the producer if and when it encountered a
4001
+ * problem of any kind. The errored value will be provided through the `err` parameter.
4002
+ * This callback can't be called more than one time, it can't be called if the
4003
+ * `complete` callback function have been called previously, nor it can't be called if
4004
+ * the consumer has unsubscribed.
4005
+ *
4006
+ * For more info, please refer to {@link guide/glossary-and-semantics#error this guide}.
4007
+ */
4008
+ error: (err: any) => void;
4009
+ /**
4010
+ * A callback function that gets called by the producer if and when it has no more
4011
+ * values to provide (by calling `next` callback function). This means that no error
4012
+ * has happened. This callback can't be called more than one time, it can't be called
4013
+ * if the `error` callback function have been called previously, nor it can't be called
4014
+ * if the consumer has unsubscribed.
4015
+ *
4016
+ * For more info, please refer to {@link guide/glossary-and-semantics#complete this guide}.
4017
+ */
4018
+ complete: () => void;
4019
+ }
1970
4020
  /**
1971
4021
  * Streaming/caching modes consistent with your REST client.
1972
4022
  */
1973
4023
  export type CacheMode = "cache-first" | "cache-only" | "network-first" | "network-only";
1974
- export type MyTRPCClient = TRPCClient<AppRouter>;
1975
- export 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;
1976
- export type Join<P extends string, K extends string> = P extends "" ? K : `${P}.${K}`;
1977
- export type IsFn<T> = T extends (...args: any[]) => any ? true : false;
1978
- export type TRPCPaths<TClient, Method extends string, P extends string = ""> = TClient extends object ? (Method extends keyof TClient ? IsFn<TClient[Method]> extends true ? P : {
4024
+ type MyTRPCClient = TRPCClient<AppRouter>;
4025
+ 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;
4026
+ type Join<P extends string, K extends string> = P extends "" ? K : `${P}.${K}`;
4027
+ type IsFn<T> = T extends (...args: any[]) => any ? true : false;
4028
+ type TRPCPaths<TClient, Method extends string, P extends string = ""> = TClient extends object ? (Method extends keyof TClient ? IsFn<TClient[Method]> extends true ? P : {
1979
4029
  [K in Extract<keyof TClient, string>]: TRPCPaths<TClient[K], Method, Join<P, K>>;
1980
4030
  }[Extract<keyof TClient, string>] : {
1981
4031
  [K in Extract<keyof TClient, string>]: TRPCPaths<TClient[K], Method, Join<P, K>>;
1982
4032
  }[Extract<keyof TClient, string>]) : never;
1983
- export type TRPCQueryPaths<TClient> = TRPCPaths<TClient, "query">;
1984
- export type TRPCMutatePaths<TClient> = TRPCPaths<TClient, "mutate">;
1985
- export type QueryPaths = TRPCQueryPaths<MyTRPCClient>;
1986
- export type MutatePaths = TRPCMutatePaths<MyTRPCClient>;
1987
- export type AnyFn = (...args: any[]) => any;
1988
- export type FirstParam<F> = F extends AnyFn ? Parameters<F> extends [
4033
+ type TRPCQueryPaths<TClient> = TRPCPaths<TClient, "query">;
4034
+ type TRPCMutatePaths<TClient> = TRPCPaths<TClient, "mutate">;
4035
+ type QueryPaths = TRPCQueryPaths<MyTRPCClient>;
4036
+ type MutatePaths = TRPCMutatePaths<MyTRPCClient>;
4037
+ type AnyFn = (...args: any[]) => any;
4038
+ type FirstParam<F> = F extends AnyFn ? Parameters<F> extends [
1989
4039
  infer A,
1990
4040
  ...any[]
1991
4041
  ] ? A : void : never;
1992
- export type RetType<F> = F extends AnyFn ? ReturnType<F> : never;
4042
+ type RetType<F> = F extends AnyFn ? ReturnType<F> : never;
1993
4043
  export interface Client {
1994
4044
  /**
1995
4045
  * Convenient wrapper for query execution. This wrapper automatically handles:
@@ -2006,7 +4056,7 @@ export interface Client {
2006
4056
  ]>;
2007
4057
  streamQuery<PathT extends QueryPaths, QueryResolverT = PathValue<MyTRPCClient, `${PathT}.query`>>(path: PathT, input: FirstParam<QueryResolverT>, opts?: {
2008
4058
  strategy?: CacheMode;
2009
- }): Observable<[
4059
+ }): Observable$1<[
2010
4060
  Awaited<RetType<QueryResolverT>> | null,
2011
4061
  TRPCClientError<any> | null
2012
4062
  ]>;
@@ -2041,9 +4091,8 @@ export interface Client {
2041
4091
  * Listen to auth state changes
2042
4092
  * @returns Unsubscribe function
2043
4093
  */
2044
- listenAuthState(listener: (props: {
2045
- loggedIn: boolean;
2046
- }) => void): (() => void);
4094
+ listenAuthState(listener: () => void): (() => void);
4095
+ loggedIn(): boolean;
2047
4096
  restoreSession(): Promise<void>;
2048
4097
  clearCache(): Promise<void>;
2049
4098
  }