text: "use strict";
  
  // TransitionOperator-cpm-child-processes-active.js
  var arccore = require("@encapsule/arccore");
  
  var cpmLib = require("./lib");
  
  var TransitionOperator = require("../../../TransitionOperator");
  
  var cellProcessQueryRequestFilterBySpec = require("./lib/iospecs/cell-process-query-request-filterby-spec");
  
  module.exports = new TransitionOperator({
    id: "xIRhBHueTRGO0xq63UUbyQ",
    name: "Cell Process Manager: Child Processes Active",
    description: "Returns Boolean true iff request.context.apmBindingPath is a cell process with one or more child cell processes.",
    operatorRequestSpec: {
      ____types: "jsObject",
      CellProcessor: {
        ____types: "jsObject",
        cell: {
          ____types: "jsObject",
          cellCoordinates: {
            ____types: ["jsString", // If a string, then the caller-supplied value must be either a fully-qualified or relative path to a cell. Or, an IRUT that resolves to a known cellProcessID.
            "jsObject" // If an object, then the caller has specified the low-level apmID, instanceName coordinates directly.
            ],
            ____defaultValue: "#",
            apmID: {
              ____accept: "jsString"
            },
            instanceName: {
              ____accept: "jsString",
              ____defaultValue: "singleton"
            }
          },
          query: {
            ____types: "jsObject",
            filterBy: cellProcessQueryRequestFilterBySpec,
            childProcessesActive: {
              ____accept: "jsObject"
            }
          }
        }
      }
    },
    bodyFunction: function bodyFunction(request_) {
      var response = {
        error: null,
        result: false
      };
      var errors = [];
      var inBreakScope = false;
  
      while (!inBreakScope) {
        inBreakScope = true;
        var messageBody = request_.operatorRequest.CellProcessor.cell;
        var cpmLibResponse = cpmLib.cellProcessFamilyOperatorPrologue.request({
          unresolvedCellCoordinates: messageBody.cellCoordinates,
          apmBindingPath: request_.context.apmBindingPath,
          ocdi: request_.context.ocdi
        });
  
        if (cpmLibResponse.error) {
          errors.push(cpmLibResponse.error);
          break;
        }
  
        var prologueData = cpmLibResponse.result;
        cpmLibResponse = cpmLib.getProcessChildrenDescriptors.request({
          cellProcessID: prologueData.resolvedCellCoordinates.cellPathID,
          filterBy: messageBody.query.filterBy,
          ocdi: request_.context.ocdi,
          treeData: prologueData.ownedCellProcessesData
        });
  
        if (cpmLibResponse.error) {
          errors.push(cpmLibResponse.error);
          break;
        }
  
        var childCellProcessDescriptors = cpmLibResponse.result;
        response.result = childCellProcessDescriptors.length ? true : false;
        break;
      }
  
      if (errors.length) {
        response.error = errors.join(" ");
      }
  
      return response;
    }
  });