Data model of the konsumation apps
- AttributeDefinition
- description
- name
- id
- unit
- unit
- schemaVersion
- serial
- validFrom
- fractionalDigits
- fractionalDigits
- order
- value
- date
- isAggregating
- Base
- Category
- SCHEMA_VERSION_2
- SCHEMA_VERSION_3
- SCHEMA_VERSION_CURRENT
- Master
- Meter
- Note
- toText
- Value
Type: Object
type
stringregex
RegExp?isKey
booleanisForeign
boolean do we represent a foreign entitywritable
booleanmandatory
booleandefault
any? the default value
Type: AttributeDefinition
Type: AttributeDefinition
Type: AttributeDefinition
Type: AttributeDefinition
Returns string
Type: string?
Type: AttributeDefinition
Type: AttributeDefinition
Type: AttributeDefinition
Type: AttributeDefinition
Type: number?
Type: AttributeDefinition
Type: AttributeDefinition
Type: AttributeDefinition
Type: AttributeDefinition
Is the given attribute defined in the target. Some attributes are inherited from parent object and therfore not defined in the target.
name
string
Returns boolean
Object keys are the mapped external attribute names.
mapping
Returns Object
Object keys are the mapped external attribute names but only for local (not isForeign) ones.
mapping
Returns Object
Sets values with external attribute names.
values
Object
Returns string
Attribute definitions.
Returns Object
Maping of attribute names from internal (javascript) to external (database).
Returns Object
Extends Base
Value Category.
attributes
Object
Type: string
Type: string?
Type: number?
Type: string?
Type: string?
Write into store.
context
any
Delete Category from store.
context
any
List assigned meters.
-
context
any -
options
Object?
Returns AsyncIterable<Meter>
Deliver Meter for a given name.
context
anyname
string
Returns Promise<(Meter | undefined)>
Currently active Meter.
context
anycreate
boolean Meter if none exist (optional, defaultfalse
)
Returns Promise<(Meter | undefined)>
Add a meter to the category;
-
context
any -
attributes
Object
Returns Meter
Delete a meter.
context
anyname
string
Returns Promise<any>
All notes from all meters.
context
any
Returns AsyncIterable<Note>
Deliver Value for a given date.
context
anyname
string
Returns Promise<(Note | undefined)>
All values from all meters.
context
any
Returns AsyncIterable<Value>
Deliver Value for a given date.
context
anydate
Date
Returns Promise<(Value | undefined)>
Get the latest value.
context
any
Returns Promise<({date: Date, value: number} | undefined)>
Add a value to the active meter.
Returns Promise<any>
Delete a value from the active meter.
context
anydate
Date
Returns Promise<any>
Text representation.
context
any
Returns AsyncIterable<string>
Name of the type in text dump
Returns string
Schema with type + name
Type: string
Values are attached to the meter. Value dates may be given as iso date.
Type: string
Schema version for newly created databases
Extends Base
values
schemaVersion
string
Query for one item.
-
query
Object
Returns Promise<(Category | Meter | Note | Value | undefined)>
Query for several items.
-
query
Object
Returns AsyncIterable<(Category | Meter | Note | Value)>
Write attributes store.
context
any
Shut down backend store.
Add a category.
-
context
any -
attributes
Object
Returns Category
context
any
Returns AsyncIterable<Category>
context
anyname
string
Returns Promise<(Category | undefined)>
Create text representation
context
(optional, defaultthis.context
)
Returns AsyncIterable<string>
input
AsyncIterable<Uint8Array>
Extends Base
attributes
Object
Type: string
Type: Category
Type: string?
Type: string?
Type: Date
Type: boolean
context
any
context
any
context
any
Returns AsyncIterable<Value>
Deliver value for a given date.
context
anydate
Date
Returns Promise<(Value | undefined)>
Add a new value.
Delete a value.
context
anydate
Date
Returns Promise<void>
Get the latest value.
context
any
Returns Promise<(Value | undefined)>
List assigned Notes.
context
anyoptions
Object?
Returns AsyncIterable<Note>
Deliver Note for a given name.
context
anyname
string
Returns Promise<(Note | undefined)>
Add a note to the meter;
-
context
any -
attributes
Object
Returns Note
delete a note.
context
anyname
string
Returns Promise<void>
Text representation.
context
any
Returns AsyncIterable<string>
Name of the type in text dump.
Returns string
Name of the parents type.
Returns string
Extends Base
attributes
Object
Type: string
Type: string?
Type: Meter
Write into store.
context
any
Delete from store.
context
any
Text representation.
context
any
Returns AsyncIterable<string>
Name of the type in text dump.
Returns string
Name of the parents type.
Returns string
Text representation.
Returns AsyncIterable<string>
Extends Base
attributes
Object
Type: Meter
Type: Date
Type: number
Write into store.
context
any
Delete from store.
context
any
Text representation.
context
any
Returns AsyncIterable<string>
Name of the type in text dump
Returns string
Name of the parents type.
Returns string
With npm do:
npm install @konsumation/model
BSD-2-Clause