jimpex 7.0.1 → 8.0.0
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/CHANGELOG.md +87 -0
- package/LICENSE +1 -1
- package/README.md +446 -434
- package/dist/app/index.d.ts +13 -0
- package/dist/app/index.js +19 -0
- package/dist/app/index.js.map +1 -0
- package/dist/app/jimpex.d.ts +13 -0
- package/dist/app/jimpex.js +440 -0
- package/dist/app/jimpex.js.map +1 -0
- package/dist/controllers/common/config.d.ts +78 -0
- package/dist/controllers/common/config.js +89 -0
- package/dist/controllers/common/config.js.map +1 -0
- package/dist/controllers/common/health.d.ts +82 -0
- package/dist/controllers/common/health.js +97 -0
- package/dist/controllers/common/health.js.map +1 -0
- package/dist/controllers/common/index.d.ts +21 -0
- package/dist/controllers/common/index.js +21 -0
- package/dist/controllers/common/index.js.map +1 -0
- package/dist/controllers/common/statics.d.ts +215 -0
- package/dist/controllers/common/statics.js +202 -0
- package/dist/controllers/common/statics.js.map +1 -0
- package/dist/controllers/index.d.ts +24 -0
- package/dist/controllers/index.js +20 -0
- package/dist/controllers/index.js.map +1 -0
- package/dist/controllers/utils/gateway.d.ts +724 -0
- package/dist/controllers/utils/gateway.js +425 -0
- package/dist/controllers/utils/gateway.js.map +1 -0
- package/dist/controllers/utils/index.d.ts +16 -0
- package/dist/controllers/utils/index.js +19 -0
- package/dist/controllers/utils/index.js.map +1 -0
- package/dist/esm/app/index.js +2 -0
- package/dist/esm/app/index.js.map +1 -0
- package/dist/esm/app/jimpex.js +415 -0
- package/dist/esm/app/jimpex.js.map +1 -0
- package/dist/esm/chunk-T2T6Q22Z.js +11 -0
- package/dist/esm/chunk-T2T6Q22Z.js.map +1 -0
- package/dist/esm/controllers/common/config.js +62 -0
- package/dist/esm/controllers/common/config.js.map +1 -0
- package/dist/esm/controllers/common/health.js +70 -0
- package/dist/esm/controllers/common/health.js.map +1 -0
- package/dist/esm/controllers/common/index.js +4 -0
- package/dist/esm/controllers/common/index.js.map +1 -0
- package/dist/esm/controllers/common/statics.js +173 -0
- package/dist/esm/controllers/common/statics.js.map +1 -0
- package/dist/esm/controllers/index.js +3 -0
- package/dist/esm/controllers/index.js.map +1 -0
- package/dist/esm/controllers/utils/gateway.js +404 -0
- package/dist/esm/controllers/utils/gateway.js.map +1 -0
- package/dist/esm/controllers/utils/index.js +2 -0
- package/dist/esm/controllers/utils/index.js.map +1 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/middlewares/common/errorHandler.js +92 -0
- package/dist/esm/middlewares/common/errorHandler.js.map +1 -0
- package/dist/esm/middlewares/common/forceHTTPS.js +41 -0
- package/dist/esm/middlewares/common/forceHTTPS.js.map +1 -0
- package/dist/esm/middlewares/common/hsts.js +53 -0
- package/dist/esm/middlewares/common/hsts.js.map +1 -0
- package/dist/esm/middlewares/common/index.js +4 -0
- package/dist/esm/middlewares/common/index.js.map +1 -0
- package/dist/esm/middlewares/html/fastHTML.js +104 -0
- package/dist/esm/middlewares/html/fastHTML.js.map +1 -0
- package/dist/esm/middlewares/html/index.js +3 -0
- package/dist/esm/middlewares/html/index.js.map +1 -0
- package/dist/esm/middlewares/html/showHTML.js +68 -0
- package/dist/esm/middlewares/html/showHTML.js.map +1 -0
- package/dist/esm/middlewares/index.js +4 -0
- package/dist/esm/middlewares/index.js.map +1 -0
- package/dist/esm/middlewares/utils/index.js +2 -0
- package/dist/esm/middlewares/utils/index.js.map +1 -0
- package/dist/esm/middlewares/utils/versionValidator.js +101 -0
- package/dist/esm/middlewares/utils/versionValidator.js.map +1 -0
- package/dist/esm/services/common/appError.js +52 -0
- package/dist/esm/services/common/appError.js.map +1 -0
- package/dist/esm/services/common/httpError.js +19 -0
- package/dist/esm/services/common/httpError.js.map +1 -0
- package/dist/esm/services/common/index.js +17 -0
- package/dist/esm/services/common/index.js.map +1 -0
- package/dist/esm/services/common/sendFile.js +27 -0
- package/dist/esm/services/common/sendFile.js.map +1 -0
- package/dist/esm/services/frontend/frontendFs.js +38 -0
- package/dist/esm/services/frontend/frontendFs.js.map +1 -0
- package/dist/esm/services/frontend/index.js +11 -0
- package/dist/esm/services/frontend/index.js.map +1 -0
- package/dist/esm/services/html/htmlGenerator.js +144 -0
- package/dist/esm/services/html/htmlGenerator.js.map +1 -0
- package/dist/esm/services/html/index.js +11 -0
- package/dist/esm/services/html/index.js.map +1 -0
- package/dist/esm/services/http/apiClient.js +71 -0
- package/dist/esm/services/http/apiClient.js.map +1 -0
- package/dist/esm/services/http/http.js +125 -0
- package/dist/esm/services/http/http.js.map +1 -0
- package/dist/esm/services/http/index.js +17 -0
- package/dist/esm/services/http/index.js.map +1 -0
- package/dist/esm/services/http/responsesBuilder.js +105 -0
- package/dist/esm/services/http/responsesBuilder.js.map +1 -0
- package/dist/esm/services/index.js +6 -0
- package/dist/esm/services/index.js.map +1 -0
- package/dist/esm/services/utils/ensureBearerToken.js +78 -0
- package/dist/esm/services/utils/ensureBearerToken.js.map +1 -0
- package/dist/esm/services/utils/index.js +11 -0
- package/dist/esm/services/utils/index.js.map +1 -0
- package/dist/esm/types/events.js +1 -0
- package/dist/esm/types/events.js.map +1 -0
- package/dist/esm/types/express.js +1 -0
- package/dist/esm/types/express.js.map +1 -0
- package/dist/esm/types/http.js +1 -0
- package/dist/esm/types/http.js.map +1 -0
- package/dist/esm/types/index.js +7 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/types/options.js +1 -0
- package/dist/esm/types/options.js.map +1 -0
- package/dist/esm/types/utils.js +1 -0
- package/dist/esm/types/utils.js.map +1 -0
- package/dist/esm/types/wootils.js +1 -0
- package/dist/esm/types/wootils.js.map +1 -0
- package/dist/esm/utils/fns/index.js +5 -0
- package/dist/esm/utils/fns/index.js.map +1 -0
- package/dist/esm/utils/fns/others.js +6 -0
- package/dist/esm/utils/fns/others.js.map +1 -0
- package/dist/esm/utils/fns/routes.js +25 -0
- package/dist/esm/utils/fns/routes.js.map +1 -0
- package/dist/esm/utils/fns/statuses.js +6 -0
- package/dist/esm/utils/fns/statuses.js.map +1 -0
- package/dist/esm/utils/fns/text.js +6 -0
- package/dist/esm/utils/fns/text.js.map +1 -0
- package/dist/esm/utils/index.js +3 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/wrappers.js +41 -0
- package/dist/esm/utils/wrappers.js.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/jimpex-7eaee271.d.ts +1278 -0
- package/dist/middlewares/common/errorHandler.d.ts +131 -0
- package/dist/middlewares/common/errorHandler.js +119 -0
- package/dist/middlewares/common/errorHandler.js.map +1 -0
- package/dist/middlewares/common/forceHTTPS.d.ts +68 -0
- package/dist/middlewares/common/forceHTTPS.js +68 -0
- package/dist/middlewares/common/forceHTTPS.js.map +1 -0
- package/dist/middlewares/common/hsts.d.ts +109 -0
- package/dist/middlewares/common/hsts.js +80 -0
- package/dist/middlewares/common/hsts.js.map +1 -0
- package/dist/middlewares/common/index.d.ts +21 -0
- package/dist/middlewares/common/index.js +21 -0
- package/dist/middlewares/common/index.js.map +1 -0
- package/dist/middlewares/html/fastHTML.d.ts +180 -0
- package/dist/middlewares/html/fastHTML.js +131 -0
- package/dist/middlewares/html/fastHTML.js.map +1 -0
- package/dist/middlewares/html/index.d.ts +21 -0
- package/dist/middlewares/html/index.js +20 -0
- package/dist/middlewares/html/index.js.map +1 -0
- package/dist/middlewares/html/showHTML.d.ts +127 -0
- package/dist/middlewares/html/showHTML.js +95 -0
- package/dist/middlewares/html/showHTML.js.map +1 -0
- package/dist/middlewares/index.d.ts +30 -0
- package/dist/middlewares/index.js +21 -0
- package/dist/middlewares/index.js.map +1 -0
- package/dist/middlewares/utils/index.d.ts +19 -0
- package/dist/middlewares/utils/index.js +19 -0
- package/dist/middlewares/utils/index.js.map +1 -0
- package/dist/middlewares/utils/versionValidator.d.ts +214 -0
- package/dist/middlewares/utils/versionValidator.js +128 -0
- package/dist/middlewares/utils/versionValidator.js.map +1 -0
- package/dist/services/common/appError.d.ts +138 -0
- package/dist/services/common/appError.js +80 -0
- package/dist/services/common/appError.js.map +1 -0
- package/dist/services/common/httpError.d.ts +79 -0
- package/dist/services/common/httpError.js +44 -0
- package/dist/services/common/httpError.js.map +1 -0
- package/dist/services/common/index.d.ts +47 -0
- package/dist/services/common/index.js +41 -0
- package/dist/services/common/index.js.map +1 -0
- package/dist/services/common/sendFile.d.ts +102 -0
- package/dist/services/common/sendFile.js +51 -0
- package/dist/services/common/sendFile.js.map +1 -0
- package/dist/services/frontend/frontendFs.d.ts +96 -0
- package/dist/services/frontend/frontendFs.js +71 -0
- package/dist/services/frontend/frontendFs.js.map +1 -0
- package/dist/services/frontend/index.d.ts +40 -0
- package/dist/services/frontend/index.js +35 -0
- package/dist/services/frontend/index.js.map +1 -0
- package/dist/services/html/htmlGenerator.d.ts +237 -0
- package/dist/services/html/htmlGenerator.js +171 -0
- package/dist/services/html/htmlGenerator.js.map +1 -0
- package/dist/services/html/index.d.ts +43 -0
- package/dist/services/html/index.js +35 -0
- package/dist/services/html/index.js.map +1 -0
- package/dist/services/http/apiClient.d.ts +169 -0
- package/dist/services/http/apiClient.js +96 -0
- package/dist/services/http/apiClient.js.map +1 -0
- package/dist/services/http/http.d.ts +175 -0
- package/dist/services/http/http.js +158 -0
- package/dist/services/http/http.js.map +1 -0
- package/dist/services/http/index.d.ts +50 -0
- package/dist/services/http/index.js +41 -0
- package/dist/services/http/index.js.map +1 -0
- package/dist/services/http/responsesBuilder.d.ts +178 -0
- package/dist/services/http/responsesBuilder.js +132 -0
- package/dist/services/http/responsesBuilder.js.map +1 -0
- package/dist/services/index.d.ts +33 -0
- package/dist/services/index.js +23 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/utils/ensureBearerToken.d.ts +157 -0
- package/dist/services/utils/ensureBearerToken.js +105 -0
- package/dist/services/utils/ensureBearerToken.js.map +1 -0
- package/dist/services/utils/index.d.ts +43 -0
- package/dist/services/utils/index.js +35 -0
- package/dist/services/utils/index.js.map +1 -0
- package/dist/types/events.d.ts +13 -0
- package/dist/types/events.js +17 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/express.d.ts +10 -0
- package/dist/types/express.js +17 -0
- package/dist/types/express.js.map +1 -0
- package/dist/types/http.d.ts +79 -0
- package/dist/types/http.js +17 -0
- package/dist/types/http.js.map +1 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.js +24 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/options.d.ts +13 -0
- package/dist/types/options.js +17 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/utils.d.ts +48 -0
- package/dist/types/utils.js +17 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/types/wootils.d.ts +4 -0
- package/dist/types/wootils.js +17 -0
- package/dist/types/wootils.js.map +1 -0
- package/dist/utils/fns/index.d.ts +5 -0
- package/dist/utils/fns/index.js +22 -0
- package/dist/utils/fns/index.js.map +1 -0
- package/dist/utils/fns/others.d.ts +17 -0
- package/dist/utils/fns/others.js +29 -0
- package/dist/utils/fns/others.js.map +1 -0
- package/dist/utils/fns/routes.d.ts +39 -0
- package/dist/utils/fns/routes.js +51 -0
- package/dist/utils/fns/routes.js.map +1 -0
- package/dist/utils/fns/statuses.d.ts +45 -0
- package/dist/utils/fns/statuses.js +35 -0
- package/dist/utils/fns/statuses.js.map +1 -0
- package/dist/utils/fns/text.d.ts +9 -0
- package/dist/utils/fns/text.js +29 -0
- package/dist/utils/fns/text.js.map +1 -0
- package/dist/utils/index.d.ts +18 -0
- package/dist/utils/index.js +20 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/wrappers.d.ts +13 -0
- package/dist/utils/wrappers.js +68 -0
- package/dist/utils/wrappers.js.map +1 -0
- package/examples/basic/404.html +12 -0
- package/examples/basic/README.md +30 -0
- package/examples/basic/app.ts +18 -0
- package/examples/basic/controller.ts +45 -0
- package/examples/basic/index.ts +19 -0
- package/examples/basic/middleware.ts +13 -0
- package/examples/basic/service.ts +11 -0
- package/package.json +59 -38
- package/src/app/index.ts +1 -0
- package/src/app/jimpex.ts +743 -0
- package/src/controllers/common/config.ts +115 -0
- package/src/controllers/common/health.ts +128 -0
- package/src/controllers/common/index.ts +3 -0
- package/src/controllers/common/statics.ts +380 -0
- package/src/controllers/index.ts +2 -0
- package/src/controllers/utils/gateway.ts +1186 -0
- package/src/controllers/utils/index.ts +1 -0
- package/src/index.ts +6 -0
- package/src/middlewares/common/errorHandler.ts +203 -0
- package/src/middlewares/common/forceHTTPS.ts +83 -0
- package/src/middlewares/common/hsts.ts +135 -0
- package/src/middlewares/common/index.ts +3 -0
- package/src/middlewares/html/fastHTML.ts +255 -0
- package/src/middlewares/html/index.ts +2 -0
- package/src/middlewares/html/showHTML.ts +165 -0
- package/src/middlewares/index.ts +3 -0
- package/src/middlewares/utils/index.ts +1 -0
- package/src/middlewares/utils/versionValidator.ts +289 -0
- package/src/services/common/appError.ts +158 -0
- package/src/services/common/httpError.ts +74 -0
- package/src/services/common/index.ts +29 -0
- package/src/services/common/sendFile.ts +106 -0
- package/src/services/frontend/frontendFs.ts +101 -0
- package/src/services/frontend/index.ts +21 -0
- package/src/services/html/htmlGenerator.ts +356 -0
- package/src/services/html/index.ts +21 -0
- package/src/services/http/apiClient.ts +221 -0
- package/src/services/http/http.ts +286 -0
- package/src/services/http/index.ts +29 -0
- package/src/services/http/responsesBuilder.ts +265 -0
- package/src/services/index.ts +5 -0
- package/src/services/utils/ensureBearerToken.ts +202 -0
- package/src/services/utils/index.ts +21 -0
- package/src/types/events.ts +303 -0
- package/src/types/express.ts +21 -0
- package/src/types/http.ts +77 -0
- package/src/types/index.ts +6 -0
- package/src/types/options.ts +248 -0
- package/src/types/utils.ts +52 -0
- package/src/types/wootils.ts +4 -0
- package/src/utils/fns/index.ts +4 -0
- package/src/utils/fns/others.ts +15 -0
- package/src/utils/fns/routes.ts +64 -0
- package/src/utils/fns/statuses.ts +44 -0
- package/src/utils/fns/text.ts +8 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/wrappers.ts +537 -0
- package/tsconfig.json +5 -8
- package/tsup.config.ts +10 -0
- package/src/app/index.js +0 -692
- package/src/constants/eventNames.js +0 -48
- package/src/constants/index.js +0 -7
- package/src/controllers/common/configuration.js +0 -116
- package/src/controllers/common/health.js +0 -79
- package/src/controllers/common/index.js +0 -7
- package/src/controllers/common/statics.js +0 -336
- package/src/controllers/index.js +0 -9
- package/src/controllers/utils/gateway.js +0 -1039
- package/src/controllers/utils/index.js +0 -3
- package/src/index.js +0 -30
- package/src/middlewares/common/errorHandler.js +0 -185
- package/src/middlewares/common/forceHTTPS.js +0 -80
- package/src/middlewares/common/hsts.js +0 -122
- package/src/middlewares/common/index.js +0 -7
- package/src/middlewares/html/fastHTML.js +0 -298
- package/src/middlewares/html/index.js +0 -5
- package/src/middlewares/html/showHTML.js +0 -167
- package/src/middlewares/index.js +0 -11
- package/src/middlewares/utils/index.js +0 -3
- package/src/middlewares/utils/versionValidator.js +0 -261
- package/src/services/common/appError.js +0 -136
- package/src/services/common/httpError.js +0 -60
- package/src/services/common/index.js +0 -25
- package/src/services/common/sendFile.js +0 -68
- package/src/services/frontend/frontendFs.js +0 -85
- package/src/services/frontend/index.js +0 -17
- package/src/services/html/htmlGenerator.js +0 -391
- package/src/services/html/index.js +0 -17
- package/src/services/http/apiClient.js +0 -148
- package/src/services/http/http.js +0 -256
- package/src/services/http/index.js +0 -25
- package/src/services/http/responsesBuilder.js +0 -193
- package/src/services/index.js +0 -15
- package/src/services/utils/ensureBearerToken.js +0 -147
- package/src/services/utils/index.js +0 -19
- package/src/types.js +0 -377
- package/src/utils/functions.js +0 -78
- package/src/utils/wrappers.js +0 -131
- package/types/app/index.d.ts +0 -417
- package/types/constants/eventNames.d.ts +0 -93
- package/types/constants/index.d.ts +0 -2
- package/types/controllers/common/configuration.d.ts +0 -71
- package/types/controllers/common/health.d.ts +0 -55
- package/types/controllers/common/index.d.ts +0 -4
- package/types/controllers/common/statics.d.ts +0 -271
- package/types/controllers/index.d.ts +0 -3
- package/types/controllers/utils/gateway.d.ts +0 -947
- package/types/controllers/utils/index.d.ts +0 -2
- package/types/index.d.ts +0 -15
- package/types/middlewares/common/errorHandler.d.ts +0 -143
- package/types/middlewares/common/forceHTTPS.d.ts +0 -64
- package/types/middlewares/common/hsts.d.ts +0 -111
- package/types/middlewares/common/index.d.ts +0 -4
- package/types/middlewares/html/fastHTML.d.ts +0 -238
- package/types/middlewares/html/index.d.ts +0 -3
- package/types/middlewares/html/showHTML.d.ts +0 -128
- package/types/middlewares/index.d.ts +0 -4
- package/types/middlewares/utils/index.d.ts +0 -2
- package/types/middlewares/utils/versionValidator.d.ts +0 -247
- package/types/services/common/appError.d.ts +0 -89
- package/types/services/common/httpError.d.ts +0 -37
- package/types/services/common/index.d.ts +0 -18
- package/types/services/common/sendFile.d.ts +0 -56
- package/types/services/frontend/frontendFs.d.ts +0 -72
- package/types/services/frontend/index.d.ts +0 -3
- package/types/services/html/htmlGenerator.d.ts +0 -298
- package/types/services/html/index.d.ts +0 -3
- package/types/services/http/apiClient.d.ts +0 -141
- package/types/services/http/http.d.ts +0 -159
- package/types/services/http/index.d.ts +0 -18
- package/types/services/http/responsesBuilder.d.ts +0 -140
- package/types/services/index.d.ts +0 -6
- package/types/services/utils/ensureBearerToken.d.ts +0 -137
- package/types/services/utils/index.d.ts +0 -16
- package/types/types.d.ts +0 -280
- package/types/utils/functions.d.ts +0 -55
- package/types/utils/wrappers.d.ts +0 -127
|
@@ -1,391 +0,0 @@
|
|
|
1
|
-
const ObjectUtils = require('wootils/shared/objectUtils');
|
|
2
|
-
const { deferred } = require('wootils/shared');
|
|
3
|
-
const { eventNames } = require('../../constants');
|
|
4
|
-
const { providerCreator } = require('../../utils/wrappers');
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {import('../../types').AppConfiguration} AppConfiguration
|
|
7
|
-
* @typedef {import('../../types').Logger} Logger
|
|
8
|
-
* @typedef {import('../frontend/frontendFs').FrontendFs} FrontendFs
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @typedef {import('../../types').ProviderCreator<O>} ProviderCreator<O>
|
|
13
|
-
* @template O
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* The options to customize the an `HTMLGenerator` service.
|
|
18
|
-
*
|
|
19
|
-
* @typedef {Object} HTMLGeneratorOptions
|
|
20
|
-
* @property {string} template The name of the file it should use as
|
|
21
|
-
* template.
|
|
22
|
-
* Default `'index.tpl.html'`.
|
|
23
|
-
* @property {string} file The name of the generated file. Default
|
|
24
|
-
* `'index.html'`.
|
|
25
|
-
* @property {boolean} deleteTemplateAfter Whether or not to delete the tempalte after
|
|
26
|
-
* generating the file. Default `true`.
|
|
27
|
-
* @property {string} replacePlaceholder The placeholder string where the information
|
|
28
|
-
* will be written. Default
|
|
29
|
-
* `'{{appConfiguration}}'`.
|
|
30
|
-
* @property {RegExp} valuesExpression A regular expression for dynamic placeholders
|
|
31
|
-
* that will be replaced by values when the file
|
|
32
|
-
* is generated.
|
|
33
|
-
* Default `'{{(.*?)}}'`.
|
|
34
|
-
* @property {string} variable The name of the variable that will have the
|
|
35
|
-
* information on the file. Default
|
|
36
|
-
* `'appConfiguration'`.
|
|
37
|
-
* @property {string[]} configurationKeys A list of settings from the app configuration
|
|
38
|
-
* that will be used as the information to
|
|
39
|
-
* inject on the file.
|
|
40
|
-
* Default `['features', 'version',
|
|
41
|
-
* 'postMessagesPrefix']`.
|
|
42
|
-
* @parent module:services
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @typedef {HTMLGeneratorOptions & HTMLGeneratorProviderOptionsProperties} HTMLGeneratorProviderOptions
|
|
47
|
-
* @parent module:services
|
|
48
|
-
* @prettierignore
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @typedef {Object} HTMLGeneratorProviderOptionsProperties
|
|
53
|
-
* @property {string} [serviceName='htmlGenerator']
|
|
54
|
-
* The name that will be used to register the service on the app container. This is to
|
|
55
|
-
* allow multiple "instances" of the service to be created.
|
|
56
|
-
* @property {?string} [valuesService='htmlGeneratorValues']
|
|
57
|
-
* The name of a service that the generator will use in order to read the values that will
|
|
58
|
-
* be injected on the template. If the service is available, the values from
|
|
59
|
-
* `configurationKeys`
|
|
60
|
-
* will be ignored.
|
|
61
|
-
* @parent module:services
|
|
62
|
-
*/
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @callback HTMLGeneratorValuesServiceGetValues
|
|
66
|
-
* @returns {Promise<Object>}
|
|
67
|
-
* @parent module:services
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* A service to provide the information value to an `HTMLGenerator` service to use on the
|
|
72
|
-
* generated file.
|
|
73
|
-
*
|
|
74
|
-
* @typedef {Object} HTMLGeneratorValuesService
|
|
75
|
-
* @property {HTMLGeneratorValuesServiceGetValues} getValues
|
|
76
|
-
* This is the method an `HTMLGenerator` service will call in order to retrieve the values
|
|
77
|
-
* that should be injected on the generated file.
|
|
78
|
-
* @parent module:services
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* This is a utility sever that generates an HTML file with custom information when the
|
|
83
|
-
* app server is started.
|
|
84
|
-
*
|
|
85
|
-
* @parent module:services
|
|
86
|
-
*/
|
|
87
|
-
class HTMLGenerator {
|
|
88
|
-
/**
|
|
89
|
-
* @param {AppConfiguration} appConfiguration
|
|
90
|
-
* To read the values of the settings that are going to be send to the file.
|
|
91
|
-
* @param {Logger} appLogger
|
|
92
|
-
* To log messages when the file is generated, when the template is removed, and if it
|
|
93
|
-
* happens,
|
|
94
|
-
* when an error is thrown.
|
|
95
|
-
* @param {FrontendFs} frontendFs
|
|
96
|
-
* To read the contents of the template.
|
|
97
|
-
* @param {Partial<HTMLGeneratorOptions>} [options={}]
|
|
98
|
-
* To customize the service.
|
|
99
|
-
* @param {?HTMLGeneratorValuesService} [valuesService=null]
|
|
100
|
-
* If specified, instead of getting the values from the app configuration, they'll be
|
|
101
|
-
* retrieved from this service `getValues` method.
|
|
102
|
-
* @throws {Error}
|
|
103
|
-
* If `valuesService` is specified but it doesn't have a `getValues` method.
|
|
104
|
-
*/
|
|
105
|
-
constructor(
|
|
106
|
-
appConfiguration,
|
|
107
|
-
appLogger,
|
|
108
|
-
frontendFs,
|
|
109
|
-
options = {},
|
|
110
|
-
valuesService = null,
|
|
111
|
-
) {
|
|
112
|
-
/**
|
|
113
|
-
* The service options.
|
|
114
|
-
*
|
|
115
|
-
* @type {HTMLGeneratorOptions}
|
|
116
|
-
* @access protected
|
|
117
|
-
* @ignore
|
|
118
|
-
*/
|
|
119
|
-
this._options = ObjectUtils.merge(
|
|
120
|
-
{
|
|
121
|
-
template: 'index.tpl.html',
|
|
122
|
-
file: 'index.html',
|
|
123
|
-
deleteTemplateAfter: true,
|
|
124
|
-
replacePlaceholder: '{{appConfiguration}}',
|
|
125
|
-
valuesExpression: /\{\{(.*?)\}\}/gi,
|
|
126
|
-
variable: 'appConfiguration',
|
|
127
|
-
configurationKeys: ['features', 'version', 'postMessagesPrefix'],
|
|
128
|
-
},
|
|
129
|
-
options,
|
|
130
|
-
);
|
|
131
|
-
/**
|
|
132
|
-
* This check is to completely overwrite the `configurationKeys` if they were specified on
|
|
133
|
-
* the received `options` parameters. The reason it's being made after the `extend` it's because
|
|
134
|
-
* `extend` mergers the array, so if you have `['a', 'b', 'c']` and merge it with `['d', 'e']`
|
|
135
|
-
* you end up with `['d', 'e', 'c']`, and in this case, that's not very useful.
|
|
136
|
-
*/
|
|
137
|
-
if (options.configurationKeys) {
|
|
138
|
-
this._options.configurationKeys = options.configurationKeys.slice();
|
|
139
|
-
}
|
|
140
|
-
// If `valuesService` was specified, check if it has a `getValues` method.
|
|
141
|
-
if (valuesService && typeof valuesService.getValues !== 'function') {
|
|
142
|
-
throw new Error('The HTMLGenerator values service must have a `getValues` method');
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* A local reference for the `appConfiguration` service.
|
|
146
|
-
*
|
|
147
|
-
* @type {AppConfiguration}
|
|
148
|
-
* @access protected
|
|
149
|
-
* @ignore
|
|
150
|
-
*/
|
|
151
|
-
this._appConfiguration = appConfiguration;
|
|
152
|
-
/**
|
|
153
|
-
* A local reference for the `appLogger` service.
|
|
154
|
-
*
|
|
155
|
-
* @type {Logger}
|
|
156
|
-
* @access protected
|
|
157
|
-
* @ignore
|
|
158
|
-
*/
|
|
159
|
-
this._appLogger = appLogger;
|
|
160
|
-
/**
|
|
161
|
-
* A local reference for the `frontendFs` service.
|
|
162
|
-
*
|
|
163
|
-
* @type {FrontendFs}
|
|
164
|
-
* @access protected
|
|
165
|
-
* @ignore
|
|
166
|
-
*/
|
|
167
|
-
this._frontendFs = frontendFs;
|
|
168
|
-
/**
|
|
169
|
-
* A local reference for the recieved `valuesService` service.
|
|
170
|
-
*
|
|
171
|
-
* @type {?HTMLGeneratorValuesService}
|
|
172
|
-
* @access protected
|
|
173
|
-
* @ignore
|
|
174
|
-
*/
|
|
175
|
-
this._valuesService = valuesService;
|
|
176
|
-
/**
|
|
177
|
-
* Whether or not the file has been generated.
|
|
178
|
-
*
|
|
179
|
-
* @type {boolean}
|
|
180
|
-
* @access protected
|
|
181
|
-
* @ignore
|
|
182
|
-
*/
|
|
183
|
-
this._fileReady = false;
|
|
184
|
-
/**
|
|
185
|
-
* A deferred promise to return when another service asks if the file has been
|
|
186
|
-
* generated. Once this sevice finishes generating the file, the promise will be
|
|
187
|
-
* resolved.
|
|
188
|
-
*
|
|
189
|
-
* @type {Object}
|
|
190
|
-
* @access protected
|
|
191
|
-
* @ignore
|
|
192
|
-
*/
|
|
193
|
-
this._fileDeferred = deferred();
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Generate the HTML file.
|
|
197
|
-
*
|
|
198
|
-
* @returns {Promise}
|
|
199
|
-
*/
|
|
200
|
-
generateHTML() {
|
|
201
|
-
// Get the service options.
|
|
202
|
-
const { template, deleteTemplateAfter, file } = this._options;
|
|
203
|
-
// Define the variable where the template contents will be saved.
|
|
204
|
-
let templateContents = '';
|
|
205
|
-
// Read the template file.
|
|
206
|
-
return this._frontendFs
|
|
207
|
-
.read(`./${template}`)
|
|
208
|
-
.then((contents) => {
|
|
209
|
-
// Save the template contents.
|
|
210
|
-
templateContents = contents;
|
|
211
|
-
// Get the values to inject.
|
|
212
|
-
return this.getValues();
|
|
213
|
-
})
|
|
214
|
-
.then((values) => {
|
|
215
|
-
// Get the HTML code for the file.
|
|
216
|
-
const html = this._processHTML(templateContents, values);
|
|
217
|
-
// Write the generated file.
|
|
218
|
-
return this._frontendFs.write(file, html);
|
|
219
|
-
})
|
|
220
|
-
.then(() => {
|
|
221
|
-
this._appLogger.success(`The HTML was successfully generated (${file})`);
|
|
222
|
-
/**
|
|
223
|
-
* If the template needs to be deleted, return the call to the `delete` method, otherwise,
|
|
224
|
-
* just an empty object to continue the promise chain.
|
|
225
|
-
*/
|
|
226
|
-
return deleteTemplateAfter && this._frontendFs.delete(`./${template}`);
|
|
227
|
-
})
|
|
228
|
-
.then(() => {
|
|
229
|
-
// If the template was deleted, log a message informing it.
|
|
230
|
-
if (deleteTemplateAfter) {
|
|
231
|
-
this._appLogger.info(
|
|
232
|
-
`The HTML template was successfully removed (${template})`,
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Mark the `_fileReady` flag as `true` so the next calls to `whenReady` won't get the
|
|
237
|
-
* deferred promise.
|
|
238
|
-
*/
|
|
239
|
-
this._fileReady = true;
|
|
240
|
-
// Resolve the deferred promise.
|
|
241
|
-
this._fileDeferred.resolve();
|
|
242
|
-
})
|
|
243
|
-
.catch((error) => {
|
|
244
|
-
this._appLogger.error('There was an error while generating the HTML');
|
|
245
|
-
return Promise.reject(error);
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Get the name of the file the service generates.
|
|
250
|
-
*
|
|
251
|
-
* @returns {string}
|
|
252
|
-
*/
|
|
253
|
-
getFile() {
|
|
254
|
-
return this._options.file;
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Get the values that are going to be injected on the file.
|
|
258
|
-
*
|
|
259
|
-
* @returns {Promise<Object>}
|
|
260
|
-
*/
|
|
261
|
-
getValues() {
|
|
262
|
-
let valuesPromise;
|
|
263
|
-
// If an `HTMLGeneratorValuesService` was specified...
|
|
264
|
-
if (this._valuesService) {
|
|
265
|
-
// ...get the values from there.
|
|
266
|
-
valuesPromise = this._valuesService.getValues();
|
|
267
|
-
} else if (this._options.configurationKeys.length) {
|
|
268
|
-
/**
|
|
269
|
-
* ...if there are configuration keys to be copied, set to return an already resolved
|
|
270
|
-
* promise with the settings from the configuration.
|
|
271
|
-
*/
|
|
272
|
-
valuesPromise = Promise.resolve(
|
|
273
|
-
this._appConfiguration.get(this._options.configurationKeys),
|
|
274
|
-
);
|
|
275
|
-
} else {
|
|
276
|
-
// ...otherwsie, return an already resolved promise with an empty object.
|
|
277
|
-
valuesPromise = Promise.resolve({});
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return valuesPromise;
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Returns a promise that will be resolved when the file has been generated.
|
|
284
|
-
*
|
|
285
|
-
* @returns {Promise}
|
|
286
|
-
*/
|
|
287
|
-
whenReady() {
|
|
288
|
-
return this._fileReady ? Promise.resolve() : this._fileDeferred.promise;
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* The service options.
|
|
292
|
-
*
|
|
293
|
-
* @type {HTMLGeneratorOptions}
|
|
294
|
-
* @todo Remove Object.freeze.
|
|
295
|
-
*/
|
|
296
|
-
get options() {
|
|
297
|
-
return Object.freeze(this._options);
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Get a value from an object dictionary using a string _"object path"_
|
|
301
|
-
* (`prop.sub.otherProp`).
|
|
302
|
-
* If the property doesn't exist or the path is invalid, it will return `null`.
|
|
303
|
-
*
|
|
304
|
-
* @param {Object} values The dictionary from where the value will be read.
|
|
305
|
-
* @param {string} valuePath The path to the value.
|
|
306
|
-
* @returns {*}
|
|
307
|
-
* @access protected
|
|
308
|
-
* @ignore
|
|
309
|
-
* @todo Use ObjectUtils.get for this.
|
|
310
|
-
*/
|
|
311
|
-
_getFromValues(values, valuePath) {
|
|
312
|
-
const pathParts = valuePath.split('.');
|
|
313
|
-
const first = pathParts.shift();
|
|
314
|
-
let currentElement = values[first];
|
|
315
|
-
if (typeof currentElement === 'undefined') {
|
|
316
|
-
currentElement = null;
|
|
317
|
-
} else if (pathParts.length) {
|
|
318
|
-
pathParts.some((currentPart) => {
|
|
319
|
-
currentElement = currentElement[currentPart];
|
|
320
|
-
let shouldBreak = false;
|
|
321
|
-
if (typeof currentElement === 'undefined') {
|
|
322
|
-
currentElement = null;
|
|
323
|
-
shouldBreak = true;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
return shouldBreak;
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
return currentElement;
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Creates the code for the HTML file.
|
|
334
|
-
*
|
|
335
|
-
* @param {string} template The template code where the values are going to be
|
|
336
|
-
* injected.
|
|
337
|
-
* @param {Object} values The dictionary of values to inject.
|
|
338
|
-
* @returns {string}
|
|
339
|
-
* @access protected
|
|
340
|
-
* @ignore
|
|
341
|
-
*/
|
|
342
|
-
_processHTML(template, values) {
|
|
343
|
-
const { replacePlaceholder, valuesExpression, variable } = this._options;
|
|
344
|
-
const htmlObject = JSON.stringify(values);
|
|
345
|
-
let code = template.replace(replacePlaceholder, `window.${variable} = ${htmlObject}`);
|
|
346
|
-
const matches = [];
|
|
347
|
-
let match = valuesExpression.exec(code);
|
|
348
|
-
while (match) {
|
|
349
|
-
const [string, value] = match;
|
|
350
|
-
matches.push({
|
|
351
|
-
string,
|
|
352
|
-
value,
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
match = valuesExpression.exec(code);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
matches.forEach((info) => {
|
|
359
|
-
code = code.replace(info.string, this._getFromValues(values, info.value));
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
return code;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* A service that hooks itself to the `after-start` event of the app server in order to
|
|
367
|
-
* trigger the generation an the html file when the server starts.
|
|
368
|
-
*
|
|
369
|
-
* @type {ProviderCreator<HTMLGeneratorProviderOptions>}
|
|
370
|
-
* @parent module:services
|
|
371
|
-
*/
|
|
372
|
-
const htmlGenerator = providerCreator((options = {}) => (app) => {
|
|
373
|
-
const { serviceName = 'htmlGenerator' } = options;
|
|
374
|
-
app.set(serviceName, () => {
|
|
375
|
-
const { valuesService = 'htmlGeneratorValues' } = options;
|
|
376
|
-
return new HTMLGenerator(
|
|
377
|
-
app.get('appConfiguration'),
|
|
378
|
-
app.get('appLogger'),
|
|
379
|
-
app.get('frontendFs'),
|
|
380
|
-
options,
|
|
381
|
-
valuesService ? app.try(valuesService) : null,
|
|
382
|
-
);
|
|
383
|
-
});
|
|
384
|
-
|
|
385
|
-
app
|
|
386
|
-
.get('events')
|
|
387
|
-
.once(eventNames.afterStart, () => app.get(serviceName).generateHTML());
|
|
388
|
-
});
|
|
389
|
-
|
|
390
|
-
module.exports.HTMLGenerator = HTMLGenerator;
|
|
391
|
-
module.exports.htmlGenerator = htmlGenerator;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const { providers } = require('../../utils/wrappers');
|
|
2
|
-
const { htmlGenerator } = require('./htmlGenerator');
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @typedef {import('../../types').Provider} Provider
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* The providers collection for the HTML services.
|
|
10
|
-
*
|
|
11
|
-
* @type {Provider}
|
|
12
|
-
* @property {Provider} htmlGenerator The default provider for {@link HTMLGenerator}.
|
|
13
|
-
* @parent module:services
|
|
14
|
-
*/
|
|
15
|
-
module.exports = providers({
|
|
16
|
-
htmlGenerator,
|
|
17
|
-
});
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
const ObjectUtils = require('wootils/shared/objectUtils');
|
|
2
|
-
const APIClientBase = require('wootils/shared/apiClient');
|
|
3
|
-
const { providerCreator } = require('../../utils/wrappers');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {import('../../types').APIClientBase} APIClientBase
|
|
7
|
-
* @typedef {import('../../types').APIClientEndpoints} APIClientEndpoints
|
|
8
|
-
* @typedef {import('./http').HTTP} HTTP
|
|
9
|
-
* @typedef {import('../common/httpError').HTTPError} HTTPError
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @typedef {import('../../types').ProviderCreator<O>} ProviderCreator<O>
|
|
14
|
-
* @template O
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* The options to customize how the service gets registered.
|
|
19
|
-
*
|
|
20
|
-
* @typedef {Object} APIClientProviderOptions
|
|
21
|
-
* @property {string} serviceName The name of the service that will be
|
|
22
|
-
* registered into the app. Default
|
|
23
|
-
* `'apiClient'`.
|
|
24
|
-
* @property {string} configurationSetting The name of the configuration
|
|
25
|
-
* setting that has the API
|
|
26
|
-
* information. Default `'api'`.
|
|
27
|
-
* @property {typeof APIClient} clientClass The class the service will
|
|
28
|
-
* instantiate. It has to extend from
|
|
29
|
-
* {@link APIClient}, which is the
|
|
30
|
-
* default value.
|
|
31
|
-
* @parent module:services
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* The configuration for the API the client will make requests to.
|
|
36
|
-
*
|
|
37
|
-
* @typedef {Object} APIClientConfiguration
|
|
38
|
-
* @property {string} url The API entry point.
|
|
39
|
-
* @property {APIClientEndpoints} endpoints A dictionary of named endpoints relative to
|
|
40
|
-
* the API entry point.
|
|
41
|
-
* @parent module:services
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* An API client for the app to use. What makes this service special is that its that it
|
|
46
|
-
* formats the received errors using the `AppError` service class and as fetch function it
|
|
47
|
-
* uses the `http` service, allowing the app to to internally handle all the requests and
|
|
48
|
-
* responses.
|
|
49
|
-
*
|
|
50
|
-
* @augments APIClientBase
|
|
51
|
-
* @parent module:services
|
|
52
|
-
*/
|
|
53
|
-
class APIClient extends APIClientBase {
|
|
54
|
-
/**
|
|
55
|
-
* @param {APIClientConfiguration} apiConfig The configuration for the API the client
|
|
56
|
-
* will make requests to.
|
|
57
|
-
* @param {HTTP} http To get the `fetch` function for this
|
|
58
|
-
* service to use on all the requests.
|
|
59
|
-
* @param {ClassHTTPError} HTTPError To format the received errors.
|
|
60
|
-
*/
|
|
61
|
-
constructor(apiConfig, http, HTTPError) {
|
|
62
|
-
super(apiConfig.url, apiConfig.endpoints || apiConfig.gateway, http.fetch);
|
|
63
|
-
/**
|
|
64
|
-
* The configuration for the API the client will make requests to.
|
|
65
|
-
*
|
|
66
|
-
* @type {APIClientConfiguration}
|
|
67
|
-
* @access protected
|
|
68
|
-
* @ignore
|
|
69
|
-
*/
|
|
70
|
-
this._apiConfig = ObjectUtils.copy(apiConfig);
|
|
71
|
-
/**
|
|
72
|
-
* A local reference for the class the app uses to generate HTTP errors.
|
|
73
|
-
*
|
|
74
|
-
* @type {ClassHTTPError}
|
|
75
|
-
* @access protected
|
|
76
|
-
* @ignore
|
|
77
|
-
*/
|
|
78
|
-
this._HTTPError = HTTPError;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Formats a response error with the App error class.
|
|
82
|
-
*
|
|
83
|
-
* @param {Object} response A received response from a request.
|
|
84
|
-
* @param {number} status The HTTP status of the request.
|
|
85
|
-
* @returns {HTTPError}
|
|
86
|
-
*/
|
|
87
|
-
error(response, status) {
|
|
88
|
-
return new this._HTTPError(this.getErrorMessageFromResponse(response), status);
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Helper method that tries to get an error message from a given response.
|
|
92
|
-
*
|
|
93
|
-
* @param {Object} response A received response from a request.
|
|
94
|
-
* @param {string} [fallback='Unexpected error'] A fallback message in case the method
|
|
95
|
-
* doesn't found one on the response.
|
|
96
|
-
* @returns {string}
|
|
97
|
-
*/
|
|
98
|
-
getErrorMessageFromResponse(response, fallback = 'Unexpected error') {
|
|
99
|
-
let message;
|
|
100
|
-
if (response.error) {
|
|
101
|
-
message = response.error;
|
|
102
|
-
} else if (response.data && response.data && response.data.message) {
|
|
103
|
-
({ message } = response.data);
|
|
104
|
-
} else if (response.data && response.data && response.data.error) {
|
|
105
|
-
message = response.data.error;
|
|
106
|
-
} else {
|
|
107
|
-
message = fallback;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return message;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* The configuration for the API the client will make requests to.
|
|
114
|
-
*
|
|
115
|
-
* @type {APIClientConfiguration}
|
|
116
|
-
* @todo Remove Object.freeze.
|
|
117
|
-
*/
|
|
118
|
-
get apiConfig() {
|
|
119
|
-
return Object.freeze(this._apiConfig);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* An API Client service to make requests to an API using endpoints defined on the app
|
|
124
|
-
* configuration.
|
|
125
|
-
*
|
|
126
|
-
* @type {ProviderCreator<APIClientProviderOptions>}
|
|
127
|
-
* @parent module:services
|
|
128
|
-
*/
|
|
129
|
-
const apiClient = providerCreator((options = {}) => (app) => {
|
|
130
|
-
const defaultName = 'apiClient';
|
|
131
|
-
const { serviceName = defaultName, clientClass: ClientClass = APIClient } = options;
|
|
132
|
-
let { configurationSetting } = options;
|
|
133
|
-
if (!configurationSetting) {
|
|
134
|
-
configurationSetting = serviceName === defaultName ? 'api' : serviceName;
|
|
135
|
-
}
|
|
136
|
-
app.set(
|
|
137
|
-
serviceName,
|
|
138
|
-
() =>
|
|
139
|
-
new ClientClass(
|
|
140
|
-
app.get('appConfiguration').get(configurationSetting),
|
|
141
|
-
app.get('http'),
|
|
142
|
-
app.get('HTTPError'),
|
|
143
|
-
),
|
|
144
|
-
);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
module.exports.APIClient = APIClient;
|
|
148
|
-
module.exports.apiClient = apiClient;
|