@biorate/nestjs-tools 1.156.2 → 1.163.2

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 CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.163.2](https://github.com/biorate/core/compare/v1.163.1...v1.163.2) (2025-11-18)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **nestjs-tools:** corsOriginHandler added ([6f0c705](https://github.com/biorate/core/commit/6f0c7053098e7462fefe04e6d002ceec23a7f47c))
11
+
12
+ # [1.163.0](https://github.com/biorate/core/compare/v1.162.0...v1.163.0) (2025-10-27)
13
+
14
+ **Note:** Version bump only for package @biorate/nestjs-tools
15
+
6
16
  ## [1.156.2](https://github.com/biorate/core/compare/v1.156.1...v1.156.2) (2025-09-18)
7
17
 
8
18
  ### Bug Fixes
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.corsOriginHandler = void 0;
4
+ const inversion_1 = require("@biorate/inversion");
5
+ const errors_1 = require("./errors");
6
+ function corsOriginHandler(origin, callback) {
7
+ if (!origin)
8
+ return callback(null, origin);
9
+ const config = inversion_1.container.get(inversion_1.Types.Config);
10
+ const regexp = new RegExp(config.get('allowedOrigin', config.get('package.name').replace('-server', '')));
11
+ callback(regexp.test(origin) ? null : new errors_1.CorsBadOriginError(origin), origin);
12
+ }
13
+ exports.corsOriginHandler = corsOriginHandler;
14
+ //# sourceMappingURL=cors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cors.js","sourceRoot":"","sources":["../../src/cors.ts"],"names":[],"mappings":";;;AAAA,kDAAsD;AAEtD,qCAA8C;AAE9C,SAAgB,iBAAiB,CAC/B,MAAc,EACd,QAAuD;IAEvD,IAAI,CAAC,MAAM;QAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,qBAAS,CAAC,GAAG,CAAU,iBAAK,CAAC,MAAM,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB,MAAM,CAAC,GAAG,CACR,eAAe,EACf,MAAM,CAAC,GAAG,CAAS,cAAc,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAC1D,CACF,CAAC;IACF,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,2BAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;AAChF,CAAC;AAbD,8CAaC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AxiosRequestError = exports.UnsupportedProtocolError = void 0;
3
+ exports.CorsBadOriginError = exports.AxiosRequestError = exports.UnsupportedProtocolError = void 0;
4
4
  const errors_1 = require("@biorate/errors");
5
5
  class UnsupportedProtocolError extends errors_1.BaseError {
6
6
  constructor(name) {
@@ -14,4 +14,10 @@ class AxiosRequestError extends errors_1.BaseError {
14
14
  }
15
15
  }
16
16
  exports.AxiosRequestError = AxiosRequestError;
17
+ class CorsBadOriginError extends errors_1.BaseError {
18
+ constructor(origin) {
19
+ super(`Cors bad origin error: [%s]`, [origin]);
20
+ }
21
+ }
22
+ exports.CorsBadOriginError = CorsBadOriginError;
17
23
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAE5C,MAAa,wBAAyB,SAAQ,kBAAS;IACrD,YAAmB,IAAY;QAC7B,KAAK,CAAC,4BAA4B,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;CACF;AAJD,4DAIC;AAED,MAAa,iBAAkB,SAAQ,kBAAS;IAC9C,YAAmB,IAAY,EAAE,KAAa,EAAE,OAAe;QAC7D,KAAK,CAAC,mCAAmC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IACrE,CAAC;CACF;AAJD,8CAIC"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAE5C,MAAa,wBAAyB,SAAQ,kBAAS;IACrD,YAAmB,IAAY;QAC7B,KAAK,CAAC,4BAA4B,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;CACF;AAJD,4DAIC;AAED,MAAa,iBAAkB,SAAQ,kBAAS;IAC9C,YAAmB,IAAY,EAAE,KAAa,EAAE,OAAe;QAC7D,KAAK,CAAC,mCAAmC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IACrE,CAAC;CACF;AAJD,8CAIC;AAED,MAAa,kBAAmB,SAAQ,kBAAS;IAC/C,YAAmB,MAAc;QAC/B,KAAK,CAAC,6BAA6B,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IACjD,CAAC;CACF;AAJD,gDAIC"}
package/dist/src/index.js CHANGED
@@ -23,4 +23,5 @@ __exportStar(require("./providers"), exports);
23
23
  __exportStar(require("./errors"), exports);
24
24
  __exportStar(require("./http"), exports);
25
25
  __exportStar(require("./app"), exports);
26
+ __exportStar(require("./cors"), exports);
26
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,0CAAwB;AACxB,4CAA0B;AAC1B,iDAA+B;AAC/B,gDAA8B;AAC9B,8CAA4B;AAC5B,2CAAyB;AACzB,yCAAuB;AACvB,wCAAsB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,0CAAwB;AACxB,4CAA0B;AAC1B,iDAA+B;AAC/B,gDAA8B;AAC9B,8CAA4B;AAC5B,2CAAyB;AACzB,yCAAuB;AACvB,wCAAsB;AACtB,yCAAuB"}