Skip to content

Commit 76a8b31

Browse files
Fix lint errors
1 parent 6cb665e commit 76a8b31

File tree

3 files changed

+109
-109
lines changed

3 files changed

+109
-109
lines changed

src/server-return.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import { ReferencedResource } from './server-types';
77
* add a Location header and set status to 201
88
*/
99
export class NewResource<T> extends ReferencedResource<T> {
10-
/**
11-
* Constructor. Receives the location of the new resource created.
12-
* @param location To be added to the Location header on response
13-
* @param body To be added to the response body
14-
*/
10+
/**
11+
* Constructor. Receives the location of the new resource created.
12+
* @param location To be added to the Location header on response
13+
* @param body To be added to the response body
14+
*/
1515
constructor(location: string, body?: T) {
1616
super(location, 201, body);
1717
}
@@ -23,12 +23,12 @@ export class NewResource<T> extends ReferencedResource<T> {
2323
* can monitor his request processing status.
2424
*/
2525
export class RequestAccepted<T> extends ReferencedResource<T> {
26-
/**
27-
* Constructor. Receives the location where information about the
28-
* request processing can be found.
29-
* @param location To be added to the Location header on response
30-
* @param body To be added to the response body
31-
*/
26+
/**
27+
* Constructor. Receives the location where information about the
28+
* request processing can be found.
29+
* @param location To be added to the Location header on response
30+
* @param body To be added to the response body
31+
*/
3232
constructor(location: string, body?: T) {
3333
super(location, 202, body);
3434
}
@@ -40,11 +40,11 @@ export class RequestAccepted<T> extends ReferencedResource<T> {
4040
* new URI with their requests.
4141
*/
4242
export class MovedPermanently<T> extends ReferencedResource<T> {
43-
/**
44-
* Constructor. Receives the location where the resource can be found.
45-
* @param location To be added to the Location header on response
46-
* @param body To be added to the response body
47-
*/
43+
/**
44+
* Constructor. Receives the location where the resource can be found.
45+
* @param location To be added to the Location header on response
46+
* @param body To be added to the response body
47+
*/
4848
constructor(location: string, body?: T) {
4949
super(location, 301, body);
5050
}
@@ -56,11 +56,11 @@ export class MovedPermanently<T> extends ReferencedResource<T> {
5656
* still use the original URI to access the resource.
5757
*/
5858
export class MovedTemporarily<T> extends ReferencedResource<T> {
59-
/**
60-
* Constructor. Receives the location where the resource can be found.
61-
* @param location To be added to the Location header on response
62-
* @param body To be added to the response body
63-
*/
59+
/**
60+
* Constructor. Receives the location where the resource can be found.
61+
* @param location To be added to the Location header on response
62+
* @param body To be added to the response body
63+
*/
6464
constructor(location: string, body?: T) {
6565
super(location, 302, body);
6666
}
@@ -70,23 +70,23 @@ export class MovedTemporarily<T> extends ReferencedResource<T> {
7070
* Used to download a resource.
7171
*/
7272
export class DownloadResource {
73-
/**
74-
* Constructor.
75-
* @param filePath The file path to download.
76-
* @param fileName The file name
77-
*/
73+
/**
74+
* Constructor.
75+
* @param filePath The file path to download.
76+
* @param fileName The file name
77+
*/
7878
constructor(public filePath: string, public fileName: string) { }
7979
}
8080

8181
/**
8282
* Used to download binary data as a file.
8383
*/
8484
export class DownloadBinaryData {
85-
/**
86-
* Constructor. Receives the location of the resource.
87-
* @param content The binary data to be downloaded as a file.
88-
* @param mimeType The mime-type to be passed on Content-Type header.
89-
* @param fileName The file name
90-
*/
85+
/**
86+
* Constructor. Receives the location of the resource.
87+
* @param content The binary data to be downloaded as a file.
88+
* @param mimeType The mime-type to be passed on Content-Type header.
89+
* @param fileName The file name
90+
*/
9191
constructor(public content: Buffer, public mimeType: string, public fileName: string) { }
9292
}

src/server-types.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,26 @@ export enum HttpMethod {
1919
* Represents the current context of the request being handled.
2020
*/
2121
export class ServiceContext {
22-
/**
23-
* The resolved language to be used in the current request handling.
24-
*/
22+
/**
23+
* The resolved language to be used in the current request handling.
24+
*/
2525
language: string;
26-
/**
27-
* The preferred media type to be used in the current request handling.
28-
*/
26+
/**
27+
* The preferred media type to be used in the current request handling.
28+
*/
2929
accept: string;
30-
/**
31-
* The request object.
32-
*/
30+
/**
31+
* The request object.
32+
*/
3333
request: express.Request;
34-
/**
35-
* The response object
36-
*/
34+
/**
35+
* The response object
36+
*/
3737
response: express.Response;
38-
/**
39-
* The next function. It can be used to delegate to the next middleware
40-
* registered the processing of the current request.
41-
*/
38+
/**
39+
* The next function. It can be used to delegate to the next middleware
40+
* registered the processing of the current request.
41+
*/
4242
next: express.NextFunction;
4343
}
4444

@@ -58,27 +58,27 @@ export abstract class HttpError extends Error {
5858
* Used to create a reference to a resource.
5959
*/
6060
export abstract class ReferencedResource<T> {
61-
/**
62-
* Constructor. Receives the location of the resource.
63-
* @param location To be added to the Location header on response
64-
* @param statusCode the response status code to be sent
65-
* @param body the body to be sent
66-
*/
61+
/**
62+
* Constructor. Receives the location of the resource.
63+
* @param location To be added to the Location header on response
64+
* @param statusCode the response status code to be sent
65+
* @param body the body to be sent
66+
*/
6767
constructor(public location: string, public statusCode: number, public body?: T) { }
6868
}
6969

7070
/**
7171
* The factory used to instantiate the object services
7272
*/
7373
export interface ServiceFactory {
74-
/**
75-
* Create a new service object. Called before each request handling.
76-
*/
74+
/**
75+
* Create a new service object. Called before each request handling.
76+
*/
7777
create: (serviceClass: Function) => any;
78-
/**
79-
* Return the type used to handle requests to the target service.
80-
* By default, returns the serviceClass received, but you can use this
81-
* to implement IoC integrations.
82-
*/
78+
/**
79+
* Return the type used to handle requests to the target service.
80+
* By default, returns the serviceClass received, but you can use this
81+
* to implement IoC integrations.
82+
*/
8383
getTargetClass: (serviceClass: Function) => FunctionConstructor;
8484
}

src/server.ts

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ import * as path from 'path';
1313
* The Http server main class.
1414
*/
1515
export class Server {
16-
/**
17-
* Create the routes for all classes decorated with our decorators
18-
*/
16+
/**
17+
* Create the routes for all classes decorated with our decorators
18+
*/
1919
static buildServices(router: express.Router, ...types: any[]) {
2020
const iternalServer: InternalServer = new InternalServer(router);
2121
iternalServer.buildServices(types);
2222
}
2323

24-
/**
25-
* Return all paths accepted by the Server
26-
*/
24+
/**
25+
* Return all paths accepted by the Server
26+
*/
2727
static getPaths(): Array<string> {
2828
const result = new Array<string>();
2929
InternalServer.getPaths().forEach(value => {
@@ -33,19 +33,19 @@ export class Server {
3333
return result;
3434
}
3535

36-
/**
37-
* Register a custom serviceFactory. It will be used to instantiate the service Objects
38-
* If You plan to use a custom serviceFactory, You must ensure to call this method before any typescript-rest service declaration.
39-
*/
36+
/**
37+
* Register a custom serviceFactory. It will be used to instantiate the service Objects
38+
* If You plan to use a custom serviceFactory, You must ensure to call this method before any typescript-rest service declaration.
39+
*/
4040
static registerServiceFactory(serviceFactory: ServiceFactory) {
4141
InternalServer.serviceFactory = serviceFactory;
4242
}
4343

44-
/**
45-
* Configure the Server to use [typescript-ioc](https://github.com/thiagobustamante/typescript-ioc)
46-
* to instantiate the service objects.
47-
* If You plan to use IoC, You must ensure to call this method before any typescript-rest service declaration.
48-
*/
44+
/**
45+
* Configure the Server to use [typescript-ioc](https://github.com/thiagobustamante/typescript-ioc)
46+
* to instantiate the service objects.
47+
* If You plan to use IoC, You must ensure to call this method before any typescript-rest service declaration.
48+
*/
4949
static useIoC() {
5050
const ioc = require('typescript-ioc');
5151
Server.registerServiceFactory({
@@ -67,10 +67,10 @@ export class Server {
6767
});
6868
}
6969

70-
/**
71-
* Return the set oh HTTP verbs configured for the given path
72-
* @param path The path to search HTTP verbs
73-
*/
70+
/**
71+
* Return the set oh HTTP verbs configured for the given path
72+
* @param path The path to search HTTP verbs
73+
*/
7474
static getHttpMethods(path: string): Array<HttpMethod> {
7575
const result = new Array<HttpMethod>();
7676
InternalServer.getHttpMethods(path).forEach(value => {
@@ -80,51 +80,51 @@ export class Server {
8080
return result;
8181
}
8282

83-
/**
84-
* A string used for signing cookies. This is optional and if not specified,
85-
* will not parse signed cookies.
86-
* @param secret the secret used to sign
87-
*/
83+
/**
84+
* A string used for signing cookies. This is optional and if not specified,
85+
* will not parse signed cookies.
86+
* @param secret the secret used to sign
87+
*/
8888
static setCookiesSecret(secret: string) {
8989
InternalServer.cookiesSecret = secret;
9090
}
9191

92-
/**
93-
* Specifies a function that will be used to decode a cookie's value.
94-
* This function can be used to decode a previously-encoded cookie value
95-
* into a JavaScript string.
96-
* The default function is the global decodeURIComponent, which will decode
97-
* any URL-encoded sequences into their byte representations.
98-
*
99-
* NOTE: if an error is thrown from this function, the original, non-decoded
100-
* cookie value will be returned as the cookie's value.
101-
* @param decoder The decoder function
102-
*/
92+
/**
93+
* Specifies a function that will be used to decode a cookie's value.
94+
* This function can be used to decode a previously-encoded cookie value
95+
* into a JavaScript string.
96+
* The default function is the global decodeURIComponent, which will decode
97+
* any URL-encoded sequences into their byte representations.
98+
*
99+
* NOTE: if an error is thrown from this function, the original, non-decoded
100+
* cookie value will be returned as the cookie's value.
101+
* @param decoder The decoder function
102+
*/
103103
static setCookiesDecoder(decoder: (val: string) => string) {
104104
InternalServer.cookiesDecoder = decoder;
105105
}
106106

107-
/**
108-
* Set where to store the uploaded files
109-
* @param dest Destination folder
110-
*/
107+
/**
108+
* Set where to store the uploaded files
109+
* @param dest Destination folder
110+
*/
111111
static setFileDest(dest: string) {
112112
InternalServer.fileDest = dest;
113113
}
114114

115-
/**
116-
* Set a Function to control which files are accepted to upload
117-
* @param filter The filter function
118-
*/
115+
/**
116+
* Set a Function to control which files are accepted to upload
117+
* @param filter The filter function
118+
*/
119119
static setFileFilter(filter: (req: Express.Request, file: Express.Multer.File,
120120
callback: (error: Error, acceptFile: boolean) => void) => void) {
121121
InternalServer.fileFilter = filter;
122122
}
123123

124-
/**
125-
* Set the limits of uploaded data
126-
* @param limit The data limit
127-
*/
124+
/**
125+
* Set the limits of uploaded data
126+
* @param limit The data limit
127+
*/
128128
static setFileLimits(limit: number) {
129129
InternalServer.fileLimits = limit;
130130
}

0 commit comments

Comments
 (0)