Gathering detailed insights and metrics for seneca-entity
Gathering detailed insights and metrics for seneca-entity
npm install seneca-entity
Typescript
Module System
Min. Node Version
Node Version
NPM Version
82.1
Supply Chain
99.2
Quality
82.7
Maintenance
100
Vulnerability
98.9
License
JavaScript (56.25%)
TypeScript (43.75%)
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Total Downloads
767,655
Last Day
1,159
Last Week
4,271
Last Month
20,428
Last Year
274,835
MIT License
13 Stars
266 Commits
15 Forks
6 Watchers
8 Branches
10 Contributors
Updated on Jul 20, 2024
Minified
Minified + Gzipped
Latest Version
28.1.0
Package Id
seneca-entity@28.1.0
Unpacked Size
138.58 kB
Size
33.69 kB
File Count
23
NPM Version
10.2.4
Node Version
20.11.1
Published on
Jul 15, 2024
Cumulative downloads
Total Downloads
Last Day
28.8%
1,159
Compared to previous day
Last Week
1.8%
4,271
Compared to previous week
Last Month
-18.9%
20,428
Compared to previous month
Last Year
297.9%
274,835
Compared to previous year
2
2
Seneca Entity is a plugin for Seneca
Provides a simple Object-Relation Mapping over Seneca messages as a convenience API for manipulating data.
Any data store can then be accessed using the full power of Seneca messages.
![]() | This open source module is sponsored and supported by Voxgig. |
---|
With npm:
$ npm install seneca-entity
With yarn:
$ yarn add seneca-entity
Implemented using TypeScript. Minimal types are provided by the package.
Please visit senecajs.org for a more complete overview and documentation of the Seneca framework.
Read the Understanding Data Entities tutorial for a step-by-step introduction to Seneca data entities.
1const Seneca = require('seneca')
2
3const seneca = Seneca() // Create a new instance of Seneca.
4 .use('entity') // Use the seneca-entity plugin (Seneca will require it).
5
6// Create an reusable instance of the `person` entity.
7const Person = seneca.entity('person')
8
9// Create a specific person instance.
10let alice = Person.make$()
11
12// Set some fields (assumes a NoSQL database, or a predefined table).
13// Properties with a final `$` are reserved for the Entity API methods.
14alice.name = 'Alice'
15alice.location = 'Wonderland'
16
17// Save your data. Seneca entity provides a default in-memory store,
18// which is very useful for fast unit tests.
19alice = await alice.save$()
20
21// The `alice` entity now has an `id` field.
22let alsoAlice = await Person.load$(alice.id)
23alsoAlice.location = 'Looking Glass'
24
25// The `alsoAlice` entity will be updated, not created, because
26// it has an `id` field. The save$ method both creates and updates.
27await alsoAlice.save$()
28
29// Entity methods can be chained (until they return a Promise).
30let lily = await Person
31 .make$({
32 name: 'Lily',
33 location: 'Looking Glass'
34 })
35 .save$()
36
37// The data$ method exports a JSON serializable verson of the entity
38// as a plain object.
39console.log(lily.data$())
40
41// The data$ method can alternatively set multiple fields.
42await lily
43 .data$({
44 game: 'chess'
45 })
46 .save$()
47
48// List all the person entities.
49let people = await Person.list$()
50
51// List only those person entities with field `game` equal to the string "chess".
52let players = await Person.list$({game: 'chess'})
Seneca Entity is inspired in part by the ActiveRecord pattern as implemented by Ruby on Rails.
Seneca Entity is not a full Object Relation Mapping. It is a convenience API over the Seneca action patterns:
role:entity,cmd:load
- .load$()
role:entity,cmd:save
- .save$()
role:entity,cmd:list
- .list$()
role:entity,cmd:remove
- .remove$()
This means that you can extend the "ORM" using the same message manipulation as with all Seneca messages, including sending them over the network to other microservices.
In particular, you can:
seneca.message('role:entity,cmd:save,name:person', async function(msg) { ... })
BUT, Seneca entity does not natively implement relations, and loads only the top level entity. Since relation mapping often leads to inefficient queries, this is not such a bad thing. When relations are needed, you can implement them manually by customizing the appropriate action patterns. Or you may find that denormalizing your data is more fun than you think.
Copyright (c) 2012-2022, Richard Rodger and other contributors. Licensed under MIT.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-03-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More