6.0.2 • Published 4 years ago

warehouse-models v6.0.2

Weekly downloads
11
License
MIT
Repository
github
Last release
4 years ago

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.

ColumnTypeSummary
key (pk)string${name}!${env}!${version}
envstringWhat environment is this build made for (dev, test, etc.)
namestringWhat package has been built
versionstringWhat version of a package does this build represent
buildIdstringA build's unique id
previousBuildIdstringHold a reference to the previous build id
rollbackBuildIdsmaptimestamp string mapped to the rollback id
locale (sk)stringWhat locale this was built for
createDatestringdynamodb's createdAt
cdnUrlstringURL of CDN to be used as a base for all the artifacts
fingerprintsstringSetPrimary keys for build_files, represents the unique contents of the file
artifactsstringSetfingerprint/file-name
recommendedstringSetPossible 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.

ColumnTypeSummary
fingerprint (pk)stringThe actual fingerprint of a file, like a md5 hash etc.
buildIdstringThe build_id associated with the build file
urlstringCDN URL for the build_file
createDatestringdynamodb's createdAt
envstringWhat environment is this file built for
localestringWhat locale was this file built for
namestringName of a built file
versionstringVersion of the package the file is built for
extensionstring.js, .css. resource type extension
filenamestringgiven 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.

ColumnTypeSummary
key (pk)string${name}!${env}!${version}
namestringWhat package has been build
envstringWhat environment is this build made for (dev, test, etc.)
buildIdstringA build's unique id
previousBuildIdstringHold a reference to the previous build id
rollbackBuildIdsmaptimestamp string mapped to the rollback id
createDatestringdynamodb's createdAt
udpateDatestringdynamodb's updatedAt
versionstringWhat version of a package does this build represent
locale (sk)stringWhat locale this was built for
cdnUrlstringURL of CDN to be used as a base for all the artifacts
fingerprintsstringSetPrimary keys for build_files, represents the unique contents of the file
artifactsstringSetfingerprint/file-name
recommendedstringSetPossible 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.

ColumnTypeSummary
name (pk)stringName of a package
dependentsstringSetName 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.

ColumnTypeSummary
pkg (pk)stringName of a package
dependentOfstringName 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)

ColumnTypeSummary
key (pk)string${pkg}!${version}
pkgstringName of a package
versionstringThe current version number or latest
previousVersionstringThe 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)

ColumnTypeSummary
key (pk)string${pkg}!${version}
pkgstringName of a package
versionstringThe current version number
previousVersionstringThe previous version number
dependent (sk)stringThe dependent package
dependentVersionstringThe dependent package version

Release Line Head (release_line_head)

Represents the head release-line for a given package.

ColumnTypeSummary
pkg (pk)stringName of a package
previousVersionstringThe previous version number
versionstringThe 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.

ColumnTypeSummary
name (pk)stringName of a package
version (sk)stringVersion of a package
valuestringFull 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

ColumnTypeSummary
name (pk)stringName of a package
versionstringVersion of a package
descriptionstringPackage description
mainstringExport file of a package
gitHeadstringHEAD git sha of package
extendedmapobject of any other properties we have
keywordsstringSetpackage.json keywords array
bundledDependenciesstringSetany bundled dependencies of a package
distTagsmapMapping of tag to version e.g. { "production": "1.1.0" }
envsmap?
metadatamap?
configmapSpecific configuration for package
repositorymapRepo config of package.json
dependenciesmapDeps of package
devDependenciesmapDevDeps of package
peerDependenciesmappeerDeps of package
optionalDependenciesmapany optional dependencies

Test

Ensure you have localstack running local.

npm test
6.0.2

4 years ago

6.0.1

4 years ago

6.0.0

4 years ago

5.9.1

5 years ago

5.9.0

6 years ago

5.8.0

6 years ago

5.7.0

6 years ago

5.6.0

7 years ago

5.5.0

7 years ago

5.4.0

7 years ago