@tahminator/sapling 1.5.3 → 1.5.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.
|
@@ -19,7 +19,7 @@ export declare class Sapling {
|
|
|
19
19
|
* app.use(router);
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
static resolve<TClass>(clazz: Class<TClass>): Router;
|
|
22
|
+
static resolve<TClass>(this: void, clazz: Class<TClass>): Router;
|
|
23
23
|
/**
|
|
24
24
|
* Register this function as a middleware in order to utilize Sapling's `deserialize` function.
|
|
25
25
|
*
|
|
@@ -32,7 +32,7 @@ export declare class Sapling {
|
|
|
32
32
|
* app.use(Sapling.json());
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
|
-
static json(): ExpressMiddlewareFn;
|
|
35
|
+
static json(this: void): ExpressMiddlewareFn;
|
|
36
36
|
/**
|
|
37
37
|
* Register your application with all the necessary middlewares and logics for Sapling to function.
|
|
38
38
|
*
|
|
@@ -68,7 +68,7 @@ export declare class Sapling {
|
|
|
68
68
|
* });
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
71
|
-
static loadResponseStatusErrorMiddleware(app: e.Express, fn: (err: ResponseStatusError, request: e.Request, response: e.Response, next: e.NextFunction) => void): void;
|
|
71
|
+
static loadResponseStatusErrorMiddleware(this: void, app: e.Express, fn: (err: ResponseStatusError, request: e.Request, response: e.Response, next: e.NextFunction) => void): void;
|
|
72
72
|
/**
|
|
73
73
|
* Serialize a value into a JSON string.
|
|
74
74
|
*
|
|
@@ -78,11 +78,11 @@ export declare class Sapling {
|
|
|
78
78
|
*
|
|
79
79
|
* @defaultValue `JSON.stringify`
|
|
80
80
|
*/
|
|
81
|
-
static serialize(value: any): string;
|
|
81
|
+
static serialize(this: void, value: any): string;
|
|
82
82
|
/**
|
|
83
83
|
* Replace the function used for `serialize`.
|
|
84
84
|
*/
|
|
85
|
-
static setSerializeFn(fn: (value: any) => string): void;
|
|
85
|
+
static setSerializeFn(this: void, fn: (value: any) => string): void;
|
|
86
86
|
/**
|
|
87
87
|
* De-serialize a JSON string back to a JavaScript object.
|
|
88
88
|
*
|
|
@@ -92,9 +92,9 @@ export declare class Sapling {
|
|
|
92
92
|
*
|
|
93
93
|
* @defaultValue `JSON.parse`
|
|
94
94
|
*/
|
|
95
|
-
static deserialize<T = any>(value: string): T;
|
|
95
|
+
static deserialize<T = any>(this: void, value: string): T;
|
|
96
96
|
/**
|
|
97
97
|
* Replace the function used for `deserialize`
|
|
98
98
|
*/
|
|
99
|
-
static setDeserializeFn(fn: (value: string) => any): void;
|
|
99
|
+
static setDeserializeFn(this: void, fn: (value: string) => any): void;
|
|
100
100
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from "express";
|
|
2
2
|
import { _ControllerRegistry } from "../annotation/controller";
|
|
3
3
|
import { ResponseStatusError } from "./error";
|
|
4
|
-
|
|
4
|
+
const settings = {
|
|
5
5
|
serialize: JSON.stringify,
|
|
6
6
|
deserialize: JSON.parse,
|
|
7
7
|
};
|
|
@@ -80,7 +80,7 @@ export class Sapling {
|
|
|
80
80
|
*/
|
|
81
81
|
static registerApp(app) {
|
|
82
82
|
app.use(e.text({ type: "application/json" }));
|
|
83
|
-
app.use(
|
|
83
|
+
app.use(Sapling.json());
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
86
|
* Register a middleware that will handle {@link ResponseStatusError}.
|