@orion-js/http 3.11.8 → 3.12.0

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.
@@ -0,0 +1,79 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ import express from 'express';
4
+ import { Request as Request$1, Response as Response$1 } from 'express';
5
+
6
+ export type onErrorFunction = (req: express.Request, res: express.Response, error: any) => Promise<void>;
7
+ export declare const onError: onErrorFunction;
8
+ export declare const setOnError: (onErrorFunc: onErrorFunction) => void;
9
+ export declare const getViewer: (req: express.Request) => Promise<any>;
10
+ export declare const setGetViewer: (getViewerFunc: (req: express.Request) => any) => void;
11
+ export interface StartOrionOptions {
12
+ keepAliveTimeout?: number;
13
+ }
14
+ export declare const startServer: (port?: number, otherOptions?: StartOrionOptions) => express.Express;
15
+ export declare const getApp: () => express.Express;
16
+ export declare const getServer: () => any;
17
+ export interface RouteResponseObject {
18
+ statusCode?: number;
19
+ headers?: {
20
+ [key: string]: string;
21
+ };
22
+ body: string | object;
23
+ }
24
+ export type RouteResponse = Promise<RouteResponseObject | void>;
25
+ export type RouteResolve = (req: express.Request, res: express.Response, viewer: any) => RouteResponse;
26
+ export interface OrionRouteOptions {
27
+ /**
28
+ * The http method of the requests to match.
29
+ */
30
+ method: "get" | "post" | "put" | "delete" | "all";
31
+ /**
32
+ * The path of the requests to match.
33
+ */
34
+ path: string;
35
+ /**
36
+ * Select the body parser to use for this route.
37
+ */
38
+ bodyParser?: "json" | "text" | "urlencoded";
39
+ /**
40
+ * Selected body parser options.
41
+ */
42
+ bodyParserOptions?: bodyParser.OptionsJson | bodyParser.OptionsText | bodyParser.OptionsUrlencoded;
43
+ /**
44
+ * Add a middleware to the route.
45
+ * See https://expressjs.com/en/4x/api.html#middleware
46
+ * for more information.
47
+ */
48
+ middlewares?: Array<express.RequestHandler>;
49
+ resolve: RouteResolve;
50
+ /**
51
+ * Pass another express app
52
+ */
53
+ app?: express.Application;
54
+ }
55
+ export interface RouteType extends OrionRouteOptions {
56
+ }
57
+ export interface RoutesMap {
58
+ [key: string]: RouteType;
59
+ }
60
+ export function route(options: OrionRouteOptions): RouteType;
61
+ export function registerRoute(route: RouteType): void;
62
+ export function registerRoutes(routesMap: RoutesMap): void;
63
+ export declare function Routes(): ClassDecorator;
64
+ export declare function Route(options: Omit<OrionRouteOptions, "resolve">): (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<RouteResolve>) => void;
65
+ export declare function getServiceRoutes(target: any): RoutesMap;
66
+ export declare const bodyParser: {
67
+ json: (options?: import("body-parser").OptionsJson) => import("connect").NextHandleFunction;
68
+ raw: (options?: import("body-parser").Options) => import("connect").NextHandleFunction;
69
+ text: (options?: import("body-parser").OptionsText) => import("connect").NextHandleFunction;
70
+ urlencoded: (options?: import("body-parser").OptionsUrlencoded) => import("connect").NextHandleFunction;
71
+ };
72
+
73
+ export {
74
+ Request$1 as Request,
75
+ Response$1 as Response,
76
+ express,
77
+ };
78
+
79
+ export {};