@golemio/core 1.1.12-dev.464849582 → 1.2.1-dev.476649313

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.
@@ -0,0 +1,7 @@
1
+ import { NextFunction, Request, Response } from "express";
2
+ /**
3
+ * Error-handling middleware preprocessor
4
+ * HttpError based exceptions with pregenarated error status code are mapped to preferred CustomError type.
5
+ * Result is send to express.js next function with other custom or default error handler.
6
+ */
7
+ export declare const mapErrorsToCustomType: (err: any, _request: Request, _response: Response, next: NextFunction) => void;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapErrorsToCustomType = void 0;
4
+ const errors_1 = require("@golemio/errors");
5
+ /**
6
+ * Error-handling middleware preprocessor
7
+ * HttpError based exceptions with pregenarated error status code are mapped to preferred CustomError type.
8
+ * Result is send to express.js next function with other custom or default error handler.
9
+ */
10
+ const mapErrorsToCustomType = (err, _request, _response, next) => {
11
+ if (!(err instanceof errors_1.CustomError) && Number.isInteger(err.status)) {
12
+ let isClientError = err.status >= 400 && err.status < 500;
13
+ next(new errors_1.CustomError(err.message, isClientError, undefined, err.status, err));
14
+ }
15
+ else {
16
+ next(err);
17
+ }
18
+ };
19
+ exports.mapErrorsToCustomType = mapErrorsToCustomType;
20
+ //# sourceMappingURL=ErrorPreprocessorMiddleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorPreprocessorMiddleware.js","sourceRoot":"","sources":["../../../src/input-gateway/helpers/ErrorPreprocessorMiddleware.ts"],"names":[],"mappings":";;;AAAA,4CAA8C;AAG9C;;;;GAIG;AACI,MAAM,qBAAqB,GAAG,CAAC,GAAQ,EAAE,QAAiB,EAAE,SAAmB,EAAE,IAAkB,EAAE,EAAE;IAC1G,IAAI,CAAC,CAAC,GAAG,YAAY,oBAAW,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;QAC/D,IAAI,aAAa,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC;QAC1D,IAAI,CAAC,IAAI,oBAAW,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;KACjF;SAAM;QACH,IAAI,CAAC,GAAG,CAAC,CAAC;KACb;AACL,CAAC,CAAC;AAPW,QAAA,qBAAqB,yBAOhC"}
@@ -1,5 +1,6 @@
1
- export * from "./Logger";
2
1
  export * from "./CheckContentTypeMiddleware";
3
2
  export * from "./ContentTypeHelper";
3
+ export * from "./ErrorPreprocessorMiddleware";
4
+ export * from "./Logger";
4
5
  export * from "./ResponseTimeMiddleware";
5
6
  export * from "./SaveRawDataMiddleware";
@@ -11,9 +11,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  /* ig/helpers/index.ts */
14
- __exportStar(require("./Logger"), exports);
15
14
  __exportStar(require("./CheckContentTypeMiddleware"), exports);
16
15
  __exportStar(require("./ContentTypeHelper"), exports);
16
+ __exportStar(require("./ErrorPreprocessorMiddleware"), exports);
17
+ __exportStar(require("./Logger"), exports);
17
18
  __exportStar(require("./ResponseTimeMiddleware"), exports);
18
19
  __exportStar(require("./SaveRawDataMiddleware"), exports);
19
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/input-gateway/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yBAAyB;AACzB,2CAAyB;AACzB,+DAA6C;AAC7C,sDAAoC;AACpC,2DAAyC;AACzC,0DAAwC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/input-gateway/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yBAAyB;AACzB,+DAA6C;AAC7C,sDAAoC;AACpC,gEAA8C;AAC9C,2CAAyB;AACzB,2DAAyC;AACzC,0DAAwC"}
@@ -1,2 +1,3 @@
1
- import * as axios from "axios";
2
- export = axios;
1
+ export * from "axios";
2
+ import axios from "axios";
3
+ export default axios;
@@ -6,18 +6,14 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
6
6
  if (k2 === undefined) k2 = k;
7
7
  o[k2] = m[k];
8
8
  }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
11
  };
21
- const axios = __importStar(require("axios"));
22
- module.exports = axios;
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ __exportStar(require("axios"), exports);
17
+ const axios_1 = __importDefault(require("axios"));
18
+ exports.default = axios_1.default;
23
19
  //# sourceMappingURL=axios.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"axios.js","sourceRoot":"","sources":["../../src/shared/axios.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,iBAAS,KAAK,CAAC"}
1
+ {"version":3,"file":"axios.js","sourceRoot":"","sources":["../../src/shared/axios.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,kDAA0B;AAC1B,kBAAe,eAAK,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/core",
3
- "version": "1.1.12-dev.464849582",
3
+ "version": "1.2.1-dev.476649313",
4
4
  "description": "Golemio Core Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,7 +15,7 @@
15
15
  "test-debug": "run-s 'test --inspect-brk=9230'",
16
16
  "code-coverage": "nyc run-s 'test -r source-map-support/register'",
17
17
  "generate-docs": "typedoc --out docs/typedoc src",
18
- "lint": "eslint '{src,test}/**/*.ts'"
18
+ "lint": "eslint \"{src,test}/**/*.ts\""
19
19
  },
20
20
  "keywords": [
21
21
  "golemio"
@@ -123,6 +123,7 @@
123
123
  },
124
124
  "resolutions": {
125
125
  "mpath": "^0.8.4",
126
- "**/axios/follow-redirects": "^1.14.7"
126
+ "**/axios/follow-redirects": "^1.14.7",
127
+ "url-parse": "^1.5.6"
127
128
  }
128
129
  }