@pristine-ts/networking 0.0.162 → 0.0.166
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/lib/cjs/decorators/body.decorator.js +20 -1
- package/dist/lib/cjs/decorators/body.decorator.js.map +1 -1
- package/dist/lib/cjs/decorators/controller.decorator.js +13 -1
- package/dist/lib/cjs/decorators/controller.decorator.js.map +1 -1
- package/dist/lib/cjs/decorators/decorators.js +1 -1
- package/dist/lib/cjs/decorators/decorators.js.map +1 -1
- package/dist/lib/cjs/decorators/headers.decorator.js +20 -1
- package/dist/lib/cjs/decorators/headers.decorator.js.map +1 -1
- package/dist/lib/cjs/decorators/identity.decorator.js +20 -1
- package/dist/lib/cjs/decorators/identity.decorator.js.map +1 -1
- package/dist/lib/cjs/decorators/query-parameter.decorator.js +22 -1
- package/dist/lib/cjs/decorators/query-parameter.decorator.js.map +1 -1
- package/dist/lib/cjs/decorators/query-parameters.decorator.js +20 -1
- package/dist/lib/cjs/decorators/query-parameters.decorator.js.map +1 -1
- package/dist/lib/cjs/decorators/request.decorator.js +20 -1
- package/dist/lib/cjs/decorators/request.decorator.js.map +1 -1
- package/dist/lib/cjs/decorators/response-header.decorator.js +24 -2
- package/dist/lib/cjs/decorators/response-header.decorator.js.map +1 -1
- package/dist/lib/cjs/decorators/route-parameter.decorator.js +21 -1
- package/dist/lib/cjs/decorators/route-parameter.decorator.js.map +1 -1
- package/dist/lib/cjs/decorators/route.decorator.js +21 -1
- package/dist/lib/cjs/decorators/route.decorator.js.map +1 -1
- package/dist/lib/cjs/enrichers/router-response.enricher.js +4 -0
- package/dist/lib/cjs/enrichers/router-response.enricher.js.map +1 -1
- package/dist/lib/cjs/errors/errors.js +3 -1
- package/dist/lib/cjs/errors/errors.js.map +1 -1
- package/dist/lib/cjs/errors/http.error.js +1 -1
- package/dist/lib/cjs/errors/http.error.js.map +1 -1
- package/dist/lib/cjs/errors/method-router-adding.error.js +25 -0
- package/dist/lib/cjs/errors/method-router-adding.error.js.map +1 -0
- package/dist/lib/cjs/errors/path-router-adding.error.js +3 -2
- package/dist/lib/cjs/errors/path-router-adding.error.js.map +1 -1
- package/dist/lib/cjs/errors/path-router-instantiation.error.js +3 -2
- package/dist/lib/cjs/errors/path-router-instantiation.error.js.map +1 -1
- package/dist/lib/cjs/interfaces/interfaces.js +2 -2
- package/dist/lib/cjs/interfaces/interfaces.js.map +1 -1
- package/dist/lib/cjs/models/models.js +0 -1
- package/dist/lib/cjs/models/models.js.map +1 -1
- package/dist/lib/cjs/models/request.js +10 -4
- package/dist/lib/cjs/models/request.js.map +1 -1
- package/dist/lib/cjs/models/response.js +6 -0
- package/dist/lib/cjs/models/response.js.map +1 -1
- package/dist/lib/cjs/models/route.js +4 -0
- package/dist/lib/cjs/models/route.js.map +1 -1
- package/dist/lib/cjs/networking.module.js +0 -6
- package/dist/lib/cjs/networking.module.js.map +1 -1
- package/dist/lib/cjs/nodes/method-router.node.js +19 -4
- package/dist/lib/cjs/nodes/method-router.node.js.map +1 -1
- package/dist/lib/cjs/nodes/path-router.node.js +22 -12
- package/dist/lib/cjs/nodes/path-router.node.js.map +1 -1
- package/dist/lib/cjs/resolvers/body-parameter-decorator.resolver.js +18 -0
- package/dist/lib/cjs/resolvers/body-parameter-decorator.resolver.js.map +1 -1
- package/dist/lib/cjs/resolvers/controller-method-parameter-decorator.resolver.js +14 -0
- package/dist/lib/cjs/resolvers/controller-method-parameter-decorator.resolver.js.map +1 -1
- package/dist/lib/cjs/resolvers/headers-parameter-decorator.resolver.js +18 -0
- package/dist/lib/cjs/resolvers/headers-parameter-decorator.resolver.js.map +1 -1
- package/dist/lib/cjs/resolvers/identity-parameter-decorator.resolver.js +18 -0
- package/dist/lib/cjs/resolvers/identity-parameter-decorator.resolver.js.map +1 -1
- package/dist/lib/cjs/resolvers/query-parameter-decorator.resolver.js +19 -0
- package/dist/lib/cjs/resolvers/query-parameter-decorator.resolver.js.map +1 -1
- package/dist/lib/cjs/resolvers/query-parameters-decorator.resolver.js +18 -0
- package/dist/lib/cjs/resolvers/query-parameters-decorator.resolver.js.map +1 -1
- package/dist/lib/cjs/resolvers/request-parameter-decorator.resolver.js +18 -0
- package/dist/lib/cjs/resolvers/request-parameter-decorator.resolver.js.map +1 -1
- package/dist/lib/cjs/resolvers/route-parameter-decorator.resolver.js +18 -0
- package/dist/lib/cjs/resolvers/route-parameter-decorator.resolver.js.map +1 -1
- package/dist/lib/cjs/router.js +25 -10
- package/dist/lib/cjs/router.js.map +1 -1
- package/dist/lib/esm/decorators/body.decorator.js +20 -1
- package/dist/lib/esm/decorators/body.decorator.js.map +1 -1
- package/dist/lib/esm/decorators/controller.decorator.js +13 -1
- package/dist/lib/esm/decorators/controller.decorator.js.map +1 -1
- package/dist/lib/esm/decorators/decorators.js +1 -1
- package/dist/lib/esm/decorators/decorators.js.map +1 -1
- package/dist/lib/esm/decorators/headers.decorator.js +20 -1
- package/dist/lib/esm/decorators/headers.decorator.js.map +1 -1
- package/dist/lib/esm/decorators/identity.decorator.js +20 -1
- package/dist/lib/esm/decorators/identity.decorator.js.map +1 -1
- package/dist/lib/esm/decorators/query-parameter.decorator.js +22 -1
- package/dist/lib/esm/decorators/query-parameter.decorator.js.map +1 -1
- package/dist/lib/esm/decorators/query-parameters.decorator.js +20 -1
- package/dist/lib/esm/decorators/query-parameters.decorator.js.map +1 -1
- package/dist/lib/esm/decorators/request.decorator.js +20 -1
- package/dist/lib/esm/decorators/request.decorator.js.map +1 -1
- package/dist/lib/esm/decorators/response-header.decorator.js +24 -2
- package/dist/lib/esm/decorators/response-header.decorator.js.map +1 -1
- package/dist/lib/esm/decorators/route-parameter.decorator.js +21 -1
- package/dist/lib/esm/decorators/route-parameter.decorator.js.map +1 -1
- package/dist/lib/esm/decorators/route.decorator.js +21 -1
- package/dist/lib/esm/decorators/route.decorator.js.map +1 -1
- package/dist/lib/esm/enrichers/router-response.enricher.js +4 -0
- package/dist/lib/esm/enrichers/router-response.enricher.js.map +1 -1
- package/dist/lib/esm/errors/errors.js +3 -1
- package/dist/lib/esm/errors/errors.js.map +1 -1
- package/dist/lib/esm/errors/http.error.js +1 -1
- package/dist/lib/esm/errors/http.error.js.map +1 -1
- package/dist/lib/esm/errors/method-router-adding.error.js +21 -0
- package/dist/lib/esm/errors/method-router-adding.error.js.map +1 -0
- package/dist/lib/esm/errors/path-router-adding.error.js +3 -2
- package/dist/lib/esm/errors/path-router-adding.error.js.map +1 -1
- package/dist/lib/esm/errors/path-router-instantiation.error.js +3 -2
- package/dist/lib/esm/errors/path-router-instantiation.error.js.map +1 -1
- package/dist/lib/esm/interfaces/interfaces.js +2 -2
- package/dist/lib/esm/interfaces/interfaces.js.map +1 -1
- package/dist/lib/esm/models/models.js +0 -1
- package/dist/lib/esm/models/models.js.map +1 -1
- package/dist/lib/esm/models/request.js +10 -4
- package/dist/lib/esm/models/request.js.map +1 -1
- package/dist/lib/esm/models/response.js +6 -0
- package/dist/lib/esm/models/response.js.map +1 -1
- package/dist/lib/esm/models/route.js +4 -0
- package/dist/lib/esm/models/route.js.map +1 -1
- package/dist/lib/esm/networking.module.js +0 -6
- package/dist/lib/esm/networking.module.js.map +1 -1
- package/dist/lib/esm/nodes/method-router.node.js +19 -4
- package/dist/lib/esm/nodes/method-router.node.js.map +1 -1
- package/dist/lib/esm/nodes/path-router.node.js +22 -12
- package/dist/lib/esm/nodes/path-router.node.js.map +1 -1
- package/dist/lib/esm/resolvers/body-parameter-decorator.resolver.js +18 -0
- package/dist/lib/esm/resolvers/body-parameter-decorator.resolver.js.map +1 -1
- package/dist/lib/esm/resolvers/controller-method-parameter-decorator.resolver.js +14 -0
- package/dist/lib/esm/resolvers/controller-method-parameter-decorator.resolver.js.map +1 -1
- package/dist/lib/esm/resolvers/headers-parameter-decorator.resolver.js +18 -0
- package/dist/lib/esm/resolvers/headers-parameter-decorator.resolver.js.map +1 -1
- package/dist/lib/esm/resolvers/identity-parameter-decorator.resolver.js +18 -0
- package/dist/lib/esm/resolvers/identity-parameter-decorator.resolver.js.map +1 -1
- package/dist/lib/esm/resolvers/query-parameter-decorator.resolver.js +19 -0
- package/dist/lib/esm/resolvers/query-parameter-decorator.resolver.js.map +1 -1
- package/dist/lib/esm/resolvers/query-parameters-decorator.resolver.js +18 -0
- package/dist/lib/esm/resolvers/query-parameters-decorator.resolver.js.map +1 -1
- package/dist/lib/esm/resolvers/request-parameter-decorator.resolver.js +18 -0
- package/dist/lib/esm/resolvers/request-parameter-decorator.resolver.js.map +1 -1
- package/dist/lib/esm/resolvers/route-parameter-decorator.resolver.js +18 -0
- package/dist/lib/esm/resolvers/route-parameter-decorator.resolver.js.map +1 -1
- package/dist/lib/esm/router.js +25 -10
- package/dist/lib/esm/router.js.map +1 -1
- package/dist/types/decorators/body.decorator.d.ts +3 -0
- package/dist/types/decorators/controller.decorator.d.ts +4 -0
- package/dist/types/decorators/decorators.d.ts +1 -1
- package/dist/types/decorators/headers.decorator.d.ts +3 -0
- package/dist/types/decorators/identity.decorator.d.ts +3 -0
- package/dist/types/decorators/query-parameter.decorator.d.ts +4 -0
- package/dist/types/decorators/query-parameters.decorator.d.ts +3 -0
- package/dist/types/decorators/request.decorator.d.ts +3 -0
- package/dist/types/decorators/response-header.decorator.d.ts +7 -0
- package/dist/types/decorators/route-parameter.decorator.d.ts +4 -0
- package/dist/types/decorators/route.decorator.d.ts +6 -1
- package/dist/types/enrichers/router-response.enricher.d.ts +4 -0
- package/dist/types/errors/errors.d.ts +3 -1
- package/dist/types/errors/http.error.d.ts +1 -1
- package/dist/types/errors/method-router-adding.error.d.ts +10 -0
- package/dist/types/errors/path-router-adding.error.d.ts +4 -3
- package/dist/types/errors/path-router-instantiation.error.d.ts +4 -3
- package/dist/types/interfaces/controller-method-parameter-decorator-resolver.interface.d.ts +19 -2
- package/dist/types/interfaces/interfaces.d.ts +2 -2
- package/dist/types/interfaces/parameter-decorator.interface.d.ts +4 -0
- package/dist/types/interfaces/query-parameters-decorator.interface.d.ts +4 -0
- package/dist/types/interfaces/route-parameter-decorator.interface.d.ts +1 -1
- package/dist/types/interfaces/router.interface.d.ts +2 -2
- package/dist/types/models/models.d.ts +0 -1
- package/dist/types/models/request.d.ts +16 -4
- package/dist/types/models/response.d.ts +15 -0
- package/dist/types/models/route.d.ts +4 -0
- package/dist/types/nodes/method-router.node.d.ts +17 -4
- package/dist/types/nodes/path-router.node.d.ts +11 -7
- package/dist/types/nodes/router.node.d.ts +3 -3
- package/dist/types/resolvers/body-parameter-decorator.resolver.d.ts +22 -2
- package/dist/types/resolvers/controller-method-parameter-decorator.resolver.d.ts +14 -0
- package/dist/types/resolvers/headers-parameter-decorator.resolver.d.ts +22 -2
- package/dist/types/resolvers/identity-parameter-decorator.resolver.d.ts +22 -2
- package/dist/types/resolvers/query-parameter-decorator.resolver.d.ts +23 -2
- package/dist/types/resolvers/query-parameters-decorator.resolver.d.ts +22 -2
- package/dist/types/resolvers/request-parameter-decorator.resolver.d.ts +22 -2
- package/dist/types/resolvers/route-parameter-decorator.resolver.d.ts +22 -2
- package/dist/types/router.d.ts +13 -3
- package/package.json +5 -5
- package/dist/lib/cjs/enums/enums.js +0 -1
- package/dist/lib/cjs/enums/enums.js.map +0 -1
- package/dist/lib/cjs/models/error-response-body.js +0 -7
- package/dist/lib/cjs/models/error-response-body.js.map +0 -1
- package/dist/lib/esm/enums/enums.js +0 -1
- package/dist/lib/esm/enums/enums.js.map +0 -1
- package/dist/lib/esm/models/error-response-body.js +0 -3
- package/dist/lib/esm/models/error-response-body.js.map +0 -1
- package/dist/types/enums/enums.d.ts +0 -0
- package/dist/types/models/error-response-body.d.ts +0 -4
|
@@ -8,10 +8,28 @@ import "reflect-metadata";
|
|
|
8
8
|
import { injectable } from "tsyringe";
|
|
9
9
|
import { moduleScoped, ServiceDefinitionTagEnum, tag } from "@pristine-ts/common";
|
|
10
10
|
import { NetworkingModuleKeyname } from "../networking.module.keyname";
|
|
11
|
+
/**
|
|
12
|
+
* The IdentityParameterDecoratorResolver resolves the value of the identity (parsed by the authenticator) of the request
|
|
13
|
+
* so that it can be injected it into the parameter of the route of the controller that was annotated with the @identity decorator.
|
|
14
|
+
* It is tagged as an MethodParameterDecoratorResolver so it can be automatically injected with the all the other MethodParameterDecoratorResolvers.
|
|
15
|
+
*/
|
|
11
16
|
let IdentityParameterDecoratorResolver = class IdentityParameterDecoratorResolver {
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the value of the identity of the request.
|
|
19
|
+
* The router than injects that value into the parameter of the controller method.
|
|
20
|
+
* @param methodArgument The method argument created by the decorator.
|
|
21
|
+
* @param request The request
|
|
22
|
+
* @param routeParameters The router parameters
|
|
23
|
+
* @param identity The identity making the request
|
|
24
|
+
*/
|
|
12
25
|
resolve(methodArgument, request, routeParameters, identity) {
|
|
13
26
|
return Promise.resolve(identity !== null && identity !== void 0 ? identity : null);
|
|
14
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Returns whether or not the resolver support such a method argument.
|
|
30
|
+
* Usually we will check the methodArgument.type field to determine if it is a supported type.
|
|
31
|
+
* @param methodArgument
|
|
32
|
+
*/
|
|
15
33
|
supports(methodArgument) {
|
|
16
34
|
return methodArgument && methodArgument.hasOwnProperty("type") && methodArgument.type === "identity";
|
|
17
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-parameter-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/identity-parameter-decorator.resolver.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,kBAAkB,CAAA;AACzB,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAoB,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"identity-parameter-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/identity-parameter-decorator.resolver.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,kBAAkB,CAAA;AACzB,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAoB,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AAIrE;;;;GAIG;AAIH,IAAa,kCAAkC,GAA/C,MAAa,kCAAkC;IAE3C;;;;;;;OAOG;IACH,OAAO,CAAC,cAAmD,EACnD,OAAgB,EAChB,eAAwC,EACxC,QAA4B;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,cAA2C;QAChD,OAAO,cAAc,IAAI,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,IAAI,KAAK,UAAU,CAAC;IACzG,CAAC;CACJ,CAAA;AAzBY,kCAAkC;IAH9C,YAAY,CAAC,uBAAuB,CAAC;IACrC,GAAG,CAAC,wBAAwB,CAAC,gCAAgC,CAAC;IAC9D,UAAU,EAAE;GACA,kCAAkC,CAyB9C;SAzBY,kCAAkC"}
|
|
@@ -8,12 +8,31 @@ import { injectable } from "tsyringe";
|
|
|
8
8
|
import { moduleScoped, ServiceDefinitionTagEnum, tag } from "@pristine-ts/common";
|
|
9
9
|
import { NetworkingModuleKeyname } from "../networking.module.keyname";
|
|
10
10
|
import Url from 'url-parse';
|
|
11
|
+
/**
|
|
12
|
+
* The QueryParameterDecoratorResolver resolves the value of the query parameter with the name passed to the decorator
|
|
13
|
+
* of the request so that it can be injected it into the parameter of the route of the controller that was annotated
|
|
14
|
+
* with the @queryParameter decorator.
|
|
15
|
+
* It is tagged as an MethodParameterDecoratorResolver so it can be automatically injected with the all the other MethodParameterDecoratorResolvers.
|
|
16
|
+
*/
|
|
11
17
|
let QueryParameterDecoratorResolver = class QueryParameterDecoratorResolver {
|
|
18
|
+
/**
|
|
19
|
+
* Resolves the value of the query parameter with the specified name of the request.
|
|
20
|
+
* The router than injects that value into the parameter of the controller method.
|
|
21
|
+
* @param methodArgument The method argument created by the decorator including the query parameter name.
|
|
22
|
+
* @param request The request
|
|
23
|
+
* @param routeParameters The router parameters
|
|
24
|
+
* @param identity The identity making the request
|
|
25
|
+
*/
|
|
12
26
|
resolve(methodArgument, request, routeParameters, identity) {
|
|
13
27
|
var _a;
|
|
14
28
|
const url = new Url(request.url, true);
|
|
15
29
|
return Promise.resolve((_a = url.query[methodArgument.queryParameterName]) !== null && _a !== void 0 ? _a : null);
|
|
16
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns whether or not the resolver support such a method argument.
|
|
33
|
+
* Usually we will check the methodArgument.type field to determine if it is a supported type.
|
|
34
|
+
* @param methodArgument
|
|
35
|
+
*/
|
|
17
36
|
supports(methodArgument) {
|
|
18
37
|
return methodArgument && methodArgument.hasOwnProperty("type") && methodArgument.type === "queryParameter";
|
|
19
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-parameter-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/query-parameter-decorator.resolver.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"query-parameter-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/query-parameter-decorator.resolver.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAoB,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AACrE,OAAO,GAAG,MAAM,WAAW,CAAC;AAI5B;;;;;GAKG;AAIH,IAAa,+BAA+B,GAA5C,MAAa,+BAA+B;IAExC;;;;;;;OAOG;IACH,OAAO,CAAC,cAAgD,EAChD,OAAgB,EAChB,eAAwC,EACxC,QAA4B;;QAChC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAEvC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAA,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC,mCAAI,IAAI,CAAC,CAAC;IACjF,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,cAA2C;QAChD,OAAO,cAAc,IAAI,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,IAAI,KAAK,gBAAgB,CAAC;IAC/G,CAAC;CACJ,CAAA;AA3BY,+BAA+B;IAH3C,YAAY,CAAC,uBAAuB,CAAC;IACrC,GAAG,CAAC,wBAAwB,CAAC,gCAAgC,CAAC;IAC9D,UAAU,EAAE;GACA,+BAA+B,CA2B3C;SA3BY,+BAA+B"}
|
|
@@ -8,12 +8,30 @@ import { injectable } from "tsyringe";
|
|
|
8
8
|
import { moduleScoped, ServiceDefinitionTagEnum, tag } from "@pristine-ts/common";
|
|
9
9
|
import { NetworkingModuleKeyname } from "../networking.module.keyname";
|
|
10
10
|
import Url from 'url-parse';
|
|
11
|
+
/**
|
|
12
|
+
* The QueryParametersDecoratorResolver resolves the value (a map) of the query parameters of the request so that it can be injected it into the
|
|
13
|
+
* parameter of the route of the controller that was annotated with the @queryParameters decorator.
|
|
14
|
+
* It is tagged as an MethodParameterDecoratorResolver so it can be automatically injected with the all the other MethodParameterDecoratorResolvers.
|
|
15
|
+
*/
|
|
11
16
|
let QueryParametersDecoratorResolver = class QueryParametersDecoratorResolver {
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the value of all the query parameters of the request.
|
|
19
|
+
* The router than injects that value into the parameter of the controller method.
|
|
20
|
+
* @param methodArgument The method argument created by the decorator.
|
|
21
|
+
* @param request The request
|
|
22
|
+
* @param routeParameters The router parameters
|
|
23
|
+
* @param identity The identity making the request
|
|
24
|
+
*/
|
|
12
25
|
resolve(methodArgument, request, routeParameters, identity) {
|
|
13
26
|
var _a;
|
|
14
27
|
const url = new Url(request.url, true);
|
|
15
28
|
return Promise.resolve((_a = url.query) !== null && _a !== void 0 ? _a : null);
|
|
16
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Returns whether or not the resolver support such a method argument.
|
|
32
|
+
* Usually we will check the methodArgument.type field to determine if it is a supported type.
|
|
33
|
+
* @param methodArgument
|
|
34
|
+
*/
|
|
17
35
|
supports(methodArgument) {
|
|
18
36
|
return methodArgument && methodArgument.hasOwnProperty("type") && methodArgument.type === "queryParameters";
|
|
19
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-parameters-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/query-parameters-decorator.resolver.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAoB,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AACrE,OAAO,GAAG,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"query-parameters-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/query-parameters-decorator.resolver.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAoB,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AACrE,OAAO,GAAG,MAAM,WAAW,CAAC;AAI5B;;;;GAIG;AAIH,IAAa,gCAAgC,GAA7C,MAAa,gCAAgC;IAEzC;;;;;;;OAOG;IACH,OAAO,CAAC,cAAiD,EACjD,OAAgB,EAChB,eAAwC,EACxC,QAA4B;;QAChC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAEvC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAA,GAAG,CAAC,KAAK,mCAAI,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,cAA2C;QAChD,OAAO,cAAc,IAAI,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,IAAI,KAAK,iBAAiB,CAAC;IAChH,CAAC;CACJ,CAAA;AA3BY,gCAAgC;IAH5C,YAAY,CAAC,uBAAuB,CAAC;IACrC,GAAG,CAAC,wBAAwB,CAAC,gCAAgC,CAAC;IAC9D,UAAU,EAAE;GACA,gCAAgC,CA2B5C;SA3BY,gCAAgC"}
|
|
@@ -8,10 +8,28 @@ import "reflect-metadata";
|
|
|
8
8
|
import { injectable } from "tsyringe";
|
|
9
9
|
import { moduleScoped, ServiceDefinitionTagEnum, tag } from "@pristine-ts/common";
|
|
10
10
|
import { NetworkingModuleKeyname } from "../networking.module.keyname";
|
|
11
|
+
/**
|
|
12
|
+
* The RequestParameterDecoratorResolver resolves the value of the whole request so that it can be injected it into the
|
|
13
|
+
* parameter of the route of the controller that was annotated with the @request decorator.
|
|
14
|
+
* It is tagged as an MethodParameterDecoratorResolver so it can be automatically injected with the all the other MethodParameterDecoratorResolvers.
|
|
15
|
+
*/
|
|
11
16
|
let RequestParameterDecoratorResolver = class RequestParameterDecoratorResolver {
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the value of the whole request.
|
|
19
|
+
* The router than injects that value into the parameter of the controller method.
|
|
20
|
+
* @param methodArgument The method argument created by the decorator.
|
|
21
|
+
* @param request The request
|
|
22
|
+
* @param routeParameters The router parameters
|
|
23
|
+
* @param identity The identity making the request
|
|
24
|
+
*/
|
|
12
25
|
resolve(methodArgument, request, routeParameters, identity) {
|
|
13
26
|
return Promise.resolve(request !== null && request !== void 0 ? request : null);
|
|
14
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Returns whether or not the resolver support such a method argument.
|
|
30
|
+
* Usually we will check the methodArgument.type field to determine if it is a supported type.
|
|
31
|
+
* @param methodArgument
|
|
32
|
+
*/
|
|
15
33
|
supports(methodArgument) {
|
|
16
34
|
return methodArgument && methodArgument.hasOwnProperty("type") && methodArgument.type === "request";
|
|
17
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-parameter-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/request-parameter-decorator.resolver.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,kBAAkB,CAAA;AACzB,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAoB,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"request-parameter-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/request-parameter-decorator.resolver.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,kBAAkB,CAAA;AACzB,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAoB,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AAIrE;;;;GAIG;AAIH,IAAa,iCAAiC,GAA9C,MAAa,iCAAiC;IAE1C;;;;;;;OAOG;IACH,OAAO,CAAC,cAAkD,EAClD,OAAgB,EAChB,eAAwC,EACxC,QAA4B;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,cAA2C;QAChD,OAAO,cAAc,IAAI,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,IAAI,KAAK,SAAS,CAAC;IACxG,CAAC;CACJ,CAAA;AAzBY,iCAAiC;IAH7C,YAAY,CAAC,uBAAuB,CAAC;IACrC,GAAG,CAAC,wBAAwB,CAAC,gCAAgC,CAAC;IAC9D,UAAU,EAAE;GACA,iCAAiC,CAyB7C;SAzBY,iCAAiC"}
|
|
@@ -7,11 +7,29 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { injectable } from "tsyringe";
|
|
8
8
|
import { moduleScoped, ServiceDefinitionTagEnum, tag } from "@pristine-ts/common";
|
|
9
9
|
import { NetworkingModuleKeyname } from "../networking.module.keyname";
|
|
10
|
+
/**
|
|
11
|
+
* The RouteParameterDecoratorResolver resolves the value of the route parameter specified of the request so that it can be injected it into the
|
|
12
|
+
* parameter of the route of the controller that was annotated with the @routeParameter decorator.
|
|
13
|
+
* It is tagged as an MethodParameterDecoratorResolver so it can be automatically injected with the all the other MethodParameterDecoratorResolvers.
|
|
14
|
+
*/
|
|
10
15
|
let RouteParameterDecoratorResolver = class RouteParameterDecoratorResolver {
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the value of the the route parameter with the specified name of the request.
|
|
18
|
+
* The router than injects that value into the parameter of the controller method.
|
|
19
|
+
* @param methodArgument The method argument created by the decorator, including the name of the parameter to resolve.
|
|
20
|
+
* @param request The request
|
|
21
|
+
* @param routeParameters The router parameters
|
|
22
|
+
* @param identity The identity making the request
|
|
23
|
+
*/
|
|
11
24
|
resolve(methodArgument, request, routeParameters, identity) {
|
|
12
25
|
var _a;
|
|
13
26
|
return Promise.resolve((_a = routeParameters[methodArgument.routeParameterName]) !== null && _a !== void 0 ? _a : null);
|
|
14
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Returns whether or not the resolver support such a method argument.
|
|
30
|
+
* Usually we will check the methodArgument.type field to determine if it is a supported type.
|
|
31
|
+
* @param methodArgument
|
|
32
|
+
*/
|
|
15
33
|
supports(methodArgument) {
|
|
16
34
|
return methodArgument && methodArgument.hasOwnProperty("type") && methodArgument.type === "routeParameter";
|
|
17
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-parameter-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/route-parameter-decorator.resolver.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAoB,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"route-parameter-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/route-parameter-decorator.resolver.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAoB,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AAGrE;;;;GAIG;AAIH,IAAa,+BAA+B,GAA5C,MAAa,+BAA+B;IAExC;;;;;;;OAOG;IACH,OAAO,CAAC,cAAgD,EAChD,OAAgB,EAChB,eAAwC,EACxC,QAA4B;;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAA,eAAe,CAAC,cAAc,CAAC,kBAAkB,CAAC,mCAAI,IAAI,CAAC,CAAC;IACvF,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,cAA2C;QAChD,OAAO,cAAc,IAAI,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,IAAI,KAAK,gBAAgB,CAAC;IAC/G,CAAC;CACJ,CAAA;AAzBY,+BAA+B;IAH3C,YAAY,CAAC,uBAAuB,CAAC;IACrC,GAAG,CAAC,wBAAwB,CAAC,gCAAgC,CAAC;IAC9D,UAAU,EAAE;GACA,+BAA+B,CAyB3C;SAzBY,+BAA+B"}
|
package/dist/lib/esm/router.js
CHANGED
|
@@ -30,13 +30,24 @@ import Url from 'url-parse';
|
|
|
30
30
|
import { ServiceDefinitionTagEnum } from "@pristine-ts/common";
|
|
31
31
|
import { NetworkingModuleKeyname } from "./networking.module.keyname";
|
|
32
32
|
import { SpanKeynameEnum } from "@pristine-ts/telemetry";
|
|
33
|
+
/**
|
|
34
|
+
* The router service is the service that creates the routing tree from the controllers.
|
|
35
|
+
* It also executes a request properly by routing it to the intended controller and returns the response.
|
|
36
|
+
*/
|
|
33
37
|
let Router = class Router {
|
|
34
|
-
|
|
38
|
+
/**
|
|
39
|
+
* The router service is the service that creates the routing tree from the controllers.
|
|
40
|
+
* It also executes a request properly by routing it to the intended controller and returns the response.
|
|
41
|
+
* @param loghandler The log handler
|
|
42
|
+
* @param controllerMethodParameterDecoratorResolver The controller method parameter decorator resolver used to resolve the values.
|
|
43
|
+
* @param authorizerManager The authorizer manager to validate authorization.
|
|
44
|
+
* @param authenticationManager The authentication manager to validate authentication.
|
|
45
|
+
*/
|
|
46
|
+
constructor(loghandler, controllerMethodParameterDecoratorResolver, authorizerManager, authenticationManager) {
|
|
35
47
|
this.loghandler = loghandler;
|
|
36
48
|
this.controllerMethodParameterDecoratorResolver = controllerMethodParameterDecoratorResolver;
|
|
37
49
|
this.authorizerManager = authorizerManager;
|
|
38
50
|
this.authenticationManager = authenticationManager;
|
|
39
|
-
this.tracingManager = tracingManager;
|
|
40
51
|
this.root = new PathRouterNode("/");
|
|
41
52
|
}
|
|
42
53
|
/**
|
|
@@ -59,13 +70,14 @@ let Router = class Router {
|
|
|
59
70
|
* @param container
|
|
60
71
|
*/
|
|
61
72
|
execute(request, container) {
|
|
62
|
-
const
|
|
73
|
+
const tracingManager = container.resolve("TracingManagerInterface");
|
|
74
|
+
const routerRequestExecutionSpan = tracingManager.startSpan(SpanKeynameEnum.RouterRequestExecution, SpanKeynameEnum.RequestExecution);
|
|
63
75
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
64
76
|
// Start by decomposing the URL. Set second parameter to true since we want to parse the query strings
|
|
65
77
|
const url = new Url(request.url, false);
|
|
66
78
|
// Split the path name
|
|
67
79
|
const splitPath = UrlUtil.splitPath(url.pathname);
|
|
68
|
-
const methodNodeSpan =
|
|
80
|
+
const methodNodeSpan = tracingManager.startSpan(SpanKeynameEnum.RouterFindMethodRouterNode, SpanKeynameEnum.RouterRequestExecution);
|
|
69
81
|
// Retrieve the node to have information about the controller
|
|
70
82
|
const methodNode = this.root.find(splitPath, request.httpMethod);
|
|
71
83
|
methodNodeSpan.end();
|
|
@@ -88,7 +100,7 @@ let Router = class Router {
|
|
|
88
100
|
// Get the route parameters
|
|
89
101
|
const routeParameters = methodNode.parent.getRouteParameters(splitPath.reverse());
|
|
90
102
|
// Instantiate the controller
|
|
91
|
-
const routerControllerResolverSpan =
|
|
103
|
+
const routerControllerResolverSpan = tracingManager.startSpan(SpanKeynameEnum.RouterControllerResolver, SpanKeynameEnum.RouterRequestExecution);
|
|
92
104
|
const controller = container.resolve(methodNode.route.controllerInstantiationToken);
|
|
93
105
|
routerControllerResolverSpan.end();
|
|
94
106
|
this.loghandler.debug("Before calling the authenticationManager", {
|
|
@@ -96,8 +108,9 @@ let Router = class Router {
|
|
|
96
108
|
routeParameters
|
|
97
109
|
}, NetworkingModuleKeyname);
|
|
98
110
|
let identity;
|
|
111
|
+
// Authenticate the request
|
|
99
112
|
try {
|
|
100
|
-
const routerRequestAuthenticationSpan =
|
|
113
|
+
const routerRequestAuthenticationSpan = tracingManager.startSpan(SpanKeynameEnum.RouterRequestAuthentication, SpanKeynameEnum.RouterRequestExecution);
|
|
101
114
|
identity = yield this.authenticationManager.authenticate(request, methodNode.route.context, container);
|
|
102
115
|
routerRequestAuthenticationSpan.end();
|
|
103
116
|
this.loghandler.debug("Found identity.", {
|
|
@@ -120,6 +133,7 @@ let Router = class Router {
|
|
|
120
133
|
}
|
|
121
134
|
// Call the controller with the resolved Method arguments
|
|
122
135
|
try {
|
|
136
|
+
// Verify that the identity making the request is authorized to make such a request
|
|
123
137
|
if ((yield this.authorizerManager.isAuthorized(request, methodNode.route.context, container, identity)) === false) {
|
|
124
138
|
this.loghandler.error("User not authorized to access this url.", {
|
|
125
139
|
request,
|
|
@@ -130,13 +144,15 @@ let Router = class Router {
|
|
|
130
144
|
routerRequestExecutionSpan.end();
|
|
131
145
|
return reject(new ForbiddenHttpError("You are not allowed to access this."));
|
|
132
146
|
}
|
|
133
|
-
|
|
147
|
+
// Execute all the enrichers to enrich the request.
|
|
148
|
+
const requestEnrichersSpan = tracingManager.startSpan(SpanKeynameEnum.RouterRequestEnrichers, SpanKeynameEnum.RouterRequestExecution);
|
|
134
149
|
const enrichedRequest = yield this.executeRequestEnrichers(request, container, methodNode);
|
|
135
150
|
requestEnrichersSpan.end();
|
|
136
151
|
this.loghandler.debug("This request has been enriched", {
|
|
137
152
|
request,
|
|
138
153
|
enrichedRequest,
|
|
139
154
|
}, NetworkingModuleKeyname);
|
|
155
|
+
// Resolve the value to inject in the method arguments that have a decorator resolver
|
|
140
156
|
const resolvedMethodArguments = [];
|
|
141
157
|
for (const methodArgument of methodNode.route.methodArguments) {
|
|
142
158
|
resolvedMethodArguments.push(yield this.controllerMethodParameterDecoratorResolver.resolve(methodArgument, enrichedRequest, routeParameters, identity));
|
|
@@ -163,7 +179,7 @@ let Router = class Router {
|
|
|
163
179
|
returnedResponse.status = 200;
|
|
164
180
|
returnedResponse.body = response;
|
|
165
181
|
}
|
|
166
|
-
const responseEnrichersSpan =
|
|
182
|
+
const responseEnrichersSpan = tracingManager.startSpan(SpanKeynameEnum.RouterResponseEnrichers, SpanKeynameEnum.RouterRequestExecution);
|
|
167
183
|
const enrichedResponse = yield this.executeResponseEnrichers(returnedResponse, request, container, methodNode);
|
|
168
184
|
responseEnrichersSpan.end();
|
|
169
185
|
this.loghandler.debug("This response has been enriched", {
|
|
@@ -259,8 +275,7 @@ Router = __decorate([
|
|
|
259
275
|
__param(0, inject("LogHandlerInterface")),
|
|
260
276
|
__param(2, inject("AuthorizerManagerInterface")),
|
|
261
277
|
__param(3, inject("AuthenticationManagerInterface")),
|
|
262
|
-
|
|
263
|
-
__metadata("design:paramtypes", [Object, ControllerMethodParameterDecoratorResolver, Object, Object, Object])
|
|
278
|
+
__metadata("design:paramtypes", [Object, ControllerMethodParameterDecoratorResolver, Object, Object])
|
|
264
279
|
], Router);
|
|
265
280
|
export { Router };
|
|
266
281
|
//# sourceMappingURL=router.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../../src/router.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAsB,MAAM,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAEhE,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAC,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AAGhE,OAAO,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;AAGxD,OAAO,EAAC,kBAAkB,EAAC,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAC,0CAA0C,EAAC,MAAM,4DAA4D,CAAC;AACtH,OAAO,GAAG,MAAM,WAAW,CAAC;AAC5B,OAAO,EAAgC,wBAAwB,EAAC,MAAM,qBAAqB,CAAC;AAK5F,OAAO,EAAC,uBAAuB,EAAC,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAO,eAAe,EAA0B,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../../src/router.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAsB,MAAM,EAAE,SAAS,E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A;6CAFoB,0CAA0C;GAZlH,MAAM,CA+QlB;SA/QY,MAAM"}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export declare const controllerRegistry: any[];
|
|
2
|
+
/**
|
|
3
|
+
* The controller decorator can be used on a class to register this class as a controller in the router.
|
|
4
|
+
* @param basePath The base path for all the routes in the controller.
|
|
5
|
+
*/
|
|
2
6
|
export declare const controller: (basePath: string) => (constructor: Function) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./body.decorator";
|
|
2
2
|
export * from "./controller.decorator";
|
|
3
|
-
export * from "./identity.decorator";
|
|
4
3
|
export * from "./headers.decorator";
|
|
4
|
+
export * from "./identity.decorator";
|
|
5
5
|
export * from "./query-parameter.decorator";
|
|
6
6
|
export * from "./query-parameters.decorator";
|
|
7
7
|
export * from "./request.decorator";
|
|
@@ -1 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The queryParameter decorator can be used to inject a specific query parameter of a request in a parameter of a method in a controller.
|
|
3
|
+
* @param name The name of the query parameter to inject.
|
|
4
|
+
*/
|
|
1
5
|
export declare const queryParameter: (name: string) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The responseHeader decorator can be used to specify a header that needs to be added to the response before sending it back.
|
|
3
|
+
* This decorator can be used with either method (route) or a class (controller).
|
|
4
|
+
* If used on the class than it will be applied to every route of the controller.
|
|
5
|
+
* @param key The key of the header
|
|
6
|
+
* @param value The value to set the header to.
|
|
7
|
+
*/
|
|
1
8
|
export declare const responseHeader: (key: string, value: string) => (target: any, propertyKey?: string | undefined, descriptor?: PropertyDescriptor | undefined) => void;
|
|
@@ -1 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The routeParameter decorator can be used to inject a specific route parameter of a request in a parameter of a method in a controller.
|
|
3
|
+
* @param name The name of the route(path) parameter to inject.
|
|
4
|
+
*/
|
|
1
5
|
export declare const routeParameter: (name: string) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { HttpMethod } from "@pristine-ts/common";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* The route decorator can be used on a method to register this method as a route of the controller in the router.
|
|
4
|
+
* @param httpMethod The http method of the route
|
|
5
|
+
* @param path The part of the path following the base path of the controller. For path parameters use the colons. (ie: resources/:id)
|
|
6
|
+
*/
|
|
7
|
+
export declare const route: (httpMethod: HttpMethod | string, path: string) => (target: Object, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
@@ -2,6 +2,10 @@ import { Response } from "../models/response";
|
|
|
2
2
|
import { Request } from "../models/request";
|
|
3
3
|
import { RouterResponseEnricherInterface } from "../interfaces/router-response-enricher.interface";
|
|
4
4
|
import { MethodRouterNode } from "../nodes/method-router.node";
|
|
5
|
+
/**
|
|
6
|
+
* The RouterResponseEnricher enriches the response of the router by adding the response headers specified by the response header decorator.
|
|
7
|
+
* It is tagged as an RouterResponseEnricher so it can be automatically injected with the all the other RouterResponseEnrichers.
|
|
8
|
+
*/
|
|
5
9
|
export declare class RouterResponseEnricher implements RouterResponseEnricherInterface {
|
|
6
10
|
enrichResponse(response: Response, request: Request, methodNode: MethodRouterNode): Promise<Response>;
|
|
7
11
|
}
|
|
@@ -2,5 +2,7 @@ export * from "./bad-request.http-error";
|
|
|
2
2
|
export * from "./forbidden.http-error";
|
|
3
3
|
export * from "./http.error";
|
|
4
4
|
export * from "./invalid-body.http-error";
|
|
5
|
-
export * from "./
|
|
5
|
+
export * from "./method-router-adding.error";
|
|
6
6
|
export * from "./not-found.http-error";
|
|
7
|
+
export * from "./path-router-adding.error";
|
|
8
|
+
export * from "./path-router-instantiation.error";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { LoggableError } from "@pristine-ts/common";
|
|
1
2
|
/**
|
|
2
3
|
* This class defines a basic HttpError. In your code, feel free to throw an HttpError to have this error returned via HTTP.
|
|
3
4
|
* If you throw this error when handling an Event, it won't be returned.
|
|
4
5
|
*/
|
|
5
|
-
import { LoggableError } from "@pristine-ts/common";
|
|
6
6
|
export declare class HttpError extends LoggableError {
|
|
7
7
|
readonly httpStatus: number;
|
|
8
8
|
readonly message: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HttpMethod, LoggableError } from "@pristine-ts/common";
|
|
2
|
+
import { Route } from "../models/route";
|
|
3
|
+
import { MethodRouterNode } from "../nodes/method-router.node";
|
|
4
|
+
/**
|
|
5
|
+
* This Error is thrown when there's an error that happens when the networking is being initialized.
|
|
6
|
+
* It is thrown when trying to add a child node to a MethodRouterNode, since a MethodRouterNode is a leaf it cannot have any children.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MethodRouterAddingError extends LoggableError {
|
|
9
|
+
constructor(message: string, splitPaths: string[], method: HttpMethod | string, route: Route, methodRouterNode: MethodRouterNode);
|
|
10
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This Error is thrown when there's an error that happens when the networking is being initialized
|
|
3
|
-
*/
|
|
4
1
|
import { HttpMethod, LoggableError } from "@pristine-ts/common";
|
|
5
2
|
import { PathRouterNode } from "../nodes/path-router.node";
|
|
6
3
|
import { Route } from "../models/route";
|
|
4
|
+
/**
|
|
5
|
+
* This Error is thrown when there's an error that happens when the networking is being initialized.
|
|
6
|
+
* It is thrown when an error occurs when trying to add a child node to a PathRouterNode.
|
|
7
|
+
*/
|
|
7
8
|
export declare class PathRouterAddingError extends LoggableError {
|
|
8
9
|
constructor(message: string, splitPaths: string[], method: HttpMethod | string, route: Route, pathRouterNode: PathRouterNode);
|
|
9
10
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This Error is thrown when there's an error that happens when the networking is being initialized
|
|
3
|
-
*/
|
|
4
1
|
import { LoggableError } from "@pristine-ts/common";
|
|
5
2
|
import { PathRouterNode } from "../nodes/path-router.node";
|
|
3
|
+
/**
|
|
4
|
+
* This Error is thrown when there's an error that happens when the networking is being initialized.
|
|
5
|
+
* It is thrown when an error occurs when trying to instantiate a PathRouterNode.
|
|
6
|
+
*/
|
|
6
7
|
export declare class PathRouterInstantiationError extends LoggableError {
|
|
7
8
|
constructor(message: string, path: string, parent?: PathRouterNode);
|
|
8
9
|
}
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import { Request } from "../models/request";
|
|
2
2
|
import { IdentityInterface } from "@pristine-ts/common";
|
|
3
|
+
import { ParameterDecoratorInterface } from "./parameter-decorator.interface";
|
|
4
|
+
/**
|
|
5
|
+
* This interface defines the methods that a decorator resolver for method parameter in a controller must implement.
|
|
6
|
+
*/
|
|
3
7
|
export interface ControllerMethodParameterDecoratorResolverInterface {
|
|
4
|
-
|
|
5
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Returns whether or not the resolver support such a method argument.
|
|
10
|
+
* Usually we will check the methodArgument.type field to determine if it is a supported type.
|
|
11
|
+
* @param methodArgument
|
|
12
|
+
*/
|
|
13
|
+
supports(methodArgument: ParameterDecoratorInterface): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Resolves the value for the decorator.
|
|
16
|
+
* The router than injects that value into the parameter of the controller method.
|
|
17
|
+
* @param methodArgument The information on where to retrieve the value.
|
|
18
|
+
* @param request The request itself.
|
|
19
|
+
* @param routeParameters The parameters and their values in the route of the controller.
|
|
20
|
+
* @param identity The identity making the request
|
|
21
|
+
*/
|
|
22
|
+
resolve(methodArgument: ParameterDecoratorInterface, request: Request, routeParameters: {
|
|
6
23
|
[key: string]: string;
|
|
7
24
|
}, identity?: IdentityInterface): Promise<any>;
|
|
8
25
|
}
|
|
@@ -6,8 +6,8 @@ export * from "./parameter-decorator.interface";
|
|
|
6
6
|
export * from "./query-parameter-decorator.interface";
|
|
7
7
|
export * from "./query-parameters-decorator.interface";
|
|
8
8
|
export * from "./request-parameter-decorator.interface";
|
|
9
|
-
export * from "./router-request-enricher.interface";
|
|
10
|
-
export * from "./router-response-enricher.interface";
|
|
11
9
|
export * from "./route-method-decorator.interface";
|
|
12
10
|
export * from "./route-parameter-decorator.interface";
|
|
13
11
|
export * from "./router.interface";
|
|
12
|
+
export * from "./router-request-enricher.interface";
|
|
13
|
+
export * from "./router-response-enricher.interface";
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ParameterDecoratorInterface } from "./parameter-decorator.interface";
|
|
2
|
+
/**
|
|
3
|
+
* This interface represents the object that will contain the information required to know how to handle the
|
|
4
|
+
* @queryParameters decorator.
|
|
5
|
+
*/
|
|
2
6
|
export interface QueryParametersDecoratorInterface extends ParameterDecoratorInterface {
|
|
3
7
|
type: "queryParameters";
|
|
4
8
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ParameterDecoratorInterface } from "./parameter-decorator.interface";
|
|
2
2
|
/**
|
|
3
3
|
* This interface represents the object that will contain the information to know how to handle the
|
|
4
|
-
* @
|
|
4
|
+
* @routeParameter decorator.
|
|
5
5
|
*/
|
|
6
6
|
export interface RouteParameterDecoratorInterface extends ParameterDecoratorInterface {
|
|
7
7
|
type: "routeParameter";
|
|
@@ -4,7 +4,7 @@ import { Response } from "../models/response";
|
|
|
4
4
|
import { Request } from "../models/request";
|
|
5
5
|
import { Route } from "../models/route";
|
|
6
6
|
/**
|
|
7
|
-
* This
|
|
7
|
+
* This interface defines the methods that the router must implement.
|
|
8
8
|
*/
|
|
9
9
|
export interface RouterInterface {
|
|
10
10
|
/**
|
|
@@ -18,7 +18,7 @@ export interface RouterInterface {
|
|
|
18
18
|
register(path: string, method: HttpMethod | string, route: Route): any;
|
|
19
19
|
/**
|
|
20
20
|
* This method executes the request passed as a parameter. A container must also be passed since we want each
|
|
21
|
-
* request to have its own container so that memory isn't
|
|
21
|
+
* request to have its own container so that memory isn't accidentally shared between requests.
|
|
22
22
|
*
|
|
23
23
|
* @param request
|
|
24
24
|
* @param container
|