<commit_before>import { FormlyExtension, FormlyConfig, TemplateManipulators } from '../../services/formly.config';
import { FormlyFieldConfigCache, FormlyFieldConfig } from '../../components/formly.field.config';
import { FormGroup, FormArray } from '@angular/forms';
import { getFieldId, assignModelValue, isUndefined, clone, removeFieldControl, getFieldValue } from '../../utils';

export class CoreExtension implements FormlyExtension {
  private formId = 0;
  constructor(private formlyConfig: FormlyConfig) { }

  prePopulate(field: FormlyFieldConfigCache) {
    if (field.parent) {
      return;
    }

    const fieldTransforms = (field.options && field.options.fieldTransform) || this.formlyConfig.extras.fieldTransform;
    (Array.isArray(fieldTransforms) ? fieldTransforms : [fieldTransforms]).forEach(fieldTransform => {
      if (fieldTransform) {
        const fieldGroup = fieldTransform(field.fieldGroup, field.model, <FormGroup>field.formControl, field.options);
        if (!fieldGroup) {
          throw new Error('fieldTransform must return an array of fields');
        }
      }
    });
  }
<commit_msg>feat(core): deprecate fieldTransform in favor of custom extension<commit_after>import { FormlyExtension, FormlyConfig, TemplateManipulators } from '../../services/formly.config';
import { FormlyFieldConfigCache, FormlyFieldConfig } from '../../components/formly.field.config';
import { FormGroup, FormArray } from '@angular/forms';
import { getFieldId, assignModelValue, isUndefined, clone, removeFieldControl, getFieldValue } from '../../utils';

export class CoreExtension implements FormlyExtension {
  private formId = 0;
  constructor(private formlyConfig: FormlyConfig) { }

  prePopulate(field: FormlyFieldConfigCache) {
    if (field.parent) {
      return;
    }

    const fieldTransforms = (field.options && field.options.fieldTransform) || this.formlyConfig.extras.fieldTransform;
    (Array.isArray(fieldTransforms) ? fieldTransforms : [fieldTransforms]).forEach(fieldTransform => {
      if (fieldTransform) {
        console.warn(`NgxFormly: fieldTransform is deprecated since v5.0, use custom extension instead.`);
        const fieldGroup = fieldTransform(field.fieldGroup, field.model, <FormGroup>field.formControl, field.options);
        if (!fieldGroup) {
          throw new Error('fieldTransform must return an array of fields');
        }
      }
    });
  }

{'fraction_non_alphanumeric': 0.11674283340257582, 'fraction_numerical': 0.0016618196925633569, 'mean_word_length': 4.20086393088553, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6802648', 'n_tokens_mistral': 651, 'n_tokens_neox': 649, 'n_words': 153}