@thzero/library_server_fastify 0.18.11 → 0.18.13

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/routes/plans.js CHANGED
@@ -1,40 +1,40 @@
1
- import LibraryCommonnConstants from '@thzero/library_common/constants.js';
2
- import LibraryServerConstants from '@thzero/library_server/constants.js';
3
-
4
- import BaseRoute from './index.js';
5
-
6
- class PlansRoute extends BaseRoute {
7
- constructor(prefix) {
8
- super(prefix ? prefix : '/plans');
9
-
10
- // this._servicePlans = null;
11
- }
12
-
13
- async init(injector, app, config) {
14
- await super.init(injector, app, config);
15
- // this._servicePlans = injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_PLANS);
16
- this._inject(app, injector, LibraryServerConstants.InjectorKeys.SERVICE_PLANS, LibraryServerConstants.InjectorKeys.SERVICE_PLANS);
17
- }
18
-
19
- get id() {
20
- return 'plans';
21
- }
22
-
23
- _initializeRoutes(router) {
24
- router.get(this._join(''),
25
- // eslint-disable-next-line
26
- async (request, reply) => {
27
- // const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_PLANS);
28
- const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_PLANS].listing(request.correlationId, request.body)).check(request);
29
- // https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
30
- return this._jsonResponse(reply, response);
31
- }
32
- );
33
- }
34
-
35
- get _version() {
36
- return 'v1';
37
- }
38
- }
39
-
40
- export default PlansRoute;
1
+ import LibraryCommonnConstants from '@thzero/library_common/constants.js';
2
+ import LibraryServerConstants from '@thzero/library_server/constants.js';
3
+
4
+ import BaseRoute from './index.js';
5
+
6
+ class PlansRoute extends BaseRoute {
7
+ constructor(prefix) {
8
+ super(prefix ? prefix : '/plans');
9
+
10
+ // this._servicePlans = null;
11
+ }
12
+
13
+ async init(injector, app, config) {
14
+ await super.init(injector, app, config);
15
+ // this._servicePlans = injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_PLANS);
16
+ this._inject(app, injector, LibraryServerConstants.InjectorKeys.SERVICE_PLANS, LibraryServerConstants.InjectorKeys.SERVICE_PLANS);
17
+ }
18
+
19
+ get id() {
20
+ return 'plans';
21
+ }
22
+
23
+ _initializeRoutes(router) {
24
+ router.get(this._join(''),
25
+ // eslint-disable-next-line
26
+ async (request, reply) => {
27
+ // const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_PLANS);
28
+ const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_PLANS].listing(request.correlationId, request.body)).check(request);
29
+ // https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
30
+ return this._jsonResponse(reply, response);
31
+ }
32
+ );
33
+ }
34
+
35
+ get _version() {
36
+ return 'v1';
37
+ }
38
+ }
39
+
40
+ export default PlansRoute;
@@ -1,39 +1,39 @@
1
- import LibraryServerConstants from '@thzero/library_server/constants.js';
2
-
3
- import BaseRoute from '@thzero/library_server_fastify/routes/index.js';
4
-
5
- class UsageMetricsRoute extends BaseRoute {
6
- constructor(prefix) {
7
- super(prefix ? prefix : '');
8
- }
9
-
10
- async init(injector, app, config) {
11
- await super.init(injector, app, config);
12
-
13
- this._inject(app, injector, LibraryServerConstants.InjectorKeys.SERVICE_USAGE_METRIC, LibraryServerConstants.InjectorKeys.SERVICE_USAGE_METRIC);
14
- }
15
-
16
- _initializeRoutes(router) {
17
- super._initializeRoutes(router);
18
-
19
- router.post(this._join('/usageMetrics/listing'),
20
- // eslint-disable-next-line
21
- async (request, reply) => {
22
- const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_USAGE_METRIC].listing(request.correlationId, request.user, request.body)).check(request);
23
- // https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
24
- return this._jsonResponse(reply, response);
25
- }
26
- );
27
-
28
- router.post(this._join('/usageMetrics/tag'),
29
- // eslint-disable-next-line
30
- async (request, reply) => {
31
- const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_USAGE_METRIC].tag(request.correlationId, request.user, request.body)).check(request);
32
- // https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
33
- return this._jsonResponse(reply, response);
34
- }
35
- );
36
- }
37
- }
38
-
39
- export default UsageMetricsRoute;
1
+ import LibraryServerConstants from '@thzero/library_server/constants.js';
2
+
3
+ import BaseRoute from '@thzero/library_server_fastify/routes/index.js';
4
+
5
+ class UsageMetricsRoute extends BaseRoute {
6
+ constructor(prefix) {
7
+ super(prefix ? prefix : '');
8
+ }
9
+
10
+ async init(injector, app, config) {
11
+ await super.init(injector, app, config);
12
+
13
+ this._inject(app, injector, LibraryServerConstants.InjectorKeys.SERVICE_USAGE_METRIC, LibraryServerConstants.InjectorKeys.SERVICE_USAGE_METRIC);
14
+ }
15
+
16
+ _initializeRoutes(router) {
17
+ super._initializeRoutes(router);
18
+
19
+ router.post(this._join('/usageMetrics/listing'),
20
+ // eslint-disable-next-line
21
+ async (request, reply) => {
22
+ const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_USAGE_METRIC].listing(request.correlationId, request.user, request.body)).check(request);
23
+ // https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
24
+ return this._jsonResponse(reply, response);
25
+ }
26
+ );
27
+
28
+ router.post(this._join('/usageMetrics/tag'),
29
+ // eslint-disable-next-line
30
+ async (request, reply) => {
31
+ const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_USAGE_METRIC].tag(request.correlationId, request.user, request.body)).check(request);
32
+ // https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
33
+ return this._jsonResponse(reply, response);
34
+ }
35
+ );
36
+ }
37
+ }
38
+
39
+ export default UsageMetricsRoute;
package/routes/users.js CHANGED
@@ -1,6 +1,6 @@
1
- import BaseUsersRoute from './baseUsers.js';
2
-
3
- class UsersRoute extends BaseUsersRoute {
4
- }
5
-
6
- export default UsersRoute;
1
+ import BaseUsersRoute from './baseUsers.js';
2
+
3
+ class UsersRoute extends BaseUsersRoute {
4
+ }
5
+
6
+ export default UsersRoute;
package/routes/utility.js CHANGED
@@ -1,80 +1,80 @@
1
- import LibraryCommonServiceConstants from '@thzero/library_common_service/constants.js';
2
- import LibraryServerConstants from '@thzero/library_server/constants.js';
3
-
4
- import BaseRoute from './index.js';
5
-
6
- class UtilityRoute extends BaseRoute {
7
- constructor(prefix) {
8
- super(prefix ? prefix : '/utility');
9
-
10
- this._loggerRequiresAuth = false;
11
- // this._serviceUtility = null;
12
- }
13
-
14
- async init(injector, app, config) {
15
- await super.init(injector, app, config);
16
-
17
- const serviceConfig = injector.getService(LibraryCommonServiceConstants.InjectorKeys.SERVICE_CONFIG);
18
- // this._serviceUtility = injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_UTILITY);
19
- this._inject(app, injector, LibraryServerConstants.InjectorKeys.SERVICE_UTILITY, LibraryServerConstants.InjectorKeys.SERVICE_UTILITY);
20
-
21
- const auth = serviceConfig.get('auth');
22
- if (auth) {
23
- const temp = auth.logger && auth.logger.external.required && auth.logger.external.required ? auth.logger.external.required : false;
24
- this._loggerRequiresAuth = temp;
25
- }
26
- }
27
-
28
- get id() {
29
- return 'utility';
30
- }
31
-
32
- _initializeRoutes(router) {
33
- router.get(this._join('/initialize'),
34
- // eslint-disable-next-line
35
- async (request, reply) => {
36
- const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_UTILITY].initialize(request.correlationId)).check(request);
37
- // https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
38
- return this._jsonResponse(reply, response);
39
- }
40
- );
41
-
42
- router.post(this._join('/logger'),
43
- // authentication(false),
44
- // // authorization('utility'),
45
- this._loggerRequiresAuth ? {
46
- preHandler: router.auth([
47
- router.authenticationDefault,
48
- // router.authorizationDefault
49
- ],
50
- {
51
- relation: LibraryCommonnConstants.Security.logicalAnd,
52
- required: false,
53
- roles: [ 'utility' ]
54
- }),
55
- } : {},
56
- // eslint-disable-next-line
57
- async (request, reply) => {
58
- // const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_UTILITY);
59
- const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_UTILITY].logger(request.correlationId, request.body)).check(request);
60
- // https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
61
- return this._jsonResponse(reply, response);
62
- }
63
- );
64
-
65
- router.get(this._join('/openSource'),
66
- // eslint-disable-next-line
67
- async (request, reply) => {
68
- const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_UTILITY].openSource(request.correlationId)).check(request);
69
- // https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
70
- return this._jsonResponse(reply, response);
71
- }
72
- );
73
- }
74
-
75
- get _version() {
76
- return 'v1';
77
- }
78
- }
79
-
80
- export default UtilityRoute;
1
+ import LibraryCommonServiceConstants from '@thzero/library_common_service/constants.js';
2
+ import LibraryServerConstants from '@thzero/library_server/constants.js';
3
+
4
+ import BaseRoute from './index.js';
5
+
6
+ class UtilityRoute extends BaseRoute {
7
+ constructor(prefix) {
8
+ super(prefix ? prefix : '/utility');
9
+
10
+ this._loggerRequiresAuth = false;
11
+ // this._serviceUtility = null;
12
+ }
13
+
14
+ async init(injector, app, config) {
15
+ await super.init(injector, app, config);
16
+
17
+ const serviceConfig = injector.getService(LibraryCommonServiceConstants.InjectorKeys.SERVICE_CONFIG);
18
+ // this._serviceUtility = injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_UTILITY);
19
+ this._inject(app, injector, LibraryServerConstants.InjectorKeys.SERVICE_UTILITY, LibraryServerConstants.InjectorKeys.SERVICE_UTILITY);
20
+
21
+ const auth = serviceConfig.get('auth');
22
+ if (auth) {
23
+ const temp = auth.logger && auth.logger.external.required && auth.logger.external.required ? auth.logger.external.required : false;
24
+ this._loggerRequiresAuth = temp;
25
+ }
26
+ }
27
+
28
+ get id() {
29
+ return 'utility';
30
+ }
31
+
32
+ _initializeRoutes(router) {
33
+ router.get(this._join('/initialize'),
34
+ // eslint-disable-next-line
35
+ async (request, reply) => {
36
+ const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_UTILITY].initialize(request.correlationId)).check(request);
37
+ // https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
38
+ return this._jsonResponse(reply, response);
39
+ }
40
+ );
41
+
42
+ router.post(this._join('/logger'),
43
+ // authentication(false),
44
+ // // authorization('utility'),
45
+ this._loggerRequiresAuth ? {
46
+ preHandler: router.auth([
47
+ router.authenticationDefault,
48
+ // router.authorizationDefault
49
+ ],
50
+ {
51
+ relation: LibraryCommonnConstants.Security.logicalAnd,
52
+ required: false,
53
+ roles: [ 'utility' ]
54
+ }),
55
+ } : {},
56
+ // eslint-disable-next-line
57
+ async (request, reply) => {
58
+ // const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_UTILITY);
59
+ const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_UTILITY].logger(request.correlationId, request.body)).check(request);
60
+ // https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
61
+ return this._jsonResponse(reply, response);
62
+ }
63
+ );
64
+
65
+ router.get(this._join('/openSource'),
66
+ // eslint-disable-next-line
67
+ async (request, reply) => {
68
+ const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_UTILITY].openSource(request.correlationId)).check(request);
69
+ // https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
70
+ return this._jsonResponse(reply, response);
71
+ }
72
+ );
73
+ }
74
+
75
+ get _version() {
76
+ return 'v1';
77
+ }
78
+ }
79
+
80
+ export default UtilityRoute;
package/routes/version.js CHANGED
@@ -1,39 +1,39 @@
1
- import LibraryServerConstants from '@thzero/library_server/constants.js';
2
-
3
- import BaseRoute from './index.js';
4
-
5
- class VersionRoute extends BaseRoute {
6
- constructor(prefix) {
7
- super(prefix ? prefix : '');
8
-
9
- // this._serviceVersion = null;
10
- }
11
-
12
- async init(injector, app, config) {
13
- await super.init(injector, app, config);
14
- // this._serviceVersion = injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_VERSION);
15
- this._inject(app, injector, LibraryServerConstants.InjectorKeys.SERVICE_VERSION, LibraryServerConstants.InjectorKeys.SERVICE_VERSION);
16
- }
17
-
18
- get id() {
19
- return 'version';
20
- }
21
-
22
- _initializeRoutes(router) {
23
- router.get(this._join('/version'),
24
- // eslint-disable-next-line
25
- async (request, reply) => {
26
- // const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_VERSION);
27
- const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_VERSION].version(request.correlationId)).check(request);
28
- // https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
29
- return this._jsonResponse(reply, response);
30
- }
31
- );
32
- }
33
-
34
- get _version() {
35
- return 'v1';
36
- }
37
- }
38
-
39
- export default VersionRoute;
1
+ import LibraryServerConstants from '@thzero/library_server/constants.js';
2
+
3
+ import BaseRoute from './index.js';
4
+
5
+ class VersionRoute extends BaseRoute {
6
+ constructor(prefix) {
7
+ super(prefix ? prefix : '');
8
+
9
+ // this._serviceVersion = null;
10
+ }
11
+
12
+ async init(injector, app, config) {
13
+ await super.init(injector, app, config);
14
+ // this._serviceVersion = injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_VERSION);
15
+ this._inject(app, injector, LibraryServerConstants.InjectorKeys.SERVICE_VERSION, LibraryServerConstants.InjectorKeys.SERVICE_VERSION);
16
+ }
17
+
18
+ get id() {
19
+ return 'version';
20
+ }
21
+
22
+ _initializeRoutes(router) {
23
+ router.get(this._join('/version'),
24
+ // eslint-disable-next-line
25
+ async (request, reply) => {
26
+ // const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_VERSION);
27
+ const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_VERSION].version(request.correlationId)).check(request);
28
+ // https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
29
+ return this._jsonResponse(reply, response);
30
+ }
31
+ );
32
+ }
33
+
34
+ get _version() {
35
+ return 'v1';
36
+ }
37
+ }
38
+
39
+ export default VersionRoute;