@donmahallem/turbo 2.4.10 → 3.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.
Files changed (37) hide show
  1. package/README.md +6 -6
  2. package/dist/cjs/promise-request-handler.cjs +2 -2
  3. package/dist/cjs/promise-request-handler.cjs.map +1 -1
  4. package/dist/cjs/promise-to-response.cjs +2 -5
  5. package/dist/cjs/promise-to-response.cjs.map +1 -1
  6. package/dist/cjs/request-error.cjs +2 -2
  7. package/dist/cjs/request-error.cjs.map +1 -1
  8. package/dist/esm/promise-request-handler.mjs +2 -2
  9. package/dist/esm/promise-request-handler.mjs.map +1 -1
  10. package/dist/esm/promise-to-response.mjs +2 -5
  11. package/dist/esm/promise-to-response.mjs.map +1 -1
  12. package/dist/esm/request-error.mjs +2 -2
  13. package/dist/esm/request-error.mjs.map +1 -1
  14. package/dist/types/error-response.d.ts +4 -0
  15. package/dist/types/error-response.d.ts.map +1 -1
  16. package/dist/types/index.d.ts +4 -0
  17. package/dist/types/index.d.ts.map +1 -1
  18. package/dist/types/index.spec.d.ts +4 -0
  19. package/dist/types/index.spec.d.ts.map +1 -1
  20. package/dist/types/promise-request-handler.d.ts +4 -0
  21. package/dist/types/promise-request-handler.d.ts.map +1 -1
  22. package/dist/types/promise-request-handler.spec.d.ts +4 -0
  23. package/dist/types/promise-request-handler.spec.d.ts.map +1 -1
  24. package/dist/types/promise-to-response.d.ts +4 -0
  25. package/dist/types/promise-to-response.d.ts.map +1 -1
  26. package/dist/types/promise-to-response.spec.d.ts +4 -0
  27. package/dist/types/promise-to-response.spec.d.ts.map +1 -1
  28. package/dist/types/request-error.d.ts +4 -0
  29. package/dist/types/request-error.d.ts.map +1 -1
  30. package/dist/types/request-error.spec.d.ts +4 -0
  31. package/dist/types/request-error.spec.d.ts.map +1 -1
  32. package/package.json +12 -12
  33. package/src/error-response.ts +2 -2
  34. package/src/index.ts +2 -2
  35. package/src/promise-request-handler.ts +2 -2
  36. package/src/promise-to-response.ts +2 -5
  37. package/src/request-error.ts +2 -2
package/README.md CHANGED
@@ -3,13 +3,13 @@
3
3
 
4
4
  # ➤ <h1 align="center">@donmahallem/turbo</h1>
5
5
  <p align="center">
6
- <a href="https://github.com/donmahallem/js-libs/actions?query=workflow%3ATest+branch%3Amaster"><img alt="Test" src="https://github.com/donmahallem/js-libs/workflows/Test/badge.svg?branch=master&event=push" height="20"/></a>
7
- <a href="https://codecov.io/gh/donmahallem/js-libs/donmahallem/master/packages/js-libs"><img alt="codecov" src="https://codecov.io/gh/donmahallem/js-libs/branch/master/graph/badge.svg?flag=Turbo" height="20"/></a>
6
+ <a href="https://github.com/donmahallem/turbo/actions?query=workflow%3ATest+branch%3Amaster"><img alt="Test" src="https://github.com/donmahallem/turbo/workflows/Test/badge.svg?branch=master&event=push" height="20"/></a>
7
+ <a href="https://codecov.io/gh/donmahallem/turbo/donmahallem/master/packages/turbo"><img alt="codecov" src="https://codecov.io/gh/donmahallem/turbo/branch/master/graph/badge.svg?flag=Turbo" height="20"/></a>
8
8
  <a href="https://badge.fury.io/js/%40donmahallem%2Fturbo"><img alt="npm version" src="https://badge.fury.io/js/%40donmahallem%2Fturbo.svg" height="20"/></a>
9
- <a href="https://github.com/donmahallem/js-libs/blob/master/LICENSE"><img alt="GitHub license" src="https://img.shields.io/github/license/donmahallem/js-libs" height="20"/></a>
10
- <a href="https://david-dm.org/donmahallem/js-libs?path=packages/turbo"><img alt="dependencies Status" src="https://david-dm.org/donmahallem/js-libs/status.svg?path=packages/turbo" height="20"/></a>
11
- <a href="https://david-dm.org/donmahallem/js-libs?path=packages/turbo&type=dev"><img alt="devDependencies Status" src="https://david-dm.org/donmahallem/js-libs/dev-status.svg?path=packages/turbo" height="20"/></a>
12
- <a href="https://github.com/donmahallem/js-libs/graphs/contributors"><img alt="GitHub contributors" src="https://img.shields.io/github/contributors-anon/donmahallem/js-libs" height="20"/></a>
9
+ <a href="https://github.com/donmahallem/turbo/blob/master/LICENSE"><img alt="GitHub license" src="https://img.shields.io/github/license/donmahallem/turbo" height="20"/></a>
10
+ <a href="https://david-dm.org/donmahallem/turbo?path=packages/turbo"><img alt="dependencies Status" src="https://david-dm.org/donmahallem/turbo/status.svg?path=packages/turbo" height="20"/></a>
11
+ <a href="https://david-dm.org/donmahallem/turbo?path=packages/turbo&type=dev"><img alt="devDependencies Status" src="https://david-dm.org/donmahallem/turbo/dev-status.svg?path=packages/turbo" height="20"/></a>
12
+ <a href="https://github.com/donmahallem/turbo/graphs/contributors"><img alt="GitHub contributors" src="https://img.shields.io/github/contributors-anon/donmahallem/turbo" height="20"/></a>
13
13
  </p>
14
14
 
15
15
 
@@ -2,9 +2,9 @@
2
2
 
3
3
  const promiseToResponse = require('./promise-to-response.cjs');
4
4
 
5
- /*
5
+ /**
6
6
  * Package @donmahallem/turbo
7
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/turbo
7
+ * Source https://github.com/donmahallem/turbo
8
8
  */
9
9
  /**
10
10
  * Does create an request handler that transforms a provided promise
@@ -1 +1 @@
1
- {"version":3,"file":"promise-request-handler.cjs","sources":["../../src/promise-request-handler.ts"],"sourcesContent":[null],"names":["promiseToResponse"],"mappings":";;;;AAAA;;;AAGG;AAQH;;;;AAIG;AACU,MAAA,qBAAqB,GAC9B,CAAI,IAAwB,KAC5B,CAAC,GAAY,EAAE,GAAiC,EAAE,IAAkB,KAAU;AAC1E,IAAAA,mCAAiB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;AACjD;;;;"}
1
+ {"version":3,"file":"promise-request-handler.cjs","sources":["../../src/promise-request-handler.ts"],"sourcesContent":[null],"names":["promiseToResponse"],"mappings":";;;;AAAA;;;AAGG;AAQH;;;;AAIG;AACU,MAAA,qBAAqB,GAC9B,CAAI,IAAwB,KAC5B,CAAC,GAAY,EAAE,GAAiC,EAAE,IAAkB,KAAU;AAC1E,IAAAA,mCAAiB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC;AAChD;;;;"}
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- /*
3
+ /**
4
4
  * Package @donmahallem/turbo
5
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/turbo
5
+ * Source https://github.com/donmahallem/turbo
6
6
  */
7
7
  /**
8
8
  * Awaits an promise and returns it
@@ -19,10 +19,8 @@ const promiseToResponse = (prom, res, next) => {
19
19
  if (next) {
20
20
  next(err);
21
21
  return;
22
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
23
22
  }
24
23
  else if (err && err.isAxiosError === true) {
25
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
26
24
  const axiosError = err;
27
25
  const code = axiosError.response?.status || 500;
28
26
  res.status(code).json({
@@ -32,7 +30,6 @@ const promiseToResponse = (prom, res, next) => {
32
30
  return;
33
31
  }
34
32
  else {
35
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment
36
33
  const code = err?.statusCode || 500;
37
34
  res.status(code).json({
38
35
  error: true,
@@ -1 +1 @@
1
- {"version":3,"file":"promise-to-response.cjs","sources":["../../src/promise-to-response.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;AAQH;;;;;AAKG;AACU,MAAA,iBAAiB,GAAe,CAAI,IAAgB,EAAE,GAAiC,EAAE,IAAmB,KAAU;AAC/H,IAAA,IAAI,CAAC,IAAI,CAAC,CAAC,KAAQ,KAAU;QACzB,CAAC,GAAG,CAAC,WAAW,GAAG,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1D,KAAC,CAAC;;AAEG,SAAA,KAAK,CAAC,CAAC,GAAQ,KAAU;QACtB,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,OAAO;;SAEV;aAAM,IAAI,GAA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YAAA,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;AAClB,gBAAA,KAAK,EAAE,IAAI;AACX,gBAAA,UAAU,EAAE,IAAI;AACnB,aAAA,CAAC;YACF;;aACG;AACH,YAAA,MAAM,IAAI,GAAW,GAAG,EAAE,UAAU,IAAI,GAAG;AAC3C,YAAA,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;AAClB,gBAAA,KAAK,EAAE,IAAI;AACX,gBAAA,UAAU,EAAE,IAAI;AACnB,aAAA,CAAC;YACF;;AAER,KAAC,CAAC;AACV;;;;"}
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- /*
3
+ /**
4
4
  * Package @donmahallem/turbo
5
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/turbo
5
+ * Source https://github.com/donmahallem/turbo
6
6
  */
7
7
  /**
8
8
  * Error that should be compatible with express errors
@@ -1 +1 @@
1
- {"version":3,"file":"request-error.cjs","sources":["../../src/request-error.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;AAEH;;AAEG;AACG,MAAO,YAAa,SAAQ,KAAK,CAAA;AAQf,IAAA,MAAA,CAAA;AAPpB;;;;AAIG;IACH,WACI,CAAA,OAAe,EACC,MAAA,GAAiB,GAAG,EAAA;QAEpC,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,IAAM,CAAA,MAAA,GAAN,MAAM,CAAc;AAGpC,QAAA,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;KACjC;AACJ;;;;"}
1
+ {"version":3,"file":"request-error.cjs","sources":["../../src/request-error.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;AAEH;;AAEG;AACG,MAAO,YAAa,SAAQ,KAAK,CAAA;AAQf,IAAA,MAAA;AAPpB;;;;AAIG;IACH,WACI,CAAA,OAAe,EACC,MAAA,GAAiB,GAAG,EAAA;QAEpC,KAAK,CAAC,OAAO,CAAC;QAFE,IAAM,CAAA,MAAA,GAAN,MAAM;AAGtB,QAAA,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI;;AAEpC;;;;"}
@@ -1,8 +1,8 @@
1
1
  import { promiseToResponse } from './promise-to-response.mjs';
2
2
 
3
- /*
3
+ /**
4
4
  * Package @donmahallem/turbo
5
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/turbo
5
+ * Source https://github.com/donmahallem/turbo
6
6
  */
7
7
  /**
8
8
  * Does create an request handler that transforms a provided promise
@@ -1 +1 @@
1
- {"version":3,"file":"promise-request-handler.mjs","sources":["../../src/promise-request-handler.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;AAQH;;;;AAIG;AACU,MAAA,qBAAqB,GAC9B,CAAI,IAAwB,KAC5B,CAAC,GAAY,EAAE,GAAiC,EAAE,IAAkB,KAAU;AAC1E,IAAA,iBAAiB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;AACjD;;;;"}
1
+ {"version":3,"file":"promise-request-handler.mjs","sources":["../../src/promise-request-handler.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;AAQH;;;;AAIG;AACU,MAAA,qBAAqB,GAC9B,CAAI,IAAwB,KAC5B,CAAC,GAAY,EAAE,GAAiC,EAAE,IAAkB,KAAU;AAC1E,IAAA,iBAAiB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC;AAChD;;;;"}
@@ -1,6 +1,6 @@
1
- /*
1
+ /**
2
2
  * Package @donmahallem/turbo
3
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/turbo
3
+ * Source https://github.com/donmahallem/turbo
4
4
  */
5
5
  /**
6
6
  * Awaits an promise and returns it
@@ -17,10 +17,8 @@ const promiseToResponse = (prom, res, next) => {
17
17
  if (next) {
18
18
  next(err);
19
19
  return;
20
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
21
20
  }
22
21
  else if (err && err.isAxiosError === true) {
23
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
24
22
  const axiosError = err;
25
23
  const code = axiosError.response?.status || 500;
26
24
  res.status(code).json({
@@ -30,7 +28,6 @@ const promiseToResponse = (prom, res, next) => {
30
28
  return;
31
29
  }
32
30
  else {
33
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment
34
31
  const code = err?.statusCode || 500;
35
32
  res.status(code).json({
36
33
  error: true,
@@ -1 +1 @@
1
- {"version":3,"file":"promise-to-response.mjs","sources":["../../src/promise-to-response.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;AAGG;AAQH;;;;;AAKG;AACU,MAAA,iBAAiB,GAAe,CAAI,IAAgB,EAAE,GAAiC,EAAE,IAAmB,KAAU;AAC/H,IAAA,IAAI,CAAC,IAAI,CAAC,CAAC,KAAQ,KAAU;QACzB,CAAC,GAAG,CAAC,WAAW,GAAG,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1D,KAAC,CAAC;;AAEG,SAAA,KAAK,CAAC,CAAC,GAAQ,KAAU;QACtB,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,OAAO;;SAEV;aAAM,IAAI,GAAG,IAAI,GAAG,CAAC,YAAY,KAAK,IAAI,EAAE;;YAEzC,MAAM,UAAU,GAAe,GAAG,CAAC;YACnC,MAAM,IAAI,GAAW,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,CAAC;AACxD,YAAA,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;AAClB,gBAAA,KAAK,EAAE,IAAI;AACX,gBAAA,UAAU,EAAE,IAAI;AACnB,aAAA,CAAC,CAAC;YACH,OAAO;SACV;aAAM;;AAEH,YAAA,MAAM,IAA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C;YACF;;AAER,KAAC,CAAC;AACV;;;;"}
@@ -1,6 +1,6 @@
1
- /*
1
+ /**
2
2
  * Package @donmahallem/turbo
3
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/turbo
3
+ * Source https://github.com/donmahallem/turbo
4
4
  */
5
5
  /**
6
6
  * Error that should be compatible with express errors
@@ -1 +1 @@
1
- {"version":3,"file":"request-error.mjs","sources":["../../src/request-error.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;AAGG;AAEH;;AAEG;AACG,MAAO,YAAa,SAAQ,KAAK,CAAA;AAQf,IAAA,MAAA,CAAA;AAPpB;;;;AAIG;IACH,WACI,CAAA,OAAe,EACC,MAAA,GAAiB,GAAG,EAAA;QAEpC,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,IAAM,CAAA,MAAA,GAAN,MAAM,CAAc;AAGpC,QAAA,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;KACjC;AACJ;;;;"}
1
+ {"version":3,"file":"request-error.mjs","sources":["../../src/request-error.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;AAGG;AAEH;;AAEG;AACG,MAAO,YAAa,SAAQ,KAAK,CAAA;AAQf,IAAA,MAAA;AAPpB;;;;AAIG;IACH,WACI,CAAA,OAAe,EACC,MAAA,GAAiB,GAAG,EAAA;QAEpC,KAAK,CAAC,OAAO,CAAC;QAFE,IAAM,CAAA,MAAA,GAAN,MAAM;AAGtB,QAAA,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI;;AAEpC;;;;"}
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Package @donmahallem/turbo
3
+ * Source https://github.com/donmahallem/turbo
4
+ */
1
5
  /**
2
6
  * Error Object to provide
3
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"error-response.d.ts","sourceRoot":"","sources":["../../src/error-response.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,IAAI,CAAC;IACZ;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACtB"}
1
+ {"version":3,"file":"error-response.d.ts","sourceRoot":"","sources":["../../src/error-response.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,IAAI,CAAC;IACZ;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACtB"}
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Package @donmahallem/turbo
3
+ * Source https://github.com/donmahallem/turbo
4
+ */
1
5
  export { promiseRequestHandler } from './promise-request-handler.js';
2
6
  export { promiseToResponse } from './promise-to-response.js';
3
7
  export { RequestError } from './request-error.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,2 +1,6 @@
1
+ /**
2
+ * Package @donmahallem/turbo
3
+ * Source https://github.com/donmahallem/turbo
4
+ */
1
5
  import 'mocha';
2
6
  //# sourceMappingURL=index.spec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../src/index.spec.ts"],"names":[],"mappings":"AAMA,OAAO,OAAO,CAAC"}
1
+ {"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../src/index.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,OAAO,CAAC"}
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Package @donmahallem/turbo
3
+ * Source https://github.com/donmahallem/turbo
4
+ */
1
5
  import type { Request, RequestHandler, Response } from 'express';
2
6
  type MethodInterface<T> = (req?: Request, res?: Response<T>) => Promise<T>;
3
7
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"promise-request-handler.d.ts","sourceRoot":"","sources":["../../src/promise-request-handler.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAgB,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE/E,KAAK,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAE3E;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,cAIhE,CAAC"}
1
+ {"version":3,"file":"promise-request-handler.d.ts","sourceRoot":"","sources":["../../src/promise-request-handler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAgB,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE/E,KAAK,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAE3E;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,cAIhE,CAAC"}
@@ -1,2 +1,6 @@
1
+ /**
2
+ * Package @donmahallem/turbo
3
+ * Source https://github.com/donmahallem/turbo
4
+ */
1
5
  import 'mocha';
2
6
  //# sourceMappingURL=promise-request-handler.spec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"promise-request-handler.spec.d.ts","sourceRoot":"","sources":["../../src/promise-request-handler.spec.ts"],"names":[],"mappings":"AAOA,OAAO,OAAO,CAAC"}
1
+ {"version":3,"file":"promise-request-handler.spec.d.ts","sourceRoot":"","sources":["../../src/promise-request-handler.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,OAAO,CAAC"}
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Package @donmahallem/turbo
3
+ * Source https://github.com/donmahallem/turbo
4
+ */
1
5
  import type { NextFunction, Response } from 'express';
2
6
  type MethodType = <T>(prom: Promise<T>, res: Response, next?: NextFunction) => void;
3
7
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"promise-to-response.d.ts","sourceRoot":"","sources":["../../src/promise-to-response.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEtD,KAAK,UAAU,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;AAEpF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,UA6B/B,CAAC"}
1
+ {"version":3,"file":"promise-to-response.d.ts","sourceRoot":"","sources":["../../src/promise-to-response.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEtD,KAAK,UAAU,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;AAEpF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,UA0B/B,CAAC"}
@@ -1,2 +1,6 @@
1
+ /**
2
+ * Package @donmahallem/turbo
3
+ * Source https://github.com/donmahallem/turbo
4
+ */
1
5
  import 'mocha';
2
6
  //# sourceMappingURL=promise-to-response.spec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"promise-to-response.spec.d.ts","sourceRoot":"","sources":["../../src/promise-to-response.spec.ts"],"names":[],"mappings":"AAMA,OAAO,OAAO,CAAC"}
1
+ {"version":3,"file":"promise-to-response.spec.d.ts","sourceRoot":"","sources":["../../src/promise-to-response.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,OAAO,CAAC"}
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Package @donmahallem/turbo
3
+ * Source https://github.com/donmahallem/turbo
4
+ */
1
5
  /**
2
6
  * Error that should be compatible with express errors
3
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"request-error.d.ts","sourceRoot":"","sources":["../../src/request-error.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;aAQf,MAAM,EAAE,MAAM;IAPlC;;;;OAIG;gBAEC,OAAO,EAAE,MAAM,EACC,MAAM,GAAE,MAAY;CAK3C"}
1
+ {"version":3,"file":"request-error.d.ts","sourceRoot":"","sources":["../../src/request-error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;aAQf,MAAM,EAAE,MAAM;IAPlC;;;;OAIG;gBAEC,OAAO,EAAE,MAAM,EACC,MAAM,GAAE,MAAY;CAK3C"}
@@ -1,2 +1,6 @@
1
+ /**
2
+ * Package @donmahallem/turbo
3
+ * Source https://github.com/donmahallem/turbo
4
+ */
1
5
  import 'mocha';
2
6
  //# sourceMappingURL=request-error.spec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"request-error.spec.d.ts","sourceRoot":"","sources":["../../src/request-error.spec.ts"],"names":[],"mappings":"AAMA,OAAO,OAAO,CAAC"}
1
+ {"version":3,"file":"request-error.spec.d.ts","sourceRoot":"","sources":["../../src/request-error.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donmahallem/turbo",
3
- "version": "2.4.10",
3
+ "version": "3.0.0",
4
4
  "description": "Turbo Helpers for express.js",
5
5
  "types": "./dist/types/index.d.ts",
6
6
  "private": false,
@@ -21,15 +21,15 @@
21
21
  "build:types": "tsc --project ./tsconfig.json -d --declarationDir dist/types --declarationMap --emitDeclarationOnly",
22
22
  "test": "mocha --config ../../.mocharc.json",
23
23
  "test:coverage": "c8 --config ../../.nycrc.json npm run test",
24
- "lint": "eslint -c ./.eslintrc.cjs --ext .ts ./src",
24
+ "lint": "eslint -c ./.eslintrc.mjs ./src",
25
25
  "postlint": "prettier --config ./../../.prettierrc src/**/*.ts --check",
26
- "lint:fix": "eslint -c ./.eslintrc.cjs --ext .ts ./src --fix",
26
+ "lint:fix": "eslint -c ./.eslintrc.mjs ./src --fix",
27
27
  "postlint:fix": "prettier --config ./../../.prettierrc src/**/*.ts --write",
28
28
  "prepublishOnly": "npm run clean && npm run test && npm run build",
29
29
  "version": "npm run build:readme && git add README.md",
30
30
  "clean": "rimraf ./dist ./.nyc_output ./coverage ./docs"
31
31
  },
32
- "homepage": "https://github.com/donmahallem/js-libs/tree/master/packages/turbo",
32
+ "homepage": "https://github.com/donmahallem/turbo",
33
33
  "author": {
34
34
  "name": "donmahallem",
35
35
  "email": "donmahallem@users.noreply.github.com",
@@ -37,14 +37,14 @@
37
37
  },
38
38
  "license": "Apache-2.0",
39
39
  "bugs": {
40
- "url": "https://github.com/donmahallem/js-libs/issues"
40
+ "url": "https://github.com/donmahallem/turbo/issues"
41
41
  },
42
42
  "repository": {
43
43
  "type": "git",
44
- "url": "https://github.com/donmahallem/js-libs.git"
44
+ "url": "https://github.com/donmahallem/turbo.git"
45
45
  },
46
46
  "engines": {
47
- "node": ">=18"
47
+ "node": ">=20"
48
48
  },
49
49
  "files": [
50
50
  "dist/*",
@@ -55,15 +55,15 @@
55
55
  "access": "public"
56
56
  },
57
57
  "devDependencies": {
58
- "@types/express": "4.17.21",
58
+ "@types/express": "5.0.0",
59
59
  "@types/supertest": "6.0.2",
60
- "axios": "1.6.3",
61
- "express": "4.18.2",
62
- "supertest": "6.3.3"
60
+ "axios": "1.7.9",
61
+ "express": "4.21.2",
62
+ "supertest": "7.0.0"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "axios": "^1.0.0",
66
66
  "express": "^4.17.1"
67
67
  },
68
- "gitHead": "8a528fb50713be968e3f490ef65b775437015996"
68
+ "gitHead": "6df4e50cd881841dfe090786f333affe02ead780"
69
69
  }
@@ -1,6 +1,6 @@
1
- /*
1
+ /**
2
2
  * Package @donmahallem/turbo
3
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/turbo
3
+ * Source https://github.com/donmahallem/turbo
4
4
  */
5
5
 
6
6
  /**
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
- /*
1
+ /**
2
2
  * Package @donmahallem/turbo
3
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/turbo
3
+ * Source https://github.com/donmahallem/turbo
4
4
  */
5
5
 
6
6
  export { promiseRequestHandler } from './promise-request-handler.js';
@@ -1,6 +1,6 @@
1
- /*
1
+ /**
2
2
  * Package @donmahallem/turbo
3
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/turbo
3
+ * Source https://github.com/donmahallem/turbo
4
4
  */
5
5
 
6
6
  import { IErrorResponse } from './error-response.js';
@@ -1,6 +1,6 @@
1
- /*
1
+ /**
2
2
  * Package @donmahallem/turbo
3
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/turbo
3
+ * Source https://github.com/donmahallem/turbo
4
4
  */
5
5
 
6
6
  import { IErrorResponse } from './error-response.js';
@@ -24,9 +24,7 @@ export const promiseToResponse: MethodType = <T>(prom: Promise<T>, res: Response
24
24
  if (next) {
25
25
  next(err);
26
26
  return;
27
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
28
27
  } else if (err && err.isAxiosError === true) {
29
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
30
28
  const axiosError: AxiosError = err;
31
29
  const code: number = axiosError.response?.status || 500;
32
30
  res.status(code).json({
@@ -35,7 +33,6 @@ export const promiseToResponse: MethodType = <T>(prom: Promise<T>, res: Response
35
33
  });
36
34
  return;
37
35
  } else {
38
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment
39
36
  const code: number = err?.statusCode || 500;
40
37
  res.status(code).json({
41
38
  error: true,
@@ -1,6 +1,6 @@
1
- /*
1
+ /**
2
2
  * Package @donmahallem/turbo
3
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/turbo
3
+ * Source https://github.com/donmahallem/turbo
4
4
  */
5
5
 
6
6
  /**