How to use the aurelia-metadata.metadata function in aurelia-metadata

To help you get started, we’ve selected a few aurelia-metadata examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SpoonX / aurelia-form / dist / native-modules / aurelia-form.js View on Github external
Metadata.forTarget = function forTarget(target) {
    if (typeof target !== 'function') {
      target = target.constructor;
    }

    return _aureliaMetadata.metadata.getOrCreateOwn('spoonx:form:metadata', _homefront.Homefront, target, target.name);
  };
github SpoonX / aurelia-orm / dist / commonjs / orm-metadata.js View on Github external
OrmMetadata.forTarget = function forTarget(target) {
    return _aureliaMetadata.metadata.getOrCreateOwn(Metadata.key, Metadata, target, target.name);
  };
github adarshpastakia / aurelia-ui-framework / dist / commonjs / data / ui-datamodel.js View on Github external
function UIDataModel(id) {
        this.busy = false;
        this.loaded = false;
        this.idProperty = 'id';
        this.metadata = aurelia_metadata_1.metadata.getOrCreateOwn(aurelia_metadata_1.metadata.properties, ModelMetadata, Object.getPrototypeOf(this));
        Object.defineProperties(this, this.metadata.propertyDefs);
        this.metadata.original = _.cloneDeep(this.serialize());
        this.metadata.updated = _.cloneDeep(this.serialize());
        Object.defineProperties(this, {
            id: {
                enumerable: true,
                writable: true
            },
            apiSlug: {
                enumerable: false,
                writable: true
            },
            idProperty: {
                enumerable: false,
                writable: true
            },
github aurelia / dependency-injection / dist / commonjs / aurelia-dependency-injection.js View on Github external
var deco = function (target) {
        if (!target.hasOwnProperty('inject')) {
            target.inject = (aureliaMetadata.metadata.getOwn(aureliaMetadata.metadata.paramTypes, target) ||
                _emptyParameters).slice();
            if (target.inject && target.inject.length > 0) {
                if (target.inject[target.inject.length - 1] === Object) {
                    target.inject.splice(-1, 1);
                }
            }
        }
    };
    if (isInjectable(potentialTarget)) {
github aurelia / validatejs / dist / commonjs / aurelia-validatejs.js View on Github external
function addRule(target, key, descriptor, targetOrConfig, rule) {
  var rules = _aureliaMetadata.metadata.getOrCreateOwn(metadataKey, ValidationRules, target);
  if (targetOrConfig === null || targetOrConfig === undefined) {
    targetOrConfig = true;
  }
  rules.addRule(key, rule(targetOrConfig));

  if (descriptor) {
    descriptor.configurable = true;
  }
}
github aurelia / validatejs / dist / commonjs / aurelia-validatejs.js View on Github external
Validator.prototype._validate = function _validate(object) {
    var propertyName = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
    var rules = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];

    var errors = [];
    if (!rules) {
      rules = _aureliaMetadata.metadata.get(metadataKey, object);
    }
    if (!rules) {
      return errors;
    }
    rules = rules.rules;
    for (var i = 0, ii = rules.length; i < ii; i++) {
      var _propertyName, _validator;

      var ruleInfo = rules[i];
      if (propertyName !== null && ruleInfo.key !== propertyName) {
        continue;
      }
      var _ruleInfo$rule = ruleInfo.rule;
      var name = _ruleInfo$rule.name;
      var config = _ruleInfo$rule.config;
github adarshpastakia / aurelia-ui-framework / dist / commonjs / data / ui-datasource.js View on Github external
function UIDataSource(options) {
        if (options === void 0) { options = {}; }
        var _this = this;
        this.data = [];
        this.busy = false;
        this.loaded = false;
        this.paginate = false;
        this.metadata = aurelia_metadata_1.metadata.getOrCreateOwn(aurelia_metadata_1.metadata.properties, DSMetadata, Object.getPrototypeOf(this));
        this.logger = aurelia_logging_1.getLogger(this.constructor.name);
        options = Object.assign({}, DEFAULT_OPTIONS, options);
        Object.keys(options).forEach(function (key) { return (_this.hasOwnProperty(key) && (_this[key] = options[key]))
            || (_this.metadata.hasOwnProperty(key) && (_this.metadata[key] = options[key])); });
    }
    UIDataSource.prototype.load = function (dataList) {
github aurelia / validatejs / dist / commonjs / base-decorator.js View on Github external
function addRule(target, key, descriptor, targetOrConfig, rule) {
  var config = _aureliaMetadata.metadata.getOrCreateOwn(_metadataKey.validationMetadataKey, _validationConfig.ValidationConfig, target);
  config.addRule(key, rule(targetOrConfig));
  return (0, _propertyObserver.observeProperty)(target, key, descriptor, targetOrConfig, rule);
}
github aurelia / dependency-injection / dist / commonjs / aurelia-dependency-injection.js View on Github external
}
        };
    };
    if (arguments.length >= 1) {
        return deco(asKeyOrTarget);
    }
    return deco();
}

function validateKey(key) {
    if (key === null || key === undefined) {
        throw new Error('key/value cannot be null or undefined. Are you trying to inject/register something that doesn\'t exist with DI?');
    }
}
var _emptyParameters = Object.freeze([]);
aureliaMetadata.metadata.registration = 'aurelia:registration';
aureliaMetadata.metadata.invoker = 'aurelia:invoker';
var resolverDecorates = resolver.decorates;
var InvocationHandler = (function () {
    function InvocationHandler(fn, invoker, dependencies) {
        this.fn = fn;
        this.invoker = invoker;
        this.dependencies = dependencies;
    }
    InvocationHandler.prototype.invoke = function (container, dynamicDependencies) {
        return dynamicDependencies !== undefined
            ? this.invoker.invokeWithDynamicDependencies(container, this.fn, this.dependencies, dynamicDependencies)
            : this.invoker.invoke(container, this.fn, this.dependencies);
    };
    return InvocationHandler;
}());
function invokeWithDynamicDependencies(container, fn, staticDependencies, dynamicDependencies) {
github SpoonX / aurelia-orm / dist / native-modules / aurelia-orm.js View on Github external
OrmMetadata.forTarget = function forTarget(target) {
    return _aureliaMetadata.metadata.getOrCreateOwn(Metadata.key, Metadata, target, target.name);
  };