jimpex 7.0.2 → 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 +80 -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,298 +0,0 @@
|
|
|
1
|
-
export type AppConfiguration = import('../../types').AppConfiguration;
|
|
2
|
-
export type Logger = import('../../types').Logger;
|
|
3
|
-
export type FrontendFs = import('../frontend/frontendFs').FrontendFs;
|
|
4
|
-
/**
|
|
5
|
-
* <O>
|
|
6
|
-
*/
|
|
7
|
-
export type ProviderCreator<O> = import('../../types').ProviderCreator<O>;
|
|
8
|
-
/**
|
|
9
|
-
* The options to customize the an `HTMLGenerator` service.
|
|
10
|
-
*/
|
|
11
|
-
export type HTMLGeneratorOptions = {
|
|
12
|
-
/**
|
|
13
|
-
* The name of the file it should use as
|
|
14
|
-
* template.
|
|
15
|
-
* Default `'index.tpl.html'`.
|
|
16
|
-
*/
|
|
17
|
-
template: string;
|
|
18
|
-
/**
|
|
19
|
-
* The name of the generated file. Default
|
|
20
|
-
* `'index.html'`.
|
|
21
|
-
*/
|
|
22
|
-
file: string;
|
|
23
|
-
/**
|
|
24
|
-
* Whether or not to delete the tempalte after
|
|
25
|
-
* generating the file. Default `true`.
|
|
26
|
-
*/
|
|
27
|
-
deleteTemplateAfter: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* The placeholder string where the information
|
|
30
|
-
* will be written. Default
|
|
31
|
-
* `'{{appConfiguration}}'`.
|
|
32
|
-
*/
|
|
33
|
-
replacePlaceholder: string;
|
|
34
|
-
/**
|
|
35
|
-
* A regular expression for dynamic placeholders
|
|
36
|
-
* that will be replaced by values when the file
|
|
37
|
-
* is generated.
|
|
38
|
-
* Default `'{{(.*?)}}'`.
|
|
39
|
-
*/
|
|
40
|
-
valuesExpression: RegExp;
|
|
41
|
-
/**
|
|
42
|
-
* The name of the variable that will have the
|
|
43
|
-
* information on the file. Default
|
|
44
|
-
* `'appConfiguration'`.
|
|
45
|
-
*/
|
|
46
|
-
variable: string;
|
|
47
|
-
/**
|
|
48
|
-
* A list of settings from the app configuration
|
|
49
|
-
* that will be used as the information to
|
|
50
|
-
* inject on the file.
|
|
51
|
-
* Default `['features', 'version',
|
|
52
|
-
* 'postMessagesPrefix']`.
|
|
53
|
-
*/
|
|
54
|
-
configurationKeys: string[];
|
|
55
|
-
};
|
|
56
|
-
export type HTMLGeneratorProviderOptions = HTMLGeneratorOptions & HTMLGeneratorProviderOptionsProperties;
|
|
57
|
-
export type HTMLGeneratorProviderOptionsProperties = {
|
|
58
|
-
/**
|
|
59
|
-
* The name that will be used to register the service on the app container. This is to
|
|
60
|
-
* allow multiple "instances" of the service to be created.
|
|
61
|
-
*/
|
|
62
|
-
serviceName?: string;
|
|
63
|
-
/**
|
|
64
|
-
* The name of a service that the generator will use in order to read the values that will
|
|
65
|
-
* be injected on the template. If the service is available, the values from
|
|
66
|
-
* `configurationKeys`
|
|
67
|
-
* will be ignored.
|
|
68
|
-
*/
|
|
69
|
-
valuesService?: string | null;
|
|
70
|
-
};
|
|
71
|
-
export type HTMLGeneratorValuesServiceGetValues = () => Promise<any>;
|
|
72
|
-
/**
|
|
73
|
-
* A service to provide the information value to an `HTMLGenerator` service to use on the
|
|
74
|
-
* generated file.
|
|
75
|
-
*/
|
|
76
|
-
export type HTMLGeneratorValuesService = {
|
|
77
|
-
/**
|
|
78
|
-
* This is the method an `HTMLGenerator` service will call in order to retrieve the values
|
|
79
|
-
* that should be injected on the generated file.
|
|
80
|
-
*/
|
|
81
|
-
getValues: HTMLGeneratorValuesServiceGetValues;
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* @typedef {import('../../types').AppConfiguration} AppConfiguration
|
|
85
|
-
* @typedef {import('../../types').Logger} Logger
|
|
86
|
-
* @typedef {import('../frontend/frontendFs').FrontendFs} FrontendFs
|
|
87
|
-
*/
|
|
88
|
-
/**
|
|
89
|
-
* @typedef {import('../../types').ProviderCreator<O>} ProviderCreator<O>
|
|
90
|
-
* @template O
|
|
91
|
-
*/
|
|
92
|
-
/**
|
|
93
|
-
* The options to customize the an `HTMLGenerator` service.
|
|
94
|
-
*
|
|
95
|
-
* @typedef {Object} HTMLGeneratorOptions
|
|
96
|
-
* @property {string} template The name of the file it should use as
|
|
97
|
-
* template.
|
|
98
|
-
* Default `'index.tpl.html'`.
|
|
99
|
-
* @property {string} file The name of the generated file. Default
|
|
100
|
-
* `'index.html'`.
|
|
101
|
-
* @property {boolean} deleteTemplateAfter Whether or not to delete the tempalte after
|
|
102
|
-
* generating the file. Default `true`.
|
|
103
|
-
* @property {string} replacePlaceholder The placeholder string where the information
|
|
104
|
-
* will be written. Default
|
|
105
|
-
* `'{{appConfiguration}}'`.
|
|
106
|
-
* @property {RegExp} valuesExpression A regular expression for dynamic placeholders
|
|
107
|
-
* that will be replaced by values when the file
|
|
108
|
-
* is generated.
|
|
109
|
-
* Default `'{{(.*?)}}'`.
|
|
110
|
-
* @property {string} variable The name of the variable that will have the
|
|
111
|
-
* information on the file. Default
|
|
112
|
-
* `'appConfiguration'`.
|
|
113
|
-
* @property {string[]} configurationKeys A list of settings from the app configuration
|
|
114
|
-
* that will be used as the information to
|
|
115
|
-
* inject on the file.
|
|
116
|
-
* Default `['features', 'version',
|
|
117
|
-
* 'postMessagesPrefix']`.
|
|
118
|
-
* @parent module:services
|
|
119
|
-
*/
|
|
120
|
-
/**
|
|
121
|
-
* @typedef {HTMLGeneratorOptions & HTMLGeneratorProviderOptionsProperties} HTMLGeneratorProviderOptions
|
|
122
|
-
* @parent module:services
|
|
123
|
-
* @prettierignore
|
|
124
|
-
*/
|
|
125
|
-
/**
|
|
126
|
-
* @typedef {Object} HTMLGeneratorProviderOptionsProperties
|
|
127
|
-
* @property {string} [serviceName='htmlGenerator']
|
|
128
|
-
* The name that will be used to register the service on the app container. This is to
|
|
129
|
-
* allow multiple "instances" of the service to be created.
|
|
130
|
-
* @property {?string} [valuesService='htmlGeneratorValues']
|
|
131
|
-
* The name of a service that the generator will use in order to read the values that will
|
|
132
|
-
* be injected on the template. If the service is available, the values from
|
|
133
|
-
* `configurationKeys`
|
|
134
|
-
* will be ignored.
|
|
135
|
-
* @parent module:services
|
|
136
|
-
*/
|
|
137
|
-
/**
|
|
138
|
-
* @callback HTMLGeneratorValuesServiceGetValues
|
|
139
|
-
* @returns {Promise<Object>}
|
|
140
|
-
* @parent module:services
|
|
141
|
-
*/
|
|
142
|
-
/**
|
|
143
|
-
* A service to provide the information value to an `HTMLGenerator` service to use on the
|
|
144
|
-
* generated file.
|
|
145
|
-
*
|
|
146
|
-
* @typedef {Object} HTMLGeneratorValuesService
|
|
147
|
-
* @property {HTMLGeneratorValuesServiceGetValues} getValues
|
|
148
|
-
* This is the method an `HTMLGenerator` service will call in order to retrieve the values
|
|
149
|
-
* that should be injected on the generated file.
|
|
150
|
-
* @parent module:services
|
|
151
|
-
*/
|
|
152
|
-
/**
|
|
153
|
-
* This is a utility sever that generates an HTML file with custom information when the
|
|
154
|
-
* app server is started.
|
|
155
|
-
*
|
|
156
|
-
* @parent module:services
|
|
157
|
-
*/
|
|
158
|
-
export class HTMLGenerator {
|
|
159
|
-
/**
|
|
160
|
-
* @param {AppConfiguration} appConfiguration
|
|
161
|
-
* To read the values of the settings that are going to be send to the file.
|
|
162
|
-
* @param {Logger} appLogger
|
|
163
|
-
* To log messages when the file is generated, when the template is removed, and if it
|
|
164
|
-
* happens,
|
|
165
|
-
* when an error is thrown.
|
|
166
|
-
* @param {FrontendFs} frontendFs
|
|
167
|
-
* To read the contents of the template.
|
|
168
|
-
* @param {Partial<HTMLGeneratorOptions>} [options={}]
|
|
169
|
-
* To customize the service.
|
|
170
|
-
* @param {?HTMLGeneratorValuesService} [valuesService=null]
|
|
171
|
-
* If specified, instead of getting the values from the app configuration, they'll be
|
|
172
|
-
* retrieved from this service `getValues` method.
|
|
173
|
-
* @throws {Error}
|
|
174
|
-
* If `valuesService` is specified but it doesn't have a `getValues` method.
|
|
175
|
-
*/
|
|
176
|
-
constructor(appConfiguration: AppConfiguration, appLogger: Logger, frontendFs: FrontendFs, options?: Partial<HTMLGeneratorOptions>, valuesService?: HTMLGeneratorValuesService | null);
|
|
177
|
-
/**
|
|
178
|
-
* The service options.
|
|
179
|
-
*
|
|
180
|
-
* @type {HTMLGeneratorOptions}
|
|
181
|
-
* @access protected
|
|
182
|
-
* @ignore
|
|
183
|
-
*/
|
|
184
|
-
_options: HTMLGeneratorOptions;
|
|
185
|
-
/**
|
|
186
|
-
* A local reference for the `appConfiguration` service.
|
|
187
|
-
*
|
|
188
|
-
* @type {AppConfiguration}
|
|
189
|
-
* @access protected
|
|
190
|
-
* @ignore
|
|
191
|
-
*/
|
|
192
|
-
_appConfiguration: AppConfiguration;
|
|
193
|
-
/**
|
|
194
|
-
* A local reference for the `appLogger` service.
|
|
195
|
-
*
|
|
196
|
-
* @type {Logger}
|
|
197
|
-
* @access protected
|
|
198
|
-
* @ignore
|
|
199
|
-
*/
|
|
200
|
-
_appLogger: Logger;
|
|
201
|
-
/**
|
|
202
|
-
* A local reference for the `frontendFs` service.
|
|
203
|
-
*
|
|
204
|
-
* @type {FrontendFs}
|
|
205
|
-
* @access protected
|
|
206
|
-
* @ignore
|
|
207
|
-
*/
|
|
208
|
-
_frontendFs: FrontendFs;
|
|
209
|
-
/**
|
|
210
|
-
* A local reference for the recieved `valuesService` service.
|
|
211
|
-
*
|
|
212
|
-
* @type {?HTMLGeneratorValuesService}
|
|
213
|
-
* @access protected
|
|
214
|
-
* @ignore
|
|
215
|
-
*/
|
|
216
|
-
_valuesService: HTMLGeneratorValuesService | null;
|
|
217
|
-
/**
|
|
218
|
-
* Whether or not the file has been generated.
|
|
219
|
-
*
|
|
220
|
-
* @type {boolean}
|
|
221
|
-
* @access protected
|
|
222
|
-
* @ignore
|
|
223
|
-
*/
|
|
224
|
-
_fileReady: boolean;
|
|
225
|
-
/**
|
|
226
|
-
* A deferred promise to return when another service asks if the file has been
|
|
227
|
-
* generated. Once this sevice finishes generating the file, the promise will be
|
|
228
|
-
* resolved.
|
|
229
|
-
*
|
|
230
|
-
* @type {Object}
|
|
231
|
-
* @access protected
|
|
232
|
-
* @ignore
|
|
233
|
-
*/
|
|
234
|
-
_fileDeferred: any;
|
|
235
|
-
/**
|
|
236
|
-
* Generate the HTML file.
|
|
237
|
-
*
|
|
238
|
-
* @returns {Promise}
|
|
239
|
-
*/
|
|
240
|
-
generateHTML(): Promise<any>;
|
|
241
|
-
/**
|
|
242
|
-
* Get the name of the file the service generates.
|
|
243
|
-
*
|
|
244
|
-
* @returns {string}
|
|
245
|
-
*/
|
|
246
|
-
getFile(): string;
|
|
247
|
-
/**
|
|
248
|
-
* Get the values that are going to be injected on the file.
|
|
249
|
-
*
|
|
250
|
-
* @returns {Promise<Object>}
|
|
251
|
-
*/
|
|
252
|
-
getValues(): Promise<any>;
|
|
253
|
-
/**
|
|
254
|
-
* Returns a promise that will be resolved when the file has been generated.
|
|
255
|
-
*
|
|
256
|
-
* @returns {Promise}
|
|
257
|
-
*/
|
|
258
|
-
whenReady(): Promise<any>;
|
|
259
|
-
/**
|
|
260
|
-
* The service options.
|
|
261
|
-
*
|
|
262
|
-
* @type {HTMLGeneratorOptions}
|
|
263
|
-
* @todo Remove Object.freeze.
|
|
264
|
-
*/
|
|
265
|
-
get options(): HTMLGeneratorOptions;
|
|
266
|
-
/**
|
|
267
|
-
* Get a value from an object dictionary using a string _"object path"_
|
|
268
|
-
* (`prop.sub.otherProp`).
|
|
269
|
-
* If the property doesn't exist or the path is invalid, it will return `null`.
|
|
270
|
-
*
|
|
271
|
-
* @param {Object} values The dictionary from where the value will be read.
|
|
272
|
-
* @param {string} valuePath The path to the value.
|
|
273
|
-
* @returns {*}
|
|
274
|
-
* @access protected
|
|
275
|
-
* @ignore
|
|
276
|
-
* @todo Use ObjectUtils.get for this.
|
|
277
|
-
*/
|
|
278
|
-
_getFromValues(values: any, valuePath: string): any;
|
|
279
|
-
/**
|
|
280
|
-
* Creates the code for the HTML file.
|
|
281
|
-
*
|
|
282
|
-
* @param {string} template The template code where the values are going to be
|
|
283
|
-
* injected.
|
|
284
|
-
* @param {Object} values The dictionary of values to inject.
|
|
285
|
-
* @returns {string}
|
|
286
|
-
* @access protected
|
|
287
|
-
* @ignore
|
|
288
|
-
*/
|
|
289
|
-
_processHTML(template: string, values: any): string;
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* A service that hooks itself to the `after-start` event of the app server in order to
|
|
293
|
-
* trigger the generation an the html file when the server starts.
|
|
294
|
-
*
|
|
295
|
-
* @type {ProviderCreator<HTMLGeneratorProviderOptions>}
|
|
296
|
-
* @parent module:services
|
|
297
|
-
*/
|
|
298
|
-
export const htmlGenerator: ProviderCreator<HTMLGeneratorProviderOptions>;
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
export type APIClientBase = import('../../types').APIClientBase;
|
|
2
|
-
export type APIClientEndpoints = import('../../types').APIClientEndpoints;
|
|
3
|
-
export type HTTP = import('./http').HTTP;
|
|
4
|
-
export type HTTPError = import('../common/httpError').HTTPError;
|
|
5
|
-
/**
|
|
6
|
-
* <O>
|
|
7
|
-
*/
|
|
8
|
-
export type ProviderCreator<O> = import('../../types').ProviderCreator<O>;
|
|
9
|
-
/**
|
|
10
|
-
* The options to customize how the service gets registered.
|
|
11
|
-
*/
|
|
12
|
-
export type APIClientProviderOptions = {
|
|
13
|
-
/**
|
|
14
|
-
* The name of the service that will be
|
|
15
|
-
* registered into the app. Default
|
|
16
|
-
* `'apiClient'`.
|
|
17
|
-
*/
|
|
18
|
-
serviceName: string;
|
|
19
|
-
/**
|
|
20
|
-
* The name of the configuration
|
|
21
|
-
* setting that has the API
|
|
22
|
-
* information. Default `'api'`.
|
|
23
|
-
*/
|
|
24
|
-
configurationSetting: string;
|
|
25
|
-
/**
|
|
26
|
-
* The class the service will
|
|
27
|
-
* instantiate. It has to extend from
|
|
28
|
-
* {@link APIClient }, which is the
|
|
29
|
-
* default value.
|
|
30
|
-
*/
|
|
31
|
-
clientClass: typeof APIClient;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* The configuration for the API the client will make requests to.
|
|
35
|
-
*/
|
|
36
|
-
export type APIClientConfiguration = {
|
|
37
|
-
/**
|
|
38
|
-
* The API entry point.
|
|
39
|
-
*/
|
|
40
|
-
url: string;
|
|
41
|
-
/**
|
|
42
|
-
* A dictionary of named endpoints relative to
|
|
43
|
-
* the API entry point.
|
|
44
|
-
*/
|
|
45
|
-
endpoints: APIClientEndpoints;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* @typedef {import('../../types').APIClientBase} APIClientBase
|
|
49
|
-
* @typedef {import('../../types').APIClientEndpoints} APIClientEndpoints
|
|
50
|
-
* @typedef {import('./http').HTTP} HTTP
|
|
51
|
-
* @typedef {import('../common/httpError').HTTPError} HTTPError
|
|
52
|
-
*/
|
|
53
|
-
/**
|
|
54
|
-
* @typedef {import('../../types').ProviderCreator<O>} ProviderCreator<O>
|
|
55
|
-
* @template O
|
|
56
|
-
*/
|
|
57
|
-
/**
|
|
58
|
-
* The options to customize how the service gets registered.
|
|
59
|
-
*
|
|
60
|
-
* @typedef {Object} APIClientProviderOptions
|
|
61
|
-
* @property {string} serviceName The name of the service that will be
|
|
62
|
-
* registered into the app. Default
|
|
63
|
-
* `'apiClient'`.
|
|
64
|
-
* @property {string} configurationSetting The name of the configuration
|
|
65
|
-
* setting that has the API
|
|
66
|
-
* information. Default `'api'`.
|
|
67
|
-
* @property {typeof APIClient} clientClass The class the service will
|
|
68
|
-
* instantiate. It has to extend from
|
|
69
|
-
* {@link APIClient}, which is the
|
|
70
|
-
* default value.
|
|
71
|
-
* @parent module:services
|
|
72
|
-
*/
|
|
73
|
-
/**
|
|
74
|
-
* The configuration for the API the client will make requests to.
|
|
75
|
-
*
|
|
76
|
-
* @typedef {Object} APIClientConfiguration
|
|
77
|
-
* @property {string} url The API entry point.
|
|
78
|
-
* @property {APIClientEndpoints} endpoints A dictionary of named endpoints relative to
|
|
79
|
-
* the API entry point.
|
|
80
|
-
* @parent module:services
|
|
81
|
-
*/
|
|
82
|
-
/**
|
|
83
|
-
* An API client for the app to use. What makes this service special is that its that it
|
|
84
|
-
* formats the received errors using the `AppError` service class and as fetch function it
|
|
85
|
-
* uses the `http` service, allowing the app to to internally handle all the requests and
|
|
86
|
-
* responses.
|
|
87
|
-
*
|
|
88
|
-
* @augments APIClientBase
|
|
89
|
-
* @parent module:services
|
|
90
|
-
*/
|
|
91
|
-
export class APIClient extends APIClientBase {
|
|
92
|
-
/**
|
|
93
|
-
* @param {APIClientConfiguration} apiConfig The configuration for the API the client
|
|
94
|
-
* will make requests to.
|
|
95
|
-
* @param {HTTP} http To get the `fetch` function for this
|
|
96
|
-
* service to use on all the requests.
|
|
97
|
-
* @param {ClassHTTPError} HTTPError To format the received errors.
|
|
98
|
-
*/
|
|
99
|
-
constructor(apiConfig: APIClientConfiguration, http: HTTP, HTTPError: any);
|
|
100
|
-
/**
|
|
101
|
-
* The configuration for the API the client will make requests to.
|
|
102
|
-
*
|
|
103
|
-
* @type {APIClientConfiguration}
|
|
104
|
-
* @access protected
|
|
105
|
-
* @ignore
|
|
106
|
-
*/
|
|
107
|
-
_apiConfig: APIClientConfiguration;
|
|
108
|
-
/**
|
|
109
|
-
* A local reference for the class the app uses to generate HTTP errors.
|
|
110
|
-
*
|
|
111
|
-
* @type {ClassHTTPError}
|
|
112
|
-
* @access protected
|
|
113
|
-
* @ignore
|
|
114
|
-
*/
|
|
115
|
-
_HTTPError: any;
|
|
116
|
-
/**
|
|
117
|
-
* Helper method that tries to get an error message from a given response.
|
|
118
|
-
*
|
|
119
|
-
* @param {Object} response A received response from a request.
|
|
120
|
-
* @param {string} [fallback='Unexpected error'] A fallback message in case the method
|
|
121
|
-
* doesn't found one on the response.
|
|
122
|
-
* @returns {string}
|
|
123
|
-
*/
|
|
124
|
-
getErrorMessageFromResponse(response: any, fallback?: string): string;
|
|
125
|
-
/**
|
|
126
|
-
* The configuration for the API the client will make requests to.
|
|
127
|
-
*
|
|
128
|
-
* @type {APIClientConfiguration}
|
|
129
|
-
* @todo Remove Object.freeze.
|
|
130
|
-
*/
|
|
131
|
-
get apiConfig(): APIClientConfiguration;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* An API Client service to make requests to an API using endpoints defined on the app
|
|
135
|
-
* configuration.
|
|
136
|
-
*
|
|
137
|
-
* @type {ProviderCreator<APIClientProviderOptions>}
|
|
138
|
-
* @parent module:services
|
|
139
|
-
*/
|
|
140
|
-
export const apiClient: ProviderCreator<APIClientProviderOptions>;
|
|
141
|
-
import APIClientBase = require("wootils/shared/apiClient");
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
export type Logger = import('../../types').Logger;
|
|
2
|
-
export type Provider = import('../../types').Provider;
|
|
3
|
-
export type Response = any;
|
|
4
|
-
export type ExpressRequest = import('../../types').ExpressRequest;
|
|
5
|
-
export type HTTPFetchOptions = {
|
|
6
|
-
/**
|
|
7
|
-
* The request method.
|
|
8
|
-
*/
|
|
9
|
-
method: string | null;
|
|
10
|
-
/**
|
|
11
|
-
* The request headers.
|
|
12
|
-
*/
|
|
13
|
-
headers: {
|
|
14
|
-
[x: string]: string;
|
|
15
|
-
} | null;
|
|
16
|
-
/**
|
|
17
|
-
* The request body.
|
|
18
|
-
*/
|
|
19
|
-
body: string | null;
|
|
20
|
-
/**
|
|
21
|
-
* The request query string parameters.
|
|
22
|
-
*/
|
|
23
|
-
qs: {
|
|
24
|
-
[x: string]: string;
|
|
25
|
-
} | null;
|
|
26
|
-
/**
|
|
27
|
-
* An Express request object used to get
|
|
28
|
-
* extra infromation (like headers and the
|
|
29
|
-
* IP).
|
|
30
|
-
*/
|
|
31
|
-
req: ExpressRequest | null;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* @typedef {import('../../types').Logger} Logger
|
|
35
|
-
* @typedef {import('../../types').Provider} Provider
|
|
36
|
-
* @typedef {import('node-fetch').Response} Response
|
|
37
|
-
* @typedef {import('../../types').ExpressRequest} ExpressRequest
|
|
38
|
-
*/
|
|
39
|
-
/**
|
|
40
|
-
* @typedef {Object} HTTPFetchOptions
|
|
41
|
-
* @property {?string} method The request method.
|
|
42
|
-
* @property {?Object.<string, string>} headers The request headers.
|
|
43
|
-
* @property {?string} body The request body.
|
|
44
|
-
* @property {?Object.<string, string>} qs The request query string parameters.
|
|
45
|
-
* @property {?ExpressRequest} req An Express request object used to get
|
|
46
|
-
* extra infromation (like headers and the
|
|
47
|
-
* IP).
|
|
48
|
-
* @parent module:services
|
|
49
|
-
*/
|
|
50
|
-
/**
|
|
51
|
-
* A set of utilities to work with HTTP requests and responses.
|
|
52
|
-
*
|
|
53
|
-
* @parent module:services
|
|
54
|
-
*/
|
|
55
|
-
export class HTTP {
|
|
56
|
-
/**
|
|
57
|
-
* @param {boolean} logRequests Whether or not to log the requests and their responses.
|
|
58
|
-
* @param {Logger} appLogger If `logRequests` is `true`, this will be used to log
|
|
59
|
-
* the requests and responses information.
|
|
60
|
-
*/
|
|
61
|
-
constructor(logRequests: boolean, appLogger: Logger);
|
|
62
|
-
/**
|
|
63
|
-
* Whether or not to log the requests and their responses.
|
|
64
|
-
*
|
|
65
|
-
* @type {boolean}
|
|
66
|
-
* @access protected
|
|
67
|
-
* @ignore
|
|
68
|
-
*/
|
|
69
|
-
_logRequests: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* A local reference for the `appLogger` service.
|
|
72
|
-
*
|
|
73
|
-
* @type {Logger}
|
|
74
|
-
* @access protected
|
|
75
|
-
* @ignore
|
|
76
|
-
*/
|
|
77
|
-
_appLogger: Logger;
|
|
78
|
-
/**
|
|
79
|
-
* Make a request.
|
|
80
|
-
*
|
|
81
|
-
* @param {string} url The request URL.
|
|
82
|
-
* @param {Partial<HTTPFetchOptions>} [options={}] The request options.
|
|
83
|
-
* @returns {Promise<Response>}
|
|
84
|
-
*/
|
|
85
|
-
fetch(url: string, options?: Partial<HTTPFetchOptions>): Promise<Response>;
|
|
86
|
-
/**
|
|
87
|
-
* Creates a dictionary with all the custom headers a request has. By custom header it
|
|
88
|
-
* means all the headers which name start with `x-`.
|
|
89
|
-
* This method doesn't copy `x-forwarded-for` as the `fetch` method generates it by
|
|
90
|
-
* calling `getIPFromRequest`.
|
|
91
|
-
*
|
|
92
|
-
* @param {ExpressRequest} req The request from which it will try to get the headers.
|
|
93
|
-
* @returns {Object.<string, string>}
|
|
94
|
-
*/
|
|
95
|
-
getCustomHeadersFromRequest(req: ExpressRequest): {
|
|
96
|
-
[x: string]: string;
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Try to get the IP from a given request.
|
|
100
|
-
*
|
|
101
|
-
* @param {ExpressRequest} req The request from which it will try to obtain the IP
|
|
102
|
-
* address.
|
|
103
|
-
* @returns {?string}
|
|
104
|
-
*/
|
|
105
|
-
getIPFromRequest(req: ExpressRequest): string | null;
|
|
106
|
-
/**
|
|
107
|
-
* It takes a dictionary of headers and normalize the names so each word will start with
|
|
108
|
-
* an upper case character. This is helpful in case you added custom headers and didn't
|
|
109
|
-
* care about the casing, or when copying headers from a server request, in which case
|
|
110
|
-
* they are all tranformed to lower case.
|
|
111
|
-
*
|
|
112
|
-
* @param {Object.<string, string>} headers The dictionary of headers to normalize.
|
|
113
|
-
* @returns {Object.<string, string>}
|
|
114
|
-
*/
|
|
115
|
-
normalizeHeaders(headers: {
|
|
116
|
-
[x: string]: string;
|
|
117
|
-
}): {
|
|
118
|
-
[x: string]: string;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Whether or not to log the requests and their responses.
|
|
122
|
-
*
|
|
123
|
-
* @type {boolean}
|
|
124
|
-
*/
|
|
125
|
-
get logRequests(): boolean;
|
|
126
|
-
/**
|
|
127
|
-
* Log a a request information using the `appLogger` service.
|
|
128
|
-
*
|
|
129
|
-
* @param {string} url The request URL.
|
|
130
|
-
* @param {HTTPFetchOptions} options The options generated by the `fetch` method.
|
|
131
|
-
* @access protected
|
|
132
|
-
* @ignore
|
|
133
|
-
*/
|
|
134
|
-
_logRequest(url: string, options: HTTPFetchOptions): void;
|
|
135
|
-
/**
|
|
136
|
-
* Log a a response information using the `appLogger` service.
|
|
137
|
-
*
|
|
138
|
-
* @param {Response} response The response object returned by `node-fetch`.
|
|
139
|
-
* @access protected
|
|
140
|
-
* @ignore
|
|
141
|
-
*/
|
|
142
|
-
_logResponse(response: any): void;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* The service provider that once registered on the app container will set an instance of
|
|
146
|
-
* `HTTP` as the `http` service. The provider also checks the `debug.logRequests` setting
|
|
147
|
-
* on the app configuration in order to enable or not the logging of requests.
|
|
148
|
-
*
|
|
149
|
-
* @type {Provider}
|
|
150
|
-
* @example
|
|
151
|
-
*
|
|
152
|
-
* // Register it on the container
|
|
153
|
-
* container.register(http);
|
|
154
|
-
* // Getting access to the service instance
|
|
155
|
-
* const http = container.get('http');
|
|
156
|
-
*
|
|
157
|
-
* @parent module:services
|
|
158
|
-
*/
|
|
159
|
-
export const http: Provider;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export = httpServices;
|
|
2
|
-
/**
|
|
3
|
-
* @typedef {import('../../types').Provider} Provider
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* The providers collection for the HTTP services.
|
|
7
|
-
*
|
|
8
|
-
* @type {Provider}
|
|
9
|
-
* @property {Provider} apiClient The provider for {@link APIClient}.
|
|
10
|
-
* @property {Provider} http The provider for {@link HTTP}.
|
|
11
|
-
* @property {Provider} responsesBuilder The provider for {@link ResponsesBuilder}.
|
|
12
|
-
* @parent module:services
|
|
13
|
-
*/
|
|
14
|
-
declare const httpServices: Provider;
|
|
15
|
-
declare namespace httpServices {
|
|
16
|
-
export { Provider };
|
|
17
|
-
}
|
|
18
|
-
type Provider = import('../../types').Provider;
|