mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-11-04 04:28:08 +00:00 
			
		
		
		
	* Add helper combineOpenApiAttrs + test * hydrateModel working with upgradeModelSchema * new registerNewModelWithAttrs method for generated models * Add newFields to generated models * copyright * Glimmerize path-help service * update generated-item-list adapter and path-help usage of it * remove unused methods combineAttributes and combineFields * move expandOpenApiProps to ts helper file * fix auth test * fix bug where adding user to second userpass mount saves to first mount * Add mutableId * fix ent test * remove addressed deprecation * Address PR comments * [VAULT-31208] remove deprecation early-static from decorator tests
		
			
				
	
	
		
			29 lines
		
	
	
		
			1012 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			1012 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/**
 | 
						|
 * Copyright (c) HashiCorp, Inc.
 | 
						|
 * SPDX-License-Identifier: BUSL-1.1
 | 
						|
 */
 | 
						|
 | 
						|
/**
 | 
						|
 * combineFieldGroups takes the newFields returned from OpenAPI and adds them to the default field group
 | 
						|
 * if they are not already accounted for in other field groups
 | 
						|
 * @param {Record<string,string[]>[]} currentGroups Field groups, as an array of objects like: [{ default: [] }, { 'TLS options': [] }]
 | 
						|
 * @param {string[]} newFields
 | 
						|
 * @param {string[]} excludedFields
 | 
						|
 * @returns modified currentGroups
 | 
						|
 */
 | 
						|
export const combineFieldGroups = function (currentGroups, newFields, excludedFields) {
 | 
						|
  let allFields = [];
 | 
						|
  for (const group of currentGroups) {
 | 
						|
    const fieldName = Object.keys(group)[0];
 | 
						|
    allFields = allFields.concat(group[fieldName]);
 | 
						|
  }
 | 
						|
  const otherFields = newFields.filter((field) => {
 | 
						|
    return !allFields.includes(field) && !excludedFields.includes(field);
 | 
						|
  });
 | 
						|
  if (otherFields.length) {
 | 
						|
    currentGroups[0].default = currentGroups[0].default.concat(otherFields);
 | 
						|
  }
 | 
						|
 | 
						|
  return currentGroups;
 | 
						|
};
 |