@xylabs/express 4.13.15 → 4.13.17

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.
Files changed (137) hide show
  1. package/README.md +35 -37
  2. package/dist/node/Logger/LogFormats/LocalDev/spec/logFormatLocalDev.spec.d.ts +2 -0
  3. package/dist/node/Logger/LogFormats/LocalDev/spec/logFormatLocalDev.spec.d.ts.map +1 -0
  4. package/dist/node/Logger/LogFormats/Rollbar/spec/logFormatRollbar.spec.d.ts +2 -0
  5. package/dist/node/Logger/LogFormats/Rollbar/spec/logFormatRollbar.spec.d.ts.map +1 -0
  6. package/dist/node/Logger/LogFormats/Structured/spec/logFormatStructured.spec.d.ts +2 -0
  7. package/dist/node/Logger/LogFormats/Structured/spec/logFormatStructured.spec.d.ts.map +1 -0
  8. package/dist/node/Logger/Transports/Rollbar/spec/RollbarTransport.spec.d.ts +2 -0
  9. package/dist/node/Logger/Transports/Rollbar/spec/RollbarTransport.spec.d.ts.map +1 -0
  10. package/dist/node/Logger/Transports/Rollbar/spec/canGetDefaultRollbarTransport.spec.d.ts +2 -0
  11. package/dist/node/Logger/Transports/Rollbar/spec/canGetDefaultRollbarTransport.spec.d.ts.map +1 -0
  12. package/dist/node/Logger/Transports/Rollbar/spec/getDefaultRollbarTransport.spec.d.ts +2 -0
  13. package/dist/node/Logger/Transports/Rollbar/spec/getDefaultRollbarTransport.spec.d.ts.map +1 -0
  14. package/dist/node/Logger/spec/getDefaultLogger.spec.d.ts +2 -0
  15. package/dist/node/Logger/spec/getDefaultLogger.spec.d.ts.map +1 -0
  16. package/dist/node/Logger/spec/getLogger.spec.d.ts +2 -0
  17. package/dist/node/Logger/spec/getLogger.spec.d.ts.map +1 -0
  18. package/dist/node/Logger/spec/toWinstonVerbosity.spec.d.ts +2 -0
  19. package/dist/node/Logger/spec/toWinstonVerbosity.spec.d.ts.map +1 -0
  20. package/dist/node/index.d.ts +8 -354
  21. package/dist/node/middleware/jsonBodyParser/spec/jsonBodyParser.spec.d.ts +2 -0
  22. package/dist/node/middleware/jsonBodyParser/spec/jsonBodyParser.spec.d.ts.map +1 -0
  23. package/package.json +8 -8
  24. package/build/node/index.d.ts +0 -8
  25. /package/{build → dist}/node/Handler/StatusCodeHandlers/index.d.ts +0 -0
  26. /package/{build → dist}/node/Handler/StatusCodeHandlers/index.d.ts.map +0 -0
  27. /package/{build → dist}/node/Handler/StatusCodeHandlers/notImplemented.d.ts +0 -0
  28. /package/{build → dist}/node/Handler/StatusCodeHandlers/notImplemented.d.ts.map +0 -0
  29. /package/{build → dist}/node/Handler/asyncHandler.d.ts +0 -0
  30. /package/{build → dist}/node/Handler/asyncHandler.d.ts.map +0 -0
  31. /package/{build → dist}/node/Handler/errorToJsonHandler.d.ts +0 -0
  32. /package/{build → dist}/node/Handler/errorToJsonHandler.d.ts.map +0 -0
  33. /package/{build → dist}/node/Handler/index.d.ts +0 -0
  34. /package/{build → dist}/node/Handler/index.d.ts.map +0 -0
  35. /package/{build → dist}/node/HttpUtil/getHttpHeader.d.ts +0 -0
  36. /package/{build → dist}/node/HttpUtil/getHttpHeader.d.ts.map +0 -0
  37. /package/{build → dist}/node/HttpUtil/index.d.ts +0 -0
  38. /package/{build → dist}/node/HttpUtil/index.d.ts.map +0 -0
  39. /package/{build → dist}/node/Logger/LogFormats/LocalDev/index.d.ts +0 -0
  40. /package/{build → dist}/node/Logger/LogFormats/LocalDev/index.d.ts.map +0 -0
  41. /package/{build → dist}/node/Logger/LogFormats/LocalDev/logFormatLocalDev.d.ts +0 -0
  42. /package/{build → dist}/node/Logger/LogFormats/LocalDev/logFormatLocalDev.d.ts.map +0 -0
  43. /package/{build → dist}/node/Logger/LogFormats/Rollbar/index.d.ts +0 -0
  44. /package/{build → dist}/node/Logger/LogFormats/Rollbar/index.d.ts.map +0 -0
  45. /package/{build → dist}/node/Logger/LogFormats/Rollbar/logFormatRollbar.d.ts +0 -0
  46. /package/{build → dist}/node/Logger/LogFormats/Rollbar/logFormatRollbar.d.ts.map +0 -0
  47. /package/{build → dist}/node/Logger/LogFormats/Structured/index.d.ts +0 -0
  48. /package/{build → dist}/node/Logger/LogFormats/Structured/index.d.ts.map +0 -0
  49. /package/{build → dist}/node/Logger/LogFormats/Structured/logFormatStructured.d.ts +0 -0
  50. /package/{build → dist}/node/Logger/LogFormats/Structured/logFormatStructured.d.ts.map +0 -0
  51. /package/{build → dist}/node/Logger/LogFormats/index.d.ts +0 -0
  52. /package/{build → dist}/node/Logger/LogFormats/index.d.ts.map +0 -0
  53. /package/{build → dist}/node/Logger/LoggerMeta.d.ts +0 -0
  54. /package/{build → dist}/node/Logger/LoggerMeta.d.ts.map +0 -0
  55. /package/{build → dist}/node/Logger/LoggerOptions.d.ts +0 -0
  56. /package/{build → dist}/node/Logger/LoggerOptions.d.ts.map +0 -0
  57. /package/{build → dist}/node/Logger/LoggerVerbosity.d.ts +0 -0
  58. /package/{build → dist}/node/Logger/LoggerVerbosity.d.ts.map +0 -0
  59. /package/{build → dist}/node/Logger/Transports/Rollbar/RollbarTransport.d.ts +0 -0
  60. /package/{build → dist}/node/Logger/Transports/Rollbar/RollbarTransport.d.ts.map +0 -0
  61. /package/{build → dist}/node/Logger/Transports/Rollbar/canGetDefaultRollbarTransport.d.ts +0 -0
  62. /package/{build → dist}/node/Logger/Transports/Rollbar/canGetDefaultRollbarTransport.d.ts.map +0 -0
  63. /package/{build → dist}/node/Logger/Transports/Rollbar/getDefaultRollbarTransport.d.ts +0 -0
  64. /package/{build → dist}/node/Logger/Transports/Rollbar/getDefaultRollbarTransport.d.ts.map +0 -0
  65. /package/{build → dist}/node/Logger/Transports/Rollbar/index.d.ts +0 -0
  66. /package/{build → dist}/node/Logger/Transports/Rollbar/index.d.ts.map +0 -0
  67. /package/{build → dist}/node/Logger/Transports/index.d.ts +0 -0
  68. /package/{build → dist}/node/Logger/Transports/index.d.ts.map +0 -0
  69. /package/{build → dist}/node/Logger/WinstonVerbosity.d.ts +0 -0
  70. /package/{build → dist}/node/Logger/WinstonVerbosity.d.ts.map +0 -0
  71. /package/{build → dist}/node/Logger/WrappedWinstonLogger.d.ts +0 -0
  72. /package/{build → dist}/node/Logger/WrappedWinstonLogger.d.ts.map +0 -0
  73. /package/{build → dist}/node/Logger/getDefaultLogger.d.ts +0 -0
  74. /package/{build → dist}/node/Logger/getDefaultLogger.d.ts.map +0 -0
  75. /package/{build → dist}/node/Logger/getLogger.d.ts +0 -0
  76. /package/{build → dist}/node/Logger/getLogger.d.ts.map +0 -0
  77. /package/{build → dist}/node/Logger/index.d.ts +0 -0
  78. /package/{build → dist}/node/Logger/index.d.ts.map +0 -0
  79. /package/{build → dist}/node/Logger/toWinstonVerbosity.d.ts +0 -0
  80. /package/{build → dist}/node/Logger/toWinstonVerbosity.d.ts.map +0 -0
  81. /package/{build → dist}/node/Model/ExpressError.d.ts +0 -0
  82. /package/{build → dist}/node/Model/ExpressError.d.ts.map +0 -0
  83. /package/{build → dist}/node/Model/index.d.ts +0 -0
  84. /package/{build → dist}/node/Model/index.d.ts.map +0 -0
  85. /package/{build → dist}/node/Performance/Counters.d.ts +0 -0
  86. /package/{build → dist}/node/Performance/Counters.d.ts.map +0 -0
  87. /package/{build → dist}/node/Performance/Profiler.d.ts +0 -0
  88. /package/{build → dist}/node/Performance/Profiler.d.ts.map +0 -0
  89. /package/{build → dist}/node/Performance/index.d.ts +0 -0
  90. /package/{build → dist}/node/Performance/index.d.ts.map +0 -0
  91. /package/{build → dist}/node/Util/compactObject.d.ts +0 -0
  92. /package/{build → dist}/node/Util/compactObject.d.ts.map +0 -0
  93. /package/{build → dist}/node/Util/index.d.ts +0 -0
  94. /package/{build → dist}/node/Util/index.d.ts.map +0 -0
  95. /package/{build → dist}/node/Util/tryParse.d.ts +0 -0
  96. /package/{build → dist}/node/Util/tryParse.d.ts.map +0 -0
  97. /package/{build → dist}/node/index.d.ts.map +0 -0
  98. /package/{build → dist}/node/middleware/caseInsensitiveRouting/caseInsensitiveRouting.d.ts +0 -0
  99. /package/{build → dist}/node/middleware/caseInsensitiveRouting/caseInsensitiveRouting.d.ts.map +0 -0
  100. /package/{build → dist}/node/middleware/caseInsensitiveRouting/index.d.ts +0 -0
  101. /package/{build → dist}/node/middleware/caseInsensitiveRouting/index.d.ts.map +0 -0
  102. /package/{build → dist}/node/middleware/customPoweredByHeader/customPoweredByHeader.d.ts +0 -0
  103. /package/{build → dist}/node/middleware/customPoweredByHeader/customPoweredByHeader.d.ts.map +0 -0
  104. /package/{build → dist}/node/middleware/customPoweredByHeader/index.d.ts +0 -0
  105. /package/{build → dist}/node/middleware/customPoweredByHeader/index.d.ts.map +0 -0
  106. /package/{build → dist}/node/middleware/index.d.ts +0 -0
  107. /package/{build → dist}/node/middleware/index.d.ts.map +0 -0
  108. /package/{build → dist}/node/middleware/jsonBodyParser/index.d.ts +0 -0
  109. /package/{build → dist}/node/middleware/jsonBodyParser/index.d.ts.map +0 -0
  110. /package/{build → dist}/node/middleware/jsonBodyParser/jsonBodyParser.d.ts +0 -0
  111. /package/{build → dist}/node/middleware/jsonBodyParser/jsonBodyParser.d.ts.map +0 -0
  112. /package/{build → dist}/node/middleware/metrics/counters.d.ts +0 -0
  113. /package/{build → dist}/node/middleware/metrics/counters.d.ts.map +0 -0
  114. /package/{build → dist}/node/middleware/metrics/index.d.ts +0 -0
  115. /package/{build → dist}/node/middleware/metrics/index.d.ts.map +0 -0
  116. /package/{build → dist}/node/middleware/metrics/responseProfiler.d.ts +0 -0
  117. /package/{build → dist}/node/middleware/metrics/responseProfiler.d.ts.map +0 -0
  118. /package/{build → dist}/node/middleware/standardResponses/getResponseMetadata.d.ts +0 -0
  119. /package/{build → dist}/node/middleware/standardResponses/getResponseMetadata.d.ts.map +0 -0
  120. /package/{build → dist}/node/middleware/standardResponses/index.d.ts +0 -0
  121. /package/{build → dist}/node/middleware/standardResponses/index.d.ts.map +0 -0
  122. /package/{build → dist}/node/middleware/standardResponses/jsonApi/error.d.ts +0 -0
  123. /package/{build → dist}/node/middleware/standardResponses/jsonApi/error.d.ts.map +0 -0
  124. /package/{build → dist}/node/middleware/standardResponses/jsonApi/index.d.ts +0 -0
  125. /package/{build → dist}/node/middleware/standardResponses/jsonApi/index.d.ts.map +0 -0
  126. /package/{build → dist}/node/middleware/standardResponses/jsonApi/links.d.ts +0 -0
  127. /package/{build → dist}/node/middleware/standardResponses/jsonApi/links.d.ts.map +0 -0
  128. /package/{build → dist}/node/middleware/standardResponses/jsonApi/relationship.d.ts +0 -0
  129. /package/{build → dist}/node/middleware/standardResponses/jsonApi/relationship.d.ts.map +0 -0
  130. /package/{build → dist}/node/middleware/standardResponses/jsonApi/resourceIdentifier.d.ts +0 -0
  131. /package/{build → dist}/node/middleware/standardResponses/jsonApi/resourceIdentifier.d.ts.map +0 -0
  132. /package/{build → dist}/node/middleware/standardResponses/jsonApi/response.d.ts +0 -0
  133. /package/{build → dist}/node/middleware/standardResponses/jsonApi/response.d.ts.map +0 -0
  134. /package/{build → dist}/node/middleware/standardResponses/standardErrors.d.ts +0 -0
  135. /package/{build → dist}/node/middleware/standardResponses/standardErrors.d.ts.map +0 -0
  136. /package/{build → dist}/node/middleware/standardResponses/standardResponses.d.ts +0 -0
  137. /package/{build → dist}/node/middleware/standardResponses/standardResponses.d.ts.map +0 -0
package/README.md CHANGED
@@ -1,62 +1,60 @@
1
- [![logo][]](https://xylabs.com)
2
-
3
1
  # @xylabs/express
4
2
 
3
+ [![logo][]](https://xylabs.com)
4
+
5
5
  [![main-build][]][main-build-link]
6
6
  [![npm-badge][]][npm-link]
7
+ [![npm-downloads-badge][]][npm-link]
8
+ [![jsdelivr-badge][]][jsdelivr-link]
9
+ [![npm-license-badge][]](LICENSE)
7
10
  [![codacy-badge][]][codacy-link]
8
11
  [![codeclimate-badge][]][codeclimate-link]
12
+ [![snyk-badge][]][snyk-link]
13
+ [![socket-badge][]][socket-link]
9
14
 
10
- ## Table of Contents
11
-
12
- - [Description](#description)
13
- - [Install](#install)
14
- - [Scripts](#scripts)
15
- - [Maintainers](#maintainers)
16
- - [License](#license)
17
- - [Credits](#credits)
18
-
19
- ## Description
15
+ Version: 4.13.15
20
16
 
21
17
  SDK for base code for Api repos that use express and deploy on AWS ECS
22
18
 
23
- ## Install
24
-
25
- Using npm:
19
+ ## Documentation
26
20
 
27
- ```sh
28
- npm i --save @xylabs/express
29
- ```
21
+ Coming Soon!
30
22
 
31
- Using yarn:
32
-
33
- ```sh
34
- yarn add @xylabs/express
35
- ```
36
-
37
- ## Scripts
38
-
39
- See [ts-scripts](https://github.com/xylabs/ts-scripts/blob/main/README.md) for
40
- list of shared scripts.
23
+ Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
41
24
 
42
25
  ## Maintainers
43
26
 
44
- - [Arie Trouw](https://github.com/arietrouw) (<https://arietrouw.com>)
27
+ - [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
28
+ - [Matt Jones](https://github.com/jonesmac)
29
+ - [Joel Carter](https://github.com/JoelBCarter)
30
+ - [Jordan Trouw](https://github.com/jordantrouw)
45
31
 
46
32
  ## License
47
33
 
48
- See the [LICENSE](LICENSE) file for license details
34
+ > See the [LICENSE](LICENSE) file for license details
49
35
 
50
36
  ## Credits
51
37
 
52
- [Made with 🔥 and ❄️ by XY Labs](https://xylabs.com)
38
+ [Made with 🔥 and ❄️ by XYLabs](https://xylabs.com)
53
39
 
54
40
  [logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
55
- [main-build]: https://github.com/xylabs/express/actions/workflows/build.yml/badge.svg
56
- [main-build-link]: https://github.com/xylabs/express/actions/workflows/build.yml
41
+
42
+ [main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml/badge.svg
43
+ [main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml
57
44
  [npm-badge]: https://img.shields.io/npm/v/@xylabs/express.svg
58
45
  [npm-link]: https://www.npmjs.com/package/@xylabs/express
59
- [codacy-badge]: https://app.codacy.com/project/badge/Grade/84270ff9f2aa4a669269191b715aa8d7
60
- [codacy-link]: https://www.codacy.com/gh/xylabs/express/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/express&utm_campaign=Badge_Grade
61
- [codeclimate-badge]: https://api.codeclimate.com/v1/badges/1c8255608f551b2119d6/maintainability
62
- [codeclimate-link]: https://codeclimate.com/github/xylabs/express/maintainability
46
+ [codacy-badge]: https://app.codacy.com/project/badge/Grade/c8e15e14f37741c18cfb47ac7245c698
47
+ [codacy-link]: https://www.codacy.com/gh/xylabs/sdk-js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/sdk-js&utm_campaign=Badge_Grade
48
+ [codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
49
+ [codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
50
+ [snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
51
+ [snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
52
+
53
+ [npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/express
54
+ [npm-license-badge]: https://img.shields.io/npm/l/@xylabs/express
55
+
56
+ [jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xylabs/express/badge
57
+ [jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xylabs/express
58
+
59
+ [socket-badge]: https://socket.dev/api/badge/npm/package/@xylabs/express
60
+ [socket-link]: https://socket.dev/npm/package/@xylabs/express
@@ -0,0 +1,2 @@
1
+ import '@xylabs/vitest-extended';
2
+ //# sourceMappingURL=logFormatLocalDev.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logFormatLocalDev.spec.d.ts","sourceRoot":"","sources":["../../../../../../src/Logger/LogFormats/LocalDev/spec/logFormatLocalDev.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import '@xylabs/vitest-extended';
2
+ //# sourceMappingURL=logFormatRollbar.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logFormatRollbar.spec.d.ts","sourceRoot":"","sources":["../../../../../../src/Logger/LogFormats/Rollbar/spec/logFormatRollbar.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import '@xylabs/vitest-extended';
2
+ //# sourceMappingURL=logFormatStructured.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logFormatStructured.spec.d.ts","sourceRoot":"","sources":["../../../../../../src/Logger/LogFormats/Structured/spec/logFormatStructured.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import '@xylabs/vitest-extended';
2
+ //# sourceMappingURL=RollbarTransport.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RollbarTransport.spec.d.ts","sourceRoot":"","sources":["../../../../../../src/Logger/Transports/Rollbar/spec/RollbarTransport.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import '@xylabs/vitest-extended';
2
+ //# sourceMappingURL=canGetDefaultRollbarTransport.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canGetDefaultRollbarTransport.spec.d.ts","sourceRoot":"","sources":["../../../../../../src/Logger/Transports/Rollbar/spec/canGetDefaultRollbarTransport.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import '@xylabs/vitest-extended';
2
+ //# sourceMappingURL=getDefaultRollbarTransport.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDefaultRollbarTransport.spec.d.ts","sourceRoot":"","sources":["../../../../../../src/Logger/Transports/Rollbar/spec/getDefaultRollbarTransport.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import '@xylabs/vitest-extended';
2
+ //# sourceMappingURL=getDefaultLogger.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDefaultLogger.spec.d.ts","sourceRoot":"","sources":["../../../../src/Logger/spec/getDefaultLogger.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import '@xylabs/vitest-extended';
2
+ //# sourceMappingURL=getLogger.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getLogger.spec.d.ts","sourceRoot":"","sources":["../../../../src/Logger/spec/getLogger.spec.ts"],"names":[],"mappings":"AAGA,OAAO,yBAAyB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import '@xylabs/vitest-extended';
2
+ //# sourceMappingURL=toWinstonVerbosity.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toWinstonVerbosity.spec.d.ts","sourceRoot":"","sources":["../../../../src/Logger/spec/toWinstonVerbosity.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,354 +1,8 @@
1
- import { RequestHandler, Request, Response, NextFunction, Express, Application } from 'express';
2
- import { ParamsDictionary, Query, Request as Request$1 } from 'express-serve-static-core';
3
- import { Logger as Logger$1, LogFunction as LogFunction$1 } from '@xylabs/logger';
4
- import { Logger as Logger$2 } from 'winston';
5
- import { OptionsJson } from 'body-parser';
6
- import { NextHandleFunction } from 'connect';
7
-
8
- declare function asyncHandler<P = NoReqParams, ResBody = NoResBody, ReqBody = NoReqBody, ReqQuery = NoReqQuery, Locals extends NoLocals = NoLocals>(fn: RequestHandler<P, ResBody, ReqBody, ReqQuery, Locals>): (req: Request<P, ResBody, ReqBody, ReqQuery, Locals>, res: Response<ResBody, Locals>, next: NextFunction) => Promise<void>;
9
- interface Empty {
10
- }
11
- type NoReqParams = ParamsDictionary;
12
- type NoResBody = Empty;
13
- type NoReqBody = Empty;
14
- type NoReqQuery = Query;
15
- type NoLocals = Record<string, any>;
16
-
17
- interface ExpressError extends Error {
18
- statusCode?: number;
19
- }
20
-
21
- declare const errorToJsonHandler: (error: ExpressError, req: Request, res: Response, next: NextFunction) => void;
22
-
23
- declare const notImplemented: RequestHandler;
24
-
25
- /**
26
- * Since there can be multiple of certain HTTP headers or
27
- * to prevent ugliness if someone did send us multiple
28
- * instances of a header we only expect one of, this
29
- * method grabs the 1st/only one of the desired header
30
- * @param header The header to find
31
- * @param req The received HTTP request (with headers)
32
- * @returns The first or only occurrence of the specified HTTP header
33
- */
34
- declare const getHttpHeader: (header: string, req: Request$1) => string | undefined;
35
-
36
- /**
37
- * Wrap Winston logger methods to adapt to familiar
38
- * console logging methods
39
- */
40
- declare class WrappedWinstonLogger implements Logger$1 {
41
- protected readonly winston: Logger$2;
42
- constructor(winston: Logger$2);
43
- debug: LogFunction$1;
44
- error: LogFunction$1;
45
- info: LogFunction$1;
46
- log: LogFunction$1;
47
- trace: LogFunction$1;
48
- warn: LogFunction$1;
49
- }
50
-
51
- /**
52
- * Static instance to prevent multiple instances of the same logger
53
- * with the same config
54
- */
55
- declare global {
56
- var xy: {
57
- defaultLogger?: WrappedWinstonLogger;
58
- };
59
- }
60
- declare const getDefaultLogger: () => Logger$1;
61
-
62
- type LoggerVerbosity = 'error' | 'warn' | 'info' | 'debug' | 'all';
63
-
64
- declare const getLogger: (minVerbosity?: LoggerVerbosity) => Logger$1;
65
-
66
- type LoggerMeta = Record<string, string | number>;
67
-
68
- interface LoggerOptions {
69
- defaultMeta?: LoggerMeta;
70
- level?: LoggerVerbosity;
71
- }
72
-
73
- /** @deprecated use from @xylabs/logger instead */
74
- type LogFunction = LogFunction$1;
75
- /** @deprecated use from @xylabs/logger instead */
76
- type Logger = Logger$1;
77
-
78
- /**
79
- * Enable case sensitivity. When enabled, "/Foo" and "/foo" are different
80
- * routes. When disabled, "/Foo" and "/foo" are treated the same.
81
- * @param app The Express app to disable the header on.
82
- */
83
- declare const enableCaseSensitiveRouting: (app: Express) => void;
84
- /**
85
- * Disable case sensitivity. When enabled, "/Foo" and "/foo" are different
86
- * routes. When disabled, "/Foo" and "/foo" are treated the same.
87
- * @param app The Express app to disable the header on.
88
- */
89
- declare const disableCaseSensitiveRouting: (app: Express) => void;
90
-
91
- /**
92
- * By default Express appends the `X-Powered-By: Express` header to
93
- * all responses. Calling this method enables that behavior.
94
- * @param app The Express app to disable the header on.
95
- */
96
- declare const enableExpressDefaultPoweredByHeader: (app: Express) => void;
97
- /**
98
- * By default Express appends the `X-Powered-By: Express` header to
99
- * all responses. Calling this method disables that behavior.
100
- * @param app The Express app to disable the header on.
101
- */
102
- declare const disableExpressDefaultPoweredByHeader: (app: Express) => void;
103
- declare const customPoweredByHeader: (req: Request, res: Response, next: NextFunction) => void;
104
-
105
- /**
106
- * The default maximum request body size for the JSON Body Parser
107
- */
108
- declare const DefaultJsonBodyParserOptionsLimit = "100kb";
109
- /**
110
- * The default MIME types for the JSON Body Parser
111
- */
112
- declare const DefaultJsonBodyParserOptionsTypes: string[];
113
- /**
114
- * The default options for the JSON Body Parser
115
- */
116
- declare const DefaultJsonBodyParserOptions: OptionsJson;
117
- /**
118
- * Gets the default JSON Body Parser options merged with the supplied options
119
- * with the supplied options taking precedence
120
- * @param options The options to override the default JSON Body Parser options with
121
- * @returns The combined JSON Body Parser options with the supplied values taking
122
- * precedence over the default
123
- */
124
- declare const getJsonBodyParserOptions: (options?: Partial<OptionsJson>) => OptionsJson;
125
- /**
126
- * Get a JSON Body Parser connect middleware handler
127
- * @param options The options for the JSON Body Parser
128
- * @returns A middleware function that parses JSON bodies
129
- */
130
- declare const getJsonBodyParser: (options?: OptionsJson) => NextHandleFunction;
131
- /**
132
- * A JSON Body Parser middleware handler initialized with the default options
133
- */
134
- declare const jsonBodyParser: NextHandleFunction;
135
-
136
- declare const useRequestCounters: (app: Application) => void;
137
-
138
- /**
139
- * Connect middleware to enable profiling of response lifecycle timing. To effectively profile
140
- * the response timing, this middleware needs to be called first when initializing your Express
141
- * App
142
- * @example
143
- * const app = express()
144
- * app.use(responseProfiler)
145
- * // other initialization ...
146
- * @param _req The request
147
- * @param res The response
148
- * @param next The next function
149
- */
150
- declare const responseProfiler: (_req: Request, res: Response, next: NextFunction) => void;
151
-
152
- declare const getResponseMetadata: (res: Response) => Record<string, unknown>;
153
-
154
- interface HrefWithMeta {
155
- href: string;
156
- meta: Record<string, unknown>;
157
- }
158
- type ApiLink = string | HrefWithMeta;
159
- type ApiLinks = Record<string, ApiLink>;
160
-
161
- /**
162
- * An object containing references to the source of the error
163
- */
164
- interface Source {
165
- /**
166
- * A string indicating which URI query parameter caused the error.
167
- */
168
- parameter?: string;
169
- /**
170
- * A JSON Pointer [RFC6901] to the associated entity in the request document [e.g. "/data" for a primary data object,
171
- * or "/data/attributes/title" for a specific attribute].
172
- */
173
- pointer?: string;
174
- }
175
- interface ApiError {
176
- /**
177
- * An application-specific error code, expressed as a string value.
178
- */
179
- code?: string;
180
- /**
181
- * A human-readable explanation specific to this occurrence of the problem. Like title, this field's value can be localized.
182
- */
183
- detail?: string;
184
- /**
185
- * A unique identifier for this particular occurrence of the problem.
186
- */
187
- id?: string;
188
- /**
189
- * A links object containing the following members:
190
- * about: a link that leads to further details about this particular occurrence of the problem
191
- */
192
- links?: ApiLinks;
193
- /**
194
- * A meta object containing non-standard meta-information about the error.
195
- */
196
- meta?: Record<string, unknown>;
197
- /**
198
- * An object containing references to the source of the error, optionally including any of the following members:
199
- */
200
- source?: Source;
201
- /**
202
- * The HTTP status code applicable to this problem, expressed as a string value.
203
- */
204
- status?: string;
205
- /**
206
- * A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.
207
- */
208
- title?: string;
209
- }
210
-
211
- /**
212
- * Within a given API, each resource object's type and id pair MUST identify a single, unique resource.
213
- * (The set of URIs controlled by a server, or multiple servers acting as one, constitute an API.)
214
- */
215
- interface ApiResourceIdentifierObject {
216
- /**
217
- * The id member is not required when the resource object originates at the client and represents a new resource to be created on the server.
218
- */
219
- id: string;
220
- /**
221
- * The type member is used to describe resource objects that share common attributes and relationships.
222
- * The values of type members MUST adhere to the same constraints as member names.
223
- */
224
- type: string;
225
- }
226
-
227
- interface IRelationshipSelfLink {
228
- /**
229
- * A link for the relationship itself (a "relationship link"). This link allows the client to directly manipulate the relationship.
230
- * For example, removing an author through an article’s relationship URL would disconnect the person from the article without
231
- * deleting the people resource itself. When fetched successfully, this link returns the linkage for the related resources as its primary data.
232
- */
233
- self: string;
234
- }
235
- interface IRelationshipRelatedLink {
236
- /**
237
- * A related resource link
238
- */
239
- related: string;
240
- }
241
- interface IRelationshipLinks {
242
- links: IRelationshipRelatedLink | IRelationshipSelfLink;
243
- }
244
- /**
245
- * Resource linkage in a compound document allows a client to link together all of the included resource objects without having to GET any URLs via links.
246
- * Resource linkage MUST be represented as one of the following:
247
- * • null for empty to-one relationships.
248
- * • an empty array ([]) for empty to-many relationships.
249
- * • a single resource identifier object for non-empty to-one relationships.
250
- * • an array of resource identifier objects for non-empty to-many relationships.
251
- */
252
- type ResourceLinkage = null | [] | ApiResourceIdentifierObject | ApiResourceIdentifierObject[];
253
- interface IRelationshipData {
254
- data: ResourceLinkage;
255
- }
256
- type RelationshipMeta = Record<string, unknown>;
257
- /**
258
- * The value of the relationships key MUST be an object (a "relationships object"). Members of the relationships object ("relationships")
259
- * represent references from the resource object in which it’s defined to other resource objects.
260
- * Relationships may be to-one or to-many.
261
- */
262
- type Relationship = IRelationshipLinks | IRelationshipData | RelationshipMeta;
263
-
264
- /**
265
- * Loosely following the JSON API 1.0 formats and conventions
266
- * https://jsonapi.org/format/
267
- */
268
-
269
- interface ApiResourceObject extends ApiResourceIdentifierObject {
270
- /**
271
- * An attributes object representing some of the resource's data.
272
- */
273
- attributes?: Record<string, unknown>;
274
- /**
275
- * A links object containing links related to the resource.
276
- */
277
- links?: ApiLinks;
278
- /**
279
- * A meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship.
280
- */
281
- meta?: Record<string, unknown>;
282
- /**
283
- * A relationships object describing relationships between the resource and other JSON:API resources.
284
- */
285
- relationships?: Record<string, Relationship>;
286
- }
287
- interface JsonApi {
288
- meta?: Record<string, unknown>;
289
- version?: '1.0' | '1.1';
290
- }
291
- interface ApiResponseBase {
292
- jsonapi?: JsonApi;
293
- links?: ApiLinks;
294
- meta?: Record<string, unknown>;
295
- }
296
- interface ApiDataResponse<T extends ApiResourceIdentifierObject> extends ApiResponseBase {
297
- data: T;
298
- included?: ApiResourceObject[];
299
- }
300
- interface ApiErrorResponse extends ApiResponseBase {
301
- errors: ApiError[];
302
- }
303
- type ApiResponse<T extends ApiResourceIdentifierObject> = ApiDataResponse<T> | ApiErrorResponse;
304
-
305
- declare const standardErrors: (err: ExpressError | undefined, req: Request, res: Response, next: NextFunction) => void;
306
-
307
- /**
308
- * Flags the response to forgo the standard response envelope
309
- * and return the raw response body to the client
310
- * @param res The response to disable the standard response format on
311
- */
312
- declare const setRawResponseFormat: (res: Response) => void;
313
- /**
314
- * Clears any flags on the response, allowing the response to
315
- * use the default standard response envelope
316
- * @param res The response to set to the standard response format
317
- */
318
- declare const clearRawResponseFormat: (res: Response) => void;
319
- /**
320
- * Checks if there are any flags on the response that would cause it
321
- * to forgo the standard response envelope and return the raw response
322
- * body to the client
323
- * @param res
324
- * @returns True if there are any flags on the response, false otherwise
325
- */
326
- declare const isRawResponseFormatSet: (res: Response) => boolean;
327
- /**
328
- * Connect middleware to enable the transform of all responses to match
329
- * the standard response format (compatible with JSON API)
330
- */
331
- declare const standardResponses: RequestHandler;
332
-
333
- declare class Counters {
334
- static counters: Record<string, number>;
335
- static inc(name: string, count?: number): void;
336
- static max(name: string, count: number): void;
337
- static min(name: string, count: number): void;
338
- private static catchError;
339
- }
340
-
341
- declare class Profiler {
342
- stats: Record<string, number>;
343
- profile<T>(name: string, promise: Promise<T>): Promise<T>;
344
- }
345
-
346
- declare const compactObject: <T extends Record<string, unknown>>(obj: T) => T;
347
-
348
- type ParseFunc<T = number> = (value: string) => T;
349
- declare const tryParse: <T = number>(func: ParseFunc<T>, value?: string) => (T & {}) | undefined;
350
- declare const tryParseFloat: (value?: string) => number | undefined;
351
- declare const tryParseInt: (value?: string) => number | undefined;
352
-
353
- export { Counters, DefaultJsonBodyParserOptions, DefaultJsonBodyParserOptionsLimit, DefaultJsonBodyParserOptionsTypes, Profiler, WrappedWinstonLogger, asyncHandler, clearRawResponseFormat, compactObject, customPoweredByHeader, disableCaseSensitiveRouting, disableExpressDefaultPoweredByHeader, enableCaseSensitiveRouting, enableExpressDefaultPoweredByHeader, errorToJsonHandler, getDefaultLogger, getHttpHeader, getJsonBodyParser, getJsonBodyParserOptions, getLogger, getResponseMetadata, isRawResponseFormatSet, jsonBodyParser, notImplemented, responseProfiler, setRawResponseFormat, standardErrors, standardResponses, tryParse, tryParseFloat, tryParseInt, useRequestCounters };
354
- export type { ApiDataResponse, ApiError, ApiErrorResponse, ApiLink, ApiLinks, ApiResourceIdentifierObject, ApiResourceObject, ApiResponse, ApiResponseBase, Empty, ExpressError, HrefWithMeta, IRelationshipData, IRelationshipLinks, IRelationshipRelatedLink, IRelationshipSelfLink, JsonApi, LogFunction, Logger, LoggerMeta, LoggerOptions, LoggerVerbosity, NoLocals, NoReqBody, NoReqParams, NoReqQuery, NoResBody, ParseFunc, Relationship, RelationshipMeta, ResourceLinkage, Source };
1
+ export * from './Handler/index.ts';
2
+ export * from './HttpUtil/index.ts';
3
+ export * from './Logger/index.ts';
4
+ export * from './middleware/index.ts';
5
+ export * from './Model/index.ts';
6
+ export * from './Performance/index.ts';
7
+ export * from './Util/index.ts';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ import '@xylabs/vitest-extended';
2
+ //# sourceMappingURL=jsonBodyParser.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonBodyParser.spec.d.ts","sourceRoot":"","sources":["../../../../../src/middleware/jsonBodyParser/spec/jsonBodyParser.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/express",
3
- "version": "4.13.15",
3
+ "version": "4.13.17",
4
4
  "description": "SDK for base code for Api repos that use express and deploy on AWS ECS",
5
5
  "keywords": [
6
6
  "xylabs",
@@ -47,9 +47,9 @@
47
47
  "dependencies": {
48
48
  "@types/connect": "^3.4.38",
49
49
  "@types/express-serve-static-core": "^5.0.7",
50
- "@xylabs/assert": "^4.13.15",
51
- "@xylabs/logger": "^4.13.15",
52
- "@xylabs/typeof": "^4.13.15",
50
+ "@xylabs/assert": "^4.13.17",
51
+ "@xylabs/logger": "^4.13.17",
52
+ "@xylabs/typeof": "^4.13.17",
53
53
  "body-parser": "^2.2.0",
54
54
  "express-mung": "^0.5.1",
55
55
  "http-status-codes": "^2.3.0",
@@ -61,10 +61,10 @@
61
61
  "@types/body-parser": "^1.19.6",
62
62
  "@types/express": "^5.0.3",
63
63
  "@types/express-mung": "^0.5.5",
64
- "@types/node": "^24.0.13",
65
- "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.20",
66
- "@xylabs/tsconfig": "^7.0.0-rc.20",
67
- "@xylabs/vitest-extended": "^4.13.15",
64
+ "@types/node": "^24.0.14",
65
+ "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.27",
66
+ "@xylabs/tsconfig": "^7.0.0-rc.27",
67
+ "@xylabs/vitest-extended": "^4.13.17",
68
68
  "body-parser": "^2.2.0",
69
69
  "express": "^5.1.0",
70
70
  "express-mung": "^0.5.1",
@@ -1,8 +0,0 @@
1
- export * from './Handler/index.ts';
2
- export * from './HttpUtil/index.ts';
3
- export * from './Logger/index.ts';
4
- export * from './middleware/index.ts';
5
- export * from './Model/index.ts';
6
- export * from './Performance/index.ts';
7
- export * from './Util/index.ts';
8
- //# sourceMappingURL=index.d.ts.map
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes