jimpex 7.0.2 → 9.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 +93 -0
- package/LICENSE +1 -1
- package/README.md +447 -435
- package/dist/app/index.d.mts +14 -0
- package/dist/app/index.d.ts +14 -0
- package/dist/app/index.js +23 -0
- package/dist/app/index.js.map +1 -0
- package/dist/app/jimpex.d.mts +14 -0
- package/dist/app/jimpex.d.ts +14 -0
- package/dist/app/jimpex.js +665 -0
- package/dist/app/jimpex.js.map +1 -0
- package/dist/controllers/common/config.d.mts +79 -0
- package/dist/controllers/common/config.d.ts +79 -0
- package/dist/controllers/common/config.js +107 -0
- package/dist/controllers/common/config.js.map +1 -0
- package/dist/controllers/common/health.d.mts +83 -0
- package/dist/controllers/common/health.d.ts +83 -0
- package/dist/controllers/common/health.js +115 -0
- package/dist/controllers/common/health.js.map +1 -0
- package/dist/controllers/common/index.d.mts +21 -0
- package/dist/controllers/common/index.d.ts +21 -0
- package/dist/controllers/common/index.js +27 -0
- package/dist/controllers/common/index.js.map +1 -0
- package/dist/controllers/common/statics.d.mts +215 -0
- package/dist/controllers/common/statics.d.ts +215 -0
- package/dist/controllers/common/statics.js +253 -0
- package/dist/controllers/common/statics.js.map +1 -0
- package/dist/controllers/index.d.mts +24 -0
- package/dist/controllers/index.d.ts +24 -0
- package/dist/controllers/index.js +25 -0
- package/dist/controllers/index.js.map +1 -0
- package/dist/controllers/utils/gateway.d.mts +725 -0
- package/dist/controllers/utils/gateway.d.ts +725 -0
- package/dist/controllers/utils/gateway.js +577 -0
- package/dist/controllers/utils/gateway.js.map +1 -0
- package/dist/controllers/utils/index.d.mts +17 -0
- package/dist/controllers/utils/index.d.ts +17 -0
- package/dist/controllers/utils/index.js +23 -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 +636 -0
- package/dist/esm/app/jimpex.js.map +1 -0
- package/dist/esm/chunk-2B2CG5KL.js +11 -0
- package/dist/esm/chunk-2B2CG5KL.js.map +1 -0
- package/dist/esm/controllers/common/config.js +80 -0
- package/dist/esm/controllers/common/config.js.map +1 -0
- package/dist/esm/controllers/common/health.js +88 -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 +220 -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 +556 -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 +116 -0
- package/dist/esm/middlewares/common/errorHandler.js.map +1 -0
- package/dist/esm/middlewares/common/forceHTTPS.js +53 -0
- package/dist/esm/middlewares/common/forceHTTPS.js.map +1 -0
- package/dist/esm/middlewares/common/hsts.js +74 -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 +158 -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 +100 -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 +135 -0
- package/dist/esm/middlewares/utils/versionValidator.js.map +1 -0
- package/dist/esm/services/common/appError.js +98 -0
- package/dist/esm/services/common/appError.js.map +1 -0
- package/dist/esm/services/common/httpError.js +28 -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 +66 -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 +194 -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 +97 -0
- package/dist/esm/services/http/apiClient.js.map +1 -0
- package/dist/esm/services/http/http.js +174 -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 +152 -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 +94 -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-b2a04c78.d.ts +1282 -0
- package/dist/index-efeb437e.d.ts +1282 -0
- package/dist/index.d.mts +46 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/middlewares/common/errorHandler.d.mts +132 -0
- package/dist/middlewares/common/errorHandler.d.ts +132 -0
- package/dist/middlewares/common/errorHandler.js +143 -0
- package/dist/middlewares/common/errorHandler.js.map +1 -0
- package/dist/middlewares/common/forceHTTPS.d.mts +69 -0
- package/dist/middlewares/common/forceHTTPS.d.ts +69 -0
- package/dist/middlewares/common/forceHTTPS.js +80 -0
- package/dist/middlewares/common/forceHTTPS.js.map +1 -0
- package/dist/middlewares/common/hsts.d.mts +110 -0
- package/dist/middlewares/common/hsts.d.ts +110 -0
- package/dist/middlewares/common/hsts.js +101 -0
- package/dist/middlewares/common/hsts.js.map +1 -0
- package/dist/middlewares/common/index.d.mts +22 -0
- package/dist/middlewares/common/index.d.ts +22 -0
- package/dist/middlewares/common/index.js +27 -0
- package/dist/middlewares/common/index.js.map +1 -0
- package/dist/middlewares/html/fastHTML.d.mts +180 -0
- package/dist/middlewares/html/fastHTML.d.ts +180 -0
- package/dist/middlewares/html/fastHTML.js +185 -0
- package/dist/middlewares/html/fastHTML.js.map +1 -0
- package/dist/middlewares/html/index.d.mts +21 -0
- package/dist/middlewares/html/index.d.ts +21 -0
- package/dist/middlewares/html/index.js +25 -0
- package/dist/middlewares/html/index.js.map +1 -0
- package/dist/middlewares/html/showHTML.d.mts +127 -0
- package/dist/middlewares/html/showHTML.d.ts +127 -0
- package/dist/middlewares/html/showHTML.js +127 -0
- package/dist/middlewares/html/showHTML.js.map +1 -0
- package/dist/middlewares/index.d.mts +30 -0
- package/dist/middlewares/index.d.ts +30 -0
- package/dist/middlewares/index.js +27 -0
- package/dist/middlewares/index.js.map +1 -0
- package/dist/middlewares/utils/index.d.mts +20 -0
- package/dist/middlewares/utils/index.d.ts +20 -0
- package/dist/middlewares/utils/index.js +23 -0
- package/dist/middlewares/utils/index.js.map +1 -0
- package/dist/middlewares/utils/versionValidator.d.mts +215 -0
- package/dist/middlewares/utils/versionValidator.d.ts +215 -0
- package/dist/middlewares/utils/versionValidator.js +162 -0
- package/dist/middlewares/utils/versionValidator.js.map +1 -0
- package/dist/services/common/appError.d.mts +139 -0
- package/dist/services/common/appError.d.ts +139 -0
- package/dist/services/common/appError.js +126 -0
- package/dist/services/common/appError.js.map +1 -0
- package/dist/services/common/httpError.d.mts +80 -0
- package/dist/services/common/httpError.d.ts +80 -0
- package/dist/services/common/httpError.js +53 -0
- package/dist/services/common/httpError.js.map +1 -0
- package/dist/services/common/index.d.mts +47 -0
- package/dist/services/common/index.d.ts +47 -0
- package/dist/services/common/index.js +44 -0
- package/dist/services/common/index.js.map +1 -0
- package/dist/services/common/sendFile.d.mts +102 -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.mts +96 -0
- package/dist/services/frontend/frontendFs.d.ts +96 -0
- package/dist/services/frontend/frontendFs.js +103 -0
- package/dist/services/frontend/frontendFs.js.map +1 -0
- package/dist/services/frontend/index.d.mts +40 -0
- package/dist/services/frontend/index.d.ts +40 -0
- package/dist/services/frontend/index.js +36 -0
- package/dist/services/frontend/index.js.map +1 -0
- package/dist/services/html/htmlGenerator.d.mts +237 -0
- package/dist/services/html/htmlGenerator.d.ts +237 -0
- package/dist/services/html/htmlGenerator.js +221 -0
- package/dist/services/html/htmlGenerator.js.map +1 -0
- package/dist/services/html/index.d.mts +43 -0
- package/dist/services/html/index.d.ts +43 -0
- package/dist/services/html/index.js +36 -0
- package/dist/services/html/index.js.map +1 -0
- package/dist/services/http/apiClient.d.mts +170 -0
- package/dist/services/http/apiClient.d.ts +170 -0
- package/dist/services/http/apiClient.js +122 -0
- package/dist/services/http/apiClient.js.map +1 -0
- package/dist/services/http/http.d.mts +176 -0
- package/dist/services/http/http.d.ts +176 -0
- package/dist/services/http/http.js +211 -0
- package/dist/services/http/http.js.map +1 -0
- package/dist/services/http/index.d.mts +51 -0
- package/dist/services/http/index.d.ts +51 -0
- package/dist/services/http/index.js +44 -0
- package/dist/services/http/index.js.map +1 -0
- package/dist/services/http/responsesBuilder.d.mts +179 -0
- package/dist/services/http/responsesBuilder.d.ts +179 -0
- package/dist/services/http/responsesBuilder.js +179 -0
- package/dist/services/http/responsesBuilder.js.map +1 -0
- package/dist/services/index.d.mts +33 -0
- package/dist/services/index.d.ts +33 -0
- package/dist/services/index.js +31 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/utils/ensureBearerToken.d.mts +158 -0
- package/dist/services/utils/ensureBearerToken.d.ts +158 -0
- package/dist/services/utils/ensureBearerToken.js +121 -0
- package/dist/services/utils/ensureBearerToken.js.map +1 -0
- package/dist/services/utils/index.d.mts +44 -0
- package/dist/services/utils/index.d.ts +44 -0
- package/dist/services/utils/index.js +36 -0
- package/dist/services/utils/index.js.map +1 -0
- package/dist/types/events.d.mts +14 -0
- package/dist/types/events.d.ts +14 -0
- package/dist/types/events.js +17 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/express.d.mts +10 -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.mts +79 -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.mts +14 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.js +33 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/options.d.mts +14 -0
- package/dist/types/options.d.ts +14 -0
- package/dist/types/options.js +17 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/utils.d.mts +48 -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.mts +4 -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.mts +5 -0
- package/dist/utils/fns/index.d.ts +5 -0
- package/dist/utils/fns/index.js +29 -0
- package/dist/utils/fns/index.js.map +1 -0
- package/dist/utils/fns/others.d.mts +17 -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.mts +39 -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.mts +45 -0
- package/dist/utils/fns/statuses.d.ts +45 -0
- package/dist/utils/fns/statuses.js +39 -0
- package/dist/utils/fns/statuses.js.map +1 -0
- package/dist/utils/fns/text.d.mts +9 -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.mts +19 -0
- package/dist/utils/index.d.ts +19 -0
- package/dist/utils/index.js +25 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/wrappers.d.mts +14 -0
- package/dist/utils/wrappers.d.ts +14 -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 +60 -39
- 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
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as _homer0_jimple from '@homer0/jimple';
|
|
2
|
+
import { J as Jimpex, R as MiddlewareConnectFn } from '../../index-efeb437e.js';
|
|
3
|
+
import { AsyncExpressMiddleware } from '../../types/express.mjs';
|
|
4
|
+
import { SendFile } from '../../services/common/sendFile.mjs';
|
|
5
|
+
import { HTMLGenerator } from '../../services/html/htmlGenerator.mjs';
|
|
6
|
+
import { Response, NextFunction } from 'express';
|
|
7
|
+
import '../../types/http.mjs';
|
|
8
|
+
import 'https';
|
|
9
|
+
import 'http';
|
|
10
|
+
import 'spdy';
|
|
11
|
+
import 'node-fetch';
|
|
12
|
+
import '../../types/utils.mjs';
|
|
13
|
+
import '@homer0/path-utils';
|
|
14
|
+
import '@homer0/simple-logger';
|
|
15
|
+
import '@homer0/simple-config';
|
|
16
|
+
import '@homer0/events-hub';
|
|
17
|
+
import '../../services/frontend/frontendFs.mjs';
|
|
18
|
+
import 'fs/promises';
|
|
19
|
+
import '@homer0/deferred';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The options to customize the behavior of the middleware.
|
|
23
|
+
*
|
|
24
|
+
* @group Middlewares/ShowHTML
|
|
25
|
+
*/
|
|
26
|
+
type ShowHTMLOptions = {
|
|
27
|
+
/**
|
|
28
|
+
* The name of the file the middleware will serve. If the {@link HTMLGenerator} service
|
|
29
|
+
* is available, it will be overriden by the service.
|
|
30
|
+
*
|
|
31
|
+
* @default 'index.html'
|
|
32
|
+
*/
|
|
33
|
+
file: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The options to construct a {@link ShowHTML}.
|
|
37
|
+
*
|
|
38
|
+
* @group Middlewares/ShowHTML
|
|
39
|
+
*/
|
|
40
|
+
type ShowHTMLConstructorOptions = Partial<ShowHTMLOptions> & {
|
|
41
|
+
/**
|
|
42
|
+
* A dictionary with the dependencies to inject.
|
|
43
|
+
*/
|
|
44
|
+
inject: {
|
|
45
|
+
sendFile: SendFile;
|
|
46
|
+
/**
|
|
47
|
+
* A function to get a possible {@link HTMLGenerator}. This is injected as a "getter"
|
|
48
|
+
* to not interrupt the DIC "lifecycle": middlewares are initialized right when the
|
|
49
|
+
* app starts, and injecting a reference would force the service to be initialized
|
|
50
|
+
* too, even if a request is not being made.
|
|
51
|
+
*/
|
|
52
|
+
getHTMLGenerator?: () => HTMLGenerator | undefined;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* The options for the middleware creator that will mount an instance of {@link ShowHTML}.
|
|
57
|
+
*
|
|
58
|
+
* @group Middlewares/ShowHTML
|
|
59
|
+
*/
|
|
60
|
+
type ShowHTMLMiddlewareOptions = Partial<ShowHTMLOptions> & {
|
|
61
|
+
/**
|
|
62
|
+
* The name of an {@link HTMLGenerator} service already available in the application.
|
|
63
|
+
*
|
|
64
|
+
* @default 'htmlGenerator'
|
|
65
|
+
*/
|
|
66
|
+
htmlGeneratorServiceName?: string;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* A very simple middleware service to send an HTML on a server response. The special
|
|
70
|
+
* _'feature'_ of this service is that it can be hooked up to an {@link HTMLGenerator}
|
|
71
|
+
* service and it will automatically server the file generated by it.
|
|
72
|
+
*
|
|
73
|
+
* @group Middleware Classes
|
|
74
|
+
* @group Middlewares/ShowHTML
|
|
75
|
+
* @prettierignore
|
|
76
|
+
*/
|
|
77
|
+
declare class ShowHTML {
|
|
78
|
+
/**
|
|
79
|
+
* The service that serves a file.
|
|
80
|
+
*/
|
|
81
|
+
protected readonly _sendFile: SendFile;
|
|
82
|
+
/**
|
|
83
|
+
* A function to get a possible {@link HTMLGenerator}. This is injected as a "getter"
|
|
84
|
+
* to not interrupt the DIC "lifecycle": middlewares are initialized right when the
|
|
85
|
+
* app starts, and injecting a reference would force the service to be initialized
|
|
86
|
+
* too, even if a request is not being made.
|
|
87
|
+
*/
|
|
88
|
+
protected readonly _getHTMLGenerator: () => HTMLGenerator | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* The customization options for the middleware.
|
|
91
|
+
*/
|
|
92
|
+
protected _options: ShowHTMLOptions;
|
|
93
|
+
/**
|
|
94
|
+
* Whether or not the file is ready to be served. In case the middleware uses an
|
|
95
|
+
* {@link HTMLGenerator} service, the file needs to be generated before being available,
|
|
96
|
+
* and that's why this flag exists.
|
|
97
|
+
*/
|
|
98
|
+
protected _fileReady: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* @param options The options to construct the class.
|
|
101
|
+
*/
|
|
102
|
+
constructor({ inject, ...options }: ShowHTMLConstructorOptions);
|
|
103
|
+
/**
|
|
104
|
+
* Generates the middleware that serves the HTML file.
|
|
105
|
+
*/
|
|
106
|
+
getMiddleware(): AsyncExpressMiddleware;
|
|
107
|
+
/**
|
|
108
|
+
* The customization options.
|
|
109
|
+
*/
|
|
110
|
+
get options(): Readonly<ShowHTMLOptions>;
|
|
111
|
+
/**
|
|
112
|
+
* Serves the HTML file to the response.
|
|
113
|
+
*
|
|
114
|
+
* @param res The response object generated by the application.
|
|
115
|
+
* @param next The function to call the next middleware.
|
|
116
|
+
*/
|
|
117
|
+
protected _sendResponse(res: Response, next: NextFunction): void;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Creates the middleware that serves an HTML file in the response.
|
|
121
|
+
*
|
|
122
|
+
* @group Middlewares
|
|
123
|
+
* @group Middlewares/ShowHTML
|
|
124
|
+
*/
|
|
125
|
+
declare const showHTMLMiddleware: _homer0_jimple.ResourceCreator<"middleware", "connect", (options?: ShowHTMLMiddlewareOptions) => <ContainerType extends Jimpex = Jimpex>(app: ContainerType) => AsyncExpressMiddleware, MiddlewareConnectFn>;
|
|
126
|
+
|
|
127
|
+
export { ShowHTML, ShowHTMLConstructorOptions, ShowHTMLMiddlewareOptions, ShowHTMLOptions, showHTMLMiddleware };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as _homer0_jimple from '@homer0/jimple';
|
|
2
|
+
import { J as Jimpex, R as MiddlewareConnectFn } from '../../index-b2a04c78.js';
|
|
3
|
+
import { AsyncExpressMiddleware } from '../../types/express.js';
|
|
4
|
+
import { SendFile } from '../../services/common/sendFile.js';
|
|
5
|
+
import { HTMLGenerator } from '../../services/html/htmlGenerator.js';
|
|
6
|
+
import { Response, NextFunction } from 'express';
|
|
7
|
+
import '../../types/http.js';
|
|
8
|
+
import 'https';
|
|
9
|
+
import 'http';
|
|
10
|
+
import 'spdy';
|
|
11
|
+
import 'node-fetch';
|
|
12
|
+
import '../../types/utils.js';
|
|
13
|
+
import '@homer0/path-utils';
|
|
14
|
+
import '@homer0/simple-logger';
|
|
15
|
+
import '@homer0/simple-config';
|
|
16
|
+
import '@homer0/events-hub';
|
|
17
|
+
import '../../services/frontend/frontendFs.js';
|
|
18
|
+
import 'fs/promises';
|
|
19
|
+
import '@homer0/deferred';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The options to customize the behavior of the middleware.
|
|
23
|
+
*
|
|
24
|
+
* @group Middlewares/ShowHTML
|
|
25
|
+
*/
|
|
26
|
+
type ShowHTMLOptions = {
|
|
27
|
+
/**
|
|
28
|
+
* The name of the file the middleware will serve. If the {@link HTMLGenerator} service
|
|
29
|
+
* is available, it will be overriden by the service.
|
|
30
|
+
*
|
|
31
|
+
* @default 'index.html'
|
|
32
|
+
*/
|
|
33
|
+
file: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The options to construct a {@link ShowHTML}.
|
|
37
|
+
*
|
|
38
|
+
* @group Middlewares/ShowHTML
|
|
39
|
+
*/
|
|
40
|
+
type ShowHTMLConstructorOptions = Partial<ShowHTMLOptions> & {
|
|
41
|
+
/**
|
|
42
|
+
* A dictionary with the dependencies to inject.
|
|
43
|
+
*/
|
|
44
|
+
inject: {
|
|
45
|
+
sendFile: SendFile;
|
|
46
|
+
/**
|
|
47
|
+
* A function to get a possible {@link HTMLGenerator}. This is injected as a "getter"
|
|
48
|
+
* to not interrupt the DIC "lifecycle": middlewares are initialized right when the
|
|
49
|
+
* app starts, and injecting a reference would force the service to be initialized
|
|
50
|
+
* too, even if a request is not being made.
|
|
51
|
+
*/
|
|
52
|
+
getHTMLGenerator?: () => HTMLGenerator | undefined;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* The options for the middleware creator that will mount an instance of {@link ShowHTML}.
|
|
57
|
+
*
|
|
58
|
+
* @group Middlewares/ShowHTML
|
|
59
|
+
*/
|
|
60
|
+
type ShowHTMLMiddlewareOptions = Partial<ShowHTMLOptions> & {
|
|
61
|
+
/**
|
|
62
|
+
* The name of an {@link HTMLGenerator} service already available in the application.
|
|
63
|
+
*
|
|
64
|
+
* @default 'htmlGenerator'
|
|
65
|
+
*/
|
|
66
|
+
htmlGeneratorServiceName?: string;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* A very simple middleware service to send an HTML on a server response. The special
|
|
70
|
+
* _'feature'_ of this service is that it can be hooked up to an {@link HTMLGenerator}
|
|
71
|
+
* service and it will automatically server the file generated by it.
|
|
72
|
+
*
|
|
73
|
+
* @group Middleware Classes
|
|
74
|
+
* @group Middlewares/ShowHTML
|
|
75
|
+
* @prettierignore
|
|
76
|
+
*/
|
|
77
|
+
declare class ShowHTML {
|
|
78
|
+
/**
|
|
79
|
+
* The service that serves a file.
|
|
80
|
+
*/
|
|
81
|
+
protected readonly _sendFile: SendFile;
|
|
82
|
+
/**
|
|
83
|
+
* A function to get a possible {@link HTMLGenerator}. This is injected as a "getter"
|
|
84
|
+
* to not interrupt the DIC "lifecycle": middlewares are initialized right when the
|
|
85
|
+
* app starts, and injecting a reference would force the service to be initialized
|
|
86
|
+
* too, even if a request is not being made.
|
|
87
|
+
*/
|
|
88
|
+
protected readonly _getHTMLGenerator: () => HTMLGenerator | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* The customization options for the middleware.
|
|
91
|
+
*/
|
|
92
|
+
protected _options: ShowHTMLOptions;
|
|
93
|
+
/**
|
|
94
|
+
* Whether or not the file is ready to be served. In case the middleware uses an
|
|
95
|
+
* {@link HTMLGenerator} service, the file needs to be generated before being available,
|
|
96
|
+
* and that's why this flag exists.
|
|
97
|
+
*/
|
|
98
|
+
protected _fileReady: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* @param options The options to construct the class.
|
|
101
|
+
*/
|
|
102
|
+
constructor({ inject, ...options }: ShowHTMLConstructorOptions);
|
|
103
|
+
/**
|
|
104
|
+
* Generates the middleware that serves the HTML file.
|
|
105
|
+
*/
|
|
106
|
+
getMiddleware(): AsyncExpressMiddleware;
|
|
107
|
+
/**
|
|
108
|
+
* The customization options.
|
|
109
|
+
*/
|
|
110
|
+
get options(): Readonly<ShowHTMLOptions>;
|
|
111
|
+
/**
|
|
112
|
+
* Serves the HTML file to the response.
|
|
113
|
+
*
|
|
114
|
+
* @param res The response object generated by the application.
|
|
115
|
+
* @param next The function to call the next middleware.
|
|
116
|
+
*/
|
|
117
|
+
protected _sendResponse(res: Response, next: NextFunction): void;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Creates the middleware that serves an HTML file in the response.
|
|
121
|
+
*
|
|
122
|
+
* @group Middlewares
|
|
123
|
+
* @group Middlewares/ShowHTML
|
|
124
|
+
*/
|
|
125
|
+
declare const showHTMLMiddleware: _homer0_jimple.ResourceCreator<"middleware", "connect", (options?: ShowHTMLMiddlewareOptions) => <ContainerType extends Jimpex = Jimpex>(app: ContainerType) => AsyncExpressMiddleware, MiddlewareConnectFn>;
|
|
126
|
+
|
|
127
|
+
export { ShowHTML, ShowHTMLConstructorOptions, ShowHTMLMiddlewareOptions, ShowHTMLOptions, showHTMLMiddleware };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var __publicField = (obj, key, value) => {
|
|
21
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
22
|
+
return value;
|
|
23
|
+
};
|
|
24
|
+
var showHTML_exports = {};
|
|
25
|
+
__export(showHTML_exports, {
|
|
26
|
+
ShowHTML: () => ShowHTML,
|
|
27
|
+
showHTMLMiddleware: () => showHTMLMiddleware
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(showHTML_exports);
|
|
30
|
+
var import_utils = require("../../utils");
|
|
31
|
+
class ShowHTML {
|
|
32
|
+
/**
|
|
33
|
+
* @param options The options to construct the class.
|
|
34
|
+
*/
|
|
35
|
+
constructor({ inject, ...options }) {
|
|
36
|
+
/**
|
|
37
|
+
* The service that serves a file.
|
|
38
|
+
*/
|
|
39
|
+
__publicField(this, "_sendFile");
|
|
40
|
+
/**
|
|
41
|
+
* A function to get a possible {@link HTMLGenerator}. This is injected as a "getter"
|
|
42
|
+
* to not interrupt the DIC "lifecycle": middlewares are initialized right when the
|
|
43
|
+
* app starts, and injecting a reference would force the service to be initialized
|
|
44
|
+
* too, even if a request is not being made.
|
|
45
|
+
*/
|
|
46
|
+
__publicField(this, "_getHTMLGenerator");
|
|
47
|
+
/**
|
|
48
|
+
* The customization options for the middleware.
|
|
49
|
+
*/
|
|
50
|
+
__publicField(this, "_options");
|
|
51
|
+
/**
|
|
52
|
+
* Whether or not the file is ready to be served. In case the middleware uses an
|
|
53
|
+
* {@link HTMLGenerator} service, the file needs to be generated before being available,
|
|
54
|
+
* and that's why this flag exists.
|
|
55
|
+
*/
|
|
56
|
+
__publicField(this, "_fileReady", false);
|
|
57
|
+
this._sendFile = inject.sendFile;
|
|
58
|
+
this._getHTMLGenerator = inject.getHTMLGenerator || (() => void 0);
|
|
59
|
+
this._options = {
|
|
60
|
+
file: "index.html",
|
|
61
|
+
...options
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Generates the middleware that serves the HTML file.
|
|
66
|
+
*/
|
|
67
|
+
getMiddleware() {
|
|
68
|
+
return async (_, res, next) => {
|
|
69
|
+
if (this._fileReady) {
|
|
70
|
+
this._sendResponse(res, next);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const htmlGenerator = this._getHTMLGenerator();
|
|
74
|
+
if (!htmlGenerator) {
|
|
75
|
+
this._fileReady = true;
|
|
76
|
+
this._sendResponse(res, next);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
await htmlGenerator.whenReady();
|
|
81
|
+
this._options.file = htmlGenerator.options.file;
|
|
82
|
+
this._fileReady = true;
|
|
83
|
+
this._sendResponse(res, next);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
next(error);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The customization options.
|
|
91
|
+
*/
|
|
92
|
+
get options() {
|
|
93
|
+
return { ...this._options };
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Serves the HTML file to the response.
|
|
97
|
+
*
|
|
98
|
+
* @param res The response object generated by the application.
|
|
99
|
+
* @param next The function to call the next middleware.
|
|
100
|
+
*/
|
|
101
|
+
_sendResponse(res, next) {
|
|
102
|
+
res.setHeader("Content-Type", "text/html");
|
|
103
|
+
this._sendFile({
|
|
104
|
+
res,
|
|
105
|
+
next,
|
|
106
|
+
filepath: this._options.file
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const showHTMLMiddleware = (0, import_utils.middlewareCreator)(
|
|
111
|
+
(options = {}) => (app) => {
|
|
112
|
+
const { htmlGeneratorServiceName = "htmlGenerator", ...rest } = options;
|
|
113
|
+
return new ShowHTML({
|
|
114
|
+
inject: {
|
|
115
|
+
sendFile: app.get("sendFile"),
|
|
116
|
+
getHTMLGenerator: () => app.try(htmlGeneratorServiceName)
|
|
117
|
+
},
|
|
118
|
+
...rest
|
|
119
|
+
}).getMiddleware();
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
123
|
+
0 && (module.exports = {
|
|
124
|
+
ShowHTML,
|
|
125
|
+
showHTMLMiddleware
|
|
126
|
+
});
|
|
127
|
+
//# sourceMappingURL=showHTML.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/middlewares/html/showHTML.ts"],"sourcesContent":["import { middlewareCreator } from '../../utils';\nimport type { HTMLGenerator, SendFile } from '../../services';\nimport type { AsyncExpressMiddleware, Response, NextFunction } from '../../types';\n/**\n * The options to customize the behavior of the middleware.\n *\n * @group Middlewares/ShowHTML\n */\nexport type ShowHTMLOptions = {\n /**\n * The name of the file the middleware will serve. If the {@link HTMLGenerator} service\n * is available, it will be overriden by the service.\n *\n * @default 'index.html'\n */\n file: string;\n};\n/**\n * The options to construct a {@link ShowHTML}.\n *\n * @group Middlewares/ShowHTML\n */\nexport type ShowHTMLConstructorOptions = Partial<ShowHTMLOptions> & {\n /**\n * A dictionary with the dependencies to inject.\n */\n inject: {\n sendFile: SendFile;\n /**\n * A function to get a possible {@link HTMLGenerator}. This is injected as a \"getter\"\n * to not interrupt the DIC \"lifecycle\": middlewares are initialized right when the\n * app starts, and injecting a reference would force the service to be initialized\n * too, even if a request is not being made.\n */\n getHTMLGenerator?: () => HTMLGenerator | undefined;\n };\n};\n/**\n * The options for the middleware creator that will mount an instance of {@link ShowHTML}.\n *\n * @group Middlewares/ShowHTML\n */\nexport type ShowHTMLMiddlewareOptions = Partial<ShowHTMLOptions> & {\n /**\n * The name of an {@link HTMLGenerator} service already available in the application.\n *\n * @default 'htmlGenerator'\n */\n htmlGeneratorServiceName?: string;\n};\n\n/**\n * A very simple middleware service to send an HTML on a server response. The special\n * _'feature'_ of this service is that it can be hooked up to an {@link HTMLGenerator}\n * service and it will automatically server the file generated by it.\n *\n * @group Middleware Classes\n * @group Middlewares/ShowHTML\n * @prettierignore\n */\nexport class ShowHTML {\n /**\n * The service that serves a file.\n */\n protected readonly _sendFile: SendFile;\n /**\n * A function to get a possible {@link HTMLGenerator}. This is injected as a \"getter\"\n * to not interrupt the DIC \"lifecycle\": middlewares are initialized right when the\n * app starts, and injecting a reference would force the service to be initialized\n * too, even if a request is not being made.\n */\n protected readonly _getHTMLGenerator: () => HTMLGenerator | undefined;\n /**\n * The customization options for the middleware.\n */\n protected _options: ShowHTMLOptions;\n /**\n * Whether or not the file is ready to be served. In case the middleware uses an\n * {@link HTMLGenerator} service, the file needs to be generated before being available,\n * and that's why this flag exists.\n */\n protected _fileReady: boolean = false;\n /**\n * @param options The options to construct the class.\n */\n constructor({ inject, ...options }: ShowHTMLConstructorOptions) {\n this._sendFile = inject.sendFile;\n this._getHTMLGenerator = inject.getHTMLGenerator || (() => undefined);\n this._options = {\n file: 'index.html',\n ...options,\n };\n }\n /**\n * Generates the middleware that serves the HTML file.\n */\n getMiddleware(): AsyncExpressMiddleware {\n return async (_, res, next) => {\n // If the file is ready to be served, serve it.\n if (this._fileReady) {\n this._sendResponse(res, next);\n return;\n }\n\n const htmlGenerator = this._getHTMLGenerator();\n // If there's no generator, switch the flag and just serve the file.\n if (!htmlGenerator) {\n this._fileReady = true;\n this._sendResponse(res, next);\n return;\n }\n\n try {\n // Wait for the HTML to be generated.\n await htmlGenerator.whenReady();\n // Update the local option.\n this._options.file = htmlGenerator.options.file;\n // Switch the flag and serve the file.\n this._fileReady = true;\n this._sendResponse(res, next);\n } catch (error) {\n next(error);\n }\n };\n }\n /**\n * The customization options.\n */\n get options(): Readonly<ShowHTMLOptions> {\n return { ...this._options };\n }\n /**\n * Serves the HTML file to the response.\n *\n * @param res The response object generated by the application.\n * @param next The function to call the next middleware.\n */\n protected _sendResponse(res: Response, next: NextFunction): void {\n res.setHeader('Content-Type', 'text/html');\n this._sendFile({\n res,\n next,\n filepath: this._options.file,\n });\n }\n}\n/**\n * Creates the middleware that serves an HTML file in the response.\n *\n * @group Middlewares\n * @group Middlewares/ShowHTML\n */\nexport const showHTMLMiddleware = middlewareCreator(\n (options: ShowHTMLMiddlewareOptions = {}) =>\n (app) => {\n const { htmlGeneratorServiceName = 'htmlGenerator', ...rest } = options;\n return new ShowHTML({\n inject: {\n sendFile: app.get('sendFile'),\n getHTMLGenerator: () => app.try(htmlGeneratorServiceName),\n },\n ...rest,\n }).getMiddleware();\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkC;AA4D3B,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA,EAyBpB,YAAY,EAAE,QAAQ,GAAG,QAAQ,GAA+B;AArBhE;AAAA;AAAA;AAAA,wBAAmB;AAOnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAmB;AAInB;AAAA;AAAA;AAAA,wBAAU;AAMV;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAU,cAAsB;AAK9B,SAAK,YAAY,OAAO;AACxB,SAAK,oBAAoB,OAAO,qBAAqB,MAAM;AAC3D,SAAK,WAAW;AAAA,MACd,MAAM;AAAA,MACN,GAAG;AAAA,IACL;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAIA,gBAAwC;AACtC,WAAO,OAAO,GAAG,KAAK,SAAS;AAE7B,UAAI,KAAK,YAAY;AACnB,aAAK,cAAc,KAAK,IAAI;AAC5B;AAAA,MACF;AAEA,YAAM,gBAAgB,KAAK,kBAAkB;AAE7C,UAAI,CAAC,eAAe;AAClB,aAAK,aAAa;AAClB,aAAK,cAAc,KAAK,IAAI;AAC5B;AAAA,MACF;AAEA,UAAI;AAEF,cAAM,cAAc,UAAU;AAE9B,aAAK,SAAS,OAAO,cAAc,QAAQ;AAE3C,aAAK,aAAa;AAClB,aAAK,cAAc,KAAK,IAAI;AAAA,MAC9B,SAAS,OAAO;AACd,aAAK,KAAK;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAIA,IAAI,UAAqC;AACvC,WAAO,EAAE,GAAG,KAAK,SAAS;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOU,cAAc,KAAe,MAA0B;AAC/D,QAAI,UAAU,gBAAgB,WAAW;AACzC,SAAK,UAAU;AAAA,MACb;AAAA,MACA;AAAA,MACA,UAAU,KAAK,SAAS;AAAA,IAC1B,CAAC;AAAA,EACH;AACF;AAOO,MAAM,yBAAqB;AAAA,EAChC,CAAC,UAAqC,CAAC,MACrC,CAAC,QAAQ;AACP,UAAM,EAAE,2BAA2B,iBAAiB,GAAG,KAAK,IAAI;AAChE,WAAO,IAAI,SAAS;AAAA,MAClB,QAAQ;AAAA,QACN,UAAU,IAAI,IAAI,UAAU;AAAA,QAC5B,kBAAkB,MAAM,IAAI,IAAI,wBAAwB;AAAA,MAC1D;AAAA,MACA,GAAG;AAAA,IACL,CAAC,EAAE,cAAc;AAAA,EACnB;AACJ;","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { ErrorHandler, ErrorHandlerConstructorOptions, ErrorHandlerOptions, ErrorHandlerPartialOptions, ErrorHandlerResponseOptions, errorHandlerMiddleware } from './common/errorHandler.mjs';
|
|
2
|
+
export { ForceHTTPS, ForceHTTPSOptions, ForceHTTPSPartialOptions, forceHTTPSMiddleware } from './common/forceHTTPS.mjs';
|
|
3
|
+
export { HSTS, HSTSMiddlewareOptions, HSTSMiddlewarePartialOptions, HSTSMiddlewareSettings, hstsMiddleware } from './common/hsts.mjs';
|
|
4
|
+
export { FastHTML, FastHTMLConstructorOptions, FastHTMLMiddlewareOptions, FastHTMLOptions, fastHTMLMiddleware } from './html/fastHTML.mjs';
|
|
5
|
+
export { ShowHTML, ShowHTMLConstructorOptions, ShowHTMLMiddlewareOptions, ShowHTMLOptions, showHTMLMiddleware } from './html/showHTML.mjs';
|
|
6
|
+
export { VersionValidator, VersionValidatorConstructorOptions, VersionValidatorLatestOptions, VersionValidatorMiddlewareOptions, VersionValidatorOptions, VersionValidatorPartialOptions, VersionValidatorPopupOptions, versionValidatorMiddleware } from './utils/versionValidator.mjs';
|
|
7
|
+
import '@homer0/jimple';
|
|
8
|
+
import '../utils/fns/statuses.mjs';
|
|
9
|
+
import 'statuses';
|
|
10
|
+
import '../index-efeb437e.js';
|
|
11
|
+
import '../types/express.mjs';
|
|
12
|
+
import 'express';
|
|
13
|
+
import '../types/http.mjs';
|
|
14
|
+
import 'https';
|
|
15
|
+
import 'http';
|
|
16
|
+
import 'spdy';
|
|
17
|
+
import 'node-fetch';
|
|
18
|
+
import '../types/utils.mjs';
|
|
19
|
+
import '@homer0/path-utils';
|
|
20
|
+
import '@homer0/simple-logger';
|
|
21
|
+
import '@homer0/simple-config';
|
|
22
|
+
import '@homer0/events-hub';
|
|
23
|
+
import '../services/common/httpError.mjs';
|
|
24
|
+
import '../services/common/appError.mjs';
|
|
25
|
+
import '../services/http/responsesBuilder.mjs';
|
|
26
|
+
import '../services/common/sendFile.mjs';
|
|
27
|
+
import '../services/html/htmlGenerator.mjs';
|
|
28
|
+
import '../services/frontend/frontendFs.mjs';
|
|
29
|
+
import 'fs/promises';
|
|
30
|
+
import '@homer0/deferred';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { ErrorHandler, ErrorHandlerConstructorOptions, ErrorHandlerOptions, ErrorHandlerPartialOptions, ErrorHandlerResponseOptions, errorHandlerMiddleware } from './common/errorHandler.js';
|
|
2
|
+
export { ForceHTTPS, ForceHTTPSOptions, ForceHTTPSPartialOptions, forceHTTPSMiddleware } from './common/forceHTTPS.js';
|
|
3
|
+
export { HSTS, HSTSMiddlewareOptions, HSTSMiddlewarePartialOptions, HSTSMiddlewareSettings, hstsMiddleware } from './common/hsts.js';
|
|
4
|
+
export { FastHTML, FastHTMLConstructorOptions, FastHTMLMiddlewareOptions, FastHTMLOptions, fastHTMLMiddleware } from './html/fastHTML.js';
|
|
5
|
+
export { ShowHTML, ShowHTMLConstructorOptions, ShowHTMLMiddlewareOptions, ShowHTMLOptions, showHTMLMiddleware } from './html/showHTML.js';
|
|
6
|
+
export { VersionValidator, VersionValidatorConstructorOptions, VersionValidatorLatestOptions, VersionValidatorMiddlewareOptions, VersionValidatorOptions, VersionValidatorPartialOptions, VersionValidatorPopupOptions, versionValidatorMiddleware } from './utils/versionValidator.js';
|
|
7
|
+
import '@homer0/jimple';
|
|
8
|
+
import '../utils/fns/statuses.js';
|
|
9
|
+
import 'statuses';
|
|
10
|
+
import '../index-b2a04c78.js';
|
|
11
|
+
import '../types/express.js';
|
|
12
|
+
import 'express';
|
|
13
|
+
import '../types/http.js';
|
|
14
|
+
import 'https';
|
|
15
|
+
import 'http';
|
|
16
|
+
import 'spdy';
|
|
17
|
+
import 'node-fetch';
|
|
18
|
+
import '../types/utils.js';
|
|
19
|
+
import '@homer0/path-utils';
|
|
20
|
+
import '@homer0/simple-logger';
|
|
21
|
+
import '@homer0/simple-config';
|
|
22
|
+
import '@homer0/events-hub';
|
|
23
|
+
import '../services/common/httpError.js';
|
|
24
|
+
import '../services/common/appError.js';
|
|
25
|
+
import '../services/http/responsesBuilder.js';
|
|
26
|
+
import '../services/common/sendFile.js';
|
|
27
|
+
import '../services/html/htmlGenerator.js';
|
|
28
|
+
import '../services/frontend/frontendFs.js';
|
|
29
|
+
import 'fs/promises';
|
|
30
|
+
import '@homer0/deferred';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var middlewares_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(middlewares_exports);
|
|
18
|
+
__reExport(middlewares_exports, require("./common"), module.exports);
|
|
19
|
+
__reExport(middlewares_exports, require("./html"), module.exports);
|
|
20
|
+
__reExport(middlewares_exports, require("./utils"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("./common"),
|
|
24
|
+
...require("./html"),
|
|
25
|
+
...require("./utils")
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/middlewares/index.ts"],"sourcesContent":["export * from './common';\nexport * from './html';\nexport * from './utils';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,gCAAc,qBAAd;AACA,gCAAc,mBADd;AAEA,gCAAc,oBAFd;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { VersionValidator, VersionValidatorConstructorOptions, VersionValidatorLatestOptions, VersionValidatorMiddlewareOptions, VersionValidatorOptions, VersionValidatorPartialOptions, VersionValidatorPopupOptions, versionValidatorMiddleware } from './versionValidator.mjs';
|
|
2
|
+
import '@homer0/jimple';
|
|
3
|
+
import '../../utils/fns/statuses.mjs';
|
|
4
|
+
import 'statuses';
|
|
5
|
+
import '../../index-efeb437e.js';
|
|
6
|
+
import '../../types/express.mjs';
|
|
7
|
+
import 'express';
|
|
8
|
+
import '../../types/http.mjs';
|
|
9
|
+
import 'https';
|
|
10
|
+
import 'http';
|
|
11
|
+
import 'spdy';
|
|
12
|
+
import 'node-fetch';
|
|
13
|
+
import '../../types/utils.mjs';
|
|
14
|
+
import '@homer0/path-utils';
|
|
15
|
+
import '@homer0/simple-logger';
|
|
16
|
+
import '@homer0/simple-config';
|
|
17
|
+
import '@homer0/events-hub';
|
|
18
|
+
import '../../services/common/httpError.mjs';
|
|
19
|
+
import '../../services/common/appError.mjs';
|
|
20
|
+
import '../../services/http/responsesBuilder.mjs';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { VersionValidator, VersionValidatorConstructorOptions, VersionValidatorLatestOptions, VersionValidatorMiddlewareOptions, VersionValidatorOptions, VersionValidatorPartialOptions, VersionValidatorPopupOptions, versionValidatorMiddleware } from './versionValidator.js';
|
|
2
|
+
import '@homer0/jimple';
|
|
3
|
+
import '../../utils/fns/statuses.js';
|
|
4
|
+
import 'statuses';
|
|
5
|
+
import '../../index-b2a04c78.js';
|
|
6
|
+
import '../../types/express.js';
|
|
7
|
+
import 'express';
|
|
8
|
+
import '../../types/http.js';
|
|
9
|
+
import 'https';
|
|
10
|
+
import 'http';
|
|
11
|
+
import 'spdy';
|
|
12
|
+
import 'node-fetch';
|
|
13
|
+
import '../../types/utils.js';
|
|
14
|
+
import '@homer0/path-utils';
|
|
15
|
+
import '@homer0/simple-logger';
|
|
16
|
+
import '@homer0/simple-config';
|
|
17
|
+
import '@homer0/events-hub';
|
|
18
|
+
import '../../services/common/httpError.js';
|
|
19
|
+
import '../../services/common/appError.js';
|
|
20
|
+
import '../../services/http/responsesBuilder.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var utils_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(utils_exports);
|
|
18
|
+
__reExport(utils_exports, require("./versionValidator"), module.exports);
|
|
19
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require("./versionValidator")
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/middlewares/utils/index.ts"],"sourcesContent":["export * from './versionValidator';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,+BAAd;","names":[]}
|