@pristine-ts/http 0.0.232 → 0.0.234

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.
@@ -17,6 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.HttpModule = void 0;
18
18
  const http_module_keyname_1 = require("./http.module.keyname");
19
19
  const logging_1 = require("@pristine-ts/logging");
20
+ const configuration_1 = require("@pristine-ts/configuration");
21
+ __exportStar(require("./http.module.keyname"), exports);
20
22
  __exportStar(require("./clients/clients"), exports);
21
23
  __exportStar(require("./enums/enums"), exports);
22
24
  __exportStar(require("./errors/errors"), exports);
@@ -28,6 +30,15 @@ __exportStar(require("./wrappers/wrappers"), exports);
28
30
  exports.HttpModule = {
29
31
  keyname: http_module_keyname_1.HttpModuleKeyname,
30
32
  importModules: [logging_1.LoggingModule],
31
- configurationDefinitions: [],
33
+ configurationDefinitions: [
34
+ {
35
+ parameterName: "pristine.http.logging-enabled",
36
+ defaultValue: true,
37
+ isRequired: false,
38
+ defaultResolvers: [
39
+ new configuration_1.BooleanResolver(new configuration_1.EnvironmentVariableResolver("PRISTINE_HTTP_LOGGING")),
40
+ ]
41
+ }
42
+ ],
32
43
  };
33
44
  //# sourceMappingURL=http.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.module.js","sourceRoot":"","sources":["../../../src/http.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,+DAAwD;AACxD,kDAAmD;AAEnD,oDAAkC;AAClC,gDAA8B;AAC9B,kDAAgC;AAChC,8DAA2C;AAC3C,0DAAuC;AACvC,oDAAkC;AAClC,gDAA8B;AAC9B,sDAAoC;AAEvB,QAAA,UAAU,GAAoB;IACvC,OAAO,EAAE,uCAAiB;IAC1B,aAAa,EAAE,CAAC,uBAAa,CAAC;IAC9B,wBAAwB,EAAE,EACzB;CACJ,CAAA"}
1
+ {"version":3,"file":"http.module.js","sourceRoot":"","sources":["../../../src/http.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,+DAAwD;AACxD,kDAAmD;AACnD,8DAAwF;AAExF,wDAAsC;AACtC,oDAAkC;AAClC,gDAA8B;AAC9B,kDAAgC;AAChC,8DAA2C;AAC3C,0DAAuC;AACvC,oDAAkC;AAClC,gDAA8B;AAC9B,sDAAoC;AAEvB,QAAA,UAAU,GAAoB;IACvC,OAAO,EAAE,uCAAiB;IAC1B,aAAa,EAAE,CAAC,uBAAa,CAAC;IAC9B,wBAAwB,EAAE;QACtB;YACI,aAAa,EAAE,+BAA+B;YAC9C,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE,KAAK;YACjB,gBAAgB,EAAE;gBACd,IAAI,+BAAe,CAAC,IAAI,2CAA2B,CAAC,uBAAuB,CAAC,CAAC;aAChF;SACJ;KACJ;CACJ,CAAA"}
@@ -31,8 +31,9 @@ const http_module_keyname_1 = require("../http.module.keyname");
31
31
  * It is module scoped to the http module so that it is only registered if the http module is imported.
32
32
  */
33
33
  let HttpErrorResponseLoggingInterceptor = class HttpErrorResponseLoggingInterceptor {
34
- constructor(logHandler) {
34
+ constructor(logHandler, loggingEnabled) {
35
35
  this.logHandler = logHandler;
36
+ this.loggingEnabled = loggingEnabled;
36
37
  }
37
38
  /**
38
39
  * This method intercepts an incoming http response that has an error and logs it.
@@ -42,7 +43,9 @@ let HttpErrorResponseLoggingInterceptor = class HttpErrorResponseLoggingIntercep
42
43
  */
43
44
  interceptErrorResponse(request, options, response) {
44
45
  return __awaiter(this, void 0, void 0, function* () {
45
- this.logHandler.error("Receiving http response that has an error", { response, options }, http_module_keyname_1.HttpModuleKeyname);
46
+ if (this.loggingEnabled) {
47
+ this.logHandler.error("Receiving http response that has an error", { response, options }, http_module_keyname_1.HttpModuleKeyname);
48
+ }
46
49
  return response;
47
50
  });
48
51
  }
@@ -52,7 +55,8 @@ HttpErrorResponseLoggingInterceptor = __decorate([
52
55
  (0, common_1.moduleScoped)(http_module_keyname_1.HttpModuleKeyname),
53
56
  (0, tsyringe_1.injectable)(),
54
57
  __param(0, (0, tsyringe_1.inject)("LogHandlerInterface")),
55
- __metadata("design:paramtypes", [Object])
58
+ __param(1, (0, tsyringe_1.inject)("%pristine.http.logging-enabled%")),
59
+ __metadata("design:paramtypes", [Object, Boolean])
56
60
  ], HttpErrorResponseLoggingInterceptor);
57
61
  exports.HttpErrorResponseLoggingInterceptor = HttpErrorResponseLoggingInterceptor;
58
62
  //# sourceMappingURL=http-error-response-logging.interceptor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-error-response-logging.interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/http-error-response-logging.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA4C;AAC5C,gDAAkF;AAKlF,gEAAyD;AAGzD;;;;GAIG;AAII,IAAM,mCAAmC,GAAzC,MAAM,mCAAmC;IAC5C,YAA4D,UAA+B;QAA/B,eAAU,GAAV,UAAU,CAAqB;IAC3F,CAAC;IAED;;;;;OAKG;IACG,sBAAsB,CAAC,OAA6B,EAAE,OAA2B,EAAE,QAA+B;;YACpH,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,2CAA2C,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAC,EAAE,uCAAiB,CAAC,CAAC;YAC3G,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CAEJ,CAAA;AAfY,mCAAmC;IAH/C,IAAA,YAAG,EAAC,iCAAwB,CAAC,4BAA4B,CAAC;IAC1D,IAAA,qBAAY,EAAC,uCAAiB,CAAC;IAC/B,IAAA,qBAAU,GAAE;IAEI,WAAA,IAAA,iBAAM,EAAC,qBAAqB,CAAC,CAAA;;GADjC,mCAAmC,CAe/C;AAfY,kFAAmC"}
1
+ {"version":3,"file":"http-error-response-logging.interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/http-error-response-logging.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA4C;AAC5C,gDAAkF;AAKlF,gEAAyD;AAGzD;;;;GAIG;AAII,IAAM,mCAAmC,GAAzC,MAAM,mCAAmC;IAC5C,YACoD,UAA+B,EACnB,cAAuB;QADnC,eAAU,GAAV,UAAU,CAAqB;QACnB,mBAAc,GAAd,cAAc,CAAS;IAEvF,CAAC;IAED;;;;;OAKG;IACG,sBAAsB,CAAC,OAA6B,EAAE,OAA2B,EAAE,QAA+B;;YACpH,IAAG,IAAI,CAAC,cAAc,EAAE;gBACpB,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,2CAA2C,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAC,EAAE,uCAAiB,CAAC,CAAC;aAC9G;YAED,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CAEJ,CAAA;AArBY,mCAAmC;IAH/C,IAAA,YAAG,EAAC,iCAAwB,CAAC,4BAA4B,CAAC;IAC1D,IAAA,qBAAY,EAAC,uCAAiB,CAAC;IAC/B,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,qBAAqB,CAAC,CAAA;IAC7B,WAAA,IAAA,iBAAM,EAAC,iCAAiC,CAAC,CAAA;;GAHrC,mCAAmC,CAqB/C;AArBY,kFAAmC"}
@@ -31,8 +31,9 @@ const http_module_keyname_1 = require("../http.module.keyname");
31
31
  * It is module scoped to the http module so that it is only registered if the http module is imported.
32
32
  */
33
33
  let HttpRequestLoggingInterceptor = class HttpRequestLoggingInterceptor {
34
- constructor(logHandler) {
34
+ constructor(logHandler, loggingEnabled) {
35
35
  this.logHandler = logHandler;
36
+ this.loggingEnabled = loggingEnabled;
36
37
  }
37
38
  /**
38
39
  * This method intercepts an outgoing http request and logs it.
@@ -41,7 +42,9 @@ let HttpRequestLoggingInterceptor = class HttpRequestLoggingInterceptor {
41
42
  */
42
43
  interceptRequest(request, options) {
43
44
  return __awaiter(this, void 0, void 0, function* () {
44
- this.logHandler.info("Outgoing http request", { request, options }, http_module_keyname_1.HttpModuleKeyname);
45
+ if (this.loggingEnabled) {
46
+ this.logHandler.info("Outgoing http request", { request, options }, http_module_keyname_1.HttpModuleKeyname);
47
+ }
45
48
  return request;
46
49
  });
47
50
  }
@@ -51,7 +54,8 @@ HttpRequestLoggingInterceptor = __decorate([
51
54
  (0, common_1.moduleScoped)(http_module_keyname_1.HttpModuleKeyname),
52
55
  (0, tsyringe_1.injectable)(),
53
56
  __param(0, (0, tsyringe_1.inject)("LogHandlerInterface")),
54
- __metadata("design:paramtypes", [Object])
57
+ __param(1, (0, tsyringe_1.inject)("%pristine.http.logging-enabled%")),
58
+ __metadata("design:paramtypes", [Object, Boolean])
55
59
  ], HttpRequestLoggingInterceptor);
56
60
  exports.HttpRequestLoggingInterceptor = HttpRequestLoggingInterceptor;
57
61
  //# sourceMappingURL=http-request-logging.interceptor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-request-logging.interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/http-request-logging.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA4C;AAE5C,gDAAkF;AAIlF,gEAAyD;AAEzD;;;;GAIG;AAII,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IACtC,YAA4D,UAA+B;QAA/B,eAAU,GAAV,UAAU,CAAqB;IAC3F,CAAC;IAED;;;;OAIG;IACG,gBAAgB,CAAC,OAA6B,EAAE,OAA2B;;YAC7E,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAC,OAAO,EAAE,OAAO,EAAC,EAAE,uCAAiB,CAAC,CAAC;YACrF,OAAO,OAAO,CAAC;QACnB,CAAC;KAAA;CACJ,CAAA;AAbY,6BAA6B;IAHzC,IAAA,YAAG,EAAC,iCAAwB,CAAC,sBAAsB,CAAC;IACpD,IAAA,qBAAY,EAAC,uCAAiB,CAAC;IAC/B,IAAA,qBAAU,GAAE;IAEI,WAAA,IAAA,iBAAM,EAAC,qBAAqB,CAAC,CAAA;;GADjC,6BAA6B,CAazC;AAbY,sEAA6B"}
1
+ {"version":3,"file":"http-request-logging.interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/http-request-logging.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA4C;AAE5C,gDAAkF;AAIlF,gEAAyD;AAEzD;;;;GAIG;AAII,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IACtC,YACoD,UAA+B,EACnB,cAAuB;QADnC,eAAU,GAAV,UAAU,CAAqB;QACnB,mBAAc,GAAd,cAAc,CAAS;IAEvF,CAAC;IAED;;;;OAIG;IACG,gBAAgB,CAAC,OAA6B,EAAE,OAA2B;;YAC7E,IAAG,IAAI,CAAC,cAAc,EAAE;gBACpB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAC,OAAO,EAAE,OAAO,EAAC,EAAE,uCAAiB,CAAC,CAAC;aACxF;YAED,OAAO,OAAO,CAAC;QACnB,CAAC;KAAA;CACJ,CAAA;AAnBY,6BAA6B;IAHzC,IAAA,YAAG,EAAC,iCAAwB,CAAC,sBAAsB,CAAC;IACpD,IAAA,qBAAY,EAAC,uCAAiB,CAAC;IAC/B,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,qBAAqB,CAAC,CAAA;IAC7B,WAAA,IAAA,iBAAM,EAAC,iCAAiC,CAAC,CAAA;;GAHrC,6BAA6B,CAmBzC;AAnBY,sEAA6B"}
@@ -31,8 +31,9 @@ const http_module_keyname_1 = require("../http.module.keyname");
31
31
  * It is module scoped to the http module so that it is only registered if the http module is imported.
32
32
  */
33
33
  let HttpResponseLoggingInterceptor = class HttpResponseLoggingInterceptor {
34
- constructor(logHandler) {
34
+ constructor(logHandler, loggingEnabled) {
35
35
  this.logHandler = logHandler;
36
+ this.loggingEnabled = loggingEnabled;
36
37
  }
37
38
  /**
38
39
  * This method intercepts an incoming http response and logs it.
@@ -42,7 +43,9 @@ let HttpResponseLoggingInterceptor = class HttpResponseLoggingInterceptor {
42
43
  */
43
44
  interceptResponse(request, options, response) {
44
45
  return __awaiter(this, void 0, void 0, function* () {
45
- this.logHandler.info("Receiving http response", { response, options }, http_module_keyname_1.HttpModuleKeyname);
46
+ if (this.loggingEnabled) {
47
+ this.logHandler.info("Receiving http response", { response, options }, http_module_keyname_1.HttpModuleKeyname);
48
+ }
46
49
  return response;
47
50
  });
48
51
  }
@@ -52,7 +55,8 @@ HttpResponseLoggingInterceptor = __decorate([
52
55
  (0, common_1.moduleScoped)(http_module_keyname_1.HttpModuleKeyname),
53
56
  (0, tsyringe_1.injectable)(),
54
57
  __param(0, (0, tsyringe_1.inject)("LogHandlerInterface")),
55
- __metadata("design:paramtypes", [Object])
58
+ __param(1, (0, tsyringe_1.inject)("%pristine.http.logging-enabled%")),
59
+ __metadata("design:paramtypes", [Object, Boolean])
56
60
  ], HttpResponseLoggingInterceptor);
57
61
  exports.HttpResponseLoggingInterceptor = HttpResponseLoggingInterceptor;
58
62
  //# sourceMappingURL=http-response-logging.interceptor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-response-logging.interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/http-response-logging.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA4C;AAC5C,gDAAkF;AAMlF,gEAAyD;AAEzD;;;;GAIG;AAII,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IACvC,YAA4D,UAA+B;QAA/B,eAAU,GAAV,UAAU,CAAqB;IAC3F,CAAC;IAED;;;;;OAKG;IACG,iBAAiB,CAAC,OAA6B,EAAE,OAA2B,EAAE,QAA+B;;YAC/G,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAC,EAAE,uCAAiB,CAAC,CAAC;YACxF,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CAEJ,CAAA;AAfY,8BAA8B;IAH1C,IAAA,YAAG,EAAC,iCAAwB,CAAC,uBAAuB,CAAC;IACrD,IAAA,qBAAY,EAAC,uCAAiB,CAAC;IAC/B,IAAA,qBAAU,GAAE;IAEI,WAAA,IAAA,iBAAM,EAAC,qBAAqB,CAAC,CAAA;;GADjC,8BAA8B,CAe1C;AAfY,wEAA8B"}
1
+ {"version":3,"file":"http-response-logging.interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/http-response-logging.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA4C;AAC5C,gDAAkF;AAMlF,gEAAyD;AAEzD;;;;GAIG;AAII,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IACvC,YACoD,UAA+B,EACnB,cAAuB;QADnC,eAAU,GAAV,UAAU,CAAqB;QACnB,mBAAc,GAAd,cAAc,CAAS;IAEvF,CAAC;IAED;;;;;OAKG;IACG,iBAAiB,CAAC,OAA6B,EAAE,OAA2B,EAAE,QAA+B;;YAC/G,IAAG,IAAI,CAAC,cAAc,EAAE;gBACpB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAC,EAAE,uCAAiB,CAAC,CAAC;aAC3F;YAED,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CAEJ,CAAA;AArBY,8BAA8B;IAH1C,IAAA,YAAG,EAAC,iCAAwB,CAAC,uBAAuB,CAAC;IACrD,IAAA,qBAAY,EAAC,uCAAiB,CAAC;IAC/B,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,qBAAqB,CAAC,CAAA;IAC7B,WAAA,IAAA,iBAAM,EAAC,iCAAiC,CAAC,CAAA;;GAHrC,8BAA8B,CAqB1C;AArBY,wEAA8B"}
@@ -1,5 +1,7 @@
1
1
  import { HttpModuleKeyname } from "./http.module.keyname";
2
2
  import { LoggingModule } from "@pristine-ts/logging";
3
+ import { BooleanResolver, EnvironmentVariableResolver } from "@pristine-ts/configuration";
4
+ export * from "./http.module.keyname";
3
5
  export * from "./clients/clients";
4
6
  export * from "./enums/enums";
5
7
  export * from "./errors/errors";
@@ -11,6 +13,15 @@ export * from "./wrappers/wrappers";
11
13
  export const HttpModule = {
12
14
  keyname: HttpModuleKeyname,
13
15
  importModules: [LoggingModule],
14
- configurationDefinitions: [],
16
+ configurationDefinitions: [
17
+ {
18
+ parameterName: "pristine.http.logging-enabled",
19
+ defaultValue: true,
20
+ isRequired: false,
21
+ defaultResolvers: [
22
+ new BooleanResolver(new EnvironmentVariableResolver("PRISTINE_HTTP_LOGGING")),
23
+ ]
24
+ }
25
+ ],
15
26
  };
16
27
  //# sourceMappingURL=http.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.module.js","sourceRoot":"","sources":["../../../src/http.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAC,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAEnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AAEpC,MAAM,CAAC,MAAM,UAAU,GAAoB;IACvC,OAAO,EAAE,iBAAiB;IAC1B,aAAa,EAAE,CAAC,aAAa,CAAC;IAC9B,wBAAwB,EAAE,EACzB;CACJ,CAAA"}
1
+ {"version":3,"file":"http.module.js","sourceRoot":"","sources":["../../../src/http.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAC,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAC,eAAe,EAAE,2BAA2B,EAAC,MAAM,4BAA4B,CAAC;AAExF,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AAEpC,MAAM,CAAC,MAAM,UAAU,GAAoB;IACvC,OAAO,EAAE,iBAAiB;IAC1B,aAAa,EAAE,CAAC,aAAa,CAAC;IAC9B,wBAAwB,EAAE;QACtB;YACI,aAAa,EAAE,+BAA+B;YAC9C,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE,KAAK;YACjB,gBAAgB,EAAE;gBACd,IAAI,eAAe,CAAC,IAAI,2BAA2B,CAAC,uBAAuB,CAAC,CAAC;aAChF;SACJ;KACJ;CACJ,CAAA"}
@@ -28,8 +28,9 @@ import { HttpModuleKeyname } from "../http.module.keyname";
28
28
  * It is module scoped to the http module so that it is only registered if the http module is imported.
29
29
  */
30
30
  let HttpErrorResponseLoggingInterceptor = class HttpErrorResponseLoggingInterceptor {
31
- constructor(logHandler) {
31
+ constructor(logHandler, loggingEnabled) {
32
32
  this.logHandler = logHandler;
33
+ this.loggingEnabled = loggingEnabled;
33
34
  }
34
35
  /**
35
36
  * This method intercepts an incoming http response that has an error and logs it.
@@ -39,7 +40,9 @@ let HttpErrorResponseLoggingInterceptor = class HttpErrorResponseLoggingIntercep
39
40
  */
40
41
  interceptErrorResponse(request, options, response) {
41
42
  return __awaiter(this, void 0, void 0, function* () {
42
- this.logHandler.error("Receiving http response that has an error", { response, options }, HttpModuleKeyname);
43
+ if (this.loggingEnabled) {
44
+ this.logHandler.error("Receiving http response that has an error", { response, options }, HttpModuleKeyname);
45
+ }
43
46
  return response;
44
47
  });
45
48
  }
@@ -49,7 +52,8 @@ HttpErrorResponseLoggingInterceptor = __decorate([
49
52
  moduleScoped(HttpModuleKeyname),
50
53
  injectable(),
51
54
  __param(0, inject("LogHandlerInterface")),
52
- __metadata("design:paramtypes", [Object])
55
+ __param(1, inject("%pristine.http.logging-enabled%")),
56
+ __metadata("design:paramtypes", [Object, Boolean])
53
57
  ], HttpErrorResponseLoggingInterceptor);
54
58
  export { HttpErrorResponseLoggingInterceptor };
55
59
  //# sourceMappingURL=http-error-response-logging.interceptor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-error-response-logging.interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/http-error-response-logging.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAKlF,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAGzD;;;;GAIG;AAII,IAAM,mCAAmC,GAAzC,MAAM,mCAAmC;IAC5C,YAA4D,UAA+B;QAA/B,eAAU,GAAV,UAAU,CAAqB;IAC3F,CAAC;IAED;;;;;OAKG;IACG,sBAAsB,CAAC,OAA6B,EAAE,OAA2B,EAAE,QAA+B;;YACpH,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,2CAA2C,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAC,EAAE,iBAAiB,CAAC,CAAC;YAC3G,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CAEJ,CAAA;AAfY,mCAAmC;IAH/C,GAAG,CAAC,wBAAwB,CAAC,4BAA4B,CAAC;IAC1D,YAAY,CAAC,iBAAiB,CAAC;IAC/B,UAAU,EAAE;IAEI,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;;GADjC,mCAAmC,CAe/C;SAfY,mCAAmC"}
1
+ {"version":3,"file":"http-error-response-logging.interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/http-error-response-logging.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAKlF,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAGzD;;;;GAIG;AAII,IAAM,mCAAmC,GAAzC,MAAM,mCAAmC;IAC5C,YACoD,UAA+B,EACnB,cAAuB;QADnC,eAAU,GAAV,UAAU,CAAqB;QACnB,mBAAc,GAAd,cAAc,CAAS;IAEvF,CAAC;IAED;;;;;OAKG;IACG,sBAAsB,CAAC,OAA6B,EAAE,OAA2B,EAAE,QAA+B;;YACpH,IAAG,IAAI,CAAC,cAAc,EAAE;gBACpB,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,2CAA2C,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAC,EAAE,iBAAiB,CAAC,CAAC;aAC9G;YAED,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CAEJ,CAAA;AArBY,mCAAmC;IAH/C,GAAG,CAAC,wBAAwB,CAAC,4BAA4B,CAAC;IAC1D,YAAY,CAAC,iBAAiB,CAAC;IAC/B,UAAU,EAAE;IAGJ,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;IAC7B,WAAA,MAAM,CAAC,iCAAiC,CAAC,CAAA;;GAHrC,mCAAmC,CAqB/C;SArBY,mCAAmC"}
@@ -28,8 +28,9 @@ import { HttpModuleKeyname } from "../http.module.keyname";
28
28
  * It is module scoped to the http module so that it is only registered if the http module is imported.
29
29
  */
30
30
  let HttpRequestLoggingInterceptor = class HttpRequestLoggingInterceptor {
31
- constructor(logHandler) {
31
+ constructor(logHandler, loggingEnabled) {
32
32
  this.logHandler = logHandler;
33
+ this.loggingEnabled = loggingEnabled;
33
34
  }
34
35
  /**
35
36
  * This method intercepts an outgoing http request and logs it.
@@ -38,7 +39,9 @@ let HttpRequestLoggingInterceptor = class HttpRequestLoggingInterceptor {
38
39
  */
39
40
  interceptRequest(request, options) {
40
41
  return __awaiter(this, void 0, void 0, function* () {
41
- this.logHandler.info("Outgoing http request", { request, options }, HttpModuleKeyname);
42
+ if (this.loggingEnabled) {
43
+ this.logHandler.info("Outgoing http request", { request, options }, HttpModuleKeyname);
44
+ }
42
45
  return request;
43
46
  });
44
47
  }
@@ -48,7 +51,8 @@ HttpRequestLoggingInterceptor = __decorate([
48
51
  moduleScoped(HttpModuleKeyname),
49
52
  injectable(),
50
53
  __param(0, inject("LogHandlerInterface")),
51
- __metadata("design:paramtypes", [Object])
54
+ __param(1, inject("%pristine.http.logging-enabled%")),
55
+ __metadata("design:paramtypes", [Object, Boolean])
52
56
  ], HttpRequestLoggingInterceptor);
53
57
  export { HttpRequestLoggingInterceptor };
54
58
  //# sourceMappingURL=http-request-logging.interceptor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-request-logging.interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/http-request-logging.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAIlF,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAEzD;;;;GAIG;AAII,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IACtC,YAA4D,UAA+B;QAA/B,eAAU,GAAV,UAAU,CAAqB;IAC3F,CAAC;IAED;;;;OAIG;IACG,gBAAgB,CAAC,OAA6B,EAAE,OAA2B;;YAC7E,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAC,OAAO,EAAE,OAAO,EAAC,EAAE,iBAAiB,CAAC,CAAC;YACrF,OAAO,OAAO,CAAC;QACnB,CAAC;KAAA;CACJ,CAAA;AAbY,6BAA6B;IAHzC,GAAG,CAAC,wBAAwB,CAAC,sBAAsB,CAAC;IACpD,YAAY,CAAC,iBAAiB,CAAC;IAC/B,UAAU,EAAE;IAEI,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;;GADjC,6BAA6B,CAazC;SAbY,6BAA6B"}
1
+ {"version":3,"file":"http-request-logging.interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/http-request-logging.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAIlF,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAEzD;;;;GAIG;AAII,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IACtC,YACoD,UAA+B,EACnB,cAAuB;QADnC,eAAU,GAAV,UAAU,CAAqB;QACnB,mBAAc,GAAd,cAAc,CAAS;IAEvF,CAAC;IAED;;;;OAIG;IACG,gBAAgB,CAAC,OAA6B,EAAE,OAA2B;;YAC7E,IAAG,IAAI,CAAC,cAAc,EAAE;gBACpB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAC,OAAO,EAAE,OAAO,EAAC,EAAE,iBAAiB,CAAC,CAAC;aACxF;YAED,OAAO,OAAO,CAAC;QACnB,CAAC;KAAA;CACJ,CAAA;AAnBY,6BAA6B;IAHzC,GAAG,CAAC,wBAAwB,CAAC,sBAAsB,CAAC;IACpD,YAAY,CAAC,iBAAiB,CAAC;IAC/B,UAAU,EAAE;IAGJ,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;IAC7B,WAAA,MAAM,CAAC,iCAAiC,CAAC,CAAA;;GAHrC,6BAA6B,CAmBzC;SAnBY,6BAA6B"}
@@ -28,8 +28,9 @@ import { HttpModuleKeyname } from "../http.module.keyname";
28
28
  * It is module scoped to the http module so that it is only registered if the http module is imported.
29
29
  */
30
30
  let HttpResponseLoggingInterceptor = class HttpResponseLoggingInterceptor {
31
- constructor(logHandler) {
31
+ constructor(logHandler, loggingEnabled) {
32
32
  this.logHandler = logHandler;
33
+ this.loggingEnabled = loggingEnabled;
33
34
  }
34
35
  /**
35
36
  * This method intercepts an incoming http response and logs it.
@@ -39,7 +40,9 @@ let HttpResponseLoggingInterceptor = class HttpResponseLoggingInterceptor {
39
40
  */
40
41
  interceptResponse(request, options, response) {
41
42
  return __awaiter(this, void 0, void 0, function* () {
42
- this.logHandler.info("Receiving http response", { response, options }, HttpModuleKeyname);
43
+ if (this.loggingEnabled) {
44
+ this.logHandler.info("Receiving http response", { response, options }, HttpModuleKeyname);
45
+ }
43
46
  return response;
44
47
  });
45
48
  }
@@ -49,7 +52,8 @@ HttpResponseLoggingInterceptor = __decorate([
49
52
  moduleScoped(HttpModuleKeyname),
50
53
  injectable(),
51
54
  __param(0, inject("LogHandlerInterface")),
52
- __metadata("design:paramtypes", [Object])
55
+ __param(1, inject("%pristine.http.logging-enabled%")),
56
+ __metadata("design:paramtypes", [Object, Boolean])
53
57
  ], HttpResponseLoggingInterceptor);
54
58
  export { HttpResponseLoggingInterceptor };
55
59
  //# sourceMappingURL=http-response-logging.interceptor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-response-logging.interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/http-response-logging.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAMlF,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAEzD;;;;GAIG;AAII,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IACvC,YAA4D,UAA+B;QAA/B,eAAU,GAAV,UAAU,CAAqB;IAC3F,CAAC;IAED;;;;;OAKG;IACG,iBAAiB,CAAC,OAA6B,EAAE,OAA2B,EAAE,QAA+B;;YAC/G,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAC,EAAE,iBAAiB,CAAC,CAAC;YACxF,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CAEJ,CAAA;AAfY,8BAA8B;IAH1C,GAAG,CAAC,wBAAwB,CAAC,uBAAuB,CAAC;IACrD,YAAY,CAAC,iBAAiB,CAAC;IAC/B,UAAU,EAAE;IAEI,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;;GADjC,8BAA8B,CAe1C;SAfY,8BAA8B"}
1
+ {"version":3,"file":"http-response-logging.interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/http-response-logging.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAMlF,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAEzD;;;;GAIG;AAII,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IACvC,YACoD,UAA+B,EACnB,cAAuB;QADnC,eAAU,GAAV,UAAU,CAAqB;QACnB,mBAAc,GAAd,cAAc,CAAS;IAEvF,CAAC;IAED;;;;;OAKG;IACG,iBAAiB,CAAC,OAA6B,EAAE,OAA2B,EAAE,QAA+B;;YAC/G,IAAG,IAAI,CAAC,cAAc,EAAE;gBACpB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAC,EAAE,iBAAiB,CAAC,CAAC;aAC3F;YAED,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CAEJ,CAAA;AArBY,8BAA8B;IAH1C,GAAG,CAAC,wBAAwB,CAAC,uBAAuB,CAAC;IACrD,YAAY,CAAC,iBAAiB,CAAC;IAC/B,UAAU,EAAE;IAGJ,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;IAC7B,WAAA,MAAM,CAAC,iCAAiC,CAAC,CAAA;;GAHrC,8BAA8B,CAqB1C;SArBY,8BAA8B"}
@@ -1,4 +1,5 @@
1
1
  import { ModuleInterface } from "@pristine-ts/common";
2
+ export * from "./http.module.keyname";
2
3
  export * from "./clients/clients";
3
4
  export * from "./enums/enums";
4
5
  export * from "./errors/errors";
@@ -10,7 +10,8 @@ import { HttpErrorResponseInterceptorInterface } from "../interfaces/http-error-
10
10
  */
11
11
  export declare class HttpErrorResponseLoggingInterceptor implements HttpErrorResponseInterceptorInterface {
12
12
  private readonly logHandler;
13
- constructor(logHandler: LogHandlerInterface);
13
+ private readonly loggingEnabled;
14
+ constructor(logHandler: LogHandlerInterface, loggingEnabled: boolean);
14
15
  /**
15
16
  * This method intercepts an incoming http response that has an error and logs it.
16
17
  * @param request
@@ -9,7 +9,8 @@ import { LogHandlerInterface } from "@pristine-ts/logging";
9
9
  */
10
10
  export declare class HttpRequestLoggingInterceptor implements HttpRequestInterceptorInterface {
11
11
  private readonly logHandler;
12
- constructor(logHandler: LogHandlerInterface);
12
+ private readonly loggingEnabled;
13
+ constructor(logHandler: LogHandlerInterface, loggingEnabled: boolean);
13
14
  /**
14
15
  * This method intercepts an outgoing http request and logs it.
15
16
  * @param request
@@ -10,7 +10,8 @@ import { HttpResponseInterface } from "../interfaces/http-response.interface";
10
10
  */
11
11
  export declare class HttpResponseLoggingInterceptor implements HttpResponseInterceptorInterface {
12
12
  private readonly logHandler;
13
- constructor(logHandler: LogHandlerInterface);
13
+ private readonly loggingEnabled;
14
+ constructor(logHandler: LogHandlerInterface, loggingEnabled: boolean);
14
15
  /**
15
16
  * This method intercepts an incoming http response and logs it.
16
17
  * @param request
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pristine-ts/http",
3
- "version": "0.0.232",
3
+ "version": "0.0.234",
4
4
  "description": "",
5
5
  "module": "dist/lib/esm/http.module.js",
6
6
  "main": "dist/lib/cjs/http.module.js",
@@ -15,8 +15,8 @@
15
15
  "dist"
16
16
  ],
17
17
  "dependencies": {
18
- "@pristine-ts/common": "^0.0.232",
19
- "@pristine-ts/logging": "^0.0.232",
18
+ "@pristine-ts/common": "^0.0.234",
19
+ "@pristine-ts/logging": "^0.0.234",
20
20
  "lodash": "^4.17.21"
21
21
  },
22
22
  "author": "",
@@ -58,5 +58,5 @@
58
58
  "src/*.{js,ts}"
59
59
  ]
60
60
  },
61
- "gitHead": "44958cfc3f2a25734efe80fa9de250e58cd7660d"
61
+ "gitHead": "4d705f7b75eb75bd649699fb6cfd23c357916779"
62
62
  }