@golemio/parkings 1.8.13-dev.1280386583 → 1.8.13-dev.1284220477

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.
@@ -5,4 +5,5 @@ export declare class PrimarySourceValidator {
5
5
  constructor(repository: CachedParkingSourcesRepository);
6
6
  validate: CustomValidator;
7
7
  validateLegacy: CustomValidator;
8
+ private isAllowedSource;
8
9
  }
@@ -25,27 +25,30 @@ exports.PrimarySourceValidator = void 0;
25
25
  const CachedParkingSourcesRepository_1 = require("../../../../helpers/data-access/CachedParkingSourcesRepository");
26
26
  const ModuleContainerToken_1 = require("../../../ioc/ModuleContainerToken");
27
27
  const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
28
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
28
29
  let PrimarySourceValidator = exports.PrimarySourceValidator = class PrimarySourceValidator {
29
30
  constructor(repository) {
30
31
  this.repository = repository;
31
32
  this.validate = (value, options) => __awaiter(this, void 0, void 0, function* () {
32
33
  const allowedSources = yield this.repository.getV3Sources();
33
- if (value instanceof Array) {
34
- return value.every((source) => allowedSources.includes(source));
35
- }
36
- else {
37
- return allowedSources.includes(value);
34
+ if (!this.isAllowedSource(value, allowedSources)) {
35
+ throw new golemio_errors_1.ValidationError("Source not allowed!");
38
36
  }
39
37
  });
40
38
  this.validateLegacy = (value, options) => __awaiter(this, void 0, void 0, function* () {
41
39
  const allowedSources = yield this.repository.getLegacySources();
40
+ if (!this.isAllowedSource(value, allowedSources)) {
41
+ throw new golemio_errors_1.ValidationError("Source not allowed!");
42
+ }
43
+ });
44
+ this.isAllowedSource = (value, allowedSources) => {
42
45
  if (value instanceof Array) {
43
46
  return value.every((source) => allowedSources.includes(source));
44
47
  }
45
48
  else {
46
49
  return allowedSources.includes(value);
47
50
  }
48
- });
51
+ };
49
52
  }
50
53
  };
51
54
  exports.PrimarySourceValidator = PrimarySourceValidator = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"PrimarySourceValidator.js","sourceRoot":"","sources":["../../../../../src/output-gateway/routers/v3/helpers/PrimarySourceValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,mHAAqG;AACrG,4EAAoE;AAEpE,iEAAwE;AAGjE,IAAM,sBAAsB,oCAA5B,MAAM,sBAAsB;IAC/B,YACiE,UAAkD;QAA1C,eAAU,GAAV,UAAU,CAAgC;QAG5G,aAAQ,GAAoB,CAAO,KAAK,EAAE,OAAO,EAAE,EAAE;YACxD,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;YAE5D,IAAI,KAAK,YAAY,KAAK,EAAE;gBACxB,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,MAAc,EAAE,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;aAC3E;iBAAM;gBACH,OAAO,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;aACzC;QACL,CAAC,CAAA,CAAC;QAEK,mBAAc,GAAoB,CAAO,KAAK,EAAE,OAAO,EAAE,EAAE;YAC9D,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC;YAEhE,IAAI,KAAK,YAAY,KAAK,EAAE;gBACxB,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,MAAc,EAAE,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;aAC3E;iBAAM;gBACH,OAAO,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;aACzC;QACL,CAAC,CAAA,CAAC;IApBC,CAAC;CAqBP,CAAA;iCAxBY,sBAAsB;IADlC,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,8BAA8B,CAAC,CAAA;qCAAqB,+DAA8B;GAF1G,sBAAsB,CAwBlC"}
1
+ {"version":3,"file":"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IAAA,iBAAM,EAAC,2CAAoB,CAAC,8BAA8B,CAAC,CAAA;qCAAqB,+DAA8B;GAF1G,sBAAsB,CA0BlC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/parkings",
3
- "version": "1.8.13-dev.1280386583",
3
+ "version": "1.8.13-dev.1284220477",
4
4
  "description": "Golemio Parkings Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",