hunk.code_window:           "label": "Array of Pipelines",
             "configProperty": "actionConfiguration.formData.aggregate.arrayPipelines",
             "controlType": "QUERY_DYNAMIC_INPUT_TEXT",
             "evaluationSubstitutionType": "TEMPLATE",
             "placeholderText" : "[{ $project: { tags: 1 } }, { $unwind: \"$tags\" }, { $group: { _id: \"$tags\", count: { $sum : 1 } } }  ]"
           }
         ]
       }
  
hunk.labels: keep keep add keep keep keep keep keep
hunk.after_edit:           "inputType": "JSON",
  
hunk.file_path: app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/aggregate.json
hunk.type: add
file: // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  //@ts-ignore
  import widgetPropertyFns from "!!raw-loader!./derived.js";
  
  // TODO(abhinav):
  // Add unit test cases
  // Handle edge cases
  // Error out on wrong values
  const derivedProperties: any = {};
  // const regex = /(\w+):\s?\(props\)\s?=>\s?{([\w\W]*?)},/gim;
  const regex = /(\w+):\s?\(props, moment, _\)\s?=>\s?{([\w\W\n]*?)},\n?\s+?\/\//gim;
  
  let m;
  
  while ((m = regex.exec((widgetPropertyFns as unknown) as string)) !== null) {
    // This is necessary to avoid infinite loops with zero-width matches
    if (m.index === regex.lastIndex) {
      regex.lastIndex++;
    }
  
    let key = "";
    // The result can be accessed through the `m`-variable.
    m.forEach((match, groupIndex) => {
      if (groupIndex === 1) {
        key = match;
      }
      if (groupIndex === 2) {
        derivedProperties[key] = match
          .trim()
          .replace(/\n/g, "")
          .replace(/props\./g, "this.");
      }
    });
  }
  
  export default derivedProperties;
  