@pristine-ts/networking 0.0.164 → 0.0.165

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.
@@ -11,10 +11,28 @@ require("reflect-metadata");
11
11
  const tsyringe_1 = require("tsyringe");
12
12
  const common_1 = require("@pristine-ts/common");
13
13
  const networking_module_keyname_1 = require("../networking.module.keyname");
14
+ /**
15
+ * The RequestParameterDecoratorResolver resolves the value of the whole request so that it can be injected it into the
16
+ * parameter of the route of the controller that was annotated with the @request decorator.
17
+ * It is tagged as an MethodParameterDecoratorResolver so it can be automatically injected with the all the other MethodParameterDecoratorResolvers.
18
+ */
14
19
  let RequestParameterDecoratorResolver = class RequestParameterDecoratorResolver {
20
+ /**
21
+ * Resolves the value of the whole request.
22
+ * The router than injects that value into the parameter of the controller method.
23
+ * @param methodArgument The method argument created by the decorator.
24
+ * @param request The request
25
+ * @param routeParameters The router parameters
26
+ * @param identity The identity making the request
27
+ */
15
28
  resolve(methodArgument, request, routeParameters, identity) {
16
29
  return Promise.resolve(request !== null && request !== void 0 ? request : null);
17
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
+ */
18
36
  supports(methodArgument) {
19
37
  return methodArgument && methodArgument.hasOwnProperty("type") && methodArgument.type === "request";
20
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"request-parameter-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/request-parameter-decorator.resolver.ts"],"names":[],"mappings":";;;;;;;;;AAAA,4BAAyB;AACzB,uCAAoC;AAGpC,gDAAmG;AACnG,4EAAqE;AAKrE,IAAa,iCAAiC,GAA9C,MAAa,iCAAiC;IAC1C,OAAO,CAAC,cAAmB,EACnB,OAAgB,EAChB,eAAwC,EACxC,QAA4B;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED,QAAQ,CAAC,cAAmB;QACxB,OAAO,cAAc,IAAI,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,IAAI,KAAK,SAAS,CAAC;IACxG,CAAC;CACJ,CAAA;AAXY,iCAAiC;IAH7C,qBAAY,CAAC,mDAAuB,CAAC;IACrC,YAAG,CAAC,iCAAwB,CAAC,gCAAgC,CAAC;IAC9D,qBAAU,EAAE;GACA,iCAAiC,CAW7C;AAXY,8EAAiC"}
1
+ {"version":3,"file":"request-parameter-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/request-parameter-decorator.resolver.ts"],"names":[],"mappings":";;;;;;;;;AAAA,4BAAyB;AACzB,uCAAoC;AAGpC,gDAAmG;AACnG,4EAAqE;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,qBAAY,CAAC,mDAAuB,CAAC;IACrC,YAAG,CAAC,iCAAwB,CAAC,gCAAgC,CAAC;IAC9D,qBAAU,EAAE;GACA,iCAAiC,CAyB7C;AAzBY,8EAAiC"}
@@ -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;AAKrE,IAAa,iCAAiC,GAA9C,MAAa,iCAAiC;IAC1C,OAAO,CAAC,cAAmB,EACnB,OAAgB,EAChB,eAAwC,EACxC,QAA4B;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED,QAAQ,CAAC,cAAmB;QACxB,OAAO,cAAc,IAAI,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,IAAI,KAAK,SAAS,CAAC;IACxG,CAAC;CACJ,CAAA;AAXY,iCAAiC;IAH7C,YAAY,CAAC,uBAAuB,CAAC;IACrC,GAAG,CAAC,wBAAwB,CAAC,gCAAgC,CAAC;IAC9D,UAAU,EAAE;GACA,iCAAiC,CAW7C;SAXY,iCAAiC"}
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"}
@@ -2,9 +2,29 @@ import "reflect-metadata";
2
2
  import { ControllerMethodParameterDecoratorResolverInterface } from "../interfaces/controller-method-parameter-decorator-resolver.interface";
3
3
  import { Request } from "../models/request";
4
4
  import { IdentityInterface } from "@pristine-ts/common";
5
+ import { RequestParameterDecoratorInterface } from "../interfaces/request-parameter-decorator.interface";
6
+ import { ParameterDecoratorInterface } from "../interfaces/parameter-decorator.interface";
7
+ /**
8
+ * The RequestParameterDecoratorResolver resolves the value of the whole request so that it can be injected it into the
9
+ * parameter of the route of the controller that was annotated with the @request decorator.
10
+ * It is tagged as an MethodParameterDecoratorResolver so it can be automatically injected with the all the other MethodParameterDecoratorResolvers.
11
+ */
5
12
  export declare class RequestParameterDecoratorResolver implements ControllerMethodParameterDecoratorResolverInterface {
6
- resolve(methodArgument: any, request: Request, routeParameters: {
13
+ /**
14
+ * Resolves the value of the whole request.
15
+ * The router than injects that value into the parameter of the controller method.
16
+ * @param methodArgument The method argument created by the decorator.
17
+ * @param request The request
18
+ * @param routeParameters The router parameters
19
+ * @param identity The identity making the request
20
+ */
21
+ resolve(methodArgument: RequestParameterDecoratorInterface, request: Request, routeParameters: {
7
22
  [p: string]: string;
8
23
  }, identity?: IdentityInterface): Promise<any>;
9
- supports(methodArgument: any): boolean;
24
+ /**
25
+ * Returns whether or not the resolver support such a method argument.
26
+ * Usually we will check the methodArgument.type field to determine if it is a supported type.
27
+ * @param methodArgument
28
+ */
29
+ supports(methodArgument: ParameterDecoratorInterface): boolean;
10
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pristine-ts/networking",
3
- "version": "0.0.164",
3
+ "version": "0.0.165",
4
4
  "description": "",
5
5
  "module": "dist/lib/esm/networking.module.js",
6
6
  "main": "dist/lib/cjs/networking.module.js",
@@ -19,9 +19,9 @@
19
19
  "access": "public"
20
20
  },
21
21
  "dependencies": {
22
- "@pristine-ts/common": "^0.0.164",
23
- "@pristine-ts/security": "^0.0.164",
24
- "@pristine-ts/telemetry": "^0.0.164",
22
+ "@pristine-ts/common": "^0.0.165",
23
+ "@pristine-ts/security": "^0.0.165",
24
+ "@pristine-ts/telemetry": "^0.0.165",
25
25
  "url-parse": "^1.4.7"
26
26
  },
27
27
  "jest": {
@@ -58,5 +58,5 @@
58
58
  "src/*.{js,ts}"
59
59
  ]
60
60
  },
61
- "gitHead": "c4e421eb5c60f895d6ae19d9b8c7078dd26d0fd4"
61
+ "gitHead": "da23f627c5a73c8b1aec0951e4b4f10ceeff44cb"
62
62
  }