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

@konsumation/model

v7.1.7

Published

data model of the konsumation apps

Downloads

2,812

Readme

npm License Typed with TypeScript bundlejs downloads Build Status Styled with prettier Commitizen friendly Known Vulnerabilities

@konsumation/model

Data model of the konsumation apps

API

Table of Contents

AttributeDefinition

Type: Object

Properties

description

Type: AttributeDefinition

name

Type: AttributeDefinition

id

Type: AttributeDefinition

unit

Type: AttributeDefinition

Returns string

unit

Type: string?

schemaVersion

Type: AttributeDefinition

serial

Type: AttributeDefinition

validFrom

Type: AttributeDefinition

fractionalDigits

Type: AttributeDefinition

fractionalDigits

Type: number?

order

Type: AttributeDefinition

value

Type: AttributeDefinition

date

Type: AttributeDefinition

Base

isDefinedAttribute

Is the given attribute defined in the target. Some attributes are inherited from parent object and therfore not defined in the target.

Parameters

Returns boolean

_getAttributes

Object keys are the mapped external attribute names.

Parameters

  • mapping

Returns Object

getLocalAttributes

Object keys are the mapped external attribute names but only for local (not isForeign) ones.

Parameters

  • mapping

Returns Object

setAttributes

Sets values with external attribute names.

Parameters

type

Returns string

attributes

Attribute definitions.

Returns Object

attributeNameMapping

Maping of attribute names from internal (javascript) to external (database).

Returns Object

Category

Extends Base

Value Category.

Parameters

name

Type: string

description

Type: string?

fractionalDigits

Type: number?

unit

Type: string?

order

Type: string?

write

Write into store.

Parameters

  • context any

delete

Delete Category from store.

Parameters

  • context any

meters

List assigned meters.

Parameters

Returns AsyncIterable<Meter>

meter

Deliver Meter for a given name.

Parameters

Returns Promise<(Meter | undefined)>

activeMeter

Currently active Meter.

Parameters

  • context any

Returns Promise<(Meter | undefined)>

addMeter

Add a meter to the category;

Parameters

Returns Meter

deleteMeter

Delete a meter.

Parameters

Returns Promise<any>

notes

All notes from all meters.

Parameters

  • context any

Returns AsyncIterable<Note>

note

Deliver Value for a given date.

Parameters

Returns Promise<(Note | undefined)>

values

All values from all meters.

Parameters

  • context any

Returns AsyncIterable<Value>

value

Deliver Value for a given date.

Parameters

  • context any
  • date Date

Returns Promise<(Value | undefined)>

latestValue

Get the latest value.

Parameters

  • context any

Returns Promise<({date: Date, value: number} | undefined)>

addValue

Add a value to the active meter.

Parameters

Returns Promise<any>

deleteValue

Delete a value from the active meter.

Parameters

  • context any
  • date Date

Returns Promise<any>

text

Text representation.

Parameters

  • context any

Returns AsyncIterable<string>

type

Name of the type in text dump

Returns string

SCHEMA_VERSION_2

Schema with type + name

Type: string

SCHEMA_VERSION_3

Values are attached to the meter. Value dates may be given as iso date.

Type: string

SCHEMA_VERSION_CURRENT

Schema version for newly created databases

Master

Extends Base

Parameters

  • values

Properties

write

Write attributes store.

Parameters

  • context any

close

addCategory

Add a category.

Parameters

Returns Category

categories

Parameters

  • context any

Returns AsyncIterable<Category>

category

Parameters

Returns Promise<(Category | undefined)>

text

Create text representation

Parameters

  • context (optional, default this.context)

Returns AsyncIterable<string>

fromText

Parameters

Returns Promise<Object>

initialize

Parameters

Returns Promise<Master>

Meter

Extends Base

Parameters

name

Type: string

category

Type: Category

description

Type: string?

serial

Type: string?

validFrom

Type: Date

write

Parameters

  • context any

delete

Parameters

  • context any

values

Parameters

  • context any

Returns AsyncIterable<Value>

value

Deliver value for a given date.

Parameters

  • context any
  • date Date

Returns Promise<(Value | undefined)>

addValue

Add a new value.

Parameters

Returns Promise<Value>

deleteValue

Delete a value.

Parameters

  • context any
  • date Date

Returns Promise<void>

latestValue

Get the latest value.

Parameters

  • context any

Returns Promise<(Value | undefined)>

notes

List assigned Notes.

Parameters

Returns AsyncIterable<Note>

note

Deliver Note for a given name.

Parameters

Returns Promise<(Note | undefined)>

addNote

Add a note to the meter;

Parameters

Returns Note

deleteNote

delete a note.

Parameters

Returns Promise<void>

text

Text representation.

Parameters

  • context any

Returns AsyncIterable<string>

type

Name of the type in text dump.

Returns string

parentType

Name of the parents type.

Returns string

Note

Extends Base

Parameters

name

Type: string

description

Type: string?

meter

Type: Meter

write

Write into store.

Parameters

  • context any

delete

Delete from store.

Parameters

  • context any

text

Text representation.

Parameters

  • context any

Returns AsyncIterable<string>

type

Name of the type in text dump.

Returns string

parentType

Name of the parents type.

Returns string

toText

Text representation.

Parameters

  • context any
  • object Base
  • key string?
  • iterators ...any

Returns AsyncIterable<string>

Value

Extends Base

Parameters

meter

Type: Meter

date

Type: Date

value

Type: number

write

Write into store.

Parameters

  • context any

delete

Delete from store.

Parameters

  • context any

text

Text representation.

Parameters

  • context any

Returns AsyncIterable<string>

type

Name of the type in text dump

Returns string

parentType

Name of the parents type.

Returns string

install

With npm do:

npm install @konsumation/model

license

BSD-2-Clause