npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vineyard-ground

v0.2.19

Published

Vineyard Ground

Downloads

131

Readme

Vineyard Ground

SQL ORM for Node.js. Uses Sequelize and Vineyard Schema.

Features

  • Uses POD (Plain Old Data) objects.
  • Schema can be defined entirely in JSON.
  • Comprehensive understanding of table relationships (something most JavaScript ORMs lack.)
  • Chainable query API.
  • Automatic identity resolution. (Functions requiring an entity identifier can be passed either an object or scalar identity value.)

API

Collection

create(seed): Promise<T>

Creates a new entity and saves it to the database. Returns a copy of the new entity.

update(seed, changes): Promise<T>

Updates a record.

seed can be either an id or a property with an id.

changes is a dictionary of property key/value pairs to be changed.

all(): Query<T>

Returns a query containing all items in that collection.

filter(options): Query<T>

Returns a query containing all items in the collection that match the key/value pairs in options

first(options?): Query<T>

Returns the first item in the collection, optionally filtered by key/value pairs.

get(identity): Query<T>

Returns a single item that matches the provided id.

Query

Queries are chainable, allowing for processes like:

model.Character
  .filter({health: 20})
  .expand('inventory')
  .expand('race')
  .select(['id', 'inventory', 'race.name'])

Since queries are chainable, they are not actually executed until either the exec or then method is called.

then(handler: any): Promise<any>

Executes the query and attaches a handler to the promise resolution.

exec(): Promise<any>

Executes the query. This is only needed when then is not called.

filter(options): Query<T>

Returns a query containing all items in the current query that match the key/value pairs in options

first(options?): Query<T>

Returns the first item in the current query, optionally filtered by key/value pairs.

expand(path: string): Query<T2>

Causes entities returned by the query to have the specified related entities expanded instead of being returned as scalar identity values.

For example, while this

model.Employee.first()

would return

{
  id: 23103013,
  name: "Bob",
  company: 31414515
}

adding an expansion

model.Employee.first().expand('company')

would return

{
  id: 23103013,
  name: "Bob",
  company: {
    id: 31414515,
    name: "Bob's Burger Joint"
  }
}