jimpex 10.0.2 → 11.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 +29 -0
- package/README.md +7 -9
- package/dist/app/index.d.ts +1 -1
- package/dist/app/index.js +1 -22
- package/dist/app/index.js.map +1 -1
- package/dist/app/jimpex.d.ts +1 -1
- package/dist/app/jimpex.js +100 -131
- package/dist/app/jimpex.js.map +1 -1
- package/dist/controllers/common/config.d.ts +2 -2
- package/dist/controllers/common/config.js +12 -39
- package/dist/controllers/common/config.js.map +1 -1
- package/dist/controllers/common/health.d.ts +4 -4
- package/dist/controllers/common/health.js +20 -47
- package/dist/controllers/common/health.js.map +1 -1
- package/dist/controllers/common/index.d.ts +1 -1
- package/dist/controllers/common/index.js +3 -26
- package/dist/controllers/common/index.js.map +1 -1
- package/dist/controllers/common/statics.d.ts +3 -3
- package/dist/controllers/common/statics.js +32 -65
- package/dist/controllers/common/statics.js.map +1 -1
- package/dist/controllers/index.d.ts +1 -1
- package/dist/controllers/index.js +2 -24
- package/dist/controllers/index.js.map +1 -1
- package/dist/controllers/utils/gateway.d.ts +5 -5
- package/dist/controllers/utils/gateway.js +70 -91
- package/dist/controllers/utils/gateway.js.map +1 -1
- package/dist/controllers/utils/index.d.ts +1 -1
- package/dist/controllers/utils/index.js +1 -22
- package/dist/controllers/utils/index.js.map +1 -1
- package/dist/{index-C6I3NCC-.d.ts → index-BlSpNHox.d.ts} +13 -13
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -32
- package/dist/index.js.map +1 -1
- package/dist/middlewares/common/errorHandler.d.ts +5 -5
- package/dist/middlewares/common/errorHandler.js +31 -56
- package/dist/middlewares/common/errorHandler.js.map +1 -1
- package/dist/middlewares/common/forceHTTPS.d.ts +1 -1
- package/dist/middlewares/common/forceHTTPS.js +8 -35
- package/dist/middlewares/common/forceHTTPS.js.map +1 -1
- package/dist/middlewares/common/hsts.d.ts +1 -1
- package/dist/middlewares/common/hsts.js +12 -39
- package/dist/middlewares/common/hsts.js.map +1 -1
- package/dist/middlewares/common/index.d.ts +3 -3
- package/dist/middlewares/common/index.js +3 -26
- package/dist/middlewares/common/index.js.map +1 -1
- package/dist/middlewares/html/fastHTML.d.ts +4 -4
- package/dist/middlewares/html/fastHTML.js +43 -66
- package/dist/middlewares/html/fastHTML.js.map +1 -1
- package/dist/middlewares/html/index.d.ts +2 -2
- package/dist/middlewares/html/index.js +2 -24
- package/dist/middlewares/html/index.js.map +1 -1
- package/dist/middlewares/html/showHTML.d.ts +3 -3
- package/dist/middlewares/html/showHTML.js +25 -52
- package/dist/middlewares/html/showHTML.js.map +1 -1
- package/dist/middlewares/index.d.ts +4 -4
- package/dist/middlewares/index.js +3 -26
- package/dist/middlewares/index.js.map +1 -1
- package/dist/middlewares/utils/index.d.ts +3 -3
- package/dist/middlewares/utils/index.js +1 -22
- package/dist/middlewares/utils/index.js.map +1 -1
- package/dist/middlewares/utils/versionValidator.d.ts +5 -5
- package/dist/middlewares/utils/versionValidator.js +24 -51
- package/dist/middlewares/utils/versionValidator.js.map +1 -1
- package/dist/services/common/appError.d.ts +2 -2
- package/dist/services/common/appError.js +18 -46
- package/dist/services/common/appError.js.map +1 -1
- package/dist/services/common/httpError.d.ts +2 -2
- package/dist/services/common/httpError.js +7 -33
- package/dist/services/common/httpError.js.map +1 -1
- package/dist/services/common/index.d.ts +1 -1
- package/dist/services/common/index.js +14 -42
- package/dist/services/common/index.js.map +1 -1
- package/dist/services/common/sendFile.d.ts +1 -1
- package/dist/services/common/sendFile.js +4 -29
- package/dist/services/common/sendFile.js.map +1 -1
- package/dist/services/frontend/frontendFs.d.ts +2 -2
- package/dist/services/frontend/frontendFs.js +12 -49
- package/dist/services/frontend/frontendFs.js.map +1 -1
- package/dist/services/frontend/index.d.ts +2 -2
- package/dist/services/frontend/index.js +8 -34
- package/dist/services/frontend/index.js.map +1 -1
- package/dist/services/html/htmlGenerator.d.ts +5 -5
- package/dist/services/html/htmlGenerator.js +46 -75
- package/dist/services/html/htmlGenerator.js.map +1 -1
- package/dist/services/html/index.d.ts +2 -2
- package/dist/services/html/index.js +8 -34
- package/dist/services/html/index.js.map +1 -1
- package/dist/services/http/apiClient.d.ts +1 -1
- package/dist/services/http/apiClient.js +23 -48
- package/dist/services/http/apiClient.js.map +1 -1
- package/dist/services/http/http.d.ts +5 -5
- package/dist/services/http/http.js +23 -60
- package/dist/services/http/http.js.map +1 -1
- package/dist/services/http/index.d.ts +2 -2
- package/dist/services/http/index.js +14 -42
- package/dist/services/http/index.js.map +1 -1
- package/dist/services/http/responsesBuilder.d.ts +4 -4
- package/dist/services/http/responsesBuilder.js +13 -40
- package/dist/services/http/responsesBuilder.js.map +1 -1
- package/dist/services/index.d.ts +3 -3
- package/dist/services/index.js +5 -30
- package/dist/services/index.js.map +1 -1
- package/dist/services/utils/ensureBearerToken.d.ts +2 -2
- package/dist/services/utils/ensureBearerToken.js +15 -42
- package/dist/services/utils/ensureBearerToken.js.map +1 -1
- package/dist/services/utils/index.d.ts +1 -1
- package/dist/services/utils/index.js +8 -34
- package/dist/services/utils/index.js.map +1 -1
- package/dist/types/events.d.ts +1 -1
- package/dist/types/events.js +0 -16
- package/dist/types/events.js.map +1 -1
- package/dist/types/express.js +0 -16
- package/dist/types/express.js.map +1 -1
- package/dist/types/http.js +0 -16
- package/dist/types/http.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +6 -32
- package/dist/types/index.js.map +1 -1
- package/dist/types/options.d.ts +1 -1
- package/dist/types/options.js +0 -16
- package/dist/types/options.js.map +1 -1
- package/dist/types/utils.js +0 -16
- package/dist/types/utils.js.map +1 -1
- package/dist/types/wootils.js +0 -16
- package/dist/types/wootils.js.map +1 -1
- package/dist/utils/fns/index.js +4 -28
- package/dist/utils/fns/index.js.map +1 -1
- package/dist/utils/fns/others.js +2 -26
- package/dist/utils/fns/others.js.map +1 -1
- package/dist/utils/fns/routes.js +4 -31
- package/dist/utils/fns/routes.js.map +1 -1
- package/dist/utils/fns/statuses.js +3 -37
- package/dist/utils/fns/statuses.js.map +1 -1
- package/dist/utils/fns/text.js +2 -26
- package/dist/utils/fns/text.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +2 -24
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/wrappers.d.ts +1 -1
- package/dist/utils/wrappers.js +20 -48
- package/dist/utils/wrappers.js.map +1 -1
- package/eslint.config.js +19 -0
- package/examples/basic/app.ts +4 -4
- package/examples/basic/controller.ts +2 -2
- package/examples/basic/index.ts +4 -4
- package/examples/basic/middleware.ts +2 -2
- package/examples/basic/service.ts +1 -1
- package/package.json +61 -49
- package/pnpm-workspace.yaml +4 -0
- package/src/app/index.ts +1 -1
- package/src/app/jimpex.ts +23 -20
- package/src/controllers/common/config.ts +4 -4
- package/src/controllers/common/health.ts +9 -5
- package/src/controllers/common/index.ts +3 -3
- package/src/controllers/common/statics.ts +12 -7
- package/src/controllers/index.ts +2 -2
- package/src/controllers/utils/gateway.ts +8 -8
- package/src/controllers/utils/index.ts +1 -1
- package/src/index.ts +6 -6
- package/src/middlewares/common/errorHandler.ts +9 -5
- package/src/middlewares/common/forceHTTPS.ts +2 -2
- package/src/middlewares/common/hsts.ts +2 -2
- package/src/middlewares/common/index.ts +3 -3
- package/src/middlewares/html/fastHTML.ts +14 -5
- package/src/middlewares/html/index.ts +2 -2
- package/src/middlewares/html/showHTML.ts +8 -4
- package/src/middlewares/index.ts +3 -3
- package/src/middlewares/utils/index.ts +1 -1
- package/src/middlewares/utils/versionValidator.ts +6 -6
- package/src/services/common/appError.ts +1 -1
- package/src/services/common/httpError.ts +2 -2
- package/src/services/common/index.ts +7 -7
- package/src/services/common/sendFile.ts +2 -2
- package/src/services/frontend/frontendFs.ts +3 -3
- package/src/services/frontend/index.ts +3 -3
- package/src/services/html/htmlGenerator.ts +11 -13
- package/src/services/html/index.ts +3 -3
- package/src/services/http/apiClient.ts +3 -3
- package/src/services/http/http.ts +5 -5
- package/src/services/http/index.ts +7 -7
- package/src/services/http/responsesBuilder.ts +5 -5
- package/src/services/index.ts +5 -5
- package/src/services/utils/ensureBearerToken.ts +4 -4
- package/src/services/utils/index.ts +3 -3
- package/src/types/events.ts +8 -8
- package/src/types/http.ts +1 -1
- package/src/types/index.ts +6 -6
- package/src/types/options.ts +2 -2
- package/src/types/utils.ts +4 -4
- package/src/utils/fns/index.ts +4 -4
- package/src/utils/fns/routes.ts +1 -1
- package/src/utils/index.ts +2 -2
- package/src/utils/wrappers.ts +6 -6
- package/tsconfig.json +9 -4
- package/tsup.config.ts +1 -2
- package/vitest.config.ts +24 -0
- package/dist/app/index.d.mts +0 -14
- package/dist/app/jimpex.d.mts +0 -14
- package/dist/controllers/common/config.d.mts +0 -79
- package/dist/controllers/common/health.d.mts +0 -83
- package/dist/controllers/common/index.d.mts +0 -22
- package/dist/controllers/common/statics.d.mts +0 -223
- package/dist/controllers/index.d.mts +0 -25
- package/dist/controllers/utils/gateway.d.mts +0 -725
- package/dist/controllers/utils/index.d.mts +0 -17
- package/dist/esm/app/index.js +0 -2
- package/dist/esm/app/index.js.map +0 -1
- package/dist/esm/app/jimpex.js +0 -640
- package/dist/esm/app/jimpex.js.map +0 -1
- package/dist/esm/chunk-V6TY7KAL.js +0 -8
- package/dist/esm/chunk-V6TY7KAL.js.map +0 -1
- package/dist/esm/controllers/common/config.js +0 -80
- package/dist/esm/controllers/common/config.js.map +0 -1
- package/dist/esm/controllers/common/health.js +0 -88
- package/dist/esm/controllers/common/health.js.map +0 -1
- package/dist/esm/controllers/common/index.js +0 -4
- package/dist/esm/controllers/common/index.js.map +0 -1
- package/dist/esm/controllers/common/statics.js +0 -226
- package/dist/esm/controllers/common/statics.js.map +0 -1
- package/dist/esm/controllers/index.js +0 -3
- package/dist/esm/controllers/index.js.map +0 -1
- package/dist/esm/controllers/utils/gateway.js +0 -559
- package/dist/esm/controllers/utils/gateway.js.map +0 -1
- package/dist/esm/controllers/utils/index.js +0 -2
- package/dist/esm/controllers/utils/index.js.map +0 -1
- package/dist/esm/index.js +0 -7
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/middlewares/common/errorHandler.js +0 -116
- package/dist/esm/middlewares/common/errorHandler.js.map +0 -1
- package/dist/esm/middlewares/common/forceHTTPS.js +0 -52
- package/dist/esm/middlewares/common/forceHTTPS.js.map +0 -1
- package/dist/esm/middlewares/common/hsts.js +0 -74
- package/dist/esm/middlewares/common/hsts.js.map +0 -1
- package/dist/esm/middlewares/common/index.js +0 -4
- package/dist/esm/middlewares/common/index.js.map +0 -1
- package/dist/esm/middlewares/html/fastHTML.js +0 -157
- package/dist/esm/middlewares/html/fastHTML.js.map +0 -1
- package/dist/esm/middlewares/html/index.js +0 -3
- package/dist/esm/middlewares/html/index.js.map +0 -1
- package/dist/esm/middlewares/html/showHTML.js +0 -100
- package/dist/esm/middlewares/html/showHTML.js.map +0 -1
- package/dist/esm/middlewares/index.js +0 -4
- package/dist/esm/middlewares/index.js.map +0 -1
- package/dist/esm/middlewares/utils/index.js +0 -2
- package/dist/esm/middlewares/utils/index.js.map +0 -1
- package/dist/esm/middlewares/utils/versionValidator.js +0 -135
- package/dist/esm/middlewares/utils/versionValidator.js.map +0 -1
- package/dist/esm/services/common/appError.js +0 -98
- package/dist/esm/services/common/appError.js.map +0 -1
- package/dist/esm/services/common/httpError.js +0 -28
- package/dist/esm/services/common/httpError.js.map +0 -1
- package/dist/esm/services/common/index.js +0 -17
- package/dist/esm/services/common/index.js.map +0 -1
- package/dist/esm/services/common/sendFile.js +0 -27
- package/dist/esm/services/common/sendFile.js.map +0 -1
- package/dist/esm/services/frontend/frontendFs.js +0 -66
- package/dist/esm/services/frontend/frontendFs.js.map +0 -1
- package/dist/esm/services/frontend/index.js +0 -11
- package/dist/esm/services/frontend/index.js.map +0 -1
- package/dist/esm/services/html/htmlGenerator.js +0 -192
- package/dist/esm/services/html/htmlGenerator.js.map +0 -1
- package/dist/esm/services/html/index.js +0 -11
- package/dist/esm/services/html/index.js.map +0 -1
- package/dist/esm/services/http/apiClient.js +0 -94
- package/dist/esm/services/http/apiClient.js.map +0 -1
- package/dist/esm/services/http/http.js +0 -180
- package/dist/esm/services/http/http.js.map +0 -1
- package/dist/esm/services/http/index.js +0 -17
- package/dist/esm/services/http/index.js.map +0 -1
- package/dist/esm/services/http/responsesBuilder.js +0 -152
- package/dist/esm/services/http/responsesBuilder.js.map +0 -1
- package/dist/esm/services/index.js +0 -6
- package/dist/esm/services/index.js.map +0 -1
- package/dist/esm/services/utils/ensureBearerToken.js +0 -94
- package/dist/esm/services/utils/ensureBearerToken.js.map +0 -1
- package/dist/esm/services/utils/index.js +0 -11
- package/dist/esm/services/utils/index.js.map +0 -1
- package/dist/esm/types/events.js +0 -1
- package/dist/esm/types/events.js.map +0 -1
- package/dist/esm/types/express.js +0 -1
- package/dist/esm/types/express.js.map +0 -1
- package/dist/esm/types/http.js +0 -1
- package/dist/esm/types/http.js.map +0 -1
- package/dist/esm/types/index.js +0 -7
- package/dist/esm/types/index.js.map +0 -1
- package/dist/esm/types/options.js +0 -1
- package/dist/esm/types/options.js.map +0 -1
- package/dist/esm/types/utils.js +0 -1
- package/dist/esm/types/utils.js.map +0 -1
- package/dist/esm/types/wootils.js +0 -1
- package/dist/esm/types/wootils.js.map +0 -1
- package/dist/esm/utils/fns/index.js +0 -5
- package/dist/esm/utils/fns/index.js.map +0 -1
- package/dist/esm/utils/fns/others.js +0 -6
- package/dist/esm/utils/fns/others.js.map +0 -1
- package/dist/esm/utils/fns/routes.js +0 -25
- package/dist/esm/utils/fns/routes.js.map +0 -1
- package/dist/esm/utils/fns/statuses.js +0 -6
- package/dist/esm/utils/fns/statuses.js.map +0 -1
- package/dist/esm/utils/fns/text.js +0 -6
- package/dist/esm/utils/fns/text.js.map +0 -1
- package/dist/esm/utils/index.js +0 -3
- package/dist/esm/utils/index.js.map +0 -1
- package/dist/esm/utils/wrappers.js +0 -41
- package/dist/esm/utils/wrappers.js.map +0 -1
- package/dist/index-Bwf7JHu9.d.mts +0 -1287
- package/dist/index.d.mts +0 -47
- package/dist/middlewares/common/errorHandler.d.mts +0 -132
- package/dist/middlewares/common/forceHTTPS.d.mts +0 -69
- package/dist/middlewares/common/hsts.d.mts +0 -110
- package/dist/middlewares/common/index.d.mts +0 -22
- package/dist/middlewares/html/fastHTML.d.mts +0 -180
- package/dist/middlewares/html/index.d.mts +0 -21
- package/dist/middlewares/html/showHTML.d.mts +0 -127
- package/dist/middlewares/index.d.mts +0 -30
- package/dist/middlewares/utils/index.d.mts +0 -20
- package/dist/middlewares/utils/versionValidator.d.mts +0 -215
- package/dist/services/common/appError.d.mts +0 -139
- package/dist/services/common/httpError.d.mts +0 -80
- package/dist/services/common/index.d.mts +0 -47
- package/dist/services/common/sendFile.d.mts +0 -102
- package/dist/services/frontend/frontendFs.d.mts +0 -96
- package/dist/services/frontend/index.d.mts +0 -40
- package/dist/services/html/htmlGenerator.d.mts +0 -237
- package/dist/services/html/index.d.mts +0 -43
- package/dist/services/http/apiClient.d.mts +0 -170
- package/dist/services/http/http.d.mts +0 -182
- package/dist/services/http/index.d.mts +0 -51
- package/dist/services/http/responsesBuilder.d.mts +0 -179
- package/dist/services/index.d.mts +0 -33
- package/dist/services/utils/ensureBearerToken.d.mts +0 -158
- package/dist/services/utils/index.d.mts +0 -44
- package/dist/types/events.d.mts +0 -14
- package/dist/types/express.d.mts +0 -10
- package/dist/types/http.d.mts +0 -82
- package/dist/types/index.d.mts +0 -14
- package/dist/types/options.d.mts +0 -14
- package/dist/types/utils.d.mts +0 -48
- package/dist/types/wootils.d.mts +0 -4
- package/dist/utils/fns/index.d.mts +0 -5
- package/dist/utils/fns/others.d.mts +0 -17
- package/dist/utils/fns/routes.d.mts +0 -39
- package/dist/utils/fns/statuses.d.mts +0 -45
- package/dist/utils/fns/text.d.mts +0 -9
- package/dist/utils/index.d.mts +0 -19
- package/dist/utils/wrappers.d.mts +0 -14
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import * as _homer0_jimple from '@homer0/jimple';
|
|
2
|
-
import { J as Jimpex, R as MiddlewareConnectFn } from '../../index-Bwf7JHu9.mjs';
|
|
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, type ShowHTMLConstructorOptions, type ShowHTMLMiddlewareOptions, type ShowHTMLOptions, showHTMLMiddleware };
|
|
@@ -1,30 +0,0 @@
|
|
|
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-Bwf7JHu9.mjs';
|
|
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';
|
|
@@ -1,20 +0,0 @@
|
|
|
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-Bwf7JHu9.mjs';
|
|
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';
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import * as _homer0_jimple from '@homer0/jimple';
|
|
2
|
-
import { Statuses } from '../../utils/fns/statuses.mjs';
|
|
3
|
-
import { J as Jimpex, R as MiddlewareConnectFn } from '../../index-Bwf7JHu9.mjs';
|
|
4
|
-
import { ExpressMiddleware } from '../../types/express.mjs';
|
|
5
|
-
import { DeepPartial } from '../../types/utils.mjs';
|
|
6
|
-
import { HTTPErrorClass } from '../../services/common/httpError.mjs';
|
|
7
|
-
import { ResponsesBuilder } from '../../services/http/responsesBuilder.mjs';
|
|
8
|
-
import { Request } from 'express';
|
|
9
|
-
import 'statuses';
|
|
10
|
-
import '../../types/http.mjs';
|
|
11
|
-
import 'https';
|
|
12
|
-
import 'http';
|
|
13
|
-
import 'spdy';
|
|
14
|
-
import 'node-fetch';
|
|
15
|
-
import '@homer0/path-utils';
|
|
16
|
-
import '@homer0/simple-logger';
|
|
17
|
-
import '@homer0/simple-config';
|
|
18
|
-
import '@homer0/events-hub';
|
|
19
|
-
import '../../services/common/appError.mjs';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* The options for how the middleware should behave if the requested version is `latest`.
|
|
23
|
-
*
|
|
24
|
-
* @group Middlewares/VersionValidator
|
|
25
|
-
*/
|
|
26
|
-
type VersionValidatorLatestOptions = {
|
|
27
|
-
/**
|
|
28
|
-
* Whether or not the middleware should validate the _"latest version"_.
|
|
29
|
-
*
|
|
30
|
-
* @default true
|
|
31
|
-
*/
|
|
32
|
-
allow: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* The name of the _"latest version"_. Basically, `req.params.version` must match with
|
|
35
|
-
* this property in order to be consider "latest".
|
|
36
|
-
*
|
|
37
|
-
* @default 'latest'
|
|
38
|
-
*/
|
|
39
|
-
name: string;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* The options for how to detect if the request comes from a popup and how to compose the
|
|
43
|
-
* post message the middleware will use to respond.
|
|
44
|
-
*
|
|
45
|
-
* @group Middlewares/VersionValidator
|
|
46
|
-
*/
|
|
47
|
-
type VersionValidatorPopupOptions = {
|
|
48
|
-
/**
|
|
49
|
-
* The name of the query string variable the middleware will check in order to indentify
|
|
50
|
-
* whether the request comes from a popup or not. The variable must have `'true'` as its
|
|
51
|
-
* value.
|
|
52
|
-
*
|
|
53
|
-
* @default 'popup'
|
|
54
|
-
*/
|
|
55
|
-
variable: string;
|
|
56
|
-
/**
|
|
57
|
-
* The title of the page that will be generated to respond in case the versions don't
|
|
58
|
-
* match.
|
|
59
|
-
*
|
|
60
|
-
* @default 'Conflict'
|
|
61
|
-
*/
|
|
62
|
-
title: string;
|
|
63
|
-
/**
|
|
64
|
-
* The contents of the post message the generated page will send if the versions don't
|
|
65
|
-
* match.
|
|
66
|
-
*
|
|
67
|
-
* @default 'version:conflict'
|
|
68
|
-
*/
|
|
69
|
-
message: string;
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* The options used to customize a {@link VersionValidator} instance.
|
|
73
|
-
*
|
|
74
|
-
* @group Middlewares/VersionValidator
|
|
75
|
-
*/
|
|
76
|
-
type VersionValidatorOptions = {
|
|
77
|
-
/**
|
|
78
|
-
* The version used to validate the requests.
|
|
79
|
-
*/
|
|
80
|
-
version: string;
|
|
81
|
-
/**
|
|
82
|
-
* The options for how the middleware should behave if the requested version is
|
|
83
|
-
* `latest`.
|
|
84
|
-
*/
|
|
85
|
-
latest: VersionValidatorLatestOptions;
|
|
86
|
-
/**
|
|
87
|
-
* The options for how to detect if the request comes from a popup and how to compose
|
|
88
|
-
* the post message the middleware will use to respond.
|
|
89
|
-
*/
|
|
90
|
-
popup: VersionValidatorPopupOptions;
|
|
91
|
-
/**
|
|
92
|
-
* The error message to show when the version is invalid.
|
|
93
|
-
*
|
|
94
|
-
* @default "The application version doesn't match"
|
|
95
|
-
* @prettierignore
|
|
96
|
-
*/
|
|
97
|
-
error: string;
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* A partial version of the {@link VersionValidatorOptions}, to be used in the constructor
|
|
101
|
-
* and the middleware creator. The reason it omits `version` it's because for the
|
|
102
|
-
* constructor it's required, but for the middleware creator it's not.
|
|
103
|
-
*
|
|
104
|
-
* @group Middlewares/VersionValidator
|
|
105
|
-
*/
|
|
106
|
-
type VersionValidatorPartialOptions = DeepPartial<Omit<VersionValidatorOptions, 'version'>>;
|
|
107
|
-
/**
|
|
108
|
-
* The options to construct a {@link VersionValidator}.
|
|
109
|
-
*
|
|
110
|
-
* @group Middlewares/VersionValidator
|
|
111
|
-
*/
|
|
112
|
-
type VersionValidatorConstructorOptions = VersionValidatorPartialOptions & {
|
|
113
|
-
/**
|
|
114
|
-
* The version used to validate the requests.
|
|
115
|
-
*/
|
|
116
|
-
version: string;
|
|
117
|
-
/**
|
|
118
|
-
* A dictionary with the dependencies to inject.
|
|
119
|
-
*/
|
|
120
|
-
inject: {
|
|
121
|
-
HTTPError: HTTPErrorClass;
|
|
122
|
-
responsesBuilder: ResponsesBuilder;
|
|
123
|
-
statuses: Statuses;
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* The options for the middleware creator that will mount an instance of
|
|
128
|
-
* {@link VersionValidator}.
|
|
129
|
-
*
|
|
130
|
-
* @group Middlewares/VersionValidator
|
|
131
|
-
*/
|
|
132
|
-
type VersionValidatorMiddlewareOptions = VersionValidatorPartialOptions & {
|
|
133
|
-
/**
|
|
134
|
-
* The version used to validate the requests. This is optional in here because if it's
|
|
135
|
-
* not specified, it will be obtained from the configuration service.
|
|
136
|
-
*/
|
|
137
|
-
version?: string;
|
|
138
|
-
};
|
|
139
|
-
/**
|
|
140
|
-
* This is the handler for the middleware/controller that validates the application
|
|
141
|
-
* version.
|
|
142
|
-
* This is useful in cases where you want to restrict the access to specific versions; for
|
|
143
|
-
* example: you have a frontend which needs to be aligned with the "current" version of
|
|
144
|
-
* the application, since the frontend won't realize a new version was released, the
|
|
145
|
-
* validator can be used to let the frontend know.
|
|
146
|
-
* Also, it can be configured to handle requests from popups, in which case, instead of
|
|
147
|
-
* generating an error message, it will send a post message.
|
|
148
|
-
*
|
|
149
|
-
* @group Middleware Classes
|
|
150
|
-
* @group Middlewares/VersionValidator
|
|
151
|
-
* @prettierignore
|
|
152
|
-
*/
|
|
153
|
-
declare class VersionValidator {
|
|
154
|
-
/**
|
|
155
|
-
* To generate the errors in case the validation fails.
|
|
156
|
-
*/
|
|
157
|
-
protected readonly _HTTPError: HTTPErrorClass;
|
|
158
|
-
/**
|
|
159
|
-
* To generate responses for popups.
|
|
160
|
-
*/
|
|
161
|
-
protected readonly _responsesBuilder: ResponsesBuilder;
|
|
162
|
-
/**
|
|
163
|
-
* The uility service to get HTTP status codes.
|
|
164
|
-
*/
|
|
165
|
-
protected readonly _statuses: Statuses;
|
|
166
|
-
/**
|
|
167
|
-
* The customization options.
|
|
168
|
-
*/
|
|
169
|
-
protected readonly _options: VersionValidatorOptions;
|
|
170
|
-
/**
|
|
171
|
-
* @param options The options to construct the class.
|
|
172
|
-
* @throws If no `version` is specified in the options.
|
|
173
|
-
*/
|
|
174
|
-
constructor({ inject, version, ...options }: VersionValidatorConstructorOptions);
|
|
175
|
-
/**
|
|
176
|
-
* Generates the middleware that validates the version.
|
|
177
|
-
*/
|
|
178
|
-
getMiddleware(): ExpressMiddleware;
|
|
179
|
-
/**
|
|
180
|
-
* The customization options.
|
|
181
|
-
*/
|
|
182
|
-
get options(): Readonly<VersionValidatorOptions>;
|
|
183
|
-
/**
|
|
184
|
-
* Helper method that checks if the incoming request is from a popup. It will look for
|
|
185
|
-
* the query string variable defined in the constructor options.
|
|
186
|
-
*
|
|
187
|
-
* @param req The request object sent by the application.
|
|
188
|
-
*/
|
|
189
|
-
protected _isPopup(req: Request): boolean;
|
|
190
|
-
/**
|
|
191
|
-
* Helper method that checks if the "latest version" is enabled and if the given version
|
|
192
|
-
* is "the latest" (comparing it with the option name).
|
|
193
|
-
*
|
|
194
|
-
* @param version The version received in the request.
|
|
195
|
-
*/
|
|
196
|
-
protected _isTheAllowedLatest(version: string): boolean;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* A middleware that will validate a `version` request parameter against the application
|
|
200
|
-
* version, and generate an error if they don't match.
|
|
201
|
-
* This is a "middleware/controller" because the wrappers for both are the same, the
|
|
202
|
-
* difference is that, for controllers, Jimpex sends a second parameter with the route
|
|
203
|
-
* where they are mounted.
|
|
204
|
-
* By validating the route parameter, the function can know whether the implementation is
|
|
205
|
-
* going to use the middleware by itself or as a route middleware.
|
|
206
|
-
* If used as middleware, it will just return the result of
|
|
207
|
-
* {@link VersionValidator.getMiddleware}; but if used as controller, it will mount it on
|
|
208
|
-
* `[route]/:version/*`.
|
|
209
|
-
*
|
|
210
|
-
* @group Middlewares
|
|
211
|
-
* @group Middlewares/VersionValidator
|
|
212
|
-
*/
|
|
213
|
-
declare const versionValidatorMiddleware: _homer0_jimple.ResourceCreator<"middleware", "connect", (options?: VersionValidatorMiddlewareOptions) => <ContainerType extends Jimpex = Jimpex>(app: ContainerType, route: string | undefined) => ExpressMiddleware, MiddlewareConnectFn>;
|
|
214
|
-
|
|
215
|
-
export { VersionValidator, type VersionValidatorConstructorOptions, type VersionValidatorLatestOptions, type VersionValidatorMiddlewareOptions, type VersionValidatorOptions, type VersionValidatorPartialOptions, type VersionValidatorPopupOptions, versionValidatorMiddleware };
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import * as _homer0_jimple from '@homer0/jimple';
|
|
2
|
-
import { J as Jimpex } from '../../index-Bwf7JHu9.mjs';
|
|
3
|
-
import { Statuses } from '../../utils/fns/statuses.mjs';
|
|
4
|
-
import '../../types/express.mjs';
|
|
5
|
-
import 'express';
|
|
6
|
-
import '../../types/http.mjs';
|
|
7
|
-
import 'https';
|
|
8
|
-
import 'http';
|
|
9
|
-
import 'spdy';
|
|
10
|
-
import 'node-fetch';
|
|
11
|
-
import '../../types/utils.mjs';
|
|
12
|
-
import '@homer0/path-utils';
|
|
13
|
-
import '@homer0/simple-logger';
|
|
14
|
-
import '@homer0/simple-config';
|
|
15
|
-
import '@homer0/events-hub';
|
|
16
|
-
import 'statuses';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* A dictionary with some context information that can be provided to {@link AppError}.
|
|
20
|
-
*
|
|
21
|
-
* @group Services/AppError
|
|
22
|
-
*/
|
|
23
|
-
type AppErrorContext = {
|
|
24
|
-
/**
|
|
25
|
-
* Extra information that the error handler can pick and include the response.
|
|
26
|
-
*/
|
|
27
|
-
response?: unknown;
|
|
28
|
-
/**
|
|
29
|
-
* A status code or name for the error handler to set in the response.
|
|
30
|
-
*/
|
|
31
|
-
status?: string | number;
|
|
32
|
-
} & Record<string, unknown>;
|
|
33
|
-
/**
|
|
34
|
-
* A simple subclass of `Error` but with support for context information.
|
|
35
|
-
*
|
|
36
|
-
* @group Services
|
|
37
|
-
* @group Services/AppError
|
|
38
|
-
*/
|
|
39
|
-
declare class AppError extends Error {
|
|
40
|
-
/**
|
|
41
|
-
* The date of when the error was generated.
|
|
42
|
-
*/
|
|
43
|
-
readonly _date: Date;
|
|
44
|
-
/**
|
|
45
|
-
* The context information that can be provided to the error, and picked by the error
|
|
46
|
-
* handler.
|
|
47
|
-
*/
|
|
48
|
-
readonly _context: AppErrorContext;
|
|
49
|
-
/**
|
|
50
|
-
* The service that generates HTTP status codes.
|
|
51
|
-
*/
|
|
52
|
-
protected _statuses: Statuses;
|
|
53
|
-
/**
|
|
54
|
-
* @param message The message of the error.
|
|
55
|
-
* @param context The context information, for the error handler.
|
|
56
|
-
* @param statuses A reference to the service that generates HTTP status codes. This
|
|
57
|
-
* is in case the implementation wants to use a special version from
|
|
58
|
-
* the container; otherwise, it will use the `statuses` library
|
|
59
|
-
* directly.
|
|
60
|
-
*/
|
|
61
|
-
constructor(message: string, context?: AppErrorContext, statuses?: Statuses);
|
|
62
|
-
/**
|
|
63
|
-
* Gets an object that can be included in a response from the application. This method
|
|
64
|
-
* is a helper for the `response` getter, as it allows for the assertion of the response
|
|
65
|
-
* type.
|
|
66
|
-
*
|
|
67
|
-
* @template T The type of the response.
|
|
68
|
-
*/
|
|
69
|
-
getResponse<T>(): T;
|
|
70
|
-
/**
|
|
71
|
-
* Information about the error that can be included in a response. This is set using the
|
|
72
|
-
* `response` key in the `context` option.
|
|
73
|
-
*/
|
|
74
|
-
get response(): unknown;
|
|
75
|
-
/**
|
|
76
|
-
* An HTTP status code related to the error. This is set using the `status` key on the
|
|
77
|
-
* `context`.
|
|
78
|
-
*/
|
|
79
|
-
get status(): number | undefined;
|
|
80
|
-
/**
|
|
81
|
-
* Context information related to the error.
|
|
82
|
-
*/
|
|
83
|
-
get context(): unknown;
|
|
84
|
-
/**
|
|
85
|
-
* The date of when the error was generated.
|
|
86
|
-
*/
|
|
87
|
-
get date(): Date;
|
|
88
|
-
/**
|
|
89
|
-
* Utility method that formats the context before saving it in the instance:
|
|
90
|
-
* - If the context includes a `status` as a `string`, it will try to replace it with
|
|
91
|
-
* its actual status code from the `statuses `service.
|
|
92
|
-
*
|
|
93
|
-
* @param context The original context sent to the constructor.
|
|
94
|
-
*/
|
|
95
|
-
protected _parseContext(context: AppErrorContext): AppErrorContext;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Shorthand for `new AppError()`.
|
|
99
|
-
*
|
|
100
|
-
* @param args The same parameters as the {@link AppError} constructor.
|
|
101
|
-
* @returns A new instance of {@link AppError}.
|
|
102
|
-
* @group Services
|
|
103
|
-
* @group Services/AppError
|
|
104
|
-
*/
|
|
105
|
-
declare const createAppError: (message: string, context?: AppErrorContext | undefined, statuses?: Statuses | undefined) => AppError;
|
|
106
|
-
/**
|
|
107
|
-
* The type of the function that generates a new instance of {@link AppError}.
|
|
108
|
-
* This is exported to make it easy to type the dependency injection.
|
|
109
|
-
*
|
|
110
|
-
* @group Services/AppError
|
|
111
|
-
*/
|
|
112
|
-
type CreateAppErrorFn = typeof createAppError;
|
|
113
|
-
/**
|
|
114
|
-
* THe type of the {@link AppError} class.
|
|
115
|
-
* This is exported to make it easy to type the dependency injection.
|
|
116
|
-
*
|
|
117
|
-
* @group Services/AppError
|
|
118
|
-
*/
|
|
119
|
-
type AppErrorClass = typeof AppError;
|
|
120
|
-
/**
|
|
121
|
-
* A service provider that will register both, {@link AppError} and
|
|
122
|
-
* {@link createAppError}, on the container. `AppError` will be the key for class, and
|
|
123
|
-
* `appError` will be for the generator function.
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
*
|
|
127
|
-
* // Register it on the container
|
|
128
|
-
* container.register(appErrorProvider);
|
|
129
|
-
* // Getting access to the class.
|
|
130
|
-
* const AppError = container.get<AppErrorClass>('AppError');
|
|
131
|
-
* // Getting access to the function.
|
|
132
|
-
* const appError = container.get<CreateAppErrorFn>('appError');
|
|
133
|
-
*
|
|
134
|
-
* @group Providers
|
|
135
|
-
* @group Services/AppError
|
|
136
|
-
*/
|
|
137
|
-
declare const appErrorProvider: _homer0_jimple.Resource<"provider", "register", _homer0_jimple.ProviderRegisterFn<Jimpex>>;
|
|
138
|
-
|
|
139
|
-
export { AppError, type AppErrorClass, type AppErrorContext, type CreateAppErrorFn, appErrorProvider, createAppError };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import * as _homer0_jimple from '@homer0/jimple';
|
|
2
|
-
import { J as Jimpex } from '../../index-Bwf7JHu9.mjs';
|
|
3
|
-
import { Statuses } from '../../utils/fns/statuses.mjs';
|
|
4
|
-
import { AppError, AppErrorContext } from './appError.mjs';
|
|
5
|
-
import '../../types/express.mjs';
|
|
6
|
-
import '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 'statuses';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* A type of error to be used on HTTP requests. This is the most common type of error used
|
|
21
|
-
* by Jimpex.
|
|
22
|
-
*
|
|
23
|
-
* @group Services
|
|
24
|
-
* @group Services/HTTPError
|
|
25
|
-
*/
|
|
26
|
-
declare class HTTPError extends AppError {
|
|
27
|
-
/**
|
|
28
|
-
* @param message The error message.
|
|
29
|
-
* @param status The HTTP status code.
|
|
30
|
-
* @param context Context information related to the error.
|
|
31
|
-
* @param statuses A reference to the service that generates HTTP status codes. This
|
|
32
|
-
* is in case the implementation wants to use a special version from
|
|
33
|
-
* the container; otherwise, it will use the `statuses` library
|
|
34
|
-
* directly.
|
|
35
|
-
*/
|
|
36
|
-
constructor(message: string, status?: number | string, context?: AppErrorContext, statuses?: Statuses);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Shorthand for `new HTTPError()`.
|
|
40
|
-
*
|
|
41
|
-
* @param args The same parameters as the {@link HTTPError} constructor.
|
|
42
|
-
* @returns A new instance of {@link HTTPError}.
|
|
43
|
-
* @group Services
|
|
44
|
-
* @group Services/HTTPError
|
|
45
|
-
*/
|
|
46
|
-
declare const createHTTPError: (message: string, status?: string | number | undefined, context?: AppErrorContext | undefined, statuses?: Statuses | undefined) => HTTPError;
|
|
47
|
-
/**
|
|
48
|
-
* The type of the function that generates a new instance of {@link HTTPError}.
|
|
49
|
-
* This is exported to make it easy to type the dependency injection.
|
|
50
|
-
*
|
|
51
|
-
* @group Services/HTTPError
|
|
52
|
-
*/
|
|
53
|
-
type CreateHTTPErrorFn = typeof createHTTPError;
|
|
54
|
-
/**
|
|
55
|
-
* THe type of the {@link HTTPError} class.
|
|
56
|
-
* This is exported to make it easy to type the dependency injection.
|
|
57
|
-
*
|
|
58
|
-
* @group Services/HTTPError
|
|
59
|
-
*/
|
|
60
|
-
type HTTPErrorClass = typeof HTTPError;
|
|
61
|
-
/**
|
|
62
|
-
* A service provider that will register both the {@link HTTPError} and a generator
|
|
63
|
-
* function on the container. `HTTPError` will be the key for class, and `httpError` will
|
|
64
|
-
* be for the generator function.
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
*
|
|
68
|
-
* // Register it on the container
|
|
69
|
-
* container.register(httpErrorProvider);
|
|
70
|
-
* // Getting access to the class.
|
|
71
|
-
* const HTTPError = container.get<HTTPErrorClass>('HTTPError');
|
|
72
|
-
* // Getting access to the function.
|
|
73
|
-
* const httpError = container.get<CreateHTTPErrorFn>('httpError');
|
|
74
|
-
*
|
|
75
|
-
* @group Providers
|
|
76
|
-
* @group Services/HTTPError
|
|
77
|
-
*/
|
|
78
|
-
declare const httpErrorProvider: _homer0_jimple.Resource<"provider", "register", _homer0_jimple.ProviderRegisterFn<Jimpex>>;
|
|
79
|
-
|
|
80
|
-
export { type CreateHTTPErrorFn, HTTPError, type HTTPErrorClass, createHTTPError, httpErrorProvider };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import * as _homer0_jimple from '@homer0/jimple';
|
|
2
|
-
import { J as Jimpex } from '../../index-Bwf7JHu9.mjs';
|
|
3
|
-
export { AppError, AppErrorClass, AppErrorContext, CreateAppErrorFn, appErrorProvider, createAppError } from './appError.mjs';
|
|
4
|
-
export { CreateHTTPErrorFn, HTTPError, HTTPErrorClass, createHTTPError, httpErrorProvider } from './httpError.mjs';
|
|
5
|
-
export { SendFile, SendFileGeneratorOptions, SendFileOptions, sendFile, sendFileProvider } from './sendFile.mjs';
|
|
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 '../../utils/fns/statuses.mjs';
|
|
19
|
-
import 'statuses';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Registers all the common services on the container.
|
|
23
|
-
*
|
|
24
|
-
* - {@link AppError | appError}
|
|
25
|
-
* - {@link HTTPError | httpError}
|
|
26
|
-
* - {@link SendFile | sendFile}
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
*
|
|
30
|
-
* // Register the collection on the container
|
|
31
|
-
* container.register(commonServicesProvider);
|
|
32
|
-
* // Getting access to one the services instance
|
|
33
|
-
* const sendFile = container.get<SendFile>('sendFile');
|
|
34
|
-
*
|
|
35
|
-
* @group Providers
|
|
36
|
-
*/
|
|
37
|
-
declare const commonServicesProvider: {
|
|
38
|
-
appErrorProvider: _homer0_jimple.Resource<"provider", "register", _homer0_jimple.ProviderRegisterFn<Jimpex>>;
|
|
39
|
-
httpErrorProvider: _homer0_jimple.Resource<"provider", "register", _homer0_jimple.ProviderRegisterFn<Jimpex>>;
|
|
40
|
-
sendFileProvider: _homer0_jimple.Resource<"provider", "register", _homer0_jimple.ProviderRegisterFn<Jimpex>>;
|
|
41
|
-
} & Record<string, _homer0_jimple.Resource<"provider", "register", _homer0_jimple.ProviderRegisterFn<Jimpex>>> & {
|
|
42
|
-
provider: true;
|
|
43
|
-
} & {
|
|
44
|
-
register: _homer0_jimple.ProviderRegisterFn<Jimpex>;
|
|
45
|
-
} & Record<string, unknown>;
|
|
46
|
-
|
|
47
|
-
export { commonServicesProvider };
|