@builttocreate/engine-utils 2.10.1-beta.v593.23 → 2.10.1-beta.v593.25

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.
@@ -164,7 +164,6 @@ function generateReadableTableColumnId(tableId, tableColumns, columnId) {
164
164
  var type = (col.type || 'unknown').toLowerCase();
165
165
  counts[type] = (counts[type] || 0) + 1;
166
166
  var readableId = "".concat(type).concat(counts[type]);
167
- counts[type]++;
168
167
  if (col._id === columnId) {
169
168
  /**
170
169
  * If the generatedReadableId is already present in the tableColumns,
@@ -146,33 +146,34 @@ var _default = exports["default"] = function _default(readableId, fields, tableC
146
146
  }
147
147
 
148
148
  //6. Check for duplicates in readableIds
149
- if (!Array.isArray(fields)) return;
150
-
151
- //DuplicateId check for fieldIds
152
- var duplicateField = fields.find(function (field) {
153
- return field._id === readableId;
154
- });
155
- if (duplicateField) {
156
- console.warn("validateReadableId: \"".concat(readableId, "\" is invalid - it already exists in fields"));
157
- return false;
158
- }
159
149
 
160
- /**
161
- * DuplicateId check for nested tables of collection fields
162
- * When readableIds for nestedTables are passed in, we need the fieldId to retrieve the collection fields that houses the nestedTable
163
- */
164
- if (fieldId) {
165
- var targetField = fields.find(function (field) {
166
- return field._id === fieldId;
150
+ if (Array.isArray(fields)) {
151
+ //DuplicateId check for fieldIds
152
+ var duplicateField = fields.find(function (field) {
153
+ return field._id === readableId;
167
154
  });
168
- if ((targetField === null || targetField === void 0 ? void 0 : targetField.type) === _FieldTypes["default"].collection) {
169
- var flattenedSchema = (0, _fieldHelper.flattenSchemaTree)(targetField.schema);
170
- var readableIdExists = flattenedSchema.some(function (schema) {
171
- return schema.id === readableId;
155
+ if (duplicateField) {
156
+ console.warn("validateReadableId: \"".concat(readableId, "\" is invalid - it already exists in fields"));
157
+ return false;
158
+ }
159
+
160
+ /**
161
+ * DuplicateId check for nested tables of collection fields
162
+ * When readableIds for nestedTables are passed in, we need the fieldId to retrieve the collection fields that houses the nestedTable
163
+ */
164
+ if (fieldId) {
165
+ var targetField = fields.find(function (field) {
166
+ return field._id === fieldId;
172
167
  });
173
- if (readableIdExists) {
174
- console.warn("validateReadableId: \"".concat(readableId, "\" is invalid - it already exists in fields"));
175
- return false;
168
+ if ((targetField === null || targetField === void 0 ? void 0 : targetField.type) === _FieldTypes["default"].collection) {
169
+ var flattenedSchema = (0, _fieldHelper.flattenSchemaTree)(targetField.schema);
170
+ var readableIdExists = flattenedSchema.some(function (schema) {
171
+ return schema.id === readableId;
172
+ });
173
+ if (readableIdExists) {
174
+ console.warn("validateReadableId: \"".concat(readableId, "\" is invalid - it already exists in fields"));
175
+ return false;
176
+ }
176
177
  }
177
178
  }
178
179
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builttocreate/engine-utils",
3
- "version": "2.10.1-beta.v593.23",
3
+ "version": "2.10.1-beta.v593.25",
4
4
  "description": "Utility library for common logic shared across web and mobile",
5
5
  "main": "dist/index.js",
6
6
  "files": [