@thzero/library_server_fastify 0.16.12 → 0.16.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/README.md +17 -17
- package/boot/index.js +367 -367
- package/boot/plugins/admin/news.js +11 -11
- package/boot/plugins/admin/users.js +11 -11
- package/boot/plugins/api.js +16 -16
- package/boot/plugins/apiFront.js +21 -21
- package/boot/plugins/news.js +11 -11
- package/boot/plugins/users.js +11 -11
- package/boot/plugins/usersExtended.js +6 -6
- package/license.md +8 -8
- package/middleware/authentication.js +94 -94
- package/middleware/authorization.js +220 -220
- package/openSource.js +80 -80
- package/package.json +41 -41
- package/plugins/apiKey.js +48 -48
- package/plugins/auth.js +124 -124
- package/plugins/responseTime.js +111 -111
- package/plugins/settings.js +12 -12
- package/plugins/usageMetrics.js +24 -24
- package/routes/admin/index.js +140 -140
- package/routes/admin/news.js +22 -22
- package/routes/admin/users.js +26 -26
- package/routes/baseNews.js +45 -45
- package/routes/baseUsers.js +153 -153
- package/routes/home.js +28 -28
- package/routes/index.js +41 -41
- package/routes/news.js +6 -6
- package/routes/plans.js +39 -39
- package/routes/users.js +6 -6
- package/routes/utility.js +70 -70
- package/routes/version.js +39 -39
package/routes/utility.js
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import LibraryConstants from '@thzero/library_server/constants.js';
|
|
2
|
-
|
|
3
|
-
import BaseRoute from './index.js';
|
|
4
|
-
|
|
5
|
-
class UtilityRoute extends BaseRoute {
|
|
6
|
-
constructor(prefix) {
|
|
7
|
-
super(prefix ? prefix : '/utility');
|
|
8
|
-
|
|
9
|
-
// this._serviceUtility = null;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async init(injector, app, config) {
|
|
13
|
-
await super.init(injector, app, config);
|
|
14
|
-
// this._serviceUtility = injector.getService(LibraryConstants.InjectorKeys.SERVICE_UTILITY);
|
|
15
|
-
this._inject(app, injector, LibraryConstants.InjectorKeys.SERVICE_UTILITY, LibraryConstants.InjectorKeys.SERVICE_UTILITY);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
get id() {
|
|
19
|
-
return 'utility';
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
_initializeRoutes(router) {
|
|
23
|
-
router.get(this._join('/initialize'),
|
|
24
|
-
// eslint-disable-next-line
|
|
25
|
-
async (request, reply) => {
|
|
26
|
-
const response = (await router[LibraryConstants.InjectorKeys.SERVICE_UTILITY].initialize(request.correlationId)).check(request);
|
|
27
|
-
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
28
|
-
return this._jsonResponse(reply, response);
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
router.post('/logger',
|
|
33
|
-
// authentication(false),
|
|
34
|
-
// // authorization('utility'),
|
|
35
|
-
{
|
|
36
|
-
preHandler: router.auth([
|
|
37
|
-
router.authenticationDefault,
|
|
38
|
-
// router.authorizationDefault
|
|
39
|
-
],
|
|
40
|
-
{
|
|
41
|
-
relation: 'and',
|
|
42
|
-
required: false,
|
|
43
|
-
roles: [ 'utility' ]
|
|
44
|
-
}),
|
|
45
|
-
},
|
|
46
|
-
// eslint-disable-next-line
|
|
47
|
-
async (request, reply) => {
|
|
48
|
-
// const service = this._injector.getService(LibraryConstants.InjectorKeys.SERVICE_UTILITY);
|
|
49
|
-
const response = (await router[LibraryConstants.InjectorKeys.SERVICE_UTILITY].logger(request.correlationId, request.body)).check(request);
|
|
50
|
-
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
51
|
-
return this._jsonResponse(reply, response);
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
router.get(this._join('/openSource'),
|
|
56
|
-
// eslint-disable-next-line
|
|
57
|
-
async (request, reply) => {
|
|
58
|
-
const response = (await router[LibraryConstants.InjectorKeys.SERVICE_UTILITY].openSource(request.correlationId)).check(request);
|
|
59
|
-
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
60
|
-
return this._jsonResponse(reply, response);
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
get _version() {
|
|
66
|
-
return 'v1';
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export default UtilityRoute;
|
|
1
|
+
import LibraryConstants from '@thzero/library_server/constants.js';
|
|
2
|
+
|
|
3
|
+
import BaseRoute from './index.js';
|
|
4
|
+
|
|
5
|
+
class UtilityRoute extends BaseRoute {
|
|
6
|
+
constructor(prefix) {
|
|
7
|
+
super(prefix ? prefix : '/utility');
|
|
8
|
+
|
|
9
|
+
// this._serviceUtility = null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async init(injector, app, config) {
|
|
13
|
+
await super.init(injector, app, config);
|
|
14
|
+
// this._serviceUtility = injector.getService(LibraryConstants.InjectorKeys.SERVICE_UTILITY);
|
|
15
|
+
this._inject(app, injector, LibraryConstants.InjectorKeys.SERVICE_UTILITY, LibraryConstants.InjectorKeys.SERVICE_UTILITY);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get id() {
|
|
19
|
+
return 'utility';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
_initializeRoutes(router) {
|
|
23
|
+
router.get(this._join('/initialize'),
|
|
24
|
+
// eslint-disable-next-line
|
|
25
|
+
async (request, reply) => {
|
|
26
|
+
const response = (await router[LibraryConstants.InjectorKeys.SERVICE_UTILITY].initialize(request.correlationId)).check(request);
|
|
27
|
+
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
28
|
+
return this._jsonResponse(reply, response);
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
router.post('/logger',
|
|
33
|
+
// authentication(false),
|
|
34
|
+
// // authorization('utility'),
|
|
35
|
+
{
|
|
36
|
+
preHandler: router.auth([
|
|
37
|
+
router.authenticationDefault,
|
|
38
|
+
// router.authorizationDefault
|
|
39
|
+
],
|
|
40
|
+
{
|
|
41
|
+
relation: 'and',
|
|
42
|
+
required: false,
|
|
43
|
+
roles: [ 'utility' ]
|
|
44
|
+
}),
|
|
45
|
+
},
|
|
46
|
+
// eslint-disable-next-line
|
|
47
|
+
async (request, reply) => {
|
|
48
|
+
// const service = this._injector.getService(LibraryConstants.InjectorKeys.SERVICE_UTILITY);
|
|
49
|
+
const response = (await router[LibraryConstants.InjectorKeys.SERVICE_UTILITY].logger(request.correlationId, request.body)).check(request);
|
|
50
|
+
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
51
|
+
return this._jsonResponse(reply, response);
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
router.get(this._join('/openSource'),
|
|
56
|
+
// eslint-disable-next-line
|
|
57
|
+
async (request, reply) => {
|
|
58
|
+
const response = (await router[LibraryConstants.InjectorKeys.SERVICE_UTILITY].openSource(request.correlationId)).check(request);
|
|
59
|
+
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
60
|
+
return this._jsonResponse(reply, response);
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get _version() {
|
|
66
|
+
return 'v1';
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default UtilityRoute;
|
package/routes/version.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import LibraryConstants 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(LibraryConstants.InjectorKeys.SERVICE_VERSION);
|
|
15
|
-
this._inject(app, injector, LibraryConstants.InjectorKeys.SERVICE_VERSION, LibraryConstants.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(LibraryConstants.InjectorKeys.SERVICE_VERSION);
|
|
27
|
-
const response = (await router[LibraryConstants.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 LibraryConstants 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(LibraryConstants.InjectorKeys.SERVICE_VERSION);
|
|
15
|
+
this._inject(app, injector, LibraryConstants.InjectorKeys.SERVICE_VERSION, LibraryConstants.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(LibraryConstants.InjectorKeys.SERVICE_VERSION);
|
|
27
|
+
const response = (await router[LibraryConstants.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;
|