@thzero/library_server 0.17.21 → 0.17.23
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/boot/index.js +7 -1
- package/package.json +3 -3
- package/service/health.js +13 -0
- package/service/usageMetrics.js +2 -2
- package/service/utility.js +3 -3
package/boot/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import LibraryServerConstants from '../constants.js';
|
|
|
8
8
|
import LibraryCommonServiceConstants from '@thzero/library_common_service/constants.js';
|
|
9
9
|
|
|
10
10
|
import LibraryCommonUtility from '@thzero/library_common/utility/index.js';
|
|
11
|
+
import LibraryMomentUtility from '@thzero/library_common/utility/moment.js';
|
|
11
12
|
|
|
12
13
|
import NotImplementedError from '@thzero/library_common/errors/notImplemented.js';
|
|
13
14
|
|
|
@@ -46,6 +47,7 @@ import injector from '@thzero/library_common/utility/injector.js';
|
|
|
46
47
|
import usageMetricsRepository from '../repository/usageMetrics/devnull.js';
|
|
47
48
|
|
|
48
49
|
import configService from '../service/config.js';
|
|
50
|
+
import healthService from '../service/health.js';
|
|
49
51
|
import loggerService from '@thzero/library_common_service/service/logger.js';
|
|
50
52
|
import usageMetricsService from '../service/usageMetrics.js';
|
|
51
53
|
|
|
@@ -300,7 +302,7 @@ class BootMain {
|
|
|
300
302
|
this._servicesPost.set(key, value);
|
|
301
303
|
}
|
|
302
304
|
|
|
303
|
-
|
|
305
|
+
LibraryMomentUtility.initDateTime();
|
|
304
306
|
}
|
|
305
307
|
finally {
|
|
306
308
|
this._repositories = null;
|
|
@@ -358,6 +360,10 @@ class BootMain {
|
|
|
358
360
|
return null;
|
|
359
361
|
}
|
|
360
362
|
|
|
363
|
+
_initServicesHealth() {
|
|
364
|
+
return new healthService();
|
|
365
|
+
}
|
|
366
|
+
|
|
361
367
|
_initServicesLogger() {
|
|
362
368
|
return new loggerService();
|
|
363
369
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thzero/library_server",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.17.
|
|
4
|
+
"version": "0.17.23",
|
|
5
5
|
"version_major": 0,
|
|
6
6
|
"version_minor": 17,
|
|
7
|
-
"version_patch":
|
|
8
|
-
"version_date": "01/
|
|
7
|
+
"version_patch": 23,
|
|
8
|
+
"version_date": "01/23/2024",
|
|
9
9
|
"description": "An opinionated library of common functionality to bootstrap an API using either Fastify or Koa as the web server.",
|
|
10
10
|
"author": "thZero",
|
|
11
11
|
"license": "MIT",
|
package/service/usageMetrics.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import LibraryServerConstants from '../constants.js';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import LibraryMomentUtility from '@thzero/library_common/utility/moment.js';
|
|
4
4
|
|
|
5
5
|
import Service from './index.js';
|
|
6
6
|
|
|
@@ -32,7 +32,7 @@ class UsageMetricsService extends Service {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
usageMetrics.date = new Date(new Date(
|
|
35
|
+
usageMetrics.date = new Date(new Date(LibraryMomentUtility.getTimestamp()).toISOString());
|
|
36
36
|
|
|
37
37
|
await this._repositoryUsageMetrics.register(usageMetrics);
|
|
38
38
|
return this._success(usageMetrics.correlationId);
|
package/service/utility.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Mutex as asyncMutex } from 'async-mutex';
|
|
|
4
4
|
|
|
5
5
|
import LibraryServerConstants from '@thzero/library_server/constants.js';
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import LibraryMomentUtility from '@thzero/library_common/utility/moment.js';
|
|
8
8
|
|
|
9
9
|
import Service from './index.js';
|
|
10
10
|
|
|
@@ -35,7 +35,7 @@ class UtilityService extends Service {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
async initialize(correlationId) {
|
|
38
|
-
const now =
|
|
38
|
+
const now = LibraryMomentUtility.getTimestamp();
|
|
39
39
|
const ttlInitialize = this._ttlInitialize ? this._ttlInitialize : 0;
|
|
40
40
|
const delta = now - ttlInitialize;
|
|
41
41
|
if (this._initializeResponse && (delta <= this._ttlInitializeDiff))
|
|
@@ -63,7 +63,7 @@ class UtilityService extends Service {
|
|
|
63
63
|
|
|
64
64
|
await this._intialize(correlationId, response);
|
|
65
65
|
|
|
66
|
-
this._ttlInitialize =
|
|
66
|
+
this._ttlInitialize = LibraryMomentUtility.getTimestamp();
|
|
67
67
|
this._initializeResponse = response;
|
|
68
68
|
return response;
|
|
69
69
|
}
|