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

warehouse-models

v6.0.2

Published

Datastar models for warehouse

Downloads

98

Readme

warehouse-models

Version npm License npm Downloads Build Status Dependencies

Data models for Warehouse.ai. Built on top of dynamodb and dynastar.

Install

npm install --save warehouse-models

Usage

All of the objects returned from this module have the same api as dynastar with the schemas as mentioned later.

const dynamo = require('dynamodb-x')
const models = require('warehouse-models')(dynamo);

...
// from passing dynamodb.define to the constructor of dynastar we get...
const Build = models.Build;
const Version = models.Version;
...

Build.findFirst({ ... }, function (err, data) { .... });

*** Note that with the new dynamo release of warehouse-models (V.6.0.0), you will to need to provide a value for locale as part of the argument to findOne.

Build.findOne({ name: 'email', env: 'prod'}, function (err, data) { .... }); // pre 6.0.0
Build.findOne({ name: 'email', env: 'prod', locale: 'en-US' }, function (err, data) { .... }); // post 6.0.0

API

All schemas for the API documentation are written using dynamodb's notation.

The following sections contain the column/attribute mappings for each table.

Legend:

(pk) - partition-key (sk) - sort/range key

Build (build)

Represent an individual build of a package.

Column | Type | Summary ------------------ | ---------------- | ------------ key (pk) | string | ${name}!${env}!${version} env | string | What environment is this build made for (dev, test, etc.) name | string | What package has been built version | string | What version of a package does this build represent buildId | string | A build's unique id previousBuildId | string | Hold a reference to the previous build id rollbackBuildIds | map | timestamp string mapped to the rollback id locale (sk) | string | What locale this was built for createDate | string | dynamodb's createdAt cdnUrl | string | URL of CDN to be used as a base for all the artifacts fingerprints | stringSet | Primary keys for build_files, represents the unique contents of the file artifacts | stringSet | fingerprint/file-name recommended | stringSet | Possible reduced set of artifacts based on a build's configuration

Build File (build_file)

Represent an individual file (unit) that is built during the build of an entire package.

Column | Type | Summary ----------------- | ----------- | ------------ fingerprint (pk) | string | The actual fingerprint of a file, like a md5 hash etc. buildId | string | The build_id associated with the build file url | string | CDN URL for the build_file createDate | string | dynamodb's createdAt env | string | What environment is this file built for locale | string | What locale was this file built for name | string | Name of a built file version | string | Version of the package the file is built for extension | string | .js, .css. resource type extension filename | string | given filename for the build-file

Build Head (build_head)

Represent the head build version of an entire package. On an npm install, the env will have to be passed in.

Column | Type | Summary ------------------ | ---------------- | ------------ key (pk) | string | ${name}!${env}!${version} name | string | What package has been build env | string | What environment is this build made for (dev, test, etc.) buildId | string | A build's unique id previousBuildId | string | Hold a reference to the previous build id rollbackBuildIds | map | timestamp string mapped to the rollback id createDate | string | dynamodb's createdAt udpateDate | string | dynamodb's updatedAt version | string | What version of a package does this build represent locale (sk) | string | What locale this was built for cdnUrl | string | URL of CDN to be used as a base for all the artifacts fingerprints | stringSet | Primary keys for build_files, represents the unique contents of the file artifacts | stringSet | fingerprint/file-name recommended | stringSet | Possible reduced set of artifacts based on a build's configuration

Dependent (dependent)

A dependency graph where every packaged publish can ensure that any package that depends on it can be updated. This should constantly be updated on every publish.

Column | Type | Summary ---------------- | ------------- | ------------ name (pk) | string | Name of a package dependents | stringSet | Name of packages are dependent on me

Dependent Of (dependent_of)

An inverse of dependent in order for a dependent package to see what its parent is.

Column | Type | Summary ---------------- | ------------- | ------------ pkg (pk) | string | Name of a package dependentOf | string | Name of the parent package

Release Line (release_line)

Represent all the necessary information for a given package/version to know what needs to be deployed, considering all its dependents as well. (When combined with Release Line Dependents)

Column | Type | Summary ----------------- | ----------- | ------------ key (pk) | string | ${pkg}!${version} pkg | string | Name of a package version | string | The current version number or latest previousVersion | string | The previous version number

Release Line Dependents (release_line_dep)

Represent all the necessary information for a given package/version to know what needs to be deployed, considering all its dependents as well. (When combined with Release Line)

Column | Type | Summary ----------------- | ----------- | ------------ key (pk) | string | ${pkg}!${version} pkg | string | Name of a package version | string | The current version number previousVersion | string | The previous version number dependent (sk) | string | The dependent package dependentVersion | string | The dependent package version

Release Line Head (release_line_head)

Represents the head release-line for a given package.

Column | Type | Summary ----------------- | ----------- | ------------ pkg (pk) | string | Name of a package previousVersion | string | The previous version number version | string | The current version number

Version (version)

Records of every npm publish of a package to the registry. Mostly needed for npm install from the builder, as it will npm install a specific tag. That tag will be tied to a specific version (look at the package table). A lookup will occur against the version table afterwards to send down the package.json.

Column | Type | Summary ---------------- | ----------- | ------------ name (pk) | string | Name of a package version (sk) | string | Version of a package value | string | Full json sent of an npm publish

Package (package)

Represent an entire published packaged (package.json) to the registry. Because the number of properties in package.json could be infinite, only relevant columns are described.

Examples of package.json

Column | Type | Summary -------------------- | --------------- | ------------ name (pk) | string | Name of a package version | string | Version of a package description | string | Package description main | string | Export file of a package gitHead | string | HEAD git sha of package extended | map | object of any other properties we have keywords | stringSet | package.json keywords array bundledDependencies | stringSet | any bundled dependencies of a package distTags | map | Mapping of tag to version e.g. { "production": "1.1.0" } envs | map | ? metadata | map | ? config | map | Specific configuration for package repository | map | Repo config of package.json dependencies | map | Deps of package devDependencies | map | DevDeps of package peerDependencies | map | peerDeps of package optionalDependencies | map | any optional dependencies

Test

Ensure you have localstack running local.

npm test