How to use ormnomnom - 10 common examples

To help you get started, we’ve selected a few ormnomnom 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 chrisdickinson / ormnomnom / lib / model / base.js View on Github external
Model.define = function(name, opts) {
  var ModelInstance = function(data) {
    ModelInstance._meta.decodeData(this, data);
  };

  ModelInstance.prototype = new Model(name, opts);
  ModelInstance.objects = new Manager(ModelInstance);
  ModelInstance.meta = function(opts) {
    Object.keys(opts).forEach(function(key) {
      this[key] = opts[key];
    }.bind(this._meta));
  };
  ModelInstance._meta = ModelInstance.prototype._meta;

  Model.events.emit('model', ModelInstance); 
  Model.events.emit('model:'+ModelInstance._meta.model_name, ModelInstance); 
  return ModelInstance;
};
github entropic-dev / entropic / services / storage / models / package.js View on Github external
this.#namespace = Promise.resolve(u);
    this.namespace_id = this.#namespace.id;
  }
};

const PackageVersion = require('./package-version');
const Namespace = require('./namespace');

module.exports.objects = orm(module.exports, {
  id: joi
    .number()
    .integer()
    .greater(-1)
    .required(),
  name: joi.string().min(1),
  namespace: orm.fk(Namespace),
  require_tfa: joi.boolean(),
  version_integrities: joi.object().unknown(),
  yanked: joi.boolean().default(false),
  created: joi.date(),
  modified: joi.date(),
  active: joi.boolean().default(true),
  tags: joi.object().unknown()
});
github entropic-dev / entropic / services / storage / models / token.js View on Github external
return this.#user;
  }

  set user(u) {
    this.#user = Promise.resolve(u);
    this.user_id = this.#user.id;
  }
};

module.exports.objects = orm(module.exports, {
  id: joi
    .number()
    .integer()
    .greater(-1)
    .required(),
  user: orm.fk(User),
  value_hash: joi.string(),
  description: joi.string(),
  created: joi.date(),
  modified: joi.date(),
  active: joi.boolean().default(true)
});
github entropic-dev / entropic / services / storage / models / namespace.js View on Github external
this.name = name;
    this.host = host;
    this.created = created;
    this.modified = modified;
    this.active = active;
  }
};

module.exports.objects = orm(module.exports, {
  id: joi
    .number()
    .integer()
    .greater(-1)
    .required(),
  name: joi.string().min(1),
  host: orm.fk(Host),
  created: joi.date(),
  modified: joi.date(),
  active: joi.boolean().default(true)
});
github entropic-dev / entropic / services / storage / models / maintainer.js View on Github external
return this.#namespace;
  }

  set namespace(n) {
    this.#namespace = Promise.resolve(n);
    this.namespace_id = this.#namespace.id;
  }
};

module.exports.objects = orm(module.exports, {
  id: joi
    .number()
    .integer()
    .greater(-1)
    .required(),
  package: orm.fk(Package),
  namespace: orm.fk(Namespace),
  created: joi.date(),
  modified: joi.date(),
  active: joi.boolean().default(true),
  accepted: joi.boolean().default(true)
});
github entropic-dev / entropic / services / storage / models / namespace-member.js View on Github external
set namespace(u) {
    this.#namespace = Promise.resolve(u);
    this.namespace_id = this.#namespace.id;
  }
};

const User = require('./user');
const Namespace = require('./namespace');

module.exports.objects = orm(module.exports, {
  id: joi
    .number()
    .integer()
    .greater(-1)
    .required(),
  user: orm.fk(User),
  namespace: orm.fk(Namespace),
  created: joi.date(),
  modified: joi.date(),
  active: joi.boolean().default(true),
  accepted: joi.boolean().default(true)
});
github entropic-dev / entropic / services / storage / models / authentication.js View on Github external
set user(u) {
    this.#user = Promise.resolve(u);
    this.user_id = this.#user.id;
  }
};

const User = require('./user');

module.exports.objects = orm(module.exports, {
  id: joi
    .number()
    .integer()
    .greater(-1)
    .required(),
  user: orm.fk(User),
  remote_identity: joi.string(),
  provider: joi.any().allow(['github']),
  access_token_enc: joi.string(),
  created: joi.date(),
  modified: joi.date(),
  active: joi.boolean().default(true)
});
github entropic-dev / entropic / services / storage / models / maintainer.js View on Github external
}

  set namespace(n) {
    this.#namespace = Promise.resolve(n);
    this.namespace_id = this.#namespace.id;
  }
};

module.exports.objects = orm(module.exports, {
  id: joi
    .number()
    .integer()
    .greater(-1)
    .required(),
  package: orm.fk(Package),
  namespace: orm.fk(Namespace),
  created: joi.date(),
  modified: joi.date(),
  active: joi.boolean().default(true),
  accepted: joi.boolean().default(true)
});
github entropic-dev / entropic / services / storage / models / package-version.js View on Github external
set parent(p) {
    this.#parent = Promise.resolve(p);
    this.parent_id = this.#parent.id;
  }
};

const Package = require('./package');

module.exports.objects = orm(module.exports, {
  id: joi
    .number()
    .integer()
    .greater(-1)
    .required(),
  version: joi.string().min(1),
  parent: orm.fk(Package),
  yanked: joi.boolean().default(false),
  files: joi.object().unknown(),
  derivedFiles: joi.object().unknown(),
  signatures: joi.array().items(joi.string()),
  dependencies: joi.object().unknown(),
  devDependencies: joi.object().unknown(),
  peerDependencies: joi.object().unknown(),
  optionalDependencies: joi.object().unknown(),
  bundledDependencies: joi.object().unknown(),
  active: joi.boolean().default(true),
  created: joi.date(),
  modified: joi.date()
});
github entropic-dev / entropic / services / storage / models / namespace-member.js View on Github external
this.#namespace = Promise.resolve(u);
    this.namespace_id = this.#namespace.id;
  }
};

const User = require('./user');
const Namespace = require('./namespace');

module.exports.objects = orm(module.exports, {
  id: joi
    .number()
    .integer()
    .greater(-1)
    .required(),
  user: orm.fk(User),
  namespace: orm.fk(Namespace),
  created: joi.date(),
  modified: joi.date(),
  active: joi.boolean().default(true),
  accepted: joi.boolean().default(true)
});

ormnomnom

a lightweight orm to silence the orm-y beast

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis