Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@konsumation/model

Package Overview
Dependencies
Maintainers
0
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@konsumation/model

data model of the konsumation apps

  • 7.1.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
413
decreased by-8.83%
Maintainers
0
Weekly downloads
 
Created
Source

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

  • type string
  • regex RegExp?
  • isKey boolean
  • isForeign boolean do we represent a foreign entity
  • writable boolean
  • mandatory boolean
  • default any? the default value

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

one

Query for one item.

Parameters

Returns Promise<(Category | Meter | Note | Value | undefined)>

all

Query for several items.

Parameters

Returns AsyncIterable<(Category | Meter | Note | Value)>

write

Write attributes store.

Parameters
  • context any

close

Shut down backend store.

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

FAQs

Package last updated on 02 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc