@thzero/library_server_fastify 0.15.36 → 0.15.37

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.
@@ -12,6 +12,7 @@ class DefaultAuthenticationMiddleware {
12
12
  init(injector) {
13
13
  this._serviceAuth = injector.getService(LibraryConstants.InjectorKeys.SERVICE_AUTH);
14
14
  this._serviceLogger = injector.getService(LibraryCommonServiceConstants.InjectorKeys.SERVICE_LOGGER);
15
+ this._serviceUsageMetrics = injector.getService(LibraryConstants.InjectorKeys.SERVICE_USAGE_METRIC);
15
16
 
16
17
  return {
17
18
  callback: async (request, reply, done, options) => {
@@ -60,8 +61,7 @@ class DefaultAuthenticationMiddleware {
60
61
  querystring: request.query,
61
62
  token: request.token
62
63
  };
63
- const serviceUsageMetrics = request.server[LibraryConstants.InjectorKeys.SERVICE_USAGE_METRIC];
64
- await serviceUsageMetrics.register(usageMetrics).catch((err) => {
64
+ await this._serviceUsageMetrics.register(usageMetrics).catch((err) => {
65
65
  this._serviceLogger.error('middleware', 'authentication', err, null, request.correlationId);
66
66
  });
67
67
  })();
@@ -31,6 +31,7 @@ class DefaultAuthenticationMiddleware {
31
31
  this._serviceConfig = injector.getService(LibraryCommonServiceConstants.InjectorKeys.SERVICE_CONFIG);
32
32
  this._serviceLogger = injector.getService(LibraryCommonServiceConstants.InjectorKeys.SERVICE_LOGGER);
33
33
  this._serviceSecurity = injector.getService(LibraryConstants.InjectorKeys.SERVICE_SECURITY);
34
+ this._serviceUsageMetrics = injector.getService(LibraryConstants.InjectorKeys.SERVICE_USAGE_METRIC);
34
35
 
35
36
  return {
36
37
  callback: async (request, reply, done, options) => {
@@ -107,8 +108,7 @@ class DefaultAuthenticationMiddleware {
107
108
  querystring: request.query,
108
109
  token: request.token
109
110
  };
110
- const serviceUsageMetrics = request.server[LibraryConstants.InjectorKeys.SERVICE_USAGE_METRIC];
111
- await serviceUsageMetrics.register(usageMetrics).catch((err) => {
111
+ await this._serviceUsageMetrics.register(usageMetrics).catch((err) => {
112
112
  this._serviceLogger.error('middleware', 'authorization', err, null, request.correlationId);
113
113
  });
114
114
  })();
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@thzero/library_server_fastify",
3
3
  "type": "module",
4
- "version": "0.15.36",
4
+ "version": "0.15.37",
5
5
  "version_major": 0,
6
6
  "version_minor": 15,
7
- "version_patch": 36,
8
- "version_date": "04/22/2022",
7
+ "version_patch": 37,
8
+ "version_date": "04/24/2022",
9
9
  "description": "An opinionated library of common functionality to bootstrap a Fastify based API application.",
10
10
  "author": "thZero",
11
11
  "license": "MIT",