Transform action to async branch
@param {Function} action
@param {Array|Function} parentAction
@param {Array} path
@param {Array} actions
@param {Boolean} isSync
@returns {*}
499530
function transformAsyncBranch (action, parentAction, path, actions, isSync) {
  action = action.slice();
  isSync = !isSync;
  return action
    .map((subAction, index) => {
      path.push(index);
      var result = transformBranch(subAction, action, path, actions, isSync);
      path.pop();
      return result;
    })
    .filter(branch => !!branch);
}
56899
function resolveAsync(p, base, root) {
  if (!path.isAbsolute(p)) {
    return new Promise(function(r, j) {
      resolve(forceRelative(p), {
        basedir: path.resolve(root, base)
      }, function(err, res) {
        if (err) {
          j(err);
        } else {
          r(res);
        }
      });
    });

  } else {

    return Promise.resolve(p);
  }
}
1221439
private String normalizeActionPath(Resource parent, String uri) {
        String relativeUri = extractRelativeUrl(uri, parent.getUri());
        if (!relativeUri.startsWith("/")) {
            relativeUri = "/" + relativeUri;
        }
        return relativeUri;
    }
562003
@Override
    public void doAction(Action action) {
        BaseComponent parent = getParent();
        
        switch (action) {
            case REMOVE:
                ActionListener.unbindActionListeners(this, actionListeners);
                detach();
                break;
            
            case HIDE:
            case COLLAPSE:
                setVisible(false);
                break;
            
            case SHOW:
            case EXPAND:
                setVisible(true);
                break;
            
            case TOP:
                parent.addChild(this, 0);
                break;
        }
        
        if (parent != null) {
            EventUtil.post(MainController.ALERT_ACTION_EVENT, parent, action);
        }
    }
180866
function(nestedChildren, transaction, context) {
      var children = ReactChildReconciler.instantiateChildren(
        nestedChildren, transaction, context
      );
      this._renderedChildren = children;
      var mountImages = [];
      var index = 0;
      for (var name in children) {
        if (children.hasOwnProperty(name)) {
          var child = children[name];
          // Inlined for performance, see `ReactInstanceHandles.createReactID`.
          var rootID = this._rootNodeID + name;
          var mountImage = ReactReconciler.mountComponent(
            child,
            rootID,
            transaction,
            context
          );
          child._mountIndex = index;
          mountImages.push(mountImage);
          index++;
        }
      }
      return mountImages;
    }
447791
function (basepath, action, recursive) {
  var isDirectory = function (target) {
    return fs.statSync(target).isDirectory();
  };
  var nextLevel = function (subpath) {
    _.each(fs.readdirSync(path.join(basepath, subpath)), function (filename) {
      if (isDirectory(path.join(basepath, (filename = path.join(subpath, filename))))) {
        if (recursive) {
          nextLevel(filename);
        }
      } else {
        action(filename);
      }
    });
  };
  nextLevel('./');
}
390396
function (context, callback, checkParents) {
            if (this.$parentResource) {
                var self = this;
                flow()
                    .seq("parentCollection", function (cb) {
                        self.$parentResource._findCollection(context, cb);
                    })
                    .seq("parent", function (cb) {
                        var parentCollection = this.vars.parentCollection,
                            id = parentCollection.$modelFactory.prototype.convertIdentifier(self.$parentResource.$resourceId),
                            parent = parentCollection.createItem(id);

                        if (checkParents) {
                            parent.fetch(null, cb);
                        } else {
                            cb(null, parent);
                        }
                    })
                    .exec(function (err, results) {
                        if (!err) {
                            var collection = results.parent.getCollection(self.$resourceConfiguration.$.path);
                            callback && callback(null, collection);
                        } else {
                            callback && callback(err);
                        }
                    });
            } else {
                var dataSource = this.$restHandler.getDataSource(context, this);
                callback && callback(null, dataSource.createCollection(Collection.of(this._getModelFactory()), {pageSize: 100}));
            }
        }
1250210
private void traverseTransientDescendants(ItemData parent, int action, List<ItemState> ret)
      throws RepositoryException
   {

      if (parent.isNode())
      {
         if (action != MERGE_PROPS)
         {
            Collection<ItemState> childNodes = changesLog.getLastChildrenStates(parent, true);
            for (ItemState childNode : childNodes)
            {
               ret.add(childNode);
            }
         }
         if (action != MERGE_NODES)
         {
            Collection<ItemState> childProps = changesLog.getLastChildrenStates(parent, false);
            for (ItemState childProp : childProps)
            {
               ret.add(childProp);
            }
         }
      }
   }
762569
function callAction(request, response, callback) {
    if (typeof callback == 'function') {
      return Promive.resolve()
        .then(callback.bind(null, request, response));
    }

    try {
      var Action = require(ACTION_PATH + '/' + callback.action + '.js');
    } catch (error) {
      if (error.message == 'Cannot find module \'' + ACTION_PATH + '/' + callback.action + '.js\'') {
        return Promise.reject('Action ' + callback.action + ' does not exist.')
          .catch(this.onPageNotFound.bind(this, request, response));
      }
      return Promise.reject(error)
        .catch(this.onError.bind(this, request, response));
    }

    var instance = new Action(request, response);
    // Test if method exists
    if (!instance[callback.method]) {
      return Promise.reject(new Error('Method "' + callback.method + '" not found in action "' + callback.action + '"'));
    }

    var promise = Promise.resolve();
    if (instance.init && 'function' == typeof instance.init) {
      promise = promise.then(function () {
        return instance.init();
      });
    }

    promise = promise.then(function () {
      return instance[callback.method].apply(instance, callback.arguments);
    });

    if (instance.onError && 'function' == typeof instance.onError) {
      promise = promise.catch(function (error) {
        return instance.onError.call(instance, error)
      });
    }

    promise = promise.catch(this.onError.bind(this, request, response));

    return promise;
  }
108474
function _createAction(action) {
  if (_isString(action)) {
    action = {
      destination: action,
    }
  }
  if (_isObject(action)) {
    action = (function() {
      const openNewTab = action.openNewTab
      const destination = action.destination
      return function() {
        if (openNewTab) {
          window.open(destination, '_blank')
        } else {
          window.location.href = destination
        }
      }
    })()
  }

  return action
}
652335
function action(route) {

    if(!route){
        throw new Error('Please pass an action');
    }

    return ({ constructor }, method, { value }) => {

        let Class = constructor;

        initCoreMap(storage, Class);
        initActionMap(storage, Class);

        let map = storage.get(Class);

        map.get('@action').get('events').push([
            `${method} ${route}`, value
        ]);

        /**
         * ### Ensure "registerCallback('created', ..." (see below) registered only once ###
         * This function will called every time if an event registered e.g. @on('click .foo')
         * but registerOnCreatedCallback can only call once because we want only Create
         * one Eventhandler
         */
        if(map.get('@action').get('callbacksDefined')){
            return;
        }

        map.get('@callbacks').get('created').push(domNode => {

            let events = map.get('@action').get('events');
            domNode.$router = Router.create({
                routes : events,
                scope  : domNode,
                bind   : domNode,
            });
        });

        map.get('@callbacks').get('attached').push(domNode => {

            if(domNode.$router.initialized()){
                return;
            }

            let events = map.get('@action').get('events');
            let config = Router.makeConfig({
                routes : events,
                scope  : domNode,
                bind   : domNode,
            });

            /**
             * Using the same instance is 30% faster in
             * (Chrome, Opera) and no difference in Firefox
             * @see: https://jsperf.com/new-class-vs-singleton
             */
            domNode.$router.reinit(config);

        });

        map.get('@callbacks').get('detached').push(domNode => {
            domNode.$router.destroy();
        });

        map.get('@action').set('callbacksDefined', true);
    }
}
83382
def action(callback=None, name=None, path=None, methods=Method.GET, resource=None, tags=None,
           summary=None, middleware=None):
    # type: (Callable, Path, Path, Methods, Type[Resource], Tags, str, List[Any]) -> Operation
    
    # Generate action path
    path = path or '{key_field}'
    if name:
        path += name

    def inner(c):
        return Operation(c, path, methods, resource, tags, summary, middleware)
    return inner(callback) if callback else inner
665392
function findSync(pattern, basePath, findDir) {
  const matches = [];

  (function findSyncRecurse(base) {
    let children;
    try {
      children = fs.readdirSync(base);
    } catch (exception) {
      if (exception.code === 'ENOENT') {
        return;
      }
      throw exception;
    }

    children.forEach((child) => {
      const childPath = path.join(base, child);
      const childIsDirectory = fs.lstatSync(childPath).isDirectory();
      const patternMatches = pattern.test(childPath);

      if (!patternMatches) {
        if (!childIsDirectory) {
          return;
        }
        findSyncRecurse(childPath);
        return;
      }

      if (!findDir) {
        matches.push(childPath);
        return;
      }

      if (childIsDirectory) {
        matches.push(childPath);
      }
    });
  })(basePath);
  return matches;
}
1131639
function mergeActions(actions, userActions) {
  const overrides = {};
  for (const key in userActions) {
    if (userActions.hasOwnProperty(key) && actions.hasOwnProperty(key)) {
      overrides[key] = userActions[key];
    }
  }

  return {...actions, ...overrides};
}
685089
function Context(data, parent, path, env) {
	/** 
	 * Context will inherit of AsyncCollector to manage all internal or external asynchroneous calls.
	 * It allows us to know when a context and its descendants are stabilised(i.e.all data are up to date).
	 **/
	AsyncCollector.call(this);
	this.__yContext__ = true;
	this.data = (data !== undefined) ? data : {};
	this.map = {};
	this.binds = [];
	if (parent) {
		this.parent = parent;
		this.env = env ? new Context(env) : parent.env;
		if (path) {
			var self = this;
			this.path = path;
			this.data = this.data || parent.get(path);
			this.parent.subscribe(path, function(value, type, p, key) {
				// console.log('binded context update : ', type, path, p, key, value);
				if (!p.length)
					p.push('$this');
				switch (type) {
					case 'set':
						self.set(p, value, true);
						break;
					case 'push':
						self.push(p, value, true);
						break;
					case 'delete':
						self.del(p, true);
						break;
					case 'displaceItem':
						self.displaceItem(p, value, true);
						break;
					case 'insertItem':
						self.insertItem(p, value, true);
						break;
					case 'deleteItem':
						self.deleteItem(p, value, true);
						break;
				}
			}, true, this.binds);
		}
	} else
		this.env = env ? (env.__yContext__ ? env : new Env(env)) : Context.env;
}
928945
function handler(isSync) {
    /**
     * lnf
     * Creates or overrides a symlink.
     *
     * @name lnf
     * @function
     * @param {String} target The target file. The path is relative to the `dstpath`.
     * @param {String} dstpath The path where the symlinks will be created or overriden.
     * @param {String} type The symlink type.
     * @param {Function} callback The callback function
     * @return {undefined}
     */
    var lnf = function (target, dstpath, type, callback) {

        if (typeof type === "function") {
            callback = type;
            type = undefined;
        }

        callback = callback || function (err) {
            if (err) { throw err; }
        };

        function res(err) {

            if (err && err.code === "EEXIST") {
                if (isSync) {
                    Fs.unlinkSync(dstpath);
                    lnf(target, dstpath, type, callback);
                } else {
                    Fs.unlink(dstpath, function (err) {
                        if (err) { return callback(err); }
                        lnf(target, dstpath, type, callback);
                    });
                }
                return;
            }

            callback(err);
        }

        if (isSync) {
            try {
                Fs.symlinkSync(target, dstpath, type);
            } catch (err) {
                return res(err);
            }
        } else {
            Fs.symlink(target, dstpath, type, res);
        }
    };
    return lnf;
}
594980
function resolveSync(p, base, root) {
  if (!path.isAbsolute(p)) {
    p = path.resolve(path.resolve(root, base), p);
  }
  return p;
}