@tramvai/papi 2.39.3 → 2.44.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/types.d.ts +4 -4
- package/package.json +1 -1
package/lib/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { ProvideDepsIterator } from '@tinkoff/dippy';
|
|
|
4
4
|
import type { Url } from '@tinkoff/url';
|
|
5
5
|
import type { REQUEST_MANAGER_TOKEN, RESPONSE_MANAGER_TOKEN, Logger } from '@tramvai/tokens-common';
|
|
6
6
|
import type { PAPI_PARAMETERS } from './createPapiMethod';
|
|
7
|
-
export
|
|
7
|
+
export type Method = 'all' | 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options' | 'head';
|
|
8
8
|
export interface Options {
|
|
9
9
|
/**
|
|
10
10
|
* Timeout in ms for handling request. If timeout is exceeded the response is resolved with 500 status.
|
|
@@ -27,7 +27,7 @@ export interface PapiHandlerContext<Deps> {
|
|
|
27
27
|
log: Logger;
|
|
28
28
|
deps: ProvideDepsIterator<Deps>;
|
|
29
29
|
}
|
|
30
|
-
export
|
|
30
|
+
export type NormalizedHandler<Result, Deps> = (this: PapiHandlerContext<Deps>, options: PapiHandlerOptions) => Result;
|
|
31
31
|
export interface PapiParameters<Result, Deps> {
|
|
32
32
|
path?: string;
|
|
33
33
|
method?: Method;
|
|
@@ -35,10 +35,10 @@ export interface PapiParameters<Result, Deps> {
|
|
|
35
35
|
options?: Options;
|
|
36
36
|
deps?: Deps;
|
|
37
37
|
}
|
|
38
|
-
export
|
|
38
|
+
export type NormalizedPapiParameters<Result, Deps> = Required<PapiParameters<Result, Deps>> & {
|
|
39
39
|
handler: NormalizedHandler<Result, Deps>;
|
|
40
40
|
options: Required<Options>;
|
|
41
41
|
};
|
|
42
|
-
export
|
|
42
|
+
export type Papi<Result = any, Deps = any> = NormalizedHandler<Deps, Result> & {
|
|
43
43
|
[PAPI_PARAMETERS]: NormalizedPapiParameters<Deps, Result>;
|
|
44
44
|
};
|