Beispiel #1
0
userSchema.methods.sanitize = function () {
  return _.omit(this.toJSON(), ['password', 'salt']);
};
 .map(r => r.roles && _.omit(
     r.roles, 
     'createdAt', 
     'updatedAt', 
     'permissions')
 .map(p => _.omit(p, 'createdAt', 'updatedAt')),
Beispiel #4
0
 function cleanInput(input) {
   return _.omit(JSON.parse(JSON.stringify(input)), ['id', 'type']);
 }
Beispiel #5
0
function signin(req, res) {
  if (_.isEmpty(req.user)) {
    return res.send({ signIn: false, message: req.authInfo.message })
  }
  return res.send(_.assign(_.omit(req.user, 'password'), { signIn: true }))
}
Beispiel #6
0
collection.filterProperties = function (opts) {
  return _.omit(opts, filterOptionsProperties);
};
Beispiel #7
0
 /**
  * Make the call to the Model layer
  * @param {Object} options
  * @returns {Object} options
  */
 function doQuery(options) {
     return dataProvider.Tag.edit(options.data.tags[0], _.omit(options, ['data']));
 }
Beispiel #8
0
 .then(this.reinsertData(function(row) {
   return _.omit(row, column);
 }))
        _.each(renderingOnlyAttrs || allAttrs, function(attrs, selector) {

            // Elements that should be updated.
            var $selected = this.findBySelector(selector);

            // No element matched by the `selector` was found. We're done then.
            if ($selected.length === 0) return;

            // Special attributes are treated by JointJS, not by SVG.
            var specialAttributes = ['style', 'text', 'html', 'ref-x', 'ref-y', 'ref-dx', 'ref-dy', 'ref-width', 'ref-height', 'ref', 'x-alignment', 'y-alignment', 'port'];

            // If the `filter` attribute is an object, it is in the special JointJS filter format and so
            // it becomes a special attribute and is treated separately.
            if (_.isObject(attrs.filter)) {

                specialAttributes.push('filter');
                this.applyFilter(selector, attrs.filter);
            }

            // If the `fill` or `stroke` attribute is an object, it is in the special JointJS gradient format and so
            // it becomes a special attribute and is treated separately.
            if (_.isObject(attrs.fill)) {

                specialAttributes.push('fill');
                this.applyGradient(selector, 'fill', attrs.fill);
            }
            if (_.isObject(attrs.stroke)) {

                specialAttributes.push('stroke');
                this.applyGradient(selector, 'stroke', attrs.stroke);
            }

            // Make special case for `text` attribute. So that we can set text content of the `<text>` element
            // via the `attrs` object as well.
            // Note that it's important to set text before applying the rest of the final attributes.
            // Vectorizer `text()` method sets on the element its own attributes and it has to be possible
            // to rewrite them, if needed. (i.e display: 'none')
            if (!_.isUndefined(attrs.text)) {

                $selected.each(function() {

                    V(this).text(attrs.text + '', { lineHeight: attrs.lineHeight, textPath: attrs.textPath });
                });
                specialAttributes.push('lineHeight','textPath');
            }

            // Set regular attributes on the `$selected` subelement. Note that we cannot use the jQuery attr()
            // method as some of the attributes might be namespaced (e.g. xlink:href) which fails with jQuery attr().
            var finalAttributes = _.omit(attrs, specialAttributes);
            
            $selected.each(function() {
                
                V(this).attr(finalAttributes);
            });

            // `port` attribute contains the `id` of the port that the underlying magnet represents.
            if (attrs.port) {

                $selected.attr('port', _.isUndefined(attrs.port.id) ? attrs.port : attrs.port.id);
            }

            // `style` attribute is special in the sense that it sets the CSS style of the subelement.
            if (attrs.style) {

                $selected.css(attrs.style);
            }
            
            if (!_.isUndefined(attrs.html)) {

                $selected.each(function() {

                    $(this).html(attrs.html + '');
                });
            }
            
            // Special `ref-x` and `ref-y` attributes make it possible to set both absolute or
            // relative positioning of subelements.
            if (!_.isUndefined(attrs['ref-x']) ||
                !_.isUndefined(attrs['ref-y']) ||
                !_.isUndefined(attrs['ref-dx']) ||
                !_.isUndefined(attrs['ref-dy']) ||
		!_.isUndefined(attrs['x-alignment']) ||
		!_.isUndefined(attrs['y-alignment']) ||
                !_.isUndefined(attrs['ref-width']) ||
                !_.isUndefined(attrs['ref-height'])
               ) {

                   _.each($selected, function(el, index, list) {
                       var $el = $(el);
                       // copy original list selector to the element
                       $el.selector = list.selector;
                       relativelyPositioned.push($el);
                   });
            }
            
        }, this);
      it(`should parse ${_.lowerCase(bundleName)}`, function () {
        const modules = parseBundle(`${BUNDLES_DIR}/${bundleName}.js`);
        const expectedModules = JSON.parse(fs.readFileSync(`${BUNDLES_DIR}/${bundleName}.modules.json`));

        expect(_.omit(modules, 'src')).to.deep.equal(expectedModules);
      });
Beispiel #11
0
 .then(this.reinsertData(function(row) {
   row[to] = row[from];
   return _.omit(row, from);
 }))
Beispiel #12
0
const baseConfig = require('./base')

var config = _.merge({
  cache: true,
  devtool: 'eval-source-map',
  entry: [
    'webpack-dev-server/client?http://0.0.0.0:0',
    'webpack/hot/only-dev-server',
  ].concat(baseConfig.entry),
  mode: 'development',
  output: {
    filename: 'app.js',
    path: __dirname,
    publicPath: baseConfig.devServer.publicPath,
  },
}, _.omit(baseConfig, 'entry'))

config.plugins = [].concat(
  config.plugins.filter(p => !(p instanceof WebpackPwaManifest)),
  [
    new webpack.LoaderOptionsPlugin({
      debug: true,
    }),
    new webpack.DefinePlugin({
      'process.env.ASSET_PATH': JSON.stringify(config.output.publicPath),
    }),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NamedModulesPlugin(),
    // Embed the JavaScript in the index.html page.
    new HtmlWebpackPlugin(),
    new webpack.NoEmitOnErrorsPlugin(),
        return function doValidate() {
            let object, options, permittedOptions;

            if (arguments.length === 2) {
                object = arguments[0];
                options = _.clone(arguments[1]) || {};
            } else if (arguments.length === 1) {
                options = _.clone(arguments[0]) || {};
            } else {
                options = {};
            }

            // Setup permitted options, starting with the global defaults
            permittedOptions = utils.globalDefaultOptions;

            // Add extra permitted options if any are passed in
            if (extras && extras.opts) {
                permittedOptions = permittedOptions.concat(extras.opts);
            }

            // This request will have a data key added during validation
            if ((extras && extras.attrs) || object) {
                permittedOptions = permittedOptions.concat(utils.dataDefaultOptions);
            }

            // If an 'attrs' object is passed, we use this to pick from options and convert them to data
            if (extras && extras.attrs) {
                options.data = _.pick(options, extras.attrs);
                options = _.omit(options, extras.attrs);
            }

            /**
             * ### Check Options
             * Ensure that the options provided match exactly with what is permitted
             * - incorrect option keys are sanitized
             * - incorrect option values are validated
             * @param {object} options
             * @returns {Promise<options>}
             */
            function checkOptions(options) {
                // @TODO: should we throw an error if there are incorrect options provided?
                options = _.pick(options, permittedOptions);

                let validationErrors = utils.validateOptions(options);

                if (_.isEmpty(validationErrors)) {
                    return Promise.resolve(options);
                }

                // For now, we can only handle showing the first validation error
                return Promise.reject(validationErrors[0]);
            }

            // If we got an object, check that too
            if (object) {
                return utils.checkObject(object, docName, options.id).then((data) => {
                    options.data = data;

                    return checkOptions(options);
                });
            }

            // Otherwise just check options and return
            return checkOptions(options);
        };
Beispiel #14
0
        });
    }

    return Promise.resolve(conversation);
  },

  /**
   * @param {Object} options
   * @private
   * @returns {Promise<Array<Activity>>}
   */
  _listActivities(options) {
    return this._list({
      service: `conversation`,
      resource: options.mentions ? `mentions` : `activities`,
      qs: omit(options, `mentions`)
    });
  },

  /**
   * @param {Object} options
   * @private
   * @returns {Promise<Array<Conversation>>}
   */
  _list(options) {
    options.qs = Object.assign({
      personRefresh: true,
      uuidEntryFormat: true,
      activitiesLimit: 0,
      participantsLimit: 0
    }, options.qs);
Beispiel #15
0
 return map(value, item => validator.validate(keys(omit(options, 'values')), item));
Beispiel #16
0
      { '@pseudo': 'table' }, margin, table ],

    '.button__cell': [
      { '@pseudo': 'cell' }, background, padding, borderRadius, border, height, width, box ],

    '.button__link': [
      { '@pseudo': 'link' }, background, text, font ],
    '.button__text': [
      { '@pseudo': 'text' }, 'color', 'text-decoration' ]
  },

  render (attrs, contents) {
    attrs.class += ' button'

    return (
      <div {...omit(attrs, [ 'href', 'target' ])}>
        <table role='presentation' width='100%' align='left' border='0' cellpadding='0' cellspacing='0'>
          <tr>
            <td>
              <table role='presentation' width='auto' align='center' border='0' cellspacing='0' cellpadding='0' class='button__table'>
                <tr>
                  <td align='center' class='button__cell'>
                    <a {...pick(attrs, [ 'href', 'target' ])} class='button__link' style='display: inline-block;'>
                      <span class='button__text'>{contents}</span>
                    </a>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
Beispiel #17
0
 retrieve: function( opts ){
   this.debug( "#retrieve" );
   return this.collection.model
     .findById( opts._id, opts.fields, _.omit( opts, [ 'fields', '_id' ] ) );
 },
Beispiel #18
0
 .then((user) => res.send(_.omit(user, 'password')))
  render: function () {
    var that = this;
    var resources = _.map(this.props.schema.resources, function (value, key) {
      return <option value={key} key={key}>{key}</option>;
    });

    var recordType = this.props.definition.recordType;
    var resourceFields = recordType && this.props.schema.schemas[recordType].properties;
    var fields = _.map(resourceFields, function (value, key) {
      return <option value={key} key={key}>{value.title}</option>;
    });

    var totals = _.map(_.omit(resourceFields, function (value) {
      return value.type !== "number";
    }), function (value, key) {
      return <option value={key} key={key}>{value.title}</option>;
    });

    return (
      <form className="form-horizontal" role="form">
        <div className="form-group">
          <label for="businessObject" ref="businessObjectLabel" className="col-md-5 control-label">Business Object:</label>
          <div className="col-md-7">
            <select onChange={this.handleResourceChange}
                id="businessObject"
                ref="businessObject"
                value={that.props.definition.recordType}
                className="form-control">
              <option value=""></option>
              {resources}
            </select>
          </div>
        </div>
        <div className="form-group">
          <label className="col-md-5 control-label">Filter by Fields:</label>
        </div>

    {_.times(this.state.filterFields, function (i) {
      return (<div className="form-group" key={"formGroup" + i}>
        <div className="col-md-5">
          <select onChange={that.handleFilterbyChange} id={"filterBy" + i} ref={"filterBy" + i}
              key={"filterBy" + i} className="form-control"
              value={that.props.definition.filterByArray.length > i &&
                that.props.definition.filterByArray[i]}>
            <option value=""></option>
            {fields}
          </select>
        </div>
        <div className="col-md-5">
          <input type="text" className="form-control" id={"filterByValue" + i}
            ref={"filterByValue" + i} key={"filterByValue" + i}
            value={that.props.definition.filterByValueArray &&
              that.props.definition.filterByValueArray.length > i &&
              that.props.definition.filterByValueArray[i]}
            onChange={that.handleFilterbyValueChange} />
        </div>
        <div className="col-md-2">
          <button type="button" className="btn btn-info"
              style={i + 1 !== that.state.filterFields ? {display:"none"} : {}}
              onClick={that.addFilterField}>
            <span className="glyphicon glyphicon-plus"></span>
          </button>
        </div>
      </div>);
    })}
        <div className="form-group">
          <label for="groupBy" className="col-md-5 control-label">Group By Field:</label>
          <div className="col-md-7">
            <select onChange={this.handleGroupbyChange} ref="groupBy" id="groupBy"
                value={that.props.definition.groupBy}
                className="form-control">
              <option value=""></option>
              {fields}
            </select>
          </div>
        </div>
        <div className="form-group">
          <label for="totalBy" className="col-md-5 control-label">Total By Field: </label>
          <div className="col-md-7">
            <select onChange={this.handleTotalbyChange} ref="totalBy" id="totalBy"
                value={that.props.definition.totalBy}
                className="form-control">
              <option value=""></option>
              <option value="_count">Count</option>
              {totals}
            </select>
          </div>
        </div>
        <div className="form-group">
          <label for="chartType" className="col-md-5 control-label">Chart Type: </label>
          <div className="col-md-7">
            <select onChange={this.handleChartTypeChange}
                ref="chartType"
                id="chartType"
                value={this.props.definition.chartType}
                className="form-control">
              <option value="bar">Bar</option>
              <option value="donut">Donut</option>
              <option value="pie">Pie</option>
            </select>
          </div>
        </div>
        <div className="form-group">
          <label for="chartType" className="col-md-5 control-label">Description: </label>
          <div className="col-md-7">
            <input onChange={this.handleDescriptionChange}
                ref="description"
                id="description"
                value={this.props.definition.description}
                className="form-control" />
          </div>
        </div>
      </form>
    );
  },
Beispiel #20
0
function show(req, res) {
  return res.send(_.assign(_.omit(req.user, 'password'), { signIn: true }))
}
Beispiel #21
0
 /**
  * ### Model Query
  * Make the call to the Model layer
  * @param {Object} options
  * @returns {Object} options
  */
 function doQuery(options) {
     return dataProvider.Tag.findOne(options.data, _.omit(options, ['data']));
 }
	var omit = function(target) {
		return _.omit(target, "pages", "pagination", "collections");
	};