@monkvision/network 5.1.1 → 5.1.3

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/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monkvision/network",
3
- "version": "5.1.0",
3
+ "version": "5.1.2",
4
4
  "license": "BSD-3-Clause-Clear",
5
5
  "packageManager": "yarn@3.2.4",
6
6
  "description": "MonkJs core package used to communicate with the API",
@@ -28,8 +28,8 @@
28
28
  "lint:fix": "yarn run prettier:fix && yarn run eslint:fix"
29
29
  },
30
30
  "dependencies": {
31
- "@monkvision/common": "5.1.0",
32
- "@monkvision/sights": "5.1.0",
31
+ "@monkvision/common": "5.1.2",
32
+ "@monkvision/sights": "5.1.2",
33
33
  "jsonwebtoken": "^9.0.2",
34
34
  "jwt-decode": "^4.0.0",
35
35
  "ky": "^1.2.0",
@@ -42,12 +42,12 @@
42
42
  "react-router-dom": "^6.22.3"
43
43
  },
44
44
  "devDependencies": {
45
- "@monkvision/eslint-config-base": "5.1.0",
46
- "@monkvision/eslint-config-typescript": "5.1.0",
47
- "@monkvision/jest-config": "5.1.0",
48
- "@monkvision/prettier-config": "5.1.0",
49
- "@monkvision/types": "5.1.0",
50
- "@monkvision/typescript-config": "5.1.0",
45
+ "@monkvision/eslint-config-base": "5.1.2",
46
+ "@monkvision/eslint-config-typescript": "5.1.2",
47
+ "@monkvision/jest-config": "5.1.2",
48
+ "@monkvision/prettier-config": "5.1.2",
49
+ "@monkvision/types": "5.1.2",
50
+ "@monkvision/typescript-config": "5.1.2",
51
51
  "@types/jest": "^29.2.2",
52
52
  "@types/jsonwebtoken": "^9.0.5",
53
53
  "@types/node": "^18.11.9",
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.mapApiImage = void 0;
4
13
  var types_1 = require("@monkvision/types");
@@ -98,13 +107,19 @@ function applyCustomComplianceThresholds(issues, complianceResult, customComplia
98
107
  });
99
108
  return complianceIssues;
100
109
  }
110
+ function applyCustomCompliances(issues, imageDimensions) {
111
+ if (imageDimensions && imageDimensions.height > imageDimensions.width) {
112
+ return __spreadArray(__spreadArray([], issues, true), [types_1.ComplianceIssue.PORTRAIT_IMAGE], false);
113
+ }
114
+ return issues;
115
+ }
101
116
  function filterCompliances(issues, validIssues) {
102
117
  return issues.filter(function (issue) { return validIssues.includes(issue); });
103
118
  }
104
119
  function compareComplianceIssues(a, b) {
105
120
  return types_1.COMPLIANCE_ISSUES_PRIORITY.indexOf(a) - types_1.COMPLIANCE_ISSUES_PRIORITY.indexOf(b);
106
121
  }
107
- function mapCompliance(sightId, complianceResult, complianceOptions) {
122
+ function mapCompliance(sightId, complianceResult, complianceOptions, imageDimensions) {
108
123
  var _a = getActiveComplianceOptions(sightId, complianceOptions), enableCompliance = _a.enableCompliance, complianceIssues = _a.complianceIssues, customComplianceThresholds = _a.customComplianceThresholds;
109
124
  if (!enableCompliance) {
110
125
  return { status: types_1.ImageStatus.SUCCESS };
@@ -113,7 +128,8 @@ function mapCompliance(sightId, complianceResult, complianceOptions) {
113
128
  return { status: types_1.ImageStatus.COMPLIANCE_RUNNING };
114
129
  }
115
130
  var newIssuesAfterCustomThresholds = applyCustomComplianceThresholds(complianceResult.compliance_issues, complianceResult, customComplianceThresholds);
116
- var filteredCompliances = filterCompliances(newIssuesAfterCustomThresholds, complianceIssues);
131
+ var newIssuesAfterCustomCompliances = applyCustomCompliances(newIssuesAfterCustomThresholds, imageDimensions);
132
+ var filteredCompliances = filterCompliances(newIssuesAfterCustomCompliances, complianceIssues);
117
133
  if (filteredCompliances.length === 0) {
118
134
  return { status: types_1.ImageStatus.SUCCESS };
119
135
  }
@@ -125,7 +141,7 @@ function mapCompliance(sightId, complianceResult, complianceOptions) {
125
141
  function mapApiImage(image, inspectionId, thumbnailDomain, complianceOptions) {
126
142
  var _a, _b, _c, _d, _e;
127
143
  var sightId = (_a = image.additional_data) === null || _a === void 0 ? void 0 : _a.sight_id;
128
- var _f = mapCompliance(sightId, image.compliances, complianceOptions), status = _f.status, complianceIssues = _f.complianceIssues;
144
+ var _f = mapCompliance(sightId, image.compliances, complianceOptions, { width: image.image_width, height: image.image_height }), status = _f.status, complianceIssues = _f.complianceIssues;
129
145
  return {
130
146
  id: image.id,
131
147
  entityType: types_1.MonkEntityType.IMAGE,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monkvision/network",
3
- "version": "5.1.1",
3
+ "version": "5.1.3",
4
4
  "license": "BSD-3-Clause-Clear",
5
5
  "packageManager": "yarn@3.2.4",
6
6
  "description": "MonkJs core package used to communicate with the API",
@@ -28,8 +28,8 @@
28
28
  "lint:fix": "yarn run prettier:fix && yarn run eslint:fix"
29
29
  },
30
30
  "dependencies": {
31
- "@monkvision/common": "5.1.1",
32
- "@monkvision/sights": "5.1.1",
31
+ "@monkvision/common": "5.1.3",
32
+ "@monkvision/sights": "5.1.3",
33
33
  "jsonwebtoken": "^9.0.2",
34
34
  "jwt-decode": "^4.0.0",
35
35
  "ky": "^1.2.0",
@@ -42,12 +42,12 @@
42
42
  "react-router-dom": "^6.22.3"
43
43
  },
44
44
  "devDependencies": {
45
- "@monkvision/eslint-config-base": "5.1.1",
46
- "@monkvision/eslint-config-typescript": "5.1.1",
47
- "@monkvision/jest-config": "5.1.1",
48
- "@monkvision/prettier-config": "5.1.1",
49
- "@monkvision/types": "5.1.1",
50
- "@monkvision/typescript-config": "5.1.1",
45
+ "@monkvision/eslint-config-base": "5.1.3",
46
+ "@monkvision/eslint-config-typescript": "5.1.3",
47
+ "@monkvision/jest-config": "5.1.3",
48
+ "@monkvision/prettier-config": "5.1.3",
49
+ "@monkvision/types": "5.1.3",
50
+ "@monkvision/typescript-config": "5.1.3",
51
51
  "@types/jest": "^29.2.2",
52
52
  "@types/jsonwebtoken": "^9.0.5",
53
53
  "@types/node": "^18.11.9",
@@ -84,5 +84,5 @@
84
84
  "url": "https://github.com/monkvision/monkjs/issues"
85
85
  },
86
86
  "homepage": "https://github.com/monkvision/monkjs",
87
- "gitHead": "2092d3aa1c5e6b1825a48441b014bebfde3e8f1e"
87
+ "gitHead": "fc9a46364b6b20374800fad854057ef7d3b28c39"
88
88
  }