Load all Model specifications
@returns {Promise<[Models]>} - the promise of an array containing all models
499206
function loadModels() {
  const modelSpecsPath = path.join(process.cwd(), plugin.config.modelsPath);

  return plugin.myrmex.fire('beforeModelsLoad')
  .spread(() => {
    return Promise.promisify(fs.readdir)(modelSpecsPath);
  })
  .then(fileNames => {
    // Load all the model specifications
    return Promise.map(fileNames, fileName => {
      const modelSpecPath = path.join(modelSpecsPath, fileName);
      const modelName = path.parse(fileName).name;
      return loadModel(modelSpecPath, modelName);
    });
  })
  .then(models => {
    return plugin.myrmex.fire('afterModelsLoad', models);
  })
  .spread(models => {
    return Promise.resolve(models);
  })
  .catch(e => {
    if (e.code === 'ENOENT' && path.basename(e.path) === path.basename(plugin.config.modelsPath)) {
      return Promise.resolve([]);
    }
    Promise.reject(e);
  });
}
666204
function() {
		var destroyPromises = [];

		_.each(this.fixtureNames, function(fixtureName) {
			var Model = sails.models[fixtureName];

			if (Model) {
				destroyPromises.push(Model.destroy());
			} else {
				throw new Error("Model " + fixtureName + " could not be found in sails.models.");
			}
		});

		return Q.all(destroyPromises);
	}
67702
function modelQuery(options) {
            return models.Post.findOne(options.data, omit(options, ['data']))
                .then((model) => {
                    if (!model) {
                        return Promise.reject(new common.errors.NotFoundError({
                            message: common.i18n.t('errors.api.posts.postNotFound')
                        }));
                    }

                    return {
                        posts: [urlsForPost(model.id, model.toJSON(options), options)]
                    };
                });
        }
947374
public function getModelsToLoad()
    {
        $returnValue = array();

		foreach ($this->getEnabledExtensions() as $ext) {
			$returnValue = array_merge($returnValue, $ext->getManifest()->getModels());
		}
		$returnValue = array_unique($returnValue);

        return (array) $returnValue;
    }
351121
function() {
      return _.map(this.models, function(model) {
        // Pull out component models
        if (model.type === 'Widget' && model.model) {
          return model.model;
        } else {
          return model;
        }
      });
    }
734087
function modelQuery(options) {
            return models.Base.Model.generateSlug(allowedTypes[options.type], options.data.name, {status: 'all'})
                .then((slug) => {
                    if (!slug) {
                        return Promise.reject(new common.errors.GhostError({
                            message: common.i18n.t('errors.api.slugs.couldNotGenerateSlug')
                        }));
                    }

                    return {
                        slugs: [{slug: slug}]
                    };
                });
        }
1138499
function all(callback) {
        var Model = this;
        var request = {
            find : 'find',
            model : Model
        };
        
        this.dispatch('beforeAll'); 
        this.storage.find(request, function findCallback(data) {
            if (callback) {
                callback(data);
                Model.dispatch('afterAll');
            }
        });
        
        return this;
    }
1321846
function () {
    const oThis = this
      , promiseArray = [];

    return new Promise(async function (onResolve, onReject) {
      for (var chain in setupConfig.chains) {
        promiseArray.push(oThis._isRunning(chain));
      }
      return Promise.all(promiseArray).then(onResolve);
    });
  }
670934
@NotNull
	public static Promise<Void> all(@NotNull Iterator<? extends Promise<?>> promises) {
		if (!promises.hasNext()) return all();
		@NotNull PromiseAll<Object> resultPromise = new PromiseAll<>();
		while (promises.hasNext()) {
			Promise<?> promise = promises.next();
			if (promise.isResult()) continue;
			if (promise.isException()) return Promise.ofException(promise.materialize().getException());
			resultPromise.countdown++;
			promise.next(resultPromise);
		}
		return resultPromise.countdown != 0 ? resultPromise : Promise.complete();
	}
1026911
function (requestPromise) {
  var that = this;

  // this will be bound to Client instance later in the Client constructor
  if (!this.isValid) {
    return Promise.reject(new Model({Errors: this.errors.join(',')}));
  }

  return requestPromise.apply(null, slice.call(arguments, 1))
    .then(function (response) {
      return new Model(response);
    }, function (reason) {
      var errors = that.errors;
      if (reason.statusCode >= 400 && reason.statusCode < 500) {
        errors.push(ClientError.HTTP_CLIENT_ERROR);
      } else if (reason.statusCode >= 500 && reason.statusCode < 600) {
        errors.push(ClientError.HTTP_SERVER_ERROR);
      } else {
        errors.push(ClientError.EXCEPTION);
      }
      return Promise.reject(new Model({Errors: errors.join(',')}));
    });
}
93077
function getModels(done) {
  if (models) {
    return done(models);
  }

  return orm.initialize(ormConfig, function(err, m) {
    if (err) {
      throw err;
    }

    // make the models available as soon as possible for other functions
    models = m;

    // ignore error if groups already created
    let catcher = (createErr) => { if (createErr && createErr.code !== "E_VALIDATION") { throw createErr; } };

    // create the administrators group
    createGroup("admin", catcher);

    // create the public group
    createGroup("public", catcher);

    return done(models);
  });
}
1268179
function() {
        var promises = [];

        this.images = this.element.find('img').each(function(index, image) {
            if (image.complete) {
                return; // Already loaded
            }

            var src = image.src,
                def = $.Deferred();

            image.onload = def.resolve;
            image.onerror = image.onabort = def.reject;
            image.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';
            image.src = src;

            promises.push(def.promise());
        });

        $.when.apply($, promises).always(this.render.bind(this));
    }
539413
def load_model(file)
      begin
        require_dependency(file)
      rescue Exception => e
        Logger.new($stdout).warn(e.message)
      end
    end
156565
function modelQuery(options) {
            return models.Post.findPage(options)
                .then(({data, meta}) => {
                    return {
                        posts: data.map(model => urlsForPost(model.id, model.toJSON(options), options)),
                        meta: meta
                    };
                });
        }
870316
function resolve() {
    var promises = [];
    var args = flatten(arguments);
    for (var i = 0; i < args.length; i ++) {
      promises.push(Esquire.resolve(args[i], true, true));
    }

    /* Await for resolution of dependencies */
    return Promise.all(promises).then(function(result) {
      var modules = {};
      for (var i = 0; i < result.length; i ++) {
        var resolved = result[i];
        for (var name in resolved) {
          var module = resolved[name];
          if (module.$$dynamic) continue;
          modules[name] = resolved[name];
        }
      }
      return modules;
    });
  }
647131
function() {
      var results = [];
      _.each(this.relations, (constructor, key) => {
        if (this.has(key)) {
          var value = this.get(key);
          // Pull out component models
          if (value && value.type === 'Widget' && value.model) {
            value = value.model;
          }
          results.push(value);
        }
      });
      return results;
    }
1035195
async function getAll(options) {
    const data = {};
    const keys = filterPaths(await module.exports.keys(), options);

    for (let key of keys) {
      data[key] = await module.exports.get(key, {
        before: options.before,
        after: options.after,
      });
    }

    await Promise.all(keys);

    return data;
  }