@esri/solution-common 1.3.13 → 1.3.16

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.
@@ -15,8 +15,8 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports._templatizeAdminLayerInfo = exports._templatizeLayerFieldReferences = exports._validateEditFieldsInfo = exports._validateTypesTemplates = exports._validateTemplatesFields = exports._validateIndexes = exports._validateDisplayField = exports._validateFields = exports._templatizeLayer = exports._templatizeProperty = exports._templatize = exports.updatePopupInfo = exports._isViewFieldOverride = exports._getDomainAndAliasInfos = exports._validateViewDomainsAndAlias = exports._getPortalViewFieldUpdates = exports._validateDomains = exports._getFieldVisibilityUpdates = exports._getTypeIdField = exports.postProcessFields = exports.updateLayerFieldReferences = exports.validateSpatialReferenceAndExtent = exports.setDefaultSpatialReference = exports._updateTemplateDictionaryFields = exports._updateGeomFieldName = exports._updateSourceLayerFields = exports._updateItemFields = exports._getFieldNames = exports._updateForPortal = exports.removeLayerOptimization = exports._updateAddOptions = exports.addFeatureServiceDefinition = exports.addFeatureServiceLayersAndTables = exports.getExistingLayersAndTables = exports.getLayersAndTables = exports.deTemplatizeFieldInfos = exports.updateTemplateForInvalidDesignations = exports.updateSettingsFieldInfos = exports.setNamesAndTitles = exports.getLayerSettings = exports._updateTypeKeywords = exports.updateTemplate = exports._cachePopupInfo = exports.cachePopupInfos = exports._cacheFieldInfo = exports.cacheFieldInfos = exports.deleteViewProps = exports.templatize = exports.rest_addFeatures = exports.rest_queryFeatures = void 0;
19
- exports._getLayerChunkSize = exports._getNameMapping = exports._templatizeDefinitionQuery = exports._templatizeTimeInfo = exports._templatizeKeys = exports._templatizeTypeTemplates = exports._templatizeTemplates = exports._templatizeLabelingInfo = exports._templatizeArcadeExpressions = exports._templatizeAuthoringInfo = exports._templatizeTemporalRenderer = exports._templatizeGenRenderer = exports._templatizeRenderer = exports._templatizeDrawingInfo = exports._templatizeSimpleName = exports._templatizeDefinitionExpression = exports._templatizeDefinitionEditor = exports._templatizeMediaInfos = exports._templatizePopupElements = exports._templatizeExpressionInfos = exports._templatizeFieldName = exports._templatizePopupInfoFieldInfos = exports._templatizeName = exports._templatizePopupInfo = exports._templatizeRelationshipFields = exports._templatizeTopFilter = exports._templatizeAdminSourceLayerFields = exports._getDependantItemId = exports._templatizeAdminLayerInfoFields = exports._templatizeSourceServiceName = exports._processAdminObject = void 0;
18
+ exports._templatizeSourceServiceName = exports._processAdminObject = exports._templatizeAdminLayerInfo = exports._templatizeLayerFieldReferences = exports._validateEditFieldsInfo = exports._validateTypesTemplates = exports._validateTemplatesFields = exports._validateIndexes = exports._validateDisplayField = exports._validateFields = exports._templatizeLayer = exports._templatizeProperty = exports._templatize = exports.updatePopupInfo = exports._isViewFieldOverride = exports._getViewFieldInfos = exports._validateViewFieldInfos = exports.postProcessFields = exports.updateLayerFieldReferences = exports.validateSpatialReferenceAndExtent = exports.setDefaultSpatialReference = exports._updateTemplateDictionaryFields = exports._updateGeomFieldName = exports._updateSourceLayerFields = exports._updateItemFields = exports._getFieldNames = exports._updateForPortal = exports.removeLayerOptimization = exports._updateAddOptions = exports.addFeatureServiceDefinition = exports.addFeatureServiceLayersAndTables = exports.getExistingLayersAndTables = exports.getLayersAndTables = exports.deTemplatizeFieldInfos = exports.processContingentValues = exports.updateTemplateForInvalidDesignations = exports.updateSettingsFieldInfos = exports.setNamesAndTitles = exports.getLayerSettings = exports._updateTypeKeywords = exports.updateTemplate = exports._cachePopupInfo = exports.cachePopupInfos = exports._cacheFieldInfo = exports.cacheContingentValues = exports.cacheFieldInfos = exports.deleteViewProps = exports.templatize = exports.rest_addFeatures = exports.rest_queryFeatures = void 0;
19
+ exports._getLayerChunkSize = exports._getNameMapping = exports._templatizeDefinitionQuery = exports._templatizeTimeInfo = exports._templatizeKeys = exports._templatizeTypeTemplates = exports._templatizeTemplates = exports._templatizeLabelingInfo = exports._templatizeArcadeExpressions = exports._templatizeAuthoringInfo = exports._templatizeTemporalRenderer = exports._templatizeGenRenderer = exports._templatizeRenderer = exports._templatizeDrawingInfo = exports._templatizeSimpleName = exports._templatizeDefinitionExpression = exports._templatizeDefinitionEditor = exports._templatizeMediaInfos = exports._templatizePopupElements = exports._templatizeExpressionInfos = exports._templatizeFieldName = exports._templatizePopupInfoFieldInfos = exports._templatizeName = exports._templatizePopupInfo = exports._templatizeRelationshipFields = exports._templatizeTopFilter = exports._templatizeAdminSourceLayerFields = exports._getDependantItemId = exports._templatizeAdminLayerInfoFields = void 0;
20
20
  /**
21
21
  * Provides general helper functions.
22
22
  *
@@ -129,10 +129,9 @@ exports.deleteViewProps = deleteViewProps;
129
129
  *
130
130
  * @param layer The data layer instance with field name references within
131
131
  * @param fieldInfos the object that stores the cached field infos
132
- * @param isPortal Controls what properties should be removed.
133
132
  * @returns An updated instance of the fieldInfos
134
133
  */
135
- function cacheFieldInfos(layer, fieldInfos, isPortal) {
134
+ function cacheFieldInfos(layer, fieldInfos) {
136
135
  // cache the source fields as they are in the original source
137
136
  if (layer && layer.fields) {
138
137
  fieldInfos[layer.id] = {
@@ -145,13 +144,13 @@ function cacheFieldInfos(layer, fieldInfos, isPortal) {
145
144
  // and will have associated updateDefinition calls when deploying to portal
146
145
  // as well as online for relationships...as relationships added with addToDef will cause failure
147
146
  const props = {
148
- editFieldsInfo: isPortal,
149
- types: isPortal,
150
- templates: isPortal,
147
+ editFieldsInfo: false,
148
+ types: false,
149
+ templates: false,
151
150
  relationships: true,
152
- drawingInfo: isPortal,
153
- timeInfo: isPortal,
154
- viewDefinitionQuery: isPortal
151
+ drawingInfo: false,
152
+ timeInfo: false,
153
+ viewDefinitionQuery: false
155
154
  };
156
155
  Object.keys(props).forEach(k => {
157
156
  _cacheFieldInfo(layer, k, fieldInfos, props[k]);
@@ -159,6 +158,22 @@ function cacheFieldInfos(layer, fieldInfos, isPortal) {
159
158
  return fieldInfos;
160
159
  }
161
160
  exports.cacheFieldInfos = cacheFieldInfos;
161
+ /**
162
+ * Cache the stored contingent values so we can add them in subsequent addToDef calls
163
+ *
164
+ * @param id The layer id for the associated values to be stored with
165
+ * @param fieldInfos The object that stores the cached field infos
166
+ * @param itemTemplate The current itemTemplate being processed
167
+ * @returns An updated instance of the fieldInfos
168
+ */
169
+ function cacheContingentValues(id, fieldInfos, itemTemplate) {
170
+ const contingentValues = (0, generalHelpers_1.getProp)(itemTemplate, 'properties.contingentValues');
171
+ if (contingentValues && contingentValues[id]) {
172
+ fieldInfos[id]['contingentValues'] = contingentValues[id];
173
+ }
174
+ return fieldInfos;
175
+ }
176
+ exports.cacheContingentValues = cacheContingentValues;
162
177
  /**
163
178
  * Helper function to cache a single property into the fieldInfos object
164
179
  * This property will be removed from the layer instance.
@@ -178,7 +193,7 @@ function _cacheFieldInfo(layer, prop, fieldInfos, removeProp) {
178
193
  // editFieldsInfo does not come through unless its with the layer
179
194
  // when it's being added
180
195
  /* istanbul ignore else */
181
- if (removeProp && prop !== "editFieldsInfo") {
196
+ if (removeProp) {
182
197
  layer[prop] = null;
183
198
  }
184
199
  }
@@ -413,6 +428,58 @@ function updateTemplateForInvalidDesignations(template, authentication) {
413
428
  });
414
429
  }
415
430
  exports.updateTemplateForInvalidDesignations = updateTemplateForInvalidDesignations;
431
+ /**
432
+ * Get the contingent values for each layer in the service.
433
+ * Remove key props that cannot be included with the addToDef call on deploy.
434
+ * Store the values alongside other key feature service properties in the template
435
+ *
436
+ * @param properties the current feature services properties
437
+ * @param adminUrl the current feature service url
438
+ * @param authentication Credentials for the request to AGOL
439
+ * @returns A promise that will resolve when the contingent values have been fetched.
440
+ * This function will update the provided properties argument when contingent values are found.
441
+ */
442
+ function processContingentValues(properties, adminUrl, authentication) {
443
+ return new Promise((resolve, reject) => {
444
+ if ((0, generalHelpers_1.getProp)(properties, 'service.isView')) {
445
+ // views will inherit from the source service
446
+ resolve();
447
+ }
448
+ else {
449
+ const layersAndTables = (properties.layers || []).concat(properties.tables || []);
450
+ const layerIds = [];
451
+ const contingentValuePromises = layersAndTables.reduce((prev, cur) => {
452
+ /* istanbul ignore else */
453
+ if (cur.hasContingentValuesDefinition) {
454
+ prev.push((0, restHelpers_1.rest_request)(`${adminUrl}/${cur['id']}/contingentValues?f=json`, { authentication }));
455
+ layerIds.push(cur['id']);
456
+ }
457
+ return prev;
458
+ }, []);
459
+ if (contingentValuePromises.length > 0) {
460
+ Promise.all(contingentValuePromises).then((results) => {
461
+ const contingentValues = {};
462
+ results.forEach((r, i) => {
463
+ (0, generalHelpers_1.deleteProp)(r, 'typeCodes');
464
+ /* istanbul ignore else */
465
+ if ((0, generalHelpers_1.getProp)(r, 'stringDicts') && (0, generalHelpers_1.getProp)(r, 'contingentValuesDefinition')) {
466
+ r.contingentValuesDefinition['stringDicts'] = r.stringDicts;
467
+ (0, generalHelpers_1.deleteProp)(r, 'stringDicts');
468
+ }
469
+ (0, generalHelpers_1.deleteProps)((0, generalHelpers_1.getProp)(r, 'contingentValuesDefinition'), ['layerID', 'layerName', 'geometryType', 'hasSubType']);
470
+ contingentValues[layerIds[i]] = r;
471
+ });
472
+ properties.contingentValues = contingentValues;
473
+ resolve();
474
+ }, reject);
475
+ }
476
+ else {
477
+ resolve();
478
+ }
479
+ }
480
+ });
481
+ }
482
+ exports.processContingentValues = processContingentValues;
416
483
  /**
417
484
  * Replace the field name reference templates with the new field names after deployment.
418
485
  *
@@ -524,16 +591,12 @@ function addFeatureServiceLayersAndTables(itemTemplate, templateDictionary, popu
524
591
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
525
592
  updateLayerFieldReferences(itemTemplate, fieldInfos, popupInfos, adminLayerInfos, templateDictionary).then(r => {
526
593
  // Update relationships and layer definitions
527
- let updates = (0, restHelpers_1.getLayerUpdates)({
594
+ const updates = (0, restHelpers_1.getLayerUpdates)({
528
595
  message: "updated layer definition",
529
596
  objects: r.layerInfos.fieldInfos,
530
597
  itemTemplate: r.itemTemplate,
531
598
  authentication
532
599
  }, templateDictionary.isPortal);
533
- // Get any updates for the service that should be performed after updates to the layers
534
- if (templateDictionary.isPortal) {
535
- updates = (0, restHelpers_1.getFinalServiceUpdates)(r.itemTemplate, authentication, updates);
536
- }
537
600
  // Process the updates sequentially
538
601
  updates
539
602
  .reduce((prev, update) => {
@@ -591,7 +654,9 @@ function addFeatureServiceDefinition(serviceUrl, listToAdd, templateDictionary,
591
654
  listToAdd.forEach((toAdd, i) => {
592
655
  let item = toAdd.item;
593
656
  const originalId = item.id;
594
- fieldInfos = cacheFieldInfos(item, fieldInfos, templateDictionary.isPortal);
657
+ fieldInfos = cacheFieldInfos(item, fieldInfos);
658
+ // cache the values to be added in seperate addToDef calls
659
+ fieldInfos = cacheContingentValues(item.id, fieldInfos, itemTemplate);
595
660
  /* istanbul ignore else */
596
661
  if (item.isView) {
597
662
  deleteViewProps(item);
@@ -607,9 +672,7 @@ function addFeatureServiceDefinition(serviceUrl, listToAdd, templateDictionary,
607
672
  // update adminLayerInfo before add to definition with view source fieldInfo settings
608
673
  item.adminLayerInfo = (0, templatization_1.replaceInTemplate)(item.adminLayerInfo, templateDictionary);
609
674
  /* istanbul ignore else */
610
- if (!templateDictionary.isPortal &&
611
- fieldInfos &&
612
- fieldInfos.hasOwnProperty(item.id)) {
675
+ if (fieldInfos && fieldInfos.hasOwnProperty(item.id)) {
613
676
  Object.keys(templateDictionary).some(k => {
614
677
  if (templateDictionary[k].itemId === itemTemplate.itemId) {
615
678
  fieldInfos[item.id]["sourceServiceFields"] =
@@ -622,7 +685,7 @@ function addFeatureServiceDefinition(serviceUrl, listToAdd, templateDictionary,
622
685
  });
623
686
  // view field domain and alias can contain different values than the source field
624
687
  // we need to set isViewOverride when added fields that differ from the source field
625
- _validateViewDomainsAndAlias(fieldInfos[item.id], item);
688
+ _validateViewFieldInfos(fieldInfos[item.id], item);
626
689
  }
627
690
  }
628
691
  /* istanbul ignore else */
@@ -777,7 +840,6 @@ function _updateForPortal(item, itemTemplate, templateDictionary) {
777
840
  }
778
841
  // not allowed to set sourceSchemaChangesAllowed or isView for portal
779
842
  // these are set when you create the service
780
- (0, generalHelpers_1.deleteProp)(item, "sourceSchemaChangesAllowed");
781
843
  (0, generalHelpers_1.deleteProp)(item, "isView");
782
844
  return item;
783
845
  }
@@ -1062,25 +1124,10 @@ function postProcessFields(itemTemplate, layerInfos, popupInfos, adminLayerInfos
1062
1124
  // more than case change when deployed to protal so keep track of the new names
1063
1125
  layerInfo["newEditFieldsInfo"] = JSON.parse(JSON.stringify(item.editFieldsInfo));
1064
1126
  }
1065
- // fields that are marked as visible false on a view are all set to
1066
- // visible true when added with the layer definition
1067
- // update the field visibility to match that of the source
1068
1127
  /* istanbul ignore else */
1069
1128
  if (isView && templateInfo && templateDictionary.isPortal) {
1070
1129
  // when the item is a view bring over the source service fields so we can compare the domains
1071
1130
  layerInfo["sourceServiceFields"] = templateInfo.sourceServiceFields;
1072
- let fieldUpdates = _getFieldVisibilityUpdates(layerInfo);
1073
- // view field domains can contain different values than the source field domains
1074
- // use the cached view domain when it differs from the source view domain
1075
- fieldUpdates = _validateDomains(layerInfo, fieldUpdates);
1076
- /* istanbul ignore else */
1077
- if (fieldUpdates.length > 0) {
1078
- layerInfo.fields = fieldUpdates;
1079
- }
1080
- layerInfo.typeIdField = _getTypeIdField(item);
1081
- const fieldNames = layerInfo.newFields.map((f) => f.name);
1082
- _validateTemplatesFields(layerInfo, fieldNames);
1083
- _validateTypesTemplates(layerInfo, fieldNames);
1084
1131
  }
1085
1132
  }
1086
1133
  });
@@ -1097,146 +1144,36 @@ function postProcessFields(itemTemplate, layerInfos, popupInfos, adminLayerInfos
1097
1144
  }
1098
1145
  exports.postProcessFields = postProcessFields;
1099
1146
  /**
1100
- * when deploying to portal if a view has a different typeIdField than what it being set on the source service
1101
- * we need to pass it via an updateDef call or it will be set as the typeIdField of the source service
1147
+ * View field domain, alias, editable, and visible props can contain
1148
+ * different values from the source.
1102
1149
  *
1103
- * @param item current layer or table
1104
- * @returns name of field to set for typeIdField in the update call
1105
- * @private
1106
- */
1107
- function _getTypeIdField(item) {
1108
- const typeIdFields = item.fields.filter((f) => {
1109
- return (f.name &&
1110
- item.typeIdField &&
1111
- f.name.toLowerCase() === item.typeIdField.toLowerCase());
1112
- });
1113
- return Array.isArray(typeIdFields) && typeIdFields.length === 1
1114
- ? typeIdFields[0].name
1115
- : item.typeIdField;
1116
- }
1117
- exports._getTypeIdField = _getTypeIdField;
1118
- /**
1119
- * Update a views field visibility to match that of the source
1120
- * Fields that are marked as visible false on a view are all set to
1121
- * visible true when added with the layer definition
1122
- *
1123
- * @param fieldInfo current layers or tables fieldInfo
1124
- * @returns Array of fields that should not be visible in the view
1125
- * @private
1126
- */
1127
- function _getFieldVisibilityUpdates(fieldInfo) {
1128
- const visibilityUpdates = [];
1129
- if (fieldInfo && fieldInfo["sourceFields"] && fieldInfo["newFields"]) {
1130
- const sourceFields = fieldInfo["sourceFields"].reduce((hash, f) => {
1131
- hash[String(f.name).toLocaleLowerCase()] = f.visible;
1132
- return hash;
1133
- }, {});
1134
- fieldInfo["newFields"].forEach((f) => {
1135
- const name = String(f.name).toLocaleLowerCase();
1136
- // only add fields that are not visible
1137
- if (sourceFields.hasOwnProperty(name) && !sourceFields[name]) {
1138
- visibilityUpdates.push({
1139
- name: f.name,
1140
- visible: sourceFields[name]
1141
- });
1142
- }
1143
- });
1144
- }
1145
- return visibilityUpdates;
1146
- }
1147
- exports._getFieldVisibilityUpdates = _getFieldVisibilityUpdates;
1148
- /**
1149
- * view field domains can contain different values than the source feature service field domains
1150
- * use the cached domain when it differs from the source view field domain
1150
+ * We need to check and set isFieldOverride to true when this occurs and false when it does not
1151
1151
  *
1152
1152
  * @param fieldInfo current view layer or table fieldInfo
1153
- * @param fieldUpdates any existing field updates
1154
- * @returns Array of fields to be updated
1155
- * @private
1156
- */
1157
- function _validateDomains(fieldInfo, fieldUpdates) {
1158
- const domainAliasInfos = _getDomainAndAliasInfos(fieldInfo);
1159
- const domainFields = domainAliasInfos.domainFields;
1160
- const domainNames = domainAliasInfos.domainNames;
1161
- const aliasFields = domainAliasInfos.aliasFields;
1162
- const aliasNames = domainAliasInfos.aliasNames;
1163
- // loop through the fields from the new view service
1164
- // add an update when the domains don't match
1165
- fieldInfo.newFields.forEach((field) => {
1166
- _getPortalViewFieldUpdates(field, domainNames, domainFields, "domain", fieldUpdates);
1167
- _getPortalViewFieldUpdates(field, aliasNames, aliasFields, "alias", fieldUpdates);
1168
- });
1169
- return fieldUpdates;
1170
- }
1171
- exports._validateDomains = _validateDomains;
1172
- /**
1173
- * Get portal field updates to be added with an updateDefinition call after the
1174
- * initial addToDef
1153
+ * @param item that stores the view fields
1175
1154
  *
1176
- * @param field the current field instance
1177
- * @param names the alias of domain field names
1178
- * @param fields the alias or domain fields
1179
- * @param key the field key to evaluate
1180
- * @param fieldUpdates any existing field updates
1155
+ * This function will update the item that is provided
1181
1156
  * @private
1182
1157
  */
1183
- function _getPortalViewFieldUpdates(field, names, fields, key, fieldUpdates) {
1184
- if (field.hasOwnProperty(key) && field[key]) {
1185
- const i = names.indexOf(String(field.name).toLocaleLowerCase());
1186
- if (JSON.stringify(field[key]) !== (i > -1 ? JSON.stringify(fields[i]) : "")) {
1187
- // should mixin the update if the field already has some other update
1188
- let hasUpdate = false;
1189
- fieldUpdates.some((update) => {
1190
- if (update.name === field.name) {
1191
- hasUpdate = true;
1192
- update[key] = field[key];
1193
- }
1194
- return hasUpdate;
1195
- });
1196
- if (!hasUpdate) {
1197
- const update = { name: field.name };
1198
- update[key] = field[key];
1199
- fieldUpdates.push(update);
1200
- }
1201
- }
1202
- }
1203
- }
1204
- exports._getPortalViewFieldUpdates = _getPortalViewFieldUpdates;
1205
- /**
1206
- * view field domains can contain different values than the source feature service field domains
1207
- * use the cached domain when it differs from the source view field domain
1208
- *
1209
- * @param fieldInfo current view layer or table fieldInfo
1210
- * @param fieldUpdates any existing field updates
1211
- * @returns Array of fields to be updated
1212
- * @private
1213
- */
1214
- function _validateViewDomainsAndAlias(fieldInfo, item) {
1215
- const domainAliasInfos = _getDomainAndAliasInfos(fieldInfo);
1216
- const domainFields = domainAliasInfos.domainFields;
1217
- const domainNames = domainAliasInfos.domainNames;
1218
- const aliasFields = domainAliasInfos.aliasFields;
1219
- const aliasNames = domainAliasInfos.aliasNames;
1220
- // loop through the fields from the item
1221
- // add isViewOverride when the domains or alias don't match
1158
+ function _validateViewFieldInfos(fieldInfo, item) {
1159
+ const fieldInfos = _getViewFieldInfos(fieldInfo);
1222
1160
  item.fields.map((field) => {
1223
- _isViewFieldOverride(field, domainNames, domainFields, "domain");
1224
- _isViewFieldOverride(field, aliasNames, aliasFields, "alias");
1161
+ Object.keys(fieldInfos).forEach(fi => {
1162
+ _isViewFieldOverride(field, fieldInfos[fi].names, fieldInfos[fi].vals, fi);
1163
+ });
1225
1164
  return field;
1226
1165
  });
1227
1166
  }
1228
- exports._validateViewDomainsAndAlias = _validateViewDomainsAndAlias;
1167
+ exports._validateViewFieldInfos = _validateViewFieldInfos;
1229
1168
  /**
1230
- * Get array of domain fields and names and alias fields and names
1169
+ * Get arrays of fields and names for domain, alias, and editable props
1231
1170
  *
1232
1171
  * @param fieldInfo current view layer or table fieldInfo
1233
1172
  * @private
1234
1173
  */
1235
- function _getDomainAndAliasInfos(fieldInfo) {
1236
- const domainFields = [];
1237
- const domainNames = [];
1238
- const aliasFields = [];
1239
- const aliasNames = [];
1174
+ function _getViewFieldInfos(fieldInfo) {
1175
+ const fieldInfos = {};
1176
+ const fieldOverrideKeys = ["domain", "alias", "editable"];
1240
1177
  /* istanbul ignore else */
1241
1178
  if (fieldInfo.sourceServiceFields) {
1242
1179
  Object.keys(fieldInfo.sourceServiceFields).forEach(k => {
@@ -1244,45 +1181,50 @@ function _getDomainAndAliasInfos(fieldInfo) {
1244
1181
  if (fieldInfo.sourceServiceFields[k]) {
1245
1182
  Object.keys(fieldInfo.sourceServiceFields[k]).forEach(_k => {
1246
1183
  fieldInfo.sourceServiceFields[k][_k].forEach((field) => {
1247
- /* istanbul ignore else */
1248
- if (field.hasOwnProperty("domain") && field.domain) {
1249
- domainFields.push(field.domain);
1250
- domainNames.push(String(field.name).toLocaleLowerCase());
1251
- }
1252
- /* istanbul ignore else */
1253
- if (field.hasOwnProperty("alias") && field.alias) {
1254
- aliasFields.push(field.alias);
1255
- aliasNames.push(String(field.name).toLocaleLowerCase());
1256
- }
1184
+ fieldOverrideKeys.forEach(o_k => {
1185
+ /* istanbul ignore else */
1186
+ if (field.hasOwnProperty(o_k)) {
1187
+ const name = String(field.name).toLocaleLowerCase();
1188
+ const v = field[o_k];
1189
+ if ((0, generalHelpers_1.getProp)(fieldInfos, o_k)) {
1190
+ fieldInfos[o_k].names.push(name);
1191
+ fieldInfos[o_k].vals.push(v);
1192
+ }
1193
+ else {
1194
+ fieldInfos[o_k] = {
1195
+ names: [name],
1196
+ vals: [v]
1197
+ };
1198
+ }
1199
+ }
1200
+ });
1257
1201
  });
1258
1202
  });
1259
1203
  }
1260
1204
  });
1261
1205
  }
1262
- return {
1263
- aliasFields,
1264
- aliasNames,
1265
- domainFields,
1266
- domainNames
1267
- };
1206
+ return fieldInfos;
1268
1207
  }
1269
- exports._getDomainAndAliasInfos = _getDomainAndAliasInfos;
1208
+ exports._getViewFieldInfos = _getViewFieldInfos;
1270
1209
  /**
1271
1210
  * Set isViewOverride for view fields when they have differences from the source FS field
1272
1211
  *
1273
1212
  * @param field the field instance we are testing
1274
1213
  * @param names array of field names
1275
- * @param fields array of fields
1214
+ * @param vals array of values
1276
1215
  * @param key the field key to compare
1277
1216
  * @private
1278
1217
  */
1279
- function _isViewFieldOverride(field, names, fields, key) {
1218
+ function _isViewFieldOverride(field, names, vals, key) {
1280
1219
  /* istanbul ignore else */
1281
- if (field.hasOwnProperty(key) && field[key]) {
1220
+ if (field.hasOwnProperty(key)) {
1282
1221
  const i = names.indexOf(String(field.name).toLocaleLowerCase());
1222
+ const isOverride = JSON.stringify(field[key]) !== (i > -1 ? JSON.stringify(vals[i]) : "");
1223
+ const overrideSet = field.hasOwnProperty('isViewOverride');
1224
+ // need to skip this check if isViewOverride has already been set to true
1283
1225
  /* istanbul ignore else */
1284
- if (JSON.stringify(field[key]) !== (i > -1 ? JSON.stringify(fields[i]) : "")) {
1285
- field.isViewOverride = true;
1226
+ if (((overrideSet && !field.isViewOverride) || !overrideSet)) {
1227
+ field.isViewOverride = isOverride;
1286
1228
  }
1287
1229
  }
1288
1230
  }