@builttocreate/engine-utils 2.10.1-beta.v593.4 → 2.10.1-beta.v593.5

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.
@@ -81,7 +81,7 @@ var JOYDOC_PROPERTIES = new Set(['_id', 'identifier', 'name', 'type', 'files', '
81
81
  * @param {*} readableId - The ID to validate
82
82
  * @returns {boolean} - True if valid, false otherwise
83
83
  */
84
- var _default = exports["default"] = function _default(readableId) {
84
+ var _default = exports["default"] = function _default(readableId, fields) {
85
85
  // Must be a non-empty string
86
86
  if (typeof readableId !== 'string' || readableId.length === 0) {
87
87
  console.warn("validateReadableId: Invalid input - expected non-empty string, got ".concat(typeof readableId === 'string' ? 'empty string' : (0, _typeof2["default"])(readableId)));
@@ -142,5 +142,17 @@ var _default = exports["default"] = function _default(readableId) {
142
142
  console.warn("validateReadableId: \"".concat(readableId, "\" is invalid - it's an Excel function name"));
143
143
  return false;
144
144
  }
145
+
146
+ //6. Check for duplicateIds
147
+ if (fields && Array.isArray(fields)) {
148
+ var duplicateField = fields.find(function (field) {
149
+ return field._id === readableId;
150
+ });
151
+ console.log('fields, readableId', fields, readableIds);
152
+ if (duplicateField) {
153
+ console.warn("validateReadableId: \"".concat(readableId, "\" is invalid - it already exists in fields"));
154
+ return false;
155
+ }
156
+ }
145
157
  return true;
146
158
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builttocreate/engine-utils",
3
- "version": "2.10.1-beta.v593.4",
3
+ "version": "2.10.1-beta.v593.5",
4
4
  "description": "Utility library for common logic shared across web and mobile",
5
5
  "main": "dist/index.js",
6
6
  "files": [