resting-squirrel-controller 2.2.1 → 2.5.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.
- package/dist/controller.d.ts +21 -9
- package/dist/controller.js +30 -3
- package/dist/controller.js.map +1 -1
- package/dist/decorators/controller-options.d.ts +2 -2
- package/dist/decorators/methods.d.ts +1 -0
- package/dist/decorators/methods.js +53 -9
- package/dist/decorators/methods.js.map +1 -1
- package/dist/decorators/options.d.ts +3 -2
- package/dist/decorators/options.js.map +1 -1
- package/dist/decorators/resource.d.ts +3 -0
- package/dist/decorators/resource.js +8 -0
- package/dist/decorators/resource.js.map +1 -0
- package/dist/utils.d.ts +11 -11
- package/dist/utils.js +2 -1
- package/dist/utils.js.map +1 -1
- package/package.json +14 -12
package/dist/controller.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Application,
|
|
1
|
+
import { Application, Field, IRequest, IResponse, IRouteOptions, Response, RouteAuth } from 'resting-squirrel';
|
|
2
2
|
import { ArgsDto, BaseDto, RequestDto, ResponseDto } from 'resting-squirrel-dto';
|
|
3
|
-
import { IOptions as IControllerOptions } from './decorators/controller-options';
|
|
4
3
|
import { IOptions, RSDtoType } from './decorators/options';
|
|
5
4
|
export interface IStore {
|
|
6
5
|
__endpoints__: Array<IEndpoint>;
|
|
@@ -10,9 +9,9 @@ export interface IStore {
|
|
|
10
9
|
__deprecated__: Array<string>;
|
|
11
10
|
}
|
|
12
11
|
export interface IEndpoint {
|
|
13
|
-
method: 'get' | 'put' | 'post' | 'delete';
|
|
12
|
+
method: 'get' | 'put' | 'post' | 'delete' | 'head';
|
|
14
13
|
route: string;
|
|
15
|
-
callback: (req: IRequest) => void | Promise<any>;
|
|
14
|
+
callback: (req: IRequest, res: any) => void | Promise<any>;
|
|
16
15
|
propertyKey: string;
|
|
17
16
|
}
|
|
18
17
|
declare class E {
|
|
@@ -32,6 +31,10 @@ declare class E {
|
|
|
32
31
|
* The endpoint is executed with `DELETE` method.
|
|
33
32
|
*/
|
|
34
33
|
static delete: (endpoint: string) => (target: Controller, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
34
|
+
/**
|
|
35
|
+
* The endpoint is executed with `HEAD` method.
|
|
36
|
+
*/
|
|
37
|
+
static head: (endpoint: string) => (target: Controller, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
35
38
|
/**
|
|
36
39
|
* Defines options to the endpoint.
|
|
37
40
|
*/
|
|
@@ -41,7 +44,9 @@ declare class E {
|
|
|
41
44
|
/**
|
|
42
45
|
* Define specific option to the endpoint.
|
|
43
46
|
*/
|
|
44
|
-
static option: <K extends
|
|
47
|
+
static option: <K extends keyof IOptions<{
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
}>>(option: K, value: IOptions<{
|
|
45
50
|
[key: string]: any;
|
|
46
51
|
}>[K]) => (target: Controller, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
47
52
|
/**
|
|
@@ -63,7 +68,7 @@ declare class E {
|
|
|
63
68
|
/**
|
|
64
69
|
* Sets the `errors` option to the endpoint.
|
|
65
70
|
*/
|
|
66
|
-
static errors: (errors:
|
|
71
|
+
static errors: (errors: IOptions['errors']) => (target: Controller, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
67
72
|
/**
|
|
68
73
|
* Sets the `description` option to the endpoint.
|
|
69
74
|
*/
|
|
@@ -102,6 +107,7 @@ declare class E {
|
|
|
102
107
|
* Sets the endpoint as deprecated.
|
|
103
108
|
*/
|
|
104
109
|
static deprecated: (target: Controller, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
110
|
+
static redirect: (target: Controller, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
105
111
|
}
|
|
106
112
|
export default class Controller {
|
|
107
113
|
/**
|
|
@@ -112,9 +118,10 @@ export default class Controller {
|
|
|
112
118
|
* @alias version
|
|
113
119
|
*/
|
|
114
120
|
static v: (version: number) => (target: typeof Controller) => void;
|
|
115
|
-
static controllerOptions: (options: Partial<
|
|
121
|
+
static controllerOptions: (options: Partial<import("./decorators/controller-options").IOptions<{
|
|
116
122
|
[key: string]: any;
|
|
117
123
|
}>>) => (target: typeof Controller) => void;
|
|
124
|
+
static resource: (resource: string) => (target: typeof Controller) => void;
|
|
118
125
|
static Endpoint: typeof E;
|
|
119
126
|
/**
|
|
120
127
|
* Marks the endpoint on the method as deprecated.
|
|
@@ -152,7 +159,9 @@ export default class Controller {
|
|
|
152
159
|
* Define specific option to the endpoint.
|
|
153
160
|
* @deprecated
|
|
154
161
|
*/
|
|
155
|
-
static option: <K extends
|
|
162
|
+
static option: <K extends keyof IOptions<{
|
|
163
|
+
[key: string]: any;
|
|
164
|
+
}>>(option: K, value: IOptions<{
|
|
156
165
|
[key: string]: any;
|
|
157
166
|
}>[K]) => (target: Controller, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
158
167
|
/**
|
|
@@ -179,7 +188,7 @@ export default class Controller {
|
|
|
179
188
|
* Sets the `errors` option to the endpoint.
|
|
180
189
|
* @deprecated
|
|
181
190
|
*/
|
|
182
|
-
static errors: (errors:
|
|
191
|
+
static errors: (errors: IOptions['errors']) => (target: Controller, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
183
192
|
/**
|
|
184
193
|
* Sets the `description` option to the endpoint.
|
|
185
194
|
* @deprecated
|
|
@@ -233,10 +242,13 @@ export default class Controller {
|
|
|
233
242
|
private _app;
|
|
234
243
|
constructor(app: Application);
|
|
235
244
|
register(): void;
|
|
245
|
+
beforeExecution(req: IRequest, res: IResponse): Promise<void>;
|
|
236
246
|
protected getEndpoints(): Array<IEndpoint>;
|
|
237
247
|
protected getVersion(): number;
|
|
248
|
+
protected getResource(): string;
|
|
238
249
|
protected getOptions(propertyKey: string): IRouteOptions;
|
|
239
250
|
protected isDeprecated(propertyKey: string): boolean;
|
|
251
|
+
protected getRoute(route: string): string;
|
|
240
252
|
private _getParamsArray;
|
|
241
253
|
private _getResponseArray;
|
|
242
254
|
}
|
package/dist/controller.js
CHANGED
|
@@ -27,6 +27,7 @@ const controller_options_1 = require("./decorators/controller-options");
|
|
|
27
27
|
const deprecated_1 = require("./decorators/deprecated");
|
|
28
28
|
const methods_1 = require("./decorators/methods");
|
|
29
29
|
const options_1 = require("./decorators/options");
|
|
30
|
+
const resource_1 = require("./decorators/resource");
|
|
30
31
|
const version_1 = require("./decorators/version");
|
|
31
32
|
const utils_1 = require("./utils");
|
|
32
33
|
class E {
|
|
@@ -47,6 +48,10 @@ E.post = methods_1.post;
|
|
|
47
48
|
* The endpoint is executed with `DELETE` method.
|
|
48
49
|
*/
|
|
49
50
|
E.delete = methods_1.del;
|
|
51
|
+
/**
|
|
52
|
+
* The endpoint is executed with `HEAD` method.
|
|
53
|
+
*/
|
|
54
|
+
E.head = methods_1.head;
|
|
50
55
|
/**
|
|
51
56
|
* Defines options to the endpoint.
|
|
52
57
|
*/
|
|
@@ -114,6 +119,8 @@ E.emptyResponse = E.response(null);
|
|
|
114
119
|
*/
|
|
115
120
|
// tslint:disable-next-line: member-ordering
|
|
116
121
|
E.deprecated = deprecated_1.default;
|
|
122
|
+
// tslint:disable-next-line: member-ordering
|
|
123
|
+
E.redirect = E.options({ redirect: true });
|
|
117
124
|
// tslint:disable-next-line: max-classes-per-file
|
|
118
125
|
class Controller {
|
|
119
126
|
constructor(app) {
|
|
@@ -137,7 +144,7 @@ class Controller {
|
|
|
137
144
|
continue;
|
|
138
145
|
}
|
|
139
146
|
try {
|
|
140
|
-
const M = utils_1.requireModule(filename);
|
|
147
|
+
const M = (0, utils_1.requireModule)(filename);
|
|
141
148
|
if (M && M.prototype && M.prototype instanceof this) {
|
|
142
149
|
M.register(app);
|
|
143
150
|
}
|
|
@@ -159,22 +166,28 @@ class Controller {
|
|
|
159
166
|
for (const endpoint of this.getEndpoints()) {
|
|
160
167
|
let e;
|
|
161
168
|
if (version !== undefined) {
|
|
162
|
-
e = this._app.registerRoute(endpoint.method, version, endpoint.route, this.getOptions(endpoint.propertyKey), endpoint.callback);
|
|
169
|
+
e = this._app.registerRoute(endpoint.method, version, this.getRoute(endpoint.route), this.getOptions(endpoint.propertyKey), endpoint.callback);
|
|
163
170
|
}
|
|
164
171
|
else {
|
|
165
|
-
e = this._app.registerRoute(endpoint.method, endpoint.route, this.getOptions(endpoint.propertyKey), endpoint.callback);
|
|
172
|
+
e = this._app.registerRoute(endpoint.method, this.getRoute(endpoint.route), this.getOptions(endpoint.propertyKey), endpoint.callback);
|
|
166
173
|
}
|
|
167
174
|
if (this.isDeprecated(endpoint.propertyKey)) {
|
|
168
175
|
e.deprecate();
|
|
169
176
|
}
|
|
170
177
|
}
|
|
171
178
|
}
|
|
179
|
+
beforeExecution(req, res) {
|
|
180
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
181
|
+
}
|
|
172
182
|
getEndpoints() {
|
|
173
183
|
return this.__endpoints__ || [];
|
|
174
184
|
}
|
|
175
185
|
getVersion() {
|
|
176
186
|
return this.constructor.__version__;
|
|
177
187
|
}
|
|
188
|
+
getResource() {
|
|
189
|
+
return this.constructor.__resource__;
|
|
190
|
+
}
|
|
178
191
|
getOptions(propertyKey) {
|
|
179
192
|
const t = this;
|
|
180
193
|
const controllerOptions = this.constructor.__options__;
|
|
@@ -205,6 +218,19 @@ class Controller {
|
|
|
205
218
|
}
|
|
206
219
|
return t.__deprecated__.includes(propertyKey);
|
|
207
220
|
}
|
|
221
|
+
getRoute(route) {
|
|
222
|
+
let resource = this.getResource();
|
|
223
|
+
if (!resource) {
|
|
224
|
+
return route;
|
|
225
|
+
}
|
|
226
|
+
if (resource.indexOf('/') !== 0) {
|
|
227
|
+
resource = `/${resource}`;
|
|
228
|
+
}
|
|
229
|
+
if (route.indexOf('/') !== 0) {
|
|
230
|
+
route = `/${route}`;
|
|
231
|
+
}
|
|
232
|
+
return `${resource}${route}`;
|
|
233
|
+
}
|
|
208
234
|
_getParamsArray(params, optional = [], omit = []) {
|
|
209
235
|
if (!params) {
|
|
210
236
|
return undefined;
|
|
@@ -238,6 +264,7 @@ Controller.version = version_1.default;
|
|
|
238
264
|
*/
|
|
239
265
|
Controller.v = Controller.version;
|
|
240
266
|
Controller.controllerOptions = controller_options_1.default;
|
|
267
|
+
Controller.resource = resource_1.default;
|
|
241
268
|
Controller.Endpoint = E;
|
|
242
269
|
/**
|
|
243
270
|
* Marks the endpoint on the method as deprecated.
|
package/dist/controller.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../src/controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA6B;AAC7B,uDAc0B;AAC1B,+
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../src/controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA6B;AAC7B,uDAc0B;AAC1B,+DAAwF;AAExF,wEAAgE;AAChE,wDAAiD;AACjD,kDAAiE;AACjE,kDAA6E;AAC7E,oDAAsD;AACtD,kDAAoD;AAEpD,mCAA4C;AAe5C,MAAM,CAAC;;AACN;;GAEG;AACW,KAAG,GAAG,aAAG,CAAC;AAExB;;GAEG;AACW,KAAG,GAAG,aAAG,CAAC;AAExB;;GAEG;AACW,MAAI,GAAG,cAAI,CAAC;AAE1B;;GAEG;AACW,QAAM,GAAG,aAAG,CAAC;AAE3B;;GAEG;AACW,MAAI,GAAG,cAAI,CAAC;AAE1B;;GAEG;AACW,SAAO,GAAG,iBAAgB,CAAC;AAEzC;;GAEG;AACW,QAAM,GAAG,CACtB,MAAS,EAAE,KAAkB,EAC5B,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;AAEnC;;GAEG;AACW,MAAI,GAAG,CAAC,IAAe,EAAE,EAAE,CAAC,CAAC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;;;GAGG;AACW,wBAAa,GAAG,CAAC,aAAsB,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC;AAEhG;;;GAGG;AACW,0BAAe,GAAG,CAAC,eACa,EAC5C,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC,CAAA;AAE5C;;;GAGG;AACW,kBAAO,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;AAE7E;;;GAGG;AACW,gBAAK,GAAG,CAAkC,KAAa,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAExG;;;GAGG;AACH,4CAA4C;AAC9B,wBAAa,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IRouteOptions, RouteAuth } from 'resting-squirrel';
|
|
2
2
|
import { IRSDto } from 'resting-squirrel-dto';
|
|
3
3
|
import Controller from '../controller';
|
|
4
4
|
export declare type RSDtoType = new (...args: Array<any>) => IRSDto;
|
|
@@ -6,7 +6,7 @@ export interface IOptions<IProps = {
|
|
|
6
6
|
[key: string]: any;
|
|
7
7
|
}> {
|
|
8
8
|
auth: RouteAuth;
|
|
9
|
-
errors:
|
|
9
|
+
errors: IRouteOptions['errors'];
|
|
10
10
|
hideDocs: boolean;
|
|
11
11
|
requireApiKey: boolean;
|
|
12
12
|
excludedApiKeys: (() => Promise<Array<string>>) | Array<string>;
|
|
@@ -3,3 +3,4 @@ export declare const put: (endpoint: string) => (target: Controller, propertyKey
|
|
|
3
3
|
export declare const get: (endpoint: string) => (target: Controller, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
4
4
|
export declare const post: (endpoint: string) => (target: Controller, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
5
5
|
export declare const del: (endpoint: string) => (target: Controller, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
6
|
+
export declare const head: (endpoint: string) => (target: Controller, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.del = exports.post = exports.get = exports.put = void 0;
|
|
4
|
-
|
|
12
|
+
exports.head = exports.del = exports.post = exports.get = exports.put = void 0;
|
|
13
|
+
const put = (endpoint) => {
|
|
5
14
|
return (target, propertyKey, descriptor) => {
|
|
6
15
|
const t = target;
|
|
7
16
|
if (!t.__endpoints__) {
|
|
8
17
|
t.__endpoints__ = [];
|
|
9
18
|
}
|
|
10
19
|
t.__endpoints__.push({
|
|
11
|
-
callback: (req) =>
|
|
20
|
+
callback: (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
yield target.beforeExecution(req, res);
|
|
22
|
+
return descriptor.value.apply(target, [req, res]);
|
|
23
|
+
}),
|
|
12
24
|
method: 'put',
|
|
13
25
|
propertyKey,
|
|
14
26
|
route: endpoint,
|
|
@@ -16,14 +28,18 @@ exports.put = (endpoint) => {
|
|
|
16
28
|
return descriptor;
|
|
17
29
|
};
|
|
18
30
|
};
|
|
19
|
-
exports.
|
|
31
|
+
exports.put = put;
|
|
32
|
+
const get = (endpoint) => {
|
|
20
33
|
return (target, propertyKey, descriptor) => {
|
|
21
34
|
const t = target;
|
|
22
35
|
if (!t.__endpoints__) {
|
|
23
36
|
t.__endpoints__ = [];
|
|
24
37
|
}
|
|
25
38
|
t.__endpoints__.push({
|
|
26
|
-
callback: (req) =>
|
|
39
|
+
callback: (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
yield target.beforeExecution(req, res);
|
|
41
|
+
return descriptor.value.apply(target, [req, res]);
|
|
42
|
+
}),
|
|
27
43
|
method: 'get',
|
|
28
44
|
propertyKey,
|
|
29
45
|
route: endpoint,
|
|
@@ -31,14 +47,18 @@ exports.get = (endpoint) => {
|
|
|
31
47
|
return descriptor;
|
|
32
48
|
};
|
|
33
49
|
};
|
|
34
|
-
exports.
|
|
50
|
+
exports.get = get;
|
|
51
|
+
const post = (endpoint) => {
|
|
35
52
|
return (target, propertyKey, descriptor) => {
|
|
36
53
|
const t = target;
|
|
37
54
|
if (!t.__endpoints__) {
|
|
38
55
|
t.__endpoints__ = [];
|
|
39
56
|
}
|
|
40
57
|
t.__endpoints__.push({
|
|
41
|
-
callback: (req) =>
|
|
58
|
+
callback: (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
yield target.beforeExecution(req, res);
|
|
60
|
+
return descriptor.value.apply(target, [req, res]);
|
|
61
|
+
}),
|
|
42
62
|
method: 'post',
|
|
43
63
|
propertyKey,
|
|
44
64
|
route: endpoint,
|
|
@@ -46,14 +66,18 @@ exports.post = (endpoint) => {
|
|
|
46
66
|
return descriptor;
|
|
47
67
|
};
|
|
48
68
|
};
|
|
49
|
-
exports.
|
|
69
|
+
exports.post = post;
|
|
70
|
+
const del = (endpoint) => {
|
|
50
71
|
return (target, propertyKey, descriptor) => {
|
|
51
72
|
const t = target;
|
|
52
73
|
if (!t.__endpoints__) {
|
|
53
74
|
t.__endpoints__ = [];
|
|
54
75
|
}
|
|
55
76
|
t.__endpoints__.push({
|
|
56
|
-
callback: (req) =>
|
|
77
|
+
callback: (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
|
+
yield target.beforeExecution(req, res);
|
|
79
|
+
return descriptor.value.apply(target, [req, res]);
|
|
80
|
+
}),
|
|
57
81
|
method: 'delete',
|
|
58
82
|
propertyKey,
|
|
59
83
|
route: endpoint,
|
|
@@ -61,4 +85,24 @@ exports.del = (endpoint) => {
|
|
|
61
85
|
return descriptor;
|
|
62
86
|
};
|
|
63
87
|
};
|
|
88
|
+
exports.del = del;
|
|
89
|
+
const head = (endpoint) => {
|
|
90
|
+
return (target, propertyKey, descriptor) => {
|
|
91
|
+
const t = target;
|
|
92
|
+
if (!t.__endpoints__) {
|
|
93
|
+
t.__endpoints__ = [];
|
|
94
|
+
}
|
|
95
|
+
t.__endpoints__.push({
|
|
96
|
+
callback: (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
97
|
+
yield target.beforeExecution(req, res);
|
|
98
|
+
return descriptor.value.apply(target, [req, res]);
|
|
99
|
+
}),
|
|
100
|
+
method: 'head',
|
|
101
|
+
propertyKey,
|
|
102
|
+
route: endpoint,
|
|
103
|
+
});
|
|
104
|
+
return descriptor;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
exports.head = head;
|
|
64
108
|
//# sourceMappingURL=methods.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"methods.js","sourceRoot":"","sources":["../../src/decorators/methods.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"methods.js","sourceRoot":"","sources":["../../src/decorators/methods.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGO,MAAM,GAAG,GAAG,CAAC,QAAgB,EAAE,EAAE;IACvC,OAAO,CAAC,MAAkB,EAAE,WAAmB,EAAE,UAA8B,EAAE,EAAE;QAClF,MAAM,CAAC,GAAW,MAAa,CAAC;QAChC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W;YACX,KAAK,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,UAAU,CAAC;IACnB,CAAC,CAAC;AACH,CAAC,CAAC;AAjBW,QAAA,GAAG,OAiBd;AAEK,MAAM,IAAI,GAAG,CAAC,QAAgB,EAAE,EAAE;IACxC,OAAO,CAAC,MAAkB,EAAE,WAAmB,EAAE,UAA8B,EAAE,EAAE;QAClF,MAAM,CAAC,GAAW,MAAa,CAAC;QAChC,IAAI,CAAC,CAAC,CAAC,aAAa,EAAE;YACrB,CAAC,CAAC,aAAa,GAAG,EAAE,CAAC;SACrB;QACD,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC;YACpB,QAAQ,EAAE,CAAO,GAAa,EAAE,GAAQ,EAAE,EAAE;gBAC3C,MAAM,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACvC,OAAO,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;YAClD,CAAC,CAAA;YACD,MAAM,EAAE,MAAM;YACd,WAAW;YACX,KAAK,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,UAAU,CAAC;IACnB,CAAC,CAAC;AACH,CAAC,CAAC;AAjBW,QAAA,IAAI,QAiBf"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Field, Response, RouteAuth, IRouteOptions } from 'resting-squirrel';
|
|
2
2
|
import { ArgsDto, BaseDto, IRSDto, RequestDto, ResponseDto } from 'resting-squirrel-dto';
|
|
3
3
|
import Controller from '../controller';
|
|
4
4
|
export declare type RSDtoType = new (...args: Array<any>) => IRSDto;
|
|
@@ -8,7 +8,7 @@ export interface IOptions<IProps = {
|
|
|
8
8
|
auth: RouteAuth;
|
|
9
9
|
params: RSDtoType | typeof BaseDto | typeof RequestDto;
|
|
10
10
|
response: RSDtoType | typeof BaseDto | typeof ResponseDto | Response.Base;
|
|
11
|
-
errors
|
|
11
|
+
errors?: IRouteOptions['errors'];
|
|
12
12
|
description: string;
|
|
13
13
|
hideDocs: boolean;
|
|
14
14
|
args: (typeof ArgsDto) | Array<Field>;
|
|
@@ -19,6 +19,7 @@ export interface IOptions<IProps = {
|
|
|
19
19
|
optionalParams: Array<string>;
|
|
20
20
|
omitParams: Array<string>;
|
|
21
21
|
omitResponse: Array<string>;
|
|
22
|
+
redirect: boolean;
|
|
22
23
|
}
|
|
23
24
|
declare const _default: (options: Partial<IOptions>) => (target: Controller, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
24
25
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/decorators/options.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/decorators/options.ts"],"names":[],"mappings":";;AAyBA,kBAAe,CAAC,OAA0B,EAAE,EAAE;IAC7C,OAAO,CAAC,MAAkB,EAAE,WAAmB,EAAE,UAA8B,EAAE,EAAE;;QAClF,MAAM,CAAC,GAAW,MAAa,CAAC;QAChC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE;YACnB,CAAC,CAAC,WAAW,GAAG,EAAE,CAAC;SACnB;QACD,IAAI,KAAK,GAAG,MAAA,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,0CAAE,KAAK,CAAC;QAC9C,IAAI,OAAO,CAAC,KAAK,EAAE;YAClB,KAAK,mCACD,KAAK,GACL,OAAO,CAAC,KAAK,CAChB,CAAC;SACF;QACD,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,iDACtB,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,GAC1B,OAAO,KACV,KAAK,GACL,CAAC;QACF,OAAO,UAAU,CAAC;IACnB,CAAC,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.js","sourceRoot":"","sources":["../../src/decorators/resource.ts"],"names":[],"mappings":";;AAEA,kBAAe,CAAC,QAAgB,EAAE,EAAE;IACnC,OAAO,CAAC,MAAyB,EAAE,EAAE;QACnC,MAAc,CAAC,YAAY,GAAG,QAAQ,CAAC;IACzC,CAAC,CAAC;AACH,CAAC,CAAC"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare const fs: {
|
|
|
31
31
|
symlink: typeof nfs.symlink;
|
|
32
32
|
symlinkSync(target: nfs.PathLike, path: nfs.PathLike, type?: nfs.symlink.Type): void;
|
|
33
33
|
readlink: typeof nfs.readlink;
|
|
34
|
-
readlinkSync(path: nfs.PathLike, options?:
|
|
34
|
+
readlinkSync(path: nfs.PathLike, options?: BufferEncoding | {
|
|
35
35
|
encoding?: BufferEncoding;
|
|
36
36
|
}): string;
|
|
37
37
|
readlinkSync(path: nfs.PathLike, options: "buffer" | {
|
|
@@ -49,7 +49,7 @@ export declare const fs: {
|
|
|
49
49
|
mkdir: typeof nfs.mkdir;
|
|
50
50
|
mkdirSync(path: nfs.PathLike, options?: string | number | nfs.MakeDirectoryOptions): void;
|
|
51
51
|
mkdtemp: typeof nfs.mkdtemp;
|
|
52
|
-
mkdtempSync(prefix: string, options?:
|
|
52
|
+
mkdtempSync(prefix: string, options?: BufferEncoding | {
|
|
53
53
|
encoding?: BufferEncoding;
|
|
54
54
|
}): string;
|
|
55
55
|
mkdtempSync(prefix: string, options: "buffer" | {
|
|
@@ -58,7 +58,7 @@ export declare const fs: {
|
|
|
58
58
|
mkdtempSync(prefix: string, options?: string | {
|
|
59
59
|
encoding?: string;
|
|
60
60
|
}): string | Buffer;
|
|
61
|
-
readdirSync(path: nfs.PathLike, options?:
|
|
61
|
+
readdirSync(path: nfs.PathLike, options?: BufferEncoding | {
|
|
62
62
|
encoding: BufferEncoding;
|
|
63
63
|
withFileTypes?: false;
|
|
64
64
|
}): string[];
|
|
@@ -85,34 +85,34 @@ export declare const fs: {
|
|
|
85
85
|
fsync: typeof nfs.fsync;
|
|
86
86
|
fsyncSync(fd: number): void;
|
|
87
87
|
write: typeof nfs.write;
|
|
88
|
-
writeSync(fd: number, buffer:
|
|
88
|
+
writeSync(fd: number, buffer: nfs.BinaryData, offset?: number, length?: number, position?: number): number;
|
|
89
89
|
writeSync(fd: number, string: any, position?: number, encoding?: string): number;
|
|
90
90
|
read: typeof nfs.read;
|
|
91
|
-
readSync(fd: number, buffer:
|
|
91
|
+
readSync(fd: number, buffer: nfs.BinaryData, offset: number, length: number, position: number): number;
|
|
92
92
|
readFile: typeof nfs.readFile;
|
|
93
|
-
readFileSync(path:
|
|
93
|
+
readFileSync(path: number | nfs.PathLike, options?: {
|
|
94
94
|
encoding?: null;
|
|
95
95
|
flag?: string;
|
|
96
96
|
}): Buffer;
|
|
97
|
-
readFileSync(path:
|
|
97
|
+
readFileSync(path: number | nfs.PathLike, options: string | {
|
|
98
98
|
encoding: string;
|
|
99
99
|
flag?: string;
|
|
100
100
|
}): string;
|
|
101
|
-
readFileSync(path:
|
|
101
|
+
readFileSync(path: number | nfs.PathLike, options?: string | {
|
|
102
102
|
encoding?: string;
|
|
103
103
|
flag?: string;
|
|
104
104
|
}): string | Buffer;
|
|
105
105
|
writeFile: typeof nfs.writeFile;
|
|
106
|
-
writeFileSync(path:
|
|
106
|
+
writeFileSync(path: number | nfs.PathLike, data: any, options?: nfs.WriteFileOptions): void;
|
|
107
107
|
appendFile: typeof nfs.appendFile;
|
|
108
|
-
appendFileSync(file:
|
|
108
|
+
appendFileSync(file: number | nfs.PathLike, data: any, options?: nfs.WriteFileOptions): void;
|
|
109
109
|
watchFile(filename: nfs.PathLike, options: {
|
|
110
110
|
persistent?: boolean;
|
|
111
111
|
interval?: number;
|
|
112
112
|
}, listener: (curr: nfs.Stats, prev: nfs.Stats) => void): void;
|
|
113
113
|
watchFile(filename: nfs.PathLike, listener: (curr: nfs.Stats, prev: nfs.Stats) => void): void;
|
|
114
114
|
unwatchFile(filename: nfs.PathLike, listener?: (curr: nfs.Stats, prev: nfs.Stats) => void): void;
|
|
115
|
-
watch(filename: nfs.PathLike, options:
|
|
115
|
+
watch(filename: nfs.PathLike, options: BufferEncoding | {
|
|
116
116
|
encoding?: BufferEncoding;
|
|
117
117
|
persistent?: boolean;
|
|
118
118
|
recursive?: boolean;
|
package/dist/utils.js
CHANGED
|
@@ -24,8 +24,9 @@ exports.fs = Object.assign(Object.assign({}, nfs), { readdir(path) {
|
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
26
|
} });
|
|
27
|
-
|
|
27
|
+
const requireModule = (path) => {
|
|
28
28
|
const requiredModule = require(path);
|
|
29
29
|
return requiredModule.default || requiredModule;
|
|
30
30
|
};
|
|
31
|
+
exports.requireModule = requireModule;
|
|
31
32
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,0BAA0B;AAEb,QAAA,EAAE,mCACX,GAAG,KACN,OAAO,CAAC,IAAkB;QACzB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;gBAChC,IAAI,GAAG,EAAE;oBACR,MAAM,CAAC,GAAG,CAAC,CAAC;oBACZ,OAAO;iBACP;gBACD,OAAO,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,IAAkB;QACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;gBAC7B,IAAI,GAAG,EAAE;oBACR,MAAM,CAAC,GAAG,CAAC,CAAC;oBACZ,OAAO;iBACP;gBACD,OAAO,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,IACA;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,0BAA0B;AAEb,QAAA,EAAE,mCACX,GAAG,KACN,OAAO,CAAC,IAAkB;QACzB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;gBAChC,IAAI,GAAG,EAAE;oBACR,MAAM,CAAC,GAAG,CAAC,CAAC;oBACZ,OAAO;iBACP;gBACD,OAAO,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,IAAkB;QACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;gBAC7B,IAAI,GAAG,EAAE;oBACR,MAAM,CAAC,GAAG,CAAC,CAAC;oBACZ,OAAO;iBACP;gBACD,OAAO,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,IACA;AAEK,MAAM,aAAa,GAAG,CAAI,IAAY,EAAK,EAAE;IACnD,MAAM,cAAc,GAAQ,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,OAAO,cAAc,CAAC,OAAO,IAAI,cAAc,CAAC;AACjD,CAAC,CAAC;AAHW,QAAA,aAAa,iBAGxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resting-squirrel-controller",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Controller for defining endpoints in resting-squirrel.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -33,24 +33,26 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/chai": "^4.
|
|
37
|
-
"@types/core-js": "^2.5.
|
|
36
|
+
"@types/chai": "^4.3.0",
|
|
37
|
+
"@types/core-js": "^2.5.5",
|
|
38
38
|
"@types/mocha": "^5.2.7",
|
|
39
39
|
"@types/node": "^10.17.26",
|
|
40
|
-
"
|
|
40
|
+
"@types/node-fetch": "^2.6.1",
|
|
41
|
+
"chai": "^4.3.6",
|
|
41
42
|
"mocha": "^6.2.0",
|
|
42
|
-
"
|
|
43
|
-
"resting-squirrel
|
|
43
|
+
"node-fetch": "^2.6.7",
|
|
44
|
+
"resting-squirrel": "^2.27.1",
|
|
45
|
+
"resting-squirrel-connector": "^2.3.4",
|
|
44
46
|
"resting-squirrel-dto": "^2.0.2",
|
|
45
47
|
"run-script-os-fix": "^1.0.4",
|
|
46
|
-
"source-map-support": "^0.5.
|
|
47
|
-
"ts-node": "^
|
|
48
|
-
"tslint": "^
|
|
49
|
-
"typedoc": "^0.
|
|
50
|
-
"typescript": "^
|
|
48
|
+
"source-map-support": "^0.5.21",
|
|
49
|
+
"ts-node": "^10.5.0",
|
|
50
|
+
"tslint": "^6.1.3",
|
|
51
|
+
"typedoc": "^0.22.11",
|
|
52
|
+
"typescript": "^4.5.5"
|
|
51
53
|
},
|
|
52
54
|
"peerDependencies": {
|
|
53
|
-
"resting-squirrel": "^2.
|
|
55
|
+
"resting-squirrel": "^2.27.0",
|
|
54
56
|
"resting-squirrel-dto": "^2.0.2"
|
|
55
57
|
},
|
|
56
58
|
"repository": {
|