@seneca/entity-util

Collection of optional utilities for Seneca entities.

Usage no npm install needed!

<script type="module">
  import senecaEntityUtil from 'https://cdn.skypack.dev/@seneca/entity-util';
</script>

README

seneca-entity-util

Npm Travis Coveralls DeepScan grade Maintainability devDependencies Status

Utilities for Seneca entities.

  • rtag: random revision tags generated per save; provides support for complex object caching.
  • archive: archival of deleted entities.
  • when: injection of created and modified time stamps
  • duration: injection of entity action duration times in results as meta data

Install

$ npm install seneca-entity-util seneca-promisify

Options

  • rtag.active : boolean false
  • rtag.field : string "rtag"
  • rtag.len : number 17
  • rtag.annotate : boolean true
  • rtag.stats : boolean true
  • rtag.clone_before_hydrate : boolean true
  • when.active : boolean false
  • when.field_created : string "t_c"
  • when.field_modified : string "t_m"
  • duration.active : boolean false
  • duration.annotation : string "dquot;
  • duration.stats : boolean true
  • archive.active : boolean false
  • archive.entity : string "sys/archive"
  • archive.custom_props : array
  • derive.active : boolean false

Set plugin options when loading with:



seneca.use('entity-util', { name: value, ... })


Note: foo.bar in the list above means { foo: { bar: ... } }

Action Patterns

Action Descriptions

« role:cache,resolve:rtag »

Use rtag to load cached version of expensive result.

Parameters

  • space : string " "
  • key : string " "
  • rtag : string " "
  • resolver : function " "

« role:cache,stats:rtag »

Get rtag cache usage statistics.


« role:entity,cmd:list »

No description provided.


« role:entity,cmd:load »

No description provided.


« role:entity,cmd:remove »

No description provided.


« role:entity,cmd:save »

Override role:entity,cmd:save to apply utilities.


« sys:entity,derive:add »

No description provided.


« sys:entity,derive:list »

No description provided.