@function createMeta

create related object

@param {object} args

@returns {Promise}

@throws {Error}
325902
function createMeta (args) {
    // resolve relation name to spec - will throw error if cant be resolved
    var relation = this.model.relation(args.relation)
    // args for creating related model
    var relatedArgs = {
        catch: false,
        data: args.data,
        session: args.session || this.session,
    }
    // add ids
    relatedArgs[this.model.columnName('id')] = this.id
    relatedArgs[this.model.columnName('originalId')] = this.originalId
    // create related model
    return relation.model.createMeta(relatedArgs)
    // create via model if any
    .then(related => {
        // if via model not specified then do not create
        if (!relation.viaModel) {
            return related
        }
        // args for via model
        var viaArgs = {
            session: defined(args.session) ? args.session : this.session,
        }
        // add id and original id for both instance and related models
        viaArgs[this.model.columnName('id')] = this.id
        viaArgs[this.model.columnName('originalId')] = this.originalId
        viaArgs[relation.model.columnName('id')] = related.id
        viaArgs[relation.model.columnName('originalId')] = related.originalId
        // create via model
        return relation.viaModel.createMeta(viaArgs)
        // resolve with related record
        .then(() => related)
    })
}
687150
function create (level) {
        return function() {
            var args, outstring;

            args = Array.prototype.slice.call(arguments, 0);

            if (!IE) {
                args.unshift(level);

            } else {
                outstring = level + ' ';
                args.forEach(function(arg){
                    outstring += object.stringify(arg) + ' ';
                });
                args = [outstring];
            }

            log.apply(this, arguments);
        };
    }
764298
function createApplication() {
  var app = connect();
  utils.merge(app, proto);
  app.request = { __proto__: req };
  app.response = { __proto__: res };
  app.init();
  return app;
}
624596
function create() {
  var app = junction();
  utils.merge(app, application);
  app.init();
  return app;
}
592548
function createHostComponentMeta(compMeta) {
	      var template = CssSelector.parse(compMeta.selector)[0].getMatchingElementTemplate();
	      return CompileDirectiveMetadata.create({
	          type: new CompileTypeMetadata({
	              reference: Object,
	              name: compMeta.type.name + "_Host",
	              moduleUrl: compMeta.type.moduleUrl,
	              isHost: true
	          }),
	          template: new CompileTemplateMetadata({
	              encapsulation: _angular_core.ViewEncapsulation.None,
	              template: template,
	              templateUrl: '',
	              styles: [],
	              styleUrls: [],
	              ngContentSelectors: [],
	              animations: []
	          }),
	          changeDetection: _angular_core.ChangeDetectionStrategy.Default,
	          inputs: [],
	          outputs: [],
	          host: {},
	          isComponent: true,
	          selector: '*',
	          providers: [],
	          viewProviders: [],
	          queries: [],
	          viewQueries: []
	      });
	  }
1265723
function createSender(args)
{

    if(args.AccessKeyId&&args.AccessKeySecret&&args.SignName&&args.TemplateCode)
    {
        let sender=JSON.parse(JSON.stringify(params));
        sender=Object.assign(sender,args);
        sender.__AccessKeySecret=args.AccessKeySecret;
        delete sender.AccessKeySecret;
        sender.__proto__=proto;
        return sender;
    }
    else
    {
        return false;
    }
}
200294
function (args) {
    Model.call(this, args);
    this.modelType = messageContents.modelType;
    this.attributes = [];
    for (var a in messageContents.attributes) {
      var attrib = new Attribute(messageContents.attributes[a].name, messageContents.attributes[a].type);
      if (attrib.name == 'id') { // TODO only If mongo! or refactor mongo to normalize IDs
        attrib.value = messageContents.attributes[a].value;
      } else {
        attrib.value = messageContents.attributes[a].value;
      }
      this.attributes.push(attrib);
    }
  }
873139
def create(args):
    

    from sick.models.create import create 
    return create(os.path.join(args.output_dir, args.model_name),
        args.grid_points_filename, args.wavelength_filenames,
        clobber=args.clobber)
120692
function main(args) {
  return new Promise((resolve, reject) => {
    let b = browserifyArgs(['--node', '--no-detect-globals'].concat(args));
    let outdir = (b.argv.outdir || b.argv.o);
    if (b.argv._[0] === 'help' || b.argv.h || b.argv.help ||
      (process.argv.length <= 2 && process.stdin.isTTY)) {
      reject(new Error('Usage: collect-js-deps --outdir <path> [--list] ' +
        '{BROWSERIFY-OPTIONS} [entry files]'));
      return;
    }
    if (!outdir && !b.argv.list) {
      reject(new Error('collect-js-deps requires --outdir (-o) option for output directory, or --list'));
      return;
    }
    collect_js_deps(b, { list: b.argv.list, outdir });
    b.bundle((err, body) => err ? reject(err) : resolve());
  });
}
1288192
function createMiddleware(options, archiveFormat) {
  /**
   * Express middleware handling GitHub API archive link requests
   *
   * @param {Request} req Request object
   * @param {Response} res Response object
   * @param {callback} next next middleware in chain
   *
   * @see https://developer.github.com/v3/repos/contents/#get-archive-link
   */
  return (req, res) => {
    // GET /repos/:owner/:repo/:archive_format/:ref
    const { owner } = req.params;
    const repoName = req.params.repo;
    const refName = req.params.ref || 'master';

    const host = req.mappedSubDomain ? `localhost:${options.listen[req.protocol].port}` : req.headers.host;
    const location = `${req.protocol}://${host}/codeload/${owner}/${repoName}/${archiveFormat}/${refName}`;

    res.writeHead(302, {
      Location: location,
    });
    res.end();
  };
}
1100885
function createGitCmdPromise(args) {
  return new Promise(function(resolve, reject) {

    //Remove null values from the final git arguments
    args = args.filter(function(arg) {
      /*jshint eqnull:true */
      return arg != null;
    });

    /**
     * @name git#command
     * @event
     * @param {String} String the command issued
     */
    events.emit('command', [gitCmd].concat(args).join(' '));
    var proc = spawn(gitCmd, args);

    var output = Promise.join(readStream(proc.stdout), readStream(proc.stderr), function(stdout, stderr) {
      //Some warnings (like code === 1) are in stdout
      //fatal are in stderr. So try both
      return stdout || stderr;
    }).tap(function(output) {
      /**
       * @name git#result
       * @event
       * @param {String} String the captured output
       */
      events.emit('result', output);
    });

    proc.on('close', function(code) {
      //Some weird behaviours can arise with stdout and stderr values
      //cause writting to then is sync in *nix and async in windows.
      //Also, excessive treatment or long outputs that cause a drain
      //in the stderr & stdout streams, could lead us to having this proc
      //closed (and this callback called), and no complete values captured
      //in an eventual closure variable set then we emit the 'result' event
      //So using promises solves this syncronization
      output.then(function(output) {
        if (code !== 0) {
          var error = new Error('git exited with an error');
          error.code = code;
          error.output = output;
          reject(error);
        } else {
          resolve(output);
        }
      });
    });

    proc.on('error', function(error) {
      reject(new Error(error));
    });
  });
}
1288863
function createMeta(source, options) {
  return {
    tagName: null,
    fragments: null,
    options: {
      ...DEFAULT_OPTIONS,
      ...options
    },
    source
  }
}
306096
async function createTable (args) {
    // get args object
    args = requireValidOptionalObject(args)
    // get create table sql
    var createTableSql = sql.createTable(this)
    // debug
    debug(createTableSql)
    // attempt to create table
    await this.mysql().query(createTableSql, {}, {}, args.session)
}
644392
function createFromMetadata (connector, modelsMetadata) {
    if (!connector || !modelsMetadata) {
      throw new Error('Please provide both connector and metadata so Arrow could create models')
    }

    const loadModels = connector.config.generateModels

    return Object.keys(modelsMetadata).reduce(function (previousModels, modelName) {
      const persistModels = connector.config.persistModels
      if (loadModels && loadModels.indexOf(modelName) === -1) {
        return previousModels
      }
      const metadata = modelsMetadata[modelName]
      metadata.autogen = !!connector.config.modelAutogen
      metadata.generated = true
      metadata.connector = connector.name
      metadata.name = modelName

      dataValidator.validate(metadata, metadataSchema)

      if (persistModels) {
        utils.saveModelSync(createModelName(connector, modelName), metadata, connector.modelDir)
      } else {
        previousModels[modelName] = Arrow.createModel(createModelName(connector, modelName), metadata)
      }
      return previousModels
    }, {})
  }
280822
function handleArguments(args) {
  return new Promise(function(resolve, reject) {
    var requires = [];
    var promises = [];

    // check for Promises in args
    if (args && args instanceof Array) {
      args.some(function (arg, i) {
        if ((arg.value === null || typeof(arg.value) == 'undefined') && arg.optional) {
          return true;
        }

        if (arg.value && Array.isArray(arg.value) && arg.optional && arg.value.length == 0) {
          return true;
        }

        if (arg.type == 'string') {
          var s = '"' + arg.value.replace(/"/g, '\\\"') + '"';
          promises.push(Promise.resolve(s));
        } else if (arg.type == 'lambda') {
          promises.push(serializeLambda(arg.value));
        } else if (arg.type == 'lambdaArgs') {
          promises.push(new Promise(function(resolve, reject) {
            handleArrayArgument(arg.value).then(function (result) {
              resolve(result);
            }).catch(reject);
          }));
        } else if (arg.type == 'map') {
          promises.push(Promise.resolve(JSON.stringify(arg.value)));
        } else if (arg.type == 'promise') {
          promises.push(new Promise(function(resolve, reject) {
            arg.value.then(function(val) {
              if (typeof(val) == 'string') {
                if (isNaN(val)) {
                  // a string
                  var s = '"' + val.replace(/"/g, '\\\"') + '"';
                  resolve(s);
                } else {
                  resolve(parseFloat(val));
                }
              } else {
                resolve(val);
              }
            });
          }));
        } else if (arg.value.refIdP) {
          promises.push(arg.value.refIdP);
        } else if (arg.type == 'List') {
          promises.push(Promise.resolve(arg.value.toString()));
        } else if (arg.type == 'array') {
          // simple array argument
          promises.push(handleArrayArgument(arg.value));
        } else if (arg.type == '_eclairSerialize') {
          if (arg.value._eclairSerialize == 'staticProperty') {
            var val = arg.value.ref.name + '.' + arg.value.value;
            promises.push(Promise.resolve(val));
            requires.push({name: arg.value.ref.name, moduleLocation: arg.value.ref.moduleLocation});
          }
        } else if (Array.isArray(arg.value)) {
          // TODO: should we try to wrap the array if it isn't?
          promises.push(new Promise(function (resolve, reject) {
            handleArguments(arg.value).then(function (result) {
              if (result.requires.length > 0) {
                result.requires.forEach(function (r) {
                  requires.push(r)
                });
              }

              resolve('[' + result.args + ']');
            }).catch(reject);
          }));
        } else if (arg.type == '_eclairForceFloat') {
          var val = arg.value.value;
          if (val.toString().indexOf('.') === -1) {
            val = val.toFixed(1);
          }
          promises.push(Promise.resolve(val));
        } else if (arg.type == '_eclairLocal') {
          promises.push(Promise.resolve(arg.value._generateRemote().refIdP));
        } else if (arg.type == 'sparkclassref') {
          // we have a spark class reference, so return its name
          promises.push(Promise.resolve(arg.value.name));
          // add the class to the requires list
          requires.push({name: arg.value.name, moduleLocation: arg.value.moduleLocation});
        } else {
          promises.push(Promise.resolve(arg.value));
        }

        return false;
      });
    }

    Promise.all(promises).then(function(finalArgs) {
      resolve({args: finalArgs, requires: requires});
      //resolve(finalArgs);
    }).catch(function(e) {
      console.log(e);
      reject(e)
    });
  });
}
1344000
function createDocument(args) {
  const { browser } = args;

  const features = {
    FetchExternalResources:   [],
    ProcessExternalResources: [],
    MutationEvents:           '2.0'
  };

  const window  = new Window({
    parsingMode:  'html',
    contentType:  'text/html',
    url:          args.url,
    referrer:     args.referrer
  });

  const { document } = window;
  const documentImpl = idlUtils.implForWrapper(document)

  if (args.browser.hasFeature('scripts', true)) {
    features.FetchExternalResources.push('script');
    features.ProcessExternalResources.push('script');
    window._runScripts = 'dangerously';
  }
  if (args.browser.hasFeature('css', false)) {
    features.FetchExternalResources.push('css');
    features.FetchExternalResources.push('link');
  }
  if (args.browser.hasFeature('img', false))
    features.FetchExternalResources.push('img');
  if (args.browser.hasFeature('iframe', true))
    features.FetchExternalResources.push('iframe');


  browserFeatures.applyDocumentFeatures(documentImpl, features);
  setupWindow(window, args);

  // Give event handler chance to register listeners.
  args.browser.emit('loading', document);
  return document;
}
635808
function runNotCached (args, methodMeta) {
    // freeze args
    if (methodMeta.freeze) {
        // clone args to prevent leaking frozen objects
        args = _.cloneDeep(args)
        // recursively freeeze all objects in args
        deepFreeze(args)
    }
    // promise to be resolved with method result
    var promise
    // Immutable AI enabled
    if (methodMeta.immutableAI) {
        // create immutable ai instance
        var ai = immutableAI(args)
        // call method with Immutable AI instance
        promise = Promise.resolve( methodMeta.method.call(ai, args) )
    }
    // Immutable AI disabled
    else {
        promise = Promise.resolve( (methodMeta.method)(args) )
    }
    // args are frozen
    if (methodMeta.freeze) {
        // after result resolves clone to prevent leaking frozen objects
        promise = promise.then(_.cloneDeep)
    }
    // resolve promises
    if (methodMeta.resolve) {
        promise = promise.then(
            // if result is object then resolve promises
            ret => typeof ret === 'object' && ret !== null ? deepResolve(ret) : ret
        )
    }
    // validate return value
    if (defined(methodMeta.schema.return) && methodMeta.validateArgs) {
        promise = promise.then(ret => validateReturn(ret, methodMeta))
    }
    // return promise to be resolved with method result
    return promise
}