drapcode-utility 1.9.6 → 1.9.7

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.
@@ -681,9 +681,24 @@ var validateData = function (fields, data) {
681
681
  break;
682
682
  case "reference":
683
683
  case "belongsTo":
684
- if (!Array.isArray(fieldValue) ||
685
- fieldValue.some(function (item) { return typeof item !== "string"; })) {
686
- errors.push("".concat(fieldTitle, " must be an array of valid UUID strings"));
684
+ if (Array.isArray(fieldValue)) {
685
+ var invalid = fieldValue.some(function (item) {
686
+ if (typeof item === "string")
687
+ return false;
688
+ if (typeof item === "object" && typeof item.uuid === "string")
689
+ return false;
690
+ return true;
691
+ });
692
+ if (invalid) {
693
+ errors.push("".concat(fieldTitle, " must be an array of UUID strings or objects with a uuid"));
694
+ }
695
+ }
696
+ else {
697
+ if (!(typeof fieldValue === "string" ||
698
+ (typeof fieldValue === "object" &&
699
+ typeof (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.uuid) === "string"))) {
700
+ errors.push("".concat(fieldTitle, " must be a UUID string or an object with a uuid"));
701
+ }
687
702
  }
688
703
  break;
689
704
  case "createdAt":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drapcode-utility",
3
- "version": "1.9.6",
3
+ "version": "1.9.7",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -37,7 +37,7 @@
37
37
  "@types/voca": "^1.4.2",
38
38
  "axios": "^1.1.2",
39
39
  "dompurify": "^3.1.7",
40
- "drapcode-constant": "^1.6.8",
40
+ "drapcode-constant": "^1.6.9",
41
41
  "drapcode-logger": "^1.3.4",
42
42
  "drapcode-redis": "^1.2.4",
43
43
  "exiftool-vendored": "^28.2.1",