warehouse.ai-status-models
v2.0.3
Published
models for warehouse.ai-status-api
Downloads
24
Readme
warehouse.ai-status-models
Datastar models for the Warehouse.ai-status-api.
Install
npm install warehouse.ai-status-models --save
Usage
const dynamoClient = new AWS.DynamoDB({ /* connection config */ });
const dynamodb = require('dynamodb');
dynamodb.dynamoDriver(dynamoClient);
const models = require('warehouse.ai-status-models')(dynamodb);
// from dynastar.define we get...
const Status = models.Status;
Status.findOne({ ... }).then(res => { ... }).catch(err => { ... });
API
All schemas for the API documentation are written using Joi notation.
Schemas
Status (Status
)
Generic status information
Column | Type | Summary ------------------ | ---------------- | ------------ pkg (pk) | string | Name of a package env (pk) | string | What environment is this build made for (dev, test, etc.) version (pk) | string | What version of a package does this status represent previousVersion | string | The previous version number total | number | Total progress as percentage error | boolean | Did the build error createdAt | timestamp | Time of creation updatedAt | timestamp | Time of last update complete | boolean | Did the build complete
StatusHead (StatusHead
)
Generic status information but just for he latest version for a given
pkg
and env
. Refer to the table above for details. The properties
error
and complete
do not exist on this table.
StatusEvent (StatusEvent
)
A detailed event for the various stages of a build process containing message
and optional details
properties as well as locale
and whether it is and
error or not.
Column | Type | Summary ------------------ | ---------------- | ------------ pkg (pk) | string | Name of a package env (pk) | string | What environment is this build made for (dev, test, etc.) version (pk) | string | What version of a package does this status represent locale | string | Build locale error | boolean | Is the status event an error message | string | Status message details | string | Message details createdAt | timestamp | Time of creation eventId | string (timeUUID)| Unique id sortable by time
StatusCounter (StatusCounter
)
A simple distributed counter model that is incremented when a locale
build
has completed in order to compute progress based on total amount of locales
.
Column | Type | Summary ------------------ | ---------------- | ------------ pkg (pk) | string | Name of a package env (pk) | string | What environment is this build made for (dev, test, etc.) version (pk) | string | What version of a package does this status represent count | counter | Incrementable counter
Test
Before running tests, spin up an instance of localstack by running
npm run localstack
Then run:
npm test